IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 24, 2010, 11:22:25 AM (16 years ago)
Author:
eugene
Message:

large update merging in changes for Ohana to support large files

Location:
trunk/Ohana
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana

  • trunk/Ohana/src/libfits/matrix/F_read_segment.c

    r16139 r27435  
    3636int gfits_fread_matrix_segment (FILE *f, Matrix *matrix, Header *header, char *region) {
    3737
    38   int status, i, nbytes, Nbytes, Nskip, NbytesData;
     38  int status;
     39  off_t i, nbytes, Nbytes, Nskip, NbytesData;
    3940  int wantaxis[FT_MAX_NAXES][2];
    4041  double tmp;
     
    6566    matrix[0].Naxis[i] = wantaxis[i][1] - wantaxis[i][0];
    6667
    67   matrix[0].size = abs (matrix[0].bitpix) / 8;
     68  matrix[0].datasize = abs (matrix[0].bitpix) / 8;
    6869  for (i = 0; i < matrix[0].Naxes; i++)
    69     matrix[0].size *= matrix[0].Naxis[i];
     70    matrix[0].datasize *= matrix[0].Naxis[i];
    7071
    7172  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;
    7374
    7475  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;
    7677  else
    77     Nbytes = FT_RECORD_SIZE * ((int) (NbytesData / FT_RECORD_SIZE)) - Nskip;
     78    Nbytes = FT_RECORD_SIZE * ((off_t) (NbytesData / FT_RECORD_SIZE)) - Nskip;
    7879
    7980  ALLOCATE (matrix[0].buffer, char, MAX (Nbytes, 1));
     
    8687
    8788  /* currently only good for reading in full planes in 3-D */
    88   fseek (f, Nskip, SEEK_CUR);
     89  fseeko (f, Nskip, SEEK_CUR);
    8990  nbytes = fread (matrix[0].buffer, sizeof(char), Nbytes, f);
    9091  if (nbytes != Nbytes) {
     
    9293  }
    9394
    94   matrix[0].size = Nbytes;
     95  matrix[0].datasize = Nbytes;
    9596
    9697# ifdef BYTE_SWAP 
     
    147148
    148149  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);
    150151    return (FALSE);
    151152  }
    152153  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);
    154155    return (TRUE);
    155156  }
Note: See TracChangeset for help on using the changeset viewer.