IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 12, 2015, 6:18:23 PM (11 years ago)
Author:
eugene
Message:

merge changes from EAM dev branch ohana.20150429

Location:
trunk/Ohana
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana

  • trunk/Ohana/src/libfits/table/F_set_column.c

    r37039 r38441  
    11# include <ohana.h>
    22# include <gfitsio.h>
     3
     4# define SWAP_NONE
     5
     6# ifdef BYTE_SWAP
    37# define SWAP_BYTE { \
    48  char tmp; \
     
    1418  tmp = Pout[2]; Pout[2] = Pout[5]; Pout[5] = tmp; \
    1519  tmp = Pout[3]; Pout[3] = Pout[4]; Pout[4] = tmp; }
     20# else
     21# define SWAP_BYTE
     22# define SWAP_WORD
     23# define SWAP_DBLE
     24# endif
    1625
    1726/***********************/
    1827int gfits_set_bintable_column (Header *header, FTable *table, char *label, void *data, off_t Nrow) {
    1928
    20   off_t Nx, Ny, nbytes;
     29  off_t Nx, Ny;
    2130  int i, N, Nfields;
    2231  int Nval, Nbytes, Nstart, Nv, Nb;
     
    5564  gfits_scan (header, "NAXIS1", OFF_T_FMT, 1,  &Nx);
    5665  gfits_scan (header, "NAXIS2", OFF_T_FMT, 1,  &Ny);
     66
     67  // if no rows have yet been assigned, we need to allocate the full data buffer
    5768  if (Ny == 0) {
    5869    Ny = Nrow;
    59     header[0].Naxis[1] = Ny;
    60     gfits_modify (header, "NAXIS2", OFF_T_FMT, 1,  Ny);
    61 
    62     nbytes = gfits_data_size (header);
    63     REALLOCATE (table[0].buffer, char, MAX (nbytes, 1));
    64     bzero (table[0].buffer, nbytes);
    65     table[0].datasize = nbytes;
     70    gfits_set_table_rows (header, table, Ny);
    6671  }
    6772  if (Ny != Nrow) return (FALSE);
     
    143148  }
    144149
     150  if (!strcmp (type, "var")) {
     151    for (i = 0; i < Nval*Nrow; i++, Pin+=Nbytes, Pout+=Nbytes) {
     152      *(int *)Pout = *(int *)Pin;
     153# ifdef BYTE_SWAP
     154      SWAP_WORD;
     155# endif
     156    }
     157  }
     158
     159  if (!strcmp (type, "var64")) {
     160    for (i = 0; i < Nval*Nrow; i++, Pin+=Nbytes, Pout+=Nbytes) {
     161      *(int *)Pout = *(int *)Pin;
     162# ifdef BYTE_SWAP
     163      SWAP_DBLE;
     164# endif
     165    }
     166  }
     167
    145168  /* check array space */
    146169  if (Nx*Ny < Nx*(Nrow - 1) + Nstart + Nval*Nbytes) {
     
    161184
    162185/***********************/
    163 int gfits_set_bintable_column_reformat (Header *header, FTable *table, char *label, char *intype, void *data, off_t Nrow) {
    164 
    165   off_t Nx, Ny, nbytes;
     186// convert the input data array (of the specified intype) to the desired table data type. swap unless nativeOrder is requested
     187int gfits_set_bintable_column_reformat (Header *header, FTable *table, char *label, char *intype, void *data, off_t Nrow, char nativeOrder) {
     188
     189  off_t Nx, Ny;
    166190  int i, N, Nfields;
    167191  int Nval, NbytesOut, Nstart, Nv, Nb;
     
    202226  if (Ny == 0) {
    203227    Ny = Nrow;
    204     header[0].Naxis[1] = Ny;
    205     gfits_modify (header, "NAXIS2", OFF_T_FMT, 1,  Ny);
    206 
    207     nbytes = gfits_data_size (header);
    208     REALLOCATE (table[0].buffer, char, MAX (nbytes, 1));
    209     bzero (table[0].buffer, nbytes);
    210     table[0].datasize = nbytes;
     228    gfits_set_table_rows (header, table, Ny);
    211229  }
    212230  if (Ny != Nrow) return (FALSE);
     
    230248  // if (!strcmp (intype, #ITYPE)) {
    231249
     250  int directCopy = (Bzero == 0.0) && (Bscale == 1.0);
     251
     252# define SET_VALUES(OUTNAME, OUTTYPE, INNAME, INTYPE, SWAP_OP, NBYTES_IN) \
     253  if (!strcmp (outtype, OUTNAME) && !strcmp (intype, INNAME)) {         \
     254    int NbytesIn = NBYTES_IN;                                           \
     255    for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) { \
     256      if (directCopy) {                                                 \
     257        *(OUTTYPE *)Pout = *(INTYPE *)Pin;                              \
     258      } else {                                                          \
     259        *(OUTTYPE *)Pout = (*(INTYPE *)Pin - Bzero) / Bscale;           \
     260      }                                                                 \
     261      if (!nativeOrder) { SWAP_OP; }}}                                 
     262
     263  SET_VALUES("char",       char, "char", char, SWAP_NONE, 1);
     264  SET_VALUES("byte",       char, "char", char, SWAP_NONE, 1);
     265  SET_VALUES("short",     short, "char", char, SWAP_BYTE, 1);
     266  SET_VALUES("int",         int, "char", char, SWAP_WORD, 1);
     267  SET_VALUES("int64_t", int64_t, "char", char, SWAP_DBLE, 1);
     268  SET_VALUES("float",     float, "char", char, SWAP_WORD, 1);
     269  SET_VALUES("double",   double, "char", char, SWAP_DBLE, 1);
     270
     271  SET_VALUES("char",       char, "byte", char, SWAP_NONE, 1);
     272  SET_VALUES("byte",       char, "byte", char, SWAP_NONE, 1);
     273  SET_VALUES("short",     short, "byte", char, SWAP_BYTE, 1);
     274  SET_VALUES("int",         int, "byte", char, SWAP_WORD, 1);
     275  SET_VALUES("int64_t", int64_t, "byte", char, SWAP_DBLE, 1);
     276  SET_VALUES("float",     float, "byte", char, SWAP_WORD, 1);
     277  SET_VALUES("double",   double, "byte", char, SWAP_DBLE, 1);
     278
     279  SET_VALUES("char",       char, "short", short, SWAP_NONE, 2);
     280  SET_VALUES("byte",       char, "short", short, SWAP_NONE, 2);
     281  SET_VALUES("short",     short, "short", short, SWAP_BYTE, 2);
     282  SET_VALUES("int",         int, "short", short, SWAP_WORD, 2);
     283  SET_VALUES("int64_t", int64_t, "short", short, SWAP_DBLE, 2);
     284  SET_VALUES("float",     float, "short", short, SWAP_WORD, 2);
     285  SET_VALUES("double",   double, "short", short, SWAP_DBLE, 2);
     286
     287  SET_VALUES("char",       char, "int", int, SWAP_NONE, 4);
     288  SET_VALUES("byte",       char, "int", int, SWAP_NONE, 4);
     289  SET_VALUES("short",     short, "int", int, SWAP_BYTE, 4);
     290  SET_VALUES("int",         int, "int", int, SWAP_WORD, 4);
     291  SET_VALUES("int64_t", int64_t, "int", int, SWAP_DBLE, 4);
     292  SET_VALUES("float",     float, "int", int, SWAP_WORD, 4);
     293  SET_VALUES("double",   double, "int", int, SWAP_DBLE, 4);
     294
     295  SET_VALUES("char",       char, "int64_t", int64_t, SWAP_NONE, 8);
     296  SET_VALUES("byte",       char, "int64_t", int64_t, SWAP_NONE, 8);
     297  SET_VALUES("short",     short, "int64_t", int64_t, SWAP_BYTE, 8);
     298  SET_VALUES("int",         int, "int64_t", int64_t, SWAP_WORD, 8);
     299  SET_VALUES("int64_t", int64_t, "int64_t", int64_t, SWAP_DBLE, 8);
     300  SET_VALUES("float",     float, "int64_t", int64_t, SWAP_WORD, 8);
     301  SET_VALUES("double",   double, "int64_t", int64_t, SWAP_DBLE, 8);
     302
     303  SET_VALUES("char",       char, "float", float, SWAP_NONE, 4);
     304  SET_VALUES("byte",       char, "float", float, SWAP_NONE, 4);
     305  SET_VALUES("short",     short, "float", float, SWAP_BYTE, 4);
     306  SET_VALUES("int",         int, "float", float, SWAP_WORD, 4);
     307  SET_VALUES("int64_t", int64_t, "float", float, SWAP_DBLE, 4);
     308  SET_VALUES("float",     float, "float", float, SWAP_WORD, 4);
     309  SET_VALUES("double",   double, "float", float, SWAP_DBLE, 4);
     310
     311  SET_VALUES("char",       char, "double", double, SWAP_NONE, 8);
     312  SET_VALUES("byte",       char, "double", double, SWAP_NONE, 8);
     313  SET_VALUES("short",     short, "double", double, SWAP_BYTE, 8);
     314  SET_VALUES("int",         int, "double", double, SWAP_WORD, 8);
     315  SET_VALUES("int64_t", int64_t, "double", double, SWAP_DBLE, 8);
     316  SET_VALUES("float",     float, "double", double, SWAP_WORD, 8);
     317  SET_VALUES("double",   double, "double", double, SWAP_DBLE, 8);
     318
     319# if (0)
    232320  /** input == char **/
    233321  if (!strcmp (outtype, "char") && !strcmp (intype, "char")) {
    234322    int NbytesIn = 1;
    235323    for (i = 0; i < Nval*Nrow; i++, Pin+=NbytesIn, Pout+=NbytesOut) {
    236       *(char *)Pout = (*(char *)Pin - Bzero) / Bscale;
     324      if (directCopy) { *(char *)Pout = *(char *)Pin; } else {
     325        *(char *)Pout = (*(char *)Pin - Bzero) / Bscale;
     326      }
    237327    }
    238328  }
    239329  if (!strcmp (outtype, "byte") && !strcmp (intype, "char")) {
     330    int NbytesIn = 1;
     331    for (i = 0; i < Nval*Nrow; i++, Pin+=NbytesIn, Pout+=NbytesOut) {
     332      if (directCopy) { *(char *)Pout = *(char *)Pin; } else {
     333        *(char *)Pout = (*(char *)Pin - Bzero) / Bscale;
     334      }
     335    }
     336  }
     337  if (!strcmp (outtype, "short") && !strcmp (intype, "char")) {
     338    int NbytesIn = 1;
     339    for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
     340      if (directCopy) { *(short *)Pout = *(char *)Pin; } else {
     341        *(short *)Pout = (*(char *)Pin - Bzero) / Bscale;
     342      }
     343# ifdef BYTE_SWAP
     344      if (!nativeOrder) { SWAP_BYTE; }
     345# endif
     346    } 
     347  }
     348  if (!strcmp (outtype, "int") && !strcmp (intype, "char")) {
     349    int NbytesIn = 1;
     350    for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
     351      *(int *)Pout = (*(char *)Pin - Bzero) / Bscale;
     352# ifdef BYTE_SWAP
     353      if (!nativeOrder) { SWAP_WORD; }
     354# endif
     355    }
     356  }
     357  if (!strcmp (outtype, "int64_t") && !strcmp (intype, "char")) {
     358    int NbytesIn = 1;
     359    for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
     360      *(int64_t *)Pout = (*(char *)Pin - Bzero) / Bscale;
     361# ifdef BYTE_SWAP
     362      if (!nativeOrder) { SWAP_DBLE; }
     363# endif
     364    }
     365  }
     366  if (!strcmp (outtype, "float") && !strcmp (intype, "char")) {
     367    int NbytesIn = 1;
     368    for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
     369      *(float *)Pout = (*(char *)Pin - Bzero) / Bscale;
     370# ifdef BYTE_SWAP
     371      if (!nativeOrder) { SWAP_WORD; }
     372# endif
     373    }
     374  }
     375  if (!strcmp (outtype, "double") && !strcmp (intype, "char")) {
     376    int NbytesIn = 1;
     377    for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
     378      *(double *)Pout = (*(char *)Pin - Bzero) / Bscale;
     379# ifdef BYTE_SWAP
     380      if (!nativeOrder) { SWAP_DBLE; }
     381# endif
     382    }
     383  }
     384
     385  /** input == byte **/
     386  if (!strcmp (outtype, "char") && !strcmp (intype, "byte")) {
    240387    int NbytesIn = 1;
    241388    for (i = 0; i < Nval*Nrow; i++, Pin+=NbytesIn, Pout+=NbytesOut) {
     
    243390    }
    244391  }
    245   if (!strcmp (outtype, "short") && !strcmp (intype, "char")) {
    246     int NbytesIn = 1;
    247     for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
    248       *(short *)Pout = (*(char *)Pin - Bzero) / Bscale;
    249 # ifdef BYTE_SWAP
    250       SWAP_BYTE;
    251 # endif
    252     } 
    253   }
    254   if (!strcmp (outtype, "int") && !strcmp (intype, "char")) {
    255     int NbytesIn = 1;
    256     for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
    257       *(int *)Pout = (*(char *)Pin - Bzero) / Bscale;
    258 # ifdef BYTE_SWAP
    259       SWAP_WORD;
    260 # endif
    261     }
    262   }
    263   if (!strcmp (outtype, "int64_t") && !strcmp (intype, "char")) {
    264     int NbytesIn = 1;
    265     for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
    266       *(int64_t *)Pout = (*(char *)Pin - Bzero) / Bscale;
    267 # ifdef BYTE_SWAP
    268       SWAP_DBLE;
    269 # endif
    270     }
    271   }
    272   if (!strcmp (outtype, "float") && !strcmp (intype, "char")) {
    273     int NbytesIn = 1;
    274     for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
    275       *(float *)Pout = (*(char *)Pin - Bzero) / Bscale;
    276 # ifdef BYTE_SWAP
    277       SWAP_WORD;
    278 # endif
    279     }
    280   }
    281   if (!strcmp (outtype, "double") && !strcmp (intype, "char")) {
    282     int NbytesIn = 1;
    283     for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
    284       *(double *)Pout = (*(char *)Pin - Bzero) / Bscale;
    285 # ifdef BYTE_SWAP
    286       SWAP_DBLE;
    287 # endif
    288     }
    289   }
    290 
    291   /** input == byte **/
    292   if (!strcmp (outtype, "char") && !strcmp (intype, "byte")) {
     392  if (!strcmp (outtype, "byte") && !strcmp (intype, "byte")) {
    293393    int NbytesIn = 1;
    294394    for (i = 0; i < Nval*Nrow; i++, Pin+=NbytesIn, Pout+=NbytesOut) {
     
    296396    }
    297397  }
    298   if (!strcmp (outtype, "byte") && !strcmp (intype, "byte")) {
    299     int NbytesIn = 1;
    300     for (i = 0; i < Nval*Nrow; i++, Pin+=NbytesIn, Pout+=NbytesOut) {
    301       *(char *)Pout = (*(char *)Pin - Bzero) / Bscale;
    302     }
    303   }
    304398  if (!strcmp (outtype, "short") && !strcmp (intype, "byte")) {
    305399    int NbytesIn = 1;
     
    307401      *(short *)Pout = (*(char *)Pin - Bzero) / Bscale;
    308402# ifdef BYTE_SWAP
    309       SWAP_BYTE;
     403      if (!nativeOrder) { SWAP_BYTE; }
    310404# endif
    311405    } 
     
    316410      *(int *)Pout = (*(char *)Pin - Bzero) / Bscale;
    317411# ifdef BYTE_SWAP
    318       SWAP_WORD;
     412      if (!nativeOrder) { SWAP_WORD; }
    319413# endif
    320414    }
     
    325419      *(int64_t *)Pout = (*(char *)Pin - Bzero) / Bscale;
    326420# ifdef BYTE_SWAP
    327       SWAP_DBLE;
     421      if (!nativeOrder) { SWAP_DBLE; }
    328422# endif
    329423    }
     
    334428      *(float *)Pout = (*(char *)Pin - Bzero) / Bscale;
    335429# ifdef BYTE_SWAP
    336       SWAP_WORD;
     430      if (!nativeOrder) { SWAP_WORD; }
    337431# endif
    338432    }
     
    343437      *(double *)Pout = (*(char *)Pin - Bzero) / Bscale;
    344438# ifdef BYTE_SWAP
    345       SWAP_DBLE;
     439      if (!nativeOrder) { SWAP_DBLE; }
    346440# endif
    347441    }
     
    366460      *(short *)Pout = (*(short *)Pin - Bzero) / Bscale;
    367461# ifdef BYTE_SWAP
    368       SWAP_BYTE;
     462      if (!nativeOrder) { SWAP_BYTE; }
    369463# endif
    370464    } 
     
    375469      *(int *)Pout = (*(short *)Pin - Bzero) / Bscale;
    376470# ifdef BYTE_SWAP
    377       SWAP_WORD;
     471      if (!nativeOrder) { SWAP_WORD; }
    378472# endif
    379473    }
     
    384478      *(int64_t *)Pout = (*(short *)Pin - Bzero) / Bscale;
    385479# ifdef BYTE_SWAP
    386       SWAP_DBLE;
     480      if (!nativeOrder) { SWAP_DBLE; }
    387481# endif
    388482    }
     
    393487      *(float *)Pout = (*(short *)Pin - Bzero) / Bscale;
    394488# ifdef BYTE_SWAP
    395       SWAP_WORD;
     489      if (!nativeOrder) { SWAP_WORD; }
    396490# endif
    397491    }
     
    402496      *(double *)Pout = (*(short *)Pin - Bzero) / Bscale;
    403497# ifdef BYTE_SWAP
    404       SWAP_DBLE;
     498      if (!nativeOrder) { SWAP_DBLE; }
    405499# endif
    406500    }
     
    425519      *(short *)Pout = (*(int *)Pin - Bzero) / Bscale;
    426520# ifdef BYTE_SWAP
    427       SWAP_BYTE;
     521      if (!nativeOrder) { SWAP_BYTE; }
    428522# endif
    429523    } 
     
    434528      *(int *)Pout = (*(int *)Pin - Bzero) / Bscale;
    435529# ifdef BYTE_SWAP
    436       SWAP_WORD;
     530      if (!nativeOrder) { SWAP_WORD; }
    437531# endif
    438532    }
     
    443537      *(int64_t *)Pout = (*(int *)Pin - Bzero) / Bscale;
    444538# ifdef BYTE_SWAP
    445       SWAP_DBLE;
     539      if (!nativeOrder) { SWAP_DBLE; }
    446540# endif
    447541    }
     
    452546      *(float *)Pout = (*(int *)Pin - Bzero) / Bscale;
    453547# ifdef BYTE_SWAP
    454       SWAP_WORD;
     548      if (!nativeOrder) { SWAP_WORD; }
    455549# endif
    456550    }
     
    461555      *(double *)Pout = (*(int *)Pin - Bzero) / Bscale;
    462556# ifdef BYTE_SWAP
    463       SWAP_DBLE;
     557      if (!nativeOrder) { SWAP_DBLE; }
    464558# endif
    465559    }
     
    484578      *(short *)Pout = (*(int64_t *)Pin - Bzero) / Bscale;
    485579# ifdef BYTE_SWAP
    486       SWAP_BYTE;
     580      if (!nativeOrder) { SWAP_BYTE; }
    487581# endif
    488582    } 
     
    493587      *(int *)Pout = (*(int64_t *)Pin - Bzero) / Bscale;
    494588# ifdef BYTE_SWAP
    495       SWAP_WORD;
     589      if (!nativeOrder) { SWAP_WORD; }
    496590# endif
    497591    }
     
    502596      *(int64_t *)Pout = (*(int64_t *)Pin - Bzero) / Bscale;
    503597# ifdef BYTE_SWAP
    504       SWAP_DBLE;
     598      if (!nativeOrder) { SWAP_DBLE; }
    505599# endif
    506600    }
     
    511605      *(float *)Pout = (*(int64_t *)Pin - Bzero) / Bscale;
    512606# ifdef BYTE_SWAP
    513       SWAP_WORD;
     607      if (!nativeOrder) { SWAP_WORD; }
    514608# endif
    515609    }
     
    520614      *(double *)Pout = (*(int64_t *)Pin - Bzero) / Bscale;
    521615# ifdef BYTE_SWAP
    522       SWAP_DBLE;
     616      if (!nativeOrder) { SWAP_DBLE; }
    523617# endif
    524618    }
     
    543637      *(short *)Pout = (*(float *)Pin - Bzero) / Bscale;
    544638# ifdef BYTE_SWAP
    545       SWAP_BYTE;
     639      if (!nativeOrder) { SWAP_BYTE; }
    546640# endif
    547641    } 
     
    552646      *(int *)Pout = (*(float *)Pin - Bzero) / Bscale;
    553647# ifdef BYTE_SWAP
    554       SWAP_WORD;
     648      if (!nativeOrder) { SWAP_WORD; }
    555649# endif
    556650    }
     
    561655      *(int64_t *)Pout = (*(float *)Pin - Bzero) / Bscale;
    562656# ifdef BYTE_SWAP
    563       SWAP_DBLE;
     657      if (!nativeOrder) { SWAP_DBLE; }
    564658# endif
    565659    }
     
    570664      *(float *)Pout = (*(float *)Pin - Bzero) / Bscale;
    571665# ifdef BYTE_SWAP
    572       SWAP_WORD;
     666      if (!nativeOrder) { SWAP_WORD; }
    573667# endif
    574668    }
     
    579673      *(double *)Pout = (*(float *)Pin - Bzero) / Bscale;
    580674# ifdef BYTE_SWAP
    581       SWAP_DBLE;
     675      if (!nativeOrder) { SWAP_DBLE; }
    582676# endif
    583677    }
     
    602696      *(short *)Pout = (*(double *)Pin - Bzero) / Bscale;
    603697# ifdef BYTE_SWAP
    604       SWAP_BYTE;
     698      if (!nativeOrder) { SWAP_BYTE; }
    605699# endif
    606700    } 
     
    611705      *(int *)Pout = (*(double *)Pin - Bzero) / Bscale;
    612706# ifdef BYTE_SWAP
    613       SWAP_WORD;
     707      if (!nativeOrder) { SWAP_WORD; }
    614708# endif
    615709    }
     
    620714      *(int64_t *)Pout = (*(double *)Pin - Bzero) / Bscale;
    621715# ifdef BYTE_SWAP
    622       SWAP_DBLE;
     716      if (!nativeOrder) { SWAP_DBLE; }
    623717# endif
    624718    }
     
    629723      *(float *)Pout = (*(double *)Pin - Bzero) / Bscale;
    630724# ifdef BYTE_SWAP
    631       SWAP_WORD;
     725      if (!nativeOrder) { SWAP_WORD; }
    632726# endif
    633727    }
     
    638732      *(double *)Pout = (*(double *)Pin - Bzero) / Bscale;
    639733# ifdef BYTE_SWAP
    640       SWAP_DBLE;
    641 # endif
    642     }
    643   }
     734      if (!nativeOrder) { SWAP_DBLE; }
     735# endif
     736    }
     737  }
     738# endif
    644739
    645740  /* check array space */
     
    683778int gfits_set_table_column (Header *header, FTable *table, char *label, void *data, off_t Nrow) {
    684779
    685   off_t Nx, Ny, nbytes;
     780  off_t Nx, Ny;
    686781  int i, N, Nfields, Nval, Nbytes, Nstart, Nv, Nb;
    687782  char tlabel[80], field[80], format[80], cformat[80], type[16], tmp[16];
     
    713808  if (Ny == 0) {
    714809    Ny = Nrow;
    715     header[0].Naxis[1] = Ny;
    716     gfits_modify (header, "NAXIS2", OFF_T_FMT, 1,  Ny);
    717 
    718     nbytes = gfits_data_size (header);
    719     REALLOCATE (table[0].buffer, char, MAX (nbytes, 1));
    720     bzero (table[0].buffer, nbytes);
    721     table[0].datasize = nbytes;
     810    gfits_set_table_rows (header, table, Ny);
    722811  }
    723812  if (Ny != Nrow) return (FALSE);
Note: See TracChangeset for help on using the changeset viewer.