- Timestamp:
- May 3, 2010, 8:41:49 AM (16 years ago)
- Location:
- branches/tap_branches
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/tap_branches
- Property svn:mergeinfo changed
-
branches/tap_branches/Ohana
-
Property svn:mergeinfo
set to (toggle deleted branches)
/trunk/Ohana merged eligible /branches/eam_branches/Ohana.20100407 27635-27772 /branches/pap_delete/Ohana 27530-27595
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/tap_branches/Ohana/src/libfits/table/F_table_varlength.c
r18264 r27838 4 4 int gfits_varlength_column_define (FTable *ftable, VarLengthColumn *def, int column) { 5 5 6 int i, Nv, Nb; 6 int i; 7 int Nv, Nb; 7 8 char *p1, *p2, *p3; 8 9 char field[81]; … … 32 33 // now p1 must be 'P'; 33 34 if (*p1 == 0) return (FALSE); 34 if (*p1 != 'P') return (FALSE); 35 if ((*p1 != 'P') && (*p1 != 'Q')) return (FALSE); 36 def->mode = *p1; 35 37 36 38 // next value is the actual varlength column format … … 61 63 } 62 64 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)) { 64 67 def->heap_start = ftable->header->Naxis[0]*ftable->header->Naxis[1]; 65 68 } … … 68 71 } 69 72 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)? 75 void *gfits_varlength_column_pointer (FTable *ftable, VarLengthColumn *column, off_t row, off_t *length) { 71 76 72 77 void *result; 73 int offset, Nx, *ptr; 78 off_t offset, Nx; 79 80 if ((column->mode != 'P') && (column->mode != 'Q')) abort(); 74 81 75 82 // find the values for the specified row … … 89 96 # endif 90 97 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 } else if (column->mode == 'Q') { 104 off_t *ptr; 105 ptr = (off_t *) &ftable->buffer[row*Nx + column->Nstart]; 106 *length = ptr[0]; 107 offset = ptr[1]; 108 } else { 109 // this was actually trapped above 110 abort(); 111 } 94 112 95 113 result = (void *) (ftable->buffer + column->heap_start + offset);
Note:
See TracChangeset
for help on using the changeset viewer.
