- Timestamp:
- May 28, 2015, 8:27:00 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ohana.20150429/src/libfits/table/F_read_T.c
r37807 r38329 45 45 if (Nread < gfits_data_min_size (table[0].header)) { 46 46 fprintf (stderr, "error: fits read error in %s, read "OFF_T_FMT", need "OFF_T_FMT"\n", __func__, Nread, gfits_data_min_size (table[0].header)); 47 if (padIfShort) { 48 memset (&table[0].buffer[Nread], 0, Nbytes - Nread); 49 fprintf (stderr, "warning: file missing data, padding with zeros: USE AT YOUR OWN RISK!\n"); 50 table[0].validsize = Nread; 51 table[0].datasize = Nbytes; 52 return (TRUE); 53 } else { 54 gfits_free_table (table); 47 if (!padIfShort) { 48 gfits_free_table (table); 55 49 return (FALSE); 56 50 } 57 } 58 fprintf (stderr, "warning: file missing pad\n"); 51 memset (&table[0].buffer[Nread], 0, Nbytes - Nread); 52 fprintf (stderr, "warning: file missing data, padding with zeros: USE AT YOUR OWN RISK!\n"); 53 } else { 54 fprintf (stderr, "warning: file missing pad\n"); 55 } 59 56 } 60 57 table[0].validsize = Nread; 61 58 table[0].datasize = Nbytes; 59 table[0].heap_start = gfits_heap_start (table->header); 62 60 return (TRUE); 63 61 } … … 93 91 } 94 92 fprintf (stderr, "error: fits read error in %s, read "OFF_T_FMT", need "OFF_T_FMT"\n", __func__, Nread, Nbytes); 95 if (padIfShort) { 96 memset (&table[0].buffer[Nread], 0, Nbytes - Nread); 97 fprintf (stderr, "warning: file missing data, padding with zeros: USE AT YOUR OWN RISK!\n"); 98 table[0].validsize = Nread; 99 table[0].datasize = Nbytes; 100 } else { 93 if (!padIfShort) { 101 94 free (table[0].buffer); 102 95 return (FALSE); 103 96 } 97 memset (&table[0].buffer[Nread], 0, Nbytes - Nread); 98 fprintf (stderr, "warning: file missing data, padding with zeros: USE AT YOUR OWN RISK!\n"); 104 99 } 105 100 … … 107 102 table[0].header[0].Naxis[1] = Nrows; 108 103 gfits_modify (table[0].header, "NAXIS2", OFF_T_FMT, 1, Nrows); 109 table[0].datasize = gfits_data_size (table[0].header); 104 table[0].validsize = Nread; 105 table[0].datasize = Nbytes; 106 table[0].heap_start = gfits_heap_start (table->header); 110 107 111 108 return (TRUE); … … 122 119 Ny = table[0].header[0].Naxis[1]; 123 120 table[0].datasize = gfits_data_size (table[0].header); 121 // table[0].heap_start = gfits_heap_start (table[0].header); 124 122 table[0].pad = table[0].datasize - Nx*Ny; 125 123 … … 206 204 for (i = 0; i < Nrow; i++) table[0].row[i] = row[i]; 207 205 table[0].datasize = gfits_data_size (table[0].header); 206 // table[0].heap_start = gfits_heap_start (table[0].header); 208 207 table[0].pad = table[0].datasize - Nx*Ny; 209 208 return (TRUE);
Note:
See TracChangeset
for help on using the changeset viewer.
