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/table/F_table_varlength.c

    r18264 r27435  
    44int gfits_varlength_column_define (FTable *ftable, VarLengthColumn *def, int column) {
    55
    6   int i, Nv, Nb;
     6  int i;
     7  int Nv, Nb;
    78  char *p1, *p2, *p3;
    89  char field[81];
     
    3233  // now p1 must be 'P';
    3334  if (*p1 == 0) return (FALSE);
    34   if (*p1 != 'P') return (FALSE);
     35  if ((*p1 != 'P') && (*p1 != 'Q')) return (FALSE);
     36  def->mode = *p1;
    3537
    3638  // next value is the actual varlength column format
     
    6163  }
    6264
    63   if (!gfits_scan (ftable->header, "THEAP", "%d", 1, &def->heap_start)) {
     65  // heap_start must be long long so file may be very large
     66  if (!gfits_scan (ftable->header, "THEAP", "%lld", 1, (long long *) &def->heap_start)) {
    6467    def->heap_start = ftable->header->Naxis[0]*ftable->header->Naxis[1];
    6568  }
     
    6871}
    6972
    70 void *gfits_varlength_column_pointer (FTable *ftable, VarLengthColumn *column, int row, int *length) {
     73// return the data and length for row 'row' of a variable length column
     74// is this capable of handling large files (value holding length and offset is an int)?
     75void *gfits_varlength_column_pointer (FTable *ftable, VarLengthColumn *column, off_t row, off_t *length) {
    7176
    7277  void *result;
    73   int offset, Nx, *ptr;
     78  off_t offset, Nx;
     79
     80  if ((column->mode != 'P') && (column->mode != 'Q')) abort();
    7481
    7582  // find the values for the specified row
     
    8996# endif
    9097
    91   ptr = (int *) &ftable->buffer[row*Nx + column->Nstart];
    92   *length = ptr[0];
    93   offset = ptr[1];
     98  if (column->mode == 'P') {
     99    int *ptr;
     100    ptr = (int *) &ftable->buffer[row*Nx + column->Nstart];
     101    *length = ptr[0];
     102    offset = ptr[1];
     103  }
     104  if (column->mode == 'Q') {
     105    off_t *ptr;
     106    ptr = (off_t *) &ftable->buffer[row*Nx + column->Nstart];
     107    *length = ptr[0];
     108    offset = ptr[1];
     109  }
    94110
    95111  result = (void *) (ftable->buffer + column->heap_start + offset);
Note: See TracChangeset for help on using the changeset viewer.