Changeset 27435 for trunk/Ohana/src/libfits/matrix/F_read_segment.c
- Timestamp:
- Mar 24, 2010, 11:22:25 AM (16 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/libfits/matrix/F_read_segment.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
-
Property svn:mergeinfo
set to
/branches/eam_branches/20091201/Ohana merged eligible /branches/eam_branches/largefiles.20100314/Ohana merged eligible
-
Property svn:mergeinfo
set to
-
trunk/Ohana/src/libfits/matrix/F_read_segment.c
r16139 r27435 36 36 int gfits_fread_matrix_segment (FILE *f, Matrix *matrix, Header *header, char *region) { 37 37 38 int status, i, nbytes, Nbytes, Nskip, NbytesData; 38 int status; 39 off_t i, nbytes, Nbytes, Nskip, NbytesData; 39 40 int wantaxis[FT_MAX_NAXES][2]; 40 41 double tmp; … … 65 66 matrix[0].Naxis[i] = wantaxis[i][1] - wantaxis[i][0]; 66 67 67 matrix[0]. size = abs (matrix[0].bitpix) / 8;68 matrix[0].datasize = abs (matrix[0].bitpix) / 8; 68 69 for (i = 0; i < matrix[0].Naxes; i++) 69 matrix[0]. size *= matrix[0].Naxis[i];70 matrix[0].datasize *= matrix[0].Naxis[i]; 70 71 71 72 Nskip = wantaxis[2][0]*matrix[0].Naxis[0]*matrix[0].Naxis[1]*abs(matrix[0].bitpix)/8; 72 NbytesData = Nskip + matrix[0]. size;73 NbytesData = Nskip + matrix[0].datasize; 73 74 74 75 if (NbytesData % FT_RECORD_SIZE) 75 Nbytes = FT_RECORD_SIZE * (( int) (NbytesData / FT_RECORD_SIZE) + 1) - Nskip;76 Nbytes = FT_RECORD_SIZE * ((off_t) (NbytesData / FT_RECORD_SIZE) + 1) - Nskip; 76 77 else 77 Nbytes = FT_RECORD_SIZE * (( int) (NbytesData / FT_RECORD_SIZE)) - Nskip;78 Nbytes = FT_RECORD_SIZE * ((off_t) (NbytesData / FT_RECORD_SIZE)) - Nskip; 78 79 79 80 ALLOCATE (matrix[0].buffer, char, MAX (Nbytes, 1)); … … 86 87 87 88 /* currently only good for reading in full planes in 3-D */ 88 fseek (f, Nskip, SEEK_CUR);89 fseeko (f, Nskip, SEEK_CUR); 89 90 nbytes = fread (matrix[0].buffer, sizeof(char), Nbytes, f); 90 91 if (nbytes != Nbytes) { … … 92 93 } 93 94 94 matrix[0]. size = Nbytes;95 matrix[0].datasize = Nbytes; 95 96 96 97 # ifdef BYTE_SWAP … … 147 148 148 149 if (nbytes < Nbytes - 2880) { /* this is a bad FITS error: image is not OK */ 149 fprintf (stderr, "error reading in matrix data from FITS file (% d < %d - 2880)\n", nbytes,Nbytes);150 fprintf (stderr, "error reading in matrix data from FITS file (%lld < %lld - 2880)\n", (long long) nbytes, (long long) Nbytes); 150 151 return (FALSE); 151 152 } 152 153 if (nbytes != Nbytes) { /* this is a FITS error, but often the image is OK */ 153 fprintf (stderr, "incomplete block in FITS file: (% d, %d)\n", nbytes,Nbytes);154 fprintf (stderr, "incomplete block in FITS file: (%lld, %lld)\n", (long long) nbytes, (long long) Nbytes); 154 155 return (TRUE); 155 156 }
Note:
See TracChangeset
for help on using the changeset viewer.
