IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 14, 2010, 2:09:00 PM (16 years ago)
Author:
eugene
Message:

better check for valid BYTE_SWAP setting; add support for PS1_V3 format cmf files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100823/Ohana/src/libautocode/def/autocode.c

    r29001 r29412  
    2525}
    2626
    27 $STRUCT *gfits_downsize_and_convert_$STRUCT ($STRUCT *data, off_t size, off_t nitems) {
    28 
    29   off_t i;
    30   unsigned char *byte, tmp;
    31   $STRUCT *output;
    32 
    33   if ($SIZE > size) {
    34     fprintf (stderr, "ERROR: uncorrectable mismatch in data types $STRUCT: "OFF_T_FMT" vs %d\n",  size,  $SIZE);
    35     exit (1);
    36   }
    37 
    38   // allocate a new array
    39   ALLOCATE (output, $STRUCT, nitems);
    40   for (i = 0; i < nitems; i++) {
    41     memcpy (&output[i], &data[i], $SIZE);
    42   }
    43 
    44   /* provide initial values to avoid compiler warnings for non-BYTE_SWAP arch */
    45   i = tmp = 0;
    46   byte = NULL;
    47 
    48 # ifdef BYTE_SWAP
    49   byte = (unsigned char *) output;
    50   for (i = 0; i < nitems; i++, byte += size) {
    51     /** BYTE SWAP **/
    52   }
    53 # endif 
    54 
    55   return (output);
    56 }
    57 
    5827/*** add test of EXTNAME and header-defined columns? ***/
    5928/* return internal structure representation */
     
    6130
    6231  int Ncols;
    63   $STRUCT *data, *output;
     32  $STRUCT *data;
    6433
    6534  Ncols = ftable[0].header[0].Naxis[0];
     
    7342  if ((swapped == NULL) || (*swapped == FALSE)) {
    7443    if (!gfits_convert_$STRUCT (data, sizeof ($STRUCT), *Ndata)) {
    75       output = gfits_downsize_and_convert_$STRUCT (data, sizeof ($STRUCT), *Ndata);
    76       free (ftable[0].buffer);
    77       ftable[0].buffer = (char *) output;
    78       // XXX do I need to change NX?
     44      return NULL;
    7945    }
    8046    gfits_table_scale_data (ftable);
Note: See TracChangeset for help on using the changeset viewer.