From 16683943c6edb42f9129cc5d6c8f340c74014dad Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 8 Oct 2007 14:59:36 -0500 Subject: [svn-r14193] Description: Make H5Dopen versioned and change all internal usage to use H5Dopen2 Add simple regression test for H5Dopen1 Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.4.10 (amazon) in debug mode --- c++/src/H5CommonFG.cpp | 10 +- examples/Attributes.txt | 6 +- examples/h5_attribute.c | 2 +- examples/h5_chunk_read.c | 2 +- examples/h5_compound.c | 2 +- examples/h5_group.c | 6 +- examples/h5_mount.c | 2 +- examples/h5_read.c | 2 +- examples/h5_ref2reg.c | 2 +- examples/h5_reference.c | 2 +- examples/h5_select.c | 2 +- examples/ph5example.c | 12 +- fortran/src/H5Df.c | 25 +- hl/examples/ex_ds1.c | 6 +- hl/fortran/src/H5IMcc.c | 50 +-- hl/src/H5IM.c | 18 +- hl/src/H5LT.c | 345 ++++++---------- hl/src/H5PT.c | 4 +- hl/src/H5TB.c | 116 +++--- hl/src/Makefile.am | 2 +- hl/test/test_ds.c | 198 ++++----- hl/test/test_lite.c | 2 +- hl/test/test_packet.c | 6 +- perform/chunk.c | 12 +- perform/perf.c | 148 ++++--- perform/perf_meta.c | 8 +- perform/pio_engine.c | 9 +- src/H5Ddeprec.c | 13 +- src/H5Dpublic.h | 2 +- src/H5O.c | 4 +- src/H5public.h | 6 +- src/H5vers.txt | 1 + src/H5version.h | 15 + test/Makefile.am | 6 +- test/big.c | 135 ++++--- test/cmpd_dset.c | 366 ++++++++--------- test/cross_read.c | 10 +- test/dangle.c | 11 +- test/dsets.c | 529 +++++++++++++++--------- test/dtypes.c | 669 +++++++++++++++---------------- test/external.c | 70 ++-- test/fillval.c | 427 ++++++++++---------- test/flush2.c | 23 +- test/getname.c | 54 +-- test/links.c | 4 +- test/mount.c | 2 +- test/mtime.c | 2 +- test/ntypes.c | 840 +++++++++++++++++++-------------------- test/objcopy.c | 112 +++--- test/ohdr.c | 10 +- test/reserved.c | 105 +++-- test/set_extent.c | 156 ++++---- test/stream_test.c | 53 ++- test/tarray.c | 256 ++++++------ test/tattr.c | 96 ++--- test/testmeta.c | 16 +- test/tfile.c | 16 +- test/th5o.c | 16 +- test/th5s.c | 38 +- test/titerate.c | 4 +- test/tmisc.c | 92 ++--- test/trefer.c | 28 +- test/tselect.c | 64 +-- test/tsohm.c | 245 ++++++------ test/ttime.c | 4 +- test/ttsafe_cancel.c | 2 +- test/ttsafe_dcreate.c | 38 +- test/ttsafe_error.c | 4 +- test/tunicode.c | 12 +- test/tvlstr.c | 6 +- test/tvltypes.c | 258 ++++++------ test/unlink.c | 2 +- test/vfd.c | 87 ++-- testpar/t_chunk_alloc.c | 4 +- testpar/t_coll_chunk.c | 2 +- testpar/t_dset.c | 24 +- testpar/t_filter_read.c | 4 +- testpar/t_mdset.c | 12 +- testpar/t_pflush2.c | 10 +- testpar/t_span_tree.c | 12 +- tools/h5dump/h5dump.c | 49 +-- tools/h5repack/Makefile.am | 4 +- tools/h5repack/h5repack_copy.c | 68 ++-- tools/h5repack/h5repack_list.c | 72 ++-- tools/h5repack/h5repack_refs.c | 14 +- tools/h5repack/h5repack_verify.c | 125 +++--- tools/h5stat/h5stat.c | 2 +- tools/lib/h5diff_attr.c | 6 +- tools/lib/h5diff_dset.c | 42 +- tools/lib/h5tools_utils.c | 4 +- tools/lib/talign.c | 6 +- 91 files changed, 3181 insertions(+), 3187 deletions(-) diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index 653cbd1..7cd3705 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -200,15 +200,13 @@ DataSet CommonFG::createDataSet( const H5std_string& name, const DataType& data_ //-------------------------------------------------------------------------- DataSet CommonFG::openDataSet( const char* name ) const { - // Call C function H5Dopen to open the specified dataset, giving + // Call C function H5Dopen2 to open the specified dataset, giving // the location id and the dataset's name - hid_t dataset_id = H5Dopen( getLocId(), name ); + hid_t dataset_id = H5Dopen2( getLocId(), name, H5P_DEFAULT ); // If the dataset's opening failed, throw an exception - if( dataset_id < 0 ) - { - throwException("openDataSet", "H5Dopen failed"); - } + if(dataset_id < 0) + throwException("openDataSet", "H5Dopen2 failed"); // No failure, create and return the DataSet object DataSet dataset( dataset_id ); diff --git a/examples/Attributes.txt b/examples/Attributes.txt index 76f2aae..e32601c 100644 --- a/examples/Attributes.txt +++ b/examples/Attributes.txt @@ -85,7 +85,7 @@ H5Aread Example: Attach to an attribute of a dataset and read in attr. data file=H5Fopen("example.h5", H5F_ACC_RDWR, H5P_DEFAULT); /* Open the dataset */ - dataset=H5Dopen(file,"Dataset1"); + dataset=H5Dopen2(file, "Dataset1", H5P_DEFAULT); /* Get the OID of the attribute */ attr=H5Aopen(dataset, ".", "Attr1", H5P_DEFAULT, H5P_DEFAULT); @@ -114,10 +114,10 @@ H5Alink Example: Shows how to share an attribute between two datasets. file=H5Fopen("example.h5", H5F_ACC_RDWR, H5P_DEFAULT); /* Open the first dataset */ - dataset1=H5Dopen(file, "Dataset1"); + dataset1=H5Dopen2(file, "Dataset1", H5P_DEFAULT); /* Open the first dataset */ - dataset2=H5Dopen(file, "Dataset2"); + dataset2=H5Dopen2(file, "Dataset2", H5P_DEFAULT); /* Get the OID of the attribute */ attr=H5Aopen(dataset1, ".", "Foo", H5P_DEFAULT, H5P_DEFAULT); diff --git a/examples/h5_attribute.c b/examples/h5_attribute.c index 1581a88..b49b0e1 100644 --- a/examples/h5_attribute.c +++ b/examples/h5_attribute.c @@ -178,7 +178,7 @@ main (void) /* * Open the dataset. */ - dataset = H5Dopen(file,"Dataset"); + dataset = H5Dopen2(file, "Dataset", H5P_DEFAULT); /* * Attach to the scalar attribute using attribute name, then read and diff --git a/examples/h5_chunk_read.c b/examples/h5_chunk_read.c index fb018f3..98b0bb4 100644 --- a/examples/h5_chunk_read.c +++ b/examples/h5_chunk_read.c @@ -55,7 +55,7 @@ main (void) * Open the file and the dataset. */ file = H5Fopen(H5FILE_NAME, H5F_ACC_RDONLY, H5P_DEFAULT); - dataset = H5Dopen(file, DATASETNAME); + dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT); /* * Get dataset rank and dimension. diff --git a/examples/h5_compound.c b/examples/h5_compound.c index 544a239..da22c87 100644 --- a/examples/h5_compound.c +++ b/examples/h5_compound.c @@ -107,7 +107,7 @@ main(void) */ file = H5Fopen(H5FILE_NAME, H5F_ACC_RDONLY, H5P_DEFAULT); - dataset = H5Dopen(file, DATASETNAME); + dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT); /* * Create a data type for s2 diff --git a/examples/h5_group.c b/examples/h5_group.c index 744f7b8..f0adff7 100644 --- a/examples/h5_group.c +++ b/examples/h5_group.c @@ -106,7 +106,7 @@ main(void) /* * Access "Compressed_Data" dataset in the group. */ - dataset = H5Dopen(grp, "Compressed_Data"); + dataset = H5Dopen2(grp, "Compressed_Data", H5P_DEFAULT); if( dataset < 0) printf(" Dataset 'Compressed-Data' is not found. \n"); printf("\"/Data/Compressed_Data\" dataset is open \n"); @@ -124,7 +124,7 @@ main(void) * We can access "Compressed_Data" dataset using created * hard link "Data_new". */ - dataset = H5Dopen(file, "/Data_new/Compressed_Data"); + dataset = H5Dopen2(file, "/Data_new/Compressed_Data", H5P_DEFAULT); if( dataset < 0) printf(" Dataset is not found. \n"); printf("\"/Data_new/Compressed_Data\" dataset is open \n"); @@ -207,7 +207,7 @@ group_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *opdata /* * Open the datasets using their names. */ - did = H5Dopen(loc_id, name); + did = H5Dopen2(loc_id, name, H5P_DEFAULT); /* * Display dataset name. diff --git a/examples/h5_mount.c b/examples/h5_mount.c index 04c6184..6c4910c 100644 --- a/examples/h5_mount.c +++ b/examples/h5_mount.c @@ -97,7 +97,7 @@ int main(void) /* * Access dataset D in the first file under /G/D name. */ - did = H5Dopen(fid1,"/G/D"); + did = H5Dopen2(fid1, "/G/D", H5P_DEFAULT); tid = H5Dget_type(did); status = H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, bm_out); diff --git a/examples/h5_read.c b/examples/h5_read.c index 2d90f02..6fe75be 100644 --- a/examples/h5_read.c +++ b/examples/h5_read.c @@ -67,7 +67,7 @@ main (void) * Open the file and the dataset. */ file = H5Fopen(H5FILE_NAME, H5F_ACC_RDONLY, H5P_DEFAULT); - dataset = H5Dopen(file, DATASETNAME); + dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT); /* * Get datatype and dataspace handles and then query diff --git a/examples/h5_ref2reg.c b/examples/h5_ref2reg.c index d5d24de..1459161 100644 --- a/examples/h5_ref2reg.c +++ b/examples/h5_ref2reg.c @@ -123,7 +123,7 @@ int main(void) * Reopen the dataset with object references and read references * to the buffer. */ - dsetr_id = H5Dopen (file_id, dsetnamer); + dsetr_id = H5Dopen2(file_id, dsetnamer, H5P_DEFAULT); status = H5Dread(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_out); diff --git a/examples/h5_reference.c b/examples/h5_reference.c index 002d753..3bd1ab3 100644 --- a/examples/h5_reference.c +++ b/examples/h5_reference.c @@ -112,7 +112,7 @@ main(void) { /* * Open and read dataset "R". */ - did_r = H5Dopen(fid, "R"); + did_r = H5Dopen2(fid, "R", H5P_DEFAULT); status = H5Dread(did_r, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf); diff --git a/examples/h5_select.c b/examples/h5_select.c index 249f2ba..d39458f 100644 --- a/examples/h5_select.c +++ b/examples/h5_select.c @@ -216,7 +216,7 @@ main (void) /* * Open the dataset. */ - dataset = H5Dopen(file,"Matrix in file"); + dataset = H5Dopen2(file, "Matrix in file", H5P_DEFAULT); /* * Get dataspace of the open dataset. diff --git a/examples/ph5example.c b/examples/ph5example.c index cc70d40..851536a 100644 --- a/examples/ph5example.c +++ b/examples/ph5example.c @@ -404,11 +404,11 @@ phdf5readInd(char *filename) assert(ret != FAIL); /* open the dataset1 collectively */ - dataset1 = H5Dopen(fid1, DATASETNAME1); + dataset1 = H5Dopen2(fid1, DATASETNAME1, H5P_DEFAULT); assert(dataset1 != FAIL); /* open another dataset collectively */ - dataset2 = H5Dopen(fid1, DATASETNAME1); + dataset2 = H5Dopen2(fid1, DATASETNAME1, H5P_DEFAULT); assert(dataset2 != FAIL); @@ -731,14 +731,14 @@ phdf5readAll(char *filename) * Open the datasets in it * ------------------------- */ /* open the dataset1 collectively */ - dataset1 = H5Dopen(fid1, DATASETNAME1); + dataset1 = H5Dopen2(fid1, DATASETNAME1, H5P_DEFAULT); assert(dataset1 != FAIL); - MESG("H5Dopen succeed"); + MESG("H5Dopen2 succeed"); /* open another dataset collectively */ - dataset2 = H5Dopen(fid1, DATASETNAME1); + dataset2 = H5Dopen2(fid1, DATASETNAME1, H5P_DEFAULT); assert(dataset2 != FAIL); - MESG("H5Dopen 2 succeed"); + MESG("H5Dopen2 2 succeed"); /* * Set up dimensions of the slab this process accesses. diff --git a/fortran/src/H5Df.c b/fortran/src/H5Df.c index 082bed5..78d484f 100644 --- a/fortran/src/H5Df.c +++ b/fortran/src/H5Df.c @@ -74,7 +74,7 @@ DONE: /*---------------------------------------------------------------------------- * Name: h5dopen_c - * Purpose: Call H5Dopen to open a dataset + * Purpose: Call H5Dopen2 to open a dataset * Inputs: loc_id - file or group identifier * name - name of the dataset * namelen - name length @@ -85,33 +85,30 @@ DONE: * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5dopen_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *dset_id) +nh5dopen_c(hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *dset_id) { - int ret_value = -1; - char *c_name; - size_t c_namelen; - hid_t c_loc_id; + char *c_name = NULL; hid_t c_dset_id; + int ret_value = -1; /* * Convert FORTRAN name to C name */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + goto DONE; /* - * Call H5Dopen function. + * Call H5Dopen2 function. */ - c_loc_id = (hid_t)*loc_id; - c_dset_id = H5Dopen(c_loc_id, c_name); + if((c_dset_id = H5Dopen2((hid_t)*loc_id, c_name, H5P_DEFAULT)) < 0) + goto DONE; - if (c_dset_id < 0) goto DONE; *dset_id = (hid_t_f)c_dset_id; ret_value = 0; DONE: - HDfree(c_name); + if(c_name) + HDfree(c_name); return ret_value; } diff --git a/hl/examples/ex_ds1.c b/hl/examples/ex_ds1.c index dc5efc9..8b7e530 100644 --- a/hl/examples/ex_ds1.c +++ b/hl/examples/ex_ds1.c @@ -67,11 +67,11 @@ int main(void) */ /* get the dataset id for DSET_NAME */ - if ((did = H5Dopen(fid,DSET_NAME))<0) + if ((did = H5Dopen2(fid,DSET_NAME, H5P_DEFAULT))<0) goto out; /* get the DS dataset id */ - if ((dsid = H5Dopen(fid,DS_1_NAME))<0) + if ((dsid = H5Dopen2(fid,DS_1_NAME, H5P_DEFAULT))<0) goto out; /* attach the DS_1_NAME dimension scale to DSET_NAME at dimension index 0 */ @@ -88,7 +88,7 @@ int main(void) */ /* get the DS dataset id */ - if ((dsid = H5Dopen(fid,DS_2_NAME))<0) + if ((dsid = H5Dopen2(fid,DS_2_NAME, H5P_DEFAULT))<0) goto out; /* attach the DS_2_NAME dimension scale to DSET_NAME as the 2nd dimension (index 1) */ diff --git a/hl/fortran/src/H5IMcc.c b/hl/fortran/src/H5IMcc.c index dc1cfc1..0b0f75a 100644 --- a/hl/fortran/src/H5IMcc.c +++ b/hl/fortran/src/H5IMcc.c @@ -268,34 +268,36 @@ herr_t H5IMread_imagef( hid_t loc_id, const char *dset_name, int_f *buf ) { - hid_t did; + hid_t did; + hid_t tid; - /* open the dataset */ - if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) - return -1; + /* open the dataset */ + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + return -1; - /* read to memory type H5T_NATIVE_INT */ - if (sizeof(int_f) == sizeof(int)){ - if ( H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf ) < 0 ) - goto out;} - else if (sizeof(int_f) == sizeof(long)) { - if ( H5Dread( did, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf ) < 0 ) - goto out;} - else if (sizeof(int_f) == sizeof(long_long)) { - if ( H5Dread( did, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf ) < 0 ) - goto out;} - else - goto out; + /* determine appropriate datatype to use */ + if(sizeof(int_f) == sizeof(int)) + tid = H5T_NATIVE_INT; + else if(sizeof(int_f) == sizeof(long)) + tid = H5T_NATIVE_LONG; + else if(sizeof(int_f) == sizeof(long_long)) + tid = H5T_NATIVE_LLONG; + else + goto out; - /* close */ - if ( H5Dclose( did ) ) - return -1; - return 0; + /* read to memory */ + if(H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + goto out; -out: - H5Dclose( did ); - return -1; + /* close */ + if(H5Dclose(did)) + return -1; + return 0; + +out: + H5Dclose(did); + return -1; } @@ -478,7 +480,7 @@ herr_t H5IM_get_palette( hid_t loc_id, hid_t pal_id; /* Open the dataset. */ - if((image_id = H5Dopen(loc_id, image_name)) < 0) + if((image_id = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0) return -1; /* Try to find the attribute "PALETTE" on the >>image<< dataset */ diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c index c7e905d..1405f8d 100644 --- a/hl/src/H5IM.c +++ b/hl/src/H5IM.c @@ -253,7 +253,7 @@ herr_t H5IMget_image_info( hid_t loc_id, *npals = 0; /* Open the dataset. */ - if((did = H5Dopen(loc_id, dset_name)) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; /* Try to find the attribute "INTERLACE_MODE" on the >>image<< dataset */ @@ -407,7 +407,7 @@ herr_t H5IMread_image( hid_t loc_id, hid_t did; /* Open the dataset. */ - if ( (did = H5Dopen( loc_id, dset_name )) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; /* Read */ @@ -527,7 +527,7 @@ herr_t H5IMlink_palette( hid_t loc_id, */ /* First we get the image id */ - if ( (image_id = H5Dopen( loc_id, image_name )) < 0) + if((image_id = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0) return -1; /* Try to find the attribute "PALETTE" on the >>image<< dataset */ @@ -694,7 +694,7 @@ herr_t H5IMunlink_palette( hid_t loc_id, */ /* First we get the image id */ - if ( (image_id = H5Dopen( loc_id, image_name )) < 0) + if((image_id = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0) return -1; /* Try to find the attribute "PALETTE" on the >>image<< dataset */ @@ -780,7 +780,7 @@ herr_t H5IMget_npalettes( hid_t loc_id, *npals = 0; /* Open the dataset. */ - if((image_id = H5Dopen(loc_id, image_name)) < 0) + if((image_id = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0) return -1; /* Try to find the attribute "PALETTE" on the >>image<< dataset */ @@ -873,7 +873,7 @@ herr_t H5IMget_palette_info( hid_t loc_id, hsize_t pal_maxdims[2]; /* Open the dataset. */ - if((image_id = H5Dopen(loc_id, image_name)) < 0) + if((image_id = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0) return -1; /* Try to find the attribute "PALETTE" on the >>image<< dataset */ @@ -985,7 +985,7 @@ herr_t H5IMget_palette( hid_t loc_id, hid_t pal_id; /* Open the dataset. */ - if((image_id = H5Dopen(loc_id, image_name)) < 0) + if((image_id = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0) return -1; /* Try to find the attribute "PALETTE" on the >>image<< dataset */ @@ -1084,7 +1084,7 @@ herr_t H5IMis_image( hid_t loc_id, ret = -1; /* Open the dataset. */ - if ( (did = H5Dopen( loc_id, dset_name )) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; /* Try to find the attribute "CLASS" on the dataset */ @@ -1169,7 +1169,7 @@ herr_t H5IMis_palette( hid_t loc_id, ret = -1; /* Open the dataset. */ - if ( (did = H5Dopen( loc_id, dset_name )) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; /* Try to find the attribute "CLASS" on the dataset */ diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 865dfb2..a98d567 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -560,44 +560,63 @@ out: /*------------------------------------------------------------------------- - * Function: H5LTread_dataset + * Function: H5LT_read_dataset * * Purpose: Reads a dataset from disk. * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Quincey Koziol, koziol@hdfgroup.org * - * Date: June 13, 2001 + * Date: October 8, 2007 * *------------------------------------------------------------------------- */ -herr_t H5LTread_dataset( hid_t loc_id, - const char *dset_name, - hid_t tid, - void *data ) +static herr_t +H5LT_read_dataset(hid_t loc_id, const char *dset_name, hid_t tid, void *data) { - hid_t did; + hid_t did; - /* Open the dataset. */ - if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) - return -1; + /* Open the dataset. */ + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + return -1; - /* Read */ - if ( H5Dread( did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, data ) < 0 ) - goto out; + /* Read */ + if(H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + goto out; - /* End access to the dataset and release resources used by it. */ - if ( H5Dclose( did ) ) - return -1; + /* End access to the dataset and release resources used by it. */ + if(H5Dclose(did)) + return -1; - return 0; + return 0; out: - H5Dclose( did ); - return -1; + H5Dclose(did); + return -1; +} +/*------------------------------------------------------------------------- + * Function: H5LTread_dataset + * + * Purpose: Reads a dataset from disk. + * + * Return: Success: 0, Failure: -1 + * + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: June 13, 2001 + * + *------------------------------------------------------------------------- + */ + +herr_t H5LTread_dataset(hid_t loc_id, + const char *dset_name, + hid_t tid, + void *data) +{ + return(H5LT_read_dataset(loc_id, dset_name, tid, data)); } @@ -619,26 +638,7 @@ herr_t H5LTread_dataset_char( hid_t loc_id, const char *dset_name, char *data ) { - hid_t did; - - /* Open the dataset. */ - if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) - return -1; - - /* Read */ - if ( H5Dread( did, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data ) < 0 ) - goto out; - - /* End access to the dataset and release resources used by it. */ - if ( H5Dclose( did ) ) - return -1; - - return 0; - -out: - H5Dclose( did ); - return -1; - + return(H5LTread_dataset(loc_id, dset_name, H5T_NATIVE_CHAR, data)); } /*------------------------------------------------------------------------- @@ -659,26 +659,7 @@ herr_t H5LTread_dataset_short( hid_t loc_id, const char *dset_name, short *data ) { - hid_t did; - - /* Open the dataset. */ - if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) - return -1; - - /* Read */ - if ( H5Dread( did, H5T_NATIVE_SHORT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data ) < 0 ) - goto out; - - /* End access to the dataset and release resources used by it. */ - if ( H5Dclose( did ) ) - return -1; - - return 0; - -out: - H5Dclose( did ); - return -1; - + return(H5LTread_dataset(loc_id, dset_name, H5T_NATIVE_SHORT, data)); } /*------------------------------------------------------------------------- @@ -699,26 +680,7 @@ herr_t H5LTread_dataset_int( hid_t loc_id, const char *dset_name, int *data ) { - hid_t did; - - /* Open the dataset. */ - if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) - return -1; - - /* Read */ - if ( H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data ) < 0 ) - goto out; - - /* End access to the dataset and release resources used by it. */ - if ( H5Dclose( did ) ) - return -1; - - return 0; - -out: - H5Dclose( did ); - return -1; - + return(H5LTread_dataset(loc_id, dset_name, H5T_NATIVE_INT, data)); } /*------------------------------------------------------------------------- @@ -739,26 +701,7 @@ herr_t H5LTread_dataset_long( hid_t loc_id, const char *dset_name, long *data ) { - hid_t did; - - /* Open the dataset. */ - if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) - return -1; - - /* Read */ - if ( H5Dread( did, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, data ) < 0 ) - goto out; - - /* End access to the dataset and release resources used by it. */ - if ( H5Dclose( did ) ) - return -1; - - return 0; - -out: - H5Dclose( did ); - return -1; - + return(H5LTread_dataset(loc_id, dset_name, H5T_NATIVE_LONG, data)); } /*------------------------------------------------------------------------- @@ -779,26 +722,7 @@ herr_t H5LTread_dataset_float( hid_t loc_id, const char *dset_name, float *data ) { - hid_t did; - - /* Open the dataset. */ - if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) - return -1; - - /* Read */ - if ( H5Dread( did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data ) < 0 ) - goto out; - - /* End access to the dataset and release resources used by it. */ - if ( H5Dclose( did ) ) - return -1; - - return 0; - -out: - H5Dclose( did ); - return -1; - + return(H5LTread_dataset(loc_id, dset_name, H5T_NATIVE_FLOAT, data)); } @@ -820,26 +744,7 @@ herr_t H5LTread_dataset_double( hid_t loc_id, const char *dset_name, double *data ) { - hid_t did; - - /* Open the dataset. */ - if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) - return -1; - - /* Read */ - if ( H5Dread( did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, data ) < 0 ) - goto out; - - /* End access to the dataset and release resources used by it. */ - if ( H5Dclose( did ) ) - return -1; - - return 0; - -out: - H5Dclose( did ); - return -1; - + return(H5LTread_dataset(loc_id, dset_name, H5T_NATIVE_DOUBLE, data)); } @@ -861,33 +766,34 @@ herr_t H5LTread_dataset_string( hid_t loc_id, const char *dset_name, char *buf ) { - hid_t did; - hid_t tid; + hid_t did = -1; + hid_t tid = -1; - /* Open the dataset. */ - if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) - return -1; + /* Open the dataset. */ + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + return -1; - if ( (tid = H5Dget_type(did)) < 0 ) - goto out; + if((tid = H5Dget_type(did)) < 0) + goto out; - /* Read */ - if ( H5Dread(did,tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0 ) - goto out; + /* Read */ + if(H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + goto out; - /* close */ - if ( H5Dclose(did) ) - goto out; - if ( H5Tclose(tid) ) - return -1; + /* close */ + if(H5Dclose(did)) + goto out; + if(H5Tclose(tid)) + return -1; - return 0; + return 0; out: - H5Dclose( did ); - H5Tclose( tid ); - return -1; - + H5E_BEGIN_TRY { + H5Dclose(did); + H5Tclose(tid); + } H5E_END_TRY; + return -1; } @@ -909,36 +815,37 @@ herr_t H5LTget_dataset_ndims( hid_t loc_id, const char *dset_name, int *rank ) { - hid_t did; - hid_t sid; + hid_t did = -1; + hid_t sid = -1; - /* Open the dataset. */ - if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) - return -1; + /* Open the dataset. */ + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + return -1; - /* Get the dataspace handle */ - if ( (sid = H5Dget_space( did )) < 0 ) - goto out; + /* Get the dataspace handle */ + if((sid = H5Dget_space(did)) < 0) + goto out; - /* Get rank */ - if ( (*rank = H5Sget_simple_extent_ndims( sid )) < 0 ) - goto out; + /* Get rank */ + if((*rank = H5Sget_simple_extent_ndims(sid)) < 0) + goto out; - /* Terminate access to the dataspace */ - if ( H5Sclose( sid ) < 0 ) - goto out; + /* Terminate access to the dataspace */ + if(H5Sclose(sid) < 0) + goto out; - /* End access to the dataset */ - if ( H5Dclose( did ) ) - return -1; + /* End access to the dataset */ + if(H5Dclose(did)) + return -1; - return 0; + return 0; out: - H5Dclose( did ); - H5Sclose( sid ); - return -1; - + H5E_BEGIN_TRY { + H5Dclose(did); + H5Sclose(sid); + } H5E_END_TRY; + return -1; } @@ -963,54 +870,56 @@ herr_t H5LTget_dataset_info( hid_t loc_id, H5T_class_t *type_class, size_t *type_size ) { - hid_t did; - hid_t tid; - hid_t sid; + hid_t did = -1; + hid_t tid = -1; + hid_t sid = -1; - /* open the dataset. */ - if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) - return -1; + /* open the dataset. */ + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + return -1; - /* get an identifier for the datatype. */ - tid = H5Dget_type( did ); + /* get an identifier for the datatype. */ + tid = H5Dget_type(did); - /* get the class. */ - if (type_class!=NULL) - *type_class = H5Tget_class( tid ); + /* get the class. */ + if(type_class != NULL) + *type_class = H5Tget_class(tid); - /* get the size. */ - if (type_size!=NULL) - *type_size = H5Tget_size( tid ); + /* get the size. */ + if(type_size!=NULL) + *type_size = H5Tget_size(tid); - if (dims!=NULL) - { - /* get the dataspace handle */ - if ( (sid = H5Dget_space( did )) < 0 ) - goto out; + if(dims != NULL) { + /* 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 dimensions */ + if(H5Sget_simple_extent_dims(sid, dims, NULL) < 0) + goto out; - /* terminate access to the dataspace */ - if ( H5Sclose( sid ) < 0 ) - goto out; - } + /* terminate access to the dataspace */ + if(H5Sclose(sid) < 0) + goto out; + } /* end if */ - /* release the datatype. */ - if ( H5Tclose( tid ) ) - return -1; + /* release the datatype. */ + if(H5Tclose(tid)) + return -1; - /* end access to the dataset */ - if ( H5Dclose( did ) ) - return -1; + /* end access to the dataset */ + if(H5Dclose(did)) + return -1; - return 0; + return 0; out: - H5Tclose( tid ); - H5Dclose( did ); - return -1; + H5E_BEGIN_TRY { + H5Tclose(tid); + H5Sclose(sid); + H5Dclose(did); + } H5E_END_TRY; + return -1; } diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c index a486f35..aedc7b5 100644 --- a/hl/src/H5PT.c +++ b/hl/src/H5PT.c @@ -232,10 +232,10 @@ hid_t H5PTopen( hid_t loc_id, if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)free))<0) goto out; - table = (htbl_t *) malloc(sizeof(htbl_t)); + table = (htbl_t *)malloc(sizeof(htbl_t)); /* Open the dataset */ - if(( table->dset_id = H5Dopen(loc_id, dset_name)) <0) + if((table->dset_id = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; if (table->dset_id < 0) goto out; diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index 9193bbd..9f4b161 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -208,7 +208,7 @@ herr_t H5TBmake_table( const char *table_title, tmp_buf = fill_data; /* Open the dataset. */ - if((did = H5Dopen( loc_id, dset_name )) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; if (( sid = H5Screate(H5S_SCALAR)) < 0) @@ -313,18 +313,18 @@ herr_t H5TBappend_records( hid_t loc_id, return -1; /* Open the dataset. */ - if((did = H5Dopen( loc_id, dset_name )) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; /* Get the datatypes */ if((tid = H5Dget_type( did )) < 0) goto out; - if ((mem_type_id=H5TB_create_type(loc_id,dset_name,type_size,field_offset,field_sizes,tid))<0) + if ((mem_type_id=H5TB_create_type(loc_id,dset_name,type_size,field_offset,field_sizes,tid)) < 0) goto out; /* Append the records */ - if ((H5TB_common_append_records(did, mem_type_id, (size_t)nrecords, nrecords_orig, data))<0) + if ((H5TB_common_append_records(did, mem_type_id, (size_t)nrecords, nrecords_orig, data)) < 0) goto out; /* Release the datatype. */ @@ -396,14 +396,14 @@ herr_t H5TBwrite_records( hid_t loc_id, hid_t mem_type_id=-1; /* Open the dataset. */ - if((did = H5Dopen( loc_id, dset_name )) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; /* Get the datatype */ if((tid = H5Dget_type( did )) < 0) goto out; - if ((mem_type_id=H5TB_create_type(loc_id,dset_name,type_size,field_offset,field_sizes,tid))<0) + if ((mem_type_id=H5TB_create_type(loc_id,dset_name,type_size,field_offset,field_sizes,tid)) < 0) goto out; /* Get the dataspace handle */ @@ -512,13 +512,13 @@ 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. */ - if((did = H5Dopen( loc_id, dset_name )) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; /* Get the datatype */ @@ -549,7 +549,7 @@ herr_t H5TBwrite_fields_name( hid_t loc_id, goto out; /* Convert to native type */ - if ((nmtype_id=H5Tget_native_type(member_type_id,H5T_DIR_DEFAULT))<0) + if ((nmtype_id=H5Tget_native_type(member_type_id,H5T_DIR_DEFAULT)) < 0) goto out; size_native=H5Tget_size(nmtype_id); @@ -557,7 +557,7 @@ herr_t H5TBwrite_fields_name( hid_t loc_id, /* Adjust, if necessary */ if (field_sizes[j]!=size_native) { - if (H5Tset_size(nmtype_id, field_sizes[j])<0) + if (H5Tset_size(nmtype_id, field_sizes[j]) < 0) goto out; } @@ -683,13 +683,13 @@ 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. */ - if((did = H5Dopen( loc_id, dset_name )) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; /* Get the datatype */ @@ -714,14 +714,14 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, goto out; /* Convert to native type */ - if ((nmtype_id=H5Tget_native_type(member_type_id,H5T_DIR_DEFAULT))<0) + if ((nmtype_id=H5Tget_native_type(member_type_id,H5T_DIR_DEFAULT)) < 0) goto out; size_native=H5Tget_size(nmtype_id); if (field_sizes[i]!=size_native) { - if (H5Tset_size(nmtype_id, field_sizes[i])<0) + if (H5Tset_size(nmtype_id, field_sizes[i]) < 0) goto out; } @@ -834,7 +834,7 @@ herr_t H5TBread_table( hid_t loc_id, hsize_t dims[1]; /* open the dataset. */ - if ((did=H5Dopen(loc_id,dset_name))<0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; /* get the dataspace handle */ @@ -846,10 +846,10 @@ herr_t H5TBread_table( hid_t loc_id, 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,type_size,field_offset,field_sizes,ftype_id))<0) + if ((mem_type_id=H5TB_create_type(loc_id,dset_name,type_size,field_offset,field_sizes,ftype_id)) < 0) goto out; /* read */ @@ -927,14 +927,14 @@ herr_t H5TBread_records( hid_t loc_id, return -1; /* open the dataset */ - if((did = H5Dopen( loc_id, dset_name )) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; /* get the datatypes */ if((ftype_id = H5Dget_type( did )) < 0) goto out; - if ((mem_type_id=H5TB_create_type(loc_id,dset_name,type_size,field_offset,field_sizes,ftype_id))<0) + if ((mem_type_id=H5TB_create_type(loc_id,dset_name,type_size,field_offset,field_sizes,ftype_id)) < 0) goto out; /* Read the records */ @@ -1043,7 +1043,7 @@ herr_t H5TBread_fields_name( hid_t loc_id, hssize_t i, j; /* open the dataset */ - if((did = H5Dopen( loc_id, dset_name )) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; /* get the datatype */ @@ -1071,14 +1071,14 @@ herr_t H5TBread_fields_name( hid_t loc_id, goto out; /* convert to native type */ - if ((nmtype_id=H5Tget_native_type(mtype_id,H5T_DIR_DEFAULT))<0) + if ((nmtype_id=H5Tget_native_type(mtype_id,H5T_DIR_DEFAULT)) < 0) goto out; size_native=H5Tget_size(nmtype_id); if (field_sizes[j]!=size_native) { - if (H5Tset_size(nmtype_id, field_sizes[j])<0) + if (H5Tset_size(nmtype_id, field_sizes[j]) < 0) goto out; } /* the field in the file is found by its name */ @@ -1198,7 +1198,7 @@ herr_t H5TBread_fields_index( hid_t loc_id, hsize_t i, j; /* Open the dataset. */ - if((did = H5Dopen( loc_id, dset_name )) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; /* Get the datatype */ @@ -1226,14 +1226,14 @@ herr_t H5TBread_fields_index( hid_t loc_id, goto out; /* Convert to native type */ - if ((nmtype_id=H5Tget_native_type(member_type_id,H5T_DIR_DEFAULT))<0) + if ((nmtype_id=H5Tget_native_type(member_type_id,H5T_DIR_DEFAULT)) < 0) goto out; size_native=H5Tget_size(nmtype_id); if (field_sizes[i]!=size_native) { - if (H5Tset_size(nmtype_id, field_sizes[i])<0) + if (H5Tset_size(nmtype_id, field_sizes[i]) < 0) goto out; } @@ -1407,7 +1407,7 @@ herr_t H5TBdelete_record( hid_t loc_id, */ /* Open the dataset. */ - if((did = H5Dopen( loc_id, dset_name )) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; /* Get the datatype */ @@ -1472,7 +1472,7 @@ 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",(size_t)1, - H5T_NATIVE_LLONG,&nrows)<0) + H5T_NATIVE_LLONG,&nrows) < 0) return -1; @@ -1538,7 +1538,7 @@ herr_t H5TBinsert_record( hid_t loc_id, return -1; /* Open the dataset. */ - if((did = H5Dopen( loc_id, dset_name )) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; /* Get the datatype */ @@ -1546,7 +1546,7 @@ herr_t H5TBinsert_record( hid_t loc_id, goto out; /* Create the memory data type. */ - if ((mem_type_id=H5TB_create_type(loc_id,dset_name,type_size,field_offset,field_sizes,tid))<0) + if ((mem_type_id=H5TB_create_type(loc_id,dset_name,type_size,field_offset,field_sizes,tid)) < 0) goto out; read_nrecords = ntotal_records - start; @@ -1719,7 +1719,7 @@ herr_t H5TBadd_records_from( hid_t loc_id, */ /* Open the 1st dataset. */ - if((dataset_id1 = H5Dopen( loc_id, dset_name1 )) < 0) + if((dataset_id1 = H5Dopen2(loc_id, dset_name1, H5P_DEFAULT)) < 0) return -1; /* Get the datatype */ @@ -1890,7 +1890,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1, */ /* Open the 1st dataset. */ - if((dataset_id1 = H5Dopen( loc_id1, dset_name1 )) < 0) + if((dataset_id1 = H5Dopen2(loc_id1, dset_name1, H5P_DEFAULT)) < 0) goto out; /* Get the datatype */ @@ -2065,7 +2065,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1, */ /* Open the dataset. */ - if((dataset_id2 = H5Dopen( loc_id2, dset_name2 )) < 0) + if((dataset_id2 = H5Dopen2(loc_id2, dset_name2, H5P_DEFAULT)) < 0) goto out; /* Get the datatype */ @@ -2255,7 +2255,7 @@ herr_t H5TBinsert_field( hid_t loc_id, */ /* Open the dataset. */ - if((dataset_id1 = H5Dopen( loc_id, dset_name )) < 0) + if((dataset_id1 = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; /* Get creation properties list */ @@ -2430,9 +2430,9 @@ herr_t H5TBinsert_field( hid_t loc_id, 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 */ @@ -2529,7 +2529,7 @@ herr_t H5TBinsert_field( hid_t loc_id, return -1; /* Open the dataset. */ - if((dataset_id1 = H5Dopen( loc_id, dset_name )) < 0) + if((dataset_id1 = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; /* Get the datatype */ @@ -2702,7 +2702,7 @@ herr_t H5TBdelete_field( hid_t loc_id, */ /* Open the dataset. */ - if((dataset_id1 = H5Dopen( loc_id, dset_name )) < 0) + if((dataset_id1 = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; /* Get creation properties list */ @@ -2914,9 +2914,9 @@ herr_t H5TBdelete_field( hid_t loc_id, 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 */ @@ -3014,7 +3014,7 @@ herr_t H5TBdelete_field( hid_t loc_id, return -1; /* Open the dataset. */ - if((dataset_id1 = H5Dopen( loc_id, dset_name )) < 0) + if((dataset_id1 = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; /* Get the datatype */ @@ -3246,7 +3246,7 @@ herr_t H5TBget_table_info ( hid_t loc_id, hsize_t n[1]; /* Open the dataset. */ - if((did = H5Dopen( loc_id, dset_name )) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; /* Get the datatype */ @@ -3275,7 +3275,7 @@ herr_t H5TBget_table_info ( hid_t loc_id, if(has_attr == 1 ) { /* Get the attribute */ - if(H5LTget_attribute(loc_id,dset_name,"NROWS",H5T_NATIVE_LLONG,n)<0) + if(H5LTget_attribute(loc_id,dset_name,"NROWS",H5T_NATIVE_LLONG,n) < 0) return -1; /**nrecords = *n;*/ @@ -3356,14 +3356,14 @@ herr_t H5TBget_field_info( hid_t loc_id, hssize_t i; /* Open the dataset. */ - if(( did = H5Dopen( loc_id, dset_name )) < 0) + if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; /* Get the datatype */ if(( ftype_id = H5Dget_type( did )) < 0) goto out; - if ((native_type_id = H5Tget_native_type(ftype_id,H5T_DIR_DEFAULT))<0) + if ((native_type_id = H5Tget_native_type(ftype_id,H5T_DIR_DEFAULT)) < 0) goto out; /* Get the type size */ @@ -3388,7 +3388,7 @@ herr_t H5TBget_field_info( hid_t loc_id, /* Get the member type */ if(( member_type_id = H5Tget_member_type( ftype_id,(unsigned) i )) < 0) goto out; - if ((nativem_type_id = H5Tget_native_type(member_type_id,H5T_DIR_DEFAULT))<0) + if ((nativem_type_id = H5Tget_native_type(member_type_id,H5T_DIR_DEFAULT)) < 0) goto out; /* Get the member size */ @@ -3582,7 +3582,7 @@ hid_t H5TB_create_type(hid_t loc_id, unsigned i; /* get the number of fields */ - if (H5TBget_table_info(loc_id,dset_name,&nfields,NULL)<0) + if (H5TBget_table_info(loc_id,dset_name,&nfields,NULL) < 0) return -1; if ((fnames=malloc(sizeof(char*)*(size_t)nfields))==NULL) @@ -3597,31 +3597,31 @@ 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) + 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,type_size))<0) + if ((mem_type_id=H5Tcreate(H5T_COMPOUND,type_size)) < 0) goto out; /* get each field ID and adjust its size, if necessary */ for ( i=0; i= 0), "H5Dget_space succeeded", H5FATAL); - /* now each process writes a block of opt_block chars in round robbin - * fashion until the whole dataset is covered. - */ - for (j=0; j < opt_iter; j++) { - /* setup a file dataspace selection */ - start[0] = (j*iter_jump)+(mynod*opt_block); - stride[0] = block[0] = opt_block; - count[0]= 1; - ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded", H5FATAL); - - if (opt_correct) /* fill in buffer for iteration */ { - for (i=mynod+j, check=buf; i= 0), "H5Sset_hyperslab succeeded", H5FATAL); - /* discover the starting time of the operation */ - MPI_Barrier(MPI_COMM_WORLD); - stim = MPI_Wtime(); + if (opt_correct) /* fill in buffer for iteration */ { + for (i=mynod+j, check=buf; i= 0), "H5Dwrite dataset1 succeeded", !H5FATAL); + /* discover the starting time of the operation */ + MPI_Barrier(MPI_COMM_WORLD); + stim = MPI_Wtime(); - /* discover the ending time of the operation */ - etim = MPI_Wtime(); + /* write data */ + ret = H5Dwrite(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, + H5P_DEFAULT, buf); + VRFY((ret >= 0), "H5Dwrite dataset1 succeeded", !H5FATAL); - write_tim += (etim - stim); + /* discover the ending time of the operation */ + etim = MPI_Wtime(); - /* we are done with this "write" iteration */ - } + write_tim += (etim - stim); + + /* we are done with this "write" iteration */ + } /* close dataset and file */ ret=H5Dclose(dataset); @@ -249,67 +249,65 @@ int main(int argc, char **argv) - /* wait for everyone to synchronize at this point */ - MPI_Barrier(MPI_COMM_WORLD); + /* wait for everyone to synchronize at this point */ + MPI_Barrier(MPI_COMM_WORLD); /* reopen the file for reading */ fid=H5Fopen(opt_file,H5F_ACC_RDONLY,acc_tpl); VRFY((fid >= 0), "", H5FATAL); /* open the dataset */ - dataset = H5Dopen(fid, "Dataset1"); + dataset = H5Dopen2(fid, "Dataset1", H5P_DEFAULT); VRFY((dataset >= 0), "H5Dopen succeeded", H5FATAL); /* we can re-use the same mem_dataspace and file_dataspace * the H5Dwrite used since the dimension size is the same. */ - /* we are going to repeat the read the same pattern the write used */ - for (j=0; j < opt_iter; j++) { - /* setup a file dataspace selection */ - start[0] = (j*iter_jump)+(mynod*opt_block); - stride[0] = block[0] = opt_block; - count[0]= 1; - ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded", H5FATAL); - /* seek to the appropriate spot give the current iteration and - * rank within the MPI processes */ - - /* discover the start time */ - MPI_Barrier(MPI_COMM_WORLD); - stim = MPI_Wtime(); - - /* read data */ - /* read in the file data */ - if (!opt_correct){ - ret = H5Dread(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, - H5P_DEFAULT, buf); - } - else{ - ret = H5Dread(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, - H5P_DEFAULT, buf2); - } - myerrno = errno; - /* discover the end time */ - etim = MPI_Wtime(); - read_tim += (etim - stim); - VRFY((ret >= 0), "H5Dwrite dataset1 succeeded", !H5FATAL); - - - if (ret < 0) fprintf(stderr, "node %d, read error, loc = %Ld: %s\n", - mynod, mynod*opt_block, strerror(myerrno)); - - /* if the user wanted to check correctness, compare the write - * buffer to the read buffer */ - if (opt_correct && memcmp(buf, buf2, opt_block)) { - fprintf(stderr, "node %d, correctness test failed\n", mynod); - my_correct = 0; - MPI_Allreduce(&my_correct, &correct, 1, MPI_INT, MPI_MIN, - MPI_COMM_WORLD); - } - - /* we are done with this read iteration */ - } + /* we are going to repeat the read the same pattern the write used */ + for (j=0; j < opt_iter; j++) { + /* setup a file dataspace selection */ + start[0] = (j*iter_jump)+(mynod*opt_block); + stride[0] = block[0] = opt_block; + count[0]= 1; + ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0), "H5Sset_hyperslab succeeded", H5FATAL); + /* seek to the appropriate spot give the current iteration and + * rank within the MPI processes */ + + /* discover the start time */ + MPI_Barrier(MPI_COMM_WORLD); + stim = MPI_Wtime(); + + /* read in the file data */ + if (!opt_correct){ + ret = H5Dread(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, H5P_DEFAULT, buf); + } + else{ + ret = H5Dread(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, H5P_DEFAULT, buf2); + } + myerrno = errno; + + /* discover the end time */ + etim = MPI_Wtime(); + read_tim += (etim - stim); + VRFY((ret >= 0), "H5Dwrite dataset1 succeeded", !H5FATAL); + + + if (ret < 0) fprintf(stderr, "node %d, read error, loc = %Ld: %s\n", + mynod, mynod*opt_block, strerror(myerrno)); + + /* if the user wanted to check correctness, compare the write + * buffer to the read buffer */ + if (opt_correct && memcmp(buf, buf2, opt_block)) { + fprintf(stderr, "node %d, correctness test failed\n", mynod); + my_correct = 0; + MPI_Allreduce(&my_correct, &correct, 1, MPI_INT, MPI_MIN, + MPI_COMM_WORLD); + } + + /* we are done with this read iteration */ + } /* close dataset and file */ ret=H5Dclose(dataset); diff --git a/perform/perf_meta.c b/perform/perf_meta.c index 7093717..dd73140 100644 --- a/perform/perf_meta.c +++ b/perform/perf_meta.c @@ -366,7 +366,7 @@ create_attrs_1(void) char attr_name[128]; int i, j; p_time attr_t = {0, 0, 0, 1000000, 0, ""}; - p_time open_t = {0, 0, 0, 1000000, 0, "H5Dopen"}; + p_time open_t = {0, 0, 0, 1000000, 0, "H5Dopen2"}; p_time close_t = {0, 0, 0, 1000000, 0, ""}; #ifdef H5_HAVE_PARALLEL @@ -391,7 +391,7 @@ create_attrs_1(void) for(i = 0; i < NUM_DSETS; i++) { sprintf(dset_name, "dataset %d", i); open_t.start = retrieve_time(); - if((dataset = H5Dopen(file, dset_name)) < 0) + if((dataset = H5Dopen2(file, dset_name, H5P_DEFAULT)) < 0) goto error; perf(&open_t, open_t.start, retrieve_time()); @@ -578,7 +578,7 @@ create_attrs_3(void) int loop_num; int i, j, k; p_time attr_t = {0, 0, 0, 1000000, 0, ""}; - p_time open_t = {0, 0, 0, 1000000, 0, "H5Dopen"}; + p_time open_t = {0, 0, 0, 1000000, 0, "H5Dopen2"}; p_time close_t = {0, 0, 0, 1000000, 0, ""}; #ifdef H5_HAVE_PARALLEL @@ -607,7 +607,7 @@ create_attrs_3(void) for(j = 0; j < NUM_DSETS; j++) { sprintf(dset_name, "dataset %d", j); open_t.start = retrieve_time(); - if((dataset = H5Dopen(file, dset_name)) < 0) + if((dataset = H5Dopen2(file, dset_name, H5P_DEFAULT)) < 0) goto error; perf(&open_t, open_t.start, retrieve_time()); diff --git a/perform/pio_engine.c b/perform/pio_engine.c index be94cc7..23c3edd 100644 --- a/perform/pio_engine.c +++ b/perform/pio_engine.c @@ -1667,12 +1667,12 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, break; } /* end switch */ - for (ndset = 1; ndset <= ndsets; ++ndset) { + for(ndset = 1; ndset <= ndsets; ++ndset) { /* Calculate dataset offset within a file */ /* create dataset */ - switch (parms->io_type) { + switch(parms->io_type) { case POSIXIO: case MPIO: /* both posix and mpi io just need dataset offset in file*/ @@ -1681,12 +1681,11 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, case PHDF5: sprintf(dname, "Dataset_%ld", ndset); - h5ds_id = H5Dopen(fd->h5fd, dname); - if (h5ds_id < 0) { + h5ds_id = H5Dopen2(fd->h5fd, dname, H5P_DEFAULT); + if(h5ds_id < 0) { fprintf(stderr, "HDF5 Dataset open failed\n"); GOTOERROR(FAIL); } - break; } diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 3d58557..465ac41 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -180,16 +180,18 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Dcreate() */ +#ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- - * Function: H5Dopen + * Function: H5Dopen1 * * Purpose: Finds a dataset named NAME at LOC_ID, opens it, and returns * its ID. The dataset should be close when the caller is no * longer interested in it. * - * Return: Success: A new dataset ID + * Note: Deprecated in favor of H5Dopen2 * + * Return: Success: A new dataset ID * Failure: FAIL * * Programmer: Robb Matzke @@ -198,7 +200,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5Dopen(hid_t loc_id, const char *name) +H5Dopen1(hid_t loc_id, const char *name) { H5D_t *dset = NULL; H5G_loc_t loc; /* Object location of group */ @@ -210,7 +212,7 @@ H5Dopen(hid_t loc_id, const char *name) hid_t dxpl_id = H5AC_dxpl_id; /* dxpl to use to open datset */ hid_t ret_value; - FUNC_ENTER_API(H5Dopen, FAIL) + FUNC_ENTER_API(H5Dopen1, FAIL) H5TRACE2("i", "i*s", loc_id, name); /* Check args */ @@ -256,9 +258,8 @@ done: } /* end if */ FUNC_LEAVE_API(ret_value) -} /* end H5Dopen() */ +} /* end H5Dopen1() */ -#ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- * Function: H5Dextend diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index bbd74a6..be858ac 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -123,7 +123,6 @@ H5_DLL herr_t H5Ddebug(hid_t dset_id); */ H5_DLL hid_t H5Dcreate(hid_t file_id, const char *name, hid_t type_id, hid_t space_id, hid_t plist_id); -H5_DLL hid_t H5Dopen(hid_t file_id, const char *name); /* Symbols defined for compatibility with previous versions of the HDF5 API. * @@ -138,6 +137,7 @@ H5_DLL hid_t H5Dopen(hid_t file_id, const char *name); /* Function prototypes */ +H5_DLL hid_t H5Dopen1(hid_t file_id, const char *name); H5_DLL herr_t H5Dextend(hid_t dset_id, const hsize_t *size); #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5O.c b/src/H5O.c index 1122e45..5711140 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -176,8 +176,8 @@ H5O_init_interface(void) * * Purpose: Opens an object within an HDF5 file. * - * This function opens an object in the same way that H5Gopen, - * H5Topen, and H5Dopen do. However, H5Oopen doesn't require + * This function opens an object in the same way that H5Gopen2, + * H5Topen2, and H5Dopen2 do. However, H5Oopen doesn't require * the type of object to be known beforehand. This can be * useful in user-defined links, for instance, when only a * path is known. diff --git a/src/H5public.h b/src/H5public.h index 00ca6ab..b07cb22 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -86,9 +86,8 @@ extern "C" { * The negative failure value is most commonly -1, but don't bet on it. The * proper way to detect failure is something like: * - * if ((dset = H5Dopen (file, name))<0) { - * fprintf (stderr, "unable to open the requested dataset\n"); - * } + * if((dset = H5Dopen2(file, name)) < 0) + * fprintf(stderr, "unable to open the requested dataset\n"); */ typedef int herr_t; @@ -319,3 +318,4 @@ H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum, } #endif #endif + diff --git a/src/H5vers.txt b/src/H5vers.txt index 8d4b6f9..39f27e4 100644 --- a/src/H5vers.txt +++ b/src/H5vers.txt @@ -49,6 +49,7 @@ FUNCTION: H5Acreate; ; v10, v18 FUNCTION: H5Adelete; ; v10, v18 FUNCTION: H5Aiterate; H5A_operator; v10, v18 FUNCTION: H5Arename; ; v16, v18 +FUNCTION: H5Dopen; ; v10, v18 FUNCTION: H5Eclear; ; v10, v18 FUNCTION: H5Eget_auto; ; v10, v18 FUNCTION: H5Eprint; ; v10, v18 diff --git a/src/H5version.h b/src/H5version.h index 25efa53..5573e5b 100644 --- a/src/H5version.h +++ b/src/H5version.h @@ -54,6 +54,10 @@ #define H5Arename_vers 1 #endif /* !defined(H5Arename_vers) */ +#if !defined(H5Dopen_vers) +#define H5Dopen_vers 1 +#endif /* !defined(H5Dopen_vers) */ + #if !defined(H5Eclear_vers) #define H5Eclear_vers 1 #endif /* !defined(H5Eclear_vers) */ @@ -165,6 +169,17 @@ #error "H5Arename_vers set to invalid value" #endif /* H5Arename_vers */ +#if !defined(H5Dopen_vers) || H5Dopen_vers == 2 +#ifndef H5Dopen_vers +#define H5Dopen_vers 2 +#endif /* H5Dopen_vers */ +#define H5Dopen H5Dopen2 +#elif H5Dopen_vers == 1 +#define H5Dopen H5Dopen1 +#else /* H5Dopen_vers */ +#error "H5Dopen_vers set to invalid value" +#endif /* H5Dopen_vers */ + #if !defined(H5Eclear_vers) || H5Eclear_vers == 2 #ifndef H5Eclear_vers #define H5Eclear_vers 2 diff --git a/test/Makefile.am b/test/Makefile.am index ae89ca2..8ced149 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -121,9 +121,9 @@ CHECK_CLEANFILES+=cmpd_dset.h5 compact_dataset.h5 dataset.h5 extend.h5 istore.h5 # Sources for testhdf5 executable testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ - tgenprop.c th5o.c th5s.c theap.c tid.c titerate.c tmeta.c tmisc.c ttime.c \ - trefer.c trefstr.c tselect.c tsohm.c tskiplist.c ttst.c tunicode.c tvltypes.c \ - tvlstr.c + tgenprop.c th5o.c th5s.c theap.c tid.c titerate.c tmeta.c tmisc.c \ + trefer.c trefstr.c tselect.c tskiplist.c tsohm.c ttime.c ttst.c tunicode.c \ + tvlstr.c tvltypes.c # Temporary files. DISTCLEANFILES=testerror.sh diff --git a/test/big.c b/test/big.c index f75a6f3..3c9cbd5 100644 --- a/test/big.c +++ b/test/big.c @@ -125,12 +125,12 @@ is_sparse(void) int fd; h5_stat_t sb; - if ((fd=HDopen("x.h5", O_RDWR|O_TRUNC|O_CREAT, 0666))<0) return 0; + if ((fd=HDopen("x.h5", O_RDWR|O_TRUNC|O_CREAT, 0666)) < 0) return 0; if (HDlseek(fd, (off_t)(1024*1024), SEEK_SET)!=1024*1024) return 0; if (5!=HDwrite(fd, "hello", (size_t)5)) return 0; - if (HDclose(fd)<0) return 0; - if (HDstat("x.h5", &sb)<0) return 0; - if (HDunlink("x.h5")<0) return 0; + if (HDclose(fd) < 0) return 0; + if (HDstat("x.h5", &sb) < 0) return 0; + if (HDunlink("x.h5") < 0) return 0; #ifdef H5_HAVE_STAT_ST_BLOCKS return ((unsigned long)sb.st_blocks*512 < (unsigned long)sb.st_size); #else @@ -162,7 +162,7 @@ supports_big(void) { int fd; - if ((fd=HDopen("y.h5", O_RDWR|O_TRUNC|O_CREAT, 0666))<0) return 0; + if ((fd=HDopen("y.h5", O_RDWR|O_TRUNC|O_CREAT, 0666)) < 0) return 0; /* Write a few bytes at 2GB */ if (HDlseek(fd, BIG_FILE, SEEK_SET)!=BIG_FILE) return 0; @@ -172,8 +172,8 @@ supports_big(void) if (HDlseek(fd, 2*BIG_FILE, SEEK_SET) != 2*BIG_FILE) return 0; if (5!=HDwrite(fd, "hello", (size_t)5)) return 0; - if (HDclose(fd)<0) return 0; - if (HDunlink("y.h5")<0) return 0; + if (HDclose(fd) < 0) return 0; + if (HDunlink("y.h5") < 0) return 0; return (1); } @@ -215,7 +215,7 @@ enough_room(hid_t fapl) /* Create files */ for (i=0; i=0; i++) { HDsnprintf(name, sizeof name, filename, i); - if(HDclose(fd[i])<0) + if(HDclose(fd[i]) < 0) ret_value=0; HDunlink(name); } @@ -276,13 +276,13 @@ writer (char* filename, hid_t fapl, int wrt_n) * We might be on a machine that has 32-bit files, so create an HDF5 file * which is a family of files. Each member of the family will be 1GB */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) { + if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { goto error; } /* Create simple data spaces according to the size specified above. */ - if ((space1 = H5Screate_simple (4, size1, size1))<0 || - (space2 = H5Screate_simple (1, size2, size2))<0) { + if ((space1 = H5Screate_simple (4, size1, size1)) < 0 || + (space2 = H5Screate_simple (1, size2, size2)) < 0) { goto error; } @@ -295,41 +295,41 @@ writer (char* filename, hid_t fapl, int wrt_n) * We should create a dataset allocating space late and never writing fill values. * EIP 4/8/03 - if ((d1=H5Dcreate (file, "d1", H5T_NATIVE_INT, space1, H5P_DEFAULT))<0 || - (d2=H5Dcreate (file, "d2", H5T_NATIVE_INT, space2, H5P_DEFAULT))<0) { + if ((d1=H5Dcreate (file, "d1", H5T_NATIVE_INT, space1, H5P_DEFAULT)) < 0 || + (d2=H5Dcreate (file, "d2", H5T_NATIVE_INT, space2, H5P_DEFAULT)) < 0) { goto error; } */ dcpl = H5Pcreate(H5P_DATASET_CREATE); H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE); H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER); - if ((d1=H5Dcreate (file, "d1", H5T_NATIVE_INT, space1, dcpl))<0 || - (d2=H5Dcreate (file, "d2", H5T_NATIVE_INT, space2, dcpl))<0) { + if ((d1=H5Dcreate (file, "d1", H5T_NATIVE_INT, space1, dcpl)) < 0 || + (d2=H5Dcreate (file, "d2", H5T_NATIVE_INT, space2, dcpl)) < 0) { goto error; } /* Write some things to them randomly */ hs_size[0] = WRT_SIZE; - if ((mem_space = H5Screate_simple (1, hs_size, hs_size))<0) goto error; + if ((mem_space = H5Screate_simple (1, hs_size, hs_size)) < 0) goto error; for (i=0; ia != d_ptr->a || @@ -1353,17 +1353,17 @@ test_hdf5_src_subset(char *filename, hid_t fapl) goto error; /* Build hdf5 datatypes */ - if ((src_tid=create_stype1())<0) + if ((src_tid=create_stype1()) < 0) goto error; - if ((dst_tid=create_stype2())<0) + if ((dst_tid=create_stype2()) < 0) goto error; - if ((rew_tid=create_stype3())<0) + if ((rew_tid=create_stype3()) < 0) goto error; /* Create the data space */ - if((space = H5Screate_simple(2, dims, NULL))<0) + if((space = H5Screate_simple(2, dims, NULL)) < 0) goto error; /* Allocate space and initialize data */ @@ -1377,7 +1377,7 @@ test_hdf5_src_subset(char *filename, hid_t fapl) /* Create dataset creation property list */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; /* @@ -1387,26 +1387,26 @@ test_hdf5_src_subset(char *filename, hid_t fapl) TESTING("writing data to contiguous and chunked datasets"); /* Create contiguous data set */ - if((dataset = H5Dcreate(file, DSET_NAME[0], src_tid, space, dcpl))<0) + if((dataset = H5Dcreate(file, DSET_NAME[0], src_tid, space, dcpl)) < 0) goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig)<0) + if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig) < 0) goto error; if(H5Dclose(dataset) < 0) goto error; /* Set chunking */ - if(H5Pset_chunk(dcpl, 2, chunk_dims)<0) + if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) goto error; /* Create chunked data set */ - if((dataset = H5Dcreate(file, DSET_NAME[1], src_tid, space, dcpl))<0) + if((dataset = H5Dcreate(file, DSET_NAME[1], src_tid, space, dcpl)) < 0) goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig)<0) + if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig) < 0) goto error; if(H5Dclose(dataset) < 0) @@ -1421,29 +1421,29 @@ test_hdf5_src_subset(char *filename, hid_t fapl) TESTING("rewriting data with a subset of original data type"); /* Create xfer properties to preserve initialized data */ - if ((dxpl = H5Pcreate (H5P_DATASET_XFER))<0) + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) goto error; - if (H5Pset_preserve (dxpl, TRUE)<0) + if(H5Pset_preserve(dxpl, TRUE) < 0) goto error; /* Rewrite contiguous data set */ - if((dataset = H5Dopen(file, DSET_NAME[0]))<0) + if((dataset = H5Dopen2(file, DSET_NAME[0], H5P_DEFAULT)) < 0) goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf)<0) + if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0) goto error; if(H5Dclose(dataset) < 0) goto error; /* Rewrite chunked data set */ - if((dataset = H5Dopen(file, DSET_NAME[1]))<0) + if((dataset = H5Dopen2(file, DSET_NAME[1], H5P_DEFAULT)) < 0) goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf)<0) + if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0) goto error; if(H5Dclose(dataset) < 0) @@ -1458,10 +1458,10 @@ test_hdf5_src_subset(char *filename, hid_t fapl) TESTING("reading data with a subset of original data type"); /* Check contiguous data set */ - if((dataset = H5Dopen(file, DSET_NAME[0]))<0) + if((dataset = H5Dopen2(file, DSET_NAME[0], H5P_DEFAULT)) < 0) goto error; - if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf)<0) + if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0) goto error; if(compare_data(orig, rbuf, TRUE) < 0) @@ -1471,10 +1471,10 @@ test_hdf5_src_subset(char *filename, hid_t fapl) goto error; /* Check chunked data set */ - if((dataset = H5Dopen(file, DSET_NAME[1]))<0) + if((dataset = H5Dopen2(file, DSET_NAME[1], H5P_DEFAULT)) < 0) goto error; - if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf)<0) + if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0) goto error; if(compare_data(orig, rbuf, TRUE) < 0) @@ -1493,11 +1493,11 @@ test_hdf5_src_subset(char *filename, hid_t fapl) if(H5Pclose(dxpl) < 0) goto error; - if(H5Tclose(src_tid)<0) + if(H5Tclose(src_tid) < 0) goto error; - if(H5Tclose(dst_tid)<0) + if(H5Tclose(dst_tid) < 0) goto error; - if(H5Tclose(rew_tid)<0) + if(H5Tclose(rew_tid) < 0) goto error; if(H5Fclose(file) < 0) goto error; @@ -1558,17 +1558,17 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) goto error; /* Build hdf5 datatypes */ - if ((src_tid=create_stype2())<0) + if ((src_tid=create_stype2()) < 0) goto error; - if ((dst_tid=create_stype1())<0) + if ((dst_tid=create_stype1()) < 0) goto error; - if ((rew_tid=create_stype4())<0) + if ((rew_tid=create_stype4()) < 0) goto error; /* Create the data space */ - if((space = H5Screate_simple(2, dims, NULL))<0) + if((space = H5Screate_simple(2, dims, NULL)) < 0) goto error; /* Allocate space and initialize data */ @@ -1581,7 +1581,7 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) initialize_stype4(rew_buf, (size_t)NX*NY); /* Create dataset creation property list */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; /* @@ -1591,26 +1591,26 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) TESTING("writing data to contiguous and chunked datasets"); /* Create contiguous data set */ - if((dataset = H5Dcreate(file, DSET_NAME[2], src_tid, space, dcpl))<0) + if((dataset = H5Dcreate(file, DSET_NAME[2], src_tid, space, dcpl)) < 0) goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig)<0) + if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig) < 0) goto error; if(H5Dclose(dataset) < 0) goto error; /* Set chunking */ - if(H5Pset_chunk(dcpl, 2, chunk_dims)<0) + if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) goto error; /* Create chunked data set */ - if((dataset = H5Dcreate(file, DSET_NAME[3], src_tid, space, dcpl))<0) + if((dataset = H5Dcreate(file, DSET_NAME[3], src_tid, space, dcpl)) < 0) goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig)<0) + if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig) < 0) goto error; if(H5Dclose(dataset) < 0) @@ -1625,29 +1625,29 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) TESTING("rewriting data with a subset of original data type"); /* Create xfer properties to preserve initialized data */ - if ((dxpl = H5Pcreate (H5P_DATASET_XFER))<0) + if((dxpl = H5Pcreate (H5P_DATASET_XFER)) < 0) goto error; - if (H5Pset_preserve (dxpl, TRUE)<0) + if(H5Pset_preserve(dxpl, TRUE) < 0) goto error; /* Rewrite contiguous data set */ - if((dataset = H5Dopen(file, DSET_NAME[2]))<0) + if((dataset = H5Dopen2(file, DSET_NAME[2], H5P_DEFAULT)) < 0) goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf)<0) + if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0) goto error; if(H5Dclose(dataset) < 0) goto error; /* Rewrite chunked data set */ - if((dataset = H5Dopen(file, DSET_NAME[3]))<0) + if((dataset = H5Dopen2(file, DSET_NAME[3], H5P_DEFAULT)) < 0) goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf)<0) + if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0) goto error; if(H5Dclose(dataset) < 0) @@ -1662,10 +1662,10 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) TESTING("reading data with a subset of original data type"); /* Check contiguous data set */ - if((dataset = H5Dopen(file, DSET_NAME[2]))<0) + if((dataset = H5Dopen2(file, DSET_NAME[2], H5P_DEFAULT)) < 0) goto error; - if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf)<0) + if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0) goto error; if(compare_data(orig, rbuf, FALSE) < 0) @@ -1675,10 +1675,10 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) goto error; /* Check chunked data set */ - if((dataset = H5Dopen(file, DSET_NAME[3]))<0) + if((dataset = H5Dopen2(file, DSET_NAME[3], H5P_DEFAULT)) < 0) goto error; - if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf)<0) + if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0) goto error; if(compare_data(orig, rbuf, FALSE) < 0) @@ -1697,11 +1697,11 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) if(H5Pclose(dxpl) < 0) goto error; - if(H5Tclose(src_tid)<0) + if(H5Tclose(src_tid) < 0) goto error; - if(H5Tclose(dst_tid)<0) + if(H5Tclose(dst_tid) < 0) goto error; - if(H5Tclose(rew_tid)<0) + if(H5Tclose(rew_tid) < 0) goto error; if(H5Fclose(file) < 0) goto error; diff --git a/test/cross_read.c b/test/cross_read.c index bdd33c0..b036217 100755 --- a/test/cross_read.c +++ b/test/cross_read.c @@ -75,25 +75,25 @@ static int read_data(char *fname) /* * Open the file and the dataset. */ - if((file = H5Fopen(pathname, H5F_ACC_RDONLY, H5P_DEFAULT))<0) + if((file = H5Fopen(pathname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR; - if((dataset = H5Dopen(file, DATASETNAME))<0) + if((dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* * Get datatype and dataspace handles and then query * dataset class, order, size, rank and dimensions. */ - if((dt = H5Dget_type(dataset))<0) /* datatype handle */ + if((dt = H5Dget_type(dataset)) < 0) /* datatype handle */ TEST_ERROR; - if((datatype = H5Tget_native_type(dt, H5T_DIR_DEFAULT))<0) + if((datatype = H5Tget_native_type(dt, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* * Read data from hyperslab in the file into the hyperslab in * memory and display. */ - if(H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_out)<0) + if(H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_out) < 0) TEST_ERROR; /* Check results */ diff --git a/test/dangle.c b/test/dangle.c index 4b1be63..834d659 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -89,7 +89,7 @@ test_dangle_dataset(H5F_close_degree_t degree) /* Try creating duplicate dataset */ H5E_BEGIN_TRY { - if((dsid = H5Dcreate (fid, DSETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT))>=0) + if((dsid = H5Dcreate(fid, DSETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT)) >= 0) TEST_ERROR; } H5E_END_TRY; @@ -97,14 +97,13 @@ test_dangle_dataset(H5F_close_degree_t degree) TEST_ERROR; /* Leave open a _lot_ of objects */ - for(u=0; u=0) + if(H5Fclose(fid) >= 0) TEST_ERROR; } H5E_END_TRY; } /* end if */ diff --git a/test/dsets.c b/test/dsets.c index cf1f650..3e8a25d 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -74,7 +74,7 @@ const char *FILENAME[] = { #define DSET_CAN_APPLY_SZIP_NAME "can_apply_szip" #define DSET_SET_LOCAL_NAME "set_local" #define DSET_SET_LOCAL_NAME_2 "set_local_2" -#define DSET_ONEBYTE_SHUF_NAME "onebyte_shuffle" +#define DSET_ONEBYTE_SHUF_NAME "onebyte_shuffle" #define DSET_NBIT_INT_NAME "nbit_int" #define DSET_NBIT_FLOAT_NAME "nbit_float" #define DSET_NBIT_DOUBLE_NAME "nbit_double" @@ -88,8 +88,11 @@ const char *FILENAME[] = { #define DSET_SCALEOFFSET_FLOAT_NAME_2 "scaleoffset_float_2" #define DSET_SCALEOFFSET_DOUBLE_NAME "scaleoffset_double" #define DSET_SCALEOFFSET_DOUBLE_NAME_2 "scaleoffset_double_2" -#define DSET_COMPARE_DCPL_NAME "compare_dcpl" +#define DSET_COMPARE_DCPL_NAME "compare_dcpl" #define DSET_COMPARE_DCPL_NAME_2 "compare_dcpl_2" +#define DSET_DEPREC_NAME "deprecated" +#define DSET_DEPREC_NAME_CHUNKED "deprecated_chunked" +#define DSET_DEPREC_NAME_COMPACT "deprecated_compact" #define USER_BLOCK 1024 #define SIXTY_FOUR_KB 65536 @@ -208,11 +211,11 @@ test_create(hid_t file) if (dataset<0) goto error; /* Close the dataset */ - if (H5Dclose(dataset) < 0) goto error; + if(H5Dclose(dataset) < 0) goto error; /* Add a comment to the dataset */ status = H5Oset_comment(file, DSET_DEFAULT_NAME, "This is a dataset", H5P_DEFAULT); - if (status<0) goto error; + if(status < 0) goto error; /* * Try creating a dataset that already exists. This should fail since a @@ -223,7 +226,7 @@ test_create(hid_t file) dataset = H5Dcreate(file, DSET_DEFAULT_NAME, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT); } H5E_END_TRY; - if (dataset >= 0) { + if(dataset >= 0) { H5_FAILED(); puts(" Library allowed overwrite of existing dataset."); goto error; @@ -233,9 +236,9 @@ test_create(hid_t file) * Open the dataset we created above and then close it. This is how * existing datasets are accessed. */ - if (H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) goto error; - if ((dataset = H5Dopen(file, DSET_DEFAULT_NAME)) < 0) goto error; - if (H5Dclose(dataset) < 0) goto error; + if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) goto error; + if((dataset = H5Dopen2(file, DSET_DEFAULT_NAME, H5P_DEFAULT)) < 0) goto error; + if(H5Dclose(dataset) < 0) goto error; /* * Try opening a non-existent dataset. This should fail since new datasets @@ -243,9 +246,9 @@ test_create(hid_t file) * reporting. */ H5E_BEGIN_TRY { - dataset = H5Dopen(file, "does_not_exist"); + dataset = H5Dopen2(file, "does_not_exist", H5P_DEFAULT); } H5E_END_TRY; - if (dataset >= 0) { + if(dataset >= 0) { H5_FAILED(); puts(" Opened a non-existent dataset."); goto error; @@ -588,16 +591,16 @@ test_compact_io(hid_t fapl) /* * Open the file and check data */ - if((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - if((dataset = H5Dopen(file, DSET_COMPACT_IO_NAME)) < 0) + if((dataset = H5Dopen2(file, DSET_COMPACT_IO_NAME, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) TEST_ERROR /* Check that the values read are the same as the values written */ - for (i = 0; i < 16; i++) { - for (j = 0; j < 8; j++) { + for(i = 0; i < 16; i++) + for(j = 0; j < 8; j++) if (rbuf[i][j] != wbuf[i][j]) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -605,9 +608,7 @@ test_compact_io(hid_t fapl) printf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]); printf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]); goto error; - } - } - } + } /* end if */ if(H5Dclose(dataset) < 0) TEST_ERROR if(H5Fclose(file) < 0) TEST_ERROR @@ -678,41 +679,39 @@ test_max_compact(hid_t fapl) assert(status >= 0); /* Create and write to a compact dataset */ - if((dataset = H5Dcreate(file, DSET_COMPACT_MAX_NAME, H5T_NATIVE_INT, space, - plist)) < 0) + if((dataset = H5Dcreate(file, DSET_COMPACT_MAX_NAME, H5T_NATIVE_INT, space, plist)) < 0) goto error; if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) goto error; /* Close file */ - H5Sclose(space); - H5Pclose(plist); - H5Dclose(dataset); - H5Fclose(file); + if(H5Sclose(space) < 0) goto error; + if(H5Pclose(plist) < 0) goto error; + if(H5Dclose(dataset) < 0) goto error; + if(H5Fclose(file) < 0) goto error; /* * Open the file and check data */ - if((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) goto error; - if((dataset = H5Dopen(file, DSET_COMPACT_MAX_NAME)) < 0) + if((dataset = H5Dopen2(file, DSET_COMPACT_MAX_NAME, H5P_DEFAULT)) < 0) goto error; if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) goto error; - /* Check that the values read are the same as the values written */ - for (i = 0; i < (int)compact_size; i++) { - if (rbuf[i] != wbuf[i]) { + /* Check that the values read are the same as the values written */ + for(i = 0; i < (int)compact_size; i++) + if(rbuf[i] != wbuf[i]) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %d\n", i); goto error; - } - } + } /* end if */ - H5Dclose(dataset); - H5Fclose(file); + if(H5Dclose(dataset) < 0) goto error; + if(H5Fclose(file) < 0) goto error; HDfree(wbuf); HDfree(rbuf); @@ -1505,16 +1504,16 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, */ TESTING(" filters (re-open)"); - if (H5Dclose (dataset) < 0) TEST_ERROR; - if ((dataset = H5Dopen (fid, name)) < 0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; + if((dataset = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) TEST_ERROR; if(corrupted) { /* Default behavior is failure when data is corrupted. */ /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); } H5E_END_TRY; - if(status>=0) TEST_ERROR; + if(status >= 0) TEST_ERROR; /* Callback decides to continue inspite data is corrupted. */ if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR; @@ -1523,28 +1522,28 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, /* Callback decides to fail when data is corrupted. */ if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR; + /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); } H5E_END_TRY; - if(status>=0) TEST_ERROR; - } else { - if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) - TEST_ERROR; + if(status >= 0) TEST_ERROR; + } /* end if */ + else { + if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) + TEST_ERROR; /* Check that the values read are the same as the values written */ - for (i=0; i=0) { H5_FAILED(); - printf(" Line %d: Should not be able to read dataset data\n",__LINE__); + printf(" Line %d: Should not be able to read dataset data\n", __LINE__); goto error; } /* end if */ /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + printf(" Line %d: Can't close dataset\n", __LINE__); goto error; } /* end if */ /* Close existing file */ if(H5Fclose(fid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close file\n",__LINE__); + printf(" Line %d: Can't close file\n", __LINE__); goto error; } /* end if */ @@ -4630,7 +4628,7 @@ test_multiopen (hid_t file) if(H5Pset_chunk(dcpl, 1, cur_size) < 0) goto error; if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; if((dset1 = H5Dcreate(file, "multiopen", H5T_NATIVE_INT, space, dcpl)) < 0) goto error; - if((dset2 = H5Dopen(dset1, ".")) < 0) goto error; + if((dset2 = H5Dopen2(dset1, ".", H5P_DEFAULT)) < 0) goto error; if(H5Sclose(space) < 0) goto error; /* Extend with the first handle */ @@ -4644,7 +4642,7 @@ test_multiopen (hid_t file) H5_FAILED(); printf(" Got %d instead of %d!\n", (int)tmp_size[0], (int)cur_size[0]); goto error; - } + } /* end if */ if(H5Dclose(dset1) < 0) goto error; if(H5Dclose(dset2) < 0) goto error; @@ -5256,56 +5254,56 @@ test_set_local(hid_t fapl) /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + printf(" Line %d: Can't close dataspace\n", __LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + printf(" Line %d: Can't close dcpl\n", __LINE__); goto error; } /* end if */ /* Close file (flushes & empties cache) */ - if (H5Fclose(file) < 0) { + if(H5Fclose(file) < 0) { H5_FAILED(); - printf(" Line %d: Can't close file\n",__LINE__); + printf(" Line %d: Can't close file\n", __LINE__); goto error; } /* end if */ /* Open file */ - if ((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) { + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open file\n",__LINE__); + printf(" Line %d: Can't open file\n", __LINE__); goto error; } /* Re-open dataset */ - if ((dsid = H5Dopen(file, DSET_SET_LOCAL_NAME)) < 0) { + if((dsid = H5Dopen2(file, DSET_SET_LOCAL_NAME, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataset\n",__LINE__); + printf(" Line %d: Can't open dataset\n", __LINE__); goto error; } /* end if */ /* Query the dataset's size on disk */ - if((dset_size=H5Dget_storage_size(dsid))==0) { + if((dset_size = H5Dget_storage_size(dsid)) == 0) { H5_FAILED(); - printf(" Line %d: Error querying dataset size\n",__LINE__); + printf(" Line %d: Error querying dataset size\n", __LINE__); goto error; } /* end if */ /* Verify that the size indicates data is uncompressed */ - if((H5Tget_size(H5T_NATIVE_INT)*dims[0]*dims[1])!=dset_size) { + if((H5Tget_size(H5T_NATIVE_INT) * dims[0] * dims[1]) != dset_size) { H5_FAILED(); - printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); + printf(" Line %d: Incorrect dataset size: %lu\n", __LINE__, (unsigned long)dset_size); goto error; } /* end if */ /* Read data */ - if (H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { + if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { H5_FAILED(); - printf(" Line %d: Error reading dataset data\n",__LINE__); + printf(" Line %d: Error reading dataset data\n", __LINE__); goto error; } /* end if */ @@ -5327,35 +5325,35 @@ test_set_local(hid_t fapl) /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + printf(" Line %d: Can't close dataset\n", __LINE__); goto error; } /* end if */ /* Re-open second dataset */ - if ((dsid = H5Dopen(file, DSET_SET_LOCAL_NAME_2)) < 0) { + if((dsid = H5Dopen2(file, DSET_SET_LOCAL_NAME_2, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataset\n",__LINE__); + printf(" Line %d: Can't open dataset\n", __LINE__); goto error; } /* end if */ /* Query the dataset's size on disk */ - if((dset_size=H5Dget_storage_size(dsid))==0) { + if((dset_size = H5Dget_storage_size(dsid)) == 0) { H5_FAILED(); - printf(" Line %d: Error querying dataset size\n",__LINE__); + printf(" Line %d: Error querying dataset size\n", __LINE__); goto error; } /* end if */ /* Verify that the size indicates data is uncompressed */ - if((H5Tget_size(H5T_NATIVE_DOUBLE)*dims[0]*dims[1])!=dset_size) { + if((H5Tget_size(H5T_NATIVE_DOUBLE) * dims[0] * dims[1]) != dset_size) { H5_FAILED(); - printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); + printf(" Line %d: Incorrect dataset size: %lu\n", __LINE__, (unsigned long)dset_size); goto error; } /* end if */ /* Read data */ - if (H5Dread(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_dbl) < 0) { + if(H5Dread(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_dbl) < 0) { H5_FAILED(); - printf(" Line %d: Error reading dataset data\n",__LINE__); + printf(" Line %d: Error reading dataset data\n", __LINE__); goto error; } /* end if */ @@ -5636,45 +5634,44 @@ auxread_fdata(hid_t fid, const char *name) hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ int i; - if ((dset_id=H5Dopen(fid,name)) < 0) + if((dset_id = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) goto error; - if ((space_id=H5Dget_space(dset_id)) < 0) + if((space_id = H5Dget_space(dset_id)) < 0) goto error; - if ((ftype_id=H5Dget_type (dset_id)) < 0) + if((ftype_id = H5Dget_type(dset_id)) < 0) goto error; - if ((dcpl_id=H5Dget_create_plist(dset_id)) < 0) + if((dcpl_id = H5Dget_create_plist(dset_id)) < 0) goto error; - if ( (rank=H5Sget_simple_extent_ndims(space_id)) < 0) + if((rank = H5Sget_simple_extent_ndims(space_id)) < 0) goto error; HDmemset(dims, 0, sizeof dims); - if ( H5Sget_simple_extent_dims(space_id,dims,NULL) < 0) + if(H5Sget_simple_extent_dims(space_id, dims, NULL) < 0) goto error; - nelmts=1; - for (i=0; i=0); + + /* Create a small data space for compact dataset */ + small_dims[0] = 16; + small_dims[1] = 8; + small_space = H5Screate_simple(2, small_dims, NULL); + assert(space>=0); + + /* + * Create a dataset using the default dataset creation properties. We're + * not sure what they are, so we won't check. + */ + if(( dataset = H5Dcreate(file, DSET_DEPREC_NAME, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT)) < 0) goto error; + + /* Close the dataset */ + if(H5Dclose(dataset) < 0) goto error; + + /* + * Try creating a dataset that already exists. This should fail since a + * dataset can only be created once. Temporarily turn off error + * reporting. + */ + H5E_BEGIN_TRY { + dataset = H5Dcreate(file, DSET_DEFAULT_NAME, H5T_NATIVE_DOUBLE, space, + H5P_DEFAULT); + } H5E_END_TRY; + if(dataset >= 0) { + H5_FAILED(); + puts(" Library allowed overwrite of existing dataset."); + goto error; + } + + /* + * Open the dataset we created above and then close it. This is how + * existing datasets are accessed. + */ + if((dataset = H5Dopen1(file, DSET_DEPREC_NAME)) < 0) goto error; + if(H5Dclose(dataset) < 0) goto error; + + /* + * Try opening a non-existent dataset. This should fail since new datasets + * cannot be created with this function. Temporarily turn off error + * reporting. + */ + H5E_BEGIN_TRY { + dataset = H5Dopen1(file, "does_not_exist"); + } H5E_END_TRY; + if(dataset >= 0) { + H5_FAILED(); + puts(" Opened a non-existent dataset."); + goto error; + } + + /* + * Create a new dataset that uses chunked storage instead of the default + * layout. + */ + create_parms = H5Pcreate(H5P_DATASET_CREATE); + assert(create_parms >= 0); + + /* Attempt to create a dataset with invalid chunk sizes */ + csize[0] = dims[0]*2; + csize[1] = dims[1]*2; + status = H5Pset_chunk(create_parms, 2, csize); + assert(status >= 0); + H5E_BEGIN_TRY { + dataset = H5Dcreate(file, DSET_DEPREC_NAME_CHUNKED, H5T_NATIVE_DOUBLE, space, + create_parms); + } H5E_END_TRY; + if(dataset >= 0) { + H5_FAILED(); + puts(" Opened a dataset with incorrect chunking parameters."); + goto error; + } + + csize[0] = 5; + csize[1] = 100; + status = H5Pset_chunk(create_parms, 2, csize); + assert(status >= 0); + + if((dataset = H5Dcreate(file, DSET_DEPREC_NAME_CHUNKED, H5T_NATIVE_DOUBLE, space, create_parms)) < 0) goto error; + H5Pclose(create_parms); + + /* + * Close the chunked dataset. + */ + if (H5Dclose(dataset) < 0) goto error; + + + /* + * Open the dataset we created above and then close it. This is how + * existing datasets are accessed. + */ + if((dataset = H5Dopen1(file, DSET_DEPREC_NAME_CHUNKED)) < 0) goto error; + if(H5Dclose(dataset) < 0) goto error; + + /* + * Create a compact dataset, then close it. + */ + create_parms = H5Pcreate(H5P_DATASET_CREATE); + assert(create_parms >= 0); + status = H5Pset_layout(create_parms, H5D_COMPACT); + assert(status >= 0); + status = H5Pset_alloc_time(create_parms, H5D_ALLOC_TIME_EARLY); + assert(status >= 0); + + if(( dataset = H5Dcreate(file, DSET_DEPREC_NAME_COMPACT, H5T_NATIVE_DOUBLE, small_space, create_parms)) < 0) goto error; + H5Pclose(create_parms); + if(H5Dclose(dataset) < 0) goto error; + + /* + * Open the dataset we created above and then close it. This is how + * existing datasets are accessed. + */ + if((dataset = H5Dopen1(file, DSET_DEPREC_NAME_COMPACT)) < 0) goto error; + if(H5Dclose(dataset) < 0) goto error; + + PASSED(); + return 0; + + error: + return -1; +} /* end test_deprec() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /*------------------------------------------------------------------------- @@ -6278,40 +6428,43 @@ main(void) if(H5Gclose(grp) < 0) goto error; - nerrors += (test_create(file) < 0 ? 1: 0); - nerrors += (test_simple_io(my_fapl) < 0 ? 1: 0); - nerrors += (test_compact_io(my_fapl) < 0 ? 1: 0); - nerrors += (test_max_compact(my_fapl) < 0 ? 1: 0); - nerrors += (test_conv_buffer(file) < 0 ? 1: 0); - nerrors += (test_tconv(file) < 0 ? 1: 0); - nerrors += (test_filters(file, my_fapl) < 0 ? 1: 0); - nerrors += (test_onebyte_shuffle(file) < 0 ? 1: 0); - nerrors += (test_nbit_int(file) < 0 ? 1: 0); - nerrors += (test_nbit_float(file) < 0 ? 1: 0); - nerrors += (test_nbit_double(file) < 0 ? 1: 0); - nerrors += (test_nbit_array(file) < 0 ? 1: 0); - nerrors += (test_nbit_compound(file) < 0 ? 1: 0); - nerrors += (test_nbit_compound_2(file) < 0 ? 1: 0); - nerrors += (test_nbit_compound_3(file) < 0 ? 1: 0); - nerrors += (test_scaleoffset_int(file) < 0 ? 1: 0); - nerrors += (test_scaleoffset_int_2(file) < 0 ? 1: 0); - nerrors += (test_scaleoffset_float(file) < 0 ? 1: 0); - nerrors += (test_scaleoffset_float_2(file) < 0 ? 1: 0); - nerrors += (test_scaleoffset_double(file) < 0 ? 1: 0); - nerrors += (test_scaleoffset_double_2(file) < 0 ? 1: 0); - nerrors += (test_multiopen (file) < 0 ? 1: 0); - nerrors += (test_types(file) < 0 ? 1: 0); - nerrors += (test_userblock_offset(my_fapl) < 0 ? 1: 0); - nerrors += (test_missing_filter(file) < 0 ? 1: 0); - nerrors += (test_can_apply(file) < 0 ? 1: 0); - nerrors += (test_set_local(my_fapl) < 0 ? 1: 0); - nerrors += (test_can_apply_szip(file) < 0 ? 1: 0); - nerrors += (test_compare_dcpl(file) < 0 ? 1: 0); - nerrors += (test_filter_delete(file) < 0 ? 1: 0); - nerrors += (test_filters_endianess(my_fapl) < 0 ? 1: 0); - nerrors += (test_zero_dims(file) < 0 ? 1: 0); - nerrors += (test_missing_chunk(file) < 0 ? 1: 0); - nerrors += (test_random_chunks() < 0 ? 1: 0); + nerrors += (test_create(file) < 0 ? 1 : 0); + nerrors += (test_simple_io(my_fapl) < 0 ? 1 : 0); + nerrors += (test_compact_io(my_fapl) < 0 ? 1 : 0); + nerrors += (test_max_compact(my_fapl) < 0 ? 1 : 0); + nerrors += (test_conv_buffer(file) < 0 ? 1 : 0); + nerrors += (test_tconv(file) < 0 ? 1 : 0); + nerrors += (test_filters(file, my_fapl) < 0 ? 1 : 0); + nerrors += (test_onebyte_shuffle(file) < 0 ? 1 : 0); + nerrors += (test_nbit_int(file) < 0 ? 1 : 0); + nerrors += (test_nbit_float(file) < 0 ? 1 : 0); + nerrors += (test_nbit_double(file) < 0 ? 1 : 0); + nerrors += (test_nbit_array(file) < 0 ? 1 : 0); + nerrors += (test_nbit_compound(file) < 0 ? 1 : 0); + nerrors += (test_nbit_compound_2(file) < 0 ? 1 : 0); + nerrors += (test_nbit_compound_3(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_int(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_float_2(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_double(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_double_2(file) < 0 ? 1 : 0); + nerrors += (test_multiopen (file) < 0 ? 1 : 0); + nerrors += (test_types(file) < 0 ? 1 : 0); + nerrors += (test_userblock_offset(my_fapl) < 0 ? 1 : 0); + nerrors += (test_missing_filter(file) < 0 ? 1 : 0); + nerrors += (test_can_apply(file) < 0 ? 1 : 0); + nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0); + nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0); + nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0); + nerrors += (test_filter_delete(file) < 0 ? 1 : 0); + nerrors += (test_filters_endianess(my_fapl) < 0 ? 1 : 0); + nerrors += (test_zero_dims(file) < 0 ? 1 : 0); + nerrors += (test_missing_chunk(file) < 0 ? 1 : 0); + nerrors += (test_random_chunks() < 0 ? 1 : 0); +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += (test_deprec(file) < 0 ? 1 : 0); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ if(H5Fclose(file) < 0) goto error; diff --git a/test/dtypes.c b/test/dtypes.c index b327344..d509a39 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -179,28 +179,28 @@ test_classes(void) /*------------------------------------------------------------- * Check class of some atomic types. *-----------------------------------------------------------*/ - if ((tcls=H5Tget_class(H5T_NATIVE_INT))<0) TEST_ERROR + if ((tcls=H5Tget_class(H5T_NATIVE_INT)) < 0) TEST_ERROR if (H5T_INTEGER!=tcls) TEST_ERROR - if ((tcls=H5Tget_class(H5T_NATIVE_DOUBLE))<0) TEST_ERROR + if ((tcls=H5Tget_class(H5T_NATIVE_DOUBLE)) < 0) TEST_ERROR if (H5T_FLOAT!=tcls) TEST_ERROR /* Create a VL datatype of char. It should be a VL, not a string class. */ - if((vlc_id=H5Tvlen_create(H5T_NATIVE_CHAR))<0) TEST_ERROR + if((vlc_id=H5Tvlen_create(H5T_NATIVE_CHAR)) < 0) TEST_ERROR /* Make certain that the correct classes can be detected */ - if ((tcls=H5Tget_class(vlc_id))<0) TEST_ERROR + if ((tcls=H5Tget_class(vlc_id)) < 0) TEST_ERROR if (H5T_VLEN!=tcls) TEST_ERROR /* Make certain that an incorrect class is not detected */ if (H5T_STRING==tcls) TEST_ERROR /* Create a VL string. It should be a string, not a VL class. */ - if((vls_id=H5Tcopy(H5T_C_S1))<0) TEST_ERROR - if(H5Tset_size(vls_id, H5T_VARIABLE)<0) TEST_ERROR; + if((vls_id=H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR + if(H5Tset_size(vls_id, H5T_VARIABLE) < 0) TEST_ERROR; /* Make certain that the correct classes can be detected */ - if ((tcls=H5Tget_class(vls_id))<0) TEST_ERROR + if ((tcls=H5Tget_class(vls_id)) < 0) TEST_ERROR if (H5T_STRING!=tcls) TEST_ERROR /* Make certain that an incorrect class is not detected */ @@ -210,31 +210,31 @@ test_classes(void) * Check class for member types of compound type. *-----------------------------------------------------------*/ /* Create a compound datatype and insert some complex types */ - if ((cmpd_id = H5Tcreate(H5T_COMPOUND, sizeof(struct complex)))<0) TEST_ERROR - if (H5Tinsert(cmpd_id, "vl_c", HOFFSET(struct complex, vl_c), vlc_id)<0) TEST_ERROR - if (H5Tinsert(cmpd_id, "vl_s", HOFFSET(struct complex, vl_s), vls_id)<0) TEST_ERROR + if ((cmpd_id = H5Tcreate(H5T_COMPOUND, sizeof(struct complex))) < 0) TEST_ERROR + if (H5Tinsert(cmpd_id, "vl_c", HOFFSET(struct complex, vl_c), vlc_id) < 0) TEST_ERROR + if (H5Tinsert(cmpd_id, "vl_s", HOFFSET(struct complex, vl_s), vls_id) < 0) TEST_ERROR nmembs = H5Tget_nmembers(cmpd_id); for (i=0;i=0) { + if(status >= 0) { H5_FAILED(); HDputs (" Dataset datatypes should not be modifiable!"); goto error; } - if (H5Tclose (t2)<0) goto error; + if(H5Tclose(t2) < 0) goto error; /* * Close the dataset and reopen it, testing that it's type is still * read-only. */ - if (H5Dclose (dset)<0) goto error; - if ((dset=H5Dopen (file, "dset1"))<0) goto error; - if ((t2 = H5Dget_type (dset))<0) goto error; + if(H5Dclose(dset) < 0) goto error; + if((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) goto error; + if((t2 = H5Dget_type(dset)) < 0) goto error; H5E_BEGIN_TRY { - status = H5Tset_precision (t2, 256); + status = H5Tset_precision(t2, 256); } H5E_END_TRY; - if (status>=0) { + if(status >= 0) { H5_FAILED(); HDputs (" Dataset datatypes should not be modifiable!"); goto error; } - if (H5Tclose (t2)<0) goto error; + if(H5Tclose(t2) < 0) goto error; /* * Get the dataset datatype by applying H5Tcopy() to the dataset. The * result should be modifiable. */ - if ((t2=H5Tcopy (dset))<0) goto error; - if (H5Tset_precision (t2, 256)<0) goto error; - if (H5Tclose (t2)<0) goto error; + if((t2=H5Tcopy(dset)) < 0) goto error; + if(H5Tset_precision(t2, 256) < 0) goto error; + if(H5Tclose(t2) < 0) goto error; + + if(H5Dclose(dset) < 0) goto error; + if(H5Fclose(file) < 0) goto error; + if(H5Tclose(type) < 0) goto error; + if(H5Sclose(space) < 0) goto error; - H5Dclose (dset); - H5Fclose (file); - H5Tclose (type); - H5Sclose (space); PASSED(); return 0; @@ -2587,10 +2588,10 @@ test_named (hid_t fapl) TESTING("named datatypes"); h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if ((file=H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) { + if ((file=H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { goto error; } - if ((space = H5Screate_simple (2, ds_size, ds_size))<0) goto error; + if ((space = H5Screate_simple (2, ds_size, ds_size)) < 0) goto error; /* Predefined types cannot be committed */ H5E_BEGIN_TRY { @@ -2684,7 +2685,7 @@ test_named (hid_t fapl) /* Close the dataset, then close its type, then reopen the dataset */ if(H5Dclose(dset) < 0) goto error; if(H5Tclose(t2) < 0) goto error; - if((dset = H5Dopen(file, "dset1")) < 0) goto error; + if((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) goto error; /* Get the dataset's type and make sure it's named */ if((t2 = H5Dget_type(dset)) < 0) goto error; @@ -2705,7 +2706,7 @@ test_named (hid_t fapl) /* Reopen the second dataset and make sure the type is shared */ if(H5Tclose(t2) < 0) goto error; if(H5Dclose(dset) < 0) goto error; - if((dset = H5Dopen(file, "dset2")) < 0) goto error; + if((dset = H5Dopen2(file, "dset2", H5P_DEFAULT)) < 0) goto error; if((t2 = H5Dget_type(dset)) < 0) goto error; if((status = H5Tcommitted(t2)) < 0) goto error; if(!status) { @@ -2786,9 +2787,9 @@ mkstr(size_t len, H5T_str_t strpad) { hid_t t; - if ((t=H5Tcopy(H5T_C_S1))<0) return -1; - if (H5Tset_size(t, len)<0) return -1; - if (H5Tset_strpad(t, strpad)<0) return -1; + if ((t=H5Tcopy(H5T_C_S1)) < 0) return -1; + if (H5Tset_size(t, len) < 0) return -1; + if (H5Tset_strpad(t, strpad) < 0) return -1; return t; } @@ -2825,21 +2826,21 @@ test_conv_str_1(void) dst_type = mkstr(5, H5T_STR_NULLTERM); buf = (char*)HDcalloc(2, 10); HDmemcpy(buf, "abcdefghi\0abcdefghi\0", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcd\0abcd\0abcdefghi\0", 20)) { H5_FAILED(); HDputs(" Truncated C-string test failed"); goto error; } - if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcd\0\0\0\0\0\0abcd\0\0\0\0\0\0", 20)) { H5_FAILED(); HDputs(" Extended C-string test failed"); goto error; } HDfree(buf); - if (H5Tclose(src_type)<0) goto error; - if (H5Tclose(dst_type)<0) goto error; + if (H5Tclose(src_type) < 0) goto error; + if (H5Tclose(dst_type) < 0) goto error; /* * Convert a null padded string to a shorter and then longer string. @@ -2848,21 +2849,21 @@ test_conv_str_1(void) dst_type = mkstr(5, H5T_STR_NULLPAD); buf = (char*)HDcalloc(2, 10); HDmemcpy(buf, "abcdefghijabcdefghij", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdeabcdeabcdefghij", 20)) { H5_FAILED(); HDputs(" Truncated C buffer test failed"); goto error; } - if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", 20)) { H5_FAILED(); HDputs(" Extended C buffer test failed"); goto error; } HDfree(buf); - if (H5Tclose(src_type)<0) goto error; - if (H5Tclose(dst_type)<0) goto error; + if (H5Tclose(src_type) < 0) goto error; + if (H5Tclose(dst_type) < 0) goto error; /* * Convert a space-padded string to a shorter and then longer string. @@ -2871,21 +2872,21 @@ test_conv_str_1(void) dst_type = mkstr(5, H5T_STR_SPACEPAD); buf = (char*)HDcalloc(2, 10); HDmemcpy(buf, "abcdefghijabcdefghij", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdeabcdeabcdefghij", 20)) { H5_FAILED(); HDputs(" Truncated Fortran-string test failed"); goto error; } - if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcde abcde ", 20)) { H5_FAILED(); HDputs(" Extended Fortran-string test failed"); goto error; } HDfree(buf); - if (H5Tclose(src_type)<0) goto error; - if (H5Tclose(dst_type)<0) goto error; + if (H5Tclose(src_type) < 0) goto error; + if (H5Tclose(dst_type) < 0) goto error; /* * What happens if a null-terminated string is not null terminated? If @@ -2897,7 +2898,7 @@ test_conv_str_1(void) dst_type = mkstr(10, H5T_STR_NULLTERM); buf = (char*)HDcalloc(2, 10); HDmemcpy(buf, "abcdefghijabcdefghij", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdefghijabcdefghij", 20)) { H5_FAILED(); HDputs(" Non-terminated string test 1"); @@ -2906,22 +2907,22 @@ test_conv_str_1(void) H5Tclose(dst_type); dst_type = mkstr(5, H5T_STR_NULLTERM); HDmemcpy(buf, "abcdefghijabcdefghij", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcd\0abcd\0abcdefghij", 20)) { H5_FAILED(); HDputs(" Non-terminated string test 2"); goto error; } HDmemcpy(buf, "abcdeabcdexxxxxxxxxx", 20); - if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", 20)) { H5_FAILED(); HDputs(" Non-terminated string test 2"); goto error; } HDfree(buf); - if (H5Tclose(src_type)<0) goto error; - if (H5Tclose(dst_type)<0) goto error; + if (H5Tclose(src_type) < 0) goto error; + if (H5Tclose(dst_type) < 0) goto error; /* * Test C string to Fortran and vice versa. @@ -2930,53 +2931,53 @@ test_conv_str_1(void) dst_type = mkstr(10, H5T_STR_SPACEPAD); buf = (char*)HDcalloc(2, 10); HDmemcpy(buf, "abcdefghi\0abcdefghi\0", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdefghi abcdefghi ", 20)) { H5_FAILED(); HDputs(" C string to Fortran test 1"); goto error; } - if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdefghi\0abcdefghi\0", 20)) { H5_FAILED(); HDputs(" Fortran to C string test 1"); goto error; } - if (H5Tclose(dst_type)<0) goto error; + if (H5Tclose(dst_type) < 0) goto error; dst_type = mkstr(5, H5T_STR_SPACEPAD); HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", 20)) { H5_FAILED(); HDputs(" C string to Fortran test 2"); goto error; } - if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", 20)) { H5_FAILED(); HDputs(" Fortran to C string test 2"); goto error; } - if (H5Tclose(src_type)<0) goto error; - if (H5Tclose(dst_type)<0) goto error; + if (H5Tclose(src_type) < 0) goto error; + if (H5Tclose(dst_type) < 0) goto error; src_type = mkstr(5, H5T_STR_NULLTERM); dst_type = mkstr(10, H5T_STR_SPACEPAD); HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcd abcd ", 20)) { H5_FAILED(); HDputs(" C string to Fortran test 3"); goto error; } - if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcd\0abcd\0abcd ", 20)) { H5_FAILED(); HDputs(" Fortran to C string test 3"); goto error; } HDfree(buf); - if (H5Tclose(src_type)<0) goto error; - if (H5Tclose(dst_type)<0) goto error; + if (H5Tclose(src_type) < 0) goto error; + if (H5Tclose(dst_type) < 0) goto error; /* * Test C buffer to Fortran and vice versa. @@ -2985,53 +2986,53 @@ test_conv_str_1(void) dst_type = mkstr(10, H5T_STR_SPACEPAD); buf = (char*)HDcalloc(2, 10); HDmemcpy(buf, "abcdefghijabcdefghij", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdefghijabcdefghij", 20)) { H5_FAILED(); HDputs(" C buffer to Fortran test 1"); goto error; } - if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdefghijabcdefghij", 20)) { H5_FAILED(); HDputs(" Fortran to C buffer test 1"); goto error; } - if (H5Tclose(dst_type)<0) goto error; + if (H5Tclose(dst_type) < 0) goto error; dst_type = mkstr(5, H5T_STR_SPACEPAD); HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", 20)) { H5_FAILED(); HDputs(" C buffer to Fortran test 2"); goto error; } - if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", 20)) { H5_FAILED(); HDputs(" Fortran to C buffer test 2"); goto error; } - if (H5Tclose(src_type)<0) goto error; - if (H5Tclose(dst_type)<0) goto error; + if (H5Tclose(src_type) < 0) goto error; + if (H5Tclose(dst_type) < 0) goto error; src_type = mkstr(5, H5T_STR_NULLPAD); dst_type = mkstr(10, H5T_STR_SPACEPAD); HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", 20); - if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcd abcd ", 20)) { H5_FAILED(); HDputs(" C buffer to Fortran test 3"); goto error; } - if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcd\0abcd\0abcd ", 20)) { H5_FAILED(); HDputs(" Fortran to C buffer test 3"); goto error; } HDfree(buf); - if (H5Tclose(src_type)<0) goto error; - if (H5Tclose(dst_type)<0) goto error; + if (H5Tclose(src_type) < 0) goto error; + if (H5Tclose(dst_type) < 0) goto error; PASSED(); reset_hdf5(); @@ -3092,9 +3093,9 @@ test_conv_str_2(void) } printf("%-70s", s); HDfflush(stdout); - if (H5Tconvert(c_type, f_type, nelmts, buf, NULL, H5P_DEFAULT)<0) + if (H5Tconvert(c_type, f_type, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error; - if (H5Tconvert(f_type, c_type, nelmts, buf, NULL, H5P_DEFAULT)<0) + if (H5Tconvert(f_type, c_type, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error; PASSED(); } @@ -3156,11 +3157,11 @@ test_conv_str_3(void) if ((size=H5Tget_precision(type))==0) goto error; if ((size=H5Tget_size(type))==0) goto error; - if (H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE)<0) goto error; - if ((cset=H5Tget_cset(type))<0) goto error; - if (H5Tget_strpad(type)<0) goto error; - if (H5Tset_offset(type, 0)<0) goto error; - if (H5Tget_order(type)<0) goto error; + if (H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE) < 0) goto error; + if ((cset=H5Tget_cset(type)) < 0) goto error; + if (H5Tget_strpad(type) < 0) goto error; + if (H5Tset_offset(type, 0) < 0) goto error; + if (H5Tget_order(type) < 0) goto error; H5E_BEGIN_TRY { ret=H5Tset_precision(type, nelmts); @@ -3277,7 +3278,7 @@ test_conv_enum_1(void) } printf("%-70s", s); HDfflush(stdout); - if (H5Tconvert(t1, t2, nelmts, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(t1, t2, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error; PASSED(); } @@ -3290,7 +3291,7 @@ test_conv_enum_1(void) } printf("%-70s", s); HDfflush(stdout); - if (H5Tconvert(t2, t1, nelmts, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(t2, t1, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error; PASSED(); } ret_value = 0; @@ -3424,7 +3425,7 @@ test_conv_bitfield(void) dt = H5Tcopy(H5T_STD_B32LE); buf[0] = buf[1] = 0xAA; buf[2] = buf[3] = 0x55; /*irrelevant*/ - if (H5Tconvert(st, dt, 1, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(st, dt, 1, buf, NULL, H5P_DEFAULT) < 0) goto error; if (buf[0]!=0xAA || buf[1]!=0xAA || buf[2]!=0 || buf[3]!=0) { H5_FAILED(); printf(" s=0xaaaa, d=0x%02x%02x%02x%02x (test 1)\n", @@ -3443,7 +3444,7 @@ test_conv_bitfield(void) H5Tset_precision(dt, 12); H5Tset_offset(dt, 10); buf[0] = 0xA8; buf[1] = 0x2A; buf[2] = buf[3] = 0; - if (H5Tconvert(st, dt, 1, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(st, dt, 1, buf, NULL, H5P_DEFAULT) < 0) goto error; if (buf[0]!=0 || buf[1]!=0xA8 || buf[2]!=0x2A || buf[3]!=0) { H5_FAILED(); printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 2)\n", @@ -3457,7 +3458,7 @@ test_conv_bitfield(void) */ H5Tset_pad(dt, H5T_PAD_ONE, H5T_PAD_ONE); buf[0] = 0xA8; buf[1] = 0x2A; buf[2] = buf[3] = 0; - if (H5Tconvert(st, dt, 1, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(st, dt, 1, buf, NULL, H5P_DEFAULT) < 0) goto error; if (buf[0]!=0xff || buf[1]!=0xAB || buf[2]!=0xEA || buf[3]!=0xff) { H5_FAILED(); printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 3)\n", @@ -3512,18 +3513,18 @@ test_bitfield_funcs(void) /* * First create a bitfield type. */ - if((type = H5Tcopy(H5T_STD_B32LE))<0) goto error; + if((type = H5Tcopy(H5T_STD_B32LE)) < 0) goto error; /* * Offset a 12-byte value in the middle of a 16 and 32 byte * field. Pad unused bits with ones. * ____ ____ __10 1010 1010 10__ ____ ____ */ - if(H5Tset_precision(type, 12)<0) goto error; - if(H5Tset_offset(type, 10)<0) goto error; + if(H5Tset_precision(type, 12) < 0) goto error; + if(H5Tset_offset(type, 10) < 0) goto error; if(H5Tset_pad(type, H5T_PAD_ONE, H5T_PAD_ONE)) goto error; if((size=H5Tget_size(type))==0) goto error; - if(H5Tset_order(type, H5T_ORDER_BE)<0) goto error; + if(H5Tset_order(type, H5T_ORDER_BE) < 0) goto error; H5E_BEGIN_TRY { size=H5Tget_ebias(type); @@ -3710,12 +3711,12 @@ opaque_check(int tag_it) saved = num_opaque_conversions_g = 0; /* Build source and destination types */ - if ((st=H5Tcreate(H5T_OPAQUE, 4))<0) goto error; - if (H5Tset_tag(st, "opaque source type")<0) goto error; + if ((st=H5Tcreate(H5T_OPAQUE, 4)) < 0) goto error; + if (H5Tset_tag(st, "opaque source type") < 0) goto error; - if ((dt=H5Tcreate(H5T_OPAQUE, 4))<0) goto error; + if ((dt=H5Tcreate(H5T_OPAQUE, 4)) < 0) goto error; if (tag_it) { - if (H5Tset_tag(dt, "opaque destination type")<0) + if (H5Tset_tag(dt, "opaque destination type") < 0) goto error; } @@ -3730,11 +3731,11 @@ opaque_check(int tag_it) } /* Register a conversion function */ - if (H5Tregister(H5T_PERS_HARD, "o_test", st, dt, convert_opaque)<0) + if (H5Tregister(H5T_PERS_HARD, "o_test", st, dt, convert_opaque) < 0) goto error; /* Try the conversion again, this time it should work */ - if (H5Tconvert(st, dt, OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT)<0) goto error; + if (H5Tconvert(st, dt, OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT) < 0) goto error; if (saved+1 != num_opaque_conversions_g) { H5_FAILED(); printf(" unexpected number of opaque conversions\n"); @@ -3742,7 +3743,7 @@ opaque_check(int tag_it) } /* Unregister conversion function */ - if (H5Tunregister(H5T_PERS_HARD, "o_test", st, dt, convert_opaque)<0) + if (H5Tunregister(H5T_PERS_HARD, "o_test", st, dt, convert_opaque) < 0) goto error; H5Tclose(st); @@ -3781,7 +3782,7 @@ opaque_long(void) herr_t ret; /* Build opaque type */ - if ((dt=H5Tcreate(H5T_OPAQUE, 4))<0) TEST_ERROR + if ((dt=H5Tcreate(H5T_OPAQUE, 4)) < 0) TEST_ERROR /* Create long tag */ long_tag = HDmalloc(16384+1); @@ -3839,8 +3840,8 @@ opaque_funcs(void) herr_t ret; /* Build opaque type */ - if ((type=H5Tcreate(H5T_OPAQUE, 4))<0) TEST_ERROR - if (H5Tset_tag(type, "opaque source type")<0) TEST_ERROR + if ((type=H5Tcreate(H5T_OPAQUE, 4)) < 0) TEST_ERROR + if (H5Tset_tag(type, "opaque source type") < 0) TEST_ERROR if ((size=H5Tget_size(type))==0) goto error; @@ -3973,7 +3974,7 @@ test_encode(void) /* Create File */ h5_fixname(FILENAME[5], H5P_DEFAULT, filename, sizeof filename); - if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) + if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; /*----------------------------------------------------------------------- @@ -3981,59 +3982,59 @@ test_encode(void) *----------------------------------------------------------------------- */ /* Create a compound datatype */ - if((tid1=H5Tcreate(H5T_COMPOUND, sizeof(struct s1)))<0) { + if((tid1=H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) { H5_FAILED(); printf("Can't create datatype!\n"); goto error; } /* end if */ - if(H5Tinsert(tid1, "a", HOFFSET(struct s1, a), H5T_NATIVE_INT)<0) { + if(H5Tinsert(tid1, "a", HOFFSET(struct s1, a), H5T_NATIVE_INT) < 0) { H5_FAILED(); printf("Can't insert field 'a'\n"); goto error; } /* end if */ - if(H5Tinsert(tid1, "b", HOFFSET(struct s1, b), H5T_NATIVE_FLOAT)<0) { + if(H5Tinsert(tid1, "b", HOFFSET(struct s1, b), H5T_NATIVE_FLOAT) < 0) { H5_FAILED(); printf("Can't insert field 'b'\n"); goto error; } /* end if */ - if(H5Tinsert(tid1, "c", HOFFSET(struct s1, c), H5T_NATIVE_LONG)<0) { + if(H5Tinsert(tid1, "c", HOFFSET(struct s1, c), H5T_NATIVE_LONG) < 0) { H5_FAILED(); printf("Can't insert field 'c'\n"); goto error; } /* end if */ - if(H5Tinsert(tid1, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE)<0) { + if(H5Tinsert(tid1, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE) < 0) { H5_FAILED(); printf("Can't insert field 'd'\n"); goto error; } /* end if */ /* Create a enumerate datatype */ - if((tid2=H5Tcreate(H5T_ENUM, sizeof(short)))<0) { + if((tid2=H5Tcreate(H5T_ENUM, sizeof(short))) < 0) { H5_FAILED(); printf("Can't create enumerate type\n"); goto error; } /* end if */ - if(H5Tenum_insert(tid2, "RED", (enum_val=0,&enum_val))<0) { + if(H5Tenum_insert(tid2, "RED", (enum_val=0,&enum_val)) < 0) { H5_FAILED(); printf("Can't insert field into enumeration type\n"); goto error; } /* end if */ - if(H5Tenum_insert(tid2, "GREEN", (enum_val=1,&enum_val))<0) { + if(H5Tenum_insert(tid2, "GREEN", (enum_val=1,&enum_val)) < 0) { H5_FAILED(); printf("Can't insert field into enumeration type\n"); goto error; } /* end if */ - if(H5Tenum_insert(tid2, "BLUE", (enum_val=2,&enum_val))<0) { + if(H5Tenum_insert(tid2, "BLUE", (enum_val=2,&enum_val)) < 0) { H5_FAILED(); printf("Can't insert field into enumeration type\n"); goto error; } /* end if */ - if(H5Tenum_insert(tid2, "ORANGE", (enum_val=3,&enum_val))<0) { + if(H5Tenum_insert(tid2, "ORANGE", (enum_val=3,&enum_val)) < 0) { H5_FAILED(); printf("Can't insert field into enumeration type\n"); goto error; } /* end if */ - if(H5Tenum_insert(tid2, "YELLOW", (enum_val=4,&enum_val))<0) { + if(H5Tenum_insert(tid2, "YELLOW", (enum_val=4,&enum_val)) < 0) { H5_FAILED(); printf("Can't insert field into enumeration type\n"); goto error; @@ -4044,7 +4045,7 @@ test_encode(void) *----------------------------------------------------------------------- */ /* Encode compound type in a buffer */ - if(H5Tencode(tid1, NULL, &cmpd_buf_size)<0) { + if(H5Tencode(tid1, NULL, &cmpd_buf_size) < 0) { H5_FAILED(); printf("Can't encode compound type\n"); goto error; @@ -4063,7 +4064,7 @@ test_encode(void) goto error; } - if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size)<0) { + if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size) < 0) { H5_FAILED(); printf("Can't encode compound type\n"); goto error; @@ -4094,7 +4095,7 @@ test_encode(void) /* Encode enumerate type in a buffer */ - if(H5Tencode(tid2, NULL, &enum_buf_size)<0) { + if(H5Tencode(tid2, NULL, &enum_buf_size) < 0) { H5_FAILED(); printf("Can't encode enumerate type\n"); goto error; @@ -4103,14 +4104,14 @@ test_encode(void) if(enum_buf_size>0) enum_buf = (unsigned char*)calloc(1, enum_buf_size); - if(H5Tencode(tid2, enum_buf, &enum_buf_size)<0) { + if(H5Tencode(tid2, enum_buf, &enum_buf_size) < 0) { H5_FAILED(); printf("Can't encode enumerate type\n"); goto error; } /* end if */ /* Decode from the enumerate buffer and return an object handle */ - if((decoded_tid2=H5Tdecode(enum_buf))<0) { + if((decoded_tid2=H5Tdecode(enum_buf)) < 0) { H5_FAILED(); printf("Can't decode enumerate type\n"); goto error; @@ -4185,7 +4186,7 @@ test_encode(void) /* Encode compound type in a buffer */ - if(H5Tencode(tid1, NULL, &cmpd_buf_size)<0) { + if(H5Tencode(tid1, NULL, &cmpd_buf_size) < 0) { H5_FAILED(); printf("Can't encode compound type\n"); goto error; @@ -4194,7 +4195,7 @@ test_encode(void) if(cmpd_buf_size>0) cmpd_buf = (unsigned char*)calloc(1, cmpd_buf_size); - if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size)<0) { + if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size) < 0) { H5_FAILED(); printf("Can't encode compound type\n"); goto error; @@ -4228,7 +4229,7 @@ test_encode(void) *----------------------------------------------------------------------- */ /* Encode enumerate type in a buffer */ - if(H5Tencode(tid2, NULL, &enum_buf_size)<0) { + if(H5Tencode(tid2, NULL, &enum_buf_size) < 0) { H5_FAILED(); printf("Can't encode enumerate type\n"); goto error; @@ -4237,14 +4238,14 @@ test_encode(void) if(enum_buf_size>0) enum_buf = (unsigned char*)calloc(1, enum_buf_size); - if(H5Tencode(tid2, enum_buf, &enum_buf_size)<0) { + if(H5Tencode(tid2, enum_buf, &enum_buf_size) < 0) { H5_FAILED(); printf("Can't encode enumerate type\n"); goto error; } /* end if */ /* Decode from the enumerate buffer and return an object handle */ - if((decoded_tid2=H5Tdecode(enum_buf))<0) { + if((decoded_tid2=H5Tdecode(enum_buf)) < 0) { H5_FAILED(); printf("Can't decode enumerate type\n"); goto error; @@ -4274,29 +4275,29 @@ test_encode(void) *----------------------------------------------------------------------- */ /* Close datatype and file */ - if(H5Tclose(tid1)<0) { + if(H5Tclose(tid1) < 0) { H5_FAILED(); printf("Can't close datatype\n"); goto error; } /* end if */ - if(H5Tclose(tid2)<0) { + if(H5Tclose(tid2) < 0) { H5_FAILED(); printf("Can't close datatype\n"); goto error; } /* end if */ - if(H5Tclose(decoded_tid1)<0) { + if(H5Tclose(decoded_tid1) < 0) { H5_FAILED(); printf("Can't close datatype\n"); goto error; } /* end if */ - if(H5Tclose(decoded_tid2)<0) { + if(H5Tclose(decoded_tid2) < 0) { H5_FAILED(); printf("Can't close datatype\n"); goto error; } /* end if */ - if(H5Fclose(file)<0) { + if(H5Fclose(file) < 0) { H5_FAILED(); printf("Can't close file\n"); goto error; diff --git a/test/external.c b/test/external.c index 0186d53..20ece60 100644 --- a/test/external.c +++ b/test/external.c @@ -106,42 +106,43 @@ test_1a(hid_t file) hsize_t file_size; /*sizeof external file segment */ TESTING("fixed-size data space, exact storage"); + /* Create the dataset */ - if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; cur_size[0] = max_size[0] = 100; - if (H5Pset_external(dcpl, "ext1.data", (off_t)0, - (hsize_t)(max_size[0]*sizeof(int))) < 0) goto error; - if ((space = H5Screate_simple (1, cur_size, max_size)) < 0) goto error; - if ((dset = H5Dcreate (file, "dset1", H5T_NATIVE_INT, space, dcpl)) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, + (hsize_t)(max_size[0] * sizeof(int))) < 0) goto error; + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; + if((dset = H5Dcreate(file, "dset1", H5T_NATIVE_INT, space, dcpl)) < 0) goto error; - if (H5Dclose (dset) < 0) goto error; - if (H5Sclose (space) < 0) goto error; - if (H5Pclose (dcpl) < 0) goto error; + if(H5Dclose(dset) < 0) goto error; + if(H5Sclose(space) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; /* Read dataset creation information */ - if ((dset = H5Dopen (file, "dset1")) < 0) goto error; + if((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) goto error; /* Test dataset address. Should be undefined. */ - if (H5Dget_offset(dset)!=HADDR_UNDEF) goto error; + if(H5Dget_offset(dset) != HADDR_UNDEF) goto error; - if ((dcpl = H5Dget_create_plist (dset)) < 0) goto error; - if ((n=H5Pget_external_count (dcpl)) < 0) goto error; - if (1!=n) { + if((dcpl = H5Dget_create_plist(dset)) < 0) goto error; + if((n = H5Pget_external_count(dcpl)) < 0) goto error; + if(1 != n) { H5_FAILED(); puts(" Returned external count is wrong."); printf(" got: %d\n ans: 1\n", n); goto error; } - strcpy (name+sizeof(name)-4, "..."); - if (H5Pget_external (dcpl, 0, sizeof(name)-4, name, &file_offset, + HDstrcpy(name + sizeof(name) - 4, "..."); + if(H5Pget_external(dcpl, 0, sizeof(name) - 4, name, &file_offset, &file_size) < 0) goto error; - if (file_offset!=0) { + if(file_offset != 0) { H5_FAILED(); puts(" Wrong file offset."); printf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); goto error; } - if (file_size!=(max_size[0]*sizeof(int))) { + if(file_size != (max_size[0] * sizeof(int))) { H5_FAILED(); puts(" Wrong file size."); printf(" got: %lu\n ans: %lu\n", (unsigned long)file_size, @@ -358,44 +359,45 @@ test_1e(hid_t file) TESTING("unlimited dataspace, unlimited external storage"); /* Create dataset */ - if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) goto error; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) goto error; cur_size[0] = 100; max_size[0] = H5S_UNLIMITED; - if ((space=H5Screate_simple(1, cur_size, max_size)) < 0) goto error; - if ((dset=H5Dcreate(file, "dset5", H5T_NATIVE_INT, space, dcpl)) < 0) + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; + if((dset = H5Dcreate(file, "dset5", H5T_NATIVE_INT, space, dcpl)) < 0) goto error; - if (H5Dclose (dset) < 0) goto error; - if (H5Sclose (space) < 0) goto error; - if (H5Pclose (dcpl) < 0) goto error; + if(H5Dclose(dset) < 0) goto error; + if(H5Sclose(space) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; /* Read dataset creation information */ - if ((dset = H5Dopen (file, "dset5")) < 0) goto error; - if ((dcpl = H5Dget_create_plist (dset)) < 0) goto error; - if ((n = H5Pget_external_count (dcpl)) < 0) goto error; - if (1!=n) { + if((dset = H5Dopen2(file, "dset5", H5P_DEFAULT)) < 0) goto error; + if((dcpl = H5Dget_create_plist(dset)) < 0) goto error; + if((n = H5Pget_external_count(dcpl)) < 0) goto error; + if(1 != n) { H5_FAILED(); puts(" Returned external count is wrong."); printf(" got: %d\n ans: 1\n", n); goto error; } - strcpy (name+sizeof(name)-4, "..."); - if (H5Pget_external (dcpl, 0, sizeof(name)-4, name, &file_offset, + HDstrcpy(name + sizeof(name) - 4, "..."); + if(H5Pget_external(dcpl, 0, sizeof(name) - 4, name, &file_offset, &file_size) < 0) goto error; - if (file_offset!=0) { + if(file_offset != 0) { H5_FAILED(); puts(" Wrong file offset."); printf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); goto error; } - if (H5F_UNLIMITED!=file_size) { + if(H5F_UNLIMITED != file_size) { H5_FAILED(); puts(" Wrong file size."); printf(" got: %lu\n ans: INF\n", (unsigned long)file_size); goto error; } - if (H5Pclose (dcpl) < 0) goto error; - if (H5Dclose (dset) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; + if(H5Dclose(dset) < 0) goto error; + PASSED(); return 0; diff --git a/test/fillval.c b/test/fillval.c index 53ff8f3..2d4d136 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -183,19 +183,19 @@ test_getset(void) * Create the dataset creation property list and the data types that will * be used during this test. */ - if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error; - if ((type_ss=H5Tcreate(H5T_COMPOUND, sizeof fill_ss))<0 || + if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if((type_ss=H5Tcreate(H5T_COMPOUND, sizeof fill_ss)) < 0 || H5Tinsert(type_ss, "v1", HOFFSET(struct fill_ss, v1), - H5T_NATIVE_SHORT)<0 || + H5T_NATIVE_SHORT) < 0 || H5Tinsert(type_ss, "v2", HOFFSET(struct fill_ss, v2), - H5T_NATIVE_SHORT)<0) { + H5T_NATIVE_SHORT) < 0) { goto error; } - if ((type_si=H5Tcreate(H5T_COMPOUND, sizeof fill_si))<0 || + if((type_si=H5Tcreate(H5T_COMPOUND, sizeof fill_si)) < 0 || H5Tinsert(type_si, "v1", HOFFSET(struct fill_si, v1), - H5T_NATIVE_INT)<0 || + H5T_NATIVE_INT) < 0 || H5Tinsert(type_si, "v2", HOFFSET(struct fill_si, v2), - H5T_NATIVE_INT)<0) { + H5T_NATIVE_INT) < 0) { goto error; } @@ -206,7 +206,7 @@ test_getset(void) H5E_BEGIN_TRY { H5Pget_fill_value(dcpl, H5T_NATIVE_INT, &fill_i); } H5E_END_TRY; - if (fill_i != 0) { + if(fill_i != 0) { H5_FAILED(); puts(" H5Pget_fill_value() should return default 0"); goto error; @@ -217,13 +217,13 @@ test_getset(void) */ fill_ss.v1 = 1111; fill_ss.v2 = 2222; - if (H5Pset_fill_value(dcpl, type_ss, &fill_ss)<0) goto error; + if(H5Pset_fill_value(dcpl, type_ss, &fill_ss) < 0) goto error; /* * Get the fill value using the same data type that was used to set it. */ - if (H5Pget_fill_value(dcpl, type_ss, &fill_ss_rd)<0) goto error; - if (fill_ss.v1!=fill_ss_rd.v1 || fill_ss.v2!=fill_ss_rd.v2) { + if(H5Pget_fill_value(dcpl, type_ss, &fill_ss_rd) < 0) goto error; + if(fill_ss.v1!=fill_ss_rd.v1 || fill_ss.v2!=fill_ss_rd.v2) { H5_FAILED(); puts(" Failed to get fill value using same data type that was "); puts(" used to set the fill value."); @@ -233,8 +233,8 @@ test_getset(void) /* * Get the fill value using some other data type. */ - if (H5Pget_fill_value(dcpl, type_si, &fill_si)<0) goto error; - if (fill_ss.v1!=fill_si.v1 || fill_ss.v2!=fill_si.v2) { + if(H5Pget_fill_value(dcpl, type_si, &fill_si) < 0) goto error; + if(fill_ss.v1!=fill_si.v1 || fill_ss.v2!=fill_si.v2) { H5_FAILED(); puts(" Failed to get fill value using a data type other than what"); puts(" was used to set the fill value."); @@ -244,18 +244,18 @@ test_getset(void) /* * Reset the fill value */ - if (H5Pset_fill_value(dcpl, type_si, &fill_si)<0) goto error; - if (H5Pget_fill_value(dcpl, type_ss, &fill_ss)<0) goto error; - if (fill_si.v1!=fill_ss.v1 || fill_si.v2!=fill_ss.v2) { + if(H5Pset_fill_value(dcpl, type_si, &fill_si) < 0) goto error; + if(H5Pget_fill_value(dcpl, type_ss, &fill_ss) < 0) goto error; + if(fill_si.v1!=fill_ss.v1 || fill_si.v2!=fill_ss.v2) { H5_FAILED(); puts(" Resetting the fill value was unsuccessful."); goto error; } /* Success */ - if (H5Pclose(dcpl)<0) goto error; - if (H5Tclose(type_si)<0) goto error; - if (H5Tclose(type_ss)<0) goto error; + if(H5Pclose(dcpl) < 0) goto error; + if(H5Tclose(type_si) < 0) goto error; + if(H5Tclose(type_ss) < 0) goto error; PASSED(); return 0; @@ -333,7 +333,7 @@ test_getset_vl(hid_t fapl) /* Re-open file, group & dataset */ if((fileid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR - if((datasetid = H5Dopen(fileid, "Dataset")) < 0) TEST_ERROR + if((datasetid = H5Dopen2(fileid, "Dataset", H5P_DEFAULT)) < 0) TEST_ERROR /* Get dataset's creation property list */ if((plistid = H5Dget_create_plist(datasetid)) < 0) TEST_ERROR @@ -397,9 +397,9 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) H5D_fill_time_t fill_time; comp_datatype rd_c, fill_ctype; - if (H5D_CHUNKED==layout) { + if(H5D_CHUNKED==layout) { TESTING("chunked dataset creation"); - } else if (H5D_COMPACT==layout) { + } else if(H5D_COMPACT==layout) { TESTING("compact dataset creation"); } else { TESTING("contiguous dataset creation"); @@ -409,18 +409,18 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) * Create a file. */ h5_fixname(base_name, fapl, filename, sizeof filename); - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) + if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; - if ((space=H5Screate_simple(5, cur_size, cur_size))<0) goto error; - if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error; - if (H5D_CHUNKED==layout) { - if (H5Pset_chunk(dcpl, 5, ch_size)<0) goto error; - } else if (H5D_COMPACT==layout) { - if (H5Pset_layout(dcpl, H5D_COMPACT)<0) goto error; + if((space=H5Screate_simple(5, cur_size, cur_size)) < 0) goto error; + if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if(H5D_CHUNKED==layout) { + if(H5Pset_chunk(dcpl, 5, ch_size) < 0) goto error; + } else if(H5D_COMPACT==layout) { + if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) goto error; } /* Create a compound datatype */ - if((comp_type_id = create_compound_type())<0) goto error; + if((comp_type_id = create_compound_type()) < 0) goto error; /* I. Test cases for late space allocation except compact dataset */ @@ -429,10 +429,10 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; /* 1. Compound datatype test */ - if(H5Pget_fill_value(dcpl, comp_type_id, &fill_ctype)<0) goto error; + if(H5Pget_fill_value(dcpl, comp_type_id, &fill_ctype) < 0) goto error; fill_ctype.y = 4444; - if(H5Pset_fill_value(dcpl, comp_type_id, &fill_ctype)<0) goto error; - if((dset9 = H5Dcreate(file, "dset9", comp_type_id, space, dcpl))<0) + if(H5Pset_fill_value(dcpl, comp_type_id, &fill_ctype) < 0) goto error; + if((dset9 = H5Dcreate(file, "dset9", comp_type_id, space, dcpl)) < 0) goto error; /* The three datasets test three fill @@ -441,33 +441,33 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) */ /* 2. Small to large fill conversion */ #ifndef NO_FILLING - if (H5Pset_fill_value(dcpl, H5T_NATIVE_SHORT, &fill_s)<0) goto error; + if(H5Pset_fill_value(dcpl, H5T_NATIVE_SHORT, &fill_s) < 0) goto error; #endif - if ((dset1=H5Dcreate(file, "dset1", H5T_NATIVE_LONG, space, dcpl))<0) + if((dset1=H5Dcreate(file, "dset1", H5T_NATIVE_LONG, space, dcpl)) < 0) goto error; /* 3. Large to small fill conversion */ #ifndef NO_FILLING - if (H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l)<0) goto error; + if(H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l) < 0) goto error; #endif - if ((dset2=H5Dcreate(file, "dset2", H5T_NATIVE_SHORT, space, dcpl))<0) + if((dset2=H5Dcreate(file, "dset2", H5T_NATIVE_SHORT, space, dcpl)) < 0) goto error; /* 4. No conversion */ #ifndef NO_FILLING - if (H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l)<0) goto error; + if(H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l) < 0) goto error; #endif - if ((dset3=H5Dcreate(file, "dset3", H5T_NATIVE_LONG, space, dcpl))<0) + if((dset3=H5Dcreate(file, "dset3", H5T_NATIVE_LONG, space, dcpl)) < 0) goto error; /* 5. late space allocation and never write fill value */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; - if ((dset4=H5Dcreate(file, "dset4", H5T_NATIVE_LONG, space, dcpl))<0) + if((dset4=H5Dcreate(file, "dset4", H5T_NATIVE_LONG, space, dcpl)) < 0) goto error; /* 6. fill value is undefined while fill write time is H5D_FILL_TIME_ALLOC. * Supposed to fail. */ - if(H5Pset_fill_value(dcpl, -1, NULL)<0) goto error; + if(H5Pset_fill_value(dcpl, -1, NULL) < 0) goto error; if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; H5E_BEGIN_TRY { if(H5Dcreate(file, "dset7", H5T_NATIVE_LONG, space, dcpl)!=FAIL) @@ -477,38 +477,38 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) /* II. Test early space allocation cases */ - if (H5Pclose(dcpl)<0) goto error; - if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error; - if (H5D_CHUNKED==layout) { - if (H5Pset_chunk(dcpl, 5, ch_size)<0) goto error; - } else if (H5D_COMPACT==layout) { - if (H5Pset_layout(dcpl, H5D_COMPACT)<0) goto error; + if(H5Pclose(dcpl) < 0) goto error; + if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if(H5D_CHUNKED==layout) { + if(H5Pset_chunk(dcpl, 5, ch_size) < 0) goto error; + } else if(H5D_COMPACT==layout) { + if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) goto error; } if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) goto error; /* 1. Compound datatype test */ - if(H5Pget_fill_value(dcpl, comp_type_id, &fill_ctype)<0) goto error; + if(H5Pget_fill_value(dcpl, comp_type_id, &fill_ctype) < 0) goto error; fill_ctype.y = 4444; - if(H5Pset_fill_value(dcpl, comp_type_id, &fill_ctype)<0) goto error; - if((dset8 = H5Dcreate(file, "dset8", comp_type_id, space, dcpl))<0) + if(H5Pset_fill_value(dcpl, comp_type_id, &fill_ctype) < 0) goto error; + if((dset8 = H5Dcreate(file, "dset8", comp_type_id, space, dcpl)) < 0) goto error; - if(H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l)<0) goto error; + if(H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l) < 0) goto error; /* 2. Never write fill value */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; - if((dset5 = H5Dcreate(file, "dset5", H5T_NATIVE_INT, space, dcpl))<0) + if((dset5 = H5Dcreate(file, "dset5", H5T_NATIVE_INT, space, dcpl)) < 0) goto error; /* 3. Write fill value at space allocation time */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; - if((dset6 = H5Dcreate(file, "dset6", H5T_NATIVE_LONG, space, dcpl))<0) + if((dset6 = H5Dcreate(file, "dset6", H5T_NATIVE_LONG, space, dcpl)) < 0) goto error; /* 4. fill value is undefined while fill write time is H5D_FILL_TIME_ALLOC. * Supposed to fail. */ - if(H5Pset_fill_value(dcpl, -1, NULL)<0) goto error; + if(H5Pset_fill_value(dcpl, -1, NULL) < 0) goto error; H5E_BEGIN_TRY { if(H5Dcreate(file, "dset7", H5T_NATIVE_LONG, space, dcpl)!=FAIL) goto error; @@ -516,69 +516,69 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) /* Close everything */ if(H5D_COMPACT != layout) { - if (H5Dclose(dset1)<0) goto error; - if (H5Dclose(dset2)<0) goto error; - if (H5Dclose(dset3)<0) goto error; - if (H5Dclose(dset4)<0) goto error; - if (H5Dclose(dset9)<0) goto error; + if(H5Dclose(dset1) < 0) goto error; + if(H5Dclose(dset2) < 0) goto error; + if(H5Dclose(dset3) < 0) goto error; + if(H5Dclose(dset4) < 0) goto error; + if(H5Dclose(dset9) < 0) goto error; } - if (H5Dclose(dset5)<0) goto error; - if (H5Dclose(dset6)<0) goto error; - if (H5Dclose(dset8)<0) goto error; - if (H5Sclose(space)<0) goto error; - if (H5Pclose(dcpl)<0) goto error; - if (H5Fclose(file)<0) goto error; + if(H5Dclose(dset5) < 0) goto error; + if(H5Dclose(dset6) < 0) goto error; + if(H5Dclose(dset8) < 0) goto error; + if(H5Sclose(space) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; + if(H5Fclose(file) < 0) goto error; /* Open the file and get the dataset fill value from each dataset */ - if ((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl))<0) + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) goto error; /* I. Check cases for late space allocation except compact dataset */ if(H5D_COMPACT != layout) { /* 1. Large to small conversion */ - if ((dset1=H5Dopen(file, "dset1"))<0) goto error; - if ((dcpl=H5Dget_create_plist(dset1))<0) goto error; + if((dset1 = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) goto error; + if((dcpl = H5Dget_create_plist(dset1)) < 0) goto error; #ifndef NO_FILLING - if (H5Pget_fill_value(dcpl, H5T_NATIVE_SHORT, &rd_s)<0) goto error; - if (rd_s!=fill_s) { + if(H5Pget_fill_value(dcpl, H5T_NATIVE_SHORT, &rd_s) < 0) goto error; + if(rd_s != fill_s) { H5_FAILED(); printf(" %d: Got a different fill value than what was set.",__LINE__); printf(" Got %d, set %d\n", rd_s, fill_s); goto error; } #endif - if (H5Dclose(dset1)<0) goto error; - if (H5Pclose(dcpl)<0) goto error; + if(H5Dclose(dset1) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; /* 2. Small to large conversion */ - if ((dset2=H5Dopen(file, "dset2"))<0) goto error; - if ((dcpl=H5Dget_create_plist(dset2))<0) goto error; + if((dset2 = H5Dopen2(file, "dset2", H5P_DEFAULT)) < 0) goto error; + if((dcpl = H5Dget_create_plist(dset2)) < 0) goto error; #ifndef NO_FILLING - if (H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l)<0) goto error; - if (rd_l!=fill_l) { + if(H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l) < 0) goto error; + if(rd_l!=fill_l) { H5_FAILED(); printf(" %d: Got a different fill value than what was set.",__LINE__); printf(" Got %ld, set %ld\n", rd_l, fill_l); goto error; } #endif - if (H5Dclose(dset2)<0) goto error; - if (H5Pclose(dcpl)<0) goto error; + if(H5Dclose(dset2) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; /* 3. No conversion */ - if ((dset3=H5Dopen(file, "dset3"))<0) goto error; - if ((dcpl=H5Dget_create_plist(dset3))<0) goto error; + if((dset3 = H5Dopen2(file, "dset3", H5P_DEFAULT)) < 0) goto error; + if((dcpl = H5Dget_create_plist(dset3)) < 0) goto error; #ifndef NO_FILLING - if (H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l)<0) goto error; - if (rd_l!=fill_l) { + if(H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l) < 0) goto error; + if(rd_l != fill_l) { H5_FAILED(); printf(" %d: Got a different fill value than what was set.",__LINE__); printf(" Got %ld, set %ld\n", rd_l, fill_l); goto error; } #endif - if(H5Pget_alloc_time(dcpl, &alloc_time)<0) goto error; - if(H5Pget_fill_time(dcpl, &fill_time)<0) goto error; + if(H5Pget_alloc_time(dcpl, &alloc_time) < 0) goto error; + if(H5Pget_fill_time(dcpl, &fill_time) < 0) goto error; if(alloc_time != H5D_ALLOC_TIME_LATE) { H5_FAILED(); puts(" Got non-H5D_ALLOC_TIME_LATE space allocation time."); @@ -589,21 +589,21 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) puts(" Got non-H5D_FILL_TIME_ALLOC fill value write time."); printf(" Got %d\n", fill_time); } - if (H5Dclose(dset3)<0) goto error; - if (H5Pclose(dcpl)<0) goto error; + if(H5Dclose(dset3) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; /* 4. late space allocation and never write fill value */ - if ((dset4=H5Dopen(file, "dset4"))<0) goto error; - if (H5Dget_space_status(dset4, &allocation)<0) goto error; - if (layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED) { + if((dset4 = H5Dopen2(file, "dset4", H5P_DEFAULT)) < 0) goto error; + if(H5Dget_space_status(dset4, &allocation) < 0) goto error; + if(layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED) { H5_FAILED(); puts(" Got allocated space instead of unallocated."); printf(" Got %d\n", allocation); goto error; } - if ((dcpl=H5Dget_create_plist(dset4))<0) goto error; - if(H5Pget_alloc_time(dcpl, &alloc_time)<0) goto error; - if(H5Pget_fill_time(dcpl, &fill_time)<0) goto error; + if((dcpl = H5Dget_create_plist(dset4)) < 0) goto error; + if(H5Pget_alloc_time(dcpl, &alloc_time) < 0) goto error; + if(H5Pget_fill_time(dcpl, &fill_time) < 0) goto error; if(alloc_time != H5D_ALLOC_TIME_LATE) { H5_FAILED(); puts(" Got non-H5D_ALLOC_TIME_LATE space allocation time."); @@ -614,100 +614,101 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) puts(" Got non-H5D_FILL_TIME_NEVER fill value write time."); printf(" Got %d\n", fill_time); } - if (H5Dclose(dset4)<0) goto error; - if (H5Pclose(dcpl)<0) goto error; + if(H5Dclose(dset4) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; /* 5. Compound datatype test */ - if ((dset9=H5Dopen(file, "dset9"))<0) goto error; - if ((dcpl=H5Dget_create_plist(dset9))<0) goto error; - if (H5Pget_fill_value(dcpl, comp_type_id, &rd_c)<0) goto error; + if((dset9 = H5Dopen2(file, "dset9", H5P_DEFAULT)) < 0) goto error; + if((dcpl = H5Dget_create_plist(dset9)) < 0) goto error; + if(H5Pget_fill_value(dcpl, comp_type_id, &rd_c) < 0) goto error; if( rd_c.a!=0 || rd_c.y != fill_ctype.y || rd_c.x != 0 || rd_c.z != '\0') { H5_FAILED(); puts(" Got wrong fill value"); printf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", rd_c.a, rd_c.y, rd_c.x, rd_c.z); } - if (H5Dclose(dset9)<0) goto error; - if (H5Pclose(dcpl)<0) goto error; + if(H5Dclose(dset9) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; } /* II. Check early space allocation cases */ /* 1. Never write fill value */ - if ((dset5=H5Dopen(file, "dset5"))<0) goto error; - if ((dcpl=H5Dget_create_plist(dset5))<0) goto error; - if (H5Dget_space_status(dset5, &allocation)<0) goto error; - if (layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) { + if((dset5 = H5Dopen2(file, "dset5", H5P_DEFAULT)) < 0) goto error; + if((dcpl = H5Dget_create_plist(dset5)) < 0) goto error; + if(H5Dget_space_status(dset5, &allocation) < 0) goto error; + if(layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) { H5_FAILED(); printf(" %d: Got unallocated space instead of allocated.\n",__LINE__); printf(" Got %d\n", allocation); goto error; } - if(H5Pget_alloc_time(dcpl, &alloc_time)<0) goto error; + if(H5Pget_alloc_time(dcpl, &alloc_time) < 0) goto error; if(alloc_time != H5D_ALLOC_TIME_EARLY) { H5_FAILED(); puts(" Got non-H5D_ALLOC_TIME_EARLY space allocation time."); printf(" Got %d\n", alloc_time); } - if(H5Pget_fill_time(dcpl, &fill_time)<0) goto error; + if(H5Pget_fill_time(dcpl, &fill_time) < 0) goto error; if(fill_time != H5D_FILL_TIME_NEVER) { H5_FAILED(); puts(" Got non-H5D_FILL_TIME_NEVER fill value write time."); printf(" Got %d\n", fill_time); } - if (H5Dclose(dset5)<0) goto error; - if (H5Pclose(dcpl)<0) goto error; + if(H5Dclose(dset5) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; /* 2. test writing fill value at space allocation time */ - if ((dset6=H5Dopen(file, "dset6"))<0) goto error; - if ((dcpl=H5Dget_create_plist(dset6))<0) goto error; - if (H5Dget_space_status(dset6, &allocation)<0) goto error; - if (layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) { + if((dset6 = H5Dopen2(file, "dset6", H5P_DEFAULT)) < 0) goto error; + if((dcpl = H5Dget_create_plist(dset6)) < 0) goto error; + if(H5Dget_space_status(dset6, &allocation) < 0) goto error; + if(layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) { H5_FAILED(); printf(" %d: Got unallocated space instead of allocated.\n",__LINE__); printf(" Got %d\n", allocation); goto error; } - if (H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l)<0) goto error; - if (rd_l!=fill_l) { + if(H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l) < 0) goto error; + if(rd_l != fill_l) { H5_FAILED(); printf(" %d: Got a different fill value than what was set.",__LINE__); printf(" Got %ld, set %ld\n", rd_l, fill_l); goto error; } - if(H5Pget_alloc_time(dcpl, &alloc_time)<0) goto error; + if(H5Pget_alloc_time(dcpl, &alloc_time) < 0) goto error; if(alloc_time != H5D_ALLOC_TIME_EARLY) { H5_FAILED(); puts(" Got non-H5D_ALLOC_TIME_EARLY space allocation time."); printf(" Got %d\n", alloc_time); } - if(H5Pget_fill_time(dcpl, &fill_time)<0) goto error; + if(H5Pget_fill_time(dcpl, &fill_time) < 0) goto error; if(fill_time != H5D_FILL_TIME_ALLOC) { H5_FAILED(); puts(" Got non-H5D_FILL_TIME_ALLOC fill value write time."); printf(" Got %d\n", fill_time); } - if (H5Dclose(dset6)<0) goto error; - if (H5Pclose(dcpl)<0) goto error; + if(H5Dclose(dset6) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; /* 3. Compound datatype test */ - if ((dset8=H5Dopen(file, "dset8"))<0) goto error; - if ((dcpl=H5Dget_create_plist(dset8))<0) goto error; - if (H5Pget_fill_value(dcpl, comp_type_id, &rd_c)<0) goto error; - if( rd_c.a != 0 || rd_c.y != fill_ctype.y || rd_c.x != 0 || rd_c.z!='\0') { + if((dset8 = H5Dopen2(file, "dset8", H5P_DEFAULT)) < 0) goto error; + if((dcpl = H5Dget_create_plist(dset8)) < 0) goto error; + if(H5Pget_fill_value(dcpl, comp_type_id, &rd_c) < 0) goto error; + if(rd_c.a != 0 || rd_c.y != fill_ctype.y || rd_c.x != 0 || rd_c.z!='\0') { H5_FAILED(); puts(" Got wrong fill value"); printf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", rd_c.a, rd_c.y, rd_c.x, rd_c.z); } - if (H5Dclose(dset8)<0) goto error; - if (H5Pclose(dcpl)<0) goto error; + if(H5Dclose(dset8) < 0) goto error; + if(H5Pclose(dcpl) < 0) goto error; + + if(H5Fclose(file) < 0) goto error; - if (H5Fclose(file)<0) goto error; PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Pclose(dcpl); H5Sclose(space); @@ -761,7 +762,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, comp_datatype *buf_c=NULL; H5D_space_status_t allocation; - if (datatype==H5T_INTEGER) + if(datatype==H5T_INTEGER) fillval = *(int*)_fillval; else if(datatype==H5T_COMPOUND) { fill_c.a=((comp_datatype*)_fillval)->a; @@ -787,14 +788,14 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, for (i=0; i<1000; i++) { for (j=0; j<5; j++) hs_offset[j] = rand() % cur_size[j]; - if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, - one, NULL)<0) goto error; + if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, + one, NULL) < 0) goto error; /* case for atomic datatype */ - if (datatype==H5T_INTEGER) { + if(datatype==H5T_INTEGER) { if(H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, - &val_rd)<0) goto error; - if (fill_time!=H5D_FILL_TIME_NEVER && val_rd!=fillval) { + &val_rd) < 0) goto error; + if(fill_time!=H5D_FILL_TIME_NEVER && val_rd!=fillval) { H5_FAILED(); HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__); HDfprintf(stdout," Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %u, " @@ -807,8 +808,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, /* case for compound datatype */ } else if(datatype==H5T_COMPOUND) { if(H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, - &rd_c)<0) goto error; - if (fill_time!=H5D_FILL_TIME_NEVER && (rd_c.a!=fill_c.a || + &rd_c) < 0) goto error; + if(fill_time!=H5D_FILL_TIME_NEVER && (rd_c.a!=fill_c.a || rd_c.x!=fill_c.x || rd_c.y!=fill_c.y || rd_c.z!=fill_c.z)) { H5_FAILED(); @@ -823,7 +824,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, } } } - if (H5Sclose(mspace)<0) goto error; + if(H5Sclose(mspace) < 0) goto error; /* Select all odd data locations in the file dataset */ for (i=0, nelmts=1; i<5; i++) { @@ -832,9 +833,9 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, hs_stride[i] = 2; nelmts *= hs_size[i]; } - if ((mspace=H5Screate_simple(5, hs_size, hs_size))<0) goto error; - if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride, - hs_size, NULL)<0) goto error; + if((mspace=H5Screate_simple(5, hs_size, hs_size)) < 0) goto error; + if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride, + hs_size, NULL) < 0) goto error; /* Read non-contiguous selection from empty dataset */ @@ -916,11 +917,11 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, } /* Check if space is allocated */ - if (datatype==H5T_INTEGER && H5Dget_space_status(dset1, &allocation)<0) + if(datatype==H5T_INTEGER && H5Dget_space_status(dset1, &allocation) < 0) goto error; - if (datatype==H5T_COMPOUND && H5Dget_space_status(dset2, &allocation)<0) + if(datatype==H5T_COMPOUND && H5Dget_space_status(dset2, &allocation) < 0) goto error; - if (layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) { + if(layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) { H5_FAILED(); printf(" %d: Got unallocated space instead of allocated.\n",__LINE__); printf(" Got %d\n", allocation); @@ -947,7 +948,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, goto error; if(fill_time == H5D_FILL_TIME_ALLOC) { should_be = odd ? fillval : 9999; - if (val_rd!=should_be) { + if(val_rd!=should_be) { H5_FAILED(); HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__); printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, " @@ -960,7 +961,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, } else if(fill_time == H5D_FILL_TIME_NEVER && !odd) { should_be = 9999; - if (val_rd!=should_be) { + if(val_rd!=should_be) { H5_FAILED(); HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__); printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, " @@ -1033,10 +1034,10 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, buf_c = NULL; } /* end if */ - if (H5Sclose(mspace)<0) goto error; - if (datatype==H5T_INTEGER && H5Dclose(dset1)<0) goto error; - if (datatype==H5T_COMPOUND && H5Dclose(dset2)<0) goto error; - if (H5Sclose(fspace)<0) goto error; + if(H5Sclose(mspace) < 0) goto error; + if(datatype==H5T_INTEGER && H5Dclose(dset1) < 0) goto error; + if(datatype==H5T_COMPOUND && H5Dclose(dset2) < 0) goto error; + if(H5Sclose(fspace) < 0) goto error; return 0; error: @@ -1079,25 +1080,25 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) int fillval = 0x4c70f1cd; comp_datatype fill_ctype={0,0,0,0}; - if (H5D_CHUNKED==layout) { + if(H5D_CHUNKED==layout) { TESTING("chunked dataset I/O"); - } else if (H5D_COMPACT==layout) { + } else if(H5D_COMPACT==layout) { TESTING("compact dataset I/O"); } else { TESTING("contiguous dataset I/O"); } h5_fixname(base_name, fapl, filename, sizeof filename); - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) + if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; - if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error; - if (H5D_CHUNKED==layout) { - if (H5Pset_chunk(dcpl, 5, ch_size)<0) goto error; - } else if (H5D_COMPACT==layout) { - if (H5Pset_layout(dcpl, H5D_COMPACT)<0) goto error; + if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if(H5D_CHUNKED==layout) { + if(H5Pset_chunk(dcpl, 5, ch_size) < 0) goto error; + } else if(H5D_COMPACT==layout) { + if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) goto error; } - if ((ctype_id=create_compound_type())<0) goto error; + if((ctype_id=create_compound_type()) < 0) goto error; /* I. Test H5D_ALLOC_TIME_LATE space allocation cases */ @@ -1111,20 +1112,20 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) layout, H5T_INTEGER, -1); /* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */ - if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; + if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset2", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER, -1); /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; fillval = 0x4c70f1cd; - if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval)<0) goto error; + if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset3", &fillval, H5D_FILL_TIME_ALLOC, layout, H5T_INTEGER, -1); /* case for H5D_FILL_TIME_NEVER as fill write time and fill value is user-defined */ - if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; - if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval)<0) goto error; + if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; + if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset4", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER, -1); @@ -1133,7 +1134,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) /* case for H5D_FILL_TIME_NEVER as fill write time and fill value is undefined */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; - if (H5Pset_fill_value(dcpl, -1, NULL)<0) goto error; + if(H5Pset_fill_value(dcpl, -1, NULL) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset5", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER, -1); @@ -1141,14 +1142,14 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) * as compound type */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; fill_ctype.y = 4444.4444; - if(H5Pset_fill_value(dcpl, ctype_id, &fill_ctype)<0) goto error; + if(H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset11", &fill_ctype, H5D_FILL_TIME_ALLOC, layout, H5T_COMPOUND, ctype_id); - if (H5Pclose(dcpl)<0) goto error; - if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error; - if (H5D_CHUNKED==layout) { - if (H5Pset_chunk(dcpl, 5, ch_size)<0) goto error; + if(H5Pclose(dcpl) < 0) goto error; + if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if(H5D_CHUNKED==layout) { + if(H5Pset_chunk(dcpl, 5, ch_size) < 0) goto error; } } @@ -1163,20 +1164,20 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) layout, H5T_INTEGER, -1); /* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */ - if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; + if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset7", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER, -1); /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; fillval = 0x4c70f1cd; - if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval)<0) goto error; + if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset8", &fillval, H5D_FILL_TIME_ALLOC, layout, H5T_INTEGER, -1); /* case for H5D_FILL_TIME_NEVER as fill write time and fill value is user-defined */ - if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; - if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval)<0) goto error; + if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; + if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset9", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER, -1); @@ -1185,7 +1186,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) /* case for H5D_FILL_TIME_NEVER as fill write time and fill value is undefined */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; - if (H5Pset_fill_value(dcpl, -1, NULL)<0) goto error; + if(H5Pset_fill_value(dcpl, -1, NULL) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset10", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER, -1); @@ -1193,16 +1194,16 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) * as compound type */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; fill_ctype.y = 4444.4444; - if(H5Pset_fill_value(dcpl, ctype_id, &fill_ctype)<0) goto error; + if(H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset12", &fill_ctype, H5D_FILL_TIME_ALLOC, layout, H5T_COMPOUND, ctype_id); if(nerrors) goto error; - if (H5Pclose(dcpl)<0) goto error; - if (H5Tclose(ctype_id)<0) goto error; - if (H5Fclose(file)<0) goto error; + if(H5Pclose(dcpl) < 0) goto error; + if(H5Tclose(ctype_id) < 0) goto error; + if(H5Fclose(file) < 0) goto error; PASSED(); return 0; @@ -1859,7 +1860,7 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) * first dimension can be extendible' as long as the test isn't skipped * below. */ - if (H5D_CONTIGUOUS==layout) { + if(H5D_CONTIGUOUS==layout) { max_size[0] = (max_size[0] * max_size[1] * max_size[2] * max_size[3] * max_size[4]) / (start_size[1] * start_size[2] * start_size[3] * start_size[4]); @@ -1877,14 +1878,14 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) * `extendible contiguous non-external dataset' as long as the test isn't * skipped below. */ - if (H5D_CONTIGUOUS==layout) { + if(H5D_CONTIGUOUS==layout) { int fd; hsize_t nelmts; nelmts = max_size[0]*max_size[1]*max_size[2]*max_size[3]*max_size[4]; - if ((fd=open(FILE_NAME_RAW, O_RDWR|O_CREAT|O_TRUNC, 0666))<0 || - close(fd)<0) goto error; - if (H5Pset_external(dcpl, FILE_NAME_RAW, (off_t)0, (hsize_t)nelmts*sizeof(int))<0) + if((fd=open(FILE_NAME_RAW, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0 || + close(fd) < 0) goto error; + if(H5Pset_external(dcpl, FILE_NAME_RAW, (off_t)0, (hsize_t)nelmts*sizeof(int)) < 0) goto error; } #endif @@ -1896,7 +1897,7 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) * dimension. If it's removed prematurely then you'll get one of the * errors described above or `unable to select fill value region'. */ - if (H5D_CONTIGUOUS==layout) { + if(H5D_CONTIGUOUS==layout) { SKIPPED(); puts(" Not implemented yet -- needs H5S_SELECT_DIFF operator"); goto skip; @@ -1978,20 +1979,20 @@ test_compatible(hid_t fapl) /* Generate correct name for test file by prepending the source path */ if(srcdir && ((strlen(srcdir) + strlen(FILE_COMPATIBLE) + 1) < sizeof(testfile))) { - strcpy(testfile, srcdir); - strcat(testfile, "/"); + HDstrcpy(testfile, srcdir); + HDstrcat(testfile, "/"); } - strcat(testfile, FILE_COMPATIBLE); + HDstrcat(testfile, FILE_COMPATIBLE); - if ((file=H5Fopen(testfile, H5F_ACC_RDONLY, fapl))<0) { + if((file = H5Fopen(testfile, H5F_ACC_RDONLY, fapl)) < 0) { printf(" Could not open file %s. Try set $srcdir to point at the " "source directory of test\n", testfile); goto error; } - if((dset1=H5Dopen(file, "dset1"))<0) goto error; - if ((dcpl1=H5Dget_create_plist(dset1))<0) goto error; - if (H5Pfill_value_defined(dcpl1, &status)<0) goto error; + if((dset1 = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) goto error; + if((dcpl1 = H5Dget_create_plist(dset1)) < 0) goto error; + if(H5Pfill_value_defined(dcpl1, &status) < 0) goto error; if(status != H5D_FILL_VALUE_UNDEFINED) { H5_FAILED(); printf(" %d: Got a different fill value than what was set.",__LINE__); @@ -1999,34 +2000,34 @@ test_compatible(hid_t fapl) (long)status); goto error; } - if((fspace = H5Dget_space(dset1))<0) goto error; - if(H5Sget_simple_extent_dims(fspace, dims, NULL)<0) goto error; + if((fspace = H5Dget_space(dset1)) < 0) goto error; + if(H5Sget_simple_extent_dims(fspace, dims, NULL) < 0) goto error; if(dims[0] != 8 || dims[1] != 8) { H5_FAILED(); puts(" Got a different dimension size than what was set."); printf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]); goto error; } - if((mspace=H5Screate_simple(2, one, NULL))<0) goto error; - if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL)<0) + if((mspace = H5Screate_simple(2, one, NULL)) < 0) goto error; + if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) goto error; - if(H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd)<0) + if(H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd) < 0) goto error; - if (val_rd != 0) { + if(val_rd != 0) { H5_FAILED(); puts(" Got a different value than what was set."); printf(" Got %ld, set 0\n", (long)val_rd); goto error; } - if(H5Pclose(dcpl1)<0) goto error; - if(H5Sclose(fspace)<0) goto error; - if(H5Sclose(mspace)<0) goto error; - if(H5Dclose(dset1)<0) goto error; + if(H5Pclose(dcpl1) < 0) goto error; + if(H5Sclose(fspace) < 0) goto error; + if(H5Sclose(mspace) < 0) goto error; + if(H5Dclose(dset1) < 0) goto error; - if((dset2=H5Dopen(file, "dset2"))<0) goto error; - if ((dcpl2=H5Dget_create_plist(dset2))<0) goto error; - if (H5Pfill_value_defined(dcpl2, &status)<0) goto error; + if((dset2 = H5Dopen2(file, "dset2", H5P_DEFAULT)) < 0) goto error; + if((dcpl2 = H5Dget_create_plist(dset2)) < 0) goto error; + if(H5Pfill_value_defined(dcpl2, &status) < 0) goto error; if(status != H5D_FILL_VALUE_USER_DEFINED) { H5_FAILED(); printf(" %d: Got a different fill value than what was set.",__LINE__); @@ -2034,40 +2035,40 @@ test_compatible(hid_t fapl) (long)status); goto error; } - if (H5Pget_fill_value(dcpl2, H5T_NATIVE_INT, &rd_fill)<0) goto error; - if (rd_fill != fill_val) { + if(H5Pget_fill_value(dcpl2, H5T_NATIVE_INT, &rd_fill) < 0) goto error; + if(rd_fill != fill_val) { H5_FAILED(); printf(" %d: Got a different fill value than what was set.",__LINE__); printf(" Got %ld, set %ld\n", (long)rd_fill, (long)fill_val); goto error; } fspace = -1; - if((fspace = H5Dget_space(dset2))<0) goto error; + if((fspace = H5Dget_space(dset2)) < 0) goto error; dims[0] = dims[1] = (hsize_t)-1; - if(H5Sget_simple_extent_dims(fspace, dims, NULL)<0) goto error; + if(H5Sget_simple_extent_dims(fspace, dims, NULL) < 0) goto error; if(dims[0] != 8 || dims[1] != 8) { H5_FAILED(); puts(" Got a different dimension size than what was set."); printf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]); goto error; } - if((mspace=H5Screate_simple(2, one, NULL))<0) goto error; - if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL)<0) + if((mspace=H5Screate_simple(2, one, NULL)) < 0) goto error; + if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) goto error; - if(H5Dread(dset2, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd)<0) + if(H5Dread(dset2, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd) < 0) goto error; - if (val_rd != fill_val) { + if(val_rd != fill_val) { H5_FAILED(); puts(" Got a different value than what was set."); printf(" Got %ld, set %ld\n", (long)val_rd, (long)fill_val); goto error; } - if(H5Pclose(dcpl2)<0) goto error; - if(H5Sclose(fspace)<0) goto error; - if(H5Sclose(mspace)<0) goto error; - if(H5Dclose(dset2)<0) goto error; + if(H5Pclose(dcpl2) < 0) goto error; + if(H5Sclose(fspace) < 0) goto error; + if(H5Sclose(mspace) < 0) goto error; + if(H5Dclose(dset2) < 0) goto error; - if(H5Fclose(file)<0) goto error; + if(H5Fclose(file) < 0) goto error; PASSED(); return 0; diff --git a/test/flush2.c b/test/flush2.c index 46f61da..dbb0a82 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -57,23 +57,23 @@ check_dset(hid_t file, const char* name) size_t i, j; /* Open the dataset */ - if ((dset=H5Dopen(file, name))<0) goto error; - if ((space=H5Dget_space(dset))<0) goto error; - if (H5Sget_simple_extent_dims(space, ds_size, NULL)<0) goto error; - assert(100==ds_size[0] && 100==ds_size[1]); + if((dset = H5Dopen2(file, name, H5P_DEFAULT)) < 0) goto error; + if((space = H5Dget_space(dset)) < 0) goto error; + if(H5Sget_simple_extent_dims(space, ds_size, NULL) < 0) goto error; + assert(100 == ds_size[0] && 100 == ds_size[1]); /* Read some data */ - if (H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, - the_data)<0) goto error; - for (i=0; i<(size_t)ds_size[0]; i++) { - for (j=0; j<(size_t)ds_size[1]; j++) { + if(H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, + the_data) < 0) goto error; + for(i = 0; i < (size_t)ds_size[0]; i++) + for(j = 0; j < (size_t)ds_size[1]; j++) { /* * The extra cast in the following statement is a bug workaround * for the Win32 version 5.0 compiler. * 1998-11-06 ptl */ - error = fabs(the_data[i][j]-(double)(hssize_t)i/((hssize_t)j+1)); - if (error>0.0001) { + error = fabs(the_data[i][j] - (double)(hssize_t)i / ((hssize_t)j + 1)); + if(error > 0.0001) { H5_FAILED(); printf(" dset[%lu][%lu] = %g\n", (unsigned long)i, (unsigned long)j, the_data[i][j]); @@ -82,8 +82,7 @@ check_dset(hid_t file, const char* name) goto error; } } - } - if (H5Dclose(dset)<0) goto error; + if(H5Dclose(dset) < 0) goto error; return 0; error: diff --git a/test/getname.c b/test/getname.c index 2f3a020..670489f 100644 --- a/test/getname.c +++ b/test/getname.c @@ -218,27 +218,27 @@ test_main(hid_t file_id, hid_t fapl) /*------------------------------------------------------------------------- - * Test H5Iget_name with H5Dopen + * Test H5Iget_name with H5Dopen2 *------------------------------------------------------------------------- */ - TESTING("H5Iget_name with H5Dopen"); + TESTING("H5Iget_name with H5Dopen2"); /* Reopen the dataset */ - if((dataset_id = H5Dopen(file_id, "d1")) < 0) TEST_ERROR + if((dataset_id = H5Dopen2(file_id, "d1", H5P_DEFAULT)) < 0) TEST_ERROR /* Verify */ if(check_name(dataset_id, "/d1", "/d1") < 0) TEST_ERROR /* Close */ - H5Dclose(dataset_id); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR /* Reopen the group */ if((group_id = H5Gopen2(file_id, "g1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Reopen the dataset */ - if((dataset_id = H5Dopen(group_id, "d1")) < 0) FAIL_STACK_ERROR + if((dataset_id = H5Dopen2(group_id, "d1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(dataset_id, "/g1/d1", "/g1/d1") < 0) TEST_ERROR @@ -268,20 +268,20 @@ test_main(hid_t file_id, hid_t fapl) if((dataset_id = H5Dcreate(group3_id , "d1", H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) TEST_ERROR /* Close */ - H5Dclose(dataset_id); - H5Sclose(space_id); - H5Gclose(group_id); - H5Gclose(group2_id); - H5Gclose(group3_id); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR + if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR /* Reopen the dataset */ - if((dataset_id = H5Dopen(file_id, "/g2/bar/baz/d1")) < 0) TEST_ERROR + if((dataset_id = H5Dopen2(file_id, "/g2/bar/baz/d1", H5P_DEFAULT)) < 0) TEST_ERROR /* Verify */ if(check_name(dataset_id, "/g2/bar/baz/d1", "/g2/bar/baz/d1") < 0) TEST_ERROR /* Close */ - H5Dclose(dataset_id); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR PASSED(); @@ -356,14 +356,14 @@ test_main(hid_t file_id, hid_t fapl) /*------------------------------------------------------------------------- - * Test H5Iget_name with H5Lmove and H5Dopen + * Test H5Iget_name with H5Lmove and H5Dopen2 *------------------------------------------------------------------------- */ - TESTING("H5Iget_name with H5Lmove and H5Dopen"); + TESTING("H5Iget_name with H5Lmove and H5Dopen2"); /* Reopen the dataset */ - if((dataset_id = H5Dopen(file_id, "/d1")) < 0) FAIL_STACK_ERROR + if((dataset_id = H5Dopen2(file_id, "/d1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Rename dataset */ if(H5Lmove(file_id, "/d1", H5L_SAME_LOC, "/d1a", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -679,10 +679,10 @@ test_main(hid_t file_id, hid_t fapl) if((group_id = H5Gcreate2(file_id, "/g12", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose(group_id); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR /* Create second file and dataset "d" in it */ - file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + if((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a dataspace */ if((space_id = H5Screate_simple(1, dims, NULL)) < 0) TEST_ERROR @@ -691,13 +691,13 @@ test_main(hid_t file_id, hid_t fapl) if((dataset_id = H5Dcreate(file1_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) TEST_ERROR /* Close */ - H5Dclose(dataset_id); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR /* Mount second file under "g12" in the first file */ if(H5Fmount(file_id, "/g12", file1_id, H5P_DEFAULT) < 0) TEST_ERROR /* Access dataset D in the first file under "/G/D" name */ - if((dataset_id = H5Dopen(file_id, "/g12/d")) < 0) TEST_ERROR + if((dataset_id = H5Dopen2(file_id, "/g12/d", H5P_DEFAULT)) < 0) TEST_ERROR /* Verify */ if(check_name(dataset_id, "/g12/d", "/g12/d") < 0) TEST_ERROR @@ -705,9 +705,9 @@ test_main(hid_t file_id, hid_t fapl) if(H5Funmount(file_id, "/g12") < 0) TEST_ERROR /* Close */ - H5Dclose(dataset_id); - H5Fclose(file1_id); - H5Sclose(space_id); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file1_id) < 0) FAIL_STACK_ERROR + if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR PASSED(); @@ -1008,7 +1008,7 @@ test_main(hid_t file_id, hid_t fapl) if(H5Tclose(type_id) < 0) FAIL_STACK_ERROR /* Reopen the dataset */ - if((dataset_id = H5Dopen(file_id, "/g17/d")) < 0) FAIL_STACK_ERROR + if((dataset_id = H5Dopen2(file_id, "/g17/d", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Get datatype*/ if((type_id = H5Dget_type(dataset_id)) < 0) FAIL_STACK_ERROR @@ -1031,11 +1031,11 @@ test_main(hid_t file_id, hid_t fapl) TESTING("H5Iget_name with datasets that have two names"); /* Open dataset named "d"*/ - if((dataset_id = H5Dopen(file_id, "/g17/d")) < 0) FAIL_STACK_ERROR + if((dataset_id = H5Dopen2(file_id, "/g17/d", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create link to dataset named "link" */ if(H5Lcreate_hard(dataset_id, ".", file_id, "/g17/link", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if((dataset2_id = H5Dopen(file_id, "/g17/link")) < 0) FAIL_STACK_ERROR + if((dataset2_id = H5Dopen2(file_id, "/g17/link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Make sure that the two IDs use two different names */ if(check_name(dataset_id, "/g17/d", "/g17/d") < 0) TEST_ERROR @@ -1280,7 +1280,7 @@ test_main(hid_t file_id, hid_t fapl) /* Open the mounted group, dataset, and datatype through their new names */ if((group6_id = H5Gopen2(file1_id, "/g3/g4/g18/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((dataset2_id = H5Dopen(file1_id, "/g3/g4/g18/d2")) < 0) FAIL_STACK_ERROR + if((dataset2_id = H5Dopen2(file1_id, "/g3/g4/g18/d2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((type2_id = H5Topen2(file1_id, "/g3/g4/g18/t2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify names */ @@ -2727,7 +2727,7 @@ test_reg_ref(hid_t fapl) TEST_ERROR /* Reopen the dataset with object references and read references to the buffer */ - if((dsetr_id = H5Dopen(file_id, REFREG_DSETNAMER)) , 0) + if((dsetr_id = H5Dopen2(file_id, REFREG_DSETNAMER, H5P_DEFAULT)) < 0) TEST_ERROR if((status = H5Dread(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_out)) < 0) diff --git a/test/links.c b/test/links.c index 1e9e8d4..487bcee 100644 --- a/test/links.c +++ b/test/links.c @@ -785,7 +785,7 @@ test_h5l_create(hid_t fapl, hbool_t new_format) if(H5Gclose(group_id) < 0) TEST_ERROR /* Open dataset through root group and verify its data */ - if((dset_id = H5Dopen(file_id, "/group/inter_group/dataset")) < 0) TEST_ERROR + if((dset_id = H5Dopen2(file_id, "/group/inter_group/dataset", H5P_DEFAULT)) < 0) TEST_ERROR /* Read data from dataset */ if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0) TEST_ERROR @@ -3451,7 +3451,7 @@ external_link_closing(hid_t fapl, hbool_t new_format) /* Test H5*open */ if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((did = H5Dopen(fid1, "elink/elink/elink/dataset1_moved")) < 0) FAIL_STACK_ERROR + if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close objects */ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR if(H5Tclose(tid) < 0) FAIL_STACK_ERROR diff --git a/test/mount.c b/test/mount.c index 0009503..6330504 100644 --- a/test/mount.c +++ b/test/mount.c @@ -1197,7 +1197,7 @@ test_mount_after_close(hid_t fapl) if(H5Gclose(gidABT) < 0) FAIL_STACK_ERROR /* Open "normal" dataset in mounted file */ - if((didABMXYD = H5Dopen(gidAB, "M/X/Y/D")) < 0) FAIL_STACK_ERROR + if((didABMXYD = H5Dopen2(gidAB, "M/X/Y/D", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if(H5Iget_name(didABMXYD, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR diff --git a/test/mtime.c b/test/mtime.c index d49dd5a..d6eed1f 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -92,7 +92,7 @@ main(void) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR; if(H5Oget_info(file, "dset", &oi1, H5P_DEFAULT) < 0) TEST_ERROR; - if((dset = H5Dopen(file, "dset")) < 0) TEST_ERROR; + if((dset = H5Dopen2(file, "dset", H5P_DEFAULT)) < 0) TEST_ERROR; if(H5Oget_info(dset, ".", &oi2, H5P_DEFAULT) < 0) TEST_ERROR; if(H5Dclose(dset) < 0) TEST_ERROR; if(H5Fclose(file) < 0) TEST_ERROR; diff --git a/test/ntypes.c b/test/ntypes.c index dc1538b..2535ce1 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -89,39 +89,37 @@ test_atomic_dtype(hid_t file) TESTING("atomic datatype"); envval = HDgetenv("HDF5_DRIVER"); - if (envval == NULL) + if(envval == NULL) envval = "nomatch"; - if (HDstrcmp(envval, "split") && HDstrcmp(envval, "multi")) { + if(HDstrcmp(envval, "split") && HDstrcmp(envval, "multi")) { /* Initialize the dataset */ - for (i = n = 0; i < DIM0; i++) { - for (j = 0; j < DIM1; j++) { + for(i = n = 0; i < DIM0; i++) + for(j = 0; j < DIM1; j++) ipoints2[i][j] = n++; - } - } /* Create the data space */ dims[0] = DIM0; dims[1] = DIM1; - if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; + if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; /*------------------- Test data values ------------------------*/ /* Create the dataset */ - if ((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_1, H5T_STD_I32BE, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_1, H5T_STD_I32BE, space, + H5P_DEFAULT)) < 0) TEST_ERROR; /* Write the data to the dataset */ - if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2)<0) + if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2) < 0) TEST_ERROR; /* Close dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Open dataset again to check H5Tget_native_type */ - if((dataset=H5Dopen(file, DSET_ATOMIC_NAME_1))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_ATOMIC_NAME_1, H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Verify the datatype retrieved and converted */ @@ -129,28 +127,28 @@ test_atomic_dtype(hid_t file) TEST_ERROR; if(H5Tget_size(native_type) < H5Tget_size(H5T_STD_I32BE)) TEST_ERROR; - if(H5T_INTEGER!=H5Tget_class(native_type)) + if(H5T_INTEGER != H5Tget_class(native_type)) TEST_ERROR; /* Read the dataset back. The temporary buffer is for special platforms * like Cray. */ - tmp = malloc((size_t)(DIM0*DIM1*H5Tget_size(native_type))); + tmp = malloc((size_t)(DIM0 * DIM1 * H5Tget_size(native_type))); - if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; /* Copy data from temporary buffer to destination buffer */ - memcpy(icheck2, tmp, (size_t)(DIM0*DIM1*H5Tget_size(native_type))); + memcpy(icheck2, tmp, (size_t)(DIM0 * DIM1 * H5Tget_size(native_type))); free(tmp); /* Convert to the integer type */ - if(H5Tconvert(native_type, H5T_NATIVE_INT, (DIM0*DIM1), icheck2, NULL, H5P_DEFAULT)<0) + if(H5Tconvert(native_type, H5T_NATIVE_INT, (DIM0*DIM1), icheck2, NULL, H5P_DEFAULT) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ for (i = 0; i < DIM0; i++) { for (j = 0; j < DIM1; j++) { - if (ipoints2[i][j] != icheck2[i][j]) { + if(ipoints2[i][j] != icheck2[i][j]) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %d,%d\n", i, j); @@ -159,19 +157,19 @@ test_atomic_dtype(hid_t file) } } - if(H5Dclose(dataset)<0) TEST_ERROR; - if(H5Tclose(native_type)<0) TEST_ERROR; - if(H5Tclose(dtype)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; + if(H5Tclose(dtype) < 0) TEST_ERROR; /*------------------ Test different data types ----------------*/ /* Create the dataset of H5T_STD_I64LE */ - if ((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_2, H5T_STD_I64LE, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_2, H5T_STD_I64LE, space, + H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype=H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Verify the datatype retrieved and converted */ @@ -182,18 +180,18 @@ test_atomic_dtype(hid_t file) if(H5T_INTEGER!=H5Tget_class(native_type)) TEST_ERROR; - if(H5Dclose(dataset)<0) TEST_ERROR; - if(H5Tclose(native_type)<0) TEST_ERROR; - if(H5Tclose(dtype)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; + if(H5Tclose(dtype) < 0) TEST_ERROR; /* Create the dataset of H5T_STD_I8LE */ - if ((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_3, H5T_STD_I8LE, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_3, H5T_STD_I8LE, space, + H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype=H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_ASCEND))<0) + if((native_type=H5Tget_native_type(dtype, H5T_DIR_ASCEND)) < 0) TEST_ERROR; /* Verify the datatype retrieved and converted */ @@ -204,18 +202,18 @@ test_atomic_dtype(hid_t file) if(H5T_INTEGER!=H5Tget_class(native_type)) TEST_ERROR; - if(H5Dclose(dataset)<0) TEST_ERROR; - if(H5Tclose(native_type)<0) TEST_ERROR; - if(H5Tclose(dtype)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; + if(H5Tclose(dtype) < 0) TEST_ERROR; /* Create the dataset of H5T_IEEE_F32BE */ - if ((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_4, H5T_IEEE_F32BE, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_4, H5T_IEEE_F32BE, space, + H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype=H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DESCEND))<0) + if((native_type=H5Tget_native_type(dtype, H5T_DIR_DESCEND)) < 0) TEST_ERROR; /* Verify the datatype retrieved and converted */ @@ -226,18 +224,18 @@ test_atomic_dtype(hid_t file) if(H5T_FLOAT!=H5Tget_class(native_type)) TEST_ERROR; - if(H5Dclose(dataset)<0) TEST_ERROR; - if(H5Tclose(native_type)<0) TEST_ERROR; - if(H5Tclose(dtype)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; + if(H5Tclose(dtype) < 0) TEST_ERROR; /* Create the dataset of H5T_IEEE_F64BE */ - if ((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_5, H5T_IEEE_F64BE, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_ATOMIC_NAME_5, H5T_IEEE_F64BE, space, + H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype=H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DESCEND))<0) + if((native_type=H5Tget_native_type(dtype, H5T_DIR_DESCEND)) < 0) TEST_ERROR; /* Verify the datatype retrieved and converted */ @@ -248,13 +246,13 @@ test_atomic_dtype(hid_t file) if(H5T_FLOAT!=H5Tget_class(native_type)) TEST_ERROR; - if(H5Dclose(dataset)<0) TEST_ERROR; - if(H5Tclose(native_type)<0) TEST_ERROR; - if(H5Tclose(dtype)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; + if(H5Tclose(dtype) < 0) TEST_ERROR; /* Close dataspace */ - if(H5Sclose(space)<0) TEST_ERROR; + if(H5Sclose(space) < 0) TEST_ERROR; PASSED(); } @@ -330,89 +328,89 @@ test_compound_dtype2(hid_t file) /* Create the data space */ dims[0] = DIM0; dims[1] = DIM1; - if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; + if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; /* Create compound datatype for disk storage */ #if H5_SIZEOF_LONG==4 - if((tid2=H5Tcreate(H5T_COMPOUND, 6))<0) TEST_ERROR; - if((tid=H5Tcreate(H5T_COMPOUND, 19))<0) TEST_ERROR; + if((tid2=H5Tcreate(H5T_COMPOUND, 6)) < 0) TEST_ERROR; + if((tid=H5Tcreate(H5T_COMPOUND, 19)) < 0) TEST_ERROR; #elif H5_SIZEOF_LONG==8 - if((tid2=H5Tcreate(H5T_COMPOUND, 10))<0) TEST_ERROR; - if((tid=H5Tcreate(H5T_COMPOUND, 23))<0) TEST_ERROR; + if((tid2=H5Tcreate(H5T_COMPOUND, 10)) < 0) TEST_ERROR; + if((tid=H5Tcreate(H5T_COMPOUND, 23)) < 0) TEST_ERROR; #else #error "Unknown 'long' size" #endif /* Insert and pack members */ - if(H5Tinsert(tid2, "c2", 0, H5T_STD_I16BE)<0) TEST_ERROR; + if(H5Tinsert(tid2, "c2", 0, H5T_STD_I16BE) < 0) TEST_ERROR; #if H5_SIZEOF_LONG==4 - if(H5Tinsert(tid2, "l2", 2, H5T_STD_I32LE)<0) TEST_ERROR; + if(H5Tinsert(tid2, "l2", 2, H5T_STD_I32LE) < 0) TEST_ERROR; #elif H5_SIZEOF_LONG==8 - if(H5Tinsert(tid2, "l2", 2, H5T_STD_I64LE)<0) TEST_ERROR; + if(H5Tinsert(tid2, "l2", 2, H5T_STD_I64LE) < 0) TEST_ERROR; #else #error "Unknown 'long' size" #endif - if(H5Tinsert(tid, "c", 0, H5T_STD_U8LE)<0) TEST_ERROR; - if(H5Tinsert(tid, "i", 1, H5T_STD_I32LE)<0) TEST_ERROR; - if(H5Tinsert(tid, "st", 5, tid2)<0) TEST_ERROR; + if(H5Tinsert(tid, "c", 0, H5T_STD_U8LE) < 0) TEST_ERROR; + if(H5Tinsert(tid, "i", 1, H5T_STD_I32LE) < 0) TEST_ERROR; + if(H5Tinsert(tid, "st", 5, tid2) < 0) TEST_ERROR; #if H5_SIZEOF_LONG==4 - if(H5Tinsert(tid, "l", 11, H5T_STD_U64BE)<0) TEST_ERROR; + if(H5Tinsert(tid, "l", 11, H5T_STD_U64BE) < 0) TEST_ERROR; #elif H5_SIZEOF_LONG==8 - if(H5Tinsert(tid, "l", 15, H5T_STD_U64BE)<0) TEST_ERROR; + if(H5Tinsert(tid, "l", 15, H5T_STD_U64BE) < 0) TEST_ERROR; #else #error "Unknown 'long' size" #endif /* Create the dataset */ - if ((dataset = H5Dcreate(file, DSET_COMPOUND_NAME_2, tid, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_COMPOUND_NAME_2, tid, space, + H5P_DEFAULT)) < 0) TEST_ERROR; /* Create compound datatype for memory */ - if((tid_m2=H5Tcreate(H5T_COMPOUND, sizeof(s2)))<0) TEST_ERROR; - if((tid_m=H5Tcreate(H5T_COMPOUND, sizeof(s1)))<0) TEST_ERROR; + if((tid_m2=H5Tcreate(H5T_COMPOUND, sizeof(s2))) < 0) TEST_ERROR; + if((tid_m=H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR; /* Insert members */ - if(H5Tinsert(tid_m2, "c2", HOFFSET(s2, c2), H5T_NATIVE_SHORT)<0) TEST_ERROR; - if(H5Tinsert(tid_m2, "l2", HOFFSET(s2, l2), H5T_NATIVE_LONG)<0) TEST_ERROR; - if(H5Tinsert(tid_m, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR)<0) TEST_ERROR; - if(H5Tinsert(tid_m, "i", HOFFSET(s1, i), H5T_NATIVE_INT)<0) TEST_ERROR; - if(H5Tinsert(tid_m, "st", HOFFSET(s1, st), tid_m2)<0) TEST_ERROR; - if(H5Tinsert(tid_m, "l", HOFFSET(s1, l), H5T_NATIVE_ULLONG)<0) TEST_ERROR; + if(H5Tinsert(tid_m2, "c2", HOFFSET(s2, c2), H5T_NATIVE_SHORT) < 0) TEST_ERROR; + if(H5Tinsert(tid_m2, "l2", HOFFSET(s2, l2), H5T_NATIVE_LONG) < 0) TEST_ERROR; + if(H5Tinsert(tid_m, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR) < 0) TEST_ERROR; + if(H5Tinsert(tid_m, "i", HOFFSET(s1, i), H5T_NATIVE_INT) < 0) TEST_ERROR; + if(H5Tinsert(tid_m, "st", HOFFSET(s1, st), tid_m2) < 0) TEST_ERROR; + if(H5Tinsert(tid_m, "l", HOFFSET(s1, l), H5T_NATIVE_ULLONG) < 0) TEST_ERROR; /* Write the data to the dataset */ - if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points)<0) + if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR; /* Close dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Close dataspace */ - if(H5Sclose(space)<0) TEST_ERROR; + if(H5Sclose(space) < 0) TEST_ERROR; /* Open dataset again to check H5Tget_native_type */ - if((dataset=H5Dopen(file, DSET_COMPOUND_NAME_2))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_COMPOUND_NAME_2, H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Verify the datatype of each field retrieved and converted */ /* check the char member */ - if((mem_id = H5Tget_member_type(native_type, 0))<0) + if((mem_id = H5Tget_member_type(native_type, 0)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_UCHAR)) TEST_ERROR; if(H5Tget_size(mem_id) < H5Tget_size(H5T_STD_U8LE)) TEST_ERROR; - if(H5T_INTEGER!=H5Tget_class(mem_id)) + if(H5T_INTEGER != H5Tget_class(mem_id)) TEST_ERROR; H5Tclose(mem_id); /* check the integer member */ - if((mem_id = H5Tget_member_type(native_type, 1))<0) + if((mem_id = H5Tget_member_type(native_type, 1)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_INT)) TEST_ERROR; @@ -423,7 +421,7 @@ test_compound_dtype2(hid_t file) H5Tclose(mem_id); /* check the long long member */ - if((mem_id = H5Tget_member_type(native_type, 3))<0) + if((mem_id = H5Tget_member_type(native_type, 3)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_ULLONG)) TEST_ERROR; @@ -434,10 +432,10 @@ test_compound_dtype2(hid_t file) H5Tclose(mem_id); /* check the nested compound member */ - if((nest_mem_id = H5Tget_member_type(native_type, 2))<0) + if((nest_mem_id = H5Tget_member_type(native_type, 2)) < 0) TEST_ERROR; - if((mem_id = H5Tget_member_type(nest_mem_id, 0))<0) + if((mem_id = H5Tget_member_type(nest_mem_id, 0)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_SHORT)) TEST_ERROR; @@ -447,7 +445,7 @@ test_compound_dtype2(hid_t file) TEST_ERROR; H5Tclose(mem_id); - if((mem_id = H5Tget_member_type(nest_mem_id, 1))<0) + if((mem_id = H5Tget_member_type(nest_mem_id, 1)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_LONG)) TEST_ERROR; @@ -468,13 +466,13 @@ test_compound_dtype2(hid_t file) if((bkg=calloc(sizeof(s1),DIM0*DIM1))==NULL) TEST_ERROR; - if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; memcpy(check, tmp, DIM0*DIM1*H5Tget_size(native_type)); free(tmp); - if (H5Tconvert(native_type, tid_m, (DIM0*DIM1), check, bkg, H5P_DEFAULT)) + if(H5Tconvert(native_type, tid_m, (DIM0*DIM1), check, bkg, H5P_DEFAULT)) TEST_ERROR; free(bkg); @@ -482,7 +480,7 @@ test_compound_dtype2(hid_t file) /* Check that the values read are the same as the values written */ for (i = 0, temp_point=points, temp_check=check; i < DIM0; i++) { for (j = 0; j < DIM1; j++, temp_point++,temp_check++) { - if (temp_point->c != temp_check->c || + if(temp_point->c != temp_check->c || temp_point->i != temp_check->i || temp_point->st.c2 != temp_check->st.c2 || temp_point->st.l2 != temp_check->st.l2 || @@ -496,9 +494,9 @@ test_compound_dtype2(hid_t file) } /* Close temporary datatypes */ - if(H5Tclose(tid2)<0) TEST_ERROR; - if(H5Tclose(tid)<0) TEST_ERROR; - if(H5Tclose(tid_m2)<0) TEST_ERROR; + if(H5Tclose(tid2) < 0) TEST_ERROR; + if(H5Tclose(tid) < 0) TEST_ERROR; + if(H5Tclose(tid_m2) < 0) TEST_ERROR; /* Close HDF5 objects */ H5Dclose(dataset); @@ -575,47 +573,47 @@ test_compound_dtype(hid_t file) /* Create the data space */ dims[0] = DIM0; dims[1] = DIM1; - if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; + if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; /* Create compound datatype for disk storage */ - if((tid=H5Tcreate(H5T_COMPOUND, sizeof(s1)))<0) TEST_ERROR; + if((tid=H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR; /* Insert members */ - if(H5Tinsert(tid, "c", 0, H5T_STD_U8LE)<0) TEST_ERROR; - if(H5Tinsert(tid, "i", 1, H5T_STD_U32LE)<0) TEST_ERROR; - if(H5Tinsert(tid, "l", 5, H5T_STD_I64BE)<0) TEST_ERROR; + if(H5Tinsert(tid, "c", 0, H5T_STD_U8LE) < 0) TEST_ERROR; + if(H5Tinsert(tid, "i", 1, H5T_STD_U32LE) < 0) TEST_ERROR; + if(H5Tinsert(tid, "l", 5, H5T_STD_I64BE) < 0) TEST_ERROR; /* Create the dataset */ - if ((dataset = H5Dcreate(file, DSET_COMPOUND_NAME, tid, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_COMPOUND_NAME, tid, space, + H5P_DEFAULT)) < 0) TEST_ERROR; /* Create compound datatype for datatype in memory */ - if((tid2=H5Tcreate(H5T_COMPOUND, sizeof(s1)))<0) TEST_ERROR; - if(H5Tinsert(tid2, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR)<0) TEST_ERROR; - if(H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_UINT)<0) TEST_ERROR; - if(H5Tinsert(tid2, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG)<0) TEST_ERROR; + if((tid2=H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR; + if(H5Tinsert(tid2, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR) < 0) TEST_ERROR; + if(H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_UINT) < 0) TEST_ERROR; + if(H5Tinsert(tid2, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG) < 0) TEST_ERROR; /* Write the data to the dataset */ - if (H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, points)<0) + if(H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR; /* Close dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Close dataspace */ - if(H5Sclose(space)<0) TEST_ERROR; + if(H5Sclose(space) < 0) TEST_ERROR; /* Open dataset again to check H5Tget_native_type */ - if((dataset=H5Dopen(file, DSET_COMPOUND_NAME))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_COMPOUND_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Verify the datatype of each field retrieved and converted */ - if((mem_id = H5Tget_member_type(native_type, 0))<0) + if((mem_id = H5Tget_member_type(native_type, 0)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_UCHAR)) TEST_ERROR; @@ -625,7 +623,7 @@ test_compound_dtype(hid_t file) TEST_ERROR; H5Tclose(mem_id); - if((mem_id = H5Tget_member_type(native_type, 1))<0) + if((mem_id = H5Tget_member_type(native_type, 1)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_UINT)) TEST_ERROR; @@ -635,7 +633,7 @@ test_compound_dtype(hid_t file) TEST_ERROR; H5Tclose(mem_id); - if((mem_id = H5Tget_member_type(native_type, 2))<0) + if((mem_id = H5Tget_member_type(native_type, 2)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_LLONG)) TEST_ERROR; @@ -650,13 +648,13 @@ test_compound_dtype(hid_t file) tmp = malloc(DIM0*DIM1*H5Tget_size(native_type)); bkg = calloc(sizeof(s1),DIM0*DIM1); - if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; memcpy(check, tmp, DIM0*DIM1*H5Tget_size(native_type)); free(tmp); - if (H5Tconvert(native_type, tid2, (DIM0*DIM1), check, bkg, H5P_DEFAULT)<0) + if(H5Tconvert(native_type, tid2, (DIM0*DIM1), check, bkg, H5P_DEFAULT) < 0) TEST_ERROR; free(bkg); @@ -664,7 +662,7 @@ test_compound_dtype(hid_t file) /* Check that the values read are the same as the values written */ for (i = 0, temp_point=points, temp_check=check; i < DIM0; i++) { for (j = 0; j < DIM1; j++, temp_point++,temp_check++) { - if (temp_point->c != temp_check->c || + if(temp_point->c != temp_check->c || temp_point->i != temp_check->i || temp_point->l != temp_check->l ) { H5_FAILED(); @@ -676,7 +674,7 @@ test_compound_dtype(hid_t file) } /* Close datatype */ - if(H5Tclose(tid)<0) TEST_ERROR; + if(H5Tclose(tid) < 0) TEST_ERROR; H5Dclose(dataset); H5Tclose(dtype); @@ -750,58 +748,58 @@ test_compound_dtype3(hid_t file) /* Create the data space */ dims[0] = DIM0; dims[1] = DIM1; - if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; + if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; /* Create array datatype */ if((tid2 = H5Tarray_create(H5T_STD_I32LE, 1, array_dims, NULL)) < 0) TEST_ERROR; /* Create compound datatype for disk storage */ - if((tid=H5Tcreate(H5T_COMPOUND, 29))<0) TEST_ERROR; + if((tid=H5Tcreate(H5T_COMPOUND, 29)) < 0) TEST_ERROR; /* Insert members */ - if(H5Tinsert(tid, "c", 0, H5T_STD_U8LE)<0) TEST_ERROR; - if(H5Tinsert(tid, "a", 1, tid2)<0) TEST_ERROR; - if(H5Tinsert(tid, "l", 21, H5T_STD_I64BE)<0) TEST_ERROR; + if(H5Tinsert(tid, "c", 0, H5T_STD_U8LE) < 0) TEST_ERROR; + if(H5Tinsert(tid, "a", 1, tid2) < 0) TEST_ERROR; + if(H5Tinsert(tid, "l", 21, H5T_STD_I64BE) < 0) TEST_ERROR; /* Create the dataset */ - if ((dataset = H5Dcreate(file, DSET_COMPOUND_NAME_3, tid, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_COMPOUND_NAME_3, tid, space, + H5P_DEFAULT)) < 0) TEST_ERROR; /* Create array datatype */ if((tid_m2 = H5Tarray_create(H5T_NATIVE_INT, 1, array_dims, NULL)) < 0) TEST_ERROR; /* Create compound datatype for datatype in memory */ - if((tid_m=H5Tcreate(H5T_COMPOUND, sizeof(s1)))<0) TEST_ERROR; - if(H5Tinsert(tid_m, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR)<0) TEST_ERROR; - if(H5Tinsert(tid_m, "a", HOFFSET(s1, a), tid_m2)<0) TEST_ERROR; - if(H5Tinsert(tid_m, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG)<0) TEST_ERROR; + if((tid_m=H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR; + if(H5Tinsert(tid_m, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR) < 0) TEST_ERROR; + if(H5Tinsert(tid_m, "a", HOFFSET(s1, a), tid_m2) < 0) TEST_ERROR; + if(H5Tinsert(tid_m, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG) < 0) TEST_ERROR; /* Write the data to the dataset */ - if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points)<0) + if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR; /* Close dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Close datatype */ - if(H5Tclose(tid)<0) TEST_ERROR; - if(H5Tclose(tid2)<0) TEST_ERROR; + if(H5Tclose(tid) < 0) TEST_ERROR; + if(H5Tclose(tid2) < 0) TEST_ERROR; /* Close dataspace */ - if(H5Sclose(space)<0) TEST_ERROR; + if(H5Sclose(space) < 0) TEST_ERROR; /* Open dataset again to check H5Tget_native_type */ - if((dataset=H5Dopen(file, DSET_COMPOUND_NAME_3))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_COMPOUND_NAME_3, H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Verify the datatype of each field retrieved and converted */ /* check the char member */ - if((mem_id = H5Tget_member_type(native_type, 0))<0) + if((mem_id = H5Tget_member_type(native_type, 0)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_UCHAR)) TEST_ERROR; @@ -812,11 +810,11 @@ test_compound_dtype3(hid_t file) H5Tclose(mem_id); /* check the array member */ - if((mem_id = H5Tget_member_type(native_type, 1))<0) + if((mem_id = H5Tget_member_type(native_type, 1)) < 0) TEST_ERROR; if(H5T_ARRAY!=H5Tget_class(mem_id)) TEST_ERROR; - if((nest_mem_id = H5Tget_super(mem_id))<0) + if((nest_mem_id = H5Tget_super(mem_id)) < 0) TEST_ERROR; if(H5Tget_order(nest_mem_id) != H5Tget_order(H5T_NATIVE_INT)) TEST_ERROR; @@ -828,7 +826,7 @@ test_compound_dtype3(hid_t file) H5Tclose(mem_id); /* check the long long member */ - if((mem_id = H5Tget_member_type(native_type, 2))<0) + if((mem_id = H5Tget_member_type(native_type, 2)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_LLONG)) TEST_ERROR; @@ -844,13 +842,13 @@ test_compound_dtype3(hid_t file) if((bkg=calloc(sizeof(s1),DIM0*DIM1))==NULL) TEST_ERROR; - if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; memcpy(check, tmp, DIM0*DIM1*H5Tget_size(native_type)); free(tmp); - if (H5Tconvert(native_type, tid_m, (DIM0*DIM1), check, bkg, H5P_DEFAULT)) + if(H5Tconvert(native_type, tid_m, (DIM0*DIM1), check, bkg, H5P_DEFAULT)) TEST_ERROR; free(bkg); @@ -858,7 +856,7 @@ test_compound_dtype3(hid_t file) /* Check that the values read are the same as the values written */ for (i = 0, temp_point=points, temp_check=check; i < DIM0; i++) { for (j = 0; j < DIM1; j++, temp_point++,temp_check++) { - if (temp_point->c != temp_check->c || + if(temp_point->c != temp_check->c || temp_point->l != temp_check->l ) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -949,56 +947,56 @@ test_compound_opaque(hid_t file) /* Create the data space */ dims[0] = DIM0; dims[1] = DIM1; - if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; + if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; /* Create opaque datatype */ - if((tid2=H5Tcreate(H5T_OPAQUE, sizeof(temp_point->o)))<0) TEST_ERROR; - if(H5Tset_tag(tid2, "testing opaque field")<0) TEST_ERROR; + if((tid2=H5Tcreate(H5T_OPAQUE, sizeof(temp_point->o))) < 0) TEST_ERROR; + if(H5Tset_tag(tid2, "testing opaque field") < 0) TEST_ERROR; /* Create compound datatype for disk storage */ - if((tid=H5Tcreate(H5T_COMPOUND, 14))<0) TEST_ERROR; + if((tid=H5Tcreate(H5T_COMPOUND, 14)) < 0) TEST_ERROR; /* Insert members */ - if(H5Tinsert(tid, "c", 0, H5T_STD_U8LE)<0) TEST_ERROR; - if(H5Tinsert(tid, "o", 1, tid2)<0) TEST_ERROR; - if(H5Tinsert(tid, "l", 6, H5T_STD_I64BE)<0) TEST_ERROR; + if(H5Tinsert(tid, "c", 0, H5T_STD_U8LE) < 0) TEST_ERROR; + if(H5Tinsert(tid, "o", 1, tid2) < 0) TEST_ERROR; + if(H5Tinsert(tid, "l", 6, H5T_STD_I64BE) < 0) TEST_ERROR; /* Create the dataset */ - if ((dataset = H5Dcreate(file, DSET_COMPOUND_NAME_4, tid, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_COMPOUND_NAME_4, tid, space, + H5P_DEFAULT)) < 0) TEST_ERROR; /* Create compound datatype for datatype in memory */ - if((tid_m=H5Tcreate(H5T_COMPOUND, sizeof(s1)))<0) TEST_ERROR; - if(H5Tinsert(tid_m, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR)<0) TEST_ERROR; - if(H5Tinsert(tid_m, "o", HOFFSET(s1, o), tid2)<0) TEST_ERROR; - if(H5Tinsert(tid_m, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG)<0) TEST_ERROR; + if((tid_m=H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR; + if(H5Tinsert(tid_m, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR) < 0) TEST_ERROR; + if(H5Tinsert(tid_m, "o", HOFFSET(s1, o), tid2) < 0) TEST_ERROR; + if(H5Tinsert(tid_m, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG) < 0) TEST_ERROR; /* Write the data to the dataset */ - if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points)<0) + if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR; /* Close dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Close datatype */ - if(H5Tclose(tid)<0) TEST_ERROR; - if(H5Tclose(tid2)<0) TEST_ERROR; + if(H5Tclose(tid) < 0) TEST_ERROR; + if(H5Tclose(tid2) < 0) TEST_ERROR; /* Close dataspace */ - if(H5Sclose(space)<0) TEST_ERROR; + if(H5Sclose(space) < 0) TEST_ERROR; /* Open dataset again to check H5Tget_native_type */ - if((dataset=H5Dopen(file, DSET_COMPOUND_NAME_4))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_COMPOUND_NAME_4, H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Verify the datatype of each field retrieved and converted */ /* check the char member */ - if((mem_id = H5Tget_member_type(native_type, 0))<0) + if((mem_id = H5Tget_member_type(native_type, 0)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_UCHAR)) TEST_ERROR; @@ -1009,7 +1007,7 @@ test_compound_opaque(hid_t file) H5Tclose(mem_id); /* check the array member */ - if((mem_id = H5Tget_member_type(native_type, 1))<0) + if((mem_id = H5Tget_member_type(native_type, 1)) < 0) TEST_ERROR; if(H5T_OPAQUE!=H5Tget_class(mem_id)) TEST_ERROR; @@ -1018,7 +1016,7 @@ test_compound_opaque(hid_t file) H5Tclose(mem_id); /* check the long long member */ - if((mem_id = H5Tget_member_type(native_type, 2))<0) + if((mem_id = H5Tget_member_type(native_type, 2)) < 0) TEST_ERROR; if(H5Tget_order(mem_id) != H5Tget_order(H5T_NATIVE_LLONG)) TEST_ERROR; @@ -1034,13 +1032,13 @@ test_compound_opaque(hid_t file) if((bkg=HDcalloc(sizeof(s1),DIM0*DIM1))==NULL) TEST_ERROR; - if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; HDmemcpy(check, tmp, DIM0*DIM1*H5Tget_size(native_type)); HDfree(tmp); - if (H5Tconvert(native_type, tid_m, (DIM0*DIM1), check, bkg, H5P_DEFAULT)) + if(H5Tconvert(native_type, tid_m, (DIM0*DIM1), check, bkg, H5P_DEFAULT)) TEST_ERROR; HDfree(bkg); @@ -1048,7 +1046,7 @@ test_compound_opaque(hid_t file) /* Check that the values read are the same as the values written */ for (i = 0, temp_point=points, temp_check=check; i < DIM0; i++) { for (j = 0; j < DIM1; j++, temp_point++,temp_check++) { - if (temp_point->c != temp_check->c || + if(temp_point->c != temp_check->c || temp_point->l != temp_check->l ) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -1130,67 +1128,67 @@ test_enum_dtype(hid_t file) /* Create the data space */ dims[0] = DIM0; dims[1] = DIM1; - if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; + if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; /* Construct enum type based on native type */ - if((tid=H5Tenum_create(H5T_STD_I16LE))<0) TEST_ERROR; + if((tid=H5Tenum_create(H5T_STD_I16LE)) < 0) TEST_ERROR; for (i = 0; i < 8; i++) { sub_colors[i*2]=i; sub_colors[i*2+1]=0; - if(H5Tenum_insert(tid, mname[i], &(sub_colors[i*2]))<0) TEST_ERROR; + if(H5Tenum_insert(tid, mname[i], &(sub_colors[i*2])) < 0) TEST_ERROR; } /* Create the dataset */ - if ((dataset = H5Dcreate(file, DSET_ENUM_NAME, tid, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_ENUM_NAME, tid, space, + H5P_DEFAULT)) < 0) TEST_ERROR; /* Construct enum type based on native type in memory */ - if((tid_m=H5Tenum_create(H5T_NATIVE_SHORT))<0) TEST_ERROR; + if((tid_m = H5Tenum_create(H5T_NATIVE_SHORT)) < 0) TEST_ERROR; - for (i = 0; i < 8; i++) { + for(i = 0; i < 8; i++) { colors[i] = i; - if(H5Tenum_insert(tid_m, mname[i], &(colors[i]))<0) TEST_ERROR; + if(H5Tenum_insert(tid_m, mname[i], &(colors[i])) < 0) TEST_ERROR; } /* Write the data to the dataset */ - if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, spoints2)<0) + if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, spoints2) < 0) TEST_ERROR; /* Close dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Close datatype */ - if(H5Tclose(tid)<0) TEST_ERROR; + if(H5Tclose(tid) < 0) TEST_ERROR; /* Close dataspace */ - if(H5Sclose(space)<0) TEST_ERROR; + if(H5Sclose(space) < 0) TEST_ERROR; /* Open dataset again to check H5Tget_native_type */ - if((dataset=H5Dopen(file, DSET_ENUM_NAME))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_ENUM_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Read the dataset back. Temporary buffer is for special platforms like * Cray */ - tmp = malloc(DIM0*DIM1*H5Tget_size(native_type)); + tmp = malloc(DIM0 * DIM1 * H5Tget_size(native_type)); - if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; - memcpy(scheck2, tmp, DIM0*DIM1*H5Tget_size(native_type)); + memcpy(scheck2, tmp, DIM0 * DIM1 * H5Tget_size(native_type)); free(tmp); - if (H5Tconvert(native_type, tid_m, (DIM0*DIM1), scheck2, NULL, H5P_DEFAULT)<0) + if(H5Tconvert(native_type, tid_m, (DIM0*DIM1), scheck2, NULL, H5P_DEFAULT) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ for (i = 0; i < DIM0; i++) { for (j = 0; j < DIM1; j++) { - if (spoints2[i][j] != scheck2[i][j]) { + if(spoints2[i][j] != scheck2[i][j]) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %d,%d\n", i, j); @@ -1265,72 +1263,72 @@ test_array_dtype(hid_t file) /* Create the data space */ space_dims[0] = DIM0; space_dims[1] = DIM1; - if ((space = H5Screate_simple(2, space_dims, NULL))<0) TEST_ERROR; + if((space = H5Screate_simple(2, space_dims, NULL)) < 0) TEST_ERROR; /* Create compound datatype for disk storage */ - if((tid2=H5Tcreate(H5T_COMPOUND, 13))<0) TEST_ERROR; + if((tid2=H5Tcreate(H5T_COMPOUND, 13)) < 0) TEST_ERROR; /* Insert members */ - if(H5Tinsert(tid2, "c", 0, H5T_STD_U8BE)<0) TEST_ERROR; - if(H5Tinsert(tid2, "i", 1, H5T_STD_U32LE)<0) TEST_ERROR; - if(H5Tinsert(tid2, "l", 5, H5T_STD_I64BE)<0) TEST_ERROR; + if(H5Tinsert(tid2, "c", 0, H5T_STD_U8BE) < 0) TEST_ERROR; + if(H5Tinsert(tid2, "i", 1, H5T_STD_U32LE) < 0) TEST_ERROR; + if(H5Tinsert(tid2, "l", 5, H5T_STD_I64BE) < 0) TEST_ERROR; /* Create array datatype for disk storage */ if((tid = H5Tarray_create(tid2, 1, array_dims, NULL)) < 0) TEST_ERROR; /* Create the dataset */ - if ((dataset = H5Dcreate(file, DSET_ARRAY_NAME, tid, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_ARRAY_NAME, tid, space, + H5P_DEFAULT)) < 0) TEST_ERROR; /* Create compound datatype for datatype in memory */ - if((tid3=H5Tcreate(H5T_COMPOUND, sizeof(s1)))<0) TEST_ERROR; - if(H5Tinsert(tid3, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR)<0) TEST_ERROR; - if(H5Tinsert(tid3, "i", HOFFSET(s1, i), H5T_NATIVE_UINT)<0) TEST_ERROR; - if(H5Tinsert(tid3, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG)<0) TEST_ERROR; + if((tid3=H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR; + if(H5Tinsert(tid3, "c", HOFFSET(s1, c), H5T_NATIVE_UCHAR) < 0) TEST_ERROR; + if(H5Tinsert(tid3, "i", HOFFSET(s1, i), H5T_NATIVE_UINT) < 0) TEST_ERROR; + if(H5Tinsert(tid3, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG) < 0) TEST_ERROR; /* Create array datatype for memory */ if((tid_m = H5Tarray_create(tid3, 1, array_dims, NULL)) < 0) TEST_ERROR; /* Write the data to the dataset */ - if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points)<0) + if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR; /* Close dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Close datatype */ - if(H5Tclose(tid)<0) TEST_ERROR; - if(H5Tclose(tid2)<0) TEST_ERROR; + if(H5Tclose(tid) < 0) TEST_ERROR; + if(H5Tclose(tid2) < 0) TEST_ERROR; /* Close dataspace */ - if(H5Sclose(space)<0) TEST_ERROR; + if(H5Sclose(space) < 0) TEST_ERROR; /* Open dataset again to check H5Tget_native_type */ - if((dataset=H5Dopen(file, DSET_ARRAY_NAME))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_ARRAY_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Read the dataset back. Temporary buffer is for special platforms like * Cray */ - tmp = malloc(DIM0*DIM1*H5Tget_size(native_type)); + tmp = malloc(DIM0 * DIM1 * H5Tget_size(native_type)); - if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; - memcpy(check, tmp, DIM0*DIM1*H5Tget_size(native_type)); + memcpy(check, tmp, DIM0 * DIM1 * H5Tget_size(native_type)); free(tmp); - if (H5Tconvert(native_type, tid_m, (DIM0*DIM1), check, NULL, H5P_DEFAULT)<0) + if(H5Tconvert(native_type, tid_m, (DIM0*DIM1), check, NULL, H5P_DEFAULT) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ for (i = 0, temp_point=points, temp_check=check; i < DIM0; i++) { for (j = 0; j < DIM1; j++) { for (k = 0; k < 5; k++, temp_point++,temp_check++) { - if (temp_point->c != temp_check->c || + if(temp_point->c != temp_check->c || temp_point->i != temp_check->i || temp_point->l != temp_check->l ) { H5_FAILED(); @@ -1346,8 +1344,8 @@ test_array_dtype(hid_t file) if(H5Dclose(dataset)) TEST_ERROR; if(H5Tclose(native_type)) TEST_ERROR; if(H5Tclose(dtype)) TEST_ERROR; - if(H5Tclose(tid_m)<0) TEST_ERROR; - if(H5Tclose(tid3)<0) TEST_ERROR; + if(H5Tclose(tid_m) < 0) TEST_ERROR; + if(H5Tclose(tid3) < 0) TEST_ERROR; /* Free memory for test data */ free(points); @@ -1401,51 +1399,51 @@ test_array_dtype2(hid_t file) /* Create the data space */ space_dims[0] = DIM0; space_dims[1] = DIM1; - if ((space = H5Screate_simple(2, space_dims, NULL))<0) TEST_ERROR; + if((space = H5Screate_simple(2, space_dims, NULL)) < 0) TEST_ERROR; /* Create array datatype for disk storage */ if((tid = H5Tarray_create(H5T_STD_I32LE, 1, array_dims, NULL)) < 0) TEST_ERROR; /* Create the dataset */ - if ((dataset = H5Dcreate(file, DSET_ARRAY2_NAME, tid, space, - H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file, DSET_ARRAY2_NAME, tid, space, + H5P_DEFAULT)) < 0) TEST_ERROR; /* Create array datatype for memory */ if((tid_m = H5Tarray_create(H5T_NATIVE_INT, 1, array_dims, NULL)) < 0) TEST_ERROR; /* Write the data to the dataset */ - if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints3)<0) + if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints3) < 0) TEST_ERROR; /* Close dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Close datatype */ - if(H5Tclose(tid)<0) TEST_ERROR; + if(H5Tclose(tid) < 0) TEST_ERROR; /* Close dataspace */ - if(H5Sclose(space)<0) TEST_ERROR; + if(H5Sclose(space) < 0) TEST_ERROR; /* Open dataset again to check H5Tget_native_type */ - if((dataset=H5Dopen(file, DSET_ARRAY2_NAME))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_ARRAY2_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; - if((dtype=H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Read the dataset back. Temporary buffer is for special platforms like * Cray */ - tmp = malloc(DIM0*DIM1*H5Tget_size(native_type)); + tmp = malloc(DIM0 * DIM1 * H5Tget_size(native_type)); - if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; - memcpy(icheck3, tmp, DIM0*DIM1*H5Tget_size(native_type)); + memcpy(icheck3, tmp, DIM0 * DIM1 * H5Tget_size(native_type)); free(tmp); - if (H5Tconvert(native_type, tid_m, (DIM0*DIM1), icheck3, NULL, H5P_DEFAULT)<0) + if(H5Tconvert(native_type, tid_m, (DIM0*DIM1), icheck3, NULL, H5P_DEFAULT) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ @@ -1466,7 +1464,7 @@ test_array_dtype2(hid_t file) if(H5Dclose(dataset)) TEST_ERROR; if(H5Tclose(native_type)) TEST_ERROR; if(H5Tclose(dtype)) TEST_ERROR; - if(H5Tclose(tid_m)<0) TEST_ERROR; + if(H5Tclose(tid_m) < 0) TEST_ERROR; PASSED(); return 0; @@ -1530,61 +1528,61 @@ test_vl_dtype(hid_t file) } /* end for */ /* Create dataspace for datasets */ - if((space = H5Screate_simple(SPACE1_RANK, dims1, NULL))<0) TEST_ERROR; + if((space = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0) TEST_ERROR; /* Create the base VL type */ - if((tid2 = H5Tvlen_create (H5T_STD_U32LE))<0) TEST_ERROR; + if((tid2 = H5Tvlen_create (H5T_STD_U32LE)) < 0) TEST_ERROR; /* Create a VL datatype for disk storage */ - tid = H5Tvlen_create (tid2); + if((tid = H5Tvlen_create(tid2)) < 0) TEST_ERROR /* Create a dataset */ - if((dataset=H5Dcreate(file, DSET_VL_NAME, tid, space, H5P_DEFAULT))<0) + if((dataset = H5Dcreate(file, DSET_VL_NAME, tid, space, H5P_DEFAULT)) < 0) TEST_ERROR; /* Create a base VL datatype for memory */ - if((tid_m2 = H5Tvlen_create (H5T_NATIVE_UINT))<0) TEST_ERROR; + if((tid_m2 = H5Tvlen_create(H5T_NATIVE_UINT)) < 0) TEST_ERROR; /* Create a VL datatype for memory */ - if((tid_m = H5Tvlen_create (tid_m2))<0) TEST_ERROR; + if((tid_m = H5Tvlen_create (tid_m2)) < 0) TEST_ERROR; /* Write dataset to disk */ - if(H5Dwrite(dataset,tid_m,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata)<0) TEST_ERROR; + if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata) < 0) TEST_ERROR; /* Close Dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Close datatype */ - if(H5Tclose(tid2)<0) TEST_ERROR; - if(H5Tclose(tid)<0) TEST_ERROR; + if(H5Tclose(tid2) < 0) TEST_ERROR; + if(H5Tclose(tid) < 0) TEST_ERROR; /* Open a dataset */ - if((dataset=H5Dopen(file, DSET_VL_NAME))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_VL_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* Get native datatype for dataset */ - if((dtype = H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Also get native base type for this nested VL type. Should be an integer type. */ - if((nat_super_type=H5Tget_super(native_type))<0) + if((nat_super_type = H5Tget_super(native_type)) < 0) TEST_ERROR; - if((nat_super_type=H5Tget_super(nat_super_type))<0) + if((nat_super_type = H5Tget_super(nat_super_type)) < 0) TEST_ERROR; /* Read dataset from disk */ - if(H5Dread(dataset,native_type,H5S_ALL,H5S_ALL,H5P_DEFAULT,rdata)<0) TEST_ERROR; + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0) TEST_ERROR; /* Compare data read in */ - for(i=0; ilen!=t2->len) { + for(t1 = wdata[i].p, t2 = rdata[i].p, j = 0; jlen != t2->len) { H5_FAILED(); printf(" VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); goto error; @@ -1595,7 +1593,7 @@ test_vl_dtype(hid_t file) tmp=malloc(t2->len*sizeof(unsigned int)); memcpy(tmp, t2->p, t2->len*H5Tget_size(nat_super_type)); - if (H5Tconvert(nat_super_type, H5T_NATIVE_UINT, t2->len, tmp, NULL, H5P_DEFAULT)) + if(H5Tconvert(nat_super_type, H5T_NATIVE_UINT, t2->len, tmp, NULL, H5P_DEFAULT)) TEST_ERROR; for(k=0; klen; k++) { @@ -1612,23 +1610,23 @@ test_vl_dtype(hid_t file) } /* end for */ /* Reclaim the read VL data */ - if(H5Dvlen_reclaim(native_type,space,H5P_DEFAULT,rdata)<0) TEST_ERROR; + if(H5Dvlen_reclaim(native_type,space,H5P_DEFAULT,rdata) < 0) TEST_ERROR; /* Reclaim the write VL data */ - if(H5Dvlen_reclaim(native_type,space,H5P_DEFAULT,wdata)<0) TEST_ERROR; + if(H5Dvlen_reclaim(native_type,space,H5P_DEFAULT,wdata) < 0) TEST_ERROR; /* Close Dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Close datatype */ - if(H5Tclose(native_type)<0) TEST_ERROR; - if(H5Tclose(dtype)<0) TEST_ERROR; - if(H5Tclose(tid_m)<0) TEST_ERROR; - if(H5Tclose(tid_m2)<0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; + if(H5Tclose(dtype) < 0) TEST_ERROR; + if(H5Tclose(tid_m) < 0) TEST_ERROR; + if(H5Tclose(tid_m2) < 0) TEST_ERROR; /* Close disk dataspace */ - if(H5Sclose(space)<0) TEST_ERROR; + if(H5Sclose(space) < 0) TEST_ERROR; PASSED(); return 0; @@ -1674,32 +1672,32 @@ test_vlstr_dtype(hid_t file) TESTING("variable length string datatype"); /* Create dataspace for datasets */ - if((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL))<0) TEST_ERROR; + if((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0) TEST_ERROR; /* Create a datatype to refer to */ - if((tid1 = H5Tcopy (H5T_C_S1))<0) TEST_ERROR; + if((tid1 = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR; - if(H5Tset_size (tid1,H5T_VARIABLE)<0) TEST_ERROR; - if(H5T_STRING!=H5Tget_class(tid1) || !H5Tis_variable_str(tid1)) + if(H5Tset_size(tid1,H5T_VARIABLE) < 0) TEST_ERROR; + if(H5T_STRING != H5Tget_class(tid1) || !H5Tis_variable_str(tid1)) TEST_ERROR; /* Create a dataset */ - if((dataset=H5Dcreate(file,DSET_VLSTR_NAME,tid1,sid1,H5P_DEFAULT))<0) TEST_ERROR; + if((dataset = H5Dcreate(file,DSET_VLSTR_NAME,tid1,sid1,H5P_DEFAULT)) < 0) TEST_ERROR; /* Write dataset to disk */ - if(H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata)<0) TEST_ERROR; + if(H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata) < 0) TEST_ERROR; /* Close Dataset */ - if(H5Dclose(dataset)<0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; /* Open a dataset */ - if((dataset=H5Dopen(file, DSET_VLSTR_NAME))<0) TEST_ERROR; + if((dataset = H5Dopen2(file, DSET_VLSTR_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* Get datatype for dataset */ - if((dtype = H5Dget_type(dataset))<0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; /* Construct native type */ - if((native_type=H5Tget_native_type(dtype, H5T_DIR_DEFAULT))<0) + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) TEST_ERROR; /* Check if the data type is equal */ @@ -1707,17 +1705,17 @@ test_vlstr_dtype(hid_t file) TEST_ERROR; /* Read dataset from disk */ - if(H5Dread(dataset,native_type,H5S_ALL,H5S_ALL,H5P_DEFAULT,rdata)<0) TEST_ERROR; + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0) TEST_ERROR; /* Compare data read in */ - for(i=0; i0) { + if(native_type > 0) { H5_FAILED(); puts(" Bit field isn't supported. Should have failed."); TEST_ERROR; - } + } /* end if */ - if (H5Tclose(type)<0) TEST_ERROR; - if (H5Tclose(dtype)<0) TEST_ERROR; - if (H5Dclose(dataset)<0) TEST_ERROR; + if(H5Tclose(type) < 0) TEST_ERROR; + if(H5Tclose(dtype) < 0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; PASSED(); return 0; @@ -2362,9 +2356,6 @@ error: return -1; } /* test_bitfield_dtype */ - - - /*------------------------------------------------------------------------- * Function: test_ninteger @@ -2414,27 +2405,27 @@ test_ninteger(void) *------------------------------------------------------------------------- */ /* create a file using default properties */ - if ((fid1=H5Fcreate("tstint1.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) + if((fid1=H5Fcreate("tstint1.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0) goto error; /* create a data space */ - if ((sid1 = H5Screate_simple(rank,dims,NULL))<0) goto error; + if((sid1 = H5Screate_simple(rank,dims,NULL)) < 0) goto error; /* create dcpl */ - if((dcpl1 = H5Pcreate(H5P_DATASET_CREATE))<0) goto error; + if((dcpl1 = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; /* create a dataset */ - if ((did1 = H5Dcreate(fid1,"dset",H5T_NATIVE_INT,sid1,dcpl1)) <0) goto error; + if((did1 = H5Dcreate(fid1, "dset", H5T_NATIVE_INT, sid1, dcpl1)) < 0) goto error; /* write */ - if(H5Dwrite(did1,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) + if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; /* close */ - if (H5Sclose (sid1)<0) goto error; - if (H5Pclose (dcpl1)<0) goto error; - if (H5Dclose (did1)<0) goto error; - if (H5Fclose (fid1)<0) goto error; + if(H5Sclose(sid1) < 0) goto error; + if(H5Pclose(dcpl1) < 0) goto error; + if(H5Dclose(did1) < 0) goto error; + if(H5Fclose(fid1) < 0) goto error; /*------------------------------------------------------------------------- * step 2: open and create another file copying the data from file1 @@ -2442,73 +2433,64 @@ test_ninteger(void) */ /* open */ - if ((fid1=H5Fopen("tstint1.h5",H5F_ACC_RDONLY,H5P_DEFAULT))<0) - goto error; + if((fid1 = H5Fopen("tstint1.h5", H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) goto error; /* open dataset */ - if ((did1=H5Dopen(fid1,"dset"))<0) - goto error; + if((did1 = H5Dopen2(fid1, "dset", H5P_DEFAULT)) < 0) goto error; - if ((sid1=H5Dget_space(did1))<0) - goto error; + if((sid1 = H5Dget_space(did1)) < 0) goto error; /* get dcpl */ - if ((dcpl1=H5Dget_create_plist(did1))<0) - goto error; + if((dcpl1 = H5Dget_create_plist(did1)) < 0) goto error; /* get file datatype */ - if ((tid1=H5Dget_type (did1))<0) - goto error; + if((tid1 = H5Dget_type(did1)) < 0) goto error; /* get native datatype */ - if ((nid1=H5Tget_native_type(tid1,H5T_DIR_DEFAULT))<0) - goto error; + if((nid1 = H5Tget_native_type(tid1, H5T_DIR_DEFAULT)) < 0) goto error; /* get size */ - if (H5Tget_size(nid1)==0) - goto error; + if(H5Tget_size(nid1) == 0) goto error; /* get rank */ - if ((rank=H5Sget_simple_extent_ndims(sid1))<0) - goto error; + if((rank = H5Sget_simple_extent_ndims(sid1)) < 0) goto error; HDmemset(dims, 0, sizeof dims); /* get dimension */ - if (H5Sget_simple_extent_dims(sid1,dims,NULL)<0) - goto error; - nelmts=1; - for (i=0; i= 0) { H5Dclose(dset); @@ -321,7 +321,7 @@ main(void) TEST_ERROR /* Open the dataset with the "mark if unknown" message */ - if((dset = H5Dopen(file, "/Dataset3")) < 0) + if((dset = H5Dopen2(file, "/Dataset3", H5P_DEFAULT)) < 0) TEST_ERROR /* Check that the "unknown" message was _NOT_ marked */ @@ -341,7 +341,7 @@ main(void) TEST_ERROR /* Open the dataset with the "mark if unknown" message */ - if((dset = H5Dopen(file, "/Dataset3")) < 0) + if((dset = H5Dopen2(file, "/Dataset3", H5P_DEFAULT)) < 0) TEST_ERROR if(H5Dclose(dset) < 0) TEST_ERROR @@ -355,7 +355,7 @@ main(void) TEST_ERROR /* Re-open the dataset with the "mark if unknown" message */ - if((dset = H5Dopen(file, "/Dataset3")) < 0) + if((dset = H5Dopen2(file, "/Dataset3", H5P_DEFAULT)) < 0) TEST_ERROR /* Check that the "unknown" message was marked */ diff --git a/test/reserved.c b/test/reserved.c index df30b5c..f719545 100755 --- a/test/reserved.c +++ b/test/reserved.c @@ -68,8 +68,7 @@ rsrv_heap(void) /* Write datasets until the file is full, at which point HDF5 * should throw an error. */ - for (i = 0; i < 200; i++) - { + for(i = 0; i < 200; i++) { H5E_BEGIN_TRY { dataspace_id = H5Screate_simple(1, dims, dims); } H5E_END_TRY @@ -87,9 +86,9 @@ rsrv_heap(void) H5Dwrite(dataset_id, H5T_NATIVE_INT, dataspace_id, dataspace_id, H5P_DEFAULT, &i); } H5E_END_TRY - if( H5Dclose(dataset_id) < 0) TEST_ERROR; - if( H5Sclose(dataspace_id) < 0) TEST_ERROR; - } + if(H5Dclose(dataset_id) < 0) TEST_ERROR; + if(H5Sclose(dataspace_id) < 0) TEST_ERROR; + } /* end for */ /* The loop should have broken before completing--the file should not have had * enough address space to hold 200 datasets (or this test needs to be updated!). @@ -98,20 +97,20 @@ rsrv_heap(void) TEST_ERROR; /* Close the file, property lists, and library */ - if( H5Fclose(file_id) < 0) TEST_ERROR; - if( H5Pclose(fapl) < 0) TEST_ERROR; - if( H5Pclose(fcpl) < 0) TEST_ERROR; - if( H5close() < 0) TEST_ERROR; + if(H5Fclose(file_id) < 0) TEST_ERROR; + if(H5Pclose(fapl) < 0) TEST_ERROR; + if(H5Pclose(fcpl) < 0) TEST_ERROR; + if(H5close() < 0) TEST_ERROR; /* Re-open the library and try to read a dataset from the file we created */ - if( H5open() < 0) TEST_ERROR; + if(H5open() < 0) TEST_ERROR; sprintf(dset_name, "Dset %d", i - 2); file_id = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); - if( file_id < 0) TEST_ERROR; + if(file_id < 0) TEST_ERROR; - dataset_id = H5Dopen(file_id, dset_name); + dataset_id = H5Dopen2(file_id, dset_name, H5P_DEFAULT); /* If we can read a dataset from the file, the file has been flushed to disk * (if the heap or object headers weren't flushed, the file would be empty). @@ -119,22 +118,22 @@ rsrv_heap(void) if(dataset_id == H5I_BADID) TEST_ERROR; - if( H5Dclose(dataset_id) < 0) TEST_ERROR; - if( H5Fclose(file_id) < 0) TEST_ERROR; + if(H5Dclose(dataset_id) < 0) TEST_ERROR; + if(H5Fclose(file_id) < 0) TEST_ERROR; PASSED(); return 0; - error: - /* Close everything we can and exit */ - H5E_BEGIN_TRY { +error: + /* Close everything we can and exit */ + H5E_BEGIN_TRY { H5Dclose(dataset_id); H5Sclose(dataspace_id); H5Pclose(fcpl); H5Pclose(fapl); H5Fclose(file_id); - } H5E_END_TRY - return 1; + } H5E_END_TRY + return 1; } /*------------------------------------------------------------------------- @@ -219,22 +218,22 @@ rsrv_ohdr(void) TEST_ERROR; /* End access to the dataset and dataspace and release resources. */ - if( H5Dclose(dataset_id) < 0) TEST_ERROR; - if( H5Pclose (fapl) < 0) TEST_ERROR; - if( H5Pclose (fcpl) < 0) TEST_ERROR; - if( H5Sclose(dataspace_id) < 0) TEST_ERROR; + if(H5Dclose(dataset_id) < 0) TEST_ERROR; + if(H5Pclose(fapl) < 0) TEST_ERROR; + if(H5Pclose(fcpl) < 0) TEST_ERROR; + if(H5Sclose(dataspace_id) < 0) TEST_ERROR; /* Close the file and the library. */ - if( H5Fclose(file_id) < 0) TEST_ERROR; - if( H5close() < 0) TEST_ERROR; + if(H5Fclose(file_id) < 0) TEST_ERROR; + if(H5close() < 0) TEST_ERROR; /* Re-open the library and try to read a dataset from the file we created */ - if( H5open() < 0) TEST_ERROR; + if(H5open() < 0) TEST_ERROR; file_id = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); - if( file_id < 0) TEST_ERROR; + if(file_id < 0) TEST_ERROR; - dataset_id = H5Dopen(file_id, "/dset"); + dataset_id = H5Dopen2(file_id, "/dset", H5P_DEFAULT); /* If we can read the dataset from the file, the file has been flushed to disk * (if the heap or object headers weren't flushed, the file would be empty). @@ -242,22 +241,22 @@ rsrv_ohdr(void) if(dataset_id == H5I_BADID) TEST_ERROR; - if( H5Dclose(dataset_id) < 0) TEST_ERROR; - if( H5Fclose(file_id) < 0) TEST_ERROR; + if(H5Dclose(dataset_id) < 0) TEST_ERROR; + if(H5Fclose(file_id) < 0) TEST_ERROR; PASSED(); return 0; - error: - /* Close everything we can and exit */ - H5E_BEGIN_TRY { +error: + /* Close everything we can and exit */ + H5E_BEGIN_TRY { H5Dclose(dataset_id); H5Sclose(dataspace_id); H5Pclose(fcpl); H5Pclose(fapl); H5Fclose(file_id); - } H5E_END_TRY - return 1; + } H5E_END_TRY + return 1; } /*------------------------------------------------------------------------- @@ -360,24 +359,24 @@ rsrv_vlen(void) TEST_ERROR; /* End access to the dataset and dataspace and release resources. */ - if( H5Dclose(dataset_id) < 0) TEST_ERROR; - if( H5Pclose(fcpl) < 0) TEST_ERROR; - if( H5Pclose(fapl) < 0) TEST_ERROR; - if( H5Sclose(dataspace_id) < 0) TEST_ERROR; - if( H5Tclose(type_id) < 0) TEST_ERROR; - if( H5Sclose(mem_space_id) < 0) TEST_ERROR; + if(H5Dclose(dataset_id) < 0) TEST_ERROR; + if(H5Pclose(fcpl) < 0) TEST_ERROR; + if(H5Pclose(fapl) < 0) TEST_ERROR; + if(H5Sclose(dataspace_id) < 0) TEST_ERROR; + if(H5Tclose(type_id) < 0) TEST_ERROR; + if(H5Sclose(mem_space_id) < 0) TEST_ERROR; /* Close the file and the library. */ - if( H5Fclose(file_id) < 0) TEST_ERROR; - if( H5close() < 0) TEST_ERROR; + if(H5Fclose(file_id) < 0) TEST_ERROR; + if(H5close() < 0) TEST_ERROR; /* Re-open the library and try to read a dataset from the file we created */ - if( H5open() < 0) TEST_ERROR; + if(H5open() < 0) TEST_ERROR; file_id = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); - if( file_id < 0) TEST_ERROR; + if(file_id < 0) TEST_ERROR; - dataset_id = H5Dopen(file_id, "/dset"); + dataset_id = H5Dopen2(file_id, "/dset", H5P_DEFAULT); /* If we can read the dataset from the file, the file has been flushed to disk * (if the heap or object headers weren't flushed, the file would be empty). @@ -385,15 +384,15 @@ rsrv_vlen(void) if(dataset_id == H5I_BADID) TEST_ERROR; - if( H5Dclose(dataset_id) < 0) TEST_ERROR; - if( H5Fclose(file_id) < 0) TEST_ERROR; + if(H5Dclose(dataset_id) < 0) TEST_ERROR; + if(H5Fclose(file_id) < 0) TEST_ERROR; PASSED(); return 0; - error: - /* Close everything we can and exit */ - H5E_BEGIN_TRY { +error: + /* Close everything we can and exit */ + H5E_BEGIN_TRY { H5Dclose(dataset_id); H5Sclose(dataspace_id); H5Sclose(mem_space_id); @@ -401,8 +400,8 @@ rsrv_vlen(void) H5Pclose(fcpl); H5Pclose(fapl); H5Fclose(file_id); - } H5E_END_TRY - return 1; + } H5E_END_TRY + return 1; } #endif /* BROKEN */ diff --git a/test/set_extent.c b/test/set_extent.c index c4c3ed0..40beda4 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -68,17 +68,17 @@ int main( void ) /* Create a new file using default properties. */ - if ((file_id = H5Fcreate( "set_extent_create.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ))<0) TEST_ERROR; + if ((file_id = H5Fcreate( "set_extent_create.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT )) < 0) TEST_ERROR; TESTING("extend dataset create with fill value"); /* Create the data space with unlimited dimensions. */ - if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) TEST_ERROR; + if ((space_id = H5Screate_simple( RANK, dims, maxdims )) < 0) TEST_ERROR; /* Modify dataset creation properties, i.e. enable chunking. */ - if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) TEST_ERROR; - if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) TEST_ERROR; - if (H5Pset_fill_value( plist_id, H5T_NATIVE_INT, &fillvalue )<0) TEST_ERROR; + if ((plist_id = H5Pcreate (H5P_DATASET_CREATE )) < 0) TEST_ERROR; + if (H5Pset_chunk( plist_id, RANK, dims_chunk ) < 0) TEST_ERROR; + if (H5Pset_fill_value( plist_id, H5T_NATIVE_INT, &fillvalue ) < 0) TEST_ERROR; /*------------------------------------------------------------------------- @@ -87,10 +87,10 @@ int main( void ) */ /* Create a new dataset */ - if ((dataset_id = H5Dcreate( file_id , "Dataset1", H5T_NATIVE_INT, space_id, plist_id ))<0) TEST_ERROR; + if ((dataset_id = H5Dcreate( file_id , "Dataset1", H5T_NATIVE_INT, space_id, plist_id )) < 0) TEST_ERROR; /* Write the data. */ - if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) TEST_ERROR; + if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data ) < 0) TEST_ERROR; /*------------------------------------------------------------------------- * Set new dimensions for the array; shrink it @@ -98,13 +98,13 @@ int main( void ) */ /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims_new )<0) TEST_ERROR; + if (H5Dset_extent( dataset_id , dims_new ) < 0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; + if ((space_id = H5Dget_space( dataset_id )) < 0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL ) < 0) TEST_ERROR; if ( dims_out[0] != dims_new[0] ) TEST_ERROR; if ( dims_out[1] != dims_new[1] ) TEST_ERROR; @@ -116,7 +116,7 @@ int main( void ) */ /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) TEST_ERROR; + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 ) < 0) TEST_ERROR; /* Compare the read array with the original array */ @@ -183,12 +183,12 @@ int main( void ) TESTING("extend dataset create without fill value"); /* Create the data space with unlimited dimensions. */ - if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) TEST_ERROR; + if ((space_id = H5Screate_simple( RANK, dims, maxdims )) < 0) TEST_ERROR; /* Modify dataset creation properties, i.e. enable chunking. */ - if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) TEST_ERROR; - if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) TEST_ERROR; - if (H5Pset_fill_time( plist_id, H5D_FILL_TIME_ALLOC)<0) TEST_ERROR; + if ((plist_id = H5Pcreate (H5P_DATASET_CREATE )) < 0) TEST_ERROR; + if (H5Pset_chunk( plist_id, RANK, dims_chunk ) < 0) TEST_ERROR; + if (H5Pset_fill_time( plist_id, H5D_FILL_TIME_ALLOC) < 0) TEST_ERROR; /*------------------------------------------------------------------------- * Create and write one dataset @@ -196,10 +196,10 @@ int main( void ) */ /* Create a new dataset */ - if ((dataset_id = H5Dcreate( file_id , "Dataset2", H5T_NATIVE_INT, space_id, plist_id ))<0) TEST_ERROR; + if ((dataset_id = H5Dcreate( file_id , "Dataset2", H5T_NATIVE_INT, space_id, plist_id )) < 0) TEST_ERROR; /* Write the data. */ - if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) TEST_ERROR; + if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data ) < 0) TEST_ERROR; /*------------------------------------------------------------------------- * Set new dimensions for the array; shrink it @@ -207,13 +207,13 @@ int main( void ) */ /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims_new )<0) TEST_ERROR; + if (H5Dset_extent( dataset_id , dims_new ) < 0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; + if ((space_id = H5Dget_space( dataset_id )) < 0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL ) < 0) TEST_ERROR; if ( dims_out[0] != dims_new[0] ) TEST_ERROR; @@ -224,7 +224,7 @@ int main( void ) */ /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) TEST_ERROR; + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 ) < 0) TEST_ERROR; /* Compare the read array with the original array */ @@ -239,13 +239,13 @@ int main( void ) */ /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims )<0) TEST_ERROR; + if (H5Dset_extent( dataset_id , dims ) < 0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; + if ((space_id = H5Dget_space( dataset_id )) < 0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL ) < 0) TEST_ERROR; if ( dims_out[0] != dims[0] ) TEST_ERROR; @@ -256,7 +256,7 @@ int main( void ) */ /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) TEST_ERROR; + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 ) < 0) TEST_ERROR; /* Compare the read array with the original array */ for( i = 0; i < (int)dims_out[0]; i++ ) { @@ -292,64 +292,65 @@ int main( void ) */ /* Create a file creation property list */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE))<0) TEST_ERROR; + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR; /* Set non-default indexed storage B-tree internal 'K' value */ - if(H5Pset_istore_k(fcpl,ISTORE_IK)<0) TEST_ERROR; + if(H5Pset_istore_k(fcpl,ISTORE_IK) < 0) TEST_ERROR; /* Create a new file using properties. */ - if ((file_id = H5Fcreate( "set_extent_read.h5", H5F_ACC_TRUNC, fcpl, H5P_DEFAULT ))<0) TEST_ERROR; + if ((file_id = H5Fcreate( "set_extent_read.h5", H5F_ACC_TRUNC, fcpl, H5P_DEFAULT )) < 0) TEST_ERROR; /* Close property list */ - if(H5Pclose(fcpl)<0) TEST_ERROR; + if(H5Pclose(fcpl) < 0) TEST_ERROR; TESTING("extend dataset read with fill value"); /* Create the data space with unlimited dimensions. */ - if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) TEST_ERROR; + if((space_id = H5Screate_simple(RANK, dims, maxdims)) < 0) TEST_ERROR; /* Modify dataset creation properties, i.e. enable chunking. */ - if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) TEST_ERROR; - if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) TEST_ERROR; - if (H5Pset_fill_value( plist_id, H5T_NATIVE_INT, &fillvalue )<0) TEST_ERROR; + if((plist_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR; + if(H5Pset_chunk(plist_id, RANK, dims_chunk) < 0) TEST_ERROR; + if(H5Pset_fill_value(plist_id, H5T_NATIVE_INT, &fillvalue) < 0) TEST_ERROR; /* Create a new dataset within the file using cparms creation properties. */ - if ((dataset_id = H5Dcreate( file_id , "Dataset1", H5T_NATIVE_INT, space_id, plist_id ))<0) TEST_ERROR; + if((dataset_id = H5Dcreate(file_id , "Dataset1", H5T_NATIVE_INT, space_id, plist_id)) < 0) TEST_ERROR; /* Write the data. */ - if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) TEST_ERROR; + if(H5Dwrite(dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data) < 0) TEST_ERROR; /* Close/release resources. */ - H5Dclose( dataset_id ); - H5Sclose( space_id ); - H5Pclose( plist_id ); - H5Fclose( file_id ); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR + if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR + if(H5Pclose(plist_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR /* Open the file */ - if ((file_id = H5Fopen( "set_extent_read.h5", H5F_ACC_RDWR, H5P_DEFAULT ))<0) TEST_ERROR; + if((file_id = H5Fopen("set_extent_read.h5", H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR; /* Open the dataset */ - if ((dataset_id = H5Dopen( file_id , "Dataset1" ))<0) TEST_ERROR; + if((dataset_id = H5Dopen2(file_id , "Dataset1", H5P_DEFAULT)) < 0) TEST_ERROR; /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id, dims_new )<0) TEST_ERROR; + if(H5Dset_extent(dataset_id, dims_new) < 0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; + if((space_id = H5Dget_space(dataset_id)) < 0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; + if(H5Sget_simple_extent_dims(space_id, dims_out, NULL) < 0) TEST_ERROR; - if ( dims_out[0] != dims_new[0] ) TEST_ERROR; + if(dims_out[0] != dims_new[0]) TEST_ERROR; /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) TEST_ERROR; + if(H5Dread(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1) < 0) TEST_ERROR; /* Compare the read array with the original array */ - for( i = 0; i < (int)dims_out[0]; i++ ) - for( j = 0; j < (int)dims_out[1]; j++ ) - if ( buf1[i][j] != data[i][j] ) TEST_ERROR; + for(i = 0; i < (int)dims_out[0]; i++) + for(j = 0; j < (int)dims_out[1]; j++) + if(buf1[i][j] != data[i][j]) + TEST_ERROR; /*------------------------------------------------------------------------- * Set new dimensions for the array; expand it again @@ -357,18 +358,18 @@ int main( void ) */ /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims )<0) TEST_ERROR; + if (H5Dset_extent( dataset_id , dims ) < 0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; + if ((space_id = H5Dget_space( dataset_id )) < 0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL ) < 0) TEST_ERROR; if ( dims_out[0] != dims[0] ) TEST_ERROR; /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) TEST_ERROR; + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 ) < 0) TEST_ERROR; /* Compare the read array with the original array */ for( i = 0; i < (int)dims_out[0]; i++ ) { @@ -397,50 +398,51 @@ int main( void ) TESTING("extend dataset read without fill value"); /* Create the data space with unlimited dimensions. */ - if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) TEST_ERROR; + if((space_id = H5Screate_simple(RANK, dims, maxdims)) < 0) TEST_ERROR; /* Modify dataset creation properties, i.e. enable chunking. */ - if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) TEST_ERROR; - if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) TEST_ERROR; - if (H5Pset_fill_time( plist_id, H5D_FILL_TIME_ALLOC)<0) TEST_ERROR; + if((plist_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR; + if(H5Pset_chunk(plist_id, RANK, dims_chunk) < 0) TEST_ERROR; + if(H5Pset_fill_time(plist_id, H5D_FILL_TIME_ALLOC) < 0) TEST_ERROR; /* Create a new dataset within the file using cparms creation properties. */ - if ((dataset_id = H5Dcreate( file_id , "Dataset2", H5T_NATIVE_INT, space_id, plist_id ))<0) TEST_ERROR; + if((dataset_id = H5Dcreate(file_id , "Dataset2", H5T_NATIVE_INT, space_id, plist_id)) < 0) TEST_ERROR; /* Write the data. */ - if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) TEST_ERROR; + if(H5Dwrite(dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data) < 0) TEST_ERROR; /* Close/release resources. */ - H5Dclose( dataset_id ); - H5Sclose( space_id ); - H5Pclose( plist_id ); - H5Fclose( file_id ); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR + if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR + if(H5Pclose(plist_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR /* Open the file */ - if ((file_id = H5Fopen( "set_extent_read.h5", H5F_ACC_RDWR, H5P_DEFAULT ))<0) TEST_ERROR; + if((file_id = H5Fopen("set_extent_read.h5", H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR; /* Open the dataset */ - if ((dataset_id = H5Dopen( file_id , "Dataset2" ))<0) TEST_ERROR; + if((dataset_id = H5Dopen2(file_id , "Dataset2", H5P_DEFAULT)) < 0) TEST_ERROR; /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id, dims_new )<0) TEST_ERROR; + if(H5Dset_extent(dataset_id, dims_new) < 0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; + if((space_id = H5Dget_space(dataset_id)) < 0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; + if(H5Sget_simple_extent_dims(space_id, dims_out, NULL) < 0) TEST_ERROR; - if ( dims_out[0] != dims_new[0] ) TEST_ERROR; + if(dims_out[0] != dims_new[0]) TEST_ERROR; /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) TEST_ERROR; + if(H5Dread(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1) < 0) TEST_ERROR; /* Compare the read array with the original array */ - for( i = 0; i < (int)dims_out[0]; i++ ) - for( j = 0; j < (int)dims_out[1]; j++ ) - if ( buf1[i][j] != data[i][j] ) TEST_ERROR; + for(i = 0; i < (int)dims_out[0]; i++) + for(j = 0; j < (int)dims_out[1]; j++) + if(buf1[i][j] != data[i][j]) + TEST_ERROR; /*------------------------------------------------------------------------- * Set new dimensions for the array; expand it again @@ -448,18 +450,18 @@ int main( void ) */ /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims )<0) TEST_ERROR; + if (H5Dset_extent( dataset_id , dims ) < 0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; + if ((space_id = H5Dget_space( dataset_id )) < 0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL ) < 0) TEST_ERROR; if ( dims_out[0] != dims[0] ) TEST_ERROR; /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) TEST_ERROR; + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 ) < 0) TEST_ERROR; /* Compare the read array with the original array */ for( i = 0; i < (int)dims_out[0]; i++ ) { diff --git a/test/stream_test.c b/test/stream_test.c index 3051d3b..7cd8267 100644 --- a/test/stream_test.c +++ b/test/stream_test.c @@ -321,25 +321,23 @@ static int receiver (void) * the sender should have created. */ tempfile = fopen (TEMPFILENAME, "r"); - if (tempfile == NULL) - { - fprintf (stderr, "receiver: couldn't open temporary file to read " + if(tempfile == NULL) { + fprintf(stderr, "receiver: couldn't open temporary file to read " "\"hostname:port\" information\n"); - H5Pclose (fapl); - return (-3); + H5Pclose(fapl); + return(-3); } - fgets (filename, sizeof (filename) - 1, tempfile); - fclose (tempfile); - unlink (TEMPFILENAME); + fgets(filename, sizeof (filename) - 1, tempfile); + fclose(tempfile); + unlink(TEMPFILENAME); /* * Open the streamed HDF5 file for reading. */ - printf (" receiver: opening file '%s' for reading...\n", filename); - file = H5Fopen (filename, H5F_ACC_RDONLY, fapl); - H5Pclose (fapl); - if (file < 0) - { + printf(" receiver: opening file '%s' for reading...\n", filename); + file = H5Fopen(filename, H5F_ACC_RDONLY, fapl); + H5Pclose(fapl); + if(file < 0) { fprintf (stderr, "receiver: couldn't open file from '%s'\n", filename); return (-4); } @@ -348,9 +346,8 @@ static int receiver (void) * Open the file and the dataset. */ printf (" receiver: reading dataset '%s'...\n", DATASETNAME); - dataset = H5Dopen (file, DATASETNAME); - if (dataset < 0) - { + dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT); + if(dataset < 0) { fprintf (stderr, "receiver: couldn't open dataset '%s'\n", DATASETNAME); return (-5); } @@ -358,27 +355,25 @@ static int receiver (void) /* * Get dataset class, order, and size information */ - datatype = H5Dget_type (dataset); - if (H5Tget_class (datatype) == H5T_INTEGER) - { - printf (" receiver: dataset is of type INTEGER\n"); - } - printf (" receiver: datatype size is %d bytes\n", + datatype = H5Dget_type(dataset); + if(H5Tget_class(datatype) == H5T_INTEGER) + printf(" receiver: dataset is of type INTEGER\n"); + printf(" receiver: datatype size is %d bytes\n", (int) H5Tget_size (datatype)); - printf (" receiver: byte ordering is %s endian\n", + printf(" receiver: byte ordering is %s endian\n", H5Tget_order (datatype) == H5T_ORDER_LE ? "little" : "big"); H5Tclose(datatype); /* * Get dataset dimensions */ - dataspace = H5Dget_space (dataset); - rank = H5Sget_simple_extent_ndims (dataspace); - dims = (hsize_t *) malloc (rank * sizeof (hsize_t)); - H5Sget_simple_extent_dims (dataspace, dims, NULL); - H5Sclose (dataspace); + dataspace = H5Dget_space(dataset); + rank = H5Sget_simple_extent_ndims(dataspace); + dims = (hsize_t *)malloc(rank * sizeof (hsize_t)); + H5Sget_simple_extent_dims(dataspace, dims, NULL); + H5Sclose(dataspace); - printf (" receiver: rank %d, dimensions %u", rank, (unsigned int) dims[0]); + printf(" receiver: rank %d, dimensions %u", rank, (unsigned int)dims[0]); nelems = dims[0]; for (i = 1; i < rank; i++) { diff --git a/test/tarray.c b/test/tarray.c index 8c7e6c8..a0e2b10 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -80,9 +80,9 @@ test_array_atomic_1d(void) MESSAGE(5, ("Testing 1-D Array of Atomic Datatypes Functionality\n")); /* Allocate and initialize array data to write */ - for(i=0; i= 0){ /* Open the first dataset (with no array fields) */ - dataset = H5Dopen(fid1, "Dataset1"); - CHECK_I(dataset, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK_I(dataset, "H5Dopen2"); /* Get the datatype */ tid1=H5Dget_type(dataset); @@ -1948,8 +1934,8 @@ test_compat(void) /* Open the second dataset (with array fields) */ - dataset = H5Dopen(fid1, "Dataset2"); - CHECK_I(dataset, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset2", H5P_DEFAULT); + CHECK_I(dataset, "H5Dopen2"); /* Get the datatype */ tid1=H5Dget_type(dataset); diff --git a/test/tattr.c b/test/tattr.c index 3e1110c..4f1e211 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -406,8 +406,8 @@ test_attr_basic_read(hid_t fapl) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset = H5Dopen(fid1, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ ret = H5Oget_info(dataset, ".", &oinfo, H5P_DEFAULT); @@ -777,8 +777,8 @@ test_attr_compound_read(hid_t fapl) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset = H5Dopen(fid1, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ ret = H5Oget_info(dataset, ".", &oinfo, H5P_DEFAULT); @@ -980,8 +980,8 @@ test_attr_scalar_read(hid_t fapl) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset = H5Dopen(fid1, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ ret = H5Oget_info(dataset, ".", &oinfo, H5P_DEFAULT); @@ -1182,8 +1182,8 @@ test_attr_mult_read(hid_t fapl) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset = H5Dopen(fid1, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ ret = H5Oget_info(dataset, ".", &oinfo, H5P_DEFAULT); @@ -1457,8 +1457,8 @@ test_attr_iterate(hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Open existing dataset w/attributes */ - dataset = H5Dopen(file, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ ret = H5Oget_info(dataset, ".", &oinfo, H5P_DEFAULT); @@ -1504,8 +1504,8 @@ test_attr_delete(hid_t fapl) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset = H5Dopen(fid1, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ ret = H5Oget_info(dataset, ".", &oinfo, H5P_DEFAULT); @@ -1729,8 +1729,8 @@ test_attr_dtype_shared(hid_t fapl) CHECK(file_id, FAIL, "H5Fopen"); /* Open dataset */ - dset_id = H5Dopen(file_id, DSET1_NAME); - CHECK(dset_id, FAIL, "H5Dopen"); + dset_id = H5Dopen2(file_id, DSET1_NAME, H5P_DEFAULT); + CHECK(dset_id, FAIL, "H5Dopen2"); /* Open attribute */ attr_id = H5Aopen(dset_id, ".", ATTR1_NAME, H5P_DEFAULT, H5P_DEFAULT); @@ -2232,8 +2232,8 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Open dataset */ - dataset = H5Dopen(fid, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Delete attributes until the attributes revert to compact storage again */ for(u--; u >= min_dense; u--) { @@ -2414,8 +2414,8 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Open dataset */ - dataset = H5Dopen(fid, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Verify renamed attributes */ for(u = 0; u < (max_compact * 2); u++) { @@ -3151,8 +3151,8 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Open dataset */ - dataset = H5Dopen(fid, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Open first attribute */ @@ -3299,8 +3299,8 @@ test_attr_deprec(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Open dataset */ - dataset = H5Dopen(fid, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get number of attributes */ @@ -3515,8 +3515,8 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Open dataset created */ - dataset = H5Dopen(fid, DSET1_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Check on dataset's attribute storage status */ is_empty = H5O_is_attr_empty_test(dataset); @@ -3680,12 +3680,12 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Open datasets created */ - dset1 = H5Dopen(fid, DSET1_NAME); - CHECK(dset1, FAIL, "H5Dopen"); - dset2 = H5Dopen(fid, DSET2_NAME); - CHECK(dset2, FAIL, "H5Dopen"); - dset3 = H5Dopen(fid, DSET3_NAME); - CHECK(dset3, FAIL, "H5Dopen"); + dset1 = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(dset1, FAIL, "H5Dopen2"); + dset2 = H5Dopen2(fid, DSET2_NAME, H5P_DEFAULT); + CHECK(dset2, FAIL, "H5Dopen2"); + dset3 = H5Dopen2(fid, DSET3_NAME, H5P_DEFAULT); + CHECK(dset3, FAIL, "H5Dopen2"); /* Work on all the datasets */ for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { @@ -3907,12 +3907,12 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Open datasets created */ - dset1 = H5Dopen(fid, DSET1_NAME); - CHECK(dset1, FAIL, "H5Dopen"); - dset2 = H5Dopen(fid, DSET2_NAME); - CHECK(dset2, FAIL, "H5Dopen"); - dset3 = H5Dopen(fid, DSET3_NAME); - CHECK(dset3, FAIL, "H5Dopen"); + dset1 = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(dset1, FAIL, "H5Dopen2"); + dset2 = H5Dopen2(fid, DSET2_NAME, H5P_DEFAULT); + CHECK(dset2, FAIL, "H5Dopen2"); + dset3 = H5Dopen2(fid, DSET3_NAME, H5P_DEFAULT); + CHECK(dset3, FAIL, "H5Dopen2"); /* Work on all the datasets */ for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { @@ -4190,12 +4190,12 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Open datasets created */ - dset1 = H5Dopen(fid, DSET1_NAME); - CHECK(dset1, FAIL, "H5Dopen"); - dset2 = H5Dopen(fid, DSET2_NAME); - CHECK(dset2, FAIL, "H5Dopen"); - dset3 = H5Dopen(fid, DSET3_NAME); - CHECK(dset3, FAIL, "H5Dopen"); + dset1 = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(dset1, FAIL, "H5Dopen2"); + dset2 = H5Dopen2(fid, DSET2_NAME, H5P_DEFAULT); + CHECK(dset2, FAIL, "H5Dopen2"); + dset3 = H5Dopen2(fid, DSET3_NAME, H5P_DEFAULT); + CHECK(dset3, FAIL, "H5Dopen2"); /* Work on all the datasets */ for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { @@ -4352,12 +4352,12 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Open datasets created */ - dset1 = H5Dopen(fid, DSET1_NAME); - CHECK(dset1, FAIL, "H5Dopen"); - dset2 = H5Dopen(fid, DSET2_NAME); - CHECK(dset2, FAIL, "H5Dopen"); - dset3 = H5Dopen(fid, DSET3_NAME); - CHECK(dset3, FAIL, "H5Dopen"); + dset1 = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(dset1, FAIL, "H5Dopen2"); + dset2 = H5Dopen2(fid, DSET2_NAME, H5P_DEFAULT); + CHECK(dset2, FAIL, "H5Dopen2"); + dset3 = H5Dopen2(fid, DSET3_NAME, H5P_DEFAULT); + CHECK(dset3, FAIL, "H5Dopen2"); /* Work on all the datasets */ for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { diff --git a/test/testmeta.c b/test/testmeta.c index 74e9aa8..7d67af2 100644 --- a/test/testmeta.c +++ b/test/testmeta.c @@ -133,8 +133,7 @@ int main(void) sprintf(name, "DataArray%06d", i); dataset_id = H5Dcreate(group_id, name, H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT); - if(dataset_id < 0) - { + if(dataset_id < 0) { fprintf(stderr, "Failed to create DataArray dataset.\n"); status = H5Fclose(file_id); return -1; @@ -143,8 +142,7 @@ int main(void) /* Write the data array data */ status = H5Dwrite(dataset_id, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); - if(status < 0) - { + if(status < 0) { fprintf(stderr, "Failed to write DataArray dataset.\n"); status = H5Fclose(file_id); return -1; @@ -156,9 +154,8 @@ int main(void) } /* Open NumDataObj dataset */ - dataset_id = H5Dopen(file_id, "/NumDataObj"); - if(dataset_id < 0) - { + dataset_id = H5Dopen2(file_id, "/NumDataObj", H5P_DEFAULT); + if(dataset_id < 0) { fprintf(stderr, "Failed to open NumDataObj dataset.\n"); status = H5Fclose(file_id); return -1; @@ -168,8 +165,7 @@ int main(void) numdataobj = j + 1; status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &numdataobj); - if(status < 0) - { + if(status < 0) { fprintf(stderr, "Failed to write NumDataObj dataset.\n"); status = H5Fclose(file_id); return -1; @@ -183,7 +179,7 @@ int main(void) for(i = 0; i < NEXTARRAYS; i++) { /* Open extendable dataset */ sprintf(name, "/ExtArray%06d", i); - dataset_id = H5Dopen(file_id, name); + dataset_id = H5Dopen2(file_id, name, H5P_DEFAULT); if(dataset_id < 0) { fprintf(stderr, "Failed to open ExtArray dataset.\n"); status = H5Fclose(file_id); diff --git a/test/tfile.c b/test/tfile.c index 4766838..a940277 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -422,8 +422,8 @@ test_file_open(void) VERIFY(intent, H5F_ACC_RDONLY, "H5Fget_intent"); /* Open dataset */ - did = H5Dopen(fid1, F2_DSET); - CHECK(did, FAIL, "H5Dopen"); + did = H5Dopen2(fid1, F2_DSET, H5P_DEFAULT); + CHECK(did, FAIL, "H5Dopen2"); /* Check that the intent works even if NULL is passed in */ ret = H5Fget_intent(fid1, NULL); @@ -1392,15 +1392,15 @@ test_file_open_dot(void) /* Open a dataset with no name using the file ID */ H5E_BEGIN_TRY { - did = H5Dopen(fid, "."); + did = H5Dopen2(fid, ".", H5P_DEFAULT); } H5E_END_TRY; - VERIFY(did, FAIL, "H5Dopen"); + VERIFY(did, FAIL, "H5Dopen2"); /* Open a dataset with no name using the group ID */ H5E_BEGIN_TRY { - did = H5Dopen(gid, "."); + did = H5Dopen2(gid, ".", H5P_DEFAULT); } H5E_END_TRY; - VERIFY(did, FAIL, "H5Dopen"); + VERIFY(did, FAIL, "H5Dopen2"); /* Make a copy of a datatype to use for creating a named datatype */ tid = H5Tcopy(H5T_NATIVE_INT); @@ -1777,8 +1777,8 @@ test_file_double_dataset_open(void) dset1_id = H5Dcreate(file1_id, DSET_NAME, H5T_NATIVE_INT, space_id, H5P_DEFAULT); CHECK(dset1_id, FAIL, "H5Dcreate"); - dset2_id = H5Dopen(file2_id, DSET_NAME); - CHECK(dset2_id, FAIL, "H5Dopen"); + dset2_id = H5Dopen2(file2_id, DSET_NAME, H5P_DEFAULT); + CHECK(dset2_id, FAIL, "H5Dopen2"); /* Close "supporting" dataspace */ ret = H5Sclose(space_id); diff --git a/test/th5o.c b/test/th5o.c index a1843ea..eb18515 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -217,8 +217,8 @@ test_h5o_close(void) CHECK(grp, FAIL, "H5Gopen2"); dtype = H5Topen2(fid, "group/datatype", H5P_DEFAULT); CHECK(dtype, FAIL, "H5Topen2"); - dset = H5Dopen(fid, "dataset"); - CHECK(dset, FAIL, "H5Dopen"); + dset = H5Dopen2(fid, "dataset", H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dopen2"); ret = H5Oclose(grp); CHECK(ret, FAIL, "H5Oclose"); @@ -482,8 +482,8 @@ test_h5o_refcount(void) CHECK(grp, FAIL, "H5Gopen2"); dtype = H5Topen2(fid, "datatype", H5P_DEFAULT); CHECK(dtype, FAIL, "H5Topen2"); - dset = H5Dopen(fid, "dataset"); - CHECK(dset, FAIL, "H5Dopen"); + dset = H5Dopen2(fid, "dataset", H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dopen2"); ret = H5Oget_info(fid, "group", &oinfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info"); @@ -520,8 +520,8 @@ test_h5o_refcount(void) CHECK(grp, FAIL, "H5Gopen2"); dtype = H5Topen2(fid, "datatype", H5P_DEFAULT); CHECK(dtype, FAIL, "H5Topen2"); - dset = H5Dopen(fid, "dataset"); - CHECK(dset, FAIL, "H5Dopen"); + dset = H5Dopen2(fid, "dataset", H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dopen2"); ret = H5Oget_info(fid, "group", &oinfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info"); @@ -710,8 +710,8 @@ test_h5o_plist(void) CHECK(grp, FAIL, "H5Gopen2"); dtype = H5Topen2(fid, "datatype", H5P_DEFAULT); CHECK(dtype, FAIL, "H5Topen2"); - dset = H5Dopen(fid, "dataset"); - CHECK(dset, FAIL, "H5Dopen"); + dset = H5Dopen2(fid, "dataset", H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dopen2"); /* Retrieve each object's creation property list */ gcpl = H5Gget_create_plist(grp); diff --git a/test/th5s.c b/test/th5s.c index 46f7110..3c872ca 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -188,8 +188,8 @@ test_h5s_basic(void) fid1 = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK_I(fid1, "H5Fopen"); if (fid1 >= 0){ - dset1 = H5Dopen(fid1, "dset"); - VERIFY(dset1, FAIL, "H5Dopen"); + dset1 = H5Dopen2(fid1, "dset", H5P_DEFAULT); + VERIFY(dset1, FAIL, "H5Dopen2"); ret = H5Fclose(fid1); CHECK_I(ret, "H5Fclose"); } @@ -462,8 +462,8 @@ test_h5s_null(void) CHECK(fid, FAIL, "H5Fopen"); /* Reopen the dataset */ - did = H5Dopen(fid, NULLDATASET); - CHECK(did, FAIL, "H5Dopen"); + did = H5Dopen2(fid, NULLDATASET, H5P_DEFAULT); + CHECK(did, FAIL, "H5Dopen2"); /* Get the space of the dataset */ dset_sid = H5Dget_space(did); @@ -783,10 +783,10 @@ test_h5s_scalar_read(void) CHECK(fid1, FAIL, "H5Fopen"); /* Create a dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); - sid1=H5Dget_space(dataset); + sid1 = H5Dget_space(dataset); CHECK(sid1, FAIL, "H5Dget_space"); n = H5Sget_simple_extent_npoints(sid1); @@ -928,10 +928,10 @@ test_h5s_compound_scalar_read(void) CHECK(fid1, FAIL, "H5Fopen"); /* Create a dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); - sid1=H5Dget_space(dataset); + sid1 = H5Dget_space(dataset); CHECK(sid1, FAIL, "H5Dget_space"); n = H5Sget_simple_extent_npoints(sid1); @@ -1034,22 +1034,22 @@ test_h5s_chunk(void) CHECK(status, FAIL, "H5Fclose"); /* Reset/initialize the data arrays to read in */ - HDmemset(chunk_data_dbl,0,sizeof(double)*50000*3); - HDmemset(chunk_data_flt,0,sizeof(float)*50000*3); + HDmemset(chunk_data_dbl, 0, sizeof(double) * 50000 * 3); + HDmemset(chunk_data_flt, 0, sizeof(float) * 50000 * 3); - fileID = H5Fopen(DATAFILE,H5F_ACC_RDONLY,H5P_DEFAULT); + fileID = H5Fopen(DATAFILE, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(fileID, FAIL, "H5Fopen"); - dsetID = H5Dopen(fileID,"coords"); - CHECK(dsetID, FAIL, "H5Dopen"); + dsetID = H5Dopen2(fileID, "coords", H5P_DEFAULT); + CHECK(dsetID, FAIL, "H5Dopen2"); - status= H5Dread (dsetID,H5T_NATIVE_DOUBLE,H5S_ALL,H5S_ALL,H5P_DEFAULT,chunk_data_dbl); + status= H5Dread (dsetID, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_dbl); CHECK(status, FAIL, "H5Dread"); - status= H5Dread (dsetID,H5T_NATIVE_FLOAT,H5S_ALL,H5S_ALL,H5P_DEFAULT,chunk_data_flt); + status= H5Dread (dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt); CHECK(status, FAIL, "H5Dread"); - status=H5Dclose(dsetID); + status = H5Dclose(dsetID); CHECK(status, FAIL, "H5Dclose"); - status=H5Fclose(fileID); + status = H5Fclose(fileID); CHECK(status, FAIL, "H5Fclose"); for(i=0; i<50000; i++) { diff --git a/test/titerate.c b/test/titerate.c index f7938e5..9aef367 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -434,8 +434,8 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format) file = H5Fopen(DATAFILE, H5F_ACC_RDONLY, fapl); CHECK(file, FAIL, "H5Fopen"); - dataset = H5Dopen(file, "Dataset"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(file, "Dataset", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Test invalid indices for starting iteration */ info.command = RET_ZERO; diff --git a/test/tmisc.c b/test/tmisc.c index 959c7a8..41feb80 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -357,8 +357,8 @@ test_misc1(void) dataspace = H5Screate(H5S_SCALAR); CHECK(dataspace, FAIL, "H5Screate"); - dataset = H5Dopen(file, MISC1_DSET_NAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(file, MISC1_DSET_NAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &i_check); CHECK(ret, FAIL, "H5Dread"); @@ -924,24 +924,24 @@ test_misc5(void) /* Read the dataset back in & verify it */ - loc_id=H5Fopen(MISC5_FILE, H5F_ACC_RDONLY, H5P_DEFAULT); - CHECK(loc_id,FAIL,"H5Fopen"); + loc_id = H5Fopen(MISC5_FILE, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK(loc_id, FAIL, "H5Fopen"); /* Open dataset again */ - dataset_id=H5Dopen(loc_id, MISC5_DSETNAME); - CHECK(dataset_id,FAIL,"H5Dopen"); + dataset_id = H5Dopen2(loc_id, MISC5_DSETNAME, H5P_DEFAULT); + CHECK(dataset_id, FAIL, "H5Dopen2"); /* Get the dataset's datatype */ - mem_type_id=H5Dget_type(dataset_id); - CHECK(mem_type_id,FAIL,"H5Dget_type"); + mem_type_id = H5Dget_type(dataset_id); + CHECK(mem_type_id, FAIL, "H5Dget_type"); /* Get the dataset's dataspace */ - space_id=H5Dget_space(dataset_id); - CHECK(space_id,FAIL,"H5Dget_space"); + space_id = H5Dget_space(dataset_id); + CHECK(space_id, FAIL, "H5Dget_space"); /* Read the data back in */ - ret=H5Dread(dataset_id, mem_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buf); - CHECK(ret,FAIL,"H5Dread"); + ret = H5Dread(dataset_id, mem_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buf); + CHECK(ret, FAIL, "H5Dread"); /* Verify the correct information was read in */ for(i=0; i<(buf.len); i++) { @@ -1036,8 +1036,8 @@ test_misc6(void) /* Open first dataset */ - dataset_id = H5Dopen(loc_id, MISC6_DSETNAME1); - CHECK(dataset_id, FAIL, "H5Dopen"); + dataset_id = H5Dopen2(loc_id, MISC6_DSETNAME1, H5P_DEFAULT); + CHECK(dataset_id, FAIL, "H5Dopen2"); /* Add attribute to dataset */ attr_id = H5Acreate2(dataset_id, ".", attr_name, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -1053,8 +1053,8 @@ test_misc6(void) /* Open second dataset */ - dataset_id = H5Dopen(loc_id, MISC6_DSETNAME2); - CHECK(dataset_id, FAIL, "H5Dopen"); + dataset_id = H5Dopen2(loc_id, MISC6_DSETNAME2, H5P_DEFAULT); + CHECK(dataset_id, FAIL, "H5Dopen2"); /* Add attribute to dataset */ attr_id = H5Acreate2(dataset_id, ".", attr_name, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -1730,8 +1730,8 @@ test_misc10(void) fcpl = H5Fget_create_plist(file); CHECK(fcpl, FAIL, "H5Fget_create_plist"); - dataset = H5Dopen(file, MISC10_DSETNAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(file, MISC10_DSETNAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); dcpl = H5Dget_create_plist(dataset); CHECK(dcpl, FAIL, "H5Dget_create_plist"); space = H5Dget_space(dataset); @@ -2112,8 +2112,8 @@ verify_dataset(hid_t loc_id, const char *name) herr_t ret; /* Generic return value */ /* Open the contiguous dataset in the root group */ - dsid = H5Dopen(loc_id, name); - CHECK(dsid, FAIL, "H5Dopen"); + dsid = H5Dopen2(loc_id, name, H5P_DEFAULT); + CHECK(dsid, FAIL, "H5Dopen2"); /* Read the data */ ret = H5Dread(dsid, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, m13_rdata); @@ -3458,8 +3458,8 @@ test_misc20(void) CHECK(fid, FAIL, "H5Fopen"); /* Open dataset with big dimensions */ - did = H5Dopen(fid, MISC20_DSET_NAME); - CHECK(did, FAIL, "H5Dopen"); + did = H5Dopen2(fid, MISC20_DSET_NAME, H5P_DEFAULT); + CHECK(did, FAIL, "H5Dopen2"); /* Get the layout version */ ret = H5D_layout_version_test(did,&version); @@ -3476,8 +3476,8 @@ test_misc20(void) CHECK(ret, FAIL, "H5Dclose"); /* Open dataset with small dimensions */ - did = H5Dopen(fid, MISC20_DSET2_NAME); - CHECK(did, FAIL, "H5Dopen"); + did = H5Dopen2(fid, MISC20_DSET2_NAME, H5P_DEFAULT); + CHECK(did, FAIL, "H5Dopen2"); /* Get the layout version */ ret = H5D_layout_version_test(did,&version); @@ -3513,8 +3513,8 @@ test_misc20(void) CHECK(fid, FAIL, "H5Fopen"); /* Open dataset with small dimensions */ - did = H5Dopen(fid, MISC20_DSET_NAME); - CHECK(did, FAIL, "H5Dopen"); + did = H5Dopen2(fid, MISC20_DSET_NAME, H5P_DEFAULT); + CHECK(did, FAIL, "H5Dopen2"); /* Get the layout version */ ret = H5D_layout_version_test(did,&version); @@ -3715,8 +3715,8 @@ test_misc22(void) ret = H5Pclose(dcpl); CHECK(ret, FAIL, "H5Pclose"); - dsid = H5Dopen(fid, MISC22_DSET_NAME); - CHECK(dsid, FAIL, "H5Dopen"); + dsid = H5Dopen2(fid, MISC22_DSET_NAME, H5P_DEFAULT); + CHECK(dsid, FAIL, "H5Dopen2"); dcpl2 = H5Dget_create_plist(dsid); CHECK(dcpl2, FAIL, "H5Dget_create_plist"); @@ -4078,14 +4078,14 @@ test_misc24(void) /* Attempt to open each kind of object with wrong API, including using soft links */ H5E_BEGIN_TRY { - tmp_id = H5Dopen(file_id, MISC24_GROUP_NAME); + tmp_id = H5Dopen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Dopen"); + VERIFY(tmp_id, FAIL, "H5Dopen2"); H5E_BEGIN_TRY { - tmp_id = H5Dopen(file_id, MISC24_GROUP_LINK); + tmp_id = H5Dopen2(file_id, MISC24_GROUP_LINK, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Dopen"); + VERIFY(tmp_id, FAIL, "H5Dopen2"); H5E_BEGIN_TRY { tmp_id = H5Topen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); @@ -4128,14 +4128,14 @@ test_misc24(void) VERIFY(tmp_id, FAIL, "H5Gopen2"); H5E_BEGIN_TRY { - tmp_id = H5Dopen(file_id, MISC24_DATATYPE_NAME); + tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Dopen"); + VERIFY(tmp_id, FAIL, "H5Dopen2"); H5E_BEGIN_TRY { - tmp_id = H5Dopen(file_id, MISC24_DATATYPE_LINK); + tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Dopen"); + VERIFY(tmp_id, FAIL, "H5Dopen2"); /* Try again, with the object already open through valid call */ /* Open group */ @@ -4143,14 +4143,14 @@ test_misc24(void) CHECK(group_id, FAIL, "H5Gopen2"); H5E_BEGIN_TRY { - tmp_id = H5Dopen(file_id, MISC24_GROUP_NAME); + tmp_id = H5Dopen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Dopen"); + VERIFY(tmp_id, FAIL, "H5Dopen2"); H5E_BEGIN_TRY { - tmp_id = H5Dopen(file_id, MISC24_GROUP_LINK); + tmp_id = H5Dopen2(file_id, MISC24_GROUP_LINK, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Dopen"); + VERIFY(tmp_id, FAIL, "H5Dopen2"); H5E_BEGIN_TRY { tmp_id = H5Topen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); @@ -4166,8 +4166,8 @@ test_misc24(void) CHECK(ret, FAIL, "H5Gclose"); /* Open dataset */ - dset_id = H5Dopen(file_id, MISC24_DATASET_NAME); - CHECK(dset_id, FAIL, "H5Dopen"); + dset_id = H5Dopen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT); + CHECK(dset_id, FAIL, "H5Dopen2"); H5E_BEGIN_TRY { tmp_id = H5Gopen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT); @@ -4207,14 +4207,14 @@ test_misc24(void) VERIFY(tmp_id, FAIL, "H5Gopen2"); H5E_BEGIN_TRY { - tmp_id = H5Dopen(file_id, MISC24_DATATYPE_NAME); + tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Dopen"); + VERIFY(tmp_id, FAIL, "H5Dopen2"); H5E_BEGIN_TRY { - tmp_id = H5Dopen(file_id, MISC24_DATATYPE_LINK); + tmp_id = H5Dopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Dopen"); + VERIFY(tmp_id, FAIL, "H5Dopen2"); ret = H5Tclose(type_id); CHECK(ret, FAIL, "H5Tclose"); diff --git a/test/trefer.c b/test/trefer.c index 2b2c96e..baa0bcd 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -216,8 +216,8 @@ test_reference_obj(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset = H5Dopen(fid1, "/Dataset3"); - CHECK(ret, FAIL, "H5Dcreate"); + dataset = H5Dopen2(fid1, "/Dataset3", H5P_DEFAULT); + CHECK(ret, FAIL, "H5Dopen2"); /* Read selection from disk */ ret = H5Dread(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf); @@ -442,8 +442,8 @@ test_reference_region(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dset1 = H5Dopen(fid1,"/Dataset1"); - CHECK(dset1, FAIL, "H5Dopen"); + dset1 = H5Dopen2(fid1, "/Dataset1", H5P_DEFAULT); + CHECK(dset1, FAIL, "H5Dopen2"); /* Read selection from disk */ ret = H5Dread(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf); @@ -714,8 +714,8 @@ test_reference_region_1D(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dset1 = H5Dopen(fid1, "/Dataset1"); - CHECK(dset1, FAIL, "H5Dopen"); + dset1 = H5Dopen2(fid1, "/Dataset1", H5P_DEFAULT); + CHECK(dset1, FAIL, "H5Dopen2"); /* Read selection from disk */ ret = H5Dread(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf); @@ -920,8 +920,8 @@ test_reference_obj_deleted(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset = H5Dopen(fid1, "/Dataset2"); - CHECK(ret, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "/Dataset2", H5P_DEFAULT); + CHECK(ret, FAIL, "H5Dopen2"); /* Read selection from disk */ HDmemset(&oref, 0, sizeof(hobj_ref_t)); @@ -1065,8 +1065,8 @@ test_reference_group(void) CHECK(fid, FAIL, "H5Fopen"); /* Re-open dataset */ - did = H5Dopen(fid, DSETNAME); - CHECK(did, FAIL, "H5Dopen"); + did = H5Dopen2(fid, DSETNAME, H5P_DEFAULT); + CHECK(did, FAIL, "H5Dopen2"); /* Read in the reference */ ret = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rref); @@ -1296,8 +1296,8 @@ test_reference_compat(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the object reference dataset */ - dataset = H5Dopen(fid1, "/Dataset3"); - CHECK(ret, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "/Dataset3", H5P_DEFAULT); + CHECK(ret, FAIL, "H5Dopen2"); /* Read selection from disk */ ret = H5Dread(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_obj); @@ -1326,8 +1326,8 @@ test_reference_compat(void) /* Open the dataset region reference dataset */ - dataset = H5Dopen(fid1, "/Dataset4"); - CHECK(ret, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "/Dataset4", H5P_DEFAULT); + CHECK(ret, FAIL, "H5Dopen2"); /* Read selection from disk */ ret = H5Dread(dataset, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_reg); diff --git a/test/tselect.c b/test/tselect.c index 45b8c88..a6b885f 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -2921,34 +2921,34 @@ test_select_hyper_union_stagger(void) /* Close things */ error=H5Sclose(dataspace); CHECK(error, FAIL, "H5Sclose"); - error=H5Dclose(dset_id); + error = H5Dclose(dset_id); CHECK(error, FAIL, "H5Dclose"); - error=H5Fclose(file_id); + error = H5Fclose(file_id); CHECK(error, FAIL, "H5Fclose"); /* Initialize intput buffer */ - memset(data_out,0,7*7*sizeof(int)); + memset(data_out, 0, 7 * 7 * sizeof(int)); /* Open file */ - file_id=H5Fopen(FILENAME,H5F_ACC_RDONLY,H5P_DEFAULT); + file_id = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(file_id, FAIL, "H5Fopen"); /* Open dataset */ - dset_id=H5Dopen(file_id,"IntArray"); - CHECK(dset_id, FAIL, "H5Dopen"); + dset_id = H5Dopen2(file_id, "IntArray", H5P_DEFAULT); + CHECK(dset_id, FAIL, "H5Dopen2"); /* Get the dataspace */ - dataspace=H5Dget_space(dset_id); + dataspace = H5Dget_space(dset_id); CHECK(dataspace, FAIL, "H5Dget_space"); /* Select the hyperslabs */ - error=H5Sselect_hyperslab(dataspace,H5S_SELECT_SET,offset,stride,count,block); + error = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, stride, count, block); CHECK(error, FAIL, "H5Sselect_hyperslab"); - tmp_space=H5Scombine_hyperslab(dataspace,H5S_SELECT_OR,offset2,stride,count2,block); + tmp_space = H5Scombine_hyperslab(dataspace, H5S_SELECT_OR, offset2, stride, count2, block); CHECK(tmp_space, FAIL, "H5Scombine_hyperslab"); /* Copy the file dataspace and select hyperslab */ - tmp2_space=H5Scopy(dataspace); + tmp2_space = H5Scopy(dataspace); CHECK(tmp2_space, FAIL, "H5Scopy"); error=H5Sselect_hyperslab(tmp2_space,H5S_SELECT_SET,offset3,stride,count3,block); CHECK(error, FAIL, "H5Sselect_hyperslab"); @@ -4068,16 +4068,16 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist) /* * Open the file and the dataset. */ - file = H5Fopen (FILENAME, H5F_ACC_RDONLY, fapl_plist); + file = H5Fopen(FILENAME, H5F_ACC_RDONLY, fapl_plist); CHECK(file, FAIL, "H5Fopen"); - dataset = H5Dopen (file, DATASETNAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); - dataspace = H5Dget_space (dataset); /* dataspace handle */ + dataspace = H5Dget_space(dataset); /* dataspace handle */ CHECK(dataspace, FAIL, "H5Dget_space"); - rank = H5Sget_simple_extent_ndims (dataspace); + rank = H5Sget_simple_extent_ndims(dataspace); VERIFY(rank, 3, "H5Sget_simple_extent_ndims"); - status_n = H5Sget_simple_extent_dims (dataspace, dims_out, NULL); + status_n = H5Sget_simple_extent_dims(dataspace, dims_out, NULL); CHECK(status_n, FAIL, "H5Sget_simple_extent_dims"); VERIFY(dims_out[0], dimsf[0], "Dataset dimensions"); VERIFY(dims_out[1], dimsf[1], "Dataset dimensions"); @@ -4301,48 +4301,48 @@ test_select_point_chunk(void) CHECK(ret, FAIL, "H5Dwrite"); /* Close everything (except selections) */ - ret=H5Pclose (dcpl); + ret = H5Pclose(dcpl); CHECK(ret, FAIL, "H5Pclose"); - ret=H5Sclose (dataspace); + ret = H5Sclose(dataspace); CHECK(ret, FAIL, "H5Sclose"); - ret=H5Dclose (dataset); + ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); - ret=H5Fclose (file); + ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); /* Re-open file & dataset */ - file = H5Fopen (FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT); + file = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(file, FAIL, "H5Fopen"); - dataset = H5Dopen (file, DATASETNAME); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Read data using 1st point selection for file and hyperslab for memory */ - ret=H5Dread(dataset,H5T_NATIVE_UINT,hyp1_space,pnt1_space,H5P_DEFAULT,data_out); + ret = H5Dread(dataset, H5T_NATIVE_UINT, hyp1_space, pnt1_space, H5P_DEFAULT, data_out); CHECK(ret, FAIL, "H5Dread"); /* Verify data (later) */ /* Read data using 2nd hyperslab selection for file and point for memory */ - ret=H5Dread(dataset,H5T_NATIVE_UINT,pnt2_space,hyp2_space,H5P_DEFAULT,data_out); + ret = H5Dread(dataset, H5T_NATIVE_UINT, pnt2_space, hyp2_space, H5P_DEFAULT, data_out); CHECK(ret, FAIL, "H5Dread"); /* Verify data (later) */ /* Close everything (inclusing selections) */ - ret=H5Sclose (pnt1_space); + ret = H5Sclose(pnt1_space); CHECK(ret, FAIL, "H5Sclose"); - ret=H5Sclose (pnt2_space); + ret = H5Sclose(pnt2_space); CHECK(ret, FAIL, "H5Sclose"); - ret=H5Sclose (hyp1_space); + ret = H5Sclose(hyp1_space); CHECK(ret, FAIL, "H5Sclose"); - ret=H5Sclose (hyp2_space); + ret = H5Sclose(hyp2_space); CHECK(ret, FAIL, "H5Sclose"); - ret=H5Dclose (dataset); + ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); - ret=H5Fclose (file); + ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); - free (data); + free(data); free (data_out); } /* test_select_point_chunk() */ diff --git a/test/tsohm.c b/test/tsohm.c index 350e9b8..c0b9848 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -418,22 +418,22 @@ make_dtype_1(void) hid_t str_id = -1; /* Create compound datatype. */ - if((dtype1_id = H5Tcreate( H5T_COMPOUND, sizeof(struct dtype1_struct)))<0) TEST_ERROR + if((dtype1_id = H5Tcreate( H5T_COMPOUND, sizeof(struct dtype1_struct))) < 0) TEST_ERROR - if(H5Tinsert(dtype1_id,"i1",HOFFSET(struct dtype1_struct,i1),H5T_NATIVE_INT)<0) TEST_ERROR + if(H5Tinsert(dtype1_id,"i1",HOFFSET(struct dtype1_struct,i1),H5T_NATIVE_INT) < 0) TEST_ERROR str_id = H5Tcopy(H5T_C_S1); - if(H5Tset_size(str_id,(size_t) 10)<0) TEST_ERROR - - if(H5Tinsert(dtype1_id,"vl_string",HOFFSET(dtype1_struct,str),str_id)<0) TEST_ERROR - if(H5Tinsert(dtype1_id,"i2",HOFFSET(struct dtype1_struct,i2),H5T_NATIVE_INT)<0) TEST_ERROR - if(H5Tinsert(dtype1_id,"i3",HOFFSET(struct dtype1_struct,i3),H5T_NATIVE_INT)<0) TEST_ERROR - if(H5Tinsert(dtype1_id,"i4",HOFFSET(struct dtype1_struct,i4),H5T_NATIVE_INT)<0) TEST_ERROR - if(H5Tinsert(dtype1_id,"i5",HOFFSET(struct dtype1_struct,i5),H5T_NATIVE_INT)<0) TEST_ERROR - if(H5Tinsert(dtype1_id,"i6",HOFFSET(struct dtype1_struct,i6),H5T_NATIVE_INT)<0) TEST_ERROR - if(H5Tinsert(dtype1_id,"i7",HOFFSET(struct dtype1_struct,i7),H5T_NATIVE_INT)<0) TEST_ERROR - if(H5Tinsert(dtype1_id,"i8",HOFFSET(struct dtype1_struct,i8),H5T_NATIVE_INT)<0) TEST_ERROR - if(H5Tinsert(dtype1_id,"f1",HOFFSET(struct dtype1_struct,f1),H5T_NATIVE_FLOAT)<0) TEST_ERROR + if(H5Tset_size(str_id,(size_t) 10) < 0) TEST_ERROR + + if(H5Tinsert(dtype1_id,"vl_string",HOFFSET(dtype1_struct,str),str_id) < 0) TEST_ERROR + if(H5Tinsert(dtype1_id,"i2",HOFFSET(struct dtype1_struct,i2),H5T_NATIVE_INT) < 0) TEST_ERROR + if(H5Tinsert(dtype1_id,"i3",HOFFSET(struct dtype1_struct,i3),H5T_NATIVE_INT) < 0) TEST_ERROR + if(H5Tinsert(dtype1_id,"i4",HOFFSET(struct dtype1_struct,i4),H5T_NATIVE_INT) < 0) TEST_ERROR + if(H5Tinsert(dtype1_id,"i5",HOFFSET(struct dtype1_struct,i5),H5T_NATIVE_INT) < 0) TEST_ERROR + if(H5Tinsert(dtype1_id,"i6",HOFFSET(struct dtype1_struct,i6),H5T_NATIVE_INT) < 0) TEST_ERROR + if(H5Tinsert(dtype1_id,"i7",HOFFSET(struct dtype1_struct,i7),H5T_NATIVE_INT) < 0) TEST_ERROR + if(H5Tinsert(dtype1_id,"i8",HOFFSET(struct dtype1_struct,i8),H5T_NATIVE_INT) < 0) TEST_ERROR + if(H5Tinsert(dtype1_id,"f1",HOFFSET(struct dtype1_struct,f1),H5T_NATIVE_FLOAT) < 0) TEST_ERROR if(H5Tclose(str_id) < 0) TEST_ERROR @@ -584,21 +584,21 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos /* Create the dataspace and dataset */ dim1[0] = 1; - if((space_id=H5Screate_simple(1,dim1,NULL))<0) TEST_ERROR + if((space_id=H5Screate_simple(1,dim1,NULL)) < 0) TEST_ERROR - if((dset_id = H5Dcreate(file,DSETNAME[0],dtype1_id,space_id,H5P_DEFAULT))<0) TEST_ERROR + if((dset_id = H5Dcreate(file,DSETNAME[0],dtype1_id,space_id,H5P_DEFAULT)) < 0) TEST_ERROR /* Test writing and reading */ - if(H5Dwrite(dset_id,dtype1_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,&wdata)<0) TEST_ERROR + if(H5Dwrite(dset_id,dtype1_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,&wdata) < 0) TEST_ERROR - if(H5Dread(dset_id,dtype1_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,&rdata)<0) TEST_ERROR + if(H5Dread(dset_id,dtype1_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,&rdata) < 0) TEST_ERROR if(rdata.i1!=wdata.i1 || rdata.i2!=wdata.i2 || HDstrcmp(rdata.str, wdata.str)) { H5_FAILED(); AT(); printf("incorrect read data\n"); goto error; } /* end if */ - if(H5Dclose(dset_id)<0) TEST_ERROR + if(H5Dclose(dset_id) < 0) TEST_ERROR /* Close and re-open the file if requested*/ if(test_file_closing) { @@ -606,94 +606,90 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos } /* Create more datasets with the same datatype */ - if((dset_id = H5Dcreate(file,DSETNAME[1],dtype1_id,space_id,H5P_DEFAULT))<0) TEST_ERROR - if(H5Dclose(dset_id)<0) TEST_ERROR + if((dset_id = H5Dcreate(file,DSETNAME[1],dtype1_id,space_id,H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(dset_id) < 0) TEST_ERROR /* Close and re-open the file if requested*/ if(test_file_closing) { if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR } - if((dset_id = H5Dcreate(file,DSETNAME[2],dtype1_id,space_id,H5P_DEFAULT))<0) TEST_ERROR - if(H5Dclose(dset_id)<0) TEST_ERROR + if((dset_id = H5Dcreate(file,DSETNAME[2],dtype1_id,space_id,H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(dset_id) < 0) TEST_ERROR /* Close and re-open the file if requested*/ if(test_file_closing) { if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR } - if((dset_id = H5Dcreate(file,DSETNAME[3],dtype1_id,space_id,H5P_DEFAULT))<0) TEST_ERROR + if((dset_id = H5Dcreate(file,DSETNAME[3],dtype1_id,space_id,H5P_DEFAULT)) < 0) TEST_ERROR /* Write data to dataset 3 for later */ - if(H5Dwrite(dset_id,dtype1_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,&wdata)<0) TEST_ERROR + if(H5Dwrite(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) TEST_ERROR - if(H5Dclose(dset_id)<0) TEST_ERROR - if(H5Tclose(dtype1_id)<0) TEST_ERROR + if(H5Dclose(dset_id) < 0) TEST_ERROR + if(H5Tclose(dtype1_id) < 0) TEST_ERROR /* Close and re-open the file if requested*/ - if(test_file_closing) { + if(test_file_closing) if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR - } /* Make sure the data has been written successfully */ - if((dset_id = H5Dopen(file, DSETNAME[0]))<0) TEST_ERROR - - if((dtype1_id = H5Dget_type(dset_id))<0) TEST_ERROR + if((dset_id = H5Dopen2(file, DSETNAME[0], H5P_DEFAULT)) < 0) TEST_ERROR + if((dtype1_id = H5Dget_type(dset_id)) < 0) TEST_ERROR rdata.i1 = rdata.i2 = 0; - strcpy(rdata.str, "\0"); + HDstrcpy(rdata.str, "\0"); /* Read data back again */ - if(H5Dread(dset_id,dtype1_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,&rdata)<0) { + if(H5Dread(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); printf("Can't read data\n"); goto error; } /* end if */ - if(rdata.i1!=wdata.i1 || rdata.i2!=wdata.i2 || strcmp(rdata.str, wdata.str)) { + if(rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) { H5_FAILED(); AT(); printf("incorrect read data\n"); goto error; } /* end if */ - if(H5Dclose(dset_id)<0) TEST_ERROR + if(H5Dclose(dset_id) < 0) TEST_ERROR /* Create several copies of the dataset (this increases the amount of space saved by sharing the datatype message) */ - for(x=0; x=0); ret=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buffer); assert(ret>=0); diff --git a/test/ttsafe_dcreate.c b/test/ttsafe_dcreate.c index 5ed4181..4faf2bc 100644 --- a/test/ttsafe_dcreate.c +++ b/test/ttsafe_dcreate.c @@ -110,51 +110,51 @@ void tts_dcreate(void) * creation plist and default file access plist */ file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(file>=0); + assert(file >= 0); /* simultaneously create a large number of datasets within the file */ - for (i = 0; i < NUM_THREAD; i++) { + for(i = 0; i < NUM_THREAD; i++) { thread_out[i].id = i; thread_out[i].file = file; thread_out[i].dsetname = dsetname[i]; ret=pthread_create(&threads[i], NULL, tts_dcreate_creator, &thread_out[i]); assert(ret==0); - } + } /* end for */ - for (i = 0;i < NUM_THREAD; i++) { - ret=pthread_join(threads[i], NULL); - assert(ret==0); + for(i = 0;i < NUM_THREAD; i++) { + ret = pthread_join(threads[i], NULL); + assert(ret == 0); } /* end for */ /* compare data to see if it is written correctly */ - for (i = 0; i < NUM_THREAD; i++) { - if ((dataset = H5Dopen(file,dsetname[i])) < 0) { + for(i = 0; i < NUM_THREAD; i++) { + if((dataset = H5Dopen2(file, dsetname[i], H5P_DEFAULT)) < 0) { TestErrPrintf("Dataset name not found - test failed\n"); H5Fclose(file); return; } else { - ret=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue); - assert(ret>=0); + ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue); + assert(ret >= 0); - if (datavalue != i) { + if(datavalue != i) { TestErrPrintf("Wrong value read %d for dataset name %s - test failed\n", datavalue, dsetname[i]); - ret=H5Dclose(dataset); - assert(ret>=0); - ret=H5Fclose(file); - assert(ret>=0); + ret = H5Dclose(dataset); + assert(ret >= 0); + ret = H5Fclose(file); + assert(ret >= 0); return; } - ret=H5Dclose(dataset); - assert(ret>=0); + ret = H5Dclose(dataset); + assert(ret >= 0); } } /* close remaining resources */ - ret=H5Fclose(file); - assert(ret>=0); + ret = H5Fclose(file); + assert(ret >= 0); /* Destroy the thread attribute */ ret=pthread_attr_destroy(&attribute); diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c index 657b68b..3989e73 100644 --- a/test/ttsafe_error.c +++ b/test/ttsafe_error.c @@ -139,8 +139,8 @@ void tts_error(void) if (error_count != NUM_THREAD - 1) TestErrPrintf("Error: %d threads failed instead of %d\n", error_count, NUM_THREAD-1); - dataset = H5Dopen(error_file, DATASETNAME); - assert(dataset>=0); + dataset = H5Dopen2(error_file, DATASETNAME, H5P_DEFAULT); + assert(dataset >= 0); ret=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value); assert(ret>=0); diff --git a/test/tunicode.c b/test/tunicode.c index 6898857..f34e19f 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -413,18 +413,18 @@ void test_objnames(hid_t fid, const char* string) space_id = H5Screate_simple(RANK, &dims, NULL); CHECK(space_id, FAIL, "H5Screate_simple"); - dset_id=H5Dcreate(grp1_id, string, H5T_NATIVE_INT, space_id, H5P_DEFAULT); + dset_id = H5Dcreate(grp1_id, string, H5T_NATIVE_INT, space_id, H5P_DEFAULT); CHECK(dset_id, FAIL, "H5Dcreate"); /* Make sure that dataset can be opened again */ - ret=H5Dclose(dset_id); + ret = H5Dclose(dset_id); CHECK(ret, FAIL, "H5Dclose"); - ret=H5Sclose(space_id); + ret = H5Sclose(space_id); CHECK(ret, FAIL, "H5Sclose"); - dset_id=H5Dopen(grp1_id, string); - CHECK(ret, FAIL, "H5Dopen"); - ret=H5Dclose(dset_id); + dset_id = H5Dopen2(grp1_id, string, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Dopen2"); + ret = H5Dclose(dset_id); CHECK(ret, FAIL, "H5Dclose"); ret = H5Gclose(grp1_id); CHECK(ret, FAIL, "H5Gclose"); diff --git a/test/tvlstr.c b/test/tvlstr.c index c9acba0..b1ba48e 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -728,7 +728,7 @@ static void write_scalar_dset(hid_t file, hid_t type, hid_t space, char *name, c hid_t dset; herr_t ret; - dset = H5Dcreate (file, name, type, space, H5P_DEFAULT); + dset = H5Dcreate(file, name, type, space, H5P_DEFAULT); CHECK(dset, FAIL, "H5Dcreate"); ret = H5Dwrite(dset, type, space, space, H5P_DEFAULT, &data); @@ -745,8 +745,8 @@ static void read_scalar_dset(hid_t file, hid_t type, hid_t space, char *name, ch herr_t ret; char *data_read; - dset = H5Dopen (file, name); - CHECK(dset, FAIL, "H5Dopen"); + dset = H5Dopen2(file, name, H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dopen2"); ret = H5Dread(dset, type, space, space, H5P_DEFAULT, &data_read); CHECK(ret, FAIL, "H5Dread"); diff --git a/test/tvltypes.c b/test/tvltypes.c index ac6e0e5..eeadc45 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -350,7 +350,7 @@ test_vltypes_vlen_atomic(void) TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p); /* Write data to disk */ - ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); CHECK(ret, FAIL, "H5Dwrite"); /* Close Dataset */ @@ -375,8 +375,8 @@ test_vltypes_vlen_atomic(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open a dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get dataspace for datasets */ sid1 = H5Dget_space(dataset); @@ -387,21 +387,21 @@ test_vltypes_vlen_atomic(void) CHECK(tid1, FAIL, "H5Dget_type"); /* Change to the custom memory allocation routines for reading VL data */ - xfer_pid=H5Pcreate(H5P_DATASET_XFER); + xfer_pid = H5Pcreate(H5P_DATASET_XFER); CHECK(xfer_pid, FAIL, "H5Pcreate"); - ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used); + ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used); CHECK(ret, FAIL, "H5Pset_vlen_mem_manager"); /* Make certain the correct amount of memory will be used */ - ret=H5Dvlen_get_buf_size(dataset,tid1,sid1,&size); + ret = H5Dvlen_get_buf_size(dataset, tid1, sid1, &size); CHECK(ret, FAIL, "H5Dvlen_get_buf_size"); /* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */ - VERIFY(size,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(unsigned int),"H5Dvlen_get_buf_size"); + VERIFY(size,((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(unsigned int), "H5Dvlen_get_buf_size"); /* Read dataset from disk */ - ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,xfer_pid,rdata); + ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, xfer_pid, rdata); CHECK(ret, FAIL, "H5Dread"); /* Make certain the correct amount of memory has been used */ @@ -423,11 +423,11 @@ test_vltypes_vlen_atomic(void) } /* end for */ /* Reclaim the read VL data */ - ret=H5Dvlen_reclaim(tid1,sid1,xfer_pid,rdata); + ret = H5Dvlen_reclaim(tid1, sid1, xfer_pid, rdata); CHECK(ret, FAIL, "H5Dvlen_reclaim"); /* Make certain the VL memory has been freed */ - VERIFY(mem_used,0,"H5Dvlen_reclaim"); + VERIFY(mem_used, 0, "H5Dvlen_reclaim"); /* Close Dataset */ ret = H5Dclose(dataset); @@ -447,8 +447,8 @@ test_vltypes_vlen_atomic(void) /* Open second dataset */ - dataset=H5Dopen(fid1,"Dataset2"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset2", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get dataspace for datasets */ sid1 = H5Dget_space(dataset); @@ -463,19 +463,19 @@ test_vltypes_vlen_atomic(void) CHECK(sid2, FAIL, "H5Screate"); /* Change to the custom memory allocation routines for reading VL data */ - xfer_pid=H5Pcreate(H5P_DATASET_XFER); + xfer_pid = H5Pcreate(H5P_DATASET_XFER); CHECK(xfer_pid, FAIL, "H5Pcreate"); - ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used); + ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used); CHECK(ret, FAIL, "H5Pset_vlen_mem_manager"); /* Make certain the correct amount of memory will be used */ - ret=H5Dvlen_get_buf_size(dataset,tid1,sid1,&size); + ret = H5Dvlen_get_buf_size(dataset, tid1, sid1, &size); CHECK(ret, FAIL, "H5Dvlen_get_buf_size"); /* Try to call H5Dvlen_get_buf with bad dataspace */ H5E_BEGIN_TRY { - ret=H5Dvlen_get_buf_size(dataset,tid1,sid2,&size); + ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size); } H5E_END_TRY VERIFY(ret, FAIL, "H5Dvlen_get_buf_size"); @@ -570,11 +570,11 @@ rewrite_vltypes_vlen_atomic(void) MESSAGE(5, ("Check Memory Leak for Basic Atomic VL Datatype Functionality\n")); /* Allocate and initialize VL data to write */ - for(i=0; ilen!=t2->len) { + if(t1->len != t2->len) { TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); continue; } /* end if */ @@ -1329,20 +1329,20 @@ test_vltypes_compound_vlstr(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dset2=H5Dopen(fid1,"Dataset1"); - CHECK(dset2, FAIL, "H5Dopen"); + dset2 = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dset2, FAIL, "H5Dopen2"); /* Get the data type */ tid2 = H5Dget_type(dset2); CHECK(tid2, FAIL, "H5Dget_type"); /* Read dataset from disk */ - ret=H5Dread(dset2,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,rdata); + ret = H5Dread(dset2, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); CHECK(ret, FAIL, "H5Dread"); /* Compare data read in */ - for(i=0; ip=HDmalloc((j+1)*sizeof(unsigned int)); - if(t1->p==NULL) { - TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); + wdata[i].len = i + increment; + for(t1 = wdata[i].p, j = 0; j < (i + increment); j++, t1++) { + t1->p = HDmalloc((j + 1) * sizeof(unsigned int)); + if(t1->p == NULL) { + TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j); return; } /* end if */ - t1->len=j+1; - for(k=0; k<(j+1); k++) - ((unsigned int *)t1->p)[k]=i*1000+j*100+k*10; + t1->len = j + 1; + for(k = 0; k < (j + 1); k++) + ((unsigned int *)t1->p)[k] = i * 1000 + j * 100 + k * 10; } /* end for */ } /* end for */ @@ -2084,8 +2084,8 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get dataspace for datasets */ sid1 = H5Dget_space(dataset); @@ -2096,7 +2096,7 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void) CHECK(tid2, FAIL, "H5Dget_type"); /* Write dataset to disk */ - ret=H5Dwrite(dataset,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + ret = H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); CHECK(ret, FAIL, "H5Dwrite"); /* Close Dataset */ @@ -2121,8 +2121,8 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open a dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get dataspace for datasets */ sid1 = H5Dget_space(dataset); @@ -2133,22 +2133,22 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void) CHECK(tid2, FAIL, "H5Dget_type"); /* Change to the custom memory allocation routines for reading VL data */ - xfer_pid=H5Pcreate(H5P_DATASET_XFER); + xfer_pid = H5Pcreate(H5P_DATASET_XFER); CHECK(xfer_pid, FAIL, "H5Pcreate"); - ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used); + ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used); CHECK(ret, FAIL, "H5Pset_vlen_mem_manager"); /* Make certain the correct amount of memory was used */ - ret=H5Dvlen_get_buf_size(dataset,tid2,sid1,&size); + ret = H5Dvlen_get_buf_size(dataset, tid2, sid1, &size); CHECK(ret, FAIL, "H5Dvlen_get_buf_size"); /* 18 hvl_t elements allocated = 3 + 4 + 5 + 6 elements for each array position */ /* 52 unsigned int elements allocated = 6 + 10 + 15 + 21 elements */ - /*VERIFY(size,18*sizeof(hvl_t)+52*sizeof(unsigned int),"H5Dvlen_get_buf_size");*/ + /*VERIFY(size, 18 * sizeof(hvl_t) + 52 * sizeof(unsigned int), "H5Dvlen_get_buf_size");*/ /* Read dataset from disk */ - ret=H5Dread(dataset,tid2,H5S_ALL,H5S_ALL,xfer_pid,rdata); + ret = H5Dread(dataset, tid2, H5S_ALL, H5S_ALL, xfer_pid, rdata); CHECK(ret, FAIL, "H5Dread"); /* Make certain the correct amount of memory has been used */ @@ -2260,8 +2260,8 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get dataspace for datasets */ sid1 = H5Dget_space(dataset); @@ -2272,7 +2272,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) CHECK(tid2, FAIL, "H5Dget_type"); /* Write dataset to disk */ - ret=H5Dwrite(dataset,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + ret = H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); CHECK(ret, FAIL, "H5Dwrite"); /* Close Dataset */ @@ -2297,8 +2297,8 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) CHECK(fid1, FAIL, "H5Fopen"); /* Open a dataset */ - dataset=H5Dopen(fid1,"Dataset1"); - CHECK(dataset, FAIL, "H5Dopen"); + dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dopen2"); /* Get dataspace for datasets */ sid1 = H5Dget_space(dataset); @@ -2309,19 +2309,19 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) CHECK(tid2, FAIL, "H5Dget_type"); /* Change to the custom memory allocation routines for reading VL data */ - xfer_pid=H5Pcreate(H5P_DATASET_XFER); + xfer_pid = H5Pcreate(H5P_DATASET_XFER); CHECK(xfer_pid, FAIL, "H5Pcreate"); - ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used); + ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used); CHECK(ret, FAIL, "H5Pset_vlen_mem_manager"); /* Make certain the correct amount of memory was used */ - ret=H5Dvlen_get_buf_size(dataset,tid2,sid1,&size); + ret = H5Dvlen_get_buf_size(dataset, tid2, sid1, &size); CHECK(ret, FAIL, "H5Dvlen_get_buf_size"); /* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */ /* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */ - VERIFY(size,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(hvl_t)+vlen_size_func((unsigned long)SPACE1_DIM1)*sizeof(unsigned int),"H5Dvlen_get_buf_size"); + VERIFY(size, ((SPACE1_DIM1*(SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dvlen_get_buf_size"); /* Read dataset from disk */ ret=H5Dread(dataset,tid2,H5S_ALL,H5S_ALL,xfer_pid,rdata); @@ -2709,8 +2709,8 @@ test_vltypes_fill_value(void) } /* end switch */ /* Open first data set */ - dset_id = H5Dopen(file_id, dset_name1); - CHECK(dset_id, FAIL, "H5Dopen"); + dset_id = H5Dopen2(file_id, dset_name1, H5P_DEFAULT); + CHECK(dset_id, FAIL, "H5Dopen2"); /* Read in the entire 'empty' dataset of fill value */ ret = H5Dread(dset_id, dtype1_id, dset_dspace_id, dset_dspace_id, xfer_pid, rbuf); @@ -2774,8 +2774,8 @@ test_vltypes_fill_value(void) /* Open the second data set to check the value of data */ - dset_id = H5Dopen(file_id, dset_name2); - CHECK(dset_id, FAIL, "H5Dopen"); + dset_id = H5Dopen2(file_id, dset_name2, H5P_DEFAULT); + CHECK(dset_id, FAIL, "H5Dopen2"); /* Read in the entire 'empty' dataset of fill value */ ret = H5Dread(dset_id, dtype1_id, dset_dspace_id, dset_dspace_id, xfer_pid, rbuf); @@ -2913,8 +2913,8 @@ test_vltypes_fill_value(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); /* Open first data set */ - dset_id = H5Dopen(file_id, dset_name1); - CHECK(dset_id, FAIL, "H5Dopen"); + dset_id = H5Dopen2(file_id, dset_name1, H5P_DEFAULT); + CHECK(dset_id, FAIL, "H5Dopen2"); /* Write one element in the dataset */ ret = H5Dwrite(dset_id, dtype1_id, scalar_dspace_id, single_dspace_id, xfer_pid, &wdata); @@ -3009,8 +3009,8 @@ test_vltypes_fill_value(void) /* Open the second data set to check the value of data */ - dset_id = H5Dopen(file_id, dset_name2); - CHECK(dset_id, FAIL, "H5Dopen"); + dset_id = H5Dopen2(file_id, dset_name2, H5P_DEFAULT); + CHECK(dset_id, FAIL, "H5Dopen2"); /* Write one element in the dataset */ ret = H5Dwrite(dset_id, dtype1_id, scalar_dspace_id, single_dspace_id, xfer_pid, &wdata); diff --git a/test/unlink.c b/test/unlink.c index fad41ae..1248063 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -1873,7 +1873,7 @@ test_resurrect_dataset(hid_t fapl) if((f = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Attempt to open the dataset under the new name */ - if((d = H5Dopen(f,DATASET2NAME)) < 0) FAIL_STACK_ERROR + if((d = H5Dopen2(f, DATASET2NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close things */ if(H5Dclose(d) < 0) FAIL_STACK_ERROR diff --git a/test/vfd.c b/test/vfd.c index 01d9d98..a8e90c6 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -232,80 +232,77 @@ test_direct(void) /* Initialize the dset1 */ p1 = points; - for (i = n = 0; i < DSET1_DIM1; i++) - for (j = 0; j < DSET1_DIM2; j++) + for(i = n = 0; i < DSET1_DIM1; i++) + for(j = 0; j < DSET1_DIM2; j++) *p1++ = n++; /* Create the data space1 */ dims1[0] = DSET1_DIM1; dims1[1] = DSET1_DIM2; - if ((space1 = H5Screate_simple(2, dims1, NULL)) < 0) + if((space1 = H5Screate_simple(2, dims1, NULL)) < 0) TEST_ERROR; /* Create the dset1 */ - if ((dset1 = H5Dcreate(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT)) < 0) + if((dset1 = H5Dcreate(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT)) < 0) TEST_ERROR; /* Write the data to the dset1 */ - if (H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) + if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR; if(H5Dclose(dset1) < 0) TEST_ERROR; - if((dset1=H5Dopen(file, DSET1_NAME)) < 0) + if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* Read the data back from dset1 */ - if (H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) + if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ p1 = points; p2 = check; - for (i = 0; i < DSET1_DIM1; i++) { - for (j = 0; j < DSET1_DIM2; j++) { - if (*p1++ != *p2++) { + for(i = 0; i < DSET1_DIM1; i++) + for(j = 0; j < DSET1_DIM2; j++) + if(*p1++ != *p2++) { H5_FAILED(); printf(" Read different values than written in data set 1.\n"); printf(" At index %d,%d\n", i, j); TEST_ERROR; - } - } - } + } /* end if */ /* Create the data space2. For data set 2, memory address and data size are not aligned. */ dims2[0] = DSET2_DIM; - if ((space2 = H5Screate_simple(1, dims2, NULL)) < 0) + if((space2 = H5Screate_simple(1, dims2, NULL)) < 0) TEST_ERROR; /* Create the dset2 */ - if ((dset2 = H5Dcreate(file, DSET2_NAME, H5T_NATIVE_INT, space2, H5P_DEFAULT)) < 0) + if((dset2 = H5Dcreate(file, DSET2_NAME, H5T_NATIVE_INT, space2, H5P_DEFAULT)) < 0) TEST_ERROR; /* Write the data to the dset1 */ - if (H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2) < 0) + if(H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2) < 0) TEST_ERROR; if(H5Dclose(dset2) < 0) TEST_ERROR; - if((dset2=H5Dopen(file, DSET2_NAME)) < 0) + if((dset2 = H5Dopen2(file, DSET2_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* Read the data back from dset1 */ - if (H5Dread(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0) + if(H5Dread(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ - for (i = 0; i < DSET2_DIM; i++) { - if (wdata2[i] != rdata2[i]) { + for(i = 0; i < DSET2_DIM; i++) + if(wdata2[i] != rdata2[i]) { H5_FAILED(); printf(" Read different values than written in data set 2.\n"); printf(" At index %d\n", i); TEST_ERROR; - } - } + } /* end if */ if(H5Sclose(space1) < 0) TEST_ERROR; @@ -430,47 +427,45 @@ test_core(void) /* Initialize the dset1 */ p1 = points; - for (i = n = 0; i < DSET1_DIM1; i++) - for (j = 0; j < DSET1_DIM2; j++) + for(i = n = 0; i < DSET1_DIM1; i++) + for(j = 0; j < DSET1_DIM2; j++) *p1++ = n++; /* Create the data space1 */ dims1[0] = DSET1_DIM1; dims1[1] = DSET1_DIM2; - if ((space1 = H5Screate_simple(2, dims1, NULL)) < 0) + if((space1 = H5Screate_simple(2, dims1, NULL)) < 0) TEST_ERROR; /* Create the dset1 */ - if ((dset1 = H5Dcreate(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT)) < 0) + if((dset1 = H5Dcreate(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT)) < 0) TEST_ERROR; /* Write the data to the dset1 */ - if (H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) + if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR; if(H5Dclose(dset1) < 0) TEST_ERROR; - if((dset1=H5Dopen(file, DSET1_NAME)) < 0) + if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* Read the data back from dset1 */ - if (H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) + if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ p1 = points; p2 = check; - for (i = 0; i < DSET1_DIM1; i++) { - for (j = 0; j < DSET1_DIM2; j++) { - if (*p1++ != *p2++) { + for(i = 0; i < DSET1_DIM1; i++) + for(j = 0; j < DSET1_DIM2; j++) + if(*p1++ != *p2++) { H5_FAILED(); printf(" Read different values than written in data set 1.\n"); printf(" At index %d,%d\n", i, j); TEST_ERROR; - } - } - } + } /* end if */ if(H5Dclose(dset1) < 0) TEST_ERROR; @@ -483,46 +478,44 @@ test_core(void) if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0) TEST_ERROR; - if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR; /* Create the dset1 */ - if ((dset1 = H5Dcreate(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT)) < 0) + if((dset1 = H5Dcreate(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT)) < 0) TEST_ERROR; /* Write the data to the dset1 */ - if (H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) + if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR; if(H5Dclose(dset1) < 0) TEST_ERROR; - if((dset1=H5Dopen(file, DSET1_NAME)) < 0) + if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* Reallocate memory for reading buffer. */ if(check) free(check); - check=(int*)malloc(DSET1_DIM1*DSET1_DIM2*sizeof(int)); + check = (int*)malloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)); /* Read the data back from dset1 */ - if (H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) + if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ p1 = points; p2 = check; - for (i = 0; i < DSET1_DIM1; i++) { - for (j = 0; j < DSET1_DIM2; j++) { - if (*p1++ != *p2++) { + for(i = 0; i < DSET1_DIM1; i++) + for(j = 0; j < DSET1_DIM2; j++) + if(*p1++ != *p2++) { H5_FAILED(); printf(" Read different values than written in data set 1.\n"); printf(" At index %d,%d\n", i, j); TEST_ERROR; - } - } - } + } /* end if */ /* Check file size API */ if(H5Fget_filesize(file, &file_size) < 0) diff --git a/testpar/t_chunk_alloc.c b/testpar/t_chunk_alloc.c index 6703687..e496a58 100644 --- a/testpar/t_chunk_alloc.c +++ b/testpar/t_chunk_alloc.c @@ -250,7 +250,7 @@ parallel_access_dataset(const char *filename, int nchunks, access_type action, h /* Open dataset*/ if (*dataset<0){ - *dataset = H5Dopen(*file_id, DATASETNAME); + *dataset = H5Dopen2(*file_id, DATASETNAME, H5P_DEFAULT); VRFY((*dataset >= 0), ""); } @@ -381,7 +381,7 @@ void verify_data(const char *filename, int nchunks, write_type write_pattern, in /* Open dataset*/ if (*dataset<0){ - *dataset = H5Dopen(*file_id, DATASETNAME); + *dataset = H5Dopen2(*file_id, DATASETNAME, H5P_DEFAULT); VRFY((*dataset >= 0), ""); } diff --git a/testpar/t_coll_chunk.c b/testpar/t_coll_chunk.c index 04088b5..46dfff1 100644 --- a/testpar/t_coll_chunk.c +++ b/testpar/t_coll_chunk.c @@ -805,7 +805,7 @@ coll_chunktest(const char* filename, VRFY((status >= 0),""); /* open the collective dataset*/ - dataset = H5Dopen(file, DSET_COLLECTIVE_CHUNK_NAME); + dataset = H5Dopen2(file, DSET_COLLECTIVE_CHUNK_NAME, H5P_DEFAULT); VRFY((dataset >= 0), ""); /* set up dimensions of the slab this process accesses */ diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 4f8de21..2d02cdb 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -419,11 +419,11 @@ dataset_readInd(void) VRFY((ret >= 0), ""); /* open the dataset1 collectively */ - dataset1 = H5Dopen(fid, DATASETNAME1); + dataset1 = H5Dopen2(fid, DATASETNAME1, H5P_DEFAULT); VRFY((dataset1 >= 0), ""); /* open another dataset collectively */ - dataset2 = H5Dopen(fid, DATASETNAME1); + dataset2 = H5Dopen2(fid, DATASETNAME1, H5P_DEFAULT); VRFY((dataset2 >= 0), ""); @@ -932,12 +932,12 @@ dataset_readAll(void) * Open the datasets in it * ------------------------- */ /* open the dataset1 collectively */ - dataset1 = H5Dopen(fid, DATASETNAME1); - VRFY((dataset1 >= 0), "H5Dopen succeeded"); + dataset1 = H5Dopen2(fid, DATASETNAME1, H5P_DEFAULT); + VRFY((dataset1 >= 0), "H5Dopen2 succeeded"); /* open another dataset collectively */ - dataset2 = H5Dopen(fid, DATASETNAME2); - VRFY((dataset2 >= 0), "H5Dopen 2 succeeded"); + dataset2 = H5Dopen2(fid, DATASETNAME2, H5P_DEFAULT); + VRFY((dataset2 >= 0), "H5Dopen2 2 succeeded"); /* * Set up dimensions of the slab this process accesses. @@ -1558,11 +1558,11 @@ extend_readInd(void) VRFY((ret >= 0), ""); /* open the dataset1 collectively */ - dataset1 = H5Dopen(fid, DATASETNAME1); + dataset1 = H5Dopen2(fid, DATASETNAME1, H5P_DEFAULT); VRFY((dataset1 >= 0), ""); /* open another dataset collectively */ - dataset2 = H5Dopen(fid, DATASETNAME1); + dataset2 = H5Dopen2(fid, DATASETNAME1, H5P_DEFAULT); VRFY((dataset2 >= 0), ""); /* Try extend dataset1 which is open RDONLY. Should fail. */ @@ -1990,11 +1990,11 @@ extend_readAll(void) VRFY((ret >= 0), ""); /* open the dataset1 collectively */ - dataset1 = H5Dopen(fid, DATASETNAME1); + dataset1 = H5Dopen2(fid, DATASETNAME1, H5P_DEFAULT); VRFY((dataset1 >= 0), ""); /* open another dataset collectively */ - dataset2 = H5Dopen(fid, DATASETNAME1); + dataset2 = H5Dopen2(fid, DATASETNAME1, H5P_DEFAULT); VRFY((dataset2 >= 0), ""); /* Try extend dataset1 which is open RDONLY. Should fail. */ @@ -2236,8 +2236,8 @@ compress_readAll(void) /* Open dataset with compressed chunks */ - dataset = H5Dopen(fid, "compressed_data"); - VRFY((dataset > 0), "H5Dopen succeeded"); + dataset = H5Dopen2(fid, "compressed_data", H5P_DEFAULT); + VRFY((dataset > 0), "H5Dopen2 succeeded"); /* Try reading & writing data */ if(dataset>0) { diff --git a/testpar/t_filter_read.c b/testpar/t_filter_read.c index 1e76c46..e255c73 100644 --- a/testpar/t_filter_read.c +++ b/testpar/t_filter_read.c @@ -138,8 +138,8 @@ filter_read_internal(const char *filename, hid_t dcpl, file = H5Fopen(filename, H5F_ACC_RDWR, access_plist); VRFY((file >= 0), "H5Fopen"); - dataset = H5Dopen (file, name); - VRFY((dataset >= 0), "H5Dopen"); + dataset = H5Dopen2(file, name, H5P_DEFAULT); + VRFY((dataset >= 0), "H5Dopen2"); hrc = H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL); VRFY(hrc>=0, "H5Sselect_hyperslab"); diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index 0a7a1a8..2fb2aef 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -260,8 +260,8 @@ void compact_dataset(void) } - dataset = H5Dopen(iof, dname); - VRFY((dataset >= 0), "H5Dcreate succeeded"); + dataset = H5Dopen2(iof, dname, H5P_DEFAULT); + VRFY((dataset >= 0), "H5Dopen2 succeeded"); ret = H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, dxpl, inme); VRFY((ret >= 0), "H5Dread succeeded"); @@ -371,8 +371,8 @@ void null_dataset(void) } - dataset = H5Dopen(iof, dname); - VRFY((dataset >= 0), "H5Dcreate succeeded"); + dataset = H5Dopen2(iof, dname, H5P_DEFAULT); + VRFY((dataset >= 0), "H5Dopen2 succeeded"); /* Try reading from the dataset (make certain our buffer is unmodified) */ ret = H5Dread(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, dxpl, &uval); @@ -898,7 +898,7 @@ void group_dataset_read(hid_t fid, int mpi_rank, int m) /* check the data. */ sprintf(dname, "dataset%d", m); - did = H5Dopen(gid, dname); + did = H5Dopen2(gid, dname, H5P_DEFAULT); VRFY((did>0), dname); H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, indata); @@ -1226,7 +1226,7 @@ int read_dataset(hid_t memspace, hid_t filespace, hid_t gid) for(n=0; n0), dname); H5Dread(did, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, diff --git a/testpar/t_pflush2.c b/testpar/t_pflush2.c index 2839cf8..4ca6a96 100644 --- a/testpar/t_pflush2.c +++ b/testpar/t_pflush2.c @@ -58,17 +58,17 @@ int check_file(char* name, hid_t fapl) plist = H5Pcreate(H5P_DATASET_XFER); H5Pset_dxpl_mpio(plist, H5FD_MPIO_COLLECTIVE); - if ((file=H5Fopen(name, H5F_ACC_RDONLY, fapl))<0) goto error; + if((file = H5Fopen(name, H5F_ACC_RDONLY, fapl)) < 0) goto error; /* Open the dataset */ - if ((dset=H5Dopen(file, "dset"))<0) goto error; - if ((space=H5Dget_space(dset))<0) goto error; - if (H5Sget_simple_extent_dims(space, ds_size, NULL)<0) goto error; + if((dset = H5Dopen2(file, "dset", H5P_DEFAULT)) < 0) goto error; + if((space = H5Dget_space(dset)) < 0) goto error; + if(H5Sget_simple_extent_dims(space, ds_size, NULL) < 0) goto error; assert(100==ds_size[0] && 100==ds_size[1]); /* Read some data */ if (H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, plist, - the_data)<0) goto error; + the_data) < 0) goto error; for (i=0; i= 0),"H5Dopen succeeded"); + datasetc = H5Dopen2(file,"collect_write", H5P_DEFAULT); + VRFY((datasetc >= 0),"H5Dopen2 succeeded"); - dataseti = H5Dopen(file,"independ_write"); - VRFY((dataseti >= 0),"H5Dopen succeeded"); + dataseti = H5Dopen2(file,"independ_write", H5P_DEFAULT); + VRFY((dataseti >= 0),"H5Dopen2 succeeded"); /* * Get dataspace of the open dataset. @@ -760,8 +760,8 @@ void coll_read_test(int chunk_factor) /* * Open the dataset. */ - dataseti = H5Dopen(file,"independ_write"); - VRFY((dataseti >= 0),"H5Dopen succeeded"); + dataseti = H5Dopen2(file,"independ_write", H5P_DEFAULT); + VRFY((dataseti >= 0),"H5Dopen2 succeeded"); /* * Get dataspace of the open dataset. diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index d9a1506..8ca611b 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -1433,7 +1433,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED break; case H5O_TYPE_DATASET: - if((obj = H5Dopen(group, name)) >= 0) { + if((obj = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) { if(oinfo.rc > 1) { obj_t *found_obj; /* Found object */ @@ -1843,8 +1843,7 @@ dump_group(hid_t gid, const char *name) d_status = EXIT_FAILURE; } - if(H5Pclose(gcpl_id) < 0) - { + if(H5Pclose(gcpl_id) < 0) { error_msg(progname, "error in closing group creation property list ID\n"); d_status = EXIT_FAILURE; } @@ -1856,20 +1855,18 @@ dump_group(hid_t gid, const char *name) begin_obj(dump_header_format->groupbegin, name, dump_header_format->groupblockbegin); indent += COL; - if (display_oid) + if(display_oid) dump_oid(gid); dump_comment(gid); - if (!HDstrcmp(name, "/") && unamedtype) - { + if(!HDstrcmp(name, "/") && unamedtype) { unsigned u; /* Local index variable */ /* dump unamed type in root group */ - for (u = 0; u < type_table->nobjs; u++) - if (!type_table->objs[u].recorded) - { - dset = H5Dopen(gid, type_table->objs[u].objname); + for(u = 0; u < type_table->nobjs; u++) + if(!type_table->objs[u].recorded) { + dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); type = H5Dget_type(dset); sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); dump_function_table->dump_named_datatype_function(type, type_name); @@ -1880,26 +1877,22 @@ dump_group(hid_t gid, const char *name) H5Oget_info(gid, ".", &oinfo, H5P_DEFAULT); - if(oinfo.rc > 1) - { + if(oinfo.rc > 1) { obj_t *found_obj; /* Found object */ found_obj = search_obj(group_table, oinfo.addr); - if (found_obj == NULL) - { + if (found_obj == NULL) { indentation(indent); error_msg(progname, "internal error (file %s:line %d)\n", __FILE__, __LINE__); d_status = EXIT_FAILURE; } - else if (found_obj->displayed) - { + else if (found_obj->displayed) { indentation(indent); printf("%s \"%s\"\n", HARDLINK, found_obj->objname); } - else - { + else { found_obj->displayed = TRUE; /* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set in the group for attributes, then, sort by creation order, otherwise by name */ @@ -3153,7 +3146,7 @@ handle_datasets(hid_t fid, char *dset, void *data) hid_t dsetid; struct subset_t *sset = (struct subset_t *)data; - if ((dsetid = H5Dopen(fid, dset)) < 0) { + if((dsetid = H5Dopen2(fid, dset, H5P_DEFAULT)) < 0) { begin_obj(dump_header_format->datasetbegin, dset, dump_header_format->datasetblockbegin); indentation(COL); @@ -3162,20 +3155,20 @@ handle_datasets(hid_t fid, char *dset, void *data) dump_header_format->datasetblockend); d_status = EXIT_FAILURE; return; - } + } /* end if */ - if (sset) { - if (!sset->start || !sset->stride || !sset->count || !sset->block) { + if(sset) { + if(!sset->start || !sset->stride || !sset->count || !sset->block) { /* they didn't specify a ``stride'' or ``block''. default to 1 in all * dimensions */ hid_t sid = H5Dget_space(dsetid); unsigned int ndims = H5Sget_simple_extent_ndims(sid); - if (!sset->start) + if(!sset->start) /* default to (0, 0, ...) for the start coord */ sset->start = calloc(ndims, sizeof(hsize_t)); - if (!sset->stride) { + if(!sset->stride) { unsigned int i; sset->stride = calloc(ndims, sizeof(hsize_t)); @@ -3419,7 +3412,7 @@ handle_datatypes(hid_t fid, char *type, void UNUSED * data) idx++; } /* end while */ - if(idx == type_table->nobjs) { + if(idx == type_table->nobjs) { /* unknown type */ begin_obj(dump_header_format->datatypebegin, type, dump_header_format->datatypeblockbegin); @@ -3429,7 +3422,7 @@ handle_datatypes(hid_t fid, char *type, void UNUSED * data) dump_header_format->datatypeblockend); d_status = EXIT_FAILURE; } else { - hid_t dsetid = H5Dopen(fid, type_table->objs[idx].objname); + hid_t dsetid = H5Dopen2(fid, type_table->objs[idx].objname, H5P_DEFAULT); type_id = H5Dget_type(dsetid); dump_named_datatype(type_id, type); H5Tclose(type_id); @@ -5371,7 +5364,7 @@ xml_dump_group(hid_t gid, const char *name) /* Very special case: dump unamed type in root group */ for(u = 0; u < type_table->nobjs; u++) { if(!type_table->objs[u].recorded) { - dset = H5Dopen(gid, type_table->objs[u].objname); + dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); type = H5Dget_type(dset); sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); dump_function_table->dump_named_datatype_function(type, type_name); @@ -5425,7 +5418,7 @@ xml_dump_group(hid_t gid, const char *name) /* Very special case: dump unamed type in root group */ for(u = 0; u < type_table->nobjs; u++) { if(!type_table->objs[u].recorded) { - dset = H5Dopen(gid, type_table->objs[u].objname); + dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); type = H5Dget_type(dset); sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); dump_function_table->dump_named_datatype_function(type, type_name); diff --git a/tools/h5repack/Makefile.am b/tools/h5repack/Makefile.am index a0fcdcc..e053e83 100644 --- a/tools/h5repack/Makefile.am +++ b/tools/h5repack/Makefile.am @@ -40,8 +40,8 @@ bin_PROGRAMS=h5repack LDADD=$(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5) # Source files -COMMON_SOURCES=h5repack.c h5repack_copy.c h5repack_refs.c h5repack_filters.c \ - h5repack_list.c h5repack_opttable.c h5repack_parse.c \ +COMMON_SOURCES=h5repack.c h5repack_copy.c h5repack_filters.c \ + h5repack_list.c h5repack_opttable.c h5repack_parse.c h5repack_refs.c \ h5repack_verify.c h5repack_SOURCES=$(COMMON_SOURCES) h5repack_main.c diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 4a84ea6..fcb0854 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -417,16 +417,16 @@ int do_copy_objects(hid_t fidin, * copy attrs *------------------------------------------------------------------------- */ - if (copy_attr(grp_in,grp_out,options) < 0) + if(copy_attr(grp_in,grp_out,options) < 0) goto error; - if (gcpl_id>0) { - if (H5Pclose(gcpl_id) < 0) + if(gcpl_id > 0) { + if(H5Pclose(gcpl_id) < 0) goto error; } - if (H5Gclose(grp_out) < 0) + if(H5Gclose(grp_out) < 0) goto error; - if (H5Gclose(grp_in) < 0) + if(H5Gclose(grp_in) < 0) goto error; break; @@ -440,15 +440,15 @@ int do_copy_objects(hid_t fidin, has_filter = 0; /* early detection of references */ - if ((dset_in=H5Dopen(fidin,travt->objs[i].name)) < 0) + if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) goto error; - if ((ftype_id=H5Dget_type (dset_in)) < 0) + if((ftype_id = H5Dget_type(dset_in)) < 0) goto error; - if (H5T_REFERENCE==H5Tget_class(ftype_id)) - is_ref=1; - if (H5Tclose(ftype_id) < 0) + if(H5T_REFERENCE == H5Tget_class(ftype_id)) + is_ref = 1; + if(H5Tclose(ftype_id) < 0) goto error; - if (H5Dclose(dset_in) < 0) + if(H5Dclose(dset_in) < 0) goto error; @@ -458,39 +458,35 @@ int do_copy_objects(hid_t fidin, * otherwise we do a copy using H5Ocopy *------------------------------------------------------------------------- */ - if (options->op_tbl->nelems - || - options->all_filter==1 || options->all_layout==1 - || is_ref - ) - { + if(options->op_tbl->nelems || options->all_filter == 1 + || options->all_layout == 1 || is_ref) { int j; - if ((dset_in=H5Dopen(fidin,travt->objs[i].name)) < 0) + if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) goto error; - if ((f_space_id=H5Dget_space(dset_in)) < 0) + if((f_space_id = H5Dget_space(dset_in)) < 0) goto error; - if ((ftype_id=H5Dget_type (dset_in)) < 0) + if((ftype_id = H5Dget_type(dset_in)) < 0) goto error; - if ((dcpl_id=H5Dget_create_plist(dset_in)) < 0) + if((dcpl_id = H5Dget_create_plist(dset_in)) < 0) goto error; - if ((dcpl_out = H5Pcopy (dcpl_id)) < 0) + if((dcpl_out = H5Pcopy(dcpl_id)) < 0) goto error; - if ( (rank=H5Sget_simple_extent_ndims(f_space_id)) < 0) + if((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0) goto error; HDmemset(dims, 0, sizeof dims); - if ( H5Sget_simple_extent_dims(f_space_id,dims,NULL) < 0) + if(H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0) goto error; - nelmts=1; - for (j=0; juse_native==1) + if(options->use_native == 1) wtype_id = h5tools_get_native_type(ftype_id); else wtype_id = H5Tcopy(ftype_id); - if ((msize=H5Tget_size(wtype_id))==0) + if((msize = H5Tget_size(wtype_id)) == 0) goto error; /*------------------------------------------------------------------------- @@ -743,7 +739,7 @@ int do_copy_objects(hid_t fidin, *------------------------------------------------------------------------- */ - if (H5Ocopy(fidin, /* Source file or group identifier */ + if(H5Ocopy(fidin, /* Source file or group identifier */ travt->objs[i].name, /* Name of the source object to be copied */ fidout, /* Destination file or group identifier */ travt->objs[i].name, /* Name of the destination object */ @@ -752,7 +748,7 @@ int do_copy_objects(hid_t fidin, goto error; /* close property */ - if (H5Pclose(pid) < 0) + if(H5Pclose(pid) < 0) goto error; @@ -760,15 +756,15 @@ int do_copy_objects(hid_t fidin, * copy attrs manually *------------------------------------------------------------------------- */ - if ((dset_in=H5Dopen(fidin,travt->objs[i].name)) < 0) + if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) goto error; - if ((dset_out=H5Dopen(fidout,travt->objs[i].name)) < 0) + if((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) goto error; - if (copy_attr(dset_in,dset_out,options) < 0) + if(copy_attr(dset_in, dset_out, options) < 0) goto error; - if (H5Dclose(dset_in) < 0) + if(H5Dclose(dset_in) < 0) goto error; - if (H5Dclose(dset_out) < 0) + if(H5Dclose(dset_out) < 0) goto error; } /* end do we have request for filter/chunking */ diff --git a/tools/h5repack/h5repack_list.c b/tools/h5repack/h5repack_list.c index 4bbfd59..4e1e072 100644 --- a/tools/h5repack/h5repack_list.c +++ b/tools/h5repack/h5repack_list.c @@ -43,17 +43,17 @@ int check_objects(const char* fname, { hid_t fid; unsigned int i; - trav_table_t *travt=NULL; + trav_table_t *travt = NULL; /* nothing to do */ - if (options->op_tbl->nelems==0) + if(options->op_tbl->nelems == 0) return 0; /*------------------------------------------------------------------------- * open the file *------------------------------------------------------------------------- */ - if ((fid=h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0))<0){ + if((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0)) < 0){ printf("<%s>: %s\n", fname, H5FOPENERROR ); return -1; } @@ -67,7 +67,7 @@ int check_objects(const char* fname, trav_table_init(&travt); /* get the list of objects in the file */ - if (h5trav_gettable(fid,travt)<0) + if(h5trav_gettable(fid, travt) < 0) goto out; /*------------------------------------------------------------------------- @@ -75,80 +75,66 @@ int check_objects(const char* fname, *------------------------------------------------------------------------- */ - if (options->verbose) - { - printf("Opening file <%s>. Searching for objects to modify...\n",fname); - } + if(options->verbose) + printf("Opening file <%s>. Searching for objects to modify...\n", fname); - for ( i = 0; i < options->op_tbl->nelems; i++) - { + for(i = 0; i < options->op_tbl->nelems; i++) { char* name=options->op_tbl->objs[i].path; - if (options->verbose) + if(options->verbose) printf(" <%s>",name); /* the input object names are present in the file and are valid */ - if (h5trav_getindext(name,travt)<0) - { + if(h5trav_getindext(name, travt) < 0) { error_msg(progname, "%s Could not find <%s> in file <%s>. Exiting...\n", (options->verbose?"\n":""),name,fname); goto out; } - if (options->verbose) + if(options->verbose) printf("...Found\n"); - - + /* check for extra filter conditions */ - switch (options->op_tbl->objs[i].filter->filtn) - { - + switch(options->op_tbl->objs[i].filter->filtn) { /* chunk size must be smaller than pixels per block */ - case H5Z_FILTER_SZIP: + case H5Z_FILTER_SZIP: { int j; - int csize=1; - int ppb=options->op_tbl->objs[i].filter->cd_values[0]; + int csize = 1; + int ppb = options->op_tbl->objs[i].filter->cd_values[0]; hsize_t dims[H5S_MAX_RANK]; int rank; hid_t did; hid_t sid; - if (options->op_tbl->objs[i].chunk.rank>0) - { - rank=options->op_tbl->objs[i].chunk.rank; - for (j=0; jop_tbl->objs[i].chunk.chunk_lengths[j]; + if(options->op_tbl->objs[i].chunk.rank > 0) { + rank = options->op_tbl->objs[i].chunk.rank; + for(j = 0; j < rank; j++) + csize *= (int)options->op_tbl->objs[i].chunk.chunk_lengths[j]; } - else - { - if ((did=H5Dopen(fid,name))<0) + else { + if((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) goto out; - if ((sid=H5Dget_space(did))<0) + if((sid = H5Dget_space(did)) < 0) goto out; - if ( (rank=H5Sget_simple_extent_ndims(sid))<0) + if((rank = H5Sget_simple_extent_ndims(sid)) < 0) goto out; HDmemset(dims, 0, sizeof dims); - if ( H5Sget_simple_extent_dims(sid,dims,NULL)<0) + if(H5Sget_simple_extent_dims(sid, dims, NULL) < 0) goto out; - for (j=0; j\n"); goto out; } - - } break; - } - } /* i */ /*------------------------------------------------------------------------- diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index 1f078c3..a1e9fb5 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -112,17 +112,17 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ case H5TRAV_TYPE_DATASET: - if((dset_in = H5Dopen(fidin,travt->objs[i].name)) < 0) + if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) goto error; if((space_id = H5Dget_space(dset_in)) < 0) goto error; - if((ftype_id = H5Dget_type (dset_in)) < 0) + if((ftype_id = H5Dget_type(dset_in)) < 0) goto error; if((dcpl_id = H5Dget_create_plist(dset_in)) < 0) goto error; if((rank = H5Sget_simple_extent_ndims(space_id)) < 0) goto error; - if(H5Sget_simple_extent_dims(space_id,dims,NULL) < 0) + if(H5Sget_simple_extent_dims(space_id, dims, NULL) < 0) goto error; nelmts = 1; for(k = 0; k < rank; k++) @@ -299,7 +299,7 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ else { - if((dset_out = H5Dopen(fidout,travt->objs[i].name)) < 0) + if((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) goto error; } /* end else */ @@ -388,9 +388,9 @@ error: * * Purpose: duplicate all referenced HDF5 located in attributes * relative to LOC_IN, which is obtained either from - * loc_id = H5Gopen2( fid, name, H5P_DEFAULT); - * loc_id = H5Dopen( fid, name); - * loc_id = H5Topen2( fid, name, H5P_DEFAULT); + * loc_id = H5Gopen2(fid, name, H5P_DEFAULT); + * loc_id = H5Dopen2(fid, name, H5P_DEFAULT); + * loc_id = H5Topen2(fid, name, H5P_DEFAULT); * * Return: 0, ok, -1 no * diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index 04b856f..e87d318 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -52,7 +52,7 @@ has_filter(hid_t dcpl_id, H5Z_filter_t filtnin) return 1; /* get information about filters */ - if ((nfilters = H5Pget_nfilters(dcpl_id))<0) + if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) return -1; /* if we do not have filters and the requested filter is NONE, return 1 */ @@ -122,7 +122,7 @@ int has_layout(hid_t dcpl_id, return 1; /* check if we have filters in the input object */ - if ((nfilters = H5Pget_nfilters(dcpl_id))<0) + if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) return -1; /* a non chunked layout was requested on a filtered object; avoid the test */ @@ -130,7 +130,7 @@ int has_layout(hid_t dcpl_id, return 1; /* get layout */ - if ((layout = H5Pget_layout(dcpl_id))<0) + if ((layout = H5Pget_layout(dcpl_id)) < 0) return -1; if (obj->layout != layout) @@ -138,7 +138,7 @@ int has_layout(hid_t dcpl_id, if (layout==H5D_CHUNKED) { - if ((rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize/*out*/))<0) + if ((rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize/*out*/)) < 0) return -1; if (obj->chunk.rank != rank) return 0; @@ -170,60 +170,58 @@ int h5repack_verify(const char *fname, pack_opt_t *options) { hid_t fid; /* file ID */ - hid_t dset_id=-1; /* dataset ID */ - hid_t dcpl_id=-1; /* dataset creation property list ID */ - hid_t space_id=-1; /* space ID */ - int ret=1; + hid_t dset_id = -1; /* dataset ID */ + hid_t dcpl_id = -1; /* dataset creation property list ID */ + hid_t space_id = -1; /* space ID */ + int ret = 1; unsigned int i; int j; - trav_table_t *travt=NULL; + trav_table_t *travt = NULL; /* open the file */ - if ((fid=H5Fopen(fname,H5F_ACC_RDONLY,H5P_DEFAULT))<0 ) + if((fid = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 ) return -1; - for ( i=0; iop_tbl->nelems; i++) - { - char* name=options->op_tbl->objs[i].path; + for(i = 0; i < options->op_tbl->nelems; i++) { + char* name = options->op_tbl->objs[i].path; pack_info_t *obj = &options->op_tbl->objs[i]; /*------------------------------------------------------------------------- * open *------------------------------------------------------------------------- */ - if ((dset_id=H5Dopen(fid,name))<0) + if((dset_id = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) goto error; - if ((space_id=H5Dget_space(dset_id))<0) + if((space_id = H5Dget_space(dset_id)) < 0) goto error; - if ((dcpl_id=H5Dget_create_plist(dset_id))<0) + if((dcpl_id = H5Dget_create_plist(dset_id)) < 0) goto error; /*------------------------------------------------------------------------- * filter check *------------------------------------------------------------------------- */ - for ( j=0; jnfilters; j++) - { - if (has_filter(dcpl_id,obj->filter[j].filtn)==0) - ret=0; + for(j = 0; j < obj->nfilters; j++) { + if(has_filter(dcpl_id, obj->filter[j].filtn) == 0) + ret = 0; } /*------------------------------------------------------------------------- * layout check *------------------------------------------------------------------------- */ - if ((obj->layout!=-1) && (has_layout(dcpl_id,obj)==0)) - ret=0; + if((obj->layout != -1) && (has_layout(dcpl_id, obj) == 0)) + ret = 0; /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ - if (H5Pclose(dcpl_id)<0) + if(H5Pclose(dcpl_id) < 0) goto error; - if (H5Sclose(space_id)<0) + if (H5Sclose(space_id) < 0) goto error; - if (H5Dclose(dset_id)<0) + if (H5Dclose(dset_id) < 0) goto error; } @@ -234,53 +232,50 @@ int h5repack_verify(const char *fname, *------------------------------------------------------------------------- */ - if (options->all_filter==1 || options->all_layout==1) - { + if(options->all_filter == 1 || options->all_layout == 1) { /* init table */ trav_table_init(&travt); /* get the list of objects in the file */ - if (h5trav_gettable(fid,travt)<0) + if(h5trav_gettable(fid, travt) < 0) goto error; - for ( i=0; inobjs; i++) - { - char* name=travt->objs[i].name; + for(i = 0; i < travt->nobjs; i++) { + char *name = travt->objs[i].name; - if ( travt->objs[i].type == H5TRAV_TYPE_DATASET) { + if(travt->objs[i].type == H5TRAV_TYPE_DATASET) { /*------------------------------------------------------------------------- * open *------------------------------------------------------------------------- */ - if ((dset_id=H5Dopen(fid,name))<0) + if((dset_id = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) goto error; - if ((space_id=H5Dget_space(dset_id))<0) + if((space_id = H5Dget_space(dset_id)) < 0) goto error; - if ((dcpl_id=H5Dget_create_plist(dset_id))<0) + if((dcpl_id = H5Dget_create_plist(dset_id)) < 0) goto error; /*------------------------------------------------------------------------- * filter check *------------------------------------------------------------------------- */ - if (options->all_filter==1 ){ - if (has_filter(dcpl_id,options->filter_g.filtn)==0) - ret=0; - } + if(options->all_filter == 1) + if(has_filter(dcpl_id, options->filter_g.filtn) == 0) + ret = 0; /*------------------------------------------------------------------------- * layout check *------------------------------------------------------------------------- */ - if (options->all_layout==1){ + if(options->all_layout == 1) { pack_info_t pack; init_packobject(&pack); - pack.layout=options->layout_g; - pack.chunk=options->chunk_g; - if (has_layout(dcpl_id,&pack)==0) - ret=0; + pack.layout = options->layout_g; + pack.chunk = options->chunk_g; + if(has_layout(dcpl_id, &pack) == 0) + ret = 0; } @@ -288,11 +283,11 @@ int h5repack_verify(const char *fname, * close *------------------------------------------------------------------------- */ - if (H5Pclose(dcpl_id)<0) + if (H5Pclose(dcpl_id) < 0) goto error; - if (H5Sclose(space_id)<0) + if (H5Sclose(space_id) < 0) goto error; - if (H5Dclose(dset_id)<0) + if (H5Dclose(dset_id) < 0) goto error; } /* if */ @@ -307,7 +302,7 @@ int h5repack_verify(const char *fname, *------------------------------------------------------------------------- */ - if (H5Fclose(fid)<0) + if (H5Fclose(fid) < 0) return -1; return ret; @@ -363,12 +358,12 @@ int h5repack_cmpdcpl(const char *fname1, H5E_BEGIN_TRY { /* Open the files */ - if ((fid1=H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT))<0 ) + if ((fid1=H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 ) { error_msg(progname, "<%s>: %s\n", fname1, H5FOPENERROR ); return -1; } - if ((fid2=H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT))<0 ) + if ((fid2=H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 ) { error_msg(progname, "<%s>: %s\n", fname2, H5FOPENERROR ); H5Fclose(fid1); @@ -383,9 +378,9 @@ int h5repack_cmpdcpl(const char *fname1, */ trav_table_init(&travt1); trav_table_init(&travt2); - if (h5trav_gettable(fid1,travt1)<0) + if(h5trav_gettable(fid1, travt1) < 0) goto error; - if (h5trav_gettable(fid2,travt2)<0) + if(h5trav_gettable(fid2, travt2) < 0) goto error; @@ -394,27 +389,25 @@ int h5repack_cmpdcpl(const char *fname1, *------------------------------------------------------------------------- */ - for ( i=0; i < travt1->nobjs; i++) - { - if ( travt1->objs[i].type == H5TRAV_TYPE_DATASET) { - if ((dset1=H5Dopen(fid1,travt1->objs[i].name))<0) + for(i = 0; i < travt1->nobjs; i++) { + if(travt1->objs[i].type == H5TRAV_TYPE_DATASET) { + if((dset1 = H5Dopen2(fid1, travt1->objs[i].name, H5P_DEFAULT)) < 0) goto error; - if ((dset2=H5Dopen(fid2,travt1->objs[i].name))<0) + if((dset2 = H5Dopen2(fid2, travt1->objs[i].name, H5P_DEFAULT)) < 0) goto error; - if ((dcpl1=H5Dget_create_plist(dset1))<0) + if((dcpl1 = H5Dget_create_plist(dset1)) < 0) goto error; - if ((dcpl2=H5Dget_create_plist(dset2))<0) + if((dcpl2 = H5Dget_create_plist(dset2)) < 0) goto error; /*------------------------------------------------------------------------- * compare the property lists *------------------------------------------------------------------------- */ - if ((ret=H5Pequal(dcpl1,dcpl2))<0) + if((ret = H5Pequal(dcpl1, dcpl2)) < 0) goto error; - if (ret==0) - { + if(ret == 0) { error_msg(progname, "property lists for <%s> are different\n",travt1->objs[i].name); goto error; } @@ -423,13 +416,13 @@ int h5repack_cmpdcpl(const char *fname1, * close *------------------------------------------------------------------------- */ - if (H5Pclose(dcpl1)<0) + if(H5Pclose(dcpl1) < 0) goto error; - if (H5Pclose(dcpl2)<0) + if(H5Pclose(dcpl2) < 0) goto error; - if (H5Dclose(dset1)<0) + if(H5Dclose(dset1) < 0) goto error; - if (H5Dclose(dset2)<0) + if(H5Dclose(dset2) < 0) goto error; } /*if*/ } /*i*/ diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index 0f5f0a5..ed6c6c4 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -575,7 +575,7 @@ dataset_stats(hid_t group, const char *name, const H5O_info_t *oi, iter_t *iter) iter->dset_ohdr_info.total_size += oi->hdr.space.total; iter->dset_ohdr_info.free_size += oi->hdr.space.free; - did = H5Dopen(group, name); + did = H5Dopen2(group, name, H5P_DEFAULT); assert(did > 0); /* Update dataset metadata info */ diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index e94c723..dfea49f 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -22,9 +22,9 @@ * * Purpose: compare attributes located in LOC1_ID and LOC2_ID, which are * obtained either from - * loc_id = H5Gopen2( fid, name, H5P_DEFAULT); - * loc_id = H5Dopen( fid, name); - * loc_id = H5Topen2( fid, name, H5P_DEFAULT); + * loc_id = H5Gopen2(fid, name, H5P_DEFAULT); + * loc_id = H5Dopen2(fid, name); + * loc_id = H5Topen2(fid, name, H5P_DEFAULT); * * Return: number of differences found * diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index d3a7078..ea833db 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -65,11 +65,11 @@ hsize_t diff_dataset( hid_t file1_id, const char *obj2_name, diff_opt_t *options) { - hid_t did1=-1; - hid_t did2=-1; - hid_t dcpl1=-1; - hid_t dcpl2=-1; - hsize_t nfound=0; + hid_t did1 = -1; + hid_t did2 = -1; + hid_t dcpl1 = -1; + hid_t dcpl2 = -1; + hsize_t nfound = 0; /*------------------------------------------------------------------------- * open the handles @@ -78,23 +78,21 @@ hsize_t diff_dataset( hid_t file1_id, /* disable error reporting */ H5E_BEGIN_TRY { /* Open the datasets */ - if ( (did1 = H5Dopen(file1_id,obj1_name)) < 0 ) - { - printf("Cannot open dataset <%s>\n", obj1_name ); + if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0) { + printf("Cannot open dataset <%s>\n", obj1_name); goto error; } - if ( (did2 = H5Dopen(file2_id,obj2_name)) < 0 ) - { - printf("Cannot open dataset <%s>\n", obj2_name ); + if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0) { + printf("Cannot open dataset <%s>\n", obj2_name); goto error; } /* enable error reporting */ } H5E_END_TRY; - if ((dcpl1=H5Dget_create_plist(did1))<0) + if((dcpl1 = H5Dget_create_plist(did1)) < 0) goto error; - if ((dcpl2=H5Dget_create_plist(did2))<0) + if((dcpl2 = H5Dget_create_plist(did2)) < 0) goto error; /*------------------------------------------------------------------------- @@ -315,10 +313,10 @@ hsize_t diff_datasetid( hid_t did1, * memory type and sizes *------------------------------------------------------------------------- */ - if ((m_tid1=h5tools_get_native_type(f_tid1))<0) + if ((m_tid1=h5tools_get_native_type(f_tid1)) < 0) goto error; - if ((m_tid2=h5tools_get_native_type(f_tid2))<0) + if ((m_tid2=h5tools_get_native_type(f_tid2)) < 0) goto error; m_size1 = H5Tget_size( m_tid1 ); @@ -378,7 +376,7 @@ hsize_t diff_datasetid( hid_t did1, { H5Tclose(m_tid1); - if ((m_tid1=h5tools_get_native_type(f_tid2))<0) + if ((m_tid1=h5tools_get_native_type(f_tid2)) < 0) goto error; m_size1 = H5Tget_size( m_tid1 ); @@ -387,7 +385,7 @@ hsize_t diff_datasetid( hid_t did1, { H5Tclose(m_tid2); - if ((m_tid2=h5tools_get_native_type(f_tid1))<0) + if ((m_tid2=h5tools_get_native_type(f_tid1)) < 0) goto error; m_size2 = H5Tget_size( m_tid2 ); @@ -495,11 +493,11 @@ hsize_t diff_datasetid( hid_t did1, hs_size[i] = MIN(dims1[i] - hs_offset[i], sm_size[i]); hs_nelmts *= hs_size[i]; } - if (H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL)<0) + if (H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) goto error; - if (H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL)<0) + if (H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) goto error; - if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL)<0) + if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0) goto error; } else @@ -692,10 +690,10 @@ int diff_can_type( hid_t f_tid1, /* file data type */ *------------------------------------------------------------------------- */ - if ((tclass1=H5Tget_class(f_tid1))<0) + if ((tclass1=H5Tget_class(f_tid1)) < 0) return -1; - if ((tclass2=H5Tget_class(f_tid2))<0) + if ((tclass2=H5Tget_class(f_tid2)) < 0) return -1; if ( tclass1 != tclass2 ) diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 4aabe09..de2043e 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -520,14 +520,14 @@ find_objs_cb(hid_t group, const char *name, const H5L_info_t UNUSED *linfo, void tmp = build_obj_path_name(info->prefix, name); add_obj(info->dset_table, oinfo.addr, tmp, TRUE); - if((dset = H5Dopen (group, name)) >= 0) { + if((dset = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) { hid_t type; type = H5Dget_type(dset); if(H5Tcommitted(type) > 0) { H5Oget_info(type, ".", &oinfo, H5P_DEFAULT); - if (search_obj(info->type_table, oinfo.addr) == NULL) { + if(search_obj(info->type_table, oinfo.addr) == NULL) { char *type_name = HDstrdup(tmp); add_obj(info->type_table, oinfo.addr, type_name, FALSE); diff --git a/tools/lib/talign.c b/tools/lib/talign.c index b0dbbe9..9c16d9a 100644 --- a/tools/lib/talign.c +++ b/tools/lib/talign.c @@ -127,17 +127,17 @@ int main(void) /* Now open the set, and read it back in */ data = malloc(H5Tget_size(fix)); - if (!data) { + if(!data) { perror("malloc() failed"); abort(); } - set = H5Dopen(fil, setname); + set = H5Dopen2(fil, setname, H5P_DEFAULT); H5Dread(set, fix, spc, H5S_ALL, H5P_DEFAULT, data); fptr = (float *)(data + H5Tget_member_offset(fix, 1)); - if (fok[0] != fptr[0] || fok[1] != fptr[1] + if(fok[0] != fptr[0] || fok[1] != fptr[1] || fnok[0] != fptr[2] || fnok[1] != fptr[3]) { result = 1; printf("%14s (%2d) %6s = %s\n", -- cgit v0.12