diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2005-08-13 20:53:35 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2005-08-13 20:53:35 (GMT) |
commit | 6b45f5172ccb4311e0be9ae15da3758abb6b0e67 (patch) | |
tree | 5a7a112fe7a8a98c6fecb45b513789d15962eb3d /hl/src/H5TB.c | |
parent | 6562465a2c2a58cfbc2f47bf60bb538f7a783933 (diff) | |
download | hdf5-6b45f5172ccb4311e0be9ae15da3758abb6b0e67.zip hdf5-6b45f5172ccb4311e0be9ae15da3758abb6b0e67.tar.gz hdf5-6b45f5172ccb4311e0be9ae15da3758abb6b0e67.tar.bz2 |
[svn-r11245] Purpose:
Code cleanup
Description:
Trim trailing whitespace, which is making 'diff'ing the two branches
difficult.
Solution:
Ran this script in each directory:
foreach f (*.[ch] *.cpp)
sed 's/[[:blank:]]*$//' $f > sed.out && mv sed.out $f
end
Platforms tested:
FreeBSD 4.11 (sleipnir)
Too minor to require h5committest
Diffstat (limited to 'hl/src/H5TB.c')
-rw-r--r-- | hl/src/H5TB.c | 648 |
1 files changed, 324 insertions, 324 deletions
diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index 59642da..c67747f 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -21,25 +21,25 @@ /*------------------------------------------------------------------------- - * + * * Private functions - * + * *------------------------------------------------------------------------- */ -int H5TB_find_field(const char *field, +int H5TB_find_field(const char *field, const char *field_list); -herr_t H5TB_attach_attributes(const char *table_title, - hid_t loc_id, +herr_t H5TB_attach_attributes(const char *table_title, + hid_t loc_id, const char *dset_name, - hsize_t nfields, + hsize_t nfields, hid_t tid ); -hid_t H5TB_create_type(hid_t loc_id, +hid_t H5TB_create_type(hid_t loc_id, const char *dset_name, - size_t dst_size, - const size_t *dst_offset, + size_t dst_size, + const size_t *dst_offset, const size_t *dst_sizes, hid_t ftype_id); @@ -64,14 +64,14 @@ hid_t H5TB_create_type(hid_t loc_id, * * Comments: The data is packed * - * Modifications: + * Modifications: * *------------------------------------------------------------------------- */ herr_t H5TBmake_table( const char *table_title, - hid_t loc_id, + hid_t loc_id, const char *dset_name, hsize_t nfields, hsize_t nrecords, @@ -82,12 +82,12 @@ herr_t H5TBmake_table( const char *table_title, hsize_t chunk_size, void *fill_data, int compress, - const void *data ) + const void *data ) { hid_t did; - hid_t sid; - hid_t mem_type_id; + hid_t sid; + hid_t mem_type_id; hid_t plist_id; hsize_t dims[1]; hsize_t dims_chunk[1]; @@ -107,7 +107,7 @@ herr_t H5TBmake_table( const char *table_title, return -1; /* Insert fields. */ - for ( i = 0; i < nfields; i++) + for ( i = 0; i < nfields; i++) { if ( H5Tinsert(mem_type_id, field_names[i], field_offset[i], field_types[i] ) < 0 ) return -1; @@ -125,25 +125,25 @@ herr_t H5TBmake_table( const char *table_title, /* Set the fill value using a struct as the data type. */ if ( fill_data ) { - if ( H5Pset_fill_value( plist_id, mem_type_id, fill_data ) < 0 ) + if ( H5Pset_fill_value( plist_id, mem_type_id, fill_data ) < 0 ) return -1; } - /* - Dataset creation property list is modified to use - GZIP compression with the compression effort set to 6. - Note that compression can be used only when dataset is chunked. + /* + Dataset creation property list is modified to use + GZIP compression with the compression effort set to 6. + Note that compression can be used only when dataset is chunked. */ if ( compress ) { - if ( H5Pset_deflate( plist_id, 6) < 0 ) + if ( H5Pset_deflate( plist_id, 6) < 0 ) return -1; } - + /* Create the dataset. */ if ( (did = H5Dcreate( loc_id, dset_name, mem_type_id, sid, plist_id )) < 0 ) goto out; - + /* Only write if there is something to write */ if ( data ) { @@ -151,8 +151,8 @@ herr_t H5TBmake_table( const char *table_title, if ( H5Dwrite( did, mem_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, data ) < 0 ) goto out; } - - /* Terminate access to the data space. */ + + /* Terminate access to the data space. */ if ( H5Sclose( sid ) < 0 ) goto out; @@ -168,7 +168,7 @@ herr_t H5TBmake_table( const char *table_title, * Set the conforming table attributes *------------------------------------------------------------------------- */ - + /* Attach the CLASS attribute */ if ( H5LTset_attribute_string( loc_id, dset_name, "CLASS", TABLE_CLASS ) < 0 ) goto out; @@ -176,7 +176,7 @@ herr_t H5TBmake_table( const char *table_title, /* Attach the VERSION attribute */ if ( H5LTset_attribute_string( loc_id, dset_name, "VERSION", "2.0" ) < 0 ) goto out; - + /* Attach the TITLE attribute */ if ( H5LTset_attribute_string( loc_id, dset_name, "TITLE", table_title ) < 0 ) goto out; @@ -193,7 +193,7 @@ herr_t H5TBmake_table( const char *table_title, strcat( attr_name, aux ); sprintf( aux, "%s", "_NAME" ); strcat( attr_name, aux ); - + /* Attach the attribute */ if ( H5LTset_attribute_string( loc_id, dset_name, attr_name, member_name ) < 0 ) goto out; @@ -211,7 +211,7 @@ herr_t H5TBmake_table( const char *table_title, /* Open the dataset. */ if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) return -1; - + if (( sid = H5Screate(H5S_SCALAR)) < 0 ) goto out; @@ -229,28 +229,28 @@ herr_t H5TBmake_table( const char *table_title, if ( (attr_id = H5Acreate( did, attr_name, field_types[i], sid, H5P_DEFAULT )) < 0 ) goto out; - + if ( H5Awrite( attr_id, field_types[i], tmp_buf+field_offset[i] ) < 0 ) goto out; - + if ( H5Aclose( attr_id ) < 0 ) goto out; free( member_name ); } - + /* Close the dataset. */ H5Dclose( did ); - /* Close data space. */ + /* Close data space. */ H5Sclose( sid ); } - + /* Release the datatype. */ if ( H5Tclose( mem_type_id ) < 0 ) return -1; - - + + return 0; /* error zone, gracefully close */ @@ -279,7 +279,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmers: + * Programmers: * Pedro Vicente, pvn@ncsa.uiuc.edu * Quincey Koziol * @@ -287,23 +287,23 @@ out: * * Comments: Uses memory offsets * - * Modifications: April 1, 2004 - * the DST_SIZES parameter is used to define the memory type ID - * returned by H5TB_create_type + * Modifications: April 1, 2004 + * the DST_SIZES parameter is used to define the memory type ID + * returned by H5TB_create_type * *------------------------------------------------------------------------- */ -herr_t H5TBappend_records( hid_t loc_id, +herr_t H5TBappend_records( hid_t loc_id, const char *dset_name, hsize_t nrecords, size_t dst_size, const size_t *dst_offset, const size_t *dst_sizes, - const void *data ) + const void *data ) { hid_t did; - hid_t tid=-1; + hid_t tid=-1; hid_t mem_type_id=-1; hid_t sid=-1; hid_t mem_space_id=-1; @@ -327,7 +327,7 @@ herr_t H5TBappend_records( hid_t loc_id, /* Append the records */ if ((H5TBcommon_append_records(did, mem_type_id, nrecords, nrecords_orig, data))<0) - goto out; + goto out; /* Release the datatype. */ if ( H5Tclose( tid ) < 0 ) @@ -341,7 +341,7 @@ herr_t H5TBappend_records( hid_t loc_id, if ( H5Dclose( did ) < 0 ) goto out; - + return 0; /* error zone, gracefully close */ @@ -369,27 +369,27 @@ out: * * Comments: Uses memory offsets * - * Modifications: April 1, 2004 - * the DST_SIZES parameter is used to define the memory type ID - * returned by H5TB_create_type + * Modifications: April 1, 2004 + * the DST_SIZES parameter is used to define the memory type ID + * returned by H5TB_create_type * *------------------------------------------------------------------------- */ -herr_t H5TBwrite_records( hid_t loc_id, +herr_t H5TBwrite_records( hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t dst_size, const size_t *dst_offset, const size_t *dst_sizes, - const void *data ) + const void *data ) { hid_t did; - hid_t tid; - hsize_t count[1]; + hid_t tid; + hsize_t count[1]; hsize_t offset[1]; hid_t sid=-1; hid_t mem_space_id=-1; @@ -418,7 +418,7 @@ herr_t H5TBwrite_records( hid_t loc_id, if ( start + nrecords > dims[0] ) goto out; - + /* Define a hyperslab in the dataset of the size of the records */ offset[0] = start; count[0] = nrecords; @@ -440,7 +440,7 @@ herr_t H5TBwrite_records( hid_t loc_id, /* Terminate access to the dataspace */ if ( H5Sclose( sid ) < 0 ) goto out; - + /* Release the datatype. */ if ( H5Tclose( tid ) < 0 ) goto out; @@ -453,7 +453,7 @@ herr_t H5TBwrite_records( hid_t loc_id, if ( H5Dclose( did ) < 0 ) return -1; - + return 0; /* error zone, gracefully close */ @@ -481,13 +481,13 @@ out: * * Comments: * - * Modifications: April 1, 2004 - * the DST_SIZES parameter is used to define the memory type ID - * returned by H5TB_create_type + * Modifications: April 1, 2004 + * the DST_SIZES parameter is used to define the memory type ID + * returned by H5TB_create_type * *------------------------------------------------------------------------- */ -herr_t H5TBwrite_fields_name( hid_t loc_id, +herr_t H5TBwrite_fields_name( hid_t loc_id, const char *dset_name, const char *field_names, hsize_t start, @@ -495,15 +495,15 @@ herr_t H5TBwrite_fields_name( hid_t loc_id, size_t type_size, const size_t *field_offset, const size_t *dst_sizes, - const void *data ) + const void *data ) { hid_t did; - hid_t tid=-1; + hid_t tid=-1; hid_t write_type_id=-1; hid_t member_type_id; hid_t nmtype_id; - hsize_t count[1]; + hsize_t count[1]; hsize_t offset[1]; hid_t sid=-1; char *member_name; @@ -513,9 +513,9 @@ herr_t H5TBwrite_fields_name( hid_t loc_id, size_t size_native; /* Create xfer properties to preserve initialized data */ - if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) + if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) return -1; - if (H5Pset_preserve (PRESERVE, 1)<0) + if (H5Pset_preserve (PRESERVE, 1)<0) return -1; /* Open the dataset. */ @@ -525,7 +525,7 @@ herr_t H5TBwrite_fields_name( hid_t loc_id, /* Get the datatype */ if ( (tid = H5Dget_type( did )) < 0 ) goto out; - + /* Get the number of fields */ if ( ( nfields = H5Tget_nmembers( tid )) < 0 ) goto out; @@ -552,9 +552,9 @@ herr_t H5TBwrite_fields_name( hid_t loc_id, /* Convert to native type */ if ((nmtype_id=H5Tget_native_type(member_type_id,H5T_DIR_DEFAULT))<0) goto out; - + size_native=H5Tget_size(nmtype_id); - + /* Adjust, if necessary */ if (dst_sizes[j]!=size_native) { @@ -601,7 +601,7 @@ herr_t H5TBwrite_fields_name( hid_t loc_id, /* Write */ if ( H5Dwrite( did, write_type_id, H5S_ALL, sid, PRESERVE, data ) < 0 ) goto out; - + /* End access to the write id */ if ( H5Tclose( write_type_id ) ) goto out; @@ -617,7 +617,7 @@ herr_t H5TBwrite_fields_name( hid_t loc_id, /* End access to the property list */ if ( H5Pclose( PRESERVE ) < 0 ) return -1; - + return 0; /* error zone, gracefully close */ @@ -648,15 +648,15 @@ out: * * Comments: Uses memory offsets * - * Modifications: April 1, 2004 - * the DST_SIZES parameter is used to define the memory type ID - * returned by H5TB_create_type + * Modifications: April 1, 2004 + * the DST_SIZES parameter is used to define the memory type ID + * returned by H5TB_create_type * *------------------------------------------------------------------------- */ -herr_t H5TBwrite_fields_index( hid_t loc_id, +herr_t H5TBwrite_fields_index( hid_t loc_id, const char *dset_name, hsize_t nfields, const int *field_index, @@ -665,15 +665,15 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, size_t type_size, const size_t *field_offset, const size_t *dst_sizes, - const void *data ) + const void *data ) { hid_t did; - hid_t tid=-1; + hid_t tid=-1; hid_t write_type_id=-1; hid_t member_type_id; hid_t nmtype_id; - hsize_t count[1]; + hsize_t count[1]; hsize_t offset[1]; hid_t sid=-1; char *member_name; @@ -682,9 +682,9 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, size_t size_native; /* Create xfer properties to preserve initialized data */ - if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) + if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) return -1; - if (H5Pset_preserve (PRESERVE, 1)<0) + if (H5Pset_preserve (PRESERVE, 1)<0) return -1; /* Open the dataset. */ @@ -694,11 +694,11 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, /* Get the datatype */ if ( (tid = H5Dget_type( did )) < 0 ) goto out; - + /* Get the number of fields */ if ( H5Tget_nmembers( tid ) < 0 ) goto out; - + /* Create a write id */ if ( ( write_type_id = H5Tcreate( H5T_COMPOUND, type_size )) < 0 ) goto out; @@ -709,7 +709,7 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, { j = field_index[i]; - + /* Get the member name */ member_name = H5Tget_member_name( tid, (unsigned) j ); @@ -720,9 +720,9 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, /* Convert to native type */ if ((nmtype_id=H5Tget_native_type(member_type_id,H5T_DIR_DEFAULT))<0) goto out; - + size_native=H5Tget_size(nmtype_id); - + if (dst_sizes[i]!=size_native) { if (H5Tset_size(nmtype_id, dst_sizes[i])<0) @@ -748,7 +748,7 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, goto out; free( member_name ); - + } /* Get the dataspace handle */ @@ -764,7 +764,7 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, /* Write */ if ( H5Dwrite( did, write_type_id, H5S_ALL, sid, PRESERVE, data ) < 0 ) goto out; - + /* End access to the write id */ if ( H5Tclose( write_type_id ) ) goto out; @@ -780,7 +780,7 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, /* End access to the property list */ if ( H5Pclose( PRESERVE ) < 0 ) return -1; - + return 0; /* error zone, gracefully close */ @@ -817,25 +817,25 @@ out: * * Comments: * - * Modifications: April 1, 2004 + * Modifications: April 1, 2004 * used a memory type ID returned by H5TB_create_type * *------------------------------------------------------------------------- */ -herr_t H5TBread_table( hid_t loc_id, +herr_t H5TBread_table( hid_t loc_id, const char *dset_name, - size_t dst_size, - const size_t *dst_offset, + size_t dst_size, + const size_t *dst_offset, const size_t *dst_sizes, - void *dst_buf ) + void *dst_buf ) { hid_t did; - hid_t ftype_id=-1; + hid_t ftype_id=-1; hid_t mem_type_id=-1; hid_t sid; hsize_t dims[1]; - + /* open the dataset. */ if ((did=H5Dopen(loc_id,dset_name))<0) return -1; @@ -843,13 +843,13 @@ herr_t H5TBread_table( hid_t loc_id, /* get the dataspace handle */ if ( (sid = H5Dget_space( did )) < 0 ) goto out; - + /* get dimensions */ if ( H5Sget_simple_extent_dims( sid, dims, NULL) < 0 ) goto out; /* get the datatypes */ - if ((ftype_id=H5Dget_type (did))<0) + if ((ftype_id=H5Dget_type (did))<0) goto out; if ((mem_type_id=H5TB_create_type(loc_id,dset_name,dst_size,dst_offset,dst_sizes,ftype_id))<0) @@ -893,30 +893,30 @@ out: * * Date: November 19, 2001 * - * Comments: + * Comments: * - * Modifications: April 1, 2004 - * the DST_SIZES parameter is used to define the memory type ID - * returned by H5TB_create_type + * Modifications: April 1, 2004 + * the DST_SIZES parameter is used to define the memory type ID + * returned by H5TB_create_type * *------------------------------------------------------------------------- */ -herr_t H5TBread_records( hid_t loc_id, +herr_t H5TBread_records( hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t dst_size, const size_t *dst_offset, const size_t *dst_sizes, - void *data ) + void *data ) { hid_t did; - hid_t ftype_id; + hid_t ftype_id; hid_t mem_type_id=-1; - hsize_t count[1]; + hsize_t count[1]; hsize_t offset[1]; hid_t sid=-1; hsize_t dims[1]; @@ -936,7 +936,7 @@ herr_t H5TBread_records( hid_t loc_id, /* get the datatypes */ if ( (ftype_id = H5Dget_type( did )) < 0 ) goto out; - + if ((mem_type_id=H5TB_create_type(loc_id,dset_name,dst_size,dst_offset,dst_sizes,ftype_id))<0) goto out; @@ -1011,15 +1011,15 @@ out: * * Comments: * - * Modifications: April 1, 2004 - * the DST_SIZES parameter is used to define the memory type ID - * returned by H5TB_create_type + * Modifications: April 1, 2004 + * the DST_SIZES parameter is used to define the memory type ID + * returned by H5TB_create_type * *------------------------------------------------------------------------- */ -herr_t H5TBread_fields_name( hid_t loc_id, +herr_t H5TBread_fields_name( hid_t loc_id, const char *dset_name, const char *field_names, hsize_t start, @@ -1027,24 +1027,24 @@ herr_t H5TBread_fields_name( hid_t loc_id, size_t type_size, const size_t *field_offset, const size_t *dst_sizes, - void *data ) + void *data ) { hid_t did; - hid_t ftype_id=-1; + hid_t ftype_id=-1; hid_t mem_type_id=-1; hid_t mtype_id; hid_t nmtype_id; char *member_name; hssize_t nfields; - hsize_t count[1]; + hsize_t count[1]; hsize_t offset[1]; hid_t sid=-1; hid_t mem_space_id=-1; hsize_t mem_size[1]; size_t size_native; hssize_t i, j; - + /* open the dataset */ if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) goto out; @@ -1076,9 +1076,9 @@ herr_t H5TBread_fields_name( hid_t loc_id, /* convert to native type */ if ((nmtype_id=H5Tget_native_type(mtype_id,H5T_DIR_DEFAULT))<0) goto out; - + size_native=H5Tget_size(nmtype_id); - + if (dst_sizes[j]!=size_native) { if (H5Tset_size(nmtype_id, dst_sizes[j])<0) @@ -1136,7 +1136,7 @@ herr_t H5TBread_fields_name( hid_t loc_id, goto out; if ( H5Dclose( did ) < 0 ) return -1; - + return 0; /* error zone, gracefully close */ @@ -1166,15 +1166,15 @@ out: * * Comments: * - * Modifications: April 1, 2004 - * the DST_SIZES parameter is used to define the memory type ID - * returned by H5TB_create_type + * Modifications: April 1, 2004 + * the DST_SIZES parameter is used to define the memory type ID + * returned by H5TB_create_type * *------------------------------------------------------------------------- */ -herr_t H5TBread_fields_index( hid_t loc_id, +herr_t H5TBread_fields_index( hid_t loc_id, const char *dset_name, hsize_t nfields, const int *field_index, @@ -1183,16 +1183,16 @@ herr_t H5TBread_fields_index( hid_t loc_id, size_t type_size, const size_t *field_offset, const size_t *dst_sizes, - void *data ) + void *data ) { hid_t did; - hid_t tid=-1; + hid_t tid=-1; hid_t read_type_id=-1; hid_t member_type_id; hid_t nmtype_id; char *member_name; - hsize_t count[1]; + hsize_t count[1]; hsize_t offset[1]; hid_t sid=-1; hid_t mem_space_id=-1; @@ -1216,7 +1216,7 @@ herr_t H5TBread_fields_index( hid_t loc_id, for ( i = 0; i < nfields; i++) { j = field_index[i]; - + /* Get the member name */ member_name = H5Tget_member_name( tid, (unsigned) j ); @@ -1227,13 +1227,13 @@ herr_t H5TBread_fields_index( hid_t loc_id, /* Get the member size */ if ( H5Tget_size( member_type_id ) == 0 ) goto out; - + /* Convert to native type */ if ((nmtype_id=H5Tget_native_type(member_type_id,H5T_DIR_DEFAULT))<0) goto out; - + size_native=H5Tget_size(nmtype_id); - + if (dst_sizes[i]!=size_native) { if (H5Tset_size(nmtype_id, dst_sizes[i])<0) @@ -1251,7 +1251,7 @@ herr_t H5TBread_fields_index( hid_t loc_id, if ( H5Tinsert( read_type_id, member_name, 0, nmtype_id ) < 0 ) goto out; } - + /* Close the member type */ if ( H5Tclose( member_type_id ) < 0 ) goto out; @@ -1270,7 +1270,7 @@ herr_t H5TBread_fields_index( hid_t loc_id, count[0] = nrecords; if ( H5Sselect_hyperslab( sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0 ) goto out; - + /* Create a memory dataspace handle */ mem_size[0] = count[0]; if ( (mem_space_id = H5Screate_simple( 1, mem_size, NULL )) < 0 ) @@ -1287,7 +1287,7 @@ herr_t H5TBread_fields_index( hid_t loc_id, /* Terminate access to the memory dataspace */ if ( H5Sclose( mem_space_id ) < 0 ) goto out; - + /* End access to the read id */ if ( H5Tclose( read_type_id ) ) goto out; @@ -1299,7 +1299,7 @@ herr_t H5TBread_fields_index( hid_t loc_id, /* End access to the dataset */ if ( H5Dclose( did ) < 0 ) return -1; - + return 0; /* error zone, gracefully close */ @@ -1340,7 +1340,7 @@ out: *------------------------------------------------------------------------- */ -herr_t H5TBdelete_record( hid_t loc_id, +herr_t H5TBdelete_record( hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords ) @@ -1351,8 +1351,8 @@ herr_t H5TBdelete_record( hid_t loc_id, hsize_t read_start; hsize_t read_nrecords; hid_t did; - hid_t tid; - hsize_t count[1]; + hid_t tid; + hsize_t count[1]; hsize_t offset[1]; hid_t sid; hid_t mem_space_id; @@ -1366,7 +1366,7 @@ herr_t H5TBdelete_record( hid_t loc_id, hsize_t dims[1]; #endif - + /*------------------------------------------------------------------------- * First we get information about type size and offsets on disk *------------------------------------------------------------------------- @@ -1381,11 +1381,11 @@ herr_t H5TBdelete_record( hid_t loc_id, if ( src_offset == NULL ) return -1; - + /* Get field info */ if ( H5TBget_field_info( loc_id, dset_name, NULL, src_sizes, src_offset, &src_size ) < 0 ) return -1; - + /*------------------------------------------------------------------------- * Read the records after the deleted one(s) *------------------------------------------------------------------------- @@ -1399,7 +1399,7 @@ herr_t H5TBdelete_record( hid_t loc_id, return -1; /* Read the records after the deleted one(s) */ - if ( H5TBread_records( loc_id, dset_name, read_start, read_nrecords, src_size, + if ( H5TBread_records( loc_id, dset_name, read_start, read_nrecords, src_size, src_offset, src_sizes, tmp_buf ) < 0 ) return -1; @@ -1412,7 +1412,7 @@ herr_t H5TBdelete_record( hid_t loc_id, /* Open the dataset. */ if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) return -1; - + /* Get the datatype */ if ( (tid = H5Dget_type( did )) < 0 ) goto out; @@ -1461,11 +1461,11 @@ herr_t H5TBdelete_record( hid_t loc_id, /* End access to the dataset */ if ( H5Dclose( did ) < 0 ) return -1; - + free( tmp_buf ); free( src_offset ); free( src_sizes ); - + /*------------------------------------------------------------------------- * Store the new dimension as an attribute @@ -1474,11 +1474,11 @@ herr_t H5TBdelete_record( hid_t loc_id, nrows = ntotal_records - nrecords; /* Set the attribute */ - if (H5LT_set_attribute_numerical(loc_id,dset_name,"NROWS",1, + if (H5LT_set_attribute_numerical(loc_id,dset_name,"NROWS",1, H5T_NATIVE_LLONG,&nrows)<0) return -1; - + return 0; out: @@ -1499,15 +1499,15 @@ out: * * Comments: Uses memory offsets * - * Modifications: April 1, 2004 - * the DST_SIZES parameter is used to define the memory type ID - * returned by H5TB_create_type + * Modifications: April 1, 2004 + * the DST_SIZES parameter is used to define the memory type ID + * returned by H5TB_create_type * *------------------------------------------------------------------------- */ -herr_t H5TBinsert_record( hid_t loc_id, +herr_t H5TBinsert_record( hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, @@ -1521,18 +1521,18 @@ herr_t H5TBinsert_record( hid_t loc_id, hsize_t ntotal_records; hsize_t read_nrecords; hid_t did; - hid_t tid=-1; + hid_t tid=-1; hid_t mem_type_id=-1; - hsize_t count[1]; + hsize_t count[1]; hsize_t offset[1]; hid_t sid=-1; hid_t mem_space_id=-1; hsize_t dims[1]; hsize_t mem_dims[1]; unsigned char *tmp_buf; - + /*------------------------------------------------------------------------- - * Read the records after the inserted one(s) + * Read the records after the inserted one(s) *------------------------------------------------------------------------- */ @@ -1556,7 +1556,7 @@ herr_t H5TBinsert_record( hid_t loc_id, tmp_buf = (unsigned char *)calloc((size_t) read_nrecords, dst_size ); /* Read the records after the inserted one(s) */ - if ( H5TBread_records( loc_id, dset_name, start, read_nrecords, dst_size, dst_offset, + if ( H5TBread_records( loc_id, dset_name, start, read_nrecords, dst_size, dst_offset, dst_sizes, tmp_buf ) < 0 ) return -1; @@ -1565,7 +1565,7 @@ herr_t H5TBinsert_record( hid_t loc_id, if ( H5Dextend ( did, dims ) < 0 ) goto out; - + /*------------------------------------------------------------------------- * Write the inserted records *------------------------------------------------------------------------- @@ -1588,13 +1588,13 @@ herr_t H5TBinsert_record( hid_t loc_id, if ( H5Dwrite( did, mem_type_id, mem_space_id, sid, H5P_DEFAULT, data ) < 0 ) goto out; - + /* Terminate access to the dataspace */ if ( H5Sclose( mem_space_id ) < 0 ) goto out; if ( H5Sclose( sid ) < 0 ) goto out; - + /*------------------------------------------------------------------------- * Write the "pushed down" records *------------------------------------------------------------------------- @@ -1617,7 +1617,7 @@ herr_t H5TBinsert_record( hid_t loc_id, if ( H5Dwrite( did, mem_type_id, mem_space_id, sid, H5P_DEFAULT, tmp_buf ) < 0 ) goto out; - + /* Terminate access to the dataspace */ if ( H5Sclose( mem_space_id ) < 0 ) goto out; @@ -1664,7 +1664,7 @@ out: * * Date: December 5, 2001 * - * Comments: + * Comments: * * Modifications: * @@ -1672,22 +1672,22 @@ out: *------------------------------------------------------------------------- */ -herr_t H5TBadd_records_from( hid_t loc_id, +herr_t H5TBadd_records_from( hid_t loc_id, const char *dset_name1, hsize_t start1, hsize_t nrecords, const char *dset_name2, - hsize_t start2 ) + hsize_t start2 ) { /* Identifiers for the 1st dataset. */ hid_t dataset_id1; - hid_t type_id1; + hid_t type_id1; hid_t space_id1=-1; hid_t mem_space_id1=-1; size_t type_size1; - hsize_t count[1]; + hsize_t count[1]; hsize_t offset[1]; hsize_t mem_size[1]; hsize_t nfields; @@ -1711,13 +1711,13 @@ herr_t H5TBadd_records_from( hid_t loc_id, if ( src_offset == NULL ) return -1; - + /* Get field info */ if ( H5TBget_field_info( loc_id, dset_name1, NULL, src_sizes, src_offset, &src_size ) < 0 ) return -1; - + /*------------------------------------------------------------------------- - * Get information about the first table and read it + * Get information about the first table and read it *------------------------------------------------------------------------- */ @@ -1754,12 +1754,12 @@ herr_t H5TBadd_records_from( hid_t loc_id, goto out; /*------------------------------------------------------------------------- - * Add to the second table + * Add to the second table *------------------------------------------------------------------------- */ if ( H5TBinsert_record(loc_id,dset_name2,start2,nrecords,src_size,src_offset,src_sizes,tmp_buf ) < 0 ) goto out; - + /*------------------------------------------------------------------------- * Close resources for table 1 *------------------------------------------------------------------------- @@ -1772,7 +1772,7 @@ herr_t H5TBadd_records_from( hid_t loc_id, /* Terminate access to the dataspace */ if ( H5Sclose( space_id1 ) < 0 ) goto out; - + /* Release the datatype. */ if ( H5Tclose( type_id1 ) < 0 ) return -1; @@ -1784,7 +1784,7 @@ herr_t H5TBadd_records_from( hid_t loc_id, free( tmp_buf ); free( src_offset ); free( src_sizes ); - + return 0; /* error zone, gracefully close */ @@ -1810,14 +1810,14 @@ out: * * Date: December 10, 2001 * - * Comments: + * Comments: * * Modifications: * * *------------------------------------------------------------------------- */ -herr_t H5TBcombine_tables( hid_t loc_id1, +herr_t H5TBcombine_tables( hid_t loc_id1, const char *dset_name1, hid_t loc_id2, const char *dset_name2, @@ -1826,23 +1826,23 @@ herr_t H5TBcombine_tables( hid_t loc_id1, /* Identifiers for the 1st dataset. */ hid_t dataset_id1; - hid_t type_id1; + hid_t type_id1; hid_t space_id1; hid_t plist_id1; /* Identifiers for the 2nd dataset. */ hid_t dataset_id2; - hid_t type_id2; + hid_t type_id2; hid_t space_id2; hid_t plist_id2; /* Identifiers for the 3rd dataset. */ hid_t dataset_id3; - hid_t type_id3; + hid_t type_id3; hid_t space_id3; hid_t plist_id3; - hsize_t count[1]; + hsize_t count[1]; hsize_t offset[1]; hid_t mem_space_id; hsize_t mem_size[1]; @@ -1850,7 +1850,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1, hsize_t nrecords; hsize_t dims[1]; hsize_t maxdims[1] = { H5S_UNLIMITED }; - + size_t type_size; hid_t sid; @@ -1882,13 +1882,13 @@ herr_t H5TBcombine_tables( hid_t loc_id1, if ( src_offset == NULL ) return -1; - + /* Get field info */ if ( H5TBget_field_info( loc_id1, dset_name1, NULL, src_sizes, src_offset, &src_size ) < 0 ) return -1; /*------------------------------------------------------------------------- - * Get information about the first table + * Get information about the first table *------------------------------------------------------------------------- */ @@ -1911,7 +1911,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1, /* Get the dimensions */ if ( H5TBget_table_info ( loc_id1, dset_name1, &nfields, &nrecords ) < 0 ) return -1; - + /*------------------------------------------------------------------------- * Make the merged table with no data originally *------------------------------------------------------------------------- @@ -1966,44 +1966,44 @@ herr_t H5TBcombine_tables( hid_t loc_id1, */ if ( has_fill == 1 ) { - + if (( sid = H5Screate(H5S_SCALAR)) < 0 ) goto out; - + for ( i = 0; i < nfields; i++) { - + /* Get the member type */ if ( ( member_type_id = H5Tget_member_type( type_id3, (unsigned) i )) < 0 ) goto out; - + /* Get the member offset */ member_offset = H5Tget_member_offset( type_id3, (unsigned) i ); - + strcpy( attr_name, "FIELD_" ); sprintf( aux, "%d", (int) i ); strcat( attr_name, aux ); sprintf( aux, "%s", "_FILL" ); strcat( attr_name, aux ); - + if ( (attr_id = H5Acreate( dataset_id3, attr_name, member_type_id, sid, H5P_DEFAULT )) < 0 ) goto out; - + if ( H5Awrite( attr_id, member_type_id, tmp_fill_buf+member_offset ) < 0 ) goto out; - + if ( H5Aclose( attr_id ) < 0 ) goto out; if ( H5Tclose( member_type_id ) < 0 ) goto out; } - - /* Close data space. */ + + /* Close data space. */ if ( H5Sclose( sid ) < 0 ) goto out; } - + /*------------------------------------------------------------------------- * Read data from 1st table *------------------------------------------------------------------------- @@ -2024,7 +2024,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1, if ( H5Dread( dataset_id1, type_id1, mem_space_id, space_id1, H5P_DEFAULT, tmp_buf ) < 0 ) goto out; - + /*------------------------------------------------------------------------- * Save data from 1st table into new table *------------------------------------------------------------------------- @@ -2046,7 +2046,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1, /* Terminate access to the dataspace */ if ( H5Sclose( space_id1 ) < 0 ) goto out; - + /* Release the datatype. */ if ( H5Tclose( type_id1 ) < 0 ) goto out; @@ -2063,7 +2063,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1, free( tmp_buf ); /*------------------------------------------------------------------------- - * Get information about the 2nd table + * Get information about the 2nd table *------------------------------------------------------------------------- */ @@ -2108,7 +2108,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1, if ( H5Dread( dataset_id2, type_id2, mem_space_id, space_id2, H5P_DEFAULT, tmp_buf ) < 0 ) goto out; - + /*------------------------------------------------------------------------- * Save data from 2nd table into new table *------------------------------------------------------------------------- @@ -2130,7 +2130,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1, /* Terminate access to the dataspace */ if ( H5Sclose( space_id2 ) < 0 ) goto out; - + /* Release the datatype. */ if ( H5Tclose( type_id2 ) < 0 ) return -1; @@ -2151,7 +2151,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1, /* Terminate access to the dataspace */ if ( H5Sclose( space_id3 ) < 0 ) return -1; - + /* Release the datatype. */ if ( H5Tclose( type_id3 ) < 0 ) return -1; @@ -2191,32 +2191,32 @@ out: * * Date: January 30, 2002 * - * Comments: + * Comments: * - * Modifications: + * Modifications: * *------------------------------------------------------------------------- */ -herr_t H5TBinsert_field( hid_t loc_id, +herr_t H5TBinsert_field( hid_t loc_id, const char *dset_name, const char *field_name, hid_t field_type, hsize_t position, const void *fill_data, - const void *data ) + const void *data ) { /* Identifiers for the 1st, original dataset */ hid_t dataset_id1; - hid_t type_id1; + hid_t type_id1; hid_t space_id1; hid_t plist_id1; hid_t mem_space_id1; /* Identifiers for the 2nd, new dataset */ hid_t dataset_id2; - hid_t type_id2; + hid_t type_id2; hid_t space_id2; hid_t plist_id2; hid_t mem_space_id2; @@ -2231,7 +2231,7 @@ herr_t H5TBinsert_field( hid_t loc_id, hsize_t dims_chunk[1]; hsize_t dims[1]; hsize_t maxdims[1] = { H5S_UNLIMITED }; - hsize_t count[1]; + hsize_t count[1]; hsize_t offset[1]; hsize_t mem_size[1]; hid_t write_type_id; @@ -2251,16 +2251,16 @@ herr_t H5TBinsert_field( hid_t loc_id, /* Get the number of records and fields */ if ( H5TBget_table_info ( loc_id, dset_name, &nfields, &nrecords ) < 0 ) return -1; - + /*------------------------------------------------------------------------- * Get information about the old data type *------------------------------------------------------------------------- */ - + /* Open the dataset. */ if ( (dataset_id1 = H5Dopen( loc_id, dset_name )) < 0 ) return -1; - + /* Get creation properties list */ if ( (plist_id1 = H5Dget_create_plist( dataset_id1 )) < 0 ) goto out; @@ -2272,7 +2272,7 @@ herr_t H5TBinsert_field( hid_t loc_id, /* Get the size of the datatype */ if ( ( total_size = H5Tget_size( type_id1 )) == 0 ) goto out; - + /* Get the dataspace handle */ if ( (space_id1 = H5Dget_space( dataset_id1 )) < 0 ) goto out; @@ -2313,7 +2313,7 @@ herr_t H5TBinsert_field( hid_t loc_id, inserted = 0; /* Insert the old fields, counting with the new one */ - for ( i = 0; i < nfields + 1; i++) + for ( i = 0; i < nfields + 1; i++) { idx = i; @@ -2337,7 +2337,7 @@ herr_t H5TBinsert_field( hid_t loc_id, continue; } - + /* Get the member name */ member_name = H5Tget_member_name( type_id1, (unsigned)idx ); @@ -2347,7 +2347,7 @@ herr_t H5TBinsert_field( hid_t loc_id, /* Get the member size */ member_size = H5Tget_size( member_type_id ); - + /* Insert it into the new type */ if ( H5Tinsert( type_id2, member_name, curr_offset, member_type_id ) < 0 ) goto out; @@ -2360,9 +2360,9 @@ herr_t H5TBinsert_field( hid_t loc_id, if ( H5Tclose( member_type_id ) < 0 ) goto out; - + } /* i */ - + /*------------------------------------------------------------------------- * Create a new temporary dataset *------------------------------------------------------------------------- @@ -2407,7 +2407,7 @@ herr_t H5TBinsert_field( hid_t loc_id, if ( H5Dread( dataset_id1, type_id1, mem_space_id1, H5S_ALL, H5P_DEFAULT, tmp_buf ) < 0 ) goto out; - + /*------------------------------------------------------------------------- * Save data from 1st table into new table, using the 1st type id *------------------------------------------------------------------------- @@ -2427,15 +2427,15 @@ herr_t H5TBinsert_field( hid_t loc_id, /* Create a write id */ if ( ( write_type_id = H5Tcreate( H5T_COMPOUND, (size_t)new_member_size )) < 0 ) goto out; - + /* The field in the file is found by its name */ if ( H5Tinsert( write_type_id, field_name, 0, field_type ) < 0 ) goto out; /* Create xfer properties to preserve initialized data */ - if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) + if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) goto out; - if (H5Pset_preserve (PRESERVE, 1)<0) + if (H5Pset_preserve (PRESERVE, 1)<0) goto out; /* Only write if there is something to write */ @@ -2468,8 +2468,8 @@ herr_t H5TBinsert_field( hid_t loc_id, /* Terminate access to the memory dataspace */ if ( H5Sclose( mem_space_id1 ) < 0 ) - goto out; - + goto out; + /* Release the datatype. */ if ( H5Tclose( type_id1 ) < 0 ) goto out; @@ -2495,7 +2495,7 @@ herr_t H5TBinsert_field( hid_t loc_id, /* Terminate access to the dataspace */ if ( H5Sclose( space_id2 ) < 0 ) goto out; - + /* Release the datatype. */ if ( H5Tclose( type_id2 ) < 0 ) return -1; @@ -2511,7 +2511,7 @@ herr_t H5TBinsert_field( hid_t loc_id, * Delete 1st table *------------------------------------------------------------------------- */ - if ( H5Gunlink( loc_id, dset_name ) < 0 ) + if ( H5Gunlink( loc_id, dset_name ) < 0 ) return -1; /*------------------------------------------------------------------------- @@ -2519,7 +2519,7 @@ herr_t H5TBinsert_field( hid_t loc_id, *------------------------------------------------------------------------- */ - if ( H5Gmove( loc_id, "new", dset_name ) < 0 ) + if ( H5Gmove( loc_id, "new", dset_name ) < 0 ) return -1; /*------------------------------------------------------------------------- @@ -2567,10 +2567,10 @@ herr_t H5TBinsert_field( hid_t loc_id, if ( (attr_id = H5Acreate( dataset_id1, attr_name, member_type_id, space_id1, H5P_DEFAULT )) < 0 ) goto out; - + if ( H5Awrite( attr_id, member_type_id, tmp_fill_buf+member_offset ) < 0 ) goto out; - + if ( H5Aclose( attr_id ) < 0 ) goto out; @@ -2598,19 +2598,19 @@ herr_t H5TBinsert_field( hid_t loc_id, if ( (attr_id = H5Acreate( dataset_id1, attr_name, member_type_id, space_id1, H5P_DEFAULT )) < 0 ) goto out; - + if ( H5Awrite( attr_id, member_type_id, fill_data ) < 0 ) goto out; - + if ( H5Aclose( attr_id ) < 0 ) goto out; if ( H5Tclose( member_type_id ) < 0 ) goto out; - + } - - /* Close data space. */ + + /* Close data space. */ if ( H5Sclose( space_id1 ) < 0 ) goto out; @@ -2621,12 +2621,12 @@ herr_t H5TBinsert_field( hid_t loc_id, /* End access to the dataset */ if ( H5Dclose( dataset_id1 ) < 0 ) goto out; - + /* Release resources. */ free ( tmp_buf ); free ( tmp_fill_buf ); - + return 0; out: @@ -2645,7 +2645,7 @@ out: * * Date: January 30, 2002 * - * Comments: + * Comments: * * Modifications: * @@ -2653,20 +2653,20 @@ out: *------------------------------------------------------------------------- */ -herr_t H5TBdelete_field( hid_t loc_id, +herr_t H5TBdelete_field( hid_t loc_id, const char *dset_name, - const char *field_name ) + const char *field_name ) { /* Identifiers for the 1st original dataset */ hid_t dataset_id1; - hid_t type_id1; + hid_t type_id1; hid_t space_id1; hid_t plist_id1; /* Identifiers for the 2nd new dataset */ hid_t dataset_id2; - hid_t type_id2; + hid_t type_id2; hid_t space_id2; hid_t plist_id2; @@ -2694,11 +2694,11 @@ herr_t H5TBdelete_field( hid_t loc_id, hid_t attr_id; hsize_t i; int has_fill=0; - + /* Get the number of records and fields */ if ( H5TBget_table_info ( loc_id, dset_name, &nfields, &nrecords ) < 0 ) return -1; - + /*------------------------------------------------------------------------- * Get information about the old data type *------------------------------------------------------------------------- @@ -2718,7 +2718,7 @@ herr_t H5TBdelete_field( hid_t loc_id, /* Get the size of the datatype */ type_size1 = H5Tget_size( type_id1 ); - + /* Get the dataspace handle */ if ( (space_id1 = H5Dget_space( dataset_id1 )) < 0 ) goto out; @@ -2733,9 +2733,9 @@ herr_t H5TBdelete_field( hid_t loc_id, */ /* Check out the field */ - for ( i = 0; i < nfields; i++) + for ( i = 0; i < nfields; i++) { - + /* Get the member name */ member_name = H5Tget_member_name( type_id1,(unsigned) i ); @@ -2748,7 +2748,7 @@ herr_t H5TBdelete_field( hid_t loc_id, /* Get the member size */ delete_member_size = H5Tget_size( member_type_id ); - + /* Close the member type */ if ( H5Tclose( member_type_id ) < 0 ) goto out; @@ -2760,7 +2760,7 @@ herr_t H5TBdelete_field( hid_t loc_id, } free( member_name ); - + } /* i */ /* No field to delete was found */ @@ -2787,15 +2787,15 @@ herr_t H5TBdelete_field( hid_t loc_id, * Get attributes from previous table in the process *------------------------------------------------------------------------- */ - + /* Get the table title */ if ( (H5TBAget_title( dataset_id1, table_title )) < 0 ) goto out; /* Insert the old fields except the one to delete */ - for ( i = 0; i < nfields; i++) + for ( i = 0; i < nfields; i++) { - + /* Get the member name */ member_name = H5Tget_member_name( type_id1, (unsigned) i ); @@ -2812,11 +2812,11 @@ herr_t H5TBdelete_field( hid_t loc_id, /* Get the member size */ member_size = H5Tget_size( member_type_id ); - + /* Insert it into the new type */ if ( H5Tinsert( type_id2, member_name, curr_offset, member_type_id ) < 0 ) goto out; - + /*------------------------------------------------------------------------- * Get the fill value information *------------------------------------------------------------------------- @@ -2845,9 +2845,9 @@ herr_t H5TBdelete_field( hid_t loc_id, /* Close the member type */ if ( H5Tclose( member_type_id ) < 0 ) goto out; - + } /* i */ - + /*------------------------------------------------------------------------- * Create a new temporary dataset *------------------------------------------------------------------------- @@ -2874,9 +2874,9 @@ herr_t H5TBdelete_field( hid_t loc_id, * We have to read field by field of the old dataset and save it into the new one *------------------------------------------------------------------------- */ - for ( i = 0; i < nfields; i++) + for ( i = 0; i < nfields; i++) { - + /* Get the member name */ member_name = H5Tget_member_name( type_id1,(unsigned) i ); @@ -2903,23 +2903,23 @@ herr_t H5TBdelete_field( hid_t loc_id, goto out; tmp_buf = (unsigned char *)calloc((size_t) nrecords, member_size ); - + /* Read */ if ( H5Dread( dataset_id1, read_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp_buf ) < 0 ) goto out; - + /* Create a write id */ if ( ( write_type_id = H5Tcreate( H5T_COMPOUND, member_size )) < 0 ) goto out; - + /* The field in the file is found by its name */ if ( H5Tinsert( write_type_id, member_name, 0, member_type_id ) < 0 ) goto out; /* Create xfer properties to preserve initialized data */ - if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) + if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) goto out; - if (H5Pset_preserve (PRESERVE, 1)<0) + if (H5Pset_preserve (PRESERVE, 1)<0) goto out; /* Write */ @@ -2932,7 +2932,7 @@ herr_t H5TBdelete_field( hid_t loc_id, /* Close the member type */ if ( H5Tclose( member_type_id ) < 0 ) - goto out; + goto out; /* Close the read type */ if ( H5Tclose( read_type_id ) < 0 ) @@ -2941,10 +2941,10 @@ herr_t H5TBdelete_field( hid_t loc_id, /* Close the write type */ if ( H5Tclose( write_type_id ) < 0 ) goto out; - + /* Release resources. */ free( member_name ); - free ( tmp_buf ); + free ( tmp_buf ); } /* i */ @@ -2952,7 +2952,7 @@ herr_t H5TBdelete_field( hid_t loc_id, * Release resources from 1st table *------------------------------------------------------------------------- */ - + /* Release the datatype. */ if ( H5Tclose( type_id1 ) < 0 ) goto out; @@ -2978,7 +2978,7 @@ herr_t H5TBdelete_field( hid_t loc_id, /* Terminate access to the dataspace */ if ( H5Sclose( space_id2 ) < 0 ) goto out; - + /* Release the datatype. */ if ( H5Tclose( type_id2 ) < 0 ) return -1; @@ -2996,7 +2996,7 @@ herr_t H5TBdelete_field( hid_t loc_id, *------------------------------------------------------------------------- */ - if ( H5Gunlink( loc_id, dset_name ) < 0 ) + if ( H5Gunlink( loc_id, dset_name ) < 0 ) return -1; /*------------------------------------------------------------------------- @@ -3004,9 +3004,9 @@ herr_t H5TBdelete_field( hid_t loc_id, *------------------------------------------------------------------------- */ - if ( H5Gmove( loc_id, "new", dset_name ) < 0 ) + if ( H5Gmove( loc_id, "new", dset_name ) < 0 ) return -1; - + /*------------------------------------------------------------------------- * Attach the conforming table attributes *------------------------------------------------------------------------- @@ -3035,45 +3035,45 @@ herr_t H5TBdelete_field( hid_t loc_id, if ( has_fill == 1 ) { - + if (( space_id1 = H5Screate(H5S_SCALAR)) < 0 ) goto out; - + for ( i = 0; i < nfields; i++) { - + /* Get the member type */ if ( ( member_type_id = H5Tget_member_type( type_id1, (unsigned)i )) < 0 ) goto out; - + /* Get the member offset */ member_offset = H5Tget_member_offset( type_id1, (unsigned)i ); - + strcpy( attr_name, "FIELD_" ); sprintf( aux, "%d", (int)i ); strcat( attr_name, aux ); sprintf( aux, "%s", "_FILL" ); strcat( attr_name, aux ); - + if ( (attr_id = H5Acreate( dataset_id1, attr_name, member_type_id, space_id1, H5P_DEFAULT )) < 0 ) goto out; - + if ( H5Awrite( attr_id, member_type_id, tmp_fill_buf+member_offset ) < 0 ) goto out; - + if ( H5Aclose( attr_id ) < 0 ) goto out; - + /* Close the member type */ if ( H5Tclose( member_type_id ) < 0 ) goto out; - + } - - /* Close data space. */ + + /* Close data space. */ if ( H5Sclose( space_id1 ) < 0 ) goto out; - + } /*has_fill*/ /* Release the datatype. */ @@ -3083,7 +3083,7 @@ herr_t H5TBdelete_field( hid_t loc_id, /* End access to the dataset */ if ( H5Dclose( dataset_id1 ) < 0 ) goto out; - + /* Release resources. */ free ( tmp_fill_buf ); @@ -3095,9 +3095,9 @@ out: } /*------------------------------------------------------------------------- - * + * * Table attribute functions - * + * *------------------------------------------------------------------------- */ @@ -3112,22 +3112,22 @@ out: * * Date: January 30, 2001 * - * Comments: + * Comments: * - * Modifications: + * Modifications: * *------------------------------------------------------------------------- */ -herr_t H5TBAget_title( hid_t loc_id, - char *table_title ) +herr_t H5TBAget_title( hid_t loc_id, + char *table_title ) { /* Get the TITLE attribute */ if ( H5LT_get_attribute_disk( loc_id, "TITLE", table_title ) < 0 ) return -1; - + return 0; } @@ -3143,18 +3143,18 @@ herr_t H5TBAget_title( hid_t loc_id, * * Date: January 30, 2002 * - * Comments: + * Comments: * - * Modifications: + * Modifications: * *------------------------------------------------------------------------- */ -herr_t H5TBAget_fill( hid_t loc_id, +herr_t H5TBAget_fill( hid_t loc_id, const char *dset_name, hid_t dset_id, - unsigned char *dst_buf ) + unsigned char *dst_buf ) { hsize_t nfields; @@ -3168,7 +3168,7 @@ herr_t H5TBAget_fill( hid_t loc_id, /* Get the number of records and fields */ if ( H5TBget_table_info ( loc_id, dset_name, &nfields, &nrecords ) < 0 ) return -1; - + src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t)); if (src_offset == NULL ) @@ -3217,7 +3217,7 @@ out: */ /*------------------------------------------------------------------------- - * Function: H5TBget_table_info + * Function: H5TBget_table_info * * Purpose: Gets the number of records and fields of a table * @@ -3230,26 +3230,26 @@ out: * Comments: * * Modifications: May 08, 2003 - * In version 2.0 of Table, the number of records is stored as an + * In version 2.0 of Table, the number of records is stored as an * attribute "NROWS" * * *------------------------------------------------------------------------- */ -herr_t H5TBget_table_info ( hid_t loc_id, +herr_t H5TBget_table_info ( hid_t loc_id, const char *dset_name, hsize_t *nfields, hsize_t *nrecords ) { - hid_t tid; + hid_t tid; hid_t sid=-1; hid_t did; int num_members; hsize_t dims[1]; int has_attr; hsize_t n[1]; - + /* Open the dataset. */ if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) return -1; @@ -3270,19 +3270,19 @@ herr_t H5TBget_table_info ( hid_t loc_id, * Get number of records *------------------------------------------------------------------------- */ - + if (nrecords) { /* Try to find the attribute "NROWS" */ has_attr = H5LT_find_attribute( did, "NROWS" ); - + /* It exists, get it */ if ( has_attr == 1 ) { /* Get the attribute */ if ( H5LTget_attribute(loc_id,dset_name,"NROWS",H5T_NATIVE_LLONG,n)<0) return -1; - + *nrecords = *n; } else @@ -3290,15 +3290,15 @@ herr_t H5TBget_table_info ( hid_t loc_id, /* Get the dataspace handle */ if ( (sid = H5Dget_space( did )) < 0 ) goto out; - + /* Get records */ if ( H5Sget_simple_extent_dims( sid, dims, NULL) < 0 ) goto out; - + /* Terminate access to the dataspace */ if ( H5Sclose( sid ) < 0 ) goto out; - + *nrecords = dims[0]; } }/*nrecords*/ @@ -3340,7 +3340,7 @@ out: * *------------------------------------------------------------------------- */ -herr_t H5TBget_field_info( hid_t loc_id, +herr_t H5TBget_field_info( hid_t loc_id, const char *dset_name, char *field_names[], size_t *field_sizes, @@ -3348,7 +3348,7 @@ herr_t H5TBget_field_info( hid_t loc_id, size_t *type_size ) { hid_t did; - hid_t ftype_id; + hid_t ftype_id; hid_t native_type_id; hssize_t nfields; char *member_name; @@ -3414,7 +3414,7 @@ herr_t H5TBget_field_info( hid_t loc_id, goto out; free( member_name ); - + } /* i */ /* Release the datatype. */ @@ -3459,19 +3459,19 @@ out: int H5TB_find_field( const char *field, const char *field_list ) { - const char *start = field_list; - const char *end; + const char *start = field_list; + const char *end; - while ( (end = strstr( start, "," )) != 0 ) { - if ( strncmp(start,field,(size_t)(end-start)) == 0 ) return 1; - start = end + 1; - } + while ( (end = strstr( start, "," )) != 0 ) { + if ( strncmp(start,field,(size_t)(end-start)) == 0 ) return 1; + start = end + 1; + } - if ( strcmp( start, field ) == 0 ) return 1; + if ( strcmp( start, field ) == 0 ) return 1; - return -1; + return -1; -} +} /*------------------------------------------------------------------------- @@ -3496,17 +3496,17 @@ int H5TB_find_field( const char *field, const char *field_list ) herr_t H5TB_attach_attributes( const char *table_title, - hid_t loc_id, + hid_t loc_id, const char *dset_name, hsize_t nfields, - hid_t tid ) + hid_t tid ) { char attr_name[255]; char *member_name; char aux[255]; hsize_t i; - + /* Attach the CLASS attribute */ if ( H5LTset_attribute_string( loc_id, dset_name, "CLASS", TABLE_CLASS ) < 0 ) goto out; @@ -3514,7 +3514,7 @@ herr_t H5TB_attach_attributes( const char *table_title, /* Attach the VERSION attribute */ if ( H5LTset_attribute_string( loc_id, dset_name, "VERSION", "2.0" ) < 0 ) goto out; - + /* Attach the TITLE attribute */ if ( H5LTset_attribute_string( loc_id, dset_name, "TITLE", table_title ) < 0 ) goto out; @@ -3531,7 +3531,7 @@ herr_t H5TB_attach_attributes( const char *table_title, strcat( attr_name, aux ); sprintf( aux, "%s", "_NAME" ); strcat( attr_name, aux ); - + /* Attach the attribute */ if ( H5LTset_attribute_string( loc_id, dset_name, attr_name, member_name ) < 0 ) goto out; @@ -3565,10 +3565,10 @@ out: *------------------------------------------------------------------------- */ -hid_t H5TB_create_type(hid_t loc_id, +hid_t H5TB_create_type(hid_t loc_id, const char *dset_name, - size_t dst_size, - const size_t *dst_offset, + size_t dst_size, + const size_t *dst_offset, const size_t *dst_sizes, hid_t ftype_id) { @@ -3587,7 +3587,7 @@ hid_t H5TB_create_type(hid_t loc_id, if ((fnames=malloc(sizeof(char*)*(size_t)nfields))==NULL) return -1; - for ( i=0; i<nfields; i++) + for ( i=0; i<nfields; i++) { if ((fnames[i]=malloc(sizeof(char)*HLTB_MAX_FIELD_LEN))==NULL) { free(fnames); @@ -3598,13 +3598,13 @@ hid_t H5TB_create_type(hid_t loc_id, /* get field info */ if ( H5TBget_field_info(loc_id,dset_name,fnames,NULL,NULL,NULL)<0) goto out; - + /* create the memory data type */ if ((mem_type_id=H5Tcreate(H5T_COMPOUND,dst_size))<0) goto out; /* get each field ID and adjust its size, if necessary */ - for ( i=0; i<nfields; i++) + for ( i=0; i<nfields; i++) { if ((mtype_id=H5Tget_member_type(ftype_id,i))<0) goto out; @@ -3624,7 +3624,7 @@ hid_t H5TB_create_type(hid_t loc_id, goto out; } - for ( i=0; i<nfields; i++) + for ( i=0; i<nfields; i++) { free (fnames[i]); } @@ -3638,7 +3638,7 @@ out: H5Tclose(mtype_id); H5Tclose(nmtype_id); } H5E_END_TRY; - for ( i=0; i<nfields; i++) + for ( i=0; i<nfields; i++) { if (fnames[i]) free (fnames[i]); |