IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 24, 2021, 3:37:52 PM (5 years ago)
Author:
eugene
Message:

clarify in comments the buffers and pixel sizes used in the different stages of compression/uncompression; catch unimplemented compression cases; fix error in pixel size for RICE1; cleanup verbose code; use correct sscanf format code in ASCII table reading code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libfits/table/F_get_column.c

    r41433 r41474  
    403403  if (!strcmp (type, "int")) {
    404404    ALLOCATE (array, char, Ny*4);
    405     Pout = array;
    406     for (i = 0; i < Ny; i++, Pin+=Nx, Pout+=4) {
     405    int *tmpPtr = (int *)array;
     406    for (i = 0; i < Ny; i++, Pin+=Nx, tmpPtr ++) {
    407407      memcpy (line, Pin, Nval*Nbytes);
    408       sscanf (line, cformat, (int *)Pout);
     408      sscanf (line, "%d", tmpPtr);
     409      // fprintf (stderr, "test: %d %d\n", Nscan, tmpValue);
    409410    }
    410411  }
    411412  if (!strcmp (type, "int64_t")) {
    412413    ALLOCATE (array, char, Ny*8);
    413     Pout = array;
    414     for (i = 0; i < Ny; i++, Pin+=Nx, Pout+=8) {
     414    int64_t *tmpPtr = (int64_t *)array;
     415    for (i = 0; i < Ny; i++, Pin+=Nx, tmpPtr ++) {
    415416      memcpy (line, Pin, Nval*Nbytes);
    416       sscanf (line, "%" PRId64, (int64_t *)Pout);
     417      sscanf (line, "%" PRId64, tmpPtr);
    417418    }
    418419  }
    419420  if (!strcmp (type, "float")) {
    420421    ALLOCATE (array, char, Ny*4);
    421     Pout = array;
    422     for (i = 0; i < Ny; i++, Pin+=Nx, Pout+=4) {
     422    float *tmpPtr = (float *) array;
     423    for (i = 0; i < Ny; i++, Pin+=Nx, tmpPtr ++) {
    423424      memcpy (line, Pin, Nval*Nbytes);
    424       sscanf (line, cformat, (float *)Pout);
     425      sscanf (line, "%e", tmpPtr);
     426    }
     427  }
     428  if (!strcmp (type, "double")) {
     429    ALLOCATE (array, char, Ny*8);
     430    double *tmpPtr = (double *) array;
     431    for (i = 0; i < Ny; i++, Pin+=Nx, tmpPtr++) {
     432      memcpy (line, Pin, Nval*Nbytes);
     433      sscanf (line, "%le", tmpPtr);
    425434    }
    426435  }
Note: See TracChangeset for help on using the changeset viewer.