Changeset 15751
- Timestamp:
- Dec 6, 2007, 3:42:40 PM (18 years ago)
- Location:
- trunk/Ohana/src/libfits
- Files:
-
- 5 edited
-
header/F_read_H.c (modified) (1 diff)
-
include/gfitsio.h (modified) (1 diff)
-
matrix/F_load_M.c (modified) (1 diff)
-
matrix/F_matrix.c (modified) (1 diff)
-
table/F_read_T.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libfits/header/F_read_H.c
r15743 r15751 35 35 sizeof(char), FT_RECORD_SIZE, f); 36 36 if (Nbytes != FT_RECORD_SIZE) { 37 if (feof(f)) return (FALSE); 37 38 perror ("fits read error"); 39 return (FALSE); 38 40 } 39 41 40 42 header[0].size += Nbytes; 41 if (Nbytes != FT_RECORD_SIZE) { 42 return (FALSE); 43 } 43 44 44 if (i == 0) { 45 45 /* on first block, verify it is a FITS table: SIMPLE .. or XTENSION ... */ -
trunk/Ohana/src/libfits/include/gfitsio.h
r15743 r15751 128 128 int gfits_write_header PROTO((char *filename, Header *header)); 129 129 int gfits_data_size PROTO((Header *header)); 130 int gfits_data_min_size PROTO((Header *header)); 130 131 int gfits_extended_to_primary PROTO((Header *header, int simple, char *comment)); 131 132 int gfits_primary_to_extended PROTO((Header *header, char *exttype, char *comment)); -
trunk/Ohana/src/libfits/matrix/F_load_M.c
r15743 r15751 31 31 nbytes = fread (matrix[0].buffer, sizeof(char), Nbytes, f); 32 32 if (nbytes != Nbytes) { 33 perror ("fits matrix read error"); 33 perror ("FITS file is short in ##__func__"); 34 if (nbytes != gfits_data_min_size (header)) { 35 fprintf (stderr, "error: fits read error in %s", __func__); 36 return (FALSE); 37 } 38 fprintf (stderr, "warning: file missing pad\n"); 34 39 } 35 40 -
trunk/Ohana/src/libfits/matrix/F_matrix.c
r15487 r15751 24 24 return (size); 25 25 } 26 27 int gfits_data_min_size (Header *header) { 28 29 int i, size; 30 31 if (header[0].Naxes == 0) return (0); 32 33 size = abs(header[0].bitpix / 8); 34 35 for (i = 0; i < header[0].Naxes; i++) 36 size *= header[0].Naxis[i]; 37 38 // XXX do I multiply this times gcount? 39 size += header[0].pcount; 40 41 return (size); 42 } -
trunk/Ohana/src/libfits/table/F_read_T.c
r15743 r15751 52 52 53 53 int Nbytes, Nread; 54 char string[128]; 54 55 55 56 /* find buffer size */ … … 59 60 Nread = fread (table[0].buffer, sizeof (char), Nbytes, f); 60 61 if (Nread != Nbytes) { 61 perror ("fits read error"); 62 gfits_free_table (table); 63 return (FALSE); 62 snprintf (string, 128, "FITS file is short (%s)", __func__); 63 perror (string); 64 if (Nread < gfits_data_min_size (table[0].header)) { 65 fprintf (stderr, "error: fits read error in %s, read %d, need %d\n", __func__, Nread, gfits_data_min_size (table[0].header)); 66 gfits_free_table (table); 67 return (FALSE); 68 } 69 fprintf (stderr, "warning: file missing pad\n"); 64 70 } 65 71 table[0].size = Nbytes;
Note:
See TracChangeset
for help on using the changeset viewer.
