diff options
author | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2017-12-08 21:37:00 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2017-12-08 21:37:00 (GMT) |
commit | 7af4786a9b29184596cb31afa80b69a68f00349b (patch) | |
tree | ca6c0c9d6da62a8206fecd2d03d4975086598579 | |
parent | 599ee2f4c6efd1def87384b15e83005eef786cd8 (diff) | |
parent | 758b9667b3e07a7562107f19f7dabee027e5bd53 (diff) | |
download | hdf5-7af4786a9b29184596cb31afa80b69a68f00349b.zip hdf5-7af4786a9b29184596cb31afa80b69a68f00349b.tar.gz hdf5-7af4786a9b29184596cb31afa80b69a68f00349b.tar.bz2 |
Merge branch 'develop' into bugfix/version_bounds
Merge from develop.
85 files changed, 3209 insertions, 3250 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f2640b1..e22ac2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -849,21 +849,8 @@ set (H5_FC_FUNC "H5_FC_FUNC(name,NAME) name ## _") set (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) name ## _") if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran") option (HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF) - option (SKIP_HDF5_FORTRAN_SHARED "Do not build the fortran shared libraries" OFF) if (HDF5_BUILD_FORTRAN) - if (BUILD_SHARED_LIBS AND APPLE) - # Tell cmake to do the right thing with COMMON symbols, this fixes - # corrupt values with COMMON and EQUIVALENCE when building shared - # Fortran libraries on OSX with gnu and Intel compilers (HDFFV-2772). - # *** NOTE: Fix does not work with Cmake. *** - # set (HDF5_LINKER_FLAGS "-Wl,-commons,use_dylibs") - if (NOT ALLOW_UNSUPPORTED) - message (STATUS " **** Shared FORTRAN libraries are unsupported **** ") - set (SKIP_HDF5_FORTRAN_SHARED ON) - else () - message (STATUS " **** Allowing unsupported Fortran shared libraries **** ") - endif () - endif () + option (HDF5_ENABLE_F2003 "Enable FORTRAN 2003 Standard" ON) include (${HDF_RESOURCES_EXT_DIR}/HDFUseFortran.cmake) diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index d2bfbda..444a77a 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -899,7 +899,7 @@ hid_t DataType::p_opentype(const H5Location& loc, const char *dtype_name) const // Call C function to open the named datatype at this location hid_t ret_value = H5Topen2(loc.getId(), dtype_name, H5P_DEFAULT); if (ret_value < 0) - throw DataTypeIException("DataType constructor", "H5Topen2 failed"); + throw DataTypeIException(inMemFunc("constructor"), "H5Topen2 failed"); return(ret_value); } diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index 5b8f924..906ccef 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -36,6 +36,10 @@ class H5_DLLCPP DataType : public H5Object { // Creates a copy of a predefined type DataType(const PredType& pred_type); + // Constructors to open a generic named datatype at a given location. + DataType(const H5Location& loc, const char* name); + DataType(const H5Location& loc, const H5std_string& name); + // Creates a datatype by way of dereference. DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); // DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT); @@ -124,13 +128,6 @@ class H5_DLLCPP DataType : public H5Object { ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DataType"); } -// From CommonFG then H5Location - // Constructors to open a generic named datatype at a given location. - DataType(const H5Location& loc, const char* name); - DataType(const H5Location& loc, const H5std_string& name); - -// End of From CommonFG then H5Location - // Creates a copy of an existing DataType using its id DataType(const hid_t type_id); diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp index ef4e1a9..f68e858 100644 --- a/c++/src/H5IntType.cpp +++ b/c++/src/H5IntType.cpp @@ -117,7 +117,7 @@ IntType::IntType(const H5Location& loc, const char *dtype_name) : AtomType() // Programmer Binh-Minh Ribler - Dec 2016 // Description // In 1.10.1, this constructor was introduced and may replace the -// existing function CommonFG::openArrayType(const H5std_string&) +// existing function CommonFG::openIntType(const H5std_string&) // to improve usability. // -BMR, Dec 2016 //-------------------------------------------------------------------------- diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index a00e181..d0b5f9d 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -76,15 +76,15 @@ H5Location::H5Location() : IdComponent() {} #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: H5Location::exists +// Function: H5Location::nameExists ///\brief Checks if a link of a given name exists in a location ///\param name - IN: Searched name ///\param lapl - IN: Link access property list ///\exception H5::LocationException -// Programmer Binh-Minh Ribler - Nov, 2016 // Modification +// Renamed from exists() in 1.10.2 -BMR //-------------------------------------------------------------------------- -bool H5Location::exists(const char* name, const LinkAccPropList& lapl) const +bool H5Location::nameExists(const char* name, const LinkAccPropList& lapl) const { htri_t ret_value = H5Lexists(getId(), name, lapl.getId()); if (ret_value > 0) @@ -93,22 +93,54 @@ bool H5Location::exists(const char* name, const LinkAccPropList& lapl) const return false; else // Raise exception when H5Lexists returns a negative value { - throw LocationException(inMemFunc("exists"), "H5Lexists failed"); + throw LocationException(inMemFunc("nameExists"), "H5Lexists failed"); } } //-------------------------------------------------------------------------- -// Function: H5Location::exists +// Function: H5Location::nameExists ///\brief Checks if a link of a given name exists in a location ///\param name - IN: Searched name ///\param lapl - IN: Link access property list ///\exception H5::LocationException +// Modification +// Renamed from exists() in 1.10.2 -BMR +//-------------------------------------------------------------------------- +bool H5Location::nameExists(const H5std_string& name, const LinkAccPropList& lapl) const +{ + return(nameExists(name.c_str(), lapl)); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::exists - Deprecated +// Purpose Checks if a link of a given name exists in a location +///\brief Deprecated in favor of nameExists +///\param name - IN: Searched name +///\param lapl - IN: Link access property list +///\exception H5::LocationException +// Programmer Binh-Minh Ribler - Nov, 2016 +// Modification +// Renamed to nameExists() in 1.10.2 -BMR +//-------------------------------------------------------------------------- +bool H5Location::exists(const char* name, const LinkAccPropList& lapl) const +{ + return(nameExists(name, lapl)); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::exists - Deprecated +// Purpose Checks if a link of a given name exists in a location +///\brief Deprecated in favor of nameExists +///\param name - IN: Searched name +///\param lapl - IN: Link access property list +///\exception H5::LocationException // Programmer Binh-Minh Ribler - Dec, 2016 // Modification +// Renamed to nameExists() in 1.10.2 -BMR //-------------------------------------------------------------------------- bool H5Location::exists(const H5std_string& name, const LinkAccPropList& lapl) const { - return(exists(name.c_str(), lapl)); + return(nameExists(name.c_str(), lapl)); } //-------------------------------------------------------------------------- diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index 2631169..e5fbc84 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -31,6 +31,11 @@ namespace H5 { class H5_DLLCPP H5Location : public IdComponent { public: // Checks if a link of a given name exists in a location + bool nameExists(const char* name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + bool nameExists(const H5std_string& name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + + // Checks if a link of a given name exists in a location + // Deprecated in favor of nameExists for better name. bool exists(const char* name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; bool exists(const H5std_string& name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index a765fb1..250ce90 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -66,13 +66,9 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, * * Programmer Binh-Minh Ribler (using C version) * Friday, January 5, 2001 - * - * Modifications: - * *------------------------------------------------------------------------- */ -static herr_t -test_create( H5File& file) +static herr_t test_create( H5File& file) { SUBTEST("Create, open, close"); @@ -198,13 +194,9 @@ test_create( H5File& file) * * Programmer Binh-Minh Ribler (using C version) * Friday, January 5, 2001 - * - * Modifications: - * *------------------------------------------------------------------------- */ -static herr_t -test_simple_io( H5File& file) +static herr_t test_simple_io( H5File& file) { SUBTEST("Simple I/O"); @@ -284,13 +276,9 @@ test_simple_io( H5File& file) * * Programmer Binh-Minh Ribler * Thursday, March 22, 2012 - * - * Modifications: - * *------------------------------------------------------------------------- */ -static herr_t -test_datasize(FileAccPropList &fapl) +static herr_t test_datasize(FileAccPropList &fapl) { SUBTEST("DataSet::getInMemDataSize()"); try @@ -354,13 +342,9 @@ test_datasize(FileAccPropList &fapl) * * Programmer Binh-Minh Ribler (using C version) * Friday, January 5, 2001 - * - * Modifications: - * *------------------------------------------------------------------------- */ -static herr_t -test_tconv(H5File& file) +static herr_t test_tconv(H5File& file) { // Prepare buffers for input/output char *out=NULL, *in=NULL; @@ -437,6 +421,7 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{ (H5Z_func_t)filter_bogus, /* The actual filter function */ }}; + /*------------------------------------------------------------------------- * Function: bogus * @@ -448,13 +433,9 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{ * * Programmer Robb Matzke * Tuesday, April 21, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ -static size_t -filter_bogus(unsigned int flags, size_t cd_nelmts, +static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[], size_t nbytes, size_t *buf_size, void **buf) // H5_ATTR_UNUSED variables caused warning, but taking them out caused failure. @@ -477,13 +458,9 @@ filter_bogus(unsigned int flags, size_t cd_nelmts, * * Programmer Binh-Minh Ribler (using C version) * Friday, January 5, 2001 - * - * Modifications: - * *------------------------------------------------------------------------- */ -static herr_t -test_compression(H5File& file) +static herr_t test_compression(H5File& file) { #ifndef H5_HAVE_FILTER_DEFLATE const char *not_supported; @@ -764,9 +741,10 @@ test_compression(H5File& file) * *------------------------------------------------------------------------- */ -const H5std_string DSET_NBIT_NAME("nbit_dataset"); +const H5std_string DSET_NBIT_NAME("nbit_dataset"); const hsize_t DIM1 = 2; const hsize_t DIM2 = 5; + static herr_t test_nbit_compression(H5File& file) { typedef struct { @@ -880,13 +858,9 @@ static herr_t test_nbit_compression(H5File& file) * * Programmer Binh-Minh Ribler (using C version) * Saturday, February 17, 2001 - * - * Modifications: - * *------------------------------------------------------------------------- */ -static herr_t -test_multiopen (H5File& file) +static herr_t test_multiopen (H5File& file) { SUBTEST("Multi-open with extending"); @@ -963,13 +937,9 @@ test_multiopen (H5File& file) * * Programmer Binh-Minh Ribler (using C version) * February 17, 2001 - * - * Modifications: - * *------------------------------------------------------------------------- */ -static herr_t -test_types(H5File& file) +static herr_t test_types(H5File& file) { SUBTEST("Various datatypes"); @@ -1148,23 +1118,21 @@ test_types(H5File& file) /*------------------------------------------------------------------------- * Function: test_virtual * - * Purpose: Tests fixed, unlimited, and printf selections in the same + * Purpose Tests fixed, unlimited, and printf selections in the same * VDS * - * Return: Success: 0 + * Return Success: 0 * * Failure: number of errors * - * Programmer: Binh-Minh Ribler + * Programmer Binh-Minh Ribler * Friday, March 10, 2017 * - * Modifications: - * *------------------------------------------------------------------------- */ const int RANK = 2; -static herr_t -test_virtual() + +static herr_t test_virtual() { SUBTEST("DSetCreatPropList::setVirtual"); @@ -1293,17 +1261,15 @@ void test_dset() cleanup_dsets(); } // test_dset + /*------------------------------------------------------------------------- * Function: cleanup_dsets * * Purpose Cleanup temporary test files * - * Return none + * Return None * * Programmer (use C version) - * - * Modifications: - * *------------------------------------------------------------------------- */ extern "C" diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp index f0c403c..f271eed 100644 --- a/c++/test/h5cpputil.cpp +++ b/c++/test/h5cpputil.cpp @@ -47,9 +47,6 @@ using namespace H5; * * Programmer Binh-Minh Ribler (using C code segment for reporting tests) * Friday, February 6, 2001 - * - * Modifications: - * *------------------------------------------------------------------------- */ int test_report( int nerrors, const H5std_string& testname ) @@ -135,9 +132,6 @@ void issue_fail_msg(const char* where, int line, const char* file_name, * * Programmer Binh-Minh Ribler (using C code segment for checking values) * Friday, February 6, 2001 - * - * Modifications: - * *------------------------------------------------------------------------- */ int check_values (hsize_t i, hsize_t j, int apoint, int acheck) @@ -191,9 +185,6 @@ void check_values(const char *value, const char* msg, int line, const char* file * * Programmer Binh-Minh Ribler * May 2, 2010 - * - * Modifications: - * *------------------------------------------------------------------------- */ void verify_val(const char* x, const char* value, const char* where, int line, const char* file_name) diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp index a1de9c5..6bd4ca6 100644 --- a/c++/test/tarray.cpp +++ b/c++/test/tarray.cpp @@ -53,13 +53,10 @@ typedef enum int_t { * * Purpose Tests 1-D array of compound datatypes (with array fields) * - * Return None. + * Return None * * Programmer Binh-Minh Ribler (using C version) * January, 2016 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_array_compound_array() @@ -280,35 +277,33 @@ static void test_array_compound_array() } // end test_array_compound_array() +/* + * Helper routine to demonstrate the issue in HDFFV-9562 + */ +H5::DataType getArr() +{ + hsize_t *dims = new hsize_t; + *dims = 5; + H5::ArrayType ret; + ret = H5::ArrayType(H5::PredType::NATIVE_INT, 1, dims); + delete[] dims; + return ret; +} + /*------------------------------------------------------------------------- * Function: test_array_assignment * * Purpose Tests the operator= * - * Return None. + * Return None * * Programmer Binh-Minh Ribler (using C version) * March, 2016 * * Description: * Used user's sample code in HDFFV-9562 - * - * Modifications: - * *------------------------------------------------------------------------- */ -/* - * Helper routine to demonstrate the issue in HDFFV-9562 - */ -H5::DataType getArr() -{ - hsize_t *dims = new hsize_t; - *dims = 5; - H5::ArrayType ret; - ret = H5::ArrayType(H5::PredType::NATIVE_INT, 1, dims); - delete[] dims; - return ret; } - static void test_array_assignment() { hsize_t sdims1[] = {SPACE1_DIM1}; @@ -359,13 +354,10 @@ static void test_array_assignment() * * Purpose Tests getting array information using the const methods. * - * Return None. + * Return None * * Programmer Binh-Minh Ribler * April, 2016 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_array_info() @@ -477,11 +469,14 @@ static void test_array_info() } // end test_array_info() -/**************************************************************** -** -** test_array(): Main datatypes testing routine. -** -****************************************************************/ +/*------------------------------------------------------------------------- + * Function: test_array + * + * Purpose Main datatypes testing routine + * + * Return None + *------------------------------------------------------------------------- + */ extern "C" void test_array() { @@ -505,13 +500,10 @@ void test_array() * * Purpose Cleanup temporary test files * - * Return none + * Return None * * Programmer Binh-Minh Ribler (using C version) * January, 2016 - * - * Modifications: - * *------------------------------------------------------------------------- */ extern "C" diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index d1a0d67..5aa4bf5 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -101,12 +101,15 @@ float attr_data5 = (float)-5.123; // Test data for 5th attribute const H5std_string ATTR1A_NAME("Attr1_a"); int attr_data1a[ATTR1_DIM1]={256,11945,-22107}; -/**************************************************************** -** -** test_attr_basic_write(): Test basic write attribute. -** Tests integer attributes on both datasets and groups -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_basic_write + * + * Purpose Test basic write attribute on both datasets and groups. + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_basic_write() { hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; @@ -233,29 +236,34 @@ static void test_attr_basic_write() } } // test_attr_basic_write() -/**************************************************************** -** -** test_attr_getname(): Test getting attribute name functions. -** -** Test these functions: -** A. ssize_t Attribute::getName(char* attr_name, size_t buf_size) -** 1. With arbitrary buf_size that is larger than the name size -** 2. With arbitrary buf_size that is smaller than the name's length. -** 3. With a buf_size that equals the name's length. -** -** B. ssize_t Attribute::getName(H5std_string& attr_name, size_t buf_size) -** 1. With buffer smaller than the actual name -** 2. Same test but with retiring overloaded function -** ssize_t Attribute::getName(size_t buf_size, H5std_string& attr_name) -** -** C. H5std_string Attribute::getName() -** -** D. H5std_string Attribute::getName(size_t len) -** -** E. ssize_t Attribute::getName(H5std_string& attr_name, size_t buf_size) -** With buffer size equals the name's length, i.e., buf_size=0 -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_getname + * + * Purpose Test getting attribute name. + * + * Description + * Test these functions: + * A. ssize_t Attribute::getName(char* attr_name, size_t buf_size) + * 1. With arbitrary buf_size that is larger than the name size + * 2. With arbitrary buf_size that is smaller than the name's length. + * 3. With a buf_size that equals the name's length. + * + * B. ssize_t Attribute::getName(H5std_string& attr_name, size_t buf_size) + * 1. With buffer smaller than the actual name + * 2. Same test but with retiring overloaded function + * ssize_t Attribute::getName(size_t buf_size, H5std_string& attr_name) + * + * C. H5std_string Attribute::getName() + * + * D. H5std_string Attribute::getName(size_t len) + * + * E. ssize_t Attribute::getName(H5std_string& attr_name, size_t buf_size) + * With buffer size equals the name's length, i.e., buf_size=0 + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_getname() { // Output message about test being performed @@ -368,11 +376,15 @@ static void test_attr_getname() } } // test_attr_getname() -/**************************************************************** -** -** test_attr_rename(): Test renaming attribute function. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_rename + * + * Purpose Test renaming attribute function. + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_rename() { int read_data1[ATTR1_DIM1]={0}; // Buffer for reading the attribute @@ -479,11 +491,15 @@ static void test_attr_rename() } } // test_attr_rename() -/******************************************************************** -** -** test_attr_basic_read(): Test basic read attribute. -** -********************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_basic_read + * + * Purpose Test basic read attribute. + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_basic_read() { hsize_t i, j; @@ -548,11 +564,15 @@ static void test_attr_basic_read() } } // test_attr_basic_read() -/**************************************************************** -** -** test_attr_compound_write(): Tests compound datatype attributes -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_compound_write + * + * Purpose Test writing attributes with compound datatype. + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_compound_write() { @@ -608,11 +628,15 @@ static void test_attr_compound_write() } } // test_attr_compound_write() -/**************************************************************** -** -** test_attr_compound_read(): Test basic H5A (attribute) code. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_compound_read + * + * Purpose Test reading attributes with compound datatype. + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_compound_read() { hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions @@ -760,11 +784,15 @@ static void test_attr_compound_read() } } // test_attr_compound_read() -/**************************************************************** -** -** test_attr_scalar_write(): Test scalar attribute writing functionality. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_scalar_write + * + * Purpose Test scalar attribute writing functionality. + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_scalar_write() { // Output message about test being performed @@ -815,11 +843,15 @@ static void test_attr_scalar_write() } } // test_attr_scalar_write() -/**************************************************************** -** -** test_attr_scalar_read(): Test scalar attribute reading functionality. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_scalar_read + * + * Purpose Test scalar attribute reading functionality. + * + * Return None + *------------------------------------------------------------------------- + */ /* Epsilon for floating-point comparisons */ #define FP_EPSILON 0.000001F @@ -864,11 +896,15 @@ static void test_attr_scalar_read() } } // test_attr_scalar_read() -/**************************************************************** -** -** test_attr_mult_write(): Test multiple attributes -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_mult_write + * + * Purpose Test writing multiple attributes. + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_mult_write() { // Output message about test being performed @@ -937,11 +973,15 @@ static void test_attr_mult_write() } } // test_attr_mult_write() -/**************************************************************** -** -** test_attr_mult_read(): Test reading multiple attributes. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_mult_read + * + * Purpose Test reading multiple attributes. + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_mult_read() { int read_data1[ATTR1_DIM1]={0}; // Buffer for reading 1st attribute @@ -1128,12 +1168,15 @@ static void test_attr_mult_read() } } // test_attr_mult_read() -/**************************************************************** -** -** test_attr_delete(): Test deleting attribute from different -** hdf5 objects. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_delete + * + * Purpose Test deleting attribute from different hdf5 objects. + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_delete() { H5std_string attr_name; // Buffer for attribute names @@ -1245,20 +1288,23 @@ static void test_attr_delete() } } // test_attr_delete() -/**************************************************************** -** -** test_attr_dtype_shared(): Test code for using shared datatypes -** in attributes. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_dtype_shared + * + * Purpose Test accessing attributes using shared datatypes. + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_dtype_shared() { - int data=8; /* Data to write */ - int rdata=0; /* Read read in */ + int data=8; // Data to write + int rdata=0; // Data read in #ifndef H5_NO_DEPRECATED_SYMBOLS - H5G_stat_t statbuf; /* Object's information */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - h5_stat_size_t filesize; /* Size of file after modifications */ + H5G_stat_t statbuf; // Object's information +#endif + h5_stat_size_t filesize; // Size of file after modifications // Output message about test being performed SUBTEST("Shared Datatypes with Attributes"); @@ -1294,7 +1340,7 @@ static void test_attr_dtype_shared() // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); verify_val((int)statbuf.nlink, 1, "DataType::getObjinfo", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ +#endif // Create dataspace for dataset DataSpace dspace; @@ -1305,7 +1351,7 @@ static void test_attr_dtype_shared() // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); verify_val((int)statbuf.nlink, 2, "H5File::getObjinfo", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ +#endif // Create attribute on dataset Attribute attr = dset.createAttribute(ATTR1_NAME,dtype,dspace); @@ -1314,7 +1360,7 @@ static void test_attr_dtype_shared() // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); verify_val((int)statbuf.nlink, 3, "DataSet::getObjinfo", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ +#endif // Close attribute attr.close(); @@ -1326,7 +1372,7 @@ static void test_attr_dtype_shared() // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); verify_val((int)statbuf.nlink, 2, "DataSet::getObjinfo after DataSet::removeAttr", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ +#endif // Create attribute on dataset attr = dset.createAttribute(ATTR1_NAME,dtype,dspace); @@ -1335,7 +1381,7 @@ static void test_attr_dtype_shared() // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); verify_val((int)statbuf.nlink, 3, "DataSet::createAttribute", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ +#endif // Write data into the attribute attr.write(PredType::NATIVE_INT,&data); @@ -1372,7 +1418,7 @@ static void test_attr_dtype_shared() // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); verify_val((int)statbuf.nlink, 3, "DataSet::openAttribute", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ +#endif } // end of second enclosing // Unlink the dataset @@ -1382,7 +1428,7 @@ static void test_attr_dtype_shared() // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); verify_val((int)statbuf.nlink, 1, "H5File::unlink", __LINE__, __FILE__); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ +#endif // Unlink the named datatype fid1.unlink(TYPE1_NAME); @@ -1403,12 +1449,15 @@ static void test_attr_dtype_shared() } } // test_attr_dtype_shared() -/**************************************************************** -** -** test_string_attr(): Test read/write string attribute. -** Tests string attributes on groups. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_string_attr + * + * Purpose Test read/write string attribute. + * + * Return None + *------------------------------------------------------------------------- + */ /* Info for a string attribute */ const H5std_string ATTR1_FL_STR_NAME("String_attr 1"); const H5std_string ATTR2_FL_STR_NAME("String_attr 2"); @@ -1528,12 +1577,18 @@ static void test_string_attr() } } // test_string_attr() -/**************************************************************** -** -** test_attr_exists(): Test checking for attribute existence. -** (additional attrExists tests are in test_attr_rename()) -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_exists + * + * Purpose Test checking for attribute existence. + * + * Return None + * + * Note + * Additional attrExists tests are in test_attr_rename(). + *------------------------------------------------------------------------- + */ static void test_attr_exists() { // Output message about test being performed @@ -1577,12 +1632,15 @@ static void test_attr_exists() } } // test_attr_exists() -/**************************************************************** -** -** test_attr_dense_create(): Test phase change properties -** Tests "dense" attribute storage creation -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_dense_create + * + * Purpose Test phase change properties + * + * Return None + *------------------------------------------------------------------------- + */ const H5std_string FILE_CRTPROPS("tattr_crt_properties.h5"); const int NAME_BUF_SIZE = 1024; const unsigned MAX_COMPACT_DEF = 8; @@ -1686,12 +1744,15 @@ static void test_attr_dense_create(FileCreatPropList& fcpl, } } // test_attr_dense_create() -/**************************************************************** -** -** test_attr_corder_create_basic(): Test creation order properties -** Tests creating an object w/attribute creation order info -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr_corder_create_basic + * + * Purpose Test creation order properties + * + * Return None + *------------------------------------------------------------------------- + */ static void test_attr_corder_create_basic(FileCreatPropList& fcpl, FileAccPropList& fapl) { @@ -1771,11 +1832,15 @@ static void test_attr_corder_create_basic(FileCreatPropList& fcpl, } } // test_attr_corder_create_basic() -/**************************************************************** -** -** test_attr(): Main attribute testing routine. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_attr + * + * Purpose Main attribute testing routine + * + * Return None + *------------------------------------------------------------------------- + */ extern "C" void test_attr() { @@ -1858,19 +1923,14 @@ void test_attr() issue_fail_msg("test_attr()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_attr() + /*------------------------------------------------------------------------- - * Function cleanup_attr + * Function: cleanup_attr * * Purpose Cleanup temporary test files * - * Return none - * - * Programmer Albert Cheng - * July 2, 1998 - * - * Modifications: - * + * Return None *------------------------------------------------------------------------- */ extern "C" diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index 3af78c5..ec8adf0 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -49,9 +49,6 @@ typedef struct complex_t { * * Programmer Binh-Minh Ribler (using C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_compound_1() @@ -86,9 +83,6 @@ static void test_compound_1() * * Programmer Binh-Minh Ribler (use C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_compound_2() @@ -211,9 +205,6 @@ static void test_compound_2() * * Programmer Binh-Minh Ribler (use C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_compound_3() @@ -333,9 +324,6 @@ static void test_compound_3() * * Programmer Binh-Minh Ribler (use C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_compound_4() @@ -466,9 +454,6 @@ static void test_compound_4() * * Programmer Binh-Minh Ribler (use C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_compound_5() @@ -569,9 +554,6 @@ static void test_compound_5() * * Programmer Binh-Minh Ribler (use C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_compound_6() @@ -651,6 +633,7 @@ static void test_compound_6() } } // test_compound_6() + /*------------------------------------------------------------------------- * Function: test_compound_7 * @@ -661,9 +644,6 @@ static void test_compound_6() * * Programmer Binh-Minh Ribler (use C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_compound_7() @@ -717,6 +697,7 @@ static void test_compound_7() issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } } // test_compound_7() + /*------------------------------------------------------------------------- * Function: test_compound_set_size @@ -727,12 +708,10 @@ static void test_compound_7() * * Programmer Binh-Minh Ribler (use partial C version test_ooo_order) * March, 2014 - * - * Modifications: - * *------------------------------------------------------------------------- */ const H5std_string COMPFILE("tcompound_types.h5"); + static void test_compound_set_size() { typedef struct { @@ -807,6 +786,7 @@ static void test_compound_set_size() issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } } // test_compound_set_size() + /*------------------------------------------------------------------------- * Function: test_compound @@ -817,9 +797,6 @@ static void test_compound_set_size() * * Programmer Binh-Minh Ribler * January 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ extern "C" @@ -844,10 +821,7 @@ void test_compound() * * Purpose Cleanup temporary test files - nothing at this time. * - * Return none - * - * Modifications: - * + * Return None *------------------------------------------------------------------------- */ extern "C" diff --git a/c++/test/tdspl.cpp b/c++/test/tdspl.cpp index 4aaa93a..438f385 100644 --- a/c++/test/tdspl.cpp +++ b/c++/test/tdspl.cpp @@ -111,11 +111,14 @@ static void test_transfplist() } -/**************************************************************** -** -** test_dsproplist(): Main dataset property list testing routine. -** -****************************************************************/ +/*------------------------------------------------------------------------- + * Function: test_dsproplist + * + * Purpose Main dataset property list testing routine + * + * Return None + *------------------------------------------------------------------------- + */ extern "C" void test_dsproplist() { @@ -126,6 +129,15 @@ void test_dsproplist() } // test_dsproplist() + +/*------------------------------------------------------------------------- + * Function: cleanup_dsproplist + * + * Purpose Cleanup temporary test files + * + * Return none + *------------------------------------------------------------------------- + */ extern "C" void cleanup_dsproplist() { diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 51682a3..ba5b486 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -78,7 +78,6 @@ const H5std_string FILE4("tfile4.h5"); * passed to verify_val to 'long' as well. If problems * arises later, this will have to be specificly handled * with a special routine. - * *------------------------------------------------------------------------- */ static void test_file_create() @@ -285,7 +284,6 @@ static void test_file_create() * passed to verify_val to 'long' as well. If problems * arises later, this will have to be specificly handled * with a special routine. - * *------------------------------------------------------------------------- */ static void test_file_open() @@ -360,9 +358,6 @@ static void test_file_open() * * Programmer Raymond Lu * June, 2004 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_file_size() @@ -425,9 +420,6 @@ static void test_file_size() * * Programmer Binh-Minh Ribler * July, 2004 - * - * Modifications: - * *------------------------------------------------------------------------- */ const int RANK = 2; @@ -507,6 +499,15 @@ static void test_file_name() } // test_file_name() +/*------------------------------------------------------------------------- + * + * Function: test_file_attribute + * + * Purpose Test file attributes + * + * Return None + *------------------------------------------------------------------------- + */ const int RANK1 = 1; const int ATTR1_DIM1 = 3; const H5std_string FILE5("tfattrs.h5"); @@ -618,11 +619,6 @@ static void test_file_attribute() } // test_file_attribute() -const H5std_string FILE6("tfile5.h5"); -const H5std_string ROOTGROUP("/"); -const H5std_string GROUP1("/G1"); -const H5std_string SUBGROUP3("/G1/G3"); - /*------------------------------------------------------------------------- * Function: test_libver_bounds_real * @@ -634,9 +630,13 @@ const H5std_string SUBGROUP3("/G1/G3"); * * Programmer Binh-Minh Ribler (use C version) * March, 2015 - * *------------------------------------------------------------------------- */ +const H5std_string FILE6("tfile5.h5"); +const H5std_string ROOTGROUP("/"); +const H5std_string GROUP1("/G1"); +const H5std_string SUBGROUP3("/G1/G3"); + static void test_libver_bounds_real( H5F_libver_t libver_create, unsigned oh_vers_create, H5F_libver_t libver_mod, unsigned oh_vers_mod) @@ -707,6 +707,7 @@ static void test_libver_bounds_real( } /* end test_libver_bounds_real() */ + /*------------------------------------------------------------------------- * * Function: test_libver_bounds @@ -718,7 +719,6 @@ static void test_libver_bounds_real( * * Programmer Binh-Minh Ribler (use C version) * March 2015 - * *------------------------------------------------------------------------- */ static void test_libver_bounds() @@ -731,9 +731,10 @@ static void test_libver_bounds() test_libver_bounds_real(H5F_LIBVER_LATEST, H5O_VERSION_2, H5F_LIBVER_EARLIEST, H5O_VERSION_2); PASSED(); } /* end test_libver_bounds() */ + /*------------------------------------------------------------------------- - * Function: test_commonfg + * Function: test_commonfg * * Purpose Verify that H5File works as a root group. * @@ -741,7 +742,6 @@ static void test_libver_bounds() * * Programmer Binh-Minh Ribler (use C version) * March, 2015 - * *------------------------------------------------------------------------- */ static void test_commonfg() @@ -793,9 +793,8 @@ static void test_commonfg() } } /* end test_commonfg() */ - -const H5std_string FILE7("tfile7.h5"); + /*------------------------------------------------------------------------- * Function: test_file_info * @@ -807,11 +806,12 @@ const H5std_string FILE7("tfile7.h5"); * * Programmer Binh-Minh Ribler * February, 2017 - * *------------------------------------------------------------------------- */ +const H5std_string FILE7("tfile7.h5"); const hsize_t FSP_SIZE_DEF = 4096; const hsize_t FSP_SIZE512 = 512; + static void test_file_info() { // Output message about test being performed @@ -932,6 +932,7 @@ static void test_file_info() issue_fail_msg("test_filespace_info()", __LINE__, __FILE__, E.getCDetailMsg()); } } /* test_file_info() */ + /*------------------------------------------------------------------------- * Function: test_file @@ -942,9 +943,6 @@ static void test_file_info() * * Programmer Binh-Minh Ribler (use C version) * January 2001 - * - * Modifications: - * *------------------------------------------------------------------------- */ extern "C" @@ -970,11 +968,6 @@ void test_file() * Purpose Cleanup temporary test files * * Return none - * - * Programmer (use C version) - * - * Modifications: - * *------------------------------------------------------------------------- */ #ifdef __cplusplus diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp index 5de6590..5a493ac 100644 --- a/c++/test/tfilter.cpp +++ b/c++/test/tfilter.cpp @@ -65,6 +65,7 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{ (H5Z_func_t)filter_bogus, /* The actual filter function */ }}; + /*------------------------------------------------------------------------- * Function: filter_bogus * @@ -76,9 +77,6 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{ * * Programmer Robb Matzke * Tuesday, April 21, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ static size_t @@ -92,6 +90,7 @@ filter_bogus(size_t nbytes) return nbytes; } + /*------------------------------------------------------------------------- * Function: test_null_filter * @@ -104,11 +103,8 @@ filter_bogus(size_t nbytes) * * Modifications: * Note: H5Z interface is not implemented yet. - * *------------------------------------------------------------------------- */ - -// Chunk dimensions const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; static void test_null_filter() @@ -144,6 +140,7 @@ static void test_null_filter() } } // test_null_filter + /*------------------------------------------------------------------------- * Function: test_szip_filter * @@ -156,11 +153,9 @@ static void test_null_filter() * * Modifications: * Note: H5Z interface is not implemented yet. - * *------------------------------------------------------------------------- */ - -const H5std_string DSET_SZIP_NAME("szipped dataset"); +const H5std_string DSET_SZIP_NAME("szipped dataset"); static void test_szip_filter(H5File& file1) { @@ -242,11 +237,14 @@ static void test_szip_filter(H5File& file1) } // test_szip_filter -/**************************************************************** -** -** test_filters(): Main routine for testing filters. -** -****************************************************************/ +/*------------------------------------------------------------------------- + * Function: test_filters + * + * Purpose Main routine for testing filters + * + * Return None + *------------------------------------------------------------------------- + */ const H5std_string FILE1("tfilters.h5"); extern "C" void test_filters() @@ -274,18 +272,13 @@ void test_filters() } } // test_filters() + /*------------------------------------------------------------------------- * Function: cleanup_filters * * Purpose Cleanup temporary test files * * Return none - * - * Programmer Quincey Koziol - * September 10, 1999 - * - * Modifications: - * *------------------------------------------------------------------------- */ extern "C" diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index e99ce99..9c92b64 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -82,13 +82,13 @@ struct space4_struct { /* Null dataspace */ int space5_data = 7; + /*------------------------------------------------------------------------- - * * Function: test_h5s_basic * * Purpose Test basic H5S (dataspace) code * - * Return none + * Return None * * Programmer Binh-Minh Ribler (using C version) * Mar 2001 @@ -214,13 +214,13 @@ static void test_h5s_basic() } } // test_h5s_basic() + /*------------------------------------------------------------------------- - * * Function: test_h5s_scalar_write * * Purpose Test scalar H5S (dataspace) writing code * - * Return none + * Return None * * Programmer Binh-Minh Ribler (using C version) * Mar 2001 @@ -278,13 +278,13 @@ static void test_h5s_scalar_write() } } // test_h5s_scalar_write() + /*------------------------------------------------------------------------- - * * Function: test_h5s_scalar_read * * Purpose Test scalar H5S (dataspace) reading code * - * Return none + * Return None * * Programmer Binh-Minh Ribler (using C version) * Mar 2001 @@ -340,13 +340,13 @@ static void test_h5s_scalar_read() } // test_h5s_scalar_read() + /*------------------------------------------------------------------------- - * * Function: test_h5s_null * * Purpose Test null H5S (dataspace) code * - * Return none + * Return None * * Programmer Raymond Lu (using C version) * May 18, 2004 @@ -394,14 +394,14 @@ static void test_h5s_null() } } // test_h5s_null() + /*------------------------------------------------------------------------- - * * Function: test_h5s_compound_scalar_write * * Purpose Test scalar H5S (dataspace) writing for compound * datatypes * - * Return none + * Return None * * Programmer Binh-Minh Ribler (using C version) * Mar 2001 @@ -467,14 +467,14 @@ static void test_h5s_compound_scalar_write() } } // test_h5s_compound_scalar_write() + /*------------------------------------------------------------------------- - * * Function: test_h5s_compound_scalar_read * * Purpose Test scalar H5S (dataspace) reading for compound * datatypes * - * Return none + * Return None * * Programmer Binh-Minh Ribler (using C version) * Mar 2001 @@ -541,18 +541,16 @@ static void test_h5s_compound_scalar_read() } } // test_h5s_compound_scalar_read() + /*------------------------------------------------------------------------- - * * Function: test_h5s * * Purpose Main dataspace testing routine * - * Return none + * Return None * * Programmer Binh-Minh Ribler (using C version) * Mar 2001 - * - * Modifications: *------------------------------------------------------------------------- */ extern "C" @@ -575,13 +573,7 @@ void test_h5s() * * Purpose Cleanup temporary test files * - * Return none - * - * Programmer Albert Cheng - * July 2, 1998 - * - * Modifications: - * + * Return None *------------------------------------------------------------------------- */ extern "C" diff --git a/c++/test/titerate.cpp b/c++/test/titerate.cpp index 5c760f3..e77ebcc 100644 --- a/c++/test/titerate.cpp +++ b/c++/test/titerate.cpp @@ -78,23 +78,25 @@ typedef struct { int iter_strcmp(const void *s1, const void *s2); -/**************************************************************** -** -** iter_strcmp(): String comparison routine for qsort -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: iter_strcmp + * + * Purpose String comparison routine for qsort + *------------------------------------------------------------------------- + */ int iter_strcmp(const void *s1, const void *s2) { return(HDstrcmp(*(const char * const *)s1,*(const char * const *)s2)); } -/**************************************************************** -** -** liter_cb(): Custom link iteration callback routine. -** -****************************************************************/ -static herr_t -liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_info, void *op_data) +/*------------------------------------------------------------------------- + * Function: liter_cb + * + * Purpose Custom link iteration callback routine + *------------------------------------------------------------------------- + */ +static herr_t liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_info, void *op_data) { iter_info *info = (iter_info *)op_data; static int count = 0; @@ -123,6 +125,7 @@ liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_ } /* end switch */ } /* end liter_cb() */ + /*------------------------------------------------------------------------- * Function: test_iter_group * @@ -133,9 +136,6 @@ liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_ * * Programmer Binh-Minh Ribler * Friday, September 9, 2016 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_iter_group(FileAccPropList& fapl) @@ -348,13 +348,13 @@ static void test_iter_group(FileAccPropList& fapl) #endif } /* test_iter_group() */ - -/**************************************************************** -** -** printelems(): Open an attribute and verify that it has a -** the correct name -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: printelems + * + * Purpose Open an attribute and verify that it has a the correct name + *------------------------------------------------------------------------- + */ const H5std_string FILE_NAME("titerate.h5"); const H5std_string GRP_NAME("/Group_A"); const H5std_string FDATASET_NAME("file dset"); @@ -386,6 +386,7 @@ void printelems(const Group& group, const H5std_string& dsname, const H5std_stri } } + /*------------------------------------------------------------------------- * Function: test_HDFFV_9920 * @@ -393,9 +394,6 @@ void printelems(const Group& group, const H5std_string& dsname, const H5std_stri * * Programmer Binh-Minh Ribler * Friday, September 9, 2016 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_HDFFV_9920() @@ -444,7 +442,7 @@ static void test_HDFFV_9920() } } - + /*------------------------------------------------------------------------- * Function: test_iterate * @@ -455,9 +453,6 @@ static void test_HDFFV_9920() * * Programmer Binh-Minh Ribler * Tuesday, September 6, 2016 - * - * Modifications: - * *------------------------------------------------------------------------- */ extern "C" @@ -476,17 +471,13 @@ void test_iterate() } // test_iterate + /*------------------------------------------------------------------------- * Function: cleanup_iterate * * Purpose Cleanup temporary test files * * Return none - * - * Programmer (use C version) - * - * Modifications: - * *------------------------------------------------------------------------- */ extern "C" diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index dc592b3..e348d64 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -328,9 +328,6 @@ static const char *FILENAME[] = { * * Programmer Binh-Minh Ribler * October 16, 2009 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_basic_links(hid_t fapl_id, hbool_t new_format) @@ -414,6 +411,11 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format) H5File file(filename, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl); // Verify link existence + if(file.nameExists("dset1", LinkAccPropList::DEFAULT) != TRUE) + throw InvalidActionException("H5File::nameExists", "dset1 doesn't exist"); + if(file.nameExists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE) + throw InvalidActionException("H5File::nameExists", "grp1/soft doesn't exist"); + // Deprecated if(file.exists("dset1", LinkAccPropList::DEFAULT) != TRUE) throw InvalidActionException("H5File::exists", "dset1 doesn't exist"); if(file.exists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE) @@ -446,9 +448,6 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format) * * Programmer Binh-Minh Ribler * October 16, 2009 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_num_links(hid_t fapl_id, hbool_t new_format) @@ -483,6 +482,7 @@ static void test_num_links(hid_t fapl_id, hbool_t new_format) issue_fail_msg("test_num_links()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_num_links + /*------------------------------------------------------------------------- * Function: test_links @@ -493,7 +493,6 @@ static void test_num_links(hid_t fapl_id, hbool_t new_format) * * Programmer Binh-Minh Ribler * October 16, 2009 - * *------------------------------------------------------------------------- */ extern "C" @@ -671,18 +670,13 @@ void test_links() } + /*------------------------------------------------------------------------- * Function: cleanup_links * * Purpose Cleanup temporary test files * * Return none - * - * Programmer Binh-Minh Ribler - * October 16, 2009 - * - * Modifications: - * *------------------------------------------------------------------------- */ extern "C" diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp index d9f4075..9980ce0 100644 --- a/c++/test/tobject.cpp +++ b/c++/test/tobject.cpp @@ -45,6 +45,7 @@ const H5std_string DSET_IN_GRP1_PATH("/Top Group/Dataset_in_Group_1"); const H5std_string DSET_IN_GRP1_2("Dataset_in_Group_1.2"); const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset_in_Group_1.2"); + /*------------------------------------------------------------------------- * Function: test_get_objname * @@ -65,9 +66,6 @@ const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset_ * * Programmer Binh-Minh Ribler * Friday, March 4, 2014 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_get_objname() @@ -153,6 +151,7 @@ static void test_get_objname() } } // test_get_objname + /*------------------------------------------------------------------------- * Function: test_existance * @@ -173,9 +172,6 @@ static void test_get_objname() * * Programmer Binh-Minh Ribler * Friday, March 4, 2014 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_existance() @@ -187,18 +183,30 @@ static void test_existance() H5File file(FILE_OBJECTS, H5F_ACC_RDONLY); // Check if GROUP1 exists in the file - bool exists = file.exists(GROUP1); + bool exists = file.nameExists(GROUP1); + verify_val(exists, TRUE, "Group::nameExists GROUP1_1", __LINE__, __FILE__); + // Deprecated + exists = file.exists(GROUP1); + verify_val(exists, TRUE, "Group::exists GROUP1_1", __LINE__, __FILE__); // Open GROUP1 Group grp1 = file.openGroup(GROUP1); // Check if GROUP1_1 and GROUP1_2 exist in GROUP1 + exists = grp1.nameExists(GROUP1_1); + verify_val(exists, TRUE, "Group::nameExists GROUP1_1", __LINE__, __FILE__); + exists = grp1.nameExists(GROUP1_2); + verify_val(exists, TRUE, "Group::nameExists GROUP1_2", __LINE__, __FILE__); + // Deprecated exists = grp1.exists(GROUP1_1); verify_val(exists, TRUE, "Group::exists GROUP1_1", __LINE__, __FILE__); exists = grp1.exists(GROUP1_2); verify_val(exists, TRUE, "Group::exists GROUP1_2", __LINE__, __FILE__); // Check if DSET_IN_GRP1 exists in GROUP1 + exists = grp1.nameExists(DSET_IN_GRP1); + verify_val(exists, TRUE, "Group::nameExists DSET_IN_GRP1", __LINE__, __FILE__); + // Deprecated exists = grp1.exists(DSET_IN_GRP1); verify_val(exists, TRUE, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__); @@ -206,14 +214,22 @@ static void test_existance() Group grp1_2 = grp1.openGroup(GROUP1_2); // Check if DSET_IN_GRP1_2 exists in GROUP1_2 + exists = grp1_2.nameExists(DSET_IN_GRP1_2); + verify_val(exists, TRUE, "Group::nameExists DSET_IN_GRP1_2", __LINE__, __FILE__); + // Deprecated exists = grp1_2.exists(DSET_IN_GRP1_2); verify_val(exists, TRUE, "Group::exists DSET_IN_GRP1_2", __LINE__, __FILE__); // Check if a dataset exists given dataset as location with full path name DataSet dset1 = file.openDataSet(DSET_IN_FILE); + exists = dset1.nameExists("/Top Group/Dataset_in_Group_1"); + verify_val(exists, TRUE, "Group::nameExists given dataset with full path name", __LINE__, __FILE__); + + exists = grp1_2.nameExists(DSET_IN_GRP1); + verify_val(exists, FALSE, "Group::nameExists DSET_IN_GRP1", __LINE__, __FILE__); + // Deprecated exists = dset1.exists("/Top Group/Dataset_in_Group_1"); verify_val(exists, TRUE, "Group::exists given dataset with full path name", __LINE__, __FILE__); - exists = grp1_2.exists(DSET_IN_GRP1); verify_val(exists, FALSE, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__); @@ -229,6 +245,7 @@ static void test_existance() } } // test_existance + /*------------------------------------------------------------------------- * Function: test_get_objname_ontypes * @@ -239,9 +256,6 @@ static void test_existance() * * Programmer Binh-Minh Ribler * March 4, 2014 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_get_objname_ontypes() @@ -330,6 +344,7 @@ static void test_get_objname_ontypes() } } // test_get_objname_ontypes + /*------------------------------------------------------------------------- * Function: test_get_objtype * @@ -340,9 +355,6 @@ static void test_get_objname_ontypes() * * Programmer Binh-Minh Ribler * Friday, March 4, 2014 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_get_objtype() @@ -394,6 +406,7 @@ static void test_get_objtype() issue_fail_msg("test_get_objtype", __LINE__, __FILE__); } } // test_get_objtype + /*------------------------------------------------------------------------- * Function: test_open_object_header @@ -404,9 +417,6 @@ static void test_get_objtype() * * Programmer Binh-Minh Ribler (use C version) * March, 2017 - * - * Modifications: - * *------------------------------------------------------------------------- */ const H5std_string GROUPNAME("group"); @@ -416,6 +426,7 @@ const H5std_string DSETNAME("dataset"); #define RANK 2 #define DIM0 5 #define DIM1 10 + static void test_open_object_header() { hsize_t dims[2]; @@ -513,6 +524,7 @@ static void test_open_object_header() issue_fail_msg("test_file_name()", __LINE__, __FILE__, E.getCDetailMsg()); } } /* test_open_object_header() */ + /*------------------------------------------------------------------------- * Function: test_objects @@ -524,9 +536,6 @@ static void test_open_object_header() * * Programmer Binh-Minh Ribler * Friday, Mar 4, 2014 - * - * Modifications: - * *------------------------------------------------------------------------- */ extern "C" @@ -543,17 +552,13 @@ void test_object() } // test_objects + /*------------------------------------------------------------------------- * Function: cleanup_objects * * Purpose Cleanup temporary test files * - * Return none - * - * Programmer (use C version) - * - * Modifications: - * + * Return None *------------------------------------------------------------------------- */ extern "C" diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 9074154..bb09616 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -61,14 +61,16 @@ typedef struct s1_t { float c; } s1_t; -/**************************************************************** -** -** test_reference_params(): Test basic H5R (reference) parameters -** for correct processing -** -****************************************************************/ -static void -test_reference_params(void) + +/*------------------------------------------------------------------------- + * Function: test_reference_params + * + * Purpose Test basic H5R (reference) parameters for correct processing + * + * Return None + *------------------------------------------------------------------------- + */ +static void test_reference_params() { const char *write_comment = "Foo!"; /* Comments for group */ @@ -177,13 +179,17 @@ test_reference_params(void) delete file1; } /* test_reference_param() */ -/**************************************************************** -** -** test_reference_obj(): Test basic object reference functions -** to various kinds of objects -** -****************************************************************/ -static void test_reference_obj(void) + +/*------------------------------------------------------------------------- + * Function: test_reference_obj + * + * Purpose Test basic object reference functions to various kinds + * of objects + * + * Return None + *------------------------------------------------------------------------- + */ +static void test_reference_obj() { int i; // counting variables const H5std_string write_comment="Foo!"; // Comments for group @@ -369,14 +375,15 @@ static void test_reference_obj(void) delete file1; } // test_reference_obj() - -/**************************************************************** -** -** test_reference_group(): Test object reference functionality -** Tests for correct behavior of various routines on -** dereferenced group -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_reference_group + * + * Purpose Test object reference functionality on group. + * + * Return None + *------------------------------------------------------------------------- + */ #define GROUPNAME "/group" #define GROUPNAME2 "group2" #define GROUPNAME3 "group3" @@ -384,8 +391,7 @@ static void test_reference_obj(void) #define DSETNAME2 "dset2" #define NAME_SIZE 16 -static void -test_reference_group(void) +static void test_reference_group() { hobj_ref_t wref; /* Reference to write */ hobj_ref_t rref; /* Reference to read */ @@ -498,14 +504,16 @@ test_reference_group(void) delete file1; } /* test_reference_group() */ -/**************************************************************** -** -** test_reference_region_1D(): Test 1-D reference functionality -** Tests 1-D references to various kinds of objects -** -****************************************************************/ -static void -test_reference_region_1D(void) + +/*------------------------------------------------------------------------- + * Function: test_reference_region_1D + * + * Purpose Test 1-D reference functionality on various kinds of objects. + * + * Return None + *------------------------------------------------------------------------- + */ +static void test_reference_region_1D() { hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */ @@ -787,26 +795,14 @@ test_reference_region_1D(void) } } /* test_reference_region_1D() */ - -/**************************************************************** -** -** test_reference_compat(): Test basic object reference functionality. -** Tests references to various kinds of objects using deprecated API. -** -****************************************************************/ -static void test_reference_compat(void) -{ - // Not yet -} // test_reference_compat() - - -/**************************************************************** -** -** test_reference(): Main reference testing routine. -** -****************************************************************/ +/*------------------------------------------------------------------------- + * + * test_reference(): Main reference testing routine. + * + *------------------------------------------------------------------------- + */ extern "C" -void test_reference(void) +void test_reference() { // Output message about test being performed MESSAGE(5, ("Testing References\n")); @@ -815,18 +811,20 @@ void test_reference(void) test_reference_obj(); // Test basic object reference functionality test_reference_group(); // Test group reference functionality test_reference_region_1D(); // Test 1-D reference functionality - test_reference_compat(); // Tests deprecated reference routines (not yet) } // test_reference() -/**************************************************************** -** Function: cleanup_reference -** Purpose Cleanup temporary test files -** Return none -****************************************************************/ +/*------------------------------------------------------------------------- + * Function: cleanup_reference + * + * Purpose Cleanup temporary test files + * + * Return None + *------------------------------------------------------------------------- + */ extern "C" -void cleanup_reference(void) +void cleanup_reference() { HDremove(FILE1.c_str()); HDremove(FILE2.c_str()); diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index 3cf0920..a2bd561 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -87,6 +87,7 @@ typedef struct { long c; double d; } src_typ_t; + /*------------------------------------------------------------------------- * Function: test_classes @@ -97,9 +98,6 @@ typedef struct { * * Programmer Binh-Minh Ribler (using C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_classes() @@ -126,6 +124,7 @@ static void test_classes() issue_fail_msg("test_classes", __LINE__, __FILE__, E.getCDetailMsg()); } } + /*------------------------------------------------------------------------- * Function: test_copy @@ -136,9 +135,6 @@ static void test_classes() * * Programmer Binh-Minh Ribler (using C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_copy() @@ -192,9 +188,6 @@ static void test_copy() * * Programmer Binh-Minh Ribler (using C version) * August, 2017 - * - * Modifications: - * *------------------------------------------------------------------------- */ typedef struct { /* Struct with atomic fields */ @@ -390,9 +383,6 @@ static void test_detect_type_class() * * Programmer Binh-Minh Ribler (use C version) * August, 2017 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_vltype() @@ -465,12 +455,8 @@ static void test_vltype() * * Programmer Binh-Minh Ribler (use C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ - const H5std_string CompT_NAME("Compound_type"); const H5std_string EnumT_NAME("Enum_type"); @@ -591,12 +577,10 @@ static void test_query() * * Programmer Binh-Minh Ribler (use C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ const char* filename1 = "dtypes1.h5"; + static void test_transient () { static hsize_t ds_size[2] = {10, 20}; @@ -668,12 +652,10 @@ static void test_transient () * * Programmer Binh-Minh Ribler (use C version) * January, 2007 - * - * Modifications: - * *------------------------------------------------------------------------- */ const H5std_string filename2("dtypes2.h5"); + static void test_named () { static hsize_t ds_size[2] = {10, 20}; @@ -831,14 +813,12 @@ static void test_named () * * Programmer Binh-Minh Ribler (using C version) * August, 2017 - * - * Modifications: - * *------------------------------------------------------------------------- */ const H5std_string filename3("encode_decode.h5"); const int ARRAY1_RANK = 1; const int ARRAY1_DIM = 10; + static void test_encode_decode() { short enum_val; @@ -1045,11 +1025,14 @@ static void test_encode_decode() } -/**************************************************************** -** -** test_types(): Main datatypes testing routine. -** -****************************************************************/ +/*------------------------------------------------------------------------- + * Function: test_types + * + * Purpose Main datatypes testing routine + * + * Return None + *------------------------------------------------------------------------- + */ extern "C" void test_types() { @@ -1074,13 +1057,7 @@ void test_types() * * Purpose Cleanup temporary test files * - * Return none - * - * Programmer Quincey Koziol - * September 10, 1999 - * - * Modifications: - * + * Return None *------------------------------------------------------------------------- */ extern "C" diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp index d5fea07..2421a87 100644 --- a/c++/test/tvlstr.cpp +++ b/c++/test/tvlstr.cpp @@ -40,16 +40,22 @@ const H5std_string FILENAME("tvlstr.h5"); const int SPACE1_RANK = 1; const hsize_t SPACE1_DIM1 = 4; -/**************************************************************** -** -** test_vlstr_alloc_custom(): Test VL datatype custom memory -** allocation routines. This routine just uses malloc to -** allocate the memory and increments the amount of memory -** allocated. It is passed into setVlenMemManager. -** -** Note: exact copy from the C version. -** (Not used now) -****************************************************************/ +/*------------------------------------------------------------------------- + * Function: test_vlstr_alloc_custom + * + * Purpose Test VL datatype custom memory allocation routines. + * + * Return None + * + * Description + * This routine just uses malloc to allocate the memory and + * increments the amount of memory allocated. It is passed + * into setVlenMemManager. + * + * Note: exact copy from the C version. + * (Not used now) + *------------------------------------------------------------------------- + */ #if 0 // not used now static void *test_vlstr_alloc_custom(size_t size, void *info) { @@ -74,16 +80,22 @@ static void *test_vlstr_alloc_custom(size_t size, void *info) } #endif -/**************************************************************** -** -** test_vlstr_free_custom(): Test VL datatype custom memory -** allocation routines. This routine just uses free to -** release the memory and decrements the amount of memory -** allocated. It is passed into setVlenMemManager. -** -** Note: exact copy from the C version. -** (Not used now) -****************************************************************/ +/*------------------------------------------------------------------------- + * Function: test_vlstr_free_custom + * + * Purpose Test VL datatype custom memory de-allocation routines. + * + * Return None + * + * Description + * This routine just uses free to release the memory and + * decrements the amount of memory allocated. It is passed + * into setVlenMemManager. + * + * Note: exact copy from the C version. + * (Not used now) + *------------------------------------------------------------------------- + */ #if 0 // not used now static void test_vlstr_free_custom(void *_mem, void *info) { @@ -221,6 +233,7 @@ static void test_vlstring_dataset() *------------------------------------------------------------------------- */ const H5std_string DSSTRARR_NAME("StringArray_dset"); + static void test_vlstring_array_dataset() { const char *string_ds_array[SPACE1_DIM1]= { @@ -440,6 +453,7 @@ static void test_vlstrings_special() *------------------------------------------------------------------------- */ const H5std_string VLSTR_TYPE("vl_string_type"); + static void test_vlstring_type() { // Output message about test being performed. @@ -608,10 +622,7 @@ static void test_compact_vlstring() * *------------------------------------------------------------------------- */ -// String for writing to attribute static char *string_att_write=NULL; - -// Info for a string attribute const H5std_string ATTRSTR_NAME("String_attr"); const H5std_string ATTRSTR_DATA("String Attribute"); @@ -877,6 +888,7 @@ static void read_scalar_dset(H5File& file, DataType& type, DataSpace& space, */ const H5std_string FILENAME2("tvlstr2.h5"); const int REWRITE_NDATASETS = 32; + static void test_vl_rewrite() { // Output message about test being performed @@ -987,12 +999,6 @@ void test_vlstrings() * Purpose Cleanup temporary test files * * Return none - * - * Programmer Quincey Koziol - * September 10, 1999 - * - * Modifications: - * *------------------------------------------------------------------------- */ extern "C" diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 602b6bf..192a5c8 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -108,6 +108,7 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) set_target_properties (${libtarget} PROPERTIES + OUTPUT_NAME ${LIB_RELEASE_NAME} OUTPUT_NAME_DEBUG ${LIB_DEBUG_NAME} OUTPUT_NAME_RELEASE ${LIB_RELEASE_NAME} OUTPUT_NAME_MINSIZEREL ${LIB_RELEASE_NAME} diff --git a/examples/h5_cmprss.c b/examples/h5_cmprss.c index ebc7712..b51ec44 100644 --- a/examples/h5_cmprss.c +++ b/examples/h5_cmprss.c @@ -36,7 +36,6 @@ int main () { hsize_t dims[2]; hsize_t cdims[2]; - int idx; int i,j, numfilt; int buf[DIM0][DIM1]; int rbuf [DIM0][DIM1]; diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index 426df7e..a05f296 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -52,7 +52,7 @@ foreach (example ${examples}) FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) - if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + if (BUILD_SHARED_LIBS) add_executable (f90_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) TARGET_NAMING (f90_ex_${example}-shared SHARED) TARGET_FORTRAN_PROPERTIES (f90_ex_${example}-shared SHARED " " " ") @@ -83,7 +83,7 @@ foreach (example ${F2003_examples}) FOLDER examples/fortran03 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) - if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + if (BUILD_SHARED_LIBS) add_executable (f03_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) TARGET_NAMING (f03_ex_${example}-shared SHARED) TARGET_FORTRAN_PROPERTIES (f03_ex_${example}-shared SHARED " " " ") @@ -114,7 +114,7 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) - if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + if (BUILD_SHARED_LIBS) add_executable (f90_ex_ph5example-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) TARGET_NAMING (f90_ex_ph5example-shared SHARED) TARGET_FORTRAN_PROPERTIES (f90_ex_ph5example-shared SHARED " " " ") diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake index b130f30..c3d94b4 100644 --- a/fortran/examples/CMakeTests.cmake +++ b/fortran/examples/CMakeTests.cmake @@ -41,7 +41,7 @@ set_tests_properties (f90_ex-clear-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "f90_ex-clear-objects") - if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + if (BUILD_SHARED_LIBS) add_test ( NAME f90_ex-shared-clear-objects COMMAND ${CMAKE_COMMAND} @@ -87,7 +87,7 @@ foreach (example ${examples}) set_tests_properties (f90_ex_${example} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "f90_ex_${example}") - if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + if (BUILD_SHARED_LIBS) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME f90_ex-shared_${example} COMMAND $<TARGET_FILE:f90_ex_${example}-shared>) else () @@ -129,7 +129,7 @@ if (HDF5_ENABLE_F2003) set_tests_properties (f03_ex_${example} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "f03_ex_${example}") - if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + if (BUILD_SHARED_LIBS) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME f03_ex-shared_${example} COMMAND $<TARGET_FILE:f03_ex_${example}-shared>) else () @@ -154,7 +154,7 @@ endif () if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) add_test (NAME f90_ex_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:f90_ex_ph5example> ${MPIEXEC_POSTFLAGS}) - if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + if (BUILD_SHARED_LIBS) add_test (NAME f90_ex-shared_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:f90_ex_ph5example> ${MPIEXEC_POSTFLAGS}) endif () endif () diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index e34c778..0f576d4 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -64,7 +64,7 @@ set_target_properties (H5_buildiface PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} ) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared") if (WIN32) set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${CMAKE_BUILD_TYPE}) @@ -136,7 +136,7 @@ set_target_properties (${HDF5_F90_C_LIB_TARGET} PROPERTIES ) set (install_targets ${HDF5_F90_C_LIB_TARGET}) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_C_LIBSH_TARGET} SHARED ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS}) TARGET_C_PROPERTIES (${HDF5_F90_C_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_F90_C_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) @@ -173,7 +173,7 @@ add_custom_target (H5gen ALL ) set_source_files_properties (${HDF5_F90_BINARY_DIR}/H5_gen.F90 PROPERTIES GENERATED TRUE) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) set (CMDSH $<TARGET_FILE:H5_buildiface>) add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 @@ -220,7 +220,7 @@ set (f90_F_SOURCES # normal distribution ${HDF5_F90_SRC_SOURCE_DIR}/HDF5.F90 ) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) set (f90_F_SOURCES_SHARED # generated file ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 @@ -262,7 +262,7 @@ endif () set (install_targets ${install_targets} ${HDF5_F90_LIB_TARGET}) add_dependencies(${HDF5_F90_LIB_TARGET} H5gen) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_LIBSH_TARGET} SHARED ${f90_F_SOURCES_SHARED}) set (SHARED_LINK_FLAGS " ") if (WIN32 AND MSVC) @@ -339,7 +339,7 @@ install ( fortheaders ) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) set (modsh_files ${MODSH_BUILD_DIR}/h5fortran_types.mod ${MODSH_BUILD_DIR}/hdf5.mod @@ -375,7 +375,7 @@ endif () # Add Target(s) to CMake Install for import into other projects #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_F90_C_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) #INSTALL_TARGET_PDB (${HDF5_F90_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) endif () diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index ef89d2f..db57f03 100644 --- a/fortran/src/H5_ff.F90 +++ b/fortran/src/H5_ff.F90 @@ -38,10 +38,111 @@ MODULE H5LIB - USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_ptr, C_INTPTR_T + USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR, C_INTPTR_T USE H5GLOBAL IMPLICIT NONE + PRIVATE + ! + ! H5F flags declaration + ! + INTEGER, PARAMETER :: H5F_FLAGS_LEN = 19 + INTEGER, DIMENSION(1:H5F_FLAGS_LEN) :: H5F_flags + ! + ! H5generic flags declaration + ! + INTEGER, PARAMETER :: H5generic_FLAGS_LEN = 9 + INTEGER, DIMENSION(1:H5generic_FLAGS_LEN) :: H5generic_flags + + INTEGER, PARAMETER :: H5generic_haddr_FLAGS_LEN = 1 + INTEGER(HADDR_T), DIMENSION(1:H5generic_haddr_FLAGS_LEN) :: H5generic_haddr_flags + ! + ! H5G flags declaration + ! + INTEGER, PARAMETER :: H5G_FLAGS_LEN = 12 + INTEGER, DIMENSION(1:H5G_FLAGS_LEN) :: H5G_flags + ! + ! H5D flags declaration + ! + INTEGER, PARAMETER :: H5D_FLAGS_LEN = 29 + INTEGER, DIMENSION(1:H5D_FLAGS_LEN) :: H5D_flags + INTEGER, PARAMETER :: H5D_SIZE_FLAGS_LEN = 2 + INTEGER(SIZE_T), DIMENSION(1:H5D_SIZE_FLAGS_LEN) :: H5D_size_flags + ! + ! H5E flags declaration + ! + INTEGER, PARAMETER :: H5E_FLAGS_LEN = 4 + INTEGER, DIMENSION(1:H5E_FLAGS_LEN) :: H5E_flags + INTEGER, PARAMETER :: H5E_HID_FLAGS_LEN = 1 + INTEGER(HID_T), DIMENSION(1:H5E_HID_FLAGS_LEN) :: H5E_hid_flags + ! + ! H5FD flags declaration + ! + INTEGER, PARAMETER :: H5FD_FLAGS_LEN = 11 + INTEGER, DIMENSION(1:H5FD_FLAGS_LEN) :: H5FD_flags + ! + ! H5FD file drivers flags declaration + ! + INTEGER, PARAMETER :: H5FD_HID_FLAGS_LEN = 7 + INTEGER(HID_T), DIMENSION(1:H5FD_HID_FLAGS_LEN) :: H5FD_hid_flags + ! + ! H5I flags declaration + ! + INTEGER, PARAMETER :: H5I_FLAGS_LEN = 7 + INTEGER, DIMENSION(1:H5I_FLAGS_LEN) :: H5I_flags + ! + ! H5L flags declaration + ! + INTEGER, PARAMETER :: H5L_FLAGS_LEN = 6 + INTEGER, DIMENSION(1:H5L_FLAGS_LEN) :: H5L_flags + ! + ! H5O flags declaration + ! + INTEGER, PARAMETER :: H5O_FLAGS_LEN = 27 + INTEGER, DIMENSION(1:H5O_FLAGS_LEN) :: H5o_flags + ! + ! H5P flags declaration + ! + INTEGER, PARAMETER :: H5P_FLAGS_LEN = 18 + INTEGER(HID_T), DIMENSION(1:H5P_FLAGS_LEN) :: H5P_flags + ! + ! H5P integers flags declaration + ! + INTEGER, PARAMETER :: H5P_FLAGS_INT_LEN = 2 + INTEGER, DIMENSION(1:H5P_FLAGS_INT_LEN) :: H5P_flags_int + ! + ! H5R flags declaration + ! + INTEGER, PARAMETER :: H5R_FLAGS_LEN = 2 + INTEGER, DIMENSION(1:H5R_FLAGS_LEN) :: H5R_flags + ! + ! H5S flags declaration + ! + INTEGER, PARAMETER :: H5S_FLAGS_LEN = 18 + INTEGER, DIMENSION(1:H5S_FLAGS_LEN) :: H5S_flags + INTEGER, PARAMETER :: H5S_HSIZE_FLAGS_LEN = 1 + INTEGER(HSIZE_T), DIMENSION(1:H5S_HSIZE_FLAGS_LEN) :: H5S_hsize_flags + INTEGER, PARAMETER :: H5S_HID_FLAGS_LEN = 1 + INTEGER(HSIZE_T), DIMENSION(1:H5S_HID_FLAGS_LEN) :: H5S_hid_flags + ! + ! H5T flags declaration + ! + INTEGER, PARAMETER :: H5T_FLAGS_LEN = 35 + INTEGER, DIMENSION(1:H5T_FLAGS_LEN) :: H5T_flags + ! + ! H5Z flags declaration + ! + INTEGER, PARAMETER :: H5Z_FLAGS_LEN = 20 + INTEGER, DIMENSION(1:H5Z_FLAGS_LEN) :: H5Z_flags + ! + ! H5 Library flags declaration + ! + INTEGER, PARAMETER :: H5LIB_FLAGS_LEN = 2 + INTEGER, DIMENSION(1:H5LIB_FLAGS_LEN) :: H5LIB_flags + + PUBLIC :: h5open_f, h5close_f, h5get_libversion_f, h5dont_atexit_f, h5kind_to_type, h5offsetof + PUBLIC :: h5garbage_collect_f, h5check_version_f + CONTAINS !****s* H5LIB/h5open_f ! @@ -65,26 +166,24 @@ CONTAINS ! ! Removed call to h5open_c since this may cause a problem for an ! application that uses HDF5 library outside HDF5 Fortran APIs. -! October 13, 2011 +! October 13, 2011 ! Fortran90 Interface: SUBROUTINE h5open_f(error) IMPLICIT NONE INTEGER, INTENT(OUT) :: error !***** - INTEGER :: error_1, error_2, error_3 - INTERFACE + INTEGER FUNCTION h5init_types_c(p_types, f_types, i_types) & BIND(C,NAME='h5init_types_c') IMPORT :: HID_T IMPORT :: PREDEF_TYPES_LEN, FLOATING_TYPES_LEN, INTEGER_TYPES_LEN IMPLICIT NONE - INTEGER(HID_T), DIMENSION(PREDEF_TYPES_LEN) :: p_types - INTEGER(HID_T), DIMENSION(FLOATING_TYPES_LEN) :: f_types - INTEGER(HID_T), DIMENSION(INTEGER_TYPES_LEN) :: i_types + INTEGER(HID_T), DIMENSION(1:PREDEF_TYPES_LEN) :: p_types + INTEGER(HID_T), DIMENSION(1:FLOATING_TYPES_LEN) :: f_types + INTEGER(HID_T), DIMENSION(1:INTEGER_TYPES_LEN) :: i_types END FUNCTION h5init_types_c - END INTERFACE - INTERFACE + INTEGER FUNCTION h5init_flags_c(i_H5D_flags, & i_H5D_size_flags,& i_H5E_flags, & @@ -116,39 +215,90 @@ CONTAINS H5R_FLAGS_LEN, H5S_FLAGS_LEN, H5S_HID_FLAGS_LEN, H5S_HSIZE_FLAGS_LEN, & H5T_FLAGS_LEN, H5Z_FLAGS_LEN, H5generic_FLAGS_LEN, H5generic_haddr_FLAGS_LEN IMPLICIT NONE - INTEGER i_H5D_flags(H5D_FLAGS_LEN) - INTEGER(SIZE_T) i_H5D_size_flags(H5D_SIZE_FLAGS_LEN) - INTEGER i_H5E_flags(H5E_FLAGS_LEN) - INTEGER(HID_T) i_H5E_hid_flags(H5E_HID_FLAGS_LEN) - INTEGER i_H5F_flags(H5F_FLAGS_LEN) - INTEGER i_H5G_flags(H5G_FLAGS_LEN) - INTEGER i_H5FD_flags(H5FD_FLAGS_LEN) - INTEGER(HID_T) i_H5FD_hid_flags(H5FD_HID_FLAGS_LEN) - INTEGER i_H5I_flags(H5I_FLAGS_LEN) - INTEGER i_H5L_flags(H5L_FLAGS_LEN) - INTEGER i_H5O_flags(H5O_FLAGS_LEN) - INTEGER(HID_T) i_H5P_flags(H5P_FLAGS_LEN) - INTEGER i_H5P_flags_int(H5P_FLAGS_INT_LEN) - INTEGER i_H5R_flags(H5R_FLAGS_LEN) - INTEGER i_H5S_flags(H5S_FLAGS_LEN) - INTEGER(HID_T) i_H5S_hid_flags(H5S_HID_FLAGS_LEN) - INTEGER(HSIZE_T) i_H5S_hsize_flags(H5S_HSIZE_FLAGS_LEN) - INTEGER i_H5T_flags(H5T_FLAGS_LEN) - INTEGER i_H5Z_flags(H5Z_FLAGS_LEN) - INTEGER i_H5generic_flags(H5generic_FLAGS_LEN) - INTEGER(HADDR_T) i_H5generic_haddr_flags(H5generic_haddr_FLAGS_LEN) + INTEGER , DIMENSION(1:H5D_FLAGS_LEN) :: i_H5D_flags + INTEGER(SIZE_T) , DIMENSION(1:H5D_SIZE_FLAGS_LEN) :: i_H5D_size_flags + INTEGER , DIMENSION(1:H5E_FLAGS_LEN) :: i_H5E_flags + INTEGER(HID_T) , DIMENSION(1:H5E_HID_FLAGS_LEN) :: i_H5E_hid_flags + INTEGER , DIMENSION(1:H5F_FLAGS_LEN) :: i_H5F_flags + INTEGER , DIMENSION(1:H5G_FLAGS_LEN) :: i_H5G_flags + INTEGER , DIMENSION(1:H5FD_FLAGS_LEN) :: i_H5FD_flags + INTEGER(HID_T) , DIMENSION(1:H5FD_HID_FLAGS_LEN) :: i_H5FD_hid_flags + INTEGER , DIMENSION(1:H5I_FLAGS_LEN) :: i_H5I_flags + INTEGER , DIMENSION(1:H5L_FLAGS_LEN) :: i_H5L_flags + INTEGER , DIMENSION(1:H5O_FLAGS_LEN) :: i_H5O_flags + INTEGER(HID_T) , DIMENSION(1:H5P_FLAGS_LEN) :: i_H5P_flags + INTEGER , DIMENSION(1:H5P_FLAGS_INT_LEN) :: i_H5P_flags_int + INTEGER , DIMENSION(1:H5R_FLAGS_LEN) :: i_H5R_flags + INTEGER , DIMENSION(1:H5S_FLAGS_LEN) :: i_H5S_flags + INTEGER(HID_T) , DIMENSION(1:H5S_HID_FLAGS_LEN) :: i_H5S_hid_flags + INTEGER(HSIZE_T), DIMENSION(1:H5S_HSIZE_FLAGS_LEN) :: i_H5S_hsize_flags + INTEGER , DIMENSION(1:H5T_FLAGS_LEN) :: i_H5T_flags + INTEGER , DIMENSION(1:H5Z_FLAGS_LEN) :: i_H5Z_flags + INTEGER , DIMENSION(1:H5generic_FLAGS_LEN) :: i_H5generic_flags + INTEGER(HADDR_T), DIMENSION(1:H5generic_haddr_FLAGS_LEN) :: i_H5generic_haddr_flags END FUNCTION h5init_flags_c - END INTERFACE - INTERFACE + INTEGER FUNCTION h5init1_flags_c( i_H5LIB_flags ) & BIND(C,NAME='h5init1_flags_c') IMPORT :: H5LIB_FLAGS_LEN IMPLICIT NONE - INTEGER i_H5LIB_flags(H5LIB_FLAGS_LEN) + INTEGER, DIMENSION(1:H5LIB_FLAGS_LEN) :: i_H5LIB_flags END FUNCTION h5init1_flags_c + END INTERFACE - error_1 = h5init_types_c(predef_types, floating_types, integer_types) - error_2 = h5init_flags_c(H5D_flags, & + + error = h5init_types_c(predef_types, floating_types, integer_types) + + H5T_NATIVE_INTEGER_KIND(1:5) = predef_types(1:5) + H5T_NATIVE_INTEGER = predef_types(6) + H5T_NATIVE_REAL = predef_types(7) + H5T_NATIVE_DOUBLE = predef_types(8) + H5T_NATIVE_CHARACTER = predef_types(9) + H5T_STD_REF_OBJ = predef_types(10) + H5T_STD_REF_DSETREG = predef_types(11) + H5T_NATIVE_REAL_C_FLOAT = predef_types(12) + H5T_NATIVE_REAL_C_DOUBLE = predef_types(13) + H5T_NATIVE_REAL_C_LONG_DOUBLE = predef_types(14) + H5T_NATIVE_B8 = predef_types(15) + H5T_NATIVE_B16 = predef_types(16) + H5T_NATIVE_B32 = predef_types(17) + H5T_NATIVE_B64 = predef_types(18) + H5T_NATIVE_FLOAT_128 = predef_types(19) + + H5T_IEEE_F32BE = floating_types(1) + H5T_IEEE_F32LE = floating_types(2) + H5T_IEEE_F64BE = floating_types(3) + H5T_IEEE_F64LE = floating_types(4) + + H5T_STD_I8BE = integer_types(1) + H5T_STD_I8LE = integer_types(2) + H5T_STD_I16BE = integer_types(3) + H5T_STD_I16LE = integer_types(4) + H5T_STD_I32BE = integer_types(5) + H5T_STD_I32LE = integer_types(6) + H5T_STD_I64BE = integer_types(7) + H5T_STD_I64LE = integer_types(8) + H5T_STD_U8BE = integer_types(9) + H5T_STD_U8LE = integer_types(10) + H5T_STD_U16BE = integer_types(11) + H5T_STD_U16LE = integer_types(12) + H5T_STD_U32BE = integer_types(13) + H5T_STD_U32LE = integer_types(14) + H5T_STD_U64BE = integer_types(15) + H5T_STD_U64LE = integer_types(16) + H5T_STRING = integer_types(17) + H5T_STD_B8BE = integer_types(18) + H5T_STD_B8LE = integer_types(19) + H5T_STD_B16BE = integer_types(20) + H5T_STD_B16LE = integer_types(21) + H5T_STD_B32BE = integer_types(22) + H5T_STD_B32LE = integer_types(23) + H5T_STD_B64BE = integer_types(24) + H5T_STD_B64LE = integer_types(25) + H5T_FORTRAN_S1 = integer_types(26) + H5T_C_S1 = integer_types(27) + + error = error + h5init_flags_c(H5D_flags, & H5D_size_flags, & H5E_flags, & H5E_hid_flags, & @@ -169,8 +319,299 @@ CONTAINS H5Z_flags, & H5generic_flags,& H5generic_haddr_flags) - error_3 = h5init1_flags_c(H5LIB_flags ) - error = error_1 + error_2 + error_3 + ! + ! H5F flags + ! + H5F_ACC_RDWR_F = H5F_flags(1) + H5F_ACC_RDONLY_F = H5F_flags(2) + H5F_ACC_TRUNC_F = H5F_flags(3) + H5F_ACC_EXCL_F = H5F_flags(4) + H5F_ACC_DEBUG_F = H5F_flags(5) + H5F_SCOPE_LOCAL_F = H5F_flags(6) + H5F_SCOPE_GLOBAL_F = H5F_flags(7) + H5F_CLOSE_DEFAULT_F = H5F_flags(8) + H5F_CLOSE_WEAK_F = H5F_flags(9) + H5F_CLOSE_SEMI_F = H5F_flags(10) + H5F_CLOSE_STRONG_F = H5F_flags(11) + H5F_OBJ_FILE_F = H5F_flags(12) + H5F_OBJ_DATASET_F = H5F_flags(13) + H5F_OBJ_GROUP_F = H5F_flags(14) + H5F_OBJ_DATATYPE_F = H5F_flags(15) + H5F_OBJ_ALL_F = H5F_flags(16) + H5F_LIBVER_EARLIEST_F = H5F_flags(17) + H5F_LIBVER_LATEST_F = H5F_flags(18) + H5F_UNLIMITED_F = H5F_flags(19) + ! + ! H5generic flags + ! + H5_INDEX_UNKNOWN_F = H5generic_flags(1) + H5_INDEX_NAME_F = H5generic_flags(2) + H5_INDEX_CRT_ORDER_F = H5generic_flags(3) + H5_INDEX_N_F = H5generic_flags(4) + H5_ITER_UNKNOWN_F = H5generic_flags(5) + H5_ITER_INC_F = H5generic_flags(6) + H5_ITER_DEC_F = H5generic_flags(7) + H5_ITER_NATIVE_F = H5generic_flags(8) + H5_ITER_N_F = H5generic_flags(9) + + HADDR_UNDEF_F = H5generic_haddr_flags(1) + ! + ! H5G flags + ! + H5G_UNKNOWN_F = H5G_flags(1) + H5G_GROUP_F = H5G_flags(2) + H5G_DATASET_F = H5G_flags(3) + H5G_TYPE_F = H5G_flags(4) + H5G_SAME_LOC_F = H5G_flags(5) + H5G_LINK_ERROR_F = H5G_flags(6) + H5G_LINK_HARD_F = H5G_flags(7) + H5G_LINK_SOFT_F = H5G_flags(8) + H5G_STORAGE_TYPE_UNKNOWN_F = H5G_flags(9) + H5G_STORAGE_TYPE_SYMBOL_TABLE_F = H5G_flags(10) + H5G_STORAGE_TYPE_COMPACT_F = H5G_flags(11) + H5G_STORAGE_TYPE_DENSE_F = H5G_flags(12) + ! + ! H5D flags + ! + H5D_COMPACT_F = H5D_flags(1) + H5D_CONTIGUOUS_F = H5D_flags(2) + H5D_CHUNKED_F = H5D_flags(3) + H5D_ALLOC_TIME_ERROR_F = H5D_flags(4) + H5D_ALLOC_TIME_DEFAULT_F = H5D_flags(5) + H5D_ALLOC_TIME_EARLY_F = H5D_flags(6) + H5D_ALLOC_TIME_LATE_F = H5D_flags(7) + H5D_ALLOC_TIME_INCR_F = H5D_flags(8) + H5D_SPACE_STS_ERROR_F = H5D_flags(9) + H5D_SPACE_STS_NOT_ALLOCATED_F = H5D_flags(10) + H5D_SPACE_STS_PART_ALLOCATED_F = H5D_flags(11) + H5D_SPACE_STS_ALLOCATED_F = H5D_flags(12) + H5D_FILL_TIME_ERROR_F = H5D_flags(13) + H5D_FILL_TIME_ALLOC_F = H5D_flags(14) + H5D_FILL_TIME_NEVER_F = H5D_flags(15) + H5D_FILL_VALUE_ERROR_F = H5D_flags(16) + H5D_FILL_VALUE_UNDEFINED_F = H5D_flags(17) + H5D_FILL_VALUE_DEFAULT_F = H5D_flags(18) + H5D_FILL_VALUE_USER_DEFINED_F = H5D_flags(19) + H5D_CHUNK_CACHE_W0_DFLT_F = H5D_flags(20) + H5D_MPIO_NO_COLLECTIVE_F = H5D_flags(21) + H5D_MPIO_CHUNK_INDEPENDENT_F = H5D_flags(22) + H5D_MPIO_CHUNK_COLLECTIVE_F = H5D_flags(23) + H5D_MPIO_CHUNK_MIXED_F = H5D_flags(24) + H5D_MPIO_CONTIG_COLLECTIVE_F = H5D_flags(25) + H5D_VDS_ERROR_F = H5D_flags(26) + H5D_VDS_FIRST_MISSING_F = H5D_flags(27) + H5D_VDS_LAST_AVAILABLE_F = H5D_flags(28) + H5D_VIRTUAL_F = H5D_flags(29) + + H5D_CHUNK_CACHE_NSLOTS_DFLT_F = H5D_size_flags(1) + H5D_CHUNK_CACHE_NBYTES_DFLT_F = H5D_size_flags(2) + ! + ! H5E flags + ! + H5E_DEFAULT_F = H5E_hid_flags(1) + + H5E_MAJOR_F = H5E_flags(1) + H5E_MINOR_F = H5E_flags(2) + H5E_WALK_UPWARD_F = H5E_flags(3) + H5E_WALK_DOWNWARD_F = H5E_flags(4) + ! + ! H5FD flags + ! + H5FD_MPIO_INDEPENDENT_F = H5FD_flags(1) + H5FD_MPIO_COLLECTIVE_F = H5FD_flags(2) + H5FD_MEM_NOLIST_F = H5FD_flags(3) + H5FD_MEM_DEFAULT_F = H5FD_flags(4) + H5FD_MEM_SUPER_F = H5FD_flags(5) + H5FD_MEM_BTREE_F = H5FD_flags(6) + H5FD_MEM_DRAW_F = H5FD_flags(7) + H5FD_MEM_GHEAP_F = H5FD_flags(8) + H5FD_MEM_LHEAP_F = H5FD_flags(9) + H5FD_MEM_OHDR_F = H5FD_flags(10) + H5FD_MEM_NTYPES_F = H5FD_flags(11) + ! + ! H5FD file driver flags + ! + H5FD_CORE_F = H5FD_hid_flags(1) + H5FD_FAMILY_F = H5FD_hid_flags(2) + H5FD_LOG_F = H5FD_hid_flags(3) + H5FD_MPIO_F = H5FD_hid_flags(4) + H5FD_MULTI_F = H5FD_hid_flags(5) + H5FD_SEC2_F = H5FD_hid_flags(6) + H5FD_STDIO_F = H5FD_hid_flags(7) + ! + ! H5I flags declaration + ! + H5I_FILE_F = H5I_flags(1) + H5I_GROUP_F = H5I_flags(2) + H5I_DATATYPE_F = H5I_flags(3) + H5I_DATASPACE_F = H5I_flags(4) + H5I_DATASET_F = H5I_flags(5) + H5I_ATTR_F = H5I_flags(6) + H5I_BADID_F = H5I_flags(7) + ! + ! H5L flags + ! + H5L_TYPE_ERROR_F = H5L_flags(1) + H5L_TYPE_HARD_F = H5L_flags(2) + H5L_TYPE_SOFT_F = H5L_flags(3) + H5L_TYPE_EXTERNAL_F = H5L_flags(4) + H5L_SAME_LOC_F = H5L_flags(5) + H5L_LINK_CLASS_T_VERS_F = H5L_flags(6) + ! + ! H5O flags + ! + H5O_COPY_SHALLOW_HIERARCHY_F = h5o_flags(1) + H5O_COPY_EXPAND_SOFT_LINK_F = h5o_flags(2) + H5O_COPY_EXPAND_EXT_LINK_F = h5o_flags(3) + H5O_COPY_EXPAND_REFERENCE_F = h5o_flags(4) + H5O_COPY_WITHOUT_ATTR_FLAG_F = h5o_flags(5) + H5O_COPY_PRESERVE_NULL_FLAG_F = h5o_flags(6) + H5O_COPY_ALL_F = h5o_flags(7) + H5O_SHMESG_NONE_FLAG_F = h5o_flags(8) + H5O_SHMESG_SDSPACE_FLAG_F = h5o_flags(9) + H5O_SHMESG_DTYPE_FLAG_F = h5o_flags(10) + H5O_SHMESG_FILL_FLAG_F = h5o_flags(11) + H5O_SHMESG_PLINE_FLAG_F = h5o_flags(12) + H5O_SHMESG_ATTR_FLAG_F = h5o_flags(13) + H5O_SHMESG_ALL_FLAG_F = h5o_flags(14) + H5O_HDR_CHUNK0_SIZE_F = h5o_flags(15) + H5O_HDR_ATTR_CRT_ORDER_TRACK_F = h5o_flags(16) + H5O_HDR_ATTR_CRT_ORDER_INDEX_F = h5o_flags(17) + H5O_HDR_ATTR_STORE_PHASE_CHA_F = h5o_flags(18) + H5O_HDR_STORE_TIMES_F = h5o_flags(19) + H5O_HDR_ALL_FLAGS_F = h5o_flags(20) + H5O_SHMESG_MAX_NINDEXES_F = h5o_flags(21) + H5O_SHMESG_MAX_LIST_SIZE_F = h5o_flags(22) + H5O_TYPE_UNKNOWN_F = h5o_flags(23) + H5O_TYPE_GROUP_F = h5o_flags(24) + H5O_TYPE_DATASET_F = h5o_flags(25) + H5O_TYPE_NAMED_DATATYPE_F = h5o_flags(26) + H5O_TYPE_NTYPES_F = h5o_flags(27) + ! + ! H5P flags + ! + H5P_FILE_CREATE_F = H5P_flags(1) + H5P_FILE_ACCESS_F = H5P_flags(2) + H5P_DATASET_CREATE_F = H5P_flags(3) + H5P_DATASET_XFER_F = H5P_flags(4) + H5P_FILE_MOUNT_F = H5P_flags(5) + H5P_DEFAULT_F = H5P_flags(6) + H5P_ROOT_F = H5P_flags(7) + H5P_OBJECT_CREATE_F = H5P_flags(8) + H5P_DATASET_ACCESS_F = H5P_flags(9) + H5P_GROUP_CREATE_F = H5P_flags(10) + H5P_GROUP_ACCESS_F = H5P_flags(11) + H5P_DATATYPE_CREATE_F = H5P_flags(12) + H5P_DATATYPE_ACCESS_F = H5P_flags(13) + H5P_STRING_CREATE_F = H5P_flags(14) + H5P_ATTRIBUTE_CREATE_F = H5P_flags(15) + H5P_OBJECT_COPY_F = H5P_flags(16) + H5P_LINK_CREATE_F = H5P_flags(17) + H5P_LINK_ACCESS_F = H5P_flags(18) + ! + ! H5P integers flags + ! + H5P_CRT_ORDER_INDEXED_F = H5P_flags_int(1) + H5P_CRT_ORDER_TRACKED_F = H5P_flags_int(2) + ! + ! H5R flags + ! + H5R_OBJECT_F = H5R_flags(1) + H5R_DATASET_REGION_F = H5R_flags(2) + ! + ! H5S flags + ! + H5S_ALL_F = H5S_hid_flags(1) + + H5S_UNLIMITED_F = H5S_hsize_flags(1) + + H5S_SCALAR_F = H5S_flags(1) + H5S_SIMPLE_F = H5S_flags(2) + H5S_NULL_F = H5S_flags(3) + H5S_SELECT_SET_F = H5S_flags(4) + H5S_SELECT_OR_F = H5S_flags(5) + H5S_SELECT_NOOP_F = H5S_flags(6) + H5S_SELECT_AND_F = H5S_flags(7) + H5S_SELECT_XOR_F = H5S_flags(8) + H5S_SELECT_NOTB_F = H5S_flags(9) + H5S_SELECT_NOTA_F = H5S_flags(10) + H5S_SELECT_APPEND_F = H5S_flags(11) + H5S_SELECT_PREPEND_F = H5S_flags(12) + H5S_SELECT_INVALID_F = H5S_flags(13) + H5S_SEL_ERROR_F = H5S_flags(14) + H5S_SEL_NONE_F = H5S_flags(15) + H5S_SEL_POINTS_F = H5S_flags(16) + H5S_SEL_HYPERSLABS_F = H5S_flags(17) + H5S_SEL_ALL_F = H5S_flags(18) + ! + ! H5T flags declaration + ! + H5T_NO_CLASS_F = H5T_flags(1) + H5T_INTEGER_F = H5T_flags(2) + H5T_FLOAT_F = H5T_flags(3) + H5T_TIME_F = H5T_flags(4) + H5T_STRING_F = H5T_flags(5) + H5T_BITFIELD_F = H5T_flags(6) + H5T_OPAQUE_F = H5T_flags(7) + H5T_COMPOUND_F = H5T_flags(8) + H5T_REFERENCE_F = H5T_flags(9) + H5T_ENUM_F = H5T_flags(10) + H5T_ORDER_LE_F = H5T_flags(11) + H5T_ORDER_BE_F = H5T_flags(12) + H5T_ORDER_MIXED_F = H5T_flags(13) + H5T_ORDER_VAX_F = H5T_flags(14) + H5T_ORDER_NONE_F = H5T_flags(15) + H5T_PAD_ZERO_F = H5T_flags(16) + H5T_PAD_ONE_F = H5T_flags(17) + H5T_PAD_BACKGROUND_F = H5T_flags(18) + H5T_PAD_ERROR_F = H5T_flags(19) + H5T_SGN_NONE_F = H5T_flags(20) + H5T_SGN_2_F = H5T_flags(21) + H5T_SGN_ERROR_F = H5T_flags(22) + H5T_NORM_IMPLIED_F = H5T_flags(23) + H5T_NORM_MSBSET_F = H5T_flags(24) + H5T_NORM_NONE_F = H5T_flags(25) + H5T_CSET_ASCII_F = H5T_flags(26) + H5T_CSET_UTF8_F = H5T_flags(27) + H5T_STR_NULLTERM_F = H5T_flags(28) + H5T_STR_NULLPAD_F = H5T_flags(29) + H5T_STR_SPACEPAD_F = H5T_flags(30) + H5T_STR_ERROR_F = H5T_flags(31) + H5T_VLEN_F = H5T_flags(32) + H5T_ARRAY_F = H5T_flags(33) + H5T_DIR_ASCEND_F = H5T_flags(34) + H5T_DIR_DESCEND_F = H5T_flags(35) + ! + ! H5Z flags + ! + H5Z_FILTER_ERROR_F = H5Z_flags(1) + H5Z_FILTER_NONE_F = H5Z_flags(2) + H5Z_FILTER_DEFLATE_F = H5Z_flags(3) + H5Z_FILTER_SHUFFLE_F = H5Z_flags(4) + H5Z_FILTER_FLETCHER32_F = H5Z_flags(5) + H5Z_ERROR_EDC_F = H5Z_flags(6) + H5Z_DISABLE_EDC_F = H5Z_flags(7) + H5Z_ENABLE_EDC_F = H5Z_flags(8) + H5Z_NO_EDC_F = H5Z_flags(9) + H5Z_FILTER_SZIP_F = H5Z_flags(10) + H5Z_FLAG_OPTIONAL_F = H5Z_flags(11) + H5Z_FILTER_ENCODE_ENABLED_F = H5Z_flags(12) + H5Z_FILTER_DECODE_ENABLED_F = H5Z_flags(13) + H5Z_FILTER_ALL_F = H5Z_flags(14) + H5Z_FILTER_NBIT_F = H5Z_flags(15) + H5Z_FILTER_SCALEOFFSET_F = H5Z_flags(16) + H5Z_SO_FLOAT_DSCALE_F = H5Z_flags(17) + H5Z_SO_FLOAT_ESCALE_F = H5Z_flags(18) + H5Z_SO_INT_F = H5Z_flags(19) + H5Z_SO_INT_MINBITS_DEFAULT_F = H5Z_flags(20) + + error = error + h5init1_flags_c(H5LIB_flags) + ! + ! H5 Library flags + ! + H5_SZIP_EC_OM_F = H5LIB_flags(1) + H5_SZIP_NN_OM_F = H5LIB_flags(2) + END SUBROUTINE h5open_f !****s* H5LIB/h5close_f @@ -201,25 +642,23 @@ CONTAINS IMPLICIT NONE INTEGER, INTENT(OUT) :: error !***** - INTEGER :: error_1 INTERFACE INTEGER FUNCTION h5close_types_c(p_types, P_TYPES_LEN, & f_types, F_TYPES_LEN, & i_types, I_TYPES_LEN ) & BIND(C,NAME='h5close_types_c') IMPORT :: HID_T - INTEGER P_TYPES_LEN - INTEGER F_TYPES_LEN - INTEGER I_TYPES_LEN - INTEGER(HID_T), DIMENSION(P_TYPES_LEN) :: p_types - INTEGER(HID_T), DIMENSION(F_TYPES_LEN) :: f_types - INTEGER(HID_T), DIMENSION(I_TYPES_LEN) :: i_types + INTEGER :: P_TYPES_LEN + INTEGER :: F_TYPES_LEN + INTEGER :: I_TYPES_LEN + INTEGER(HID_T), DIMENSION(1:P_TYPES_LEN) :: p_types + INTEGER(HID_T), DIMENSION(1:F_TYPES_LEN) :: f_types + INTEGER(HID_T), DIMENSION(1:I_TYPES_LEN) :: i_types END FUNCTION h5close_types_c END INTERFACE - error_1 = h5close_types_c(predef_types, PREDEF_TYPES_LEN, & + error = h5close_types_c(predef_types, PREDEF_TYPES_LEN, & floating_types, FLOATING_TYPES_LEN, & integer_types, INTEGER_TYPES_LEN ) - error = error_1 END SUBROUTINE h5close_f diff --git a/fortran/src/H5f90global.F90 b/fortran/src/H5f90global.F90 index 629418a..078778a 100644 --- a/fortran/src/H5f90global.F90 +++ b/fortran/src/H5f90global.F90 @@ -50,7 +50,6 @@ MODULE H5GLOBAL END ENUM INTEGER, PARAMETER :: ENUM_T = KIND(enum_dtype) - ! Definitions for reference datatypes. ! If you change the value of these parameters, do not forget to change corresponding ! values in the H5f90.h file. @@ -71,184 +70,170 @@ MODULE H5GLOBAL INTEGER, DIMENSION(1:REF_REG_BUF_LEN) :: ref END TYPE hdset_reg_ref_t_f - INTEGER, PARAMETER :: PREDEF_TYPES_LEN = 19 ! Do not forget to change this - ! value when new predefined - ! datatypes are added - - ! Do not forget to change the following line when new predefined - ! floating data types are added + ! Do not forget to change these values when new predefined + ! datatypes are added + INTEGER, PARAMETER :: PREDEF_TYPES_LEN = 19 INTEGER, PARAMETER :: FLOATING_TYPES_LEN = 4 - - ! Do not forget to change the following line when new predefined - ! integer data types are added INTEGER, PARAMETER :: INTEGER_TYPES_LEN = 27 - INTEGER(HID_T) :: H5T_NATIVE_REAL_C_FLOAT, & - H5T_NATIVE_REAL_C_DOUBLE, & - H5T_NATIVE_REAL_C_LONG_DOUBLE, & - H5T_NATIVE_INTEGER, & - H5T_NATIVE_REAL, & - H5T_NATIVE_DOUBLE, & - H5T_NATIVE_CHARACTER , & - H5T_STD_REF_OBJ, & - H5T_STD_REF_DSETREG, & - H5T_IEEE_F32BE, & - H5T_IEEE_F32LE, & - H5T_IEEE_F64BE, & - H5T_IEEE_F64LE, & - H5T_STD_I8BE, & - H5T_STD_I8LE, & - H5T_STD_I16BE, & - H5T_STD_I16LE, & - H5T_STD_I32BE, & - H5T_STD_I32LE, & - H5T_STD_I64BE, & - H5T_STD_I64LE, & - H5T_STD_U8BE, & - H5T_STD_U8LE, & - H5T_STD_U16BE, & - H5T_STD_U16LE, & - H5T_STD_U32BE + ! These arrays need to be global because they are used in + ! both h5open_f and in h5close_f; initialize to fix linking issues + ! on OSX and Intel compilers. + INTEGER(HID_T), DIMENSION(1:PREDEF_TYPES_LEN) :: predef_types = -1 + INTEGER(HID_T), DIMENSION(1:FLOATING_TYPES_LEN) :: floating_types = -1 + INTEGER(HID_T), DIMENSION(1:INTEGER_TYPES_LEN) :: integer_types = -1 + + !DEC$if defined(BUILD_HDF5_DLL) + !DEC$ATTRIBUTES DLLEXPORT :: H5T_NATIVE_REAL_C_FLOAT + !DEC$ATTRIBUTES DLLEXPORT :: H5T_NATIVE_REAL_C_DOUBLE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_NATIVE_REAL_C_LONG_DOUBLE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_NATIVE_INTEGER + !DEC$ATTRIBUTES DLLEXPORT :: H5T_NATIVE_REAL + !DEC$ATTRIBUTES DLLEXPORT :: H5T_NATIVE_DOUBLE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_NATIVE_CHARACTER + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_REF_OBJ + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_REF_DSETREG + !DEC$ATTRIBUTES DLLEXPORT :: H5T_IEEE_F32BE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_IEEE_F32LE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_IEEE_F64BE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_IEEE_F64LE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_I8BE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_I8LE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_I16BE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_I16LE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_I32BE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_I32LE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_I64BE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_I64LE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_U8BE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_U8LE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_U16BE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_U16LE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_U32BE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_U32LE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_U64BE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_U64LE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STRING + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_B8BE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_B8LE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_B16BE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_B16LE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_B32BE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_B32LE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_B64BE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_B64LE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_NATIVE_B8 + !DEC$ATTRIBUTES DLLEXPORT :: H5T_NATIVE_B16 + !DEC$ATTRIBUTES DLLEXPORT :: H5T_NATIVE_B32 + !DEC$ATTRIBUTES DLLEXPORT :: H5T_NATIVE_B64 + !DEC$ATTRIBUTES DLLEXPORT :: H5T_FORTRAN_S1 + !DEC$ATTRIBUTES DLLEXPORT :: H5T_C_S1 + !DEC$ATTRIBUTES DLLEXPORT :: H5T_NATIVE_INTEGER_KIND + !DEC$ATTRIBUTES DLLEXPORT :: H5T_NATIVE_FLOAT_128 + !DEC$endif + + INTEGER(HID_T) :: H5T_NATIVE_REAL_C_FLOAT + INTEGER(HID_T) :: H5T_NATIVE_REAL_C_DOUBLE + INTEGER(HID_T) :: H5T_NATIVE_REAL_C_LONG_DOUBLE + INTEGER(HID_T) :: H5T_NATIVE_INTEGER + INTEGER(HID_T) :: H5T_NATIVE_REAL + INTEGER(HID_T) :: H5T_NATIVE_DOUBLE + INTEGER(HID_T) :: H5T_NATIVE_CHARACTER + INTEGER(HID_T) :: H5T_STD_REF_OBJ + INTEGER(HID_T) :: H5T_STD_REF_DSETREG + INTEGER(HID_T) :: H5T_IEEE_F32BE + INTEGER(HID_T) :: H5T_IEEE_F32LE + INTEGER(HID_T) :: H5T_IEEE_F64BE + INTEGER(HID_T) :: H5T_IEEE_F64LE + INTEGER(HID_T) :: H5T_STD_I8BE + INTEGER(HID_T) :: H5T_STD_I8LE + INTEGER(HID_T) :: H5T_STD_I16BE + INTEGER(HID_T) :: H5T_STD_I16LE + INTEGER(HID_T) :: H5T_STD_I32BE + INTEGER(HID_T) :: H5T_STD_I32LE + INTEGER(HID_T) :: H5T_STD_I64BE + INTEGER(HID_T) :: H5T_STD_I64LE + INTEGER(HID_T) :: H5T_STD_U8BE + INTEGER(HID_T) :: H5T_STD_U8LE + INTEGER(HID_T) :: H5T_STD_U16BE + INTEGER(HID_T) :: H5T_STD_U16LE + INTEGER(HID_T) :: H5T_STD_U32BE + INTEGER(HID_T) :: H5T_STD_U32LE + INTEGER(HID_T) :: H5T_STD_U64BE + INTEGER(HID_T) :: H5T_STD_U64LE + INTEGER(HID_T) :: H5T_STRING + INTEGER(HID_T) :: H5T_STD_B8BE + INTEGER(HID_T) :: H5T_STD_B8LE + INTEGER(HID_T) :: H5T_STD_B16BE + INTEGER(HID_T) :: H5T_STD_B16LE + INTEGER(HID_T) :: H5T_STD_B32BE + INTEGER(HID_T) :: H5T_STD_B32LE + INTEGER(HID_T) :: H5T_STD_B64BE + INTEGER(HID_T) :: H5T_STD_B64LE + INTEGER(HID_T) :: H5T_NATIVE_B8 + INTEGER(HID_T) :: H5T_NATIVE_B16 + INTEGER(HID_T) :: H5T_NATIVE_B32 + INTEGER(HID_T) :: H5T_NATIVE_B64 + INTEGER(HID_T) :: H5T_FORTRAN_S1 + INTEGER(HID_T) :: H5T_C_S1 INTEGER, PARAMETER :: NUM_NATIVE_INTEGER_KIND = 5 ! INTEGER*1, INTEGER*2, INTEGER*4, INTEGER*8, INTEGER*16 INTEGER(HID_T), DIMENSION(1:NUM_NATIVE_INTEGER_KIND) :: H5T_NATIVE_INTEGER_KIND INTEGER(HID_T) :: H5T_NATIVE_FLOAT_128 ! NEED IFDEF -MSB- - -! NOTE: Splitting the line since the Fortran 95 standard limits the number of -! continuation lines to 39; the F03/F08 standard limits the number -! to 255 lines. - - INTEGER(HID_T) :: H5T_STD_U32LE, & - H5T_STD_U64BE, & - H5T_STD_U64LE, & - H5T_STRING, & - H5T_STD_B8BE, & - H5T_STD_B8LE, & - H5T_STD_B16BE, & - H5T_STD_B16LE, & - H5T_STD_B32BE, & - H5T_STD_B32LE, & - H5T_STD_B64BE, & - H5T_STD_B64LE, & - H5T_NATIVE_B8, & - H5T_NATIVE_B16, & - H5T_NATIVE_B32, & - H5T_NATIVE_B64, & - H5T_FORTRAN_S1, & - H5T_C_S1 - - - INTEGER(HID_T), DIMENSION(PREDEF_TYPES_LEN) :: predef_types - EQUIVALENCE (predef_types(1), H5T_NATIVE_INTEGER_KIND(1)) - ! EQUIVALENCE predef_types(2:5) are unnecessary and violate the standard - EQUIVALENCE (predef_types(6), H5T_NATIVE_INTEGER) - EQUIVALENCE (predef_types(7), H5T_NATIVE_REAL) - EQUIVALENCE (predef_types(8), H5T_NATIVE_DOUBLE) - EQUIVALENCE (predef_types(9), H5T_NATIVE_CHARACTER) - EQUIVALENCE (predef_types(10), H5T_STD_REF_OBJ) - EQUIVALENCE (predef_types(11), H5T_STD_REF_DSETREG) - EQUIVALENCE (predef_types(12), H5T_NATIVE_REAL_C_FLOAT) - EQUIVALENCE (predef_types(13), H5T_NATIVE_REAL_C_DOUBLE) - EQUIVALENCE (predef_types(14), H5T_NATIVE_REAL_C_LONG_DOUBLE) - EQUIVALENCE (predef_types(15), H5T_NATIVE_B8 ) - EQUIVALENCE (predef_types(16), H5T_NATIVE_B16) - EQUIVALENCE (predef_types(17), H5T_NATIVE_B32) - EQUIVALENCE (predef_types(18), H5T_NATIVE_B64) - EQUIVALENCE (predef_types(19), H5T_NATIVE_FLOAT_128) ! ADDED NEW TYPE -MSB- - - INTEGER(HID_T), DIMENSION(FLOATING_TYPES_LEN) :: floating_types - EQUIVALENCE (floating_types(1), H5T_IEEE_F32BE ) - EQUIVALENCE (floating_types(2), H5T_IEEE_F32LE) - EQUIVALENCE (floating_types(3), H5T_IEEE_F64BE) - EQUIVALENCE (floating_types(4), H5T_IEEE_F64LE) - - INTEGER(HID_T), DIMENSION(INTEGER_TYPES_LEN) :: integer_types - EQUIVALENCE (integer_types(1), H5T_STD_I8BE ) - EQUIVALENCE (integer_types(2), H5T_STD_I8LE) - EQUIVALENCE (integer_types(3), H5T_STD_I16BE) - EQUIVALENCE (integer_types(4), H5T_STD_I16LE) - EQUIVALENCE (integer_types(5), H5T_STD_I32BE) - EQUIVALENCE (integer_types(6), H5T_STD_I32LE) - EQUIVALENCE (integer_types(7), H5T_STD_I64BE) - EQUIVALENCE (integer_types(8), H5T_STD_I64LE) - EQUIVALENCE (integer_types(9), H5T_STD_U8BE) - EQUIVALENCE (integer_types(10), H5T_STD_U8LE) - EQUIVALENCE (integer_types(11), H5T_STD_U16BE) - EQUIVALENCE (integer_types(12), H5T_STD_U16LE) - EQUIVALENCE (integer_types(13), H5T_STD_U32BE) - EQUIVALENCE (integer_types(14), H5T_STD_U32LE) - EQUIVALENCE (integer_types(15), H5T_STD_U64BE) - EQUIVALENCE (integer_types(16), H5T_STD_U64LE) - EQUIVALENCE (integer_types(17), H5T_STRING) - EQUIVALENCE (integer_types(18), H5T_STD_B8BE) - EQUIVALENCE (integer_types(19), H5T_STD_B8LE) - EQUIVALENCE (integer_types(20), H5T_STD_B16BE) - EQUIVALENCE (integer_types(21), H5T_STD_B16LE) - EQUIVALENCE (integer_types(22), H5T_STD_B32BE) - EQUIVALENCE (integer_types(23), H5T_STD_B32LE) - EQUIVALENCE (integer_types(24), H5T_STD_B64BE) - EQUIVALENCE (integer_types(25), H5T_STD_B64LE) - EQUIVALENCE (integer_types(26), H5T_FORTRAN_S1) - EQUIVALENCE (integer_types(27), H5T_C_S1) - - - ! COMMON /PREDEFINED_TYPES/ H5T_NATIVE_INTEGER, & - ! H5T_NATIVE_REAL, & - ! H5T_NATIVE_DOUBLE, & - ! H5T_NATIVE_CHARACTER, & - ! H5T_STD_REF_OBJ, & - ! H5T_STD_REF_DSETREG - !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: /PREDEFINED_TYPES/ - !DEC$endif - COMMON /PREDEFINED_TYPES/ predef_types - - ! COMMON /FLOATING_TYPES/ H5T_IEEE_F32BE, & - ! H5T_IEEE_F32LE, & - ! H5T_IEEE_F64BE, & - ! H5T_IEEE_F64LE - !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: /FLOATING_TYPES/ - !DEC$endif - COMMON /FLOATING_TYPES/ floating_types ! - ! COMMON /INTEGER_TYPES/ H5T_STD_I8BE, & - ! H5T_STD_I8LE, & - ! H5T_STD_I16BE, & - ! H5T_STD_I16LE, & - ! H5T_STD_I32BE, & - ! H5T_STD_I32LE, & - ! H5T_STD_I64BE, & - ! H5T_STD_I64LE, & - ! H5T_STD_U8BE, & - ! H5T_STD_U8LE, & - ! H5T_STD_U16BE, & - ! H5T_STD_U16LE, & - ! H5T_STD_U32BE, & - ! H5T_STD_U32LE, & - ! H5T_STD_U64BE, & - ! H5T_STD_U64LE + ! H5generic flags declaration + ! !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: /INTEGER_TYPES/ + !DEC$ATTRIBUTES DLLEXPORT :: H5_INDEX_UNKNOWN_F + !DEC$ATTRIBUTES DLLEXPORT :: H5_INDEX_NAME_F + !DEC$ATTRIBUTES DLLEXPORT :: H5_INDEX_CRT_ORDER_F + !DEC$ATTRIBUTES DLLEXPORT :: H5_INDEX_N_F + !DEC$ATTRIBUTES DLLEXPORT :: H5_ITER_UNKNOWN_F + !DEC$ATTRIBUTES DLLEXPORT :: H5_ITER_INC_F + !DEC$ATTRIBUTES DLLEXPORT :: H5_ITER_DEC_F + !DEC$ATTRIBUTES DLLEXPORT :: H5_ITER_NATIVE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5_ITER_N_F + !DEC$ATTRIBUTES DLLEXPORT :: HADDR_UNDEF_F !DEC$endif - COMMON /INTEGER_TYPES/ integer_types - ! - ! Fortran flags - ! - ! - ! H5F flags (DO NOT FORGET TO UPDATE WHEN NEW FLAGS ARE ADDED !) + + INTEGER :: H5_INDEX_UNKNOWN_F + INTEGER :: H5_INDEX_NAME_F + INTEGER :: H5_INDEX_CRT_ORDER_F + INTEGER :: H5_INDEX_N_F + INTEGER :: H5_ITER_UNKNOWN_F + INTEGER :: H5_ITER_INC_F + INTEGER :: H5_ITER_DEC_F + INTEGER :: H5_ITER_NATIVE_F + INTEGER :: H5_ITER_N_F + + INTEGER(HADDR_T) :: HADDR_UNDEF_F ! ! H5F flags declaration ! - INTEGER, PARAMETER :: H5F_FLAGS_LEN = 19 - INTEGER :: H5F_flags(H5F_FLAGS_LEN) !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: /H5F_FLAGS/ + !DEC$ATTRIBUTES DLLEXPORT :: H5F_ACC_RDWR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_ACC_RDONLY_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_ACC_TRUNC_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_ACC_EXCL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_ACC_DEBUG_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_SCOPE_LOCAL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_SCOPE_GLOBAL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_CLOSE_DEFAULT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_CLOSE_WEAK_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_CLOSE_SEMI_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_CLOSE_STRONG_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_OBJ_FILE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_OBJ_DATASET_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_OBJ_GROUP_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_OBJ_DATATYPE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_OBJ_ALL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_LIBVER_EARLIEST_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_LIBVER_LATEST_F + !DEC$ATTRIBUTES DLLEXPORT :: H5F_UNLIMITED_F !DEC$endif - COMMON /H5F_FLAGS/ H5F_flags - + INTEGER :: H5F_ACC_RDWR_F INTEGER :: H5F_ACC_RDONLY_F INTEGER :: H5F_ACC_TRUNC_F @@ -268,77 +253,26 @@ MODULE H5GLOBAL INTEGER :: H5F_LIBVER_EARLIEST_F INTEGER :: H5F_LIBVER_LATEST_F INTEGER :: H5F_UNLIMITED_F - - EQUIVALENCE(H5F_flags(1), H5F_ACC_RDWR_F) - EQUIVALENCE(H5F_flags(2), H5F_ACC_RDONLY_F) - EQUIVALENCE(H5F_flags(3), H5F_ACC_TRUNC_F) - EQUIVALENCE(H5F_flags(4), H5F_ACC_EXCL_F) - EQUIVALENCE(H5F_flags(5), H5F_ACC_DEBUG_F) - EQUIVALENCE(H5F_flags(6), H5F_SCOPE_LOCAL_F) - EQUIVALENCE(H5F_flags(7), H5F_SCOPE_GLOBAL_F) - EQUIVALENCE(H5F_flags(8), H5F_CLOSE_DEFAULT_F) - EQUIVALENCE(H5F_flags(9), H5F_CLOSE_WEAK_F) - EQUIVALENCE(H5F_flags(10), H5F_CLOSE_SEMI_F) - EQUIVALENCE(H5F_flags(11), H5F_CLOSE_STRONG_F) - EQUIVALENCE(H5F_flags(12), H5F_OBJ_FILE_F) - EQUIVALENCE(H5F_flags(13), H5F_OBJ_DATASET_F) - EQUIVALENCE(H5F_flags(14), H5F_OBJ_GROUP_F) - EQUIVALENCE(H5F_flags(15), H5F_OBJ_DATATYPE_F) - EQUIVALENCE(H5F_flags(16), H5F_OBJ_ALL_F) - EQUIVALENCE(H5F_flags(17), H5F_LIBVER_EARLIEST_F) - EQUIVALENCE(H5F_flags(18), H5F_LIBVER_LATEST_F) - EQUIVALENCE(H5F_flags(19), H5F_UNLIMITED_F) - ! - ! H5generic flags declaration - ! - INTEGER, PARAMETER :: H5generic_FLAGS_LEN = 9 - INTEGER :: H5generic_flags(H5generic_FLAGS_LEN) - !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: /H5generic_FLAGS/ - !DEC$endif - COMMON /H5generic_FLAGS/ H5generic_flags - - INTEGER :: H5_INDEX_UNKNOWN_F - INTEGER :: H5_INDEX_NAME_F - INTEGER :: H5_INDEX_CRT_ORDER_F - INTEGER :: H5_INDEX_N_F - INTEGER :: H5_ITER_UNKNOWN_F - INTEGER :: H5_ITER_INC_F - INTEGER :: H5_ITER_DEC_F - INTEGER :: H5_ITER_NATIVE_F - INTEGER :: H5_ITER_N_F - - EQUIVALENCE(H5generic_flags(1), H5_INDEX_UNKNOWN_F) - EQUIVALENCE(H5generic_flags(2), H5_INDEX_NAME_F) - EQUIVALENCE(H5generic_flags(3), H5_INDEX_CRT_ORDER_F) - EQUIVALENCE(H5generic_flags(4), H5_INDEX_N_F) - EQUIVALENCE(H5generic_flags(5), H5_ITER_UNKNOWN_F) - EQUIVALENCE(H5generic_flags(6), H5_ITER_INC_F) - EQUIVALENCE(H5generic_flags(7), H5_ITER_DEC_F) - EQUIVALENCE(H5generic_flags(8), H5_ITER_NATIVE_F) - EQUIVALENCE(H5generic_flags(9), H5_ITER_N_F) - - INTEGER, PARAMETER :: H5generic_haddr_FLAGS_LEN = 1 - INTEGER(HADDR_T) :: H5generic_haddr_flags(H5generic_haddr_FLAGS_LEN) - !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: /H5generic_haddr_FLAGS/ - !DEC$endif - COMMON /H5generic_haddr_FLAGS/ H5generic_haddr_flags - - INTEGER(HADDR_T) :: HADDR_UNDEF_F - - EQUIVALENCE(H5generic_haddr_flags(1), HADDR_UNDEF_F) - ! ! H5G flags declaration ! - INTEGER, PARAMETER :: H5G_FLAGS_LEN = 12 - INTEGER :: H5G_flags(H5G_FLAGS_LEN) !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: /H5G_FLAGS/ + !DEC$ATTRIBUTES DLLEXPORT :: H5G_UNKNOWN_F + !DEC$ATTRIBUTES DLLEXPORT :: H5G_GROUP_F + !DEC$ATTRIBUTES DLLEXPORT :: H5G_DATASET_F + !DEC$ATTRIBUTES DLLEXPORT :: H5G_TYPE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5G_LINK_F + !DEC$ATTRIBUTES DLLEXPORT :: H5G_UDLINK_F + !DEC$ATTRIBUTES DLLEXPORT :: H5G_SAME_LOC_F + !DEC$ATTRIBUTES DLLEXPORT :: H5G_LINK_ERROR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5G_LINK_HARD_F + !DEC$ATTRIBUTES DLLEXPORT :: H5G_LINK_SOFT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5G_STORAGE_TYPE_UNKNOWN_F + !DEC$ATTRIBUTES DLLEXPORT :: H5G_STORAGE_TYPE_SYMBOL_TABLE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5G_STORAGE_TYPE_COMPACT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5G_STORAGE_TYPE_DENSE_F !DEC$endif - COMMON /H5G_FLAGS/ H5G_flags - + INTEGER :: H5G_UNKNOWN_F INTEGER :: H5G_GROUP_F INTEGER :: H5G_DATASET_F @@ -353,35 +287,43 @@ MODULE H5GLOBAL INTEGER :: H5G_STORAGE_TYPE_SYMBOL_TABLE_F INTEGER :: H5G_STORAGE_TYPE_COMPACT_F INTEGER :: H5G_STORAGE_TYPE_DENSE_F - - EQUIVALENCE(H5G_flags(1), H5G_UNKNOWN_F) ! Unknown object type - EQUIVALENCE(H5G_flags(2), H5G_GROUP_F) ! Object is a group - EQUIVALENCE(H5G_flags(3), H5G_DATASET_F) ! Object is a dataset - EQUIVALENCE(H5G_flags(4), H5G_TYPE_F) ! Object is a named data type - EQUIVALENCE(H5G_flags(5), H5G_SAME_LOC_F) - EQUIVALENCE(H5G_flags(6), H5G_LINK_ERROR_F) - EQUIVALENCE(H5G_flags(7), H5G_LINK_HARD_F) - EQUIVALENCE(H5G_flags(8), H5G_LINK_SOFT_F) - - EQUIVALENCE(H5G_flags(9), H5G_STORAGE_TYPE_UNKNOWN_F ) - EQUIVALENCE(H5G_flags(10), H5G_STORAGE_TYPE_SYMBOL_TABLE_F) - EQUIVALENCE(H5G_flags(11), H5G_STORAGE_TYPE_COMPACT_F) - EQUIVALENCE(H5G_flags(12), H5G_STORAGE_TYPE_DENSE_F) - ! ! H5D flags declaration ! - INTEGER, PARAMETER :: H5D_FLAGS_LEN = 29 - INTEGER :: H5D_flags(H5D_FLAGS_LEN) - INTEGER, PARAMETER :: H5D_SIZE_FLAGS_LEN = 2 - INTEGER(SIZE_T) :: H5D_size_flags(H5D_SIZE_FLAGS_LEN) !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: /H5D_FLAGS/ - !DEC$ATTRIBUTES DLLEXPORT :: /H5D_SIZE_FLAGS/ + !DEC$ATTRIBUTES DLLEXPORT :: H5D_COMPACT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_CONTIGUOUS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_CHUNKED_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_ALLOC_TIME_ERROR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_ALLOC_TIME_DEFAULT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_ALLOC_TIME_EARLY_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_ALLOC_TIME_LATE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_ALLOC_TIME_INCR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_SPACE_STS_ERROR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_SPACE_STS_NOT_ALLOCATED_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_SPACE_STS_PART_ALLOCATED_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_SPACE_STS_ALLOCATED_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_FILL_TIME_ERROR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_FILL_TIME_ALLOC_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_FILL_TIME_NEVER_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_FILL_VALUE_ERROR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_FILL_VALUE_UNDEFINED_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_FILL_VALUE_DEFAULT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_FILL_VALUE_USER_DEFINED_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_CHUNK_CACHE_NSLOTS_DFLT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_CHUNK_CACHE_NBYTES_DFLT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_CHUNK_CACHE_W0_DFLT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_MPIO_NO_COLLECTIVE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_MPIO_CHUNK_INDEPENDENT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_MPIO_CHUNK_COLLECTIVE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_MPIO_CHUNK_MIXED_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_MPIO_CONTIG_COLLECTIVE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_VDS_ERROR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_VDS_FIRST_MISSING_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_VDS_LAST_AVAILABLE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5D_VIRTUAL_F !DEC$endif - COMMON /H5D_FLAGS/ H5D_flags - COMMON /H5D_SIZE_FLAGS/ H5D_size_flags - + INTEGER :: H5D_COMPACT_F INTEGER :: H5D_CONTIGUOUS_F INTEGER :: H5D_CHUNKED_F @@ -406,13 +348,14 @@ MODULE H5GLOBAL INTEGER :: H5D_FILL_VALUE_DEFAULT_F INTEGER :: H5D_FILL_VALUE_USER_DEFINED_F -! shortened "_DEFAULT" to "_DFLT" to satisfy the limit of 31 -! characters for variable names in Fortran. -! shortened "_CONTIGUOUS" to "_CONTIG" to satisfy the limit of 31 -! characters for variable names in Fortran. - + ! shortened "_DEFAULT" to "_DFLT" to satisfy the limit of 31 + ! characters for variable names in Fortran. + ! shortened "_CONTIGUOUS" to "_CONTIG" to satisfy the limit of 31 + ! characters for variable names in Fortran. + INTEGER(SIZE_T) :: H5D_CHUNK_CACHE_NSLOTS_DFLT_F INTEGER(SIZE_T) :: H5D_CHUNK_CACHE_NBYTES_DFLT_F + INTEGER :: H5D_CHUNK_CACHE_W0_DFLT_F INTEGER :: H5D_MPIO_NO_COLLECTIVE_F INTEGER :: H5D_MPIO_CHUNK_INDEPENDENT_F @@ -423,80 +366,45 @@ MODULE H5GLOBAL INTEGER :: H5D_VDS_FIRST_MISSING_F INTEGER :: H5D_VDS_LAST_AVAILABLE_F INTEGER :: H5D_VIRTUAL_F - - EQUIVALENCE(H5D_flags(1), H5D_COMPACT_F) - EQUIVALENCE(H5D_flags(2), H5D_CONTIGUOUS_F) - EQUIVALENCE(H5D_flags(3), H5D_CHUNKED_F) - - EQUIVALENCE(H5D_flags(4), H5D_ALLOC_TIME_ERROR_F) - EQUIVALENCE(H5D_flags(5), H5D_ALLOC_TIME_DEFAULT_F) - EQUIVALENCE(H5D_flags(6), H5D_ALLOC_TIME_EARLY_F) - EQUIVALENCE(H5D_flags(7), H5D_ALLOC_TIME_LATE_F) - EQUIVALENCE(H5D_flags(8), H5D_ALLOC_TIME_INCR_F) - - EQUIVALENCE(H5D_flags(9), H5D_SPACE_STS_ERROR_F) - EQUIVALENCE(H5D_flags(10), H5D_SPACE_STS_NOT_ALLOCATED_F) - EQUIVALENCE(H5D_flags(11), H5D_SPACE_STS_PART_ALLOCATED_F) - EQUIVALENCE(H5D_flags(12), H5D_SPACE_STS_ALLOCATED_F) - - EQUIVALENCE(H5D_flags(13), H5D_FILL_TIME_ERROR_F) - EQUIVALENCE(H5D_flags(14), H5D_FILL_TIME_ALLOC_F) - EQUIVALENCE(H5D_flags(15), H5D_FILL_TIME_NEVER_F) - - EQUIVALENCE(H5D_flags(16), H5D_FILL_VALUE_ERROR_F) - EQUIVALENCE(H5D_flags(17), H5D_FILL_VALUE_UNDEFINED_F) - EQUIVALENCE(H5D_flags(18), H5D_FILL_VALUE_DEFAULT_F) - EQUIVALENCE(H5D_flags(19), H5D_FILL_VALUE_USER_DEFINED_F) - - EQUIVALENCE(H5D_flags(20), H5D_CHUNK_CACHE_W0_DFLT_F) - EQUIVALENCE(H5D_flags(21), H5D_MPIO_NO_COLLECTIVE_F) - EQUIVALENCE(H5D_flags(22), H5D_MPIO_CHUNK_INDEPENDENT_F) - EQUIVALENCE(H5D_flags(23), H5D_MPIO_CHUNK_COLLECTIVE_F) - EQUIVALENCE(H5D_flags(24), H5D_MPIO_CHUNK_MIXED_F) - EQUIVALENCE(H5D_flags(25), H5D_MPIO_CONTIG_COLLECTIVE_F) - EQUIVALENCE(H5D_flags(26), H5D_VDS_ERROR_F) - EQUIVALENCE(H5D_flags(27), H5D_VDS_FIRST_MISSING_F) - EQUIVALENCE(H5D_flags(28), H5D_VDS_LAST_AVAILABLE_F) - EQUIVALENCE(H5D_flags(29), H5D_VIRTUAL_F) - - EQUIVALENCE(H5D_size_flags(1), H5D_CHUNK_CACHE_NSLOTS_DFLT_F) - EQUIVALENCE(H5D_size_flags(2), H5D_CHUNK_CACHE_NBYTES_DFLT_F) - ! ! H5E flags declaration ! - INTEGER, PARAMETER :: H5E_FLAGS_LEN = 4 - INTEGER :: H5E_flags(H5E_FLAGS_LEN) - INTEGER, PARAMETER :: H5E_HID_FLAGS_LEN = 1 - INTEGER(HID_T) :: H5E_hid_flags(H5E_HID_FLAGS_LEN) !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: /H5E_FLAGS/ - !DEC$ATTRIBUTES DLLEXPORT :: /H5E_HID_FLAGS/ + !DEC$ATTRIBUTES DLLEXPORT :: H5E_DEFAULT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5E_MAJOR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5E_MINOR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5E_WALK_UPWARD_F + !DEC$ATTRIBUTES DLLEXPORT :: H5E_WALK_DOWNWARD_F !DEC$endif - COMMON /H5E_FLAGS/ H5E_flags - COMMON /H5E_HID_FLAGS/ H5E_hid_flags INTEGER(HID_T) :: H5E_DEFAULT_F INTEGER :: H5E_MAJOR_F INTEGER :: H5E_MINOR_F INTEGER :: H5E_WALK_UPWARD_F INTEGER :: H5E_WALK_DOWNWARD_F - - EQUIVALENCE(H5E_hid_flags(1), H5E_DEFAULT_F) - EQUIVALENCE(H5E_flags(1) , H5E_MAJOR_F) - EQUIVALENCE(H5E_flags(2) , H5E_MINOR_F) - EQUIVALENCE(H5E_flags(3) , H5E_WALK_UPWARD_F) - EQUIVALENCE(H5E_flags(4) , H5E_WALK_DOWNWARD_F) - ! - ! H5FD flags declaration + ! H5FD file drivers flags declaration ! - INTEGER, PARAMETER :: H5FD_FLAGS_LEN = 11 - INTEGER :: H5FD_flags(H5FD_FLAGS_LEN) !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: /H5FD_FLAGS/ + !DEC$ATTRIBUTES DLLEXPORT :: H5FD_MPIO_INDEPENDENT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5FD_MPIO_COLLECTIVE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5FD_MEM_NOLIST_F + !DEC$ATTRIBUTES DLLEXPORT :: H5FD_MEM_DEFAULT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5FD_MEM_SUPER_F + !DEC$ATTRIBUTES DLLEXPORT :: H5FD_MEM_BTREE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5FD_MEM_DRAW_F + !DEC$ATTRIBUTES DLLEXPORT :: H5FD_MEM_GHEAP_F + !DEC$ATTRIBUTES DLLEXPORT :: H5FD_MEM_LHEAP_F + !DEC$ATTRIBUTES DLLEXPORT :: H5FD_MEM_OHDR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5FD_MEM_NTYPES_F + !DEC$ATTRIBUTES DLLEXPORT :: H5FD_CORE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5FD_FAMILY_F + !DEC$ATTRIBUTES DLLEXPORT :: H5FD_LOG_F + !DEC$ATTRIBUTES DLLEXPORT :: H5FD_MPIO_F + !DEC$ATTRIBUTES DLLEXPORT :: H5FD_MULTI_F + !DEC$ATTRIBUTES DLLEXPORT :: H5FD_SEC2_F + !DEC$ATTRIBUTES DLLEXPORT :: H5FD_STDIO_F !DEC$endif - COMMON /H5FD_FLAGS/ H5FD_flags INTEGER :: H5FD_MPIO_INDEPENDENT_F INTEGER :: H5FD_MPIO_COLLECTIVE_F @@ -509,28 +417,6 @@ MODULE H5GLOBAL INTEGER :: H5FD_MEM_LHEAP_F INTEGER :: H5FD_MEM_OHDR_F INTEGER :: H5FD_MEM_NTYPES_F - - EQUIVALENCE(H5FD_flags(1), H5FD_MPIO_INDEPENDENT_F) - EQUIVALENCE(H5FD_flags(2), H5FD_MPIO_COLLECTIVE_F) - EQUIVALENCE(H5FD_flags(3), H5FD_MEM_NOLIST_F) - EQUIVALENCE(H5FD_flags(4), H5FD_MEM_DEFAULT_F) - EQUIVALENCE(H5FD_flags(5), H5FD_MEM_SUPER_F) - EQUIVALENCE(H5FD_flags(6), H5FD_MEM_BTREE_F) - EQUIVALENCE(H5FD_flags(7), H5FD_MEM_DRAW_F) - EQUIVALENCE(H5FD_flags(8), H5FD_MEM_GHEAP_F) - EQUIVALENCE(H5FD_flags(9), H5FD_MEM_LHEAP_F) - EQUIVALENCE(H5FD_flags(10), H5FD_MEM_OHDR_F) - EQUIVALENCE(H5FD_flags(11), H5FD_MEM_NTYPES_F) - ! - ! H5FD file drivers flags declaration - ! - INTEGER, PARAMETER :: H5FD_HID_FLAGS_LEN = 7 - INTEGER(HID_T) :: H5FD_hid_flags(H5FD_HID_FLAGS_LEN) - !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: /H5FD_HID_FLAGS/ - !DEC$endif - COMMON /H5FD_HID_FLAGS/ H5FD_hid_flags - INTEGER(HID_T) :: H5FD_CORE_F INTEGER(HID_T) :: H5FD_FAMILY_F INTEGER(HID_T) :: H5FD_LOG_F @@ -538,24 +424,18 @@ MODULE H5GLOBAL INTEGER(HID_T) :: H5FD_MULTI_F INTEGER(HID_T) :: H5FD_SEC2_F INTEGER(HID_T) :: H5FD_STDIO_F - - EQUIVALENCE(H5FD_hid_flags(1), H5FD_CORE_F) - EQUIVALENCE(H5FD_hid_flags(2), H5FD_FAMILY_F) - EQUIVALENCE(H5FD_hid_flags(3), H5FD_LOG_F) - EQUIVALENCE(H5FD_hid_flags(4), H5FD_MPIO_F) - EQUIVALENCE(H5FD_hid_flags(5), H5FD_MULTI_F) - EQUIVALENCE(H5FD_hid_flags(6), H5FD_SEC2_F) - EQUIVALENCE(H5FD_hid_flags(7), H5FD_STDIO_F) - ! ! H5I flags declaration ! - INTEGER, PARAMETER :: H5I_FLAGS_LEN = 7 - INTEGER :: H5I_flags(H5I_FLAGS_LEN) !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: /H5I_FLAGS/ + !DEC$ATTRIBUTES DLLEXPORT :: H5I_FILE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_GROUP_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_DATATYPE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_DATASPACE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_DATASET_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_ATTR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_BADID_F !DEC$endif - COMMON /H5I_FLAGS/ H5I_flags INTEGER :: H5I_FILE_F INTEGER :: H5I_GROUP_F @@ -564,48 +444,57 @@ MODULE H5GLOBAL INTEGER :: H5I_DATASET_F INTEGER :: H5I_ATTR_F INTEGER :: H5I_BADID_F - - EQUIVALENCE(H5I_flags(1), H5I_FILE_F) - EQUIVALENCE(H5I_flags(2), H5I_GROUP_F) - EQUIVALENCE(H5I_flags(3), H5I_DATATYPE_F) - EQUIVALENCE(H5I_flags(4), H5I_DATASPACE_F) - EQUIVALENCE(H5I_flags(5), H5I_DATASET_F) - EQUIVALENCE(H5I_flags(6), H5I_ATTR_F) - EQUIVALENCE(H5I_flags(7), H5I_BADID_F) ! ! H5L flags declaration ! - INTEGER, PARAMETER :: H5L_FLAGS_LEN = 6 - INTEGER :: H5L_flags(H5L_FLAGS_LEN) - + !DEC$if defined(BUILD_HDF5_DLL) + !DEC$ATTRIBUTES DLLEXPORT :: H5L_TYPE_ERROR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5L_TYPE_HARD_F + !DEC$ATTRIBUTES DLLEXPORT :: H5L_TYPE_SOFT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5L_TYPE_EXTERNAL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5L_SAME_LOC_F + !DEC$ATTRIBUTES DLLEXPORT :: H5L_LINK_CLASS_T_VERS_F + !DEC$endif + INTEGER :: H5L_TYPE_ERROR_F INTEGER :: H5L_TYPE_HARD_F INTEGER :: H5L_TYPE_SOFT_F INTEGER :: H5L_TYPE_EXTERNAL_F INTEGER :: H5L_SAME_LOC_F INTEGER :: H5L_LINK_CLASS_T_VERS_F - - !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: /H5L_FLAGS/ - !DEC$endif - COMMON /H5L_FLAGS/ H5L_flags - - EQUIVALENCE(H5L_flags(1), H5L_TYPE_ERROR_F) - EQUIVALENCE(H5L_flags(2), H5L_TYPE_HARD_F) - EQUIVALENCE(H5L_flags(3), H5L_TYPE_SOFT_F) - EQUIVALENCE(H5L_flags(4), H5L_TYPE_EXTERNAL_F) - EQUIVALENCE(H5L_flags(5), H5L_SAME_LOC_F) - EQUIVALENCE(H5L_flags(6), H5L_LINK_CLASS_T_VERS_F) ! ! H5O flags declaration ! - INTEGER, PARAMETER :: H5O_FLAGS_LEN = 27 - INTEGER :: H5o_flags(H5O_FLAGS_LEN) !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: /H5O_FLAGS/ + !DEC$ATTRIBUTES DLLEXPORT :: H5O_COPY_SHALLOW_HIERARCHY_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_COPY_EXPAND_SOFT_LINK_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_COPY_EXPAND_EXT_LINK_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_COPY_EXPAND_REFERENCE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_COPY_WITHOUT_ATTR_FLAG_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_COPY_PRESERVE_NULL_FLAG_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_COPY_ALL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_SHMESG_NONE_FLAG_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_SHMESG_SDSPACE_FLAG_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_SHMESG_DTYPE_FLAG_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_SHMESG_FILL_FLAG_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_SHMESG_PLINE_FLAG_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_SHMESG_ATTR_FLAG_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_SHMESG_ALL_FLAG_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_HDR_CHUNK0_SIZE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_HDR_ATTR_CRT_ORDER_TRACK_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_HDR_ATTR_CRT_ORDER_INDEX_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_HDR_ATTR_STORE_PHASE_CHA_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_HDR_STORE_TIMES_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_HDR_ALL_FLAGS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_SHMESG_MAX_NINDEXES_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_SHMESG_MAX_LIST_SIZE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_TYPE_UNKNOWN_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_TYPE_GROUP_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_TYPE_DATASET_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_TYPE_NAMED_DATATYPE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5O_TYPE_NTYPES_F !DEC$endif - COMMON /H5O_FLAGS/ H5O_flags - + INTEGER :: H5O_COPY_SHALLOW_HIERARCHY_F ! *** THESE VARIABLES DO INTEGER :: H5O_COPY_EXPAND_SOFT_LINK_F ! NOT MATCH THE C VARIABLE INTEGER :: H5O_COPY_EXPAND_EXT_LINK_F ! IN ORDER @@ -633,44 +522,31 @@ MODULE H5GLOBAL INTEGER :: H5O_TYPE_DATASET_F INTEGER :: H5O_TYPE_NAMED_DATATYPE_F INTEGER :: H5O_TYPE_NTYPES_F - - EQUIVALENCE(h5o_flags(1) , H5O_COPY_SHALLOW_HIERARCHY_F) - EQUIVALENCE(h5o_flags(2) , H5O_COPY_EXPAND_SOFT_LINK_F) - EQUIVALENCE(h5o_flags(3) , H5O_COPY_EXPAND_EXT_LINK_F) - EQUIVALENCE(h5o_flags(4) , H5O_COPY_EXPAND_REFERENCE_F) - EQUIVALENCE(h5o_flags(5) , H5O_COPY_WITHOUT_ATTR_FLAG_F) - EQUIVALENCE(h5o_flags(6) , H5O_COPY_PRESERVE_NULL_FLAG_F) - EQUIVALENCE(h5o_flags(7) , H5O_COPY_ALL_F) - EQUIVALENCE(h5o_flags(8) , H5O_SHMESG_NONE_FLAG_F) - EQUIVALENCE(h5o_flags(9) , H5O_SHMESG_SDSPACE_FLAG_F) - EQUIVALENCE(h5o_flags(10) , H5O_SHMESG_DTYPE_FLAG_F) - EQUIVALENCE(h5o_flags(11) , H5O_SHMESG_FILL_FLAG_F) - EQUIVALENCE(h5o_flags(12) , H5O_SHMESG_PLINE_FLAG_F) - EQUIVALENCE(h5o_flags(13) , H5O_SHMESG_ATTR_FLAG_F) - EQUIVALENCE(h5o_flags(14) , H5O_SHMESG_ALL_FLAG_F) - EQUIVALENCE(h5o_flags(15) , H5O_HDR_CHUNK0_SIZE_F) - EQUIVALENCE(h5o_flags(16) , H5O_HDR_ATTR_CRT_ORDER_TRACK_F) - EQUIVALENCE(h5o_flags(17) , H5O_HDR_ATTR_CRT_ORDER_INDEX_F) - EQUIVALENCE(h5o_flags(18) , H5O_HDR_ATTR_STORE_PHASE_CHA_F) - EQUIVALENCE(h5o_flags(19) , H5O_HDR_STORE_TIMES_F) - EQUIVALENCE(h5o_flags(20) , H5O_HDR_ALL_FLAGS_F) - EQUIVALENCE(h5o_flags(21) , H5O_SHMESG_MAX_NINDEXES_F) - EQUIVALENCE(h5o_flags(22) , H5O_SHMESG_MAX_LIST_SIZE_F) - EQUIVALENCE(h5o_flags(23) , H5O_TYPE_UNKNOWN_F) - EQUIVALENCE(h5o_flags(24) , H5O_TYPE_GROUP_F) - EQUIVALENCE(h5o_flags(25) , H5O_TYPE_DATASET_F) - EQUIVALENCE(h5o_flags(26) , H5O_TYPE_NAMED_DATATYPE_F) - EQUIVALENCE(h5o_flags(27) , H5O_TYPE_NTYPES_F) - ! ! H5P flags declaration ! - INTEGER, PARAMETER :: H5P_FLAGS_LEN = 18 - INTEGER(HID_T) H5P_flags(H5P_FLAGS_LEN) !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: /H5P_FLAGS/ + !DEC$ATTRIBUTES DLLEXPORT :: H5P_FILE_CREATE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5P_FILE_ACCESS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5P_DATASET_CREATE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5P_DATASET_XFER_F + !DEC$ATTRIBUTES DLLEXPORT :: H5P_FILE_MOUNT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5P_DEFAULT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5P_ROOT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5P_OBJECT_CREATE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5P_DATASET_ACCESS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5P_GROUP_CREATE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5P_GROUP_ACCESS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5P_DATATYPE_CREATE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5P_DATATYPE_ACCESS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5P_STRING_CREATE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5P_ATTRIBUTE_CREATE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5P_OBJECT_COPY_F + !DEC$ATTRIBUTES DLLEXPORT :: H5P_LINK_CREATE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5P_LINK_ACCESS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5P_CRT_ORDER_INDEXED_F + !DEC$ATTRIBUTES DLLEXPORT :: H5P_CRT_ORDER_TRACKED_F !DEC$endif - COMMON /H5P_FLAGS/ H5P_flags INTEGER(HID_T) :: H5P_FILE_CREATE_F INTEGER(HID_T) :: H5P_FILE_ACCESS_F @@ -691,72 +567,44 @@ MODULE H5GLOBAL INTEGER(HID_T) :: H5P_LINK_CREATE_F INTEGER(HID_T) :: H5P_LINK_ACCESS_F - EQUIVALENCE(H5P_flags(1), H5P_FILE_CREATE_F) - EQUIVALENCE(H5P_flags(2), H5P_FILE_ACCESS_F) - EQUIVALENCE(H5P_flags(3), H5P_DATASET_CREATE_F) - EQUIVALENCE(H5P_flags(4), H5P_DATASET_XFER_F) - EQUIVALENCE(H5P_flags(5), H5P_FILE_MOUNT_F) - EQUIVALENCE(H5P_flags(6), H5P_DEFAULT_F) - EQUIVALENCE(H5P_flags(7), H5P_ROOT_F) - EQUIVALENCE(H5P_flags(8), H5P_OBJECT_CREATE_F) - EQUIVALENCE(H5P_flags(9), H5P_DATASET_ACCESS_F) - EQUIVALENCE(H5P_flags(10), H5P_GROUP_CREATE_F) - EQUIVALENCE(H5P_flags(11), H5P_GROUP_ACCESS_F) - EQUIVALENCE(H5P_flags(12), H5P_DATATYPE_CREATE_F) - EQUIVALENCE(H5P_flags(13), H5P_DATATYPE_ACCESS_F) - EQUIVALENCE(H5P_flags(14), H5P_STRING_CREATE_F) - EQUIVALENCE(H5P_flags(15), H5P_ATTRIBUTE_CREATE_F) - EQUIVALENCE(H5P_flags(16), H5P_OBJECT_COPY_F) - EQUIVALENCE(H5P_flags(17), H5P_LINK_CREATE_F) - EQUIVALENCE(H5P_flags(18), H5P_LINK_ACCESS_F) - - ! - ! H5P integers flags declaration - ! - INTEGER, PARAMETER :: H5P_FLAGS_INT_LEN = 2 - INTEGER :: H5P_flags_int(H5P_FLAGS_INT_LEN) - !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: /H5P_FLAGS_INT/ - !DEC$endif - COMMON /H5P_FLAGS_INT/ H5P_flags_int INTEGER :: H5P_CRT_ORDER_INDEXED_F INTEGER :: H5P_CRT_ORDER_TRACKED_F - EQUIVALENCE(H5P_flags_int(1), H5P_CRT_ORDER_INDEXED_F) - EQUIVALENCE(H5P_flags_int(2), H5P_CRT_ORDER_TRACKED_F) ! ! H5R flags declaration ! - INTEGER, PARAMETER :: H5R_FLAGS_LEN = 2 - INTEGER :: H5R_flags(H5R_FLAGS_LEN) !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: /H5R_FLAGS/ + !DEC$ATTRIBUTES DLLEXPORT :: H5R_OBJECT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5R_DATASET_REGION_F !DEC$endif - COMMON /H5R_FLAGS/ H5R_flags INTEGER :: H5R_OBJECT_F INTEGER :: H5R_DATASET_REGION_F - - EQUIVALENCE(H5R_flags(1), H5R_OBJECT_F) - EQUIVALENCE(H5R_flags(2), H5R_DATASET_REGION_F) - ! ! H5S flags declaration ! - INTEGER, PARAMETER :: H5S_FLAGS_LEN = 18 - INTEGER :: H5S_flags(H5S_FLAGS_LEN) - INTEGER, PARAMETER :: H5S_HSIZE_FLAGS_LEN = 1 - INTEGER(HSIZE_T) H5S_hsize_flags(H5S_HSIZE_FLAGS_LEN) - INTEGER, PARAMETER :: H5S_HID_FLAGS_LEN = 1 - INTEGER(HSIZE_T) H5S_hid_flags(H5S_HID_FLAGS_LEN) !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: /H5S_FLAGS/ - !DEC$ATTRIBUTES DLLEXPORT :: /H5S_HID_FLAGS/ - !DEC$ATTRIBUTES DLLEXPORT :: /H5S_HSIZE_FLAGS/ + !DEC$ATTRIBUTES DLLEXPORT :: H5S_UNLIMITED_F + !DEC$ATTRIBUTES DLLEXPORT :: H5S_ALL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5S_SCALAR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5S_SIMPLE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5S_NULL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5S_SELECT_NOOP_F + !DEC$ATTRIBUTES DLLEXPORT :: H5S_SELECT_SET_F + !DEC$ATTRIBUTES DLLEXPORT :: H5S_SELECT_OR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5S_SELECT_AND_F + !DEC$ATTRIBUTES DLLEXPORT :: H5S_SELECT_XOR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5S_SELECT_NOTB_F + !DEC$ATTRIBUTES DLLEXPORT :: H5S_SELECT_NOTA_F + !DEC$ATTRIBUTES DLLEXPORT :: H5S_SELECT_APPEND_F + !DEC$ATTRIBUTES DLLEXPORT :: H5S_SELECT_PREPEND_F + !DEC$ATTRIBUTES DLLEXPORT :: H5S_SELECT_INVALID_F + !DEC$ATTRIBUTES DLLEXPORT :: H5S_SEL_ERROR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5S_SEL_NONE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5S_SEL_POINTS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5S_SEL_HYPERSLABS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5S_SEL_ALL_F !DEC$endif - COMMON /H5S_FLAGS/ H5S_flags - COMMON /H5S_HID_FLAGS/ H5S_hid_flags - COMMON /H5S_HSIZE_FLAGS/ H5S_hsize_flags - + INTEGER(HSIZE_T) :: H5S_UNLIMITED_F INTEGER(HID_T) :: H5S_ALL_F @@ -781,42 +629,46 @@ MODULE H5GLOBAL INTEGER :: H5S_SEL_POINTS_F INTEGER :: H5S_SEL_HYPERSLABS_F INTEGER :: H5S_SEL_ALL_F - - EQUIVALENCE(H5S_hid_flags(1), H5S_ALL_F) - - EQUIVALENCE(H5S_hsize_flags(1), H5S_UNLIMITED_F) - - EQUIVALENCE(H5S_flags(1), H5S_SCALAR_F) - EQUIVALENCE(H5S_flags(2), H5S_SIMPLE_F) - EQUIVALENCE(H5S_flags(3), H5S_NULL_F) - EQUIVALENCE(H5S_flags(4), H5S_SELECT_SET_F) - EQUIVALENCE(H5S_flags(5), H5S_SELECT_OR_F) - - EQUIVALENCE(H5S_flags(6), H5S_SELECT_NOOP_F) - EQUIVALENCE(H5S_flags(7), H5S_SELECT_AND_F) - EQUIVALENCE(H5S_flags(8), H5S_SELECT_XOR_F) - EQUIVALENCE(H5S_flags(9), H5S_SELECT_NOTB_F) - EQUIVALENCE(H5S_flags(10), H5S_SELECT_NOTA_F) - - EQUIVALENCE(H5S_flags(11), H5S_SELECT_APPEND_F) - EQUIVALENCE(H5S_flags(12), H5S_SELECT_PREPEND_F) - EQUIVALENCE(H5S_flags(13), H5S_SELECT_INVALID_F) - EQUIVALENCE(H5S_flags(14), H5S_SEL_ERROR_F) - EQUIVALENCE(H5S_flags(15), H5S_SEL_NONE_F) - - EQUIVALENCE(H5S_flags(16), H5S_SEL_POINTS_F) - EQUIVALENCE(H5S_flags(17), H5S_SEL_HYPERSLABS_F) - EQUIVALENCE(H5S_flags(18), H5S_SEL_ALL_F) - ! ! H5T flags declaration ! - INTEGER, PARAMETER :: H5T_FLAGS_LEN = 35 - INTEGER :: H5T_flags(H5T_FLAGS_LEN) !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: /H5T_FLAGS/ + !DEC$ATTRIBUTES DLLEXPORT :: H5T_NO_CLASS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_INTEGER_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_FLOAT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_TIME_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STRING_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_BITFIELD_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_OPAQUE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_COMPOUND_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_REFERENCE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_ENUM_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_VLEN_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_ARRAY_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_ORDER_LE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_ORDER_BE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_ORDER_VAX_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_ORDER_NONE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_ORDER_MIXED_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_PAD_ZERO_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_PAD_ONE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_PAD_BACKGROUND_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_PAD_ERROR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_SGN_NONE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_SGN_2_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_SGN_ERROR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_NORM_IMPLIED_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_NORM_MSBSET_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_NORM_NONE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_CSET_ASCII_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_CSET_UTF8_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STR_NULLTERM_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STR_NULLPAD_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STR_SPACEPAD_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_STR_ERROR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_DIR_ASCEND_F + !DEC$ATTRIBUTES DLLEXPORT :: H5T_DIR_DESCEND_F !DEC$endif - COMMON /H5T_FLAGS/ H5T_flags INTEGER :: H5T_NO_CLASS_F INTEGER :: H5T_INTEGER_F @@ -853,51 +705,31 @@ MODULE H5GLOBAL INTEGER :: H5T_STR_ERROR_F INTEGER :: H5T_DIR_ASCEND_F INTEGER :: H5T_DIR_DESCEND_F - - EQUIVALENCE(H5T_flags(1), H5T_NO_CLASS_F) - EQUIVALENCE(H5T_flags(2), H5T_INTEGER_F) - EQUIVALENCE(H5T_flags(3), H5T_FLOAT_F) - EQUIVALENCE(H5T_flags(4), H5T_TIME_F) - EQUIVALENCE(H5T_flags(5), H5T_STRING_F) - EQUIVALENCE(H5T_flags(6), H5T_BITFIELD_F) - EQUIVALENCE(H5T_flags(7), H5T_OPAQUE_F) - EQUIVALENCE(H5T_flags(8), H5T_COMPOUND_F) - EQUIVALENCE(H5T_flags(9), H5T_REFERENCE_F) - EQUIVALENCE(H5T_flags(10), H5T_ENUM_F) - EQUIVALENCE(H5T_flags(11), H5T_ORDER_LE_F) - EQUIVALENCE(H5T_flags(12), H5T_ORDER_BE_F) - EQUIVALENCE(H5T_flags(13), H5T_ORDER_MIXED_F) - EQUIVALENCE(H5T_flags(14), H5T_ORDER_VAX_F) - EQUIVALENCE(H5T_flags(15), H5T_ORDER_NONE_F) - EQUIVALENCE(H5T_flags(16), H5T_PAD_ZERO_F) - EQUIVALENCE(H5T_flags(17), H5T_PAD_ONE_F) - EQUIVALENCE(H5T_flags(18), H5T_PAD_BACKGROUND_F) - EQUIVALENCE(H5T_flags(19), H5T_PAD_ERROR_F) - EQUIVALENCE(H5T_flags(20), H5T_SGN_NONE_F) - EQUIVALENCE(H5T_flags(21), H5T_SGN_2_F) - EQUIVALENCE(H5T_flags(22), H5T_SGN_ERROR_F) - EQUIVALENCE(H5T_flags(23), H5T_NORM_IMPLIED_F) - EQUIVALENCE(H5T_flags(24), H5T_NORM_MSBSET_F) - EQUIVALENCE(H5T_flags(25), H5T_NORM_NONE_F) - EQUIVALENCE(H5T_flags(26), H5T_CSET_ASCII_F) - EQUIVALENCE(H5T_flags(27), H5T_CSET_UTF8_F) - EQUIVALENCE(H5T_flags(28), H5T_STR_NULLTERM_F) - EQUIVALENCE(H5T_flags(29), H5T_STR_NULLPAD_F) - EQUIVALENCE(H5T_flags(30), H5T_STR_SPACEPAD_F) - EQUIVALENCE(H5T_flags(31), H5T_STR_ERROR_F) - EQUIVALENCE(H5T_flags(32), H5T_VLEN_F) - EQUIVALENCE(H5T_flags(33), H5T_ARRAY_F) - EQUIVALENCE(H5T_flags(34), H5T_DIR_ASCEND_F) - EQUIVALENCE(H5T_flags(35), H5T_DIR_DESCEND_F) ! ! H5Z flags declaration ! - INTEGER, PARAMETER :: H5Z_FLAGS_LEN = 20 - INTEGER :: H5Z_flags(H5Z_FLAGS_LEN) !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: /H5Z_FLAGS/ + !DEC$ATTRIBUTES DLLEXPORT :: H5Z_FILTER_ERROR_F + !DEC$ATTRIBUTES DLLEXPORT :: H5Z_FILTER_NONE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5Z_FILTER_ALL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5Z_FILTER_DEFLATE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5Z_FILTER_SHUFFLE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5Z_FILTER_FLETCHER32_F + !DEC$ATTRIBUTES DLLEXPORT :: H5Z_FILTER_SZIP_F + !DEC$ATTRIBUTES DLLEXPORT :: H5Z_ERROR_EDC_F + !DEC$ATTRIBUTES DLLEXPORT :: H5Z_DISABLE_EDC_F + !DEC$ATTRIBUTES DLLEXPORT :: H5Z_ENABLE_EDC_F + !DEC$ATTRIBUTES DLLEXPORT :: H5Z_NO_EDC_F + !DEC$ATTRIBUTES DLLEXPORT :: H5Z_FLAG_OPTIONAL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5Z_FILTER_ENCODE_ENABLED_F + !DEC$ATTRIBUTES DLLEXPORT :: H5Z_FILTER_DECODE_ENABLED_F + !DEC$ATTRIBUTES DLLEXPORT :: H5Z_FILTER_NBIT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5Z_FILTER_SCALEOFFSET_F + !DEC$ATTRIBUTES DLLEXPORT :: H5Z_SO_FLOAT_DSCALE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5Z_SO_FLOAT_ESCALE_F + !DEC$ATTRIBUTES DLLEXPORT :: H5Z_SO_INT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5Z_SO_INT_MINBITS_DEFAULT_F !DEC$endif - COMMON /H5Z_FLAGS/ H5Z_flags INTEGER :: H5Z_FILTER_ERROR_F INTEGER :: H5Z_FILTER_NONE_F @@ -919,58 +751,16 @@ MODULE H5GLOBAL INTEGER :: H5Z_SO_FLOAT_ESCALE_F INTEGER :: H5Z_SO_INT_F INTEGER :: H5Z_SO_INT_MINBITS_DEFAULT_F - - EQUIVALENCE(H5Z_flags(1), H5Z_FILTER_ERROR_F) - EQUIVALENCE(H5Z_flags(2), H5Z_FILTER_NONE_F) - EQUIVALENCE(H5Z_flags(3), H5Z_FILTER_DEFLATE_F) - EQUIVALENCE(H5Z_flags(4), H5Z_FILTER_SHUFFLE_F) - EQUIVALENCE(H5Z_flags(5), H5Z_FILTER_FLETCHER32_F) - EQUIVALENCE(H5Z_flags(6), H5Z_ERROR_EDC_F) - EQUIVALENCE(H5Z_flags(7), H5Z_DISABLE_EDC_F) - EQUIVALENCE(H5Z_flags(8), H5Z_ENABLE_EDC_F) - EQUIVALENCE(H5Z_flags(9), H5Z_NO_EDC_F) - EQUIVALENCE(H5Z_flags(10), H5Z_FILTER_SZIP_F) - EQUIVALENCE(H5Z_flags(11), H5Z_FLAG_OPTIONAL_F) - EQUIVALENCE(H5Z_flags(12), H5Z_FILTER_ENCODE_ENABLED_F) - EQUIVALENCE(H5Z_flags(13), H5Z_FILTER_DECODE_ENABLED_F) - EQUIVALENCE(H5Z_flags(14), H5Z_FILTER_ALL_F) - EQUIVALENCE(H5Z_flags(15), H5Z_FILTER_NBIT_F) - EQUIVALENCE(H5Z_flags(16), H5Z_FILTER_SCALEOFFSET_F) - EQUIVALENCE(H5Z_flags(17), H5Z_SO_FLOAT_DSCALE_F) - EQUIVALENCE(H5Z_flags(18), H5Z_SO_FLOAT_ESCALE_F) - EQUIVALENCE(H5Z_flags(19), H5Z_SO_INT_F) - EQUIVALENCE(H5Z_flags(20), H5Z_SO_INT_MINBITS_DEFAULT_F) - ! ! H5 Library flags declaration ! - INTEGER, PARAMETER :: H5LIB_FLAGS_LEN = 2 - INTEGER :: H5LIB_flags(H5LIB_FLAGS_LEN) !DEC$if defined(BUILD_HDF5_DLL) - !DEC$ATTRIBUTES DLLEXPORT :: /H5LIB_FLAGS/ + !DEC$ATTRIBUTES DLLEXPORT :: H5_SZIP_EC_OM_F + !DEC$ATTRIBUTES DLLEXPORT :: H5_SZIP_NN_OM_F !DEC$endif - COMMON /H5LIB_FLAGS/ H5LIB_flags + INTEGER :: H5_SZIP_EC_OM_F INTEGER :: H5_SZIP_NN_OM_F - ! - EQUIVALENCE(H5LIB_flags(1), H5_SZIP_EC_OM_F) - EQUIVALENCE(H5LIB_flags(2), H5_SZIP_NN_OM_F) - - - ! General H5 flags declarations - ! -!!$ INTEGER, PARAMETER :: H5_FLAGS_LEN = 2 -!!$ INTEGER H5_flags(H5_FLAGS_LEN) -!!$!DEC$if defined(BUILD_HDF5_DLL) -!!$!DEC$ATTRIBUTES DLLEXPORT :: /H5_FLAGS/ -!!$!DEC$endif -!!$ COMMON /H5_FLAGS/ H5_flags -!!$ -!!$ INTEGER :: _F -!!$ INTEGER :: H5F_SCOPE_LOCAL_F -!!$ -!!$ EQUIVALENCE(H5F_flags(1), H5F_SCOPE_GLOBAL_F) -!!$ EQUIVALENCE(H5F_flags(2), H5F_SCOPE_LOCAL_F) CONTAINS diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 1661a10..3c3eb8f 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -32,7 +32,7 @@ set_target_properties (H5_test_buildiface PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} ) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared") if (WIN32) set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${CMAKE_BUILD_TYPE}) @@ -64,7 +64,7 @@ set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES LINKER_LANGUAGE C INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED t.c) TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_F90_C_TEST_LIBSH_TARGET} @@ -94,7 +94,7 @@ add_custom_target (H5testgen ALL ) set_source_files_properties (${HDF5_F90_BINARY_DIR}/tf_gen.F90 PROPERTIES GENERATED TRUE) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) set (CMDSH $<TARGET_FILE:H5_test_buildiface>) add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/shared/tf_gen.F90 @@ -117,7 +117,7 @@ set (HDF5_F90_TF_SOURCES tf.F90 ) set_source_files_properties (${HDF5_F90_TF_SOURCES} PROPERTIES LANGUAGE Fortran) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) set (HDF5_F90_TF_SOURCES_SHARED # generated file ${HDF5_F90_BINARY_DIR}/shared/tf_gen.F90 @@ -150,7 +150,7 @@ if (WIN32) endif () add_dependencies(${HDF5_F90_TEST_LIB_TARGET} H5testgen) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_TEST_LIBSH_TARGET} SHARED ${HDF5_F90_TF_SOURCES_SHARED}) set (SHARED_LINK_FLAGS " ") if (WIN32 AND MSVC) @@ -220,7 +220,7 @@ set_target_properties (testhdf5_fortran PROPERTIES ) add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET}) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) add_executable (testhdf5_fortran-shared fortranlib_test.F90 tH5A.F90 @@ -284,7 +284,7 @@ set_target_properties (testhdf5_fortran_1_8 PROPERTIES ) add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET}) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) add_executable (testhdf5_fortran_1_8-shared fortranlib_test_1_8.F90 tH5O.F90 @@ -341,7 +341,7 @@ set_target_properties (fortranlib_test_F03 PROPERTIES ) add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET}) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) add_executable (fortranlib_test_F03-shared fortranlib_test_F03.F90 tH5E_F03.F90 @@ -392,7 +392,7 @@ set_target_properties (fflush1 PROPERTIES ) add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET}) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) add_executable (fflush1-shared fflush1.F90) TARGET_NAMING (fflush1-shared SHARED) TARGET_FORTRAN_PROPERTIES (fflush1-shared SHARED " " " ") @@ -433,7 +433,7 @@ set_target_properties (fflush2 PROPERTIES ) add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET}) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) add_executable (fflush2-shared fflush2.F90) TARGET_NAMING (fflush2-shared SHARED) TARGET_FORTRAN_PROPERTIES (fflush2-shared SHARED " " " ") diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index e171e7c..4d06359 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -132,7 +132,7 @@ set_tests_properties (FORTRAN_fflush1 PROPERTIES DEPENDS FORTRAN_testhdf5-clear- add_test (NAME FORTRAN_fflush2 COMMAND $<TARGET_FILE:fflush2>) set_tests_properties (FORTRAN_fflush2 PROPERTIES DEPENDS FORTRAN_fflush1) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) add_test ( NAME FORTRAN_testhdf5-shared-clear-objects COMMAND ${CMAKE_COMMAND} diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 345a739..c870aed 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -36,7 +36,7 @@ set_target_properties (H5HL_buildiface PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} ) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_HL_F90_SRC_BINARY_DIR}/shared") if (WIN32) set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${CMAKE_BUILD_TYPE}) @@ -87,7 +87,7 @@ set_target_properties (${HDF5_HL_F90_C_LIB_TARGET} PROPERTIES ) set (install_targets ${HDF5_HL_F90_C_LIB_TARGET}) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_F90_C_LIBSH_TARGET} SHARED ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS}) TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_F90_C_LIBSH_TARGET} ${HDF5_HL_LIBSH_TARGET}) @@ -129,7 +129,7 @@ set_source_files_properties ( ${HDF5_HL_F90_SRC_BINARY_DIR}/H5TBff_gen.F90 PROPERTIES GENERATED TRUE ) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) set (CMDSH $<TARGET_FILE:H5HL_buildiface>) add_custom_command ( OUTPUT ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5TBff_gen.F90 @@ -157,7 +157,7 @@ set (HDF5_HL_F90_F_SOURCES ) set_source_files_properties (${HDF5_HL_F90_F_SOURCES} PROPERTIES LANGUAGE Fortran) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) set (HDF5_HL_F90_F_SOURCES_SHARED ${HDF5_HL_F90_F_BASE_SOURCES} @@ -187,7 +187,7 @@ endif () set (install_targets ${install_targets} ${HDF5_HL_F90_LIB_TARGET}) add_dependencies(${HDF5_HL_F90_LIB_TARGET} H5HLgen) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_F90_LIBSH_TARGET} SHARED ${HDF5_HL_F90_F_SOURCES_SHARED}) set (SHARED_LINK_FLAGS " ") if (WIN32 AND MSVC) @@ -236,7 +236,7 @@ install ( fortheaders ) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) set (modsh_files ${MODSH_BUILD_DIR}/h5ds.mod ${MODSH_BUILD_DIR}/h5tb.mod @@ -259,7 +259,7 @@ endif () # Add Target(s) to CMake Install for import into other projects #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) #INSTALL_TARGET_PDB (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) endif () diff --git a/hl/fortran/src/H5DSff.F90 b/hl/fortran/src/H5DSff.F90 index 4f0d040..2dca479 100644 --- a/hl/fortran/src/H5DSff.F90 +++ b/hl/fortran/src/H5DSff.F90 @@ -44,13 +44,6 @@ CONTAINS IMPLICIT NONE -! -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_HL_DLL) -!DEC$attributes dllexport :: h5dsset_scale_f -!DEC$endif -! - INTEGER(hid_t), INTENT(in) :: dsid ! The dataset to be made a Dimension Scale CHARACTER(LEN=*), INTENT(in), OPTIONAL :: dimname ! The dimension name INTEGER :: errcode ! Error code @@ -99,12 +92,6 @@ CONTAINS IMPLICIT NONE -! -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_HL_DLL) -!DEC$attributes dllexport :: h5dsattach_scale_f -!DEC$endif -! INTEGER(hid_t), INTENT(in) :: did ! the dataset INTEGER(hid_t), INTENT(in) :: dsid ! the scale to be attached INTEGER , INTENT(in) :: idx ! the dimension of did that dsid is associated with. @@ -148,13 +135,7 @@ CONTAINS SUBROUTINE H5DSdetach_scale_f( did, dsid, idx, errcode) IMPLICIT NONE - -! -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_HL_DLL) -!DEC$attributes dllexport :: h5dsdetach_scale_f -!DEC$endif -! + INTEGER(hid_t), INTENT(in) :: did ! the dataset INTEGER(hid_t), INTENT(in) :: dsid ! the scale to be detached INTEGER , INTENT(in) :: idx ! the dimension of did to detach @@ -199,13 +180,7 @@ CONTAINS SUBROUTINE H5DSis_attached_f( did, dsid, idx, is_attached, errcode) IMPLICIT NONE - -! -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_HL_DLL) -!DEC$attributes dllexport :: h5dsis_attached_f -!DEC$endif -! + INTEGER(hid_t), INTENT(in) :: did ! the dataset INTEGER(hid_t), INTENT(in) :: dsid ! the scale to be attached INTEGER , INTENT(in) :: idx ! the dimension of did that dsid is associated with @@ -264,13 +239,7 @@ CONTAINS SUBROUTINE H5DSis_scale_f( did, is_scale, errcode) IMPLICIT NONE - -! -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_HL_DLL) -!DEC$attributes dllexport :: h5dsis_scale_f -!DEC$endif -! + INTEGER(hid_t), INTENT(in) :: did ! the data set to query LOGICAL , INTENT(out) :: is_scale ! logical: ! .TRUE. if did is a Dimension Scale @@ -319,13 +288,6 @@ CONTAINS IMPLICIT NONE -! -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_HL_DLL) -!DEC$attributes dllexport :: h5dsset_label_f -!DEC$endif -! - INTEGER(hid_t), INTENT(in) :: did ! The dataset INTEGER , INTENT(in) :: idx ! The dimension CHARACTER(LEN=*), INTENT(in) :: label ! The label @@ -375,13 +337,6 @@ CONTAINS IMPLICIT NONE -! -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_HL_DLL) -!DEC$attributes dllexport :: h5dsget_label_f -!DEC$endif -! - INTEGER(hid_t), INTENT(in) :: did ! The dataget INTEGER , INTENT(in) :: idx ! The dimension CHARACTER(LEN=*), INTENT(in) :: label ! The label @@ -430,13 +385,6 @@ CONTAINS IMPLICIT NONE -! -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_HL_DLL) -!DEC$attributes dllexport :: h5dsget_scale_name_f -!DEC$endif -! - INTEGER(hid_t), INTENT(in) :: did ! The dataget CHARACTER(LEN=*), INTENT(out) :: name ! The name INTEGER(size_t) , INTENT(inout) :: size ! The length of the name buffer @@ -478,13 +426,6 @@ CONTAINS SUBROUTINE H5DSget_num_scales_f( did, idx, num_scales, errcode) IMPLICIT NONE - -! -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_HL_DLL) -!DEC$attributes dllexport :: h5dsget_num_scales_f -!DEC$endif -! INTEGER(hid_t), INTENT(in) :: did ! the dataset INTEGER , INTENT(in) :: idx ! the dimension of did to query INTEGER , INTENT(out) :: num_scales ! the number of Dimension Scales associated with did diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index 3138173..fbd31c5 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -14,7 +14,7 @@ target_link_libraries (hl_f90_tstds ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TAR target_include_directories (hl_f90_tstds PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) set_target_properties (hl_f90_tstds PROPERTIES LINKER_LANGUAGE Fortran) set_target_properties (hl_f90_tstds PROPERTIES FOLDER test/hl/fortran) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) add_executable (hl_f90_tstds-shared tstds.F90) TARGET_NAMING (hl_f90_tstds-shared SHARED) TARGET_FORTRAN_PROPERTIES (hl_f90_tstds-shared SHARED " " " ") @@ -35,7 +35,7 @@ target_link_libraries (hl_f90_tstlite ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_T target_include_directories (hl_f90_tstlite PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) set_target_properties (hl_f90_tstlite PROPERTIES LINKER_LANGUAGE Fortran) set_target_properties (hl_f90_tstlite PROPERTIES FOLDER test/hl/fortran) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) add_executable (hl_f90_tstlite-shared tstlite.F90) TARGET_NAMING (hl_f90_tstlite-shared SHARED) TARGET_FORTRAN_PROPERTIES (hl_f90_tstlite-shared SHARED " " " ") @@ -56,7 +56,7 @@ target_link_libraries (hl_f90_tstimage ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB target_include_directories (hl_f90_tstimage PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) set_target_properties (hl_f90_tstimage PROPERTIES LINKER_LANGUAGE Fortran) set_target_properties (hl_f90_tstimage PROPERTIES FOLDER test/hl/fortran) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) add_executable (hl_f90_tstimage-shared tstimage.F90) TARGET_NAMING (hl_f90_tstimage-shared SHARED) TARGET_FORTRAN_PROPERTIES (hl_f90_tstimage-shared SHARED " " " ") @@ -77,7 +77,7 @@ target_link_libraries (hl_f90_tsttable ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_ target_include_directories (hl_f90_tsttable PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) set_target_properties (hl_f90_tsttable PROPERTIES LINKER_LANGUAGE Fortran) set_target_properties (hl_f90_tsttable PROPERTIES FOLDER test/hl/fortran) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) add_executable (hl_f90_tsttable-shared tsttable.F90) TARGET_NAMING (hl_f90_tsttable-shared SHARED) TARGET_FORTRAN_PROPERTIES (hl_f90_tsttable-shared SHARED " " " ") diff --git a/hl/fortran/test/CMakeTests.cmake b/hl/fortran/test/CMakeTests.cmake index 90cc3a3..d541377 100644 --- a/hl/fortran/test/CMakeTests.cmake +++ b/hl/fortran/test/CMakeTests.cmake @@ -96,7 +96,7 @@ else () endif () set_tests_properties (HL_FORTRAN_f90_tsttable PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects) -if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS) add_test ( NAME HL_FORTRAN_test-shared-clear-objects COMMAND ${CMAKE_COMMAND} diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 26750b5..f20ca43 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -594,7 +594,6 @@ HDF5_USE_FOLDERS "Enable folder grouping of projects in IDEs." HDF5_WANT_DATA_ACCURACY "IF data accuracy is guaranteed during data conversions" ON HDF5_WANT_DCONV_EXCEPTION "exception handling functions is checked during data conversions" ON HDF5_ENABLE_THREADSAFE "Enable Threadsafety" OFF -SKIP_HDF5_FORTRAN_SHARED "Do not build the fortran shared libraries" OFF if (APPLE) HDF5_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path" OFF if (CMAKE_BUILD_TYPE MATCHES Debug) @@ -19,17 +19,18 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5Lprivate.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5SLprivate.h" /* Skip lists */ -#include "H5Tprivate.h" /* Datatypes */ -#include "H5FSprivate.h" /* File free space */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5FSprivate.h" /* File free space */ +#include "H5Lprivate.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5SLprivate.h" /* Skip lists */ +#include "H5Tprivate.h" /* Datatypes */ +#include "H5FSprivate.h" /* File free space */ /****************/ /* Local Macros */ @@ -80,9 +81,9 @@ hbool_t H5_libterm_g = FALSE; /* Library isn't being shutdown */ hbool_t H5_MPEinit_g = FALSE; /* MPE Library hasn't been initialized */ #endif -char H5_lib_vers_info_g[] = H5_VERS_INFO; +char H5_lib_vers_info_g[] = H5_VERS_INFO; static hbool_t H5_dont_atexit_g = FALSE; -H5_debug_t H5_debug_g; /*debugging info */ +H5_debug_t H5_debug_g; /* debugging info */ /*******************/ @@ -243,11 +244,6 @@ done: * * Return: void * - * Programmer: Robb Matzke - * Friday, November 20, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ void @@ -281,11 +277,11 @@ H5_term_library(void) */ #define DOWN(F) \ (((n = H5##F##_term_package()) && (at + 8) < sizeof loop)? \ - (sprintf(loop + at, "%s%s", (at ? "," : ""), #F), \ + (HDsprintf(loop + at, "%s%s", (at ? "," : ""), #F), \ at += HDstrlen(loop + at), \ n): \ ((n > 0 && (at + 5) < sizeof loop) ? \ - (sprintf(loop + at, "..."), \ + (HDsprintf(loop + at, "..."), \ at += HDstrlen(loop + at), \ n) : n)) @@ -364,8 +360,8 @@ H5_term_library(void) if(pending) { /* Only display the error message if the user is interested in them. */ if(func) { - fprintf(stderr, "HDF5: infinite loop closing library\n"); - fprintf(stderr, " %s\n", loop); + HDfprintf(stderr, "HDF5: infinite loop closing library\n"); + HDfprintf(stderr, " %s\n", loop); #ifndef NDEBUG HDabort(); #endif /* NDEBUG */ @@ -440,11 +436,6 @@ done: * Failure: negative if this function is called more than * once or if it is called too late. * - * Programmer: Robb Matzke - * Friday, November 20, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -479,11 +470,6 @@ H5dont_atexit(void) * * Failure: negative * - * Programmer: Quincey Koziol - * Saturday, March 11, 2000 - * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -528,13 +514,6 @@ done: * * Failure: negative * - * Programmer: Quincey Koziol - * Wednesday, August 2, 2000 - * - * Modifications: Neil Fortner - * Wednesday, April 8, 2009 - * Added support for factory free lists - * *------------------------------------------------------------------------- */ herr_t @@ -578,9 +557,6 @@ done: * * Return: void * - * Programmer: Robb Matzke - * Wednesday, August 19, 1998 - * *------------------------------------------------------------------------- */ static void @@ -632,7 +608,7 @@ H5_debug_mask(const char *s) } /* end if */ } /* end for */ if (i>=(size_t)H5_NPKGS) - fprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name); + HDfprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name); } /* end if-else */ } else if (HDisdigit(*s)) { @@ -672,8 +648,6 @@ H5_debug_mask(const char *s) * * Return: MPI_SUCCESS * - * Programmer: Mohamad Chaarawi, February 2015 - * *------------------------------------------------------------------------- */ static int H5_mpi_delete_cb(MPI_Comm H5_ATTR_UNUSED comm, int H5_ATTR_UNUSED keyval, void H5_ATTR_UNUSED *attr_val, int H5_ATTR_UNUSED *flag) @@ -698,13 +672,6 @@ static int H5_mpi_delete_cb(MPI_Comm H5_ATTR_UNUSED comm, int H5_ATTR_UNUSED key * * Return: Non-negative on success/Negative on failure * - * Programmer: Unknown - * - * Modifications: - * Robb Matzke, 4 Mar 1998 - * Now use "normal" data types for the interface. Any of the arguments - * may be null pointers - * *------------------------------------------------------------------------- */ herr_t @@ -738,13 +705,6 @@ done: * * Failure: abort() * - * Programmer: Robb Matzke - * Tuesday, April 21, 1998 - * - * Modifications: - * Albert Cheng, May 12, 2001 - * Added verification of H5_VERS_INFO. - * *------------------------------------------------------------------------- */ #define VERSION_MISMATCH_WARNING \ @@ -869,11 +829,6 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 - * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -896,11 +851,6 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Friday, January 30, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -717,8 +717,7 @@ hid_t H5Aget_space(hid_t attr_id) { H5A_t *attr; /* Attribute object for ID */ - H5S_t *ds = NULL; - hid_t ret_value; + hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", attr_id); @@ -727,19 +726,9 @@ H5Aget_space(hid_t attr_id) if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") - if(NULL == (ds = H5A_get_space(attr))) + if((ret_value = H5A_get_space(attr)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute") - - /* Atomize */ - if((ret_value = H5I_register(H5I_DATASPACE, ds, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") - done: - if(ret_value < 0) { - if(ds && (H5S_close(ds) < 0)) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") - } /* end if */ - FUNC_LEAVE_API(ret_value) } /* H5Aget_space() */ @@ -764,7 +753,6 @@ hid_t H5Aget_type(hid_t attr_id) { H5A_t *attr; /* Attribute object for ID */ - H5T_t *dt = NULL; hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -774,19 +762,9 @@ H5Aget_type(hid_t attr_id) if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") - if(NULL == (dt = H5A_get_type(attr))) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute") - - /* Create an atom */ - if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") - + if((ret_value = H5A_get_type(attr)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of attribute") done: - if(ret_value < 0) { - if(dt && (H5T_close(dt) < 0)) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype") - } /* end if */ - FUNC_LEAVE_API(ret_value) } /* H5Aget_type() */ @@ -1172,7 +1150,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) if(HDstrcmp(old_name, new_name)) { H5G_loc_t loc; /* Object location */ - if(H5G_loc(loc_id, & loc) < 0) + if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Call private attribute rename routine */ @@ -1227,7 +1205,7 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") - if(H5G_loc(loc_id, & loc) < 0) + if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Call private attribute rename routine */ @@ -1685,12 +1663,12 @@ H5Aexists(hid_t obj_id, const char *attr_name) H5TRACE2("t", "i*s", obj_id, attr_name); /* check arguments */ - if(H5I_ATTR == H5I_get_type(obj_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + if (H5I_ATTR == H5I_get_type(obj_id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + if (H5G_loc(obj_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if (!attr_name || !*attr_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Check if the attribute exists */ if((ret_value = H5O_attr_exists(loc.oloc, attr_name, H5AC_ind_read_dxpl_id)) < 0) @@ -1726,20 +1704,20 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5TRACE4("t", "i*s*si", loc_id, obj_name, attr_name, lapl_id); /* check arguments */ - if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") - if(!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + if (H5I_ATTR == H5I_get_type(loc_id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + if (H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if (!obj_name || !*obj_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + if (!attr_name || !*attr_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) + if (H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") - if((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id, dxpl_id)) < 0) + if ((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: diff --git a/src/H5Aint.c b/src/H5Aint.c index 117dbce..5c32e86 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -33,14 +33,14 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5SMprivate.h" /* Shared Object Header Messages */ /****************/ @@ -739,86 +739,89 @@ H5A__get_name(H5A_t *attr, size_t buf_size, char *buf) /*------------------------------------------------------------------------- - * Function: H5A_get_space + * Function: H5A_get_space * - * Purpose: Returns dataspace of the attribute. + * Purpose: Returns dataspace of the attribute. * - * Return: Success: dataspace + * Return: Success: A valid ID for the dataspace of an attribute * - * Failure: NULL - * - * Programmer: Mohamad Chaarawi - * March, 2012 + * Failure: H5I_INVALID_ID * *------------------------------------------------------------------------- */ -H5S_t * +hid_t H5A_get_space(H5A_t *attr) { - H5S_t *ret_value = NULL; + H5S_t *ds = NULL; + hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_NOAPI_NOINIT HDassert(attr); /* Copy the attribute's dataspace */ - if(NULL == (ret_value = H5S_copy(attr->shared->ds, FALSE, TRUE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to copy dataspace") + if (NULL == (ds = H5S_copy(attr->shared->ds, FALSE, TRUE))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy dataspace") + + /* Atomize */ + if ((ret_value = H5I_register(H5I_DATASPACE, ds, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom") done: + if (H5I_INVALID_HID == ret_value && ds && H5S_close(ds) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataspace") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_get_space() */ /*------------------------------------------------------------------------- - * Function: H5A_get_type + * Function: H5A_get_type * - * Purpose: Returns datatype of the dataset. + * Purpose: Returns an ID for the datatype of an attribute * - * Return: Success: datatype + * Return: Success: A valid ID for the datatype of an attribute * - * Failure: NULL - * - * Programmer: Mohamad Chaarawi - * March, 2012 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ -H5T_t * +hid_t H5A_get_type(H5A_t *attr) { H5T_t *dt = NULL; - H5T_t *ret_value = NULL; + hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_NOAPI_NOINIT HDassert(attr); /* Patch the datatype's "top level" file pointer */ - if(H5T_patch_file(attr->shared->dt, attr->oloc.file) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to patch datatype's file pointer") + if (H5T_patch_file(attr->shared->dt, attr->oloc.file) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to patch datatype's file pointer") - /* - * Copy the attribute's datatype. If the type is a named type then + /* Copy the attribute's datatype. If the type is a named type then * reopen the type before returning it to the user. Make the type * read-only. */ - if(NULL == (dt = H5T_copy(attr->shared->dt, H5T_COPY_REOPEN))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to copy datatype") + if (NULL == (dt = H5T_copy(attr->shared->dt, H5T_COPY_REOPEN))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy datatype") /* Mark any datatypes as being in memory now */ - if(H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location") + if (H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "invalid datatype location") /* Lock copied type */ - if(H5T_lock(dt, FALSE) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to lock transient datatype") + if (H5T_lock(dt, FALSE) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to lock transient datatype") - ret_value = dt; + /* Atomize */ + if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype") done: - if(!ret_value && dt && (H5T_close(dt) < 0)) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release datatype") + if (H5I_INVALID_HID == ret_value && dt && (H5T_close(dt) < 0)) + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype") FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_get_type() */ diff --git a/src/H5Aprivate.h b/src/H5Aprivate.h index b285920..9826859 100644 --- a/src/H5Aprivate.h +++ b/src/H5Aprivate.h @@ -76,8 +76,8 @@ typedef struct H5A_attr_iter_op_t { H5_DLL struct H5O_loc_t *H5A_oloc(H5A_t *attr); H5_DLL H5G_name_t *H5A_nameof(H5A_t *attr); H5_DLL H5T_t *H5A_type(const H5A_t *attr); -H5_DLL H5T_t *H5A_get_type(H5A_t *attr); -H5_DLL H5S_t *H5A_get_space(H5A_t *attr); +H5_DLL hid_t H5A_get_type(H5A_t *attr); +H5_DLL hid_t H5A_get_space(H5A_t *attr); H5_DLL herr_t H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, void *op_data); diff --git a/src/H5Dio.c b/src/H5Dio.c index 104a632..aee3c35 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -49,10 +49,6 @@ /* Local Prototypes */ /********************/ -/* Internal I/O routines */ -static herr_t H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id, - const H5S_t *mem_space, const H5S_t *file_space, hid_t dxpl_id, const void *buf); - /* Setup/teardown routines */ static herr_t H5D__ioinfo_init(H5D_t *dset, #ifndef H5_HAVE_PARALLEL @@ -324,18 +320,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__pre_write - * - * Purpose: Preparation for writing data. + * Function: H5D__pre_write * - * Return: Non-negative on success/Negative on failure + * Purpose: Preparation for writing data. * - * Programmer: Raymond Lu - * 2 November 2012 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space, hid_t dxpl_id, const void *buf) @@ -962,7 +955,9 @@ const io_info->using_mpi_vfd = H5F_HAS_FEATURE(dset->oloc.file, H5FD_FEAT_HAS_MPI); #endif /* H5_HAVE_PARALLEL */ -done: +#ifdef H5_DEBUG_BUILD + done: +#endif /* H5_DEBUG_BUILD */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__ioinfo_init() */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index beb1089..542abd0 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -598,6 +598,8 @@ H5_DLL herr_t H5D_set_io_info_dxpls(H5D_io_info_t *io_info, hid_t dxpl_id); H5_DLL herr_t H5D__format_convert(H5D_t *dataset, hid_t dxpl_id); /* Internal I/O routines */ +H5_DLL herr_t H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id, + const H5S_t *mem_space, const H5S_t *file_space, hid_t dxpl_id, const void *buf); H5_DLL herr_t H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space, hid_t dset_xfer_plist, void *buf/*out*/); @@ -21,20 +21,20 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Aprivate.h" /* Attributes */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5SMprivate.h" /* Shared Object Header Messages */ -#include "H5Tprivate.h" /* Datatypes */ +#include "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5Tprivate.h" /* Datatypes */ /****************/ @@ -377,83 +377,82 @@ done: /*------------------------------------------------------------------------- * Function: H5Fcreate * - * Purpose: This is the primary function for creating HDF5 files . The - * flags parameter determines whether an existing file will be - * overwritten or not. All newly created files are opened for - * both reading and writing. All flags may be combined with the - * bit-wise OR operator (`|') to change the behavior of the file - * create call. + * Purpose: This is the primary function for creating HDF5 files . The + * flags parameter determines whether an existing file will be + * overwritten or not. All newly created files are opened for + * both reading and writing. All flags may be combined with the + * bit-wise OR operator (`|') to change the behavior of the file + * create call. * - * The more complex behaviors of a file's creation and access - * are controlled through the file-creation and file-access - * property lists. The value of H5P_DEFAULT for a template - * value indicates that the library should use the default - * values for the appropriate template. + * The more complex behaviors of a file's creation and access + * are controlled through the file-creation and file-access + * property lists. The value of H5P_DEFAULT for a template + * value indicates that the library should use the default + * values for the appropriate template. * * See also: H5Fpublic.h for the list of supported flags. H5Ppublic.h for - * the list of file creation and file access properties. + * the list of file creation and file access properties. * - * Return: Success: A file ID - * Failure: FAIL + * Return: Success: A file ID + * Failure: FAIL *------------------------------------------------------------------------- */ hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { - H5F_t *new_file = NULL; /*file struct for new file */ - hid_t dxpl_id = H5AC_ind_read_dxpl_id; /*dxpl used by library */ - hid_t ret_value; /*return value */ + H5F_t *new_file = NULL; /* file struct for new file */ + hid_t dxpl_id = H5AC_ind_read_dxpl_id;/* dxpl used by library */ + hid_t ret_value; /* return value */ FUNC_ENTER_API(FAIL) H5TRACE4("i", "*sIuii", filename, flags, fcpl_id, fapl_id); /* Check/fix arguments */ - if(!filename || !*filename) + if (!filename || !*filename) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file name") + /* In this routine, we only accept the following flags: * H5F_ACC_EXCL, H5F_ACC_TRUNC and H5F_ACC_SWMR_WRITE */ - if(flags & ~(H5F_ACC_EXCL | H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE)) + if (flags & ~(H5F_ACC_EXCL | H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags") + /* The H5F_ACC_EXCL and H5F_ACC_TRUNC flags are mutually exclusive */ - if((flags & H5F_ACC_EXCL) && (flags & H5F_ACC_TRUNC)) + if ((flags & H5F_ACC_EXCL) && (flags & H5F_ACC_TRUNC)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mutually exclusive flags for file creation") /* Check file creation property list */ - if(H5P_DEFAULT == fcpl_id) + if (H5P_DEFAULT == fcpl_id) fcpl_id = H5P_FILE_CREATE_DEFAULT; else - if(TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) + if (TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file create property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id, H5I_INVALID_HID, TRUE) < 0) + if (H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id, H5I_INVALID_HID, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") - /* - * Adjust bit flags by turning on the creation bit and making sure that + /* Adjust bit flags by turning on the creation bit and making sure that * the EXCL or TRUNC bit is set. All newly-created files are opened for * reading and writing. */ - if (0==(flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC))) - flags |= H5F_ACC_EXCL; /*default*/ + if (0 == (flags & (H5F_ACC_EXCL | H5F_ACC_TRUNC))) + flags |= H5F_ACC_EXCL; /*default*/ flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; - /* - * Create a new file or truncate an existing file. - */ - if(NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id, dxpl_id))) + /* Create a new file or truncate an existing file. */ + if (NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file") /* Get an atom for the file */ - if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) + if ((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file") /* Keep this ID in file object structure */ new_file->file_id = ret_value; done: - if(ret_value < 0 && new_file && H5F_try_close(new_file, NULL) < 0) + if (ret_value < 0 && new_file && H5F_try_close(new_file, NULL) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file") FUNC_LEAVE_API(ret_value) @@ -463,46 +462,28 @@ done: /*------------------------------------------------------------------------- * Function: H5Fopen * - * Purpose: This is the primary function for accessing existing HDF5 - * files. The FLAGS argument determines whether writing to an - * existing file will be allowed or not. All flags may be - * combined with the bit-wise OR operator (`|') to change the - * behavior of the file open call. The more complex behaviors - * of a file's access are controlled through the file-access - * property list. - * - * See Also: H5Fpublic.h for a list of possible values for FLAGS. - * - * Return: Success: A file ID - * Failure: FAIL - * - * Modifications: - * Robb Matzke, 1997-07-18 - * File struct creation and destruction is through H5F_new() and - * H5F__dest(). Reading the root symbol table entry is done with - * H5G_decode(). - * - * Robb Matzke, 1997-09-23 - * Most of the work is now done by H5F_open() since H5Fcreate() - * and H5Fopen() originally contained almost identical code. - * - * Robb Matzke, 1998-02-18 - * Added better error checking for the flags and the file access - * property list. It used to be possible to make the library - * dump core by passing an object ID that was not a file access - * property list. - * - * Robb Matzke, 1999-08-02 - * The file access property list is passed to the H5F_open() as - * object IDs. + * Purpose: This is the primary function for accessing existing HDF5 + * files. The FLAGS argument determines whether writing to an + * existing file will be allowed or not. All flags may be + * combined with the bit-wise OR operator (`|') to change the + * behavior of the file open call. The more complex behaviors + * of a file's access are controlled through the file-access + * property list. + * + * See Also: H5Fpublic.h for a list of possible values for FLAGS. + * + * Return: Success: A file ID + * + * Failure: FAIL + * *------------------------------------------------------------------------- */ hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { - H5F_t *new_file = NULL; /* file struct for new file */ - hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */ - hid_t ret_value; /* return value */ + H5F_t *new_file = NULL; /* file struct for new file */ + hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */ + hid_t ret_value; /* return value */ FUNC_ENTER_API(FAIL) H5TRACE3("i", "*sIui", filename, flags, fapl_id); @@ -685,28 +666,28 @@ H5Fclose(hid_t file_id) H5TRACE1("e", "i", file_id); /* Check/fix arguments. */ - if(H5I_FILE != H5I_get_type(file_id)) + if (H5I_FILE != H5I_get_type(file_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file ID") /* Flush file if this is the last reference to this id and we have write * intent, unless it will be flushed by the "shared" file being closed. * This is only necessary to replicate previous behaviour, and could be - * disabled by an option/property to improve performance. */ - if(NULL == (f = (H5F_t *)H5I_object(file_id))) + * disabled by an option/property to improve performance. + */ + if (NULL == (f = (H5F_t *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if((f->shared->nrefs > 1) && (H5F_INTENT(f) & H5F_ACC_RDWR)) { - if((nref = H5I_get_ref(file_id, FALSE)) < 0) + if ((f->shared->nrefs > 1) && (H5F_INTENT(f) & H5F_ACC_RDWR)) { + if ((nref = H5I_get_ref(file_id, FALSE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID ref count") - if(nref == 1) - if(H5F__flush(f, H5AC_ind_read_dxpl_id, H5AC_rawdata_dxpl_id, FALSE) < 0) + if (nref == 1) + if (H5F__flush(f, H5AC_ind_read_dxpl_id, H5AC_rawdata_dxpl_id, FALSE) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") - } /* end if */ + } - /* - * Decrement reference count on atom. When it reaches zero the file will + /* Decrement reference count on atom. When it reaches zero the file will * be closed. */ - if(H5I_dec_app_ref(file_id) < 0) + if (H5I_dec_app_ref(file_id) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTCLOSEFILE, FAIL, "decrementing file ID failed") done: @@ -119,7 +119,7 @@ H5FD__init_package(void) FUNC_ENTER_PACKAGE if(H5I_register_type(H5I_VFL_CLS) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface") /* Reset the file serial numbers */ H5FD_file_serial_no_g = 0; @@ -151,18 +151,18 @@ H5FD_term_package(void) FUNC_ENTER_NOAPI_NOINIT_NOERR if(H5_PKG_INIT_VAR) { - if(H5I_nmembers(H5I_VFL) > 0) { - (void)H5I_clear_type(H5I_VFL, FALSE, FALSE); + if(H5I_nmembers(H5I_VFL) > 0) { + (void)H5I_clear_type(H5I_VFL, FALSE, FALSE); n++; /*H5I*/ - } /* end if */ + } /* end if */ else { - /* Destroy the VFL driver id group */ - n += (H5I_dec_type_ref(H5I_VFL) > 0); + /* Destroy the VFL driver ID group */ + n += (H5I_dec_type_ref(H5I_VFL) > 0); - /* Mark closed */ + /* Mark closed */ if(0 == n) H5_PKG_INIT_VAR = FALSE; - } /* end else */ + } /* end else */ } /* end if */ FUNC_LEAVE_NOAPI(n) @@ -247,7 +247,7 @@ H5FDregister(const H5FD_class_t *cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid free-list mapping") /* Create the new class ID */ - if((ret_value=H5FD_register(cls, sizeof(H5FD_class_t), TRUE)) < 0) + if((ret_value = H5FD_register(cls, sizeof(H5FD_class_t), TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file driver ID") done: diff --git a/src/H5Fint.c b/src/H5Fint.c index cf52288..f223195 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -409,39 +409,39 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) H5O_loc_t *oloc; /* Group entry info for object */ switch(olist->obj_type) { - case H5I_ATTR: - oloc = H5A_oloc((H5A_t *)obj_ptr); - break; - - case H5I_GROUP: - oloc = H5G_oloc((H5G_t *)obj_ptr); - break; - - case H5I_DATASET: - oloc = H5D_oloc((H5D_t *)obj_ptr); - break; - - case H5I_DATATYPE: - if(H5T_is_named((H5T_t*)obj_ptr)==TRUE) - oloc = H5T_oloc((H5T_t*)obj_ptr); - else - oloc = NULL; - break; - - case H5I_UNINIT: - case H5I_BADID: - case H5I_FILE: - case H5I_DATASPACE: - case H5I_REFERENCE: - case H5I_VFL: - case H5I_GENPROP_CLS: - case H5I_GENPROP_LST: - case H5I_ERROR_CLASS: - case H5I_ERROR_MSG: - case H5I_ERROR_STACK: - case H5I_NTYPES: + case H5I_ATTR: + oloc = H5A_oloc((H5A_t *)obj_ptr); + break; + + case H5I_GROUP: + oloc = H5G_oloc((H5G_t *)obj_ptr); + break; + + case H5I_DATASET: + oloc = H5D_oloc((H5D_t *)obj_ptr); + break; + + case H5I_DATATYPE: + if(H5T_is_named((H5T_t*)obj_ptr)==TRUE) + oloc = H5T_oloc((H5T_t*)obj_ptr); + else + oloc = NULL; + break; + + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "unknown data object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "unknown or invalid data object") } /* end switch */ if((olist->file_info.local && @@ -1575,7 +1575,7 @@ H5F__flush_phase2(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t closi * * Purpose: Flushes cached data. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 3cd5c21..17d7850 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -25,9 +25,6 @@ #include "H5MMprivate.h" /* Memory management */ /* PRIVATE PROTOTYPES */ -static herr_t H5F_mount(H5G_loc_t *loc, const char *name, H5F_t *child, - hid_t plist_id, hid_t dxpl_id); -static herr_t H5F_unmount(H5G_loc_t *loc, const char *name, hid_t dxpl_id); static void H5F_mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs); @@ -99,7 +96,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5F_mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED plist_id, hid_t dxpl_id) { @@ -265,7 +262,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5F_unmount(H5G_loc_t *loc, const char *name, hid_t dxpl_id) { H5G_t *child_group = NULL; /* Child's group in parent mtab */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index cd6a295..c9aba56 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -361,16 +361,16 @@ struct H5F_file_t { * to shared H5F_file_t structs. */ struct H5F_t { - char *open_name; /* Name used to open file */ - char *actual_name; /* Actual name of the file, after resolving symlinks, etc. */ - char *extpath; /* Path for searching target external link file */ - H5F_file_t *shared; /* The shared file info */ - unsigned nopen_objs; /* Number of open object headers*/ - H5FO_t *obj_count; /* # of time each object is opened through top file structure */ - hid_t file_id; /* ID of this file */ - hbool_t closing; /* File is in the process of being closed */ - struct H5F_t *parent; /* Parent file that this file is mounted to */ - unsigned nmounts; /* Number of children mounted to this file */ + char *open_name; /* Name used to open file */ + char *actual_name; /* Actual name of the file, after resolving symlinks, etc. */ + char *extpath; /* Path for searching target external link file */ + H5F_file_t *shared; /* The shared file info */ + unsigned nopen_objs; /* Number of open object headers */ + H5FO_t *obj_count; /* # of time each object is opened through top file structure */ + hid_t file_id; /* ID of this file */ + hbool_t closing; /* File is in the process of being closed */ + struct H5F_t *parent; /* Parent file that this file is mounted to */ + unsigned nmounts; /* Number of children mounted to this file */ #ifdef H5_HAVE_PARALLEL H5P_coll_md_read_flag_t coll_md_read; /* Do all metadata reads collectively */ hbool_t coll_md_write; /* Do all metadata writes collectively */ @@ -400,11 +400,12 @@ H5_DLL herr_t H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t H5_DLL herr_t H5F__flush(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t closing); H5_DLL htri_t H5F__is_hdf5(const char *name, hid_t meta_dxpl_id, hid_t raw_dxpl_id); H5_DLL herr_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr); -H5_DLL ssize_t H5F_get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len, - hid_t meta_dxpl_id, hid_t raw_dxpl_id); +H5_DLL ssize_t H5F_get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len, hid_t meta_dxpl_id, hid_t raw_dxpl_id); H5_DLL herr_t H5F_close(H5F_t *f); /* File mount related routines */ +H5_DLL herr_t H5F_mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id, hid_t dxpl_id); +H5_DLL herr_t H5F_unmount(H5G_loc_t *loc, const char *name, hid_t dxpl_id); H5_DLL herr_t H5F_close_mounts(H5F_t *f); H5_DLL int H5F_term_unmount_cb(void *obj_ptr, hid_t obj_id, void *key); H5_DLL herr_t H5F_mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 2ec071f..50325bb 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -18,6 +18,9 @@ #ifndef _H5Fprivate_H #define _H5Fprivate_H +/* Early typedefs to avoid circular dependencies */ +typedef struct H5F_t H5F_t; + /* Include package's public header */ #include "H5Fpublic.h" @@ -475,8 +478,8 @@ #define H5F_ACS_SIEVE_BUF_SIZE_NAME "sieve_buf_size" /* Maximum sieve buffer size (when data sieving is allowed by file driver) */ #define H5F_ACS_SDATA_BLOCK_SIZE_NAME "sdata_block_size" /* Minimum "small data" allocation block size (when aggregating "small" raw data allocations) */ #define H5F_ACS_GARBG_COLCT_REF_NAME "gc_ref" /* Garbage-collect references */ -#define H5F_ACS_FILE_DRV_NAME "driver-id/info" /* File driver ID & info */ -#define H5F_ACS_CLOSE_DEGREE_NAME "close_degree" /* File close degree */ +#define H5F_ACS_FILE_DRV_NAME "vfd_info" /* File driver ID & info */ +#define H5F_ACS_CLOSE_DEGREE_NAME "close_degree" /* File close degree */ #define H5F_ACS_FAMILY_OFFSET_NAME "family_offset" /* Offset position in file for family file driver */ #define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" /* New member size of family driver. (private property only used by h5repart) */ #define H5F_ACS_FAMILY_TO_SEC2_NAME "family_to_sec2" /* Whether to convert family to sec2 driver. (private property only used by h5repart) */ @@ -485,7 +488,7 @@ #define H5F_ACS_FORMAT_HIGH_BOUND_NAME "high_bound" /* 'high' bound of library format versions */ #define H5F_ACS_WANT_POSIX_FD_NAME "want_posix_fd" /* Internal: query the file descriptor from the core VFD, instead of the memory address */ #define H5F_ACS_METADATA_READ_ATTEMPTS_NAME "metadata_read_attempts" /* # of metadata read attempts */ -#define H5F_ACS_OBJECT_FLUSH_CB_NAME "object_flush_cb" /* Object flush callback */ +#define H5F_ACS_OBJECT_FLUSH_CB_NAME "object_flush_cb" /* Object flush callback */ #define H5F_ACS_EFC_SIZE_NAME "efc_size" /* Size of external file cache */ #define H5F_ACS_FILE_IMAGE_INFO_NAME "file_image_info" /* struct containing initial file image and callback info */ #define H5F_ACS_CLEAR_STATUS_FLAGS_NAME "clear_status_flags" /* Whether to clear superblock status_flags (private property only used by h5clear) */ @@ -584,7 +587,7 @@ #define H5_SIZEOF_CHKSUM 4 /* v1 B-tree node signature */ -#define H5B_MAGIC "TREE" +#define H5B_MAGIC "TREE" /* v2 B-tree signatures */ #define H5B2_HDR_MAGIC "BTHD" /* Header */ @@ -614,7 +617,7 @@ #define H5HF_DBLOCK_MAGIC "FHDB" /* Direct block */ /* Global heap signature */ -#define H5HG_MAGIC "GCOL" +#define H5HG_MAGIC "GCOL" /* Local heap signature */ #define H5HL_MAGIC "HEAP" @@ -636,12 +639,12 @@ struct H5B_class_t; struct H5UC_t; struct H5O_loc_t; struct H5HG_heap_t; +struct H5VL_class_t; struct H5P_genplist_t; /* Forward declarations for anonymous H5F objects */ /* Main file structures */ -typedef struct H5F_t H5F_t; typedef struct H5F_file_t H5F_file_t; /* Block aggregation structure */ diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 580b062..6b641f1 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -32,10 +32,10 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ /****************/ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 228fb9c..1cc7e15 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -695,29 +695,26 @@ done: /*------------------------------------------------------------------------- - * Function: H5Giterate + * Function: H5Giterate * - * Purpose: Iterates over the entries of a group. The LOC_ID and NAME - * identify the group over which to iterate and IDX indicates - * where to start iterating (zero means at the beginning). The - * OPERATOR is called for each member and the iteration - * continues until the operator returns non-zero or all members - * are processed. The operator is passed a group ID for the - * group being iterated, a member name, and OP_DATA for each - * member. + * Purpose: Iterates over the entries of a group. The LOC_ID and NAME + * identify the group over which to iterate and IDX indicates + * where to start iterating (zero means at the beginning). The + * OPERATOR is called for each member and the iteration + * continues until the operator returns non-zero or all members + * are processed. The operator is passed a group ID for the + * group being iterated, a member name, and OP_DATA for each + * member. * - * Note: Deprecated in favor of H5Literate + * NOTE: Deprecated in favor of H5Literate * - * Return: Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. * - * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. - * - * Programmer: Robb Matzke - * Monday, March 23, 1998 + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. * *------------------------------------------------------------------------- */ @@ -725,21 +722,21 @@ herr_t H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, void *op_data) { - H5G_link_iterate_t lnk_op; /* Link operator */ - hsize_t last_obj; /* Index of last object looked at */ - hsize_t idx; /* Internal location to hold index */ - herr_t ret_value; + H5G_link_iterate_t lnk_op; /* Link operator */ + hsize_t last_obj; /* Index of last object looked at */ + hsize_t idx; /* Internal location to hold index */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "i*s*Isx*x", loc_id, name, idx_p, op, op_data); /* Check args */ - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(idx_p && *idx_p < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified") - if(!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") + if (!name || !*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + if (idx_p && *idx_p < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified") + if (!op) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") /* Set number of objects looked at to zero */ last_obj = 0; @@ -750,11 +747,11 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, lnk_op.op_func.op_old = op; /* Call private function. */ - if((ret_value = H5G_iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_read_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") + if ((ret_value = H5G_iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_read_dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") /* Set the index we stopped at */ - if(idx_p) + if (idx_p) *idx_p = (int)last_obj; done: @@ -12,48 +12,40 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * FILE: H5I.c - Internal storage routines for handling "IDs" + * FILE: H5I.c - Internal storage routines for handling "IDs" * - * REMARKS: ID's which allow objects (void *'s currently) to be bundled - * into "types" for more general storage. + * REMARKS: IDs which allow objects (void * currently) to be bundled + * into "types" for more general storage. * - * DESIGN: The types are stored in an array of pointers to store each - * type in an element. Each "type" node contains a link to a - * hash table to manage the IDs in each type. Allowed types are - * values within the range 1 to H5I_MAX_NUM_TYPES and are given out - * at run-time. Types used by the library are stored in global - * variables defined in H5Ipublic.h. - * - * AUTHOR: Quincey Koziol - * - * MODIFICATIONS: - * 1/3/96 - Starting writing specs & coding prototype - * 1/7/96 - Finished coding prototype - * 6/10/97 - Moved into HDF5 library - * 5/18/04 - Expanded to allow registration of new types at run-time + * DESIGN: The types are stored in an array of pointers to store each + * type in an element. Each "type" node contains a link to a + * hash table to manage the IDs in each type. Allowed types are + * values within the range 1 to H5I_MAX_NUM_TYPES and are given out + * at run-time. Types used by the library are stored in global + * variables defined in H5Ipublic.h. */ #include "H5Imodule.h" /* This source code file is part of the H5I module */ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Ipkg.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5SLprivate.h" /* Skip Lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Ipkg.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5SLprivate.h" /* Skip Lists */ /* Define this to compile in support for dumping ID information */ /* #define H5I_DEBUG_OUTPUT */ #ifndef H5I_DEBUG_OUTPUT -#include "H5Gprivate.h" /* Groups */ +#include "H5Gprivate.h" /* Groups */ #else /* H5I_DEBUG_OUTPUT */ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Tprivate.h" /* Datatypes */ +#define H5G_FRIEND /* Suppress error about including H5Gpkg */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Tprivate.h" /* Datatypes */ #endif /* H5I_DEBUG_OUTPUT */ /* Local Macros */ @@ -194,23 +186,19 @@ H5I_term_package(void) /*------------------------------------------------------------------------- - * Function: H5Iregister_type + * Function: H5Iregister_type * - * Purpose: Public interface to H5I_register_type. Creates a new type - * of ID's to give out. A specific number (RESERVED) of type - * entries may be reserved to enable "constant" values to be handed - * out which are valid IDs in the type, but which do not map to any - * data structures and are not allocated dynamically later. HASH_SIZE is - * the minimum hash table size to use for the type. FREE_FUNC is - * called with an object pointer when the object is removed from - * the type. + * Purpose: Public interface to H5I_register_type. Creates a new type + * of ID's to give out. A specific number (RESERVED) of type + * entries may be reserved to enable "constant" values to be handed + * out which are valid IDs in the type, but which do not map to any + * data structures and are not allocated dynamically later. HASH_SIZE is + * the minimum hash table size to use for the type. FREE_FUNC is + * called with an object pointer when the object is removed from + * the type. * - * Return: Success: Type ID of the new type - * Failure: H5I_BADID - * - * Programmers: Nathaniel Furrer - * James Laird - * Friday, April 30, 2004 + * Return: Success: Type ID of the new type + * Failure: H5I_BADID * *------------------------------------------------------------------------- */ @@ -278,18 +266,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_register_type + * Function: H5I_register_type * - * Purpose: Creates a new type of ID's to give out. - * The class is initialized or its reference count is incremented + * Purpose: Creates a new type of ID's to give out. + * The class is initialized or its reference count is incremented * (if it is already initialized). * - * Return: Success: Type ID of the new type - * Failure: H5I_BADID - * - * Programmers: Nathaniel Furrer - * James Laird - * Friday, April 30, 2004 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -343,17 +326,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Itype_exists + * Function: H5Itype_exists * * Purpose: Query function to inform the user if a given type is * currently registered with the library. * - * Return: Success: 1 if the type is registered, 0 if it is not - * Failure: Negative - * - * Programmer: James Laird - * Nathaniel Furrer - * Tuesday, June 29, 2004 + * Return: Success: 1 if the type is registered, 0 if it is not + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -365,10 +344,10 @@ H5Itype_exists(H5I_type_t type) FUNC_ENTER_API(FAIL) H5TRACE1("t", "It", type); - if(type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + if (type <= H5I_BADID || type >= H5I_next_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - if(NULL == H5I_id_type_list_g[type]) + if (NULL == H5I_id_type_list_g[type]) ret_value = FALSE; done: @@ -409,9 +388,9 @@ H5Inmembers(H5I_type_t type, hsize_t *num_members) * an error when the supplied type does not exist. */ if(type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") if(NULL == H5I_id_type_list_g[type]) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "supplied type does not exist") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "supplied type does not exist") if(num_members) { int64_t members; @@ -693,15 +672,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Iregister + * Function: H5Iregister * - * Purpose: Public interface to H5I_register. - * - * Return: Success: New object id. - * Failure: Negative + * Purpose: Public interface to H5I_register. * - * Programmer: Nathaniel Furrer - * James Laird + * Return: Success: New object id. + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -724,58 +700,54 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_register + * Function: H5I_register * - * Purpose: Registers an OBJECT in a TYPE and returns an ID for it. - * This routine does _not_ check for unique-ness of the objects, - * if you register an object twice, you will get two different - * IDs for it. This routine does make certain that each ID in a - * type is unique. IDs are created by getting a unique number - * for the type the ID is in and incorporating the type into - * the ID which is returned to the user. - * - * Return: Success: New object id. - * Failure: Negative + * Purpose: Registers an OBJECT in a TYPE and returns an ID for it. + * This routine does _not_ check for unique-ness of the objects, + * if you register an object twice, you will get two different + * IDs for it. This routine does make certain that each ID in a + * type is unique. IDs are created by getting a unique number + * for the type the ID is in and incorporating the type into + * the ID which is returned to the user. * - * Programmer: Unknown + * Return: Success: New object id + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5I_register(H5I_type_t type, const void *object, hbool_t app_ref) { - H5I_id_type_t *type_ptr; /*ptr to the type */ - H5I_id_info_t *id_ptr; /*ptr to the new ID information */ - hid_t new_id; /*new ID */ - hid_t ret_value = SUCCEED; /*return value */ + H5I_id_type_t *type_ptr = NULL; /* ptr to the type */ + H5I_id_info_t *id_ptr = NULL; /* ptr to the new ID information */ + hid_t new_id = -1; /* new ID */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - if(type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + if (type <= H5I_BADID || type >= H5I_next_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if(NULL == type_ptr || type_ptr->init_count <= 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") - if(NULL == (id_ptr = H5FL_MALLOC(H5I_id_info_t))) - HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, FAIL, "memory allocation failed") + if ((NULL == type_ptr) || (type_ptr->init_count <= 0)) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, H5I_INVALID_HID, "invalid type") + if (NULL == (id_ptr = H5FL_MALLOC(H5I_id_info_t))) + HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed") - /* Create the struct & it's ID */ + /* Create the struct & its ID */ new_id = H5I_MAKE(type, type_ptr->nextid); id_ptr->id = new_id; - id_ptr->count = 1; /*initial reference count*/ + id_ptr->count = 1; /* initial reference count */ id_ptr->app_count = !!app_ref; id_ptr->obj_ptr = object; /* Insert into the type */ - if(H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, FAIL, "can't insert ID node into skip list") + if (H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert ID node into skip list") type_ptr->id_count++; type_ptr->nextid++; - /* - * Sanity check for the 'nextid' getting too large and wrapping around. - */ + /* Sanity check for the 'nextid' getting too large and wrapping around */ HDassert(type_ptr->nextid <= ID_MASK); /* Set return value */ @@ -789,27 +761,23 @@ done: /*------------------------------------------------------------------------- * Function: H5I_register_with_id * - * Purpose: Registers an OBJECT in a TYPE with the supplied ID for it. - * This routine will check to ensure the supplied ID is not already - * in use, and ensure that it is a valid ID for the given type, - * but will NOT check to ensure the OBJECT is not already - * registered (thus, it is possible to register one object under - * multiple IDs). + * Purpose: Registers an OBJECT in a TYPE with the supplied ID for it. + * This routine will check to ensure the supplied ID is not already + * in use, and ensure that it is a valid ID for the given type, + * but will NOT check to ensure the OBJECT is not already + * registered (thus, it is possible to register one object under + * multiple IDs). * - * Return: Success: 0 - * Failure: -1 - * - * Programmer: Mike McGreevy - * Wednesday, July 21, 2010 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t id) { - H5I_id_type_t *type_ptr; /*ptr to the type */ - H5I_id_info_t *id_ptr; /*ptr to the new ID information */ - herr_t ret_value = SUCCEED; /*return value */ + H5I_id_type_t *type_ptr; /* ptr to the type */ + H5I_id_info_t *id_ptr; /* ptr to the new ID information */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1199,10 +1167,10 @@ H5I_remove(hid_t id) /* Check arguments */ type = H5I_TYPE(id); if(type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid type number") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; if(type_ptr == NULL || type_ptr->init_count <= 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid type") + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid type") /* Remove the node from the type */ if(NULL == (ret_value = H5I__remove_common(type_ptr, id))) @@ -1238,7 +1206,7 @@ H5Idec_ref(hid_t id) /* Check arguments */ if(id < 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") /* Do actual decrement operation */ if((ret_value = H5I_dec_app_ref(id)) < 0) @@ -1371,16 +1339,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_dec_app_ref_always_close - * - * Purpose: H5I_dec_app_ref wrapper for case of always closing the ID, - * even when the free routine fails + * Function: H5I_dec_app_ref_always_close * - * Return: Success: New app. reference count. - * Failure: Negative + * Purpose: H5I_dec_app_ref wrapper for case of always closing the ID, + * even when the free routine fails * - * Programmer: Quincey Koziol - * Sept 16, 2010 + * Return: Success: New app. reference count. + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1398,7 +1363,7 @@ H5I_dec_app_ref_always_close(hid_t id) ret_value = H5I_dec_app_ref(id); /* Check for failure */ - if(ret_value < 0) { + if (ret_value < 0) { /* * If an object is closing, we can remove the ID even though the free * method might fail. This can happen when a mandatory filter fails to @@ -1408,7 +1373,7 @@ H5I_dec_app_ref_always_close(hid_t id) H5I_remove(id); HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, FAIL, "can't decrement ID ref count") - } /* end if */ + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -1416,15 +1381,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Iinc_ref - * - * Purpose: Increments the number of references outstanding for an ID. + * Function: H5Iinc_ref * - * Return: Success: New reference count - * Failure: Negative + * Purpose: Increments the number of references outstanding for an ID. * - * Programmer: Quincey Koziol - * Dec 7, 2003 + * Return: Success: New reference count + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1437,11 +1399,11 @@ H5Iinc_ref(hid_t id) H5TRACE1("Is", "i", id); /* Check arguments */ - if(id < 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") + if (id < 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") /* Do actual increment operation */ - if((ret_value = H5I_inc_ref(id, TRUE)) < 0) + if ((ret_value = H5I_inc_ref(id, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, FAIL, "can't increment ID ref count") done: @@ -1450,15 +1412,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_inc_ref - * - * Purpose: Increment the reference count for an object. + * Function: H5I_inc_ref * - * Return: Success: The new reference count. - * Failure: Negative + * Purpose: Increment the reference count for an object. * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 + * Return: Success: The new reference count. + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1474,8 +1433,8 @@ H5I_inc_ref(hid_t id, hbool_t app_ref) HDassert(id >= 0); /* General lookup of the ID */ - if(NULL == (id_ptr = H5I__find_id(id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") + if (NULL == (id_ptr = H5I__find_id(id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") /* Adjust reference counts */ ++(id_ptr->count); @@ -1491,15 +1450,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Iget_ref - * - * Purpose: Retrieves the number of references outstanding for an ID. + * Function: H5Iget_ref * - * Return: Success: Reference count - * Failure: Negative + * Purpose: Retrieves the number of references outstanding for an ID. * - * Programmer: Quincey Koziol - * Dec 7, 2003 + * Return: Success: Reference count + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1512,11 +1468,11 @@ H5Iget_ref(hid_t id) H5TRACE1("Is", "i", id); /* Check arguments */ - if(id < 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") + if (id < 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") /* Do actual retrieve operation */ - if((ret_value = H5I_get_ref(id, TRUE)) < 0) + if ((ret_value = H5I_get_ref(id, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID ref count") done: @@ -1525,15 +1481,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_get_ref + * Function: H5I_get_ref * - * Purpose: Retrieve the reference count for an object. - * - * Return: Success: The reference count. - * Failure: Negative + * Purpose: Retrieve the reference count for an object. * - * Programmer: Quincey Koziol - * Saturday, Decemeber 6, 2003 + * Return: Success: The reference count. + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1549,8 +1502,8 @@ H5I_get_ref(hid_t id, hbool_t app_ref) HDassert(id >= 0); /* General lookup of the ID */ - if(NULL == (id_ptr = H5I__find_id(id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") + if (NULL == (id_ptr = H5I__find_id(id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") /* Set return value */ ret_value = (int)(app_ref ? id_ptr->app_count : id_ptr->count); @@ -1561,16 +1514,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Iinc_type_ref + * Function: H5Iinc_type_ref * - * Purpose: Increments the number of references outstanding for an ID type. + * Purpose: Increments the number of references outstanding for an ID type. * - * Return: Success: New reference count - * Failure: Negative - * - * Programmer: Nat Furrer - * James Laird - * April 30, 2004 + * Return: Success: New reference count + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1583,14 +1532,14 @@ H5Iinc_type_ref(H5I_type_t type) H5TRACE1("Is", "It", type); /* Check arguments */ - if(type <= 0 || type >= H5I_next_type) + if (type <= 0 || type >= H5I_next_type) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID type") - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") /* Do actual increment operation */ - if((ret_value = H5I__inc_type_ref(type)) < 0) + if ((ret_value = H5I__inc_type_ref(type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, FAIL, "can't increment ID type ref count") done: @@ -1599,16 +1548,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5I__inc_type_ref - * - * Purpose: Increment the reference count for an ID type. + * Function: H5I__inc_type_ref * - * Return: Success: The new reference count. - * Failure: Negative + * Purpose: Increment the reference count for an ID type. * - * Programmer: James Laird - * Nat Furrer - * Friday, April 30, 2004 + * Return: Success: The new reference count + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1625,8 +1570,8 @@ H5I__inc_type_ref(H5I_type_t type) /* Check arguments */ type_ptr = H5I_id_type_list_g[type]; - if(!type_ptr) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") + if (!type_ptr) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* Set return value */ ret_value = (int)(++(type_ptr->init_count)); @@ -1637,24 +1582,26 @@ done: /*------------------------------------------------------------------------- - * Function: H5Idec_type_ref - * - * Purpose: Decrements the reference count on an entire type of IDs. - * If the type reference count becomes zero then the type is - * destroyed along with all atoms in that type regardless of - * their reference counts. Destroying IDs involves calling - * the free-func for each ID's object and then adding the ID - * struct to the ID free list. Public interface to - * H5I_dec_type_ref. - * Returns the number of references to the type on success; a - * return value of 0 means that the type will have to be - * re-initialized before it can be used again (and should probably - * be set to H5I_UNINIT). - * - * Return: Number of references to type on success/Negative on failure - * - * Programmer: Nathaniel Furrer - * James Laird + * Function: H5Idec_type_ref + * + * Purpose: Decrements the reference count on an entire type of IDs. + * If the type reference count becomes zero then the type is + * destroyed along with all atoms in that type regardless of + * their reference counts. Destroying IDs involves calling + * the free-func for each ID's object and then adding the ID + * struct to the ID free list. Public interface to + * H5I_dec_type_ref. + * Returns the number of references to the type on success; a + * return value of 0 means that the type will have to be + * re-initialized before it can be used again (and should probably + * be set to H5I_UNINIT). + * + * NOTE: Using an error type to also represent a count is semantially + * incorrect. We should consider fixing this in a future major + * release (DER). + * + * Return: Success: Number of references to type + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1666,7 +1613,7 @@ H5Idec_type_ref(H5I_type_t type) FUNC_ENTER_API(FAIL) H5TRACE1("e", "It", type); - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") ret_value = H5I_dec_type_ref(type); @@ -1677,22 +1624,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_dec_type_ref - * - * Purpose: Decrements the reference count on an entire type of IDs. - * If the type reference count becomes zero then the type is - * destroyed along with all atoms in that type regardless of - * their reference counts. Destroying IDs involves calling - * the free-func for each ID's object and then adding the ID - * struct to the ID free list. - * Returns the number of references to the type on success; a - * return value of 0 means that the type will have to be - * re-initialized before it can be used again (and should probably - * be set to H5I_UNINIT). - * - * Return: Number of references to type on success/Negative on failure - * - * Programmer: Unknown + * Function: H5I_dec_type_ref + * + * Purpose: Decrements the reference count on an entire type of IDs. + * If the type reference count becomes zero then the type is + * destroyed along with all atoms in that type regardless of + * their reference counts. Destroying IDs involves calling + * the free-func for each ID's object and then adding the ID + * struct to the ID free list. + * Returns the number of references to the type on success; a + * return value of 0 means that the type will have to be + * re-initialized before it can be used again (and should probably + * be set to H5I_UNINIT). + * + * Return: Success: Number of references to type + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1704,27 +1650,26 @@ H5I_dec_type_ref(H5I_type_t type) FUNC_ENTER_NOAPI(FAIL) - if(type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + if (type <= H5I_BADID || type >= H5I_next_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if(type_ptr == NULL || type_ptr->init_count <= 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") + if (type_ptr == NULL || type_ptr->init_count <= 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") - /* - * Decrement the number of users of the atomic type. If this is the + /* Decrement the number of users of the atomic type. If this is the * last user of the type then release all atoms from the type and * free all memory it used. The free function is invoked for each atom * being freed. */ - if(1 == type_ptr->init_count) { + if (1 == type_ptr->init_count) { H5I__destroy_type(type); ret_value = 0; - } /* end if */ + } else { --(type_ptr->init_count); ret_value = (herr_t)type_ptr->init_count; - } /* end else */ + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -1732,16 +1677,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Iget_type_ref - * - * Purpose: Retrieves the number of references outstanding for a type. + * Function: H5Iget_type_ref * - * Return: Success: Reference count - * Failure: Negative + * Purpose: Retrieves the number of references outstanding for a type. * - * Programmer: Nat Furrer - * James Laird - * April 30, 2004 + * Return: Success: Reference count + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1754,14 +1695,14 @@ H5Iget_type_ref(H5I_type_t type) H5TRACE1("Is", "It", type); /* Check arguments */ - if(type <= 0 || type >= H5I_next_type) + if (type <= 0 || type >= H5I_next_type) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID type") - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") /* Do actual retrieve operation */ - if((ret_value = H5I__get_type_ref(type)) < 0) + if ((ret_value = H5I__get_type_ref(type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID type ref count") done: @@ -1770,25 +1711,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5I__get_type_ref - * - * Purpose: Retrieve the reference count for an ID type. + * Function: H5I__get_type_ref * - * Return: Success: The reference count. + * Purpose: Retrieve the reference count for an ID type. * - * Failure: Negative + * Return: Success: The reference count. * - * Programmer: Nat Furrer - * James Laird - * April 30, 2004 + * Failure: Negative * *------------------------------------------------------------------------- */ static int H5I__get_type_ref(H5I_type_t type) { - H5I_id_type_t *type_ptr; /*ptr to the type */ - int ret_value = -1; /* Return value */ + H5I_id_type_t *type_ptr; /* Pointer to the type */ + int ret_value = -1; /* Return value */ FUNC_ENTER_STATIC @@ -1797,7 +1734,7 @@ H5I__get_type_ref(H5I_type_t type) /* Check arguments */ type_ptr = H5I_id_type_list_g[type]; - if(!type_ptr) + if (!type_ptr) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* Set return value */ @@ -1809,17 +1746,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Iis_valid + * Function: H5Iis_valid * - * Purpose: Check if the given id is valid. An id is valid if it is in + * Purpose: Check if the given id is valid. An id is valid if it is in * use and has an application reference count of at least 1. * - * Return: Success: TRUE if the id is valid, FALSE otherwise. + * Return: Success: TRUE if the id is valid, FALSE otherwise. * - * Failure: Negative (never fails currently) - * - * Programmer: Neil Fortner - * Friday, October 31, 2008 (boo) + * Failure: Negative (never fails currently) * *------------------------------------------------------------------------- */ @@ -1835,9 +1769,7 @@ H5Iis_valid(hid_t id) /* Find the ID */ if (NULL == (id_ptr = H5I__find_id(id))) ret_value = FALSE; - - /* Check if the found id is an internal id */ - else if (!id_ptr->app_count) + else if (!id_ptr->app_count) /* Check if the found id is an internal id */ ret_value = FALSE; done: @@ -1846,19 +1778,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5I__search_cb - * - * Purpose: Callback routine for H5Isearch, when it calls H5I_iterate. - * Calls "user" callback search function, and then sets return - * value, based on the result of that callback. + * Function: H5I__search_cb * - * Return: Success: The first object in the type for which FUNC - * returns non-zero. NULL if FUNC returned zero - * for every object in the type. - * Failure: NULL + * Purpose: Callback routine for H5Isearch, when it calls H5I_iterate. + * Calls "user" callback search function, and then sets return + * value, based on the result of that callback. * - * Programmer: Quincey Koziol - * Friday, March 30, 2012 + * Return: Success: The first object in the type for which FUNC + * returns non-zero. NULL if FUNC returned zero + * for every object in the type. + * Failure: NULL * *------------------------------------------------------------------------- */ @@ -1871,7 +1800,7 @@ H5I__search_cb(void *obj, hid_t id, void *_udata) FUNC_ENTER_STATIC_NOERR ret_value = (*udata->app_cb)(obj, id, udata->app_key); - if(ret_value > 0) + if (ret_value > 0) udata->ret_obj = obj; FUNC_LEAVE_NOAPI(ret_value) @@ -1879,26 +1808,22 @@ H5I__search_cb(void *obj, hid_t id, void *_udata) /*------------------------------------------------------------------------- - * Function: H5Isearch + * Function: H5Isearch * - * Purpose: Apply function FUNC to each member of type TYPE and return a - * pointer to the first object for which FUNC returns non-zero. - * The FUNC should take a pointer to the object and the KEY as - * arguments and return non-zero to terminate the search (zero - * to continue). Public interface to H5I_search. + * Purpose: Apply function FUNC to each member of type TYPE and return a + * pointer to the first object for which FUNC returns non-zero. + * The FUNC should take a pointer to the object and the KEY as + * arguments and return non-zero to terminate the search (zero + * to continue). Public interface to H5I_search. * - * Limitation: Currently there is no way to start searching from where a - * previous search left off. + * Limitation: Currently there is no way to start searching from where a + * previous search left off. * - * Return: Success: The first object in the type for which FUNC - * returns non-zero. NULL if FUNC returned zero - * for every object in the type. - * - * Failure: NULL + * Return: Success: The first object in the type for which FUNC + * returns non-zero. NULL if FUNC returned zero + * for every object in the type. * - * Programmer: James Laird - * Nathaniel Furrer - * Friday, April 23, 2004 + * Failure: NULL * *------------------------------------------------------------------------- */ @@ -1912,7 +1837,7 @@ H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key) H5TRACE3("*x", "Itx*x", type, func, key); /* Check arguments */ - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") /* Set up udata struct */ @@ -1934,17 +1859,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5I__iterate_cb + * Function: H5I__iterate_cb * - * Purpose: Callback routine for H5I_iterate, invokes "user" callback + * Purpose: Callback routine for H5I_iterate, invokes "user" callback * function, and then sets return value, based on the result of * that callback. * - * Return: Success: Non-negative on success - * Failure: Negative - * - * Programmer: Quincey Koziol - * Thursday, October 3, 2013 + * Return: Success: Non-negative on success + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -1976,29 +1898,25 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) /*------------------------------------------------------------------------- * Function: H5I_iterate * - * Purpose: Apply function FUNC to each member of type TYPE (with - * non-zero application reference count if app_ref is TRUE). - * Stop if FUNC returns a non zero value (i.e. anything - * other than H5_ITER_CONT). + * Purpose: Apply function FUNC to each member of type TYPE (with + * non-zero application reference count if app_ref is TRUE). + * Stop if FUNC returns a non zero value (i.e. anything + * other than H5_ITER_CONT). * - * If FUNC returns a positive value (i.e. H5_ITER_STOP), - * return SUCCEED. + * If FUNC returns a positive value (i.e. H5_ITER_STOP), + * return SUCCEED. * - * If FUNC returns a negative value (i.e. H5_ITER_ERROR), - * return FAIL. + * If FUNC returns a negative value (i.e. H5_ITER_ERROR), + * return FAIL. * - * The FUNC should take a pointer to the object and the - * udata as arguments and return non-zero to terminate - * siteration, and zero to continue. - * - * Limitation: Currently there is no way to start the iteration from - * where a previous iteration left off. + * The FUNC should take a pointer to the object and the + * udata as arguments and return non-zero to terminate + * siteration, and zero to continue. * - * Return: Success: SUCCEED - * Failure: FAIL + * Limitation: Currently there is no way to start the iteration from + * where a previous iteration left off. * - * Programmer: John Mainzer - * Monday, December 6, 2011 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -2011,12 +1929,12 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - if(type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + if (type <= H5I_BADID || type >= H5I_next_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; /* Only iterate through ID list if it is initialized and there are IDs in type */ - if(type_ptr && type_ptr->init_count > 0 && type_ptr->id_count > 0) { + if (type_ptr && type_ptr->init_count > 0 && type_ptr->id_count > 0) { H5I_iterate_ud_t iter_udata; /* User data for iteration callback */ herr_t iter_status; /* Iteration status */ @@ -2026,9 +1944,9 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re iter_udata.app_ref = app_ref; /* Iterate over IDs */ - if((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0) + if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed") - } /* end if */ + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -2036,16 +1954,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5I__find_id - * - * Purpose: Given an object ID find the info struct that describes the - * object. + * Function: H5I__find_id * - * Return: Success: Ptr to the object's info struct. + * Purpose: Given an object ID find the info struct that describes the + * object. * - * Failure: NULL + * Return: Success: A pointer to the object's info struct. * - * Programmer: Unknown + * Failure: NULL * *------------------------------------------------------------------------- */ @@ -2060,12 +1976,12 @@ H5I__find_id(hid_t id) /* Check arguments */ type = H5I_TYPE(id); - if(type <= H5I_BADID || type >= H5I_next_type) - HGOTO_DONE(NULL) + if (type <= H5I_BADID || type >= H5I_next_type) + HGOTO_DONE(NULL) type_ptr = H5I_id_type_list_g[type]; - if(!type_ptr || type_ptr->init_count <= 0) - HGOTO_DONE(NULL) + if (!type_ptr || type_ptr->init_count <= 0) + HGOTO_DONE(NULL) /* Locate the ID node for the ID */ ret_value = (H5I_id_info_t *)H5SL_search(type_ptr->ids, &id); @@ -2076,17 +1992,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Iget_name - * - * Purpose: Gets a name of an object from its ID. + * Function: H5Iget_name * - * Return: Success: The length of name. + * Purpose: Gets a name of an object from its ID. * - * Failure: -1 + * Return: Success: The length of the name * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: July 26, 2002 + * Failure: -1 * * Comments: Public function * If `name' is non-NULL then write up to `size' bytes into that @@ -2110,12 +2022,12 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size) H5TRACE3("Zs", "ixz", id, name, size); /* Get object location */ - if(H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location") + if (H5G_loc(id, &loc) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location") /* Call internal group routine to retrieve object's name */ - if((ret_value = H5G_get_name(&loc, name, size, NULL, H5P_DEFAULT, H5AC_ind_read_dxpl_id)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") + if ((ret_value = H5G_get_name(&loc, name, size, NULL, H5P_DEFAULT, H5AC_ind_read_dxpl_id)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") done: FUNC_LEAVE_API(ret_value) @@ -2123,30 +2035,27 @@ done: /*------------------------------------------------------------------------- - * Function: H5Iget_file_id + * Function: H5Iget_file_id * - * Purpose: The public version of H5I_get_file_id(), obtains the file + * Purpose: The public version of H5I_get_file_id(), obtains the file * ID given an object ID. User has to close this ID. * - * Return: Success: file ID - * - * Failure: a negative value + * Return: Success: The file ID associated with the object * - * Programmer: Raymond Lu - * Oct 27, 2003 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Iget_file_id(hid_t obj_id) { - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", obj_id); - if((ret_value = H5I_get_file_id(obj_id, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve file ID") + if ((ret_value = H5I_get_file_id(obj_id, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID") done: FUNC_LEAVE_API(ret_value) @@ -2154,50 +2063,48 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_get_file_id + * Function: H5I_get_file_id * - * Purpose: The private version of H5Iget_file_id(), obtains the file + * Purpose: The private version of H5Iget_file_id(), obtains the file * ID given an object ID. * - * Return: Success: file ID - * Failure: a negative value + * Return: Success: The file ID associated with the object * - * Programmer: Raymond Lu - * Oct 27, 2003 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5I_get_file_id(hid_t obj_id, hbool_t app_ref) { - H5I_type_t type; /* ID type */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5I_type_t type; /* ID type */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Get object type */ type = H5I_TYPE(obj_id); - if(type == H5I_FILE) { + if (type == H5I_FILE) { /* Increment reference count on file ID */ if(H5I_inc_ref(obj_id, app_ref) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed") + HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") /* Set return value */ ret_value = obj_id; - } /* end if */ - else if(type == H5I_DATATYPE || type == H5I_GROUP || type == H5I_DATASET || type == H5I_ATTR) { + } + else if (type == H5I_DATATYPE || type == H5I_GROUP || type == H5I_DATASET || type == H5I_ATTR) { H5G_loc_t loc; /* Location of object */ /* Get the object location information */ if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get object location") + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't get object location") /* Get the file ID for the object */ if((ret_value = H5F_get_id(loc.oloc->file, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get file ID") - } /* end if */ + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't get file ID") + } else - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid object ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "invalid object ID") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2206,34 +2113,29 @@ done: #ifdef H5I_DEBUG_OUTPUT /*------------------------------------------------------------------------- - * Function: H5I__debug_cb + * Function: H5I__debug_cb * - * Purpose: Dump the contents of an ID to stderr for debugging. + * Purpose: Dump the contents of an ID to stderr for debugging. * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Robb Matzke - * Friday, February 19, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) { - H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ - H5I_type_t type = *(H5I_type_t *)_udata; /* User data */ - H5G_name_t *path = NULL; - int ret_value = H5_ITER_CONT; /* Return value */ + H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ + H5I_type_t type = *(H5I_type_t *)_udata; /* User data */ + H5G_name_t *path = NULL; FUNC_ENTER_STATIC_NOERR - fprintf(stderr, " id = %lu\n", (unsigned long)(item->id)); - fprintf(stderr, " count = %u\n", item->count); - fprintf(stderr, " obj = 0x%08lx\n", (unsigned long)(item->obj_ptr)); + HDfprintf(stderr, " id = %lu\n", (unsigned long)(item->id)); + HDfprintf(stderr, " count = %u\n", item->count); + HDfprintf(stderr, " obj = 0x%08lx\n", (unsigned long)(item->obj_ptr)); /* Get the group location, so we get get the name */ - switch(type) { + switch (type) { case H5I_GROUP: path = H5G_nameof((H5G_t*)item->obj_ptr); break; @@ -2246,31 +2148,40 @@ H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) path = H5T_nameof((H5T_t*)item->obj_ptr); break; + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_ATTR: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: default: break; /* Other types of IDs are not stored in files */ - } /* end switch*/ + } - if(path) { - if(path->user_path_r) - fprintf(stderr, " user_path = %s\n", H5RS_get_str(path->user_path_r)); - if(path->full_path_r) - fprintf(stderr, " full_path = %s\n", H5RS_get_str(path->full_path_r)); - } /* end if */ + if (path) { + if (path->user_path_r) + HDfprintf(stderr, " user_path = %s\n", H5RS_get_str(path->user_path_r)); + if (path->full_path_r) + HDfprintf(stderr, " full_path = %s\n", H5RS_get_str(path->full_path_r)); + } FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5I__debug_cb() */ /*------------------------------------------------------------------------- - * Function: H5I__debug - * - * Purpose: Dump the contents of a type to stderr for debugging. + * Function: H5I__debug * - * Return: Success: Non-negative - * Failure: Negative + * Purpose: Dump the contents of a type to stderr for debugging. * - * Programmer: Robb Matzke - * Friday, February 19, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -2281,17 +2192,17 @@ H5I__debug(H5I_type_t type) FUNC_ENTER_STATIC_NOERR - fprintf(stderr, "Dumping ID type %d\n", (int)type); + HDfprintf(stderr, "Dumping ID type %d\n", (int)type); type_ptr = H5I_id_type_list_g[type]; /* Header */ - fprintf(stderr, " init_count = %u\n", type_ptr->init_count); - fprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved); - fprintf(stderr, " id_count = %llu\n", (unsigned long long)type_ptr->id_count); - fprintf(stderr, " nextid = %llu\n", (unsigned long long)type_ptr->nextid); + HDfprintf(stderr, " init_count = %u\n", type_ptr->init_count); + HDfprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved); + HDfprintf(stderr, " id_count = %llu\n", (unsigned long long)type_ptr->id_count); + HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_ptr->nextid); /* List */ - fprintf(stderr, " List:\n"); + HDfprintf(stderr, " List:\n"); H5SL_iterate(type_ptr->ids, H5I__debug_cb, &type); FUNC_LEAVE_NOAPI(SUCCEED) @@ -50,18 +50,6 @@ typedef struct { hid_t dxpl_id; /* DXPL to use in callback */ } H5L_trav_gi_t; -/* User data for path traversal routine for getting link info by index */ -typedef struct { - /* In */ - H5_index_t idx_type; /* Index to use */ - H5_iter_order_t order; /* Order to iterate in index */ - hsize_t n; /* Offset of link within index */ - hid_t dxpl_id; /* DXPL to use in callback */ - - /* Out */ - H5L_info_t *linfo; /* Buffer to return to user */ -} H5L_trav_gibi_t; - /* User data for path traversal callback to creating a link */ typedef struct { H5F_t *file; /* Pointer to the file */ @@ -108,47 +96,11 @@ typedef struct { void *buf; /* User buffer */ } H5L_trav_gv_t; -/* User data for path traversal routine for getting link value by index */ -typedef struct { - /* In */ - H5_index_t idx_type; /* Index to use */ - H5_iter_order_t order; /* Order to iterate in index */ - hsize_t n; /* Offset of link within index */ - hid_t dxpl_id; /* DXPL to use in callback */ - size_t size; /* Size of user buffer */ - - /* Out */ - void *buf; /* User buffer */ -} H5L_trav_gvbi_t; - /* User data for path traversal routine for removing link */ typedef struct { hid_t dxpl_id; /* DXPL to use in callback */ } H5L_trav_rm_t; -/* User data for path traversal routine for removing link by index */ -typedef struct { - /* In */ - H5_index_t idx_type; /* Index to use */ - H5_iter_order_t order; /* Order to iterate in index */ - hsize_t n; /* Offset of link within index */ - hid_t dxpl_id; /* DXPL to use in callback */ -} H5L_trav_rmbi_t; - -/* User data for path traversal routine for getting name by index */ -typedef struct { - /* In */ - H5_index_t idx_type; /* Index to use */ - H5_iter_order_t order; /* Order to iterate in index */ - hsize_t n; /* Offset of link within index */ - size_t size; /* Size of name buffer */ - hid_t dxpl_id; /* DXPL to use in callback */ - - /* Out */ - char *name; /* Buffer to return name to user */ - ssize_t name_len; /* Length of full name */ -} H5L_trav_gnbi_t; - /********************/ /* Local Prototypes */ /********************/ @@ -185,8 +137,6 @@ static herr_t H5L__exists_final_cb(H5G_loc_t *grp_loc/*in*/, const char *name, static herr_t H5L__exists_inter_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static htri_t H5L__exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, - hid_t dxpl_id); static herr_t H5L_get_info_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); @@ -866,17 +816,17 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) /* Check arguments */ if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Verify access property list and get correct dxpl */ if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Check for the existence of the link */ - if((ret_value = H5L__exists(&loc, name, lapl_id, dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") + if((ret_value = H5L_exists(&loc, name, lapl_id, dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) @@ -1181,24 +1131,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5Literate + * Function: H5Literate * - * Purpose: Iterates over links in a group, with user callback routine, + * Purpose: Iterates over links in a group, with user callback routine, * according to the order within an index. * * Same pattern of behavior as H5Giterate. * - * Return: Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. - * - * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. - * + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. * - * Programmer: Quincey Koziol - * Thursday, November 16, 2006 + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. * *------------------------------------------------------------------------- */ @@ -1206,25 +1152,25 @@ herr_t H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data) { - H5I_type_t id_type; /* Type of ID */ - H5G_link_iterate_t lnk_op; /* Link operator */ - hsize_t last_lnk; /* Index of last object looked at */ - hsize_t idx; /* Internal location to hold index */ - herr_t ret_value; /* Return value */ + H5I_type_t id_type; /* Type of ID */ + H5G_link_iterate_t lnk_op; /* Link operator */ + hsize_t last_lnk; /* Index of last object looked at */ + hsize_t idx; /* Internal location to hold index */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iIiIo*hx*x", grp_id, idx_type, order, idx_p, op, op_data); /* Check arguments */ id_type = H5I_get_type(grp_id); - if(!(H5I_GROUP == id_type || H5I_FILE == id_type)) + if (!(H5I_GROUP == id_type || H5I_FILE == id_type)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") - if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") - if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") + if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if (!op) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") /* Set up iteration beginning/end info */ idx = (idx_p == NULL ? 0 : *idx_p); @@ -1235,8 +1181,8 @@ H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, lnk_op.op_func.op_new = op; /* Iterate over the links */ - if((ret_value = H5G_iterate(grp_id, ".", idx_type, order, idx, &last_lnk, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_read_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") + if ((ret_value = H5G_iterate(grp_id, ".", idx_type, order, idx, &last_lnk, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_read_dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") /* Set the index we stopped at */ if(idx_p) @@ -2930,7 +2876,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__exists + * Function: H5L_exists * * Purpose: Returns whether a link exists in a group * @@ -2944,13 +2890,13 @@ done: * *------------------------------------------------------------------------- */ -static htri_t -H5L__exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id) +htri_t +H5L_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id) { H5L_trav_le_t udata; /* User data for traversal */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_NOAPI(FAIL) /* A path of "/" will always exist in a file */ if(0 == HDstrcmp(name, "/")) @@ -2966,7 +2912,7 @@ H5L__exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5L__exists() */ +} /* H5L_exists() */ /*------------------------------------------------------------------------- diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h index dd243a6..8a2bd34 100644 --- a/src/H5Lprivate.h +++ b/src/H5Lprivate.h @@ -48,6 +48,54 @@ /* Library Private Typedefs */ /****************************/ +/* User data for path traversal routine for getting link value by index */ +typedef struct { + /* In */ + H5_index_t idx_type; /* Index to use */ + H5_iter_order_t order; /* Order to iterate in index */ + hsize_t n; /* Offset of link within index */ + hid_t dxpl_id; /* DXPL to use in callback */ + size_t size; /* Size of user buffer */ + + /* Out */ + void *buf; /* User buffer */ +} H5L_trav_gvbi_t; + +/* User data for path traversal routine for getting link info by index */ +typedef struct { + /* In */ + H5_index_t idx_type; /* Index to use */ + H5_iter_order_t order; /* Order to iterate in index */ + hsize_t n; /* Offset of link within index */ + hid_t dxpl_id; /* DXPL to use in callback */ + + /* Out */ + H5L_info_t *linfo; /* Buffer to return to user */ +} H5L_trav_gibi_t; + +/* User data for path traversal routine for getting name by index */ +typedef struct { + /* In */ + H5_index_t idx_type; /* Index to use */ + H5_iter_order_t order; /* Order to iterate in index */ + hsize_t n; /* Offset of link within index */ + size_t size; /* Size of name buffer */ + hid_t dxpl_id; /* DXPL to use in callback */ + + /* Out */ + char *name; /* Buffer to return name to user */ + ssize_t name_len; /* Length of full name */ +} H5L_trav_gnbi_t; + +/* User data for path traversal routine for removing link by index */ +typedef struct { + /* In */ + H5_index_t idx_type; /* Index to use */ + H5_iter_order_t order; /* Order to iterate in index */ + hsize_t n; /* Offset of link within index */ + hid_t dxpl_id; /* DXPL to use in callback */ +} H5L_trav_rmbi_t; + /* Structure for external link traversal callback property */ typedef struct H5L_elink_cb_t { H5L_elink_traverse_t func; @@ -81,6 +129,7 @@ H5_DLL herr_t H5L_move(H5G_loc_t *src_loc, const char *src_name, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id); H5_DLL htri_t H5L_exists_tolerant(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id); +H5_DLL htri_t H5L_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id); H5_DLL herr_t H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info_t *linkbuf/*out*/, hid_t lapl_id, hid_t dxpl_id); H5_DLL herr_t H5L_delete(H5G_loc_t *loc, const char *name, hid_t lapl_id, @@ -3247,7 +3247,6 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) /* for self referential FSMs */ haddr_t eoa_post_fsm_fsalloc; /* eoa post file space allocation */ /* for self referential FSMs */ - H5FS_stat_t fs_stat; /* Information for hdr FSM */ H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ hbool_t reset_ring = FALSE; /* Whether we set the ring */ @@ -3310,6 +3309,9 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) reset_ring = TRUE; #ifndef NDEBUG +{ + H5FS_stat_t fs_stat; /* Information for hdr FSM */ + /* Verify that sm_hdr_fspace is floating if it exists */ if(sm_hdr_fspace) { /* Query free space manager info for this type */ @@ -3357,6 +3359,7 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled) HDassert(fs_stat.alloc_sect_size == 0); } /* end if */ } /* end if */ +} #endif /* NDEBUG */ /* Free the space in the metadata aggregator. Do this via the diff --git a/src/H5Oflush.c b/src/H5Oflush.c index 9764f56..b1592dd 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -405,7 +405,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hid_t dxpl_id, hbool_ case H5I_ERROR_STACK: case H5I_NTYPES: default: - HGOTO_ERROR(H5E_ARGS, H5E_CANTRELEASE, FAIL, "not a valid file object ID (dataset, group, or datatype)") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid file object ID (dataset, group, or datatype)") break; } /* end switch */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 9c482b0..13e0e3e 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -247,20 +247,20 @@ struct H5O_msg_class_t { }; struct H5O_mesg_t { - const H5O_msg_class_t *type; /*type of message */ - hbool_t dirty; /*raw out of date wrt native */ - uint8_t flags; /*message flags */ - H5O_msg_crt_idx_t crt_idx; /*message creation index */ - unsigned chunkno; /*chunk number for this mesg */ - void *native; /*native format message */ - uint8_t *raw; /*ptr to raw data */ - size_t raw_size; /*size with alignment */ + const H5O_msg_class_t *type; /* type of message */ + hbool_t dirty; /* raw out of date wrt native */ + uint8_t flags; /* message flags */ + H5O_msg_crt_idx_t crt_idx; /* message creation index */ + unsigned chunkno; /* chunk number for this mesg */ + void *native; /* native format message */ + uint8_t *raw; /* pointer to raw data */ + size_t raw_size; /* size with alignment */ }; /* Struct for storing information about "best" message to move to new chunk */ typedef struct H5O_msg_alloc_info_t { int msgno; /* Index in message array */ - unsigned id; /* Message type ID on disk */ + unsigned id; /* Message type ID on disk */ unsigned chunkno; /* Index in chunk array */ size_t gap_size; /* Size of any "gap" in the chunk immediately after message */ size_t null_size; /* Size of any null message in the chunk immediately after message */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 9382cd5..5cf9dce 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -26,6 +26,7 @@ /* Early typedefs to avoid circular dependencies */ typedef struct H5O_t H5O_t; +typedef struct H5O_fill_t H5O_fill_t; /* Include the public header file for this API */ #include "H5Opublic.h" /* Object header functions */ @@ -309,7 +310,7 @@ typedef struct H5O_linfo_t { * message if it's shared. */ -typedef struct H5O_fill_t { +struct H5O_fill_t { H5O_shared_t sh_loc; /* Shared message info (must be first) */ unsigned version; /* Encoding version number */ @@ -319,7 +320,7 @@ typedef struct H5O_fill_t { H5D_alloc_time_t alloc_time; /* time to allocate space */ H5D_fill_time_t fill_time; /* time to write fill value */ hbool_t fill_defined; /* whether fill value is defined */ -} H5O_fill_t; +}; /* * Link message. diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index a1d53cc..d2e1058 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -14,8 +14,6 @@ /*------------------------------------------------------------------------- * * Created: H5Pfapl.c - * February 26 1998 - * Robb Matzke <matzke@llnl.gov> * * Purpose: File access property list class routines * @@ -32,21 +30,21 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* Files */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5Iprivate.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory Management */ -#include "H5Ppkg.h" /* Property lists */ +#include "H5Ppkg.h" /* Property lists */ /* Includes needed to set as default file driver */ -#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */ -#include "H5FDstdio.h" /* Standard C buffered I/O */ +#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */ +#include "H5FDstdio.h" /* Standard C buffered I/O */ #ifdef H5_HAVE_WINDOWS -#include "H5FDwindows.h" /* Windows buffered I/O */ +#include "H5FDwindows.h" /* Win32 I/O */ #endif @@ -404,8 +402,8 @@ static const unsigned H5F_def_page_buf_min_raw_perc_g = H5F_ACS_PAGE_BUFFER_MIN_ static herr_t H5P__facc_reg_prop(H5P_genclass_t *pclass) { - const H5FD_driver_prop_t def_driver_prop = H5F_ACS_FILE_DRV_DEF; /* Default VFL driver ID & info (initialized from a variable) */ - herr_t ret_value = SUCCEED; /* Return value */ + const H5FD_driver_prop_t def_driver_prop = H5F_ACS_FILE_DRV_DEF; /* Default VFL driver ID & info (initialized from a variable) */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index a468464..374c117 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -17,6 +17,9 @@ #ifndef _H5Pprivate_H #define _H5Pprivate_H +/* Early typedefs to avoid circular dependencies */ +typedef struct H5P_genplist_t H5P_genplist_t; + /* Include package's public header */ #include "H5Ppublic.h" @@ -52,12 +55,7 @@ typedef enum H5P_coll_md_read_flag_t { H5P_USER_TRUE = 1 } H5P_coll_md_read_flag_t; -/* Forward declarations (for prototypes & type definitions) */ -struct H5O_fill_t; -struct H5T_t; - /* Forward declarations for anonymous H5P objects */ -typedef struct H5P_genplist_t H5P_genplist_t; typedef struct H5P_genclass_t H5P_genclass_t; typedef enum H5P_plist_type_t { @@ -145,6 +143,10 @@ H5_DLLVAR const struct H5P_libclass_t H5P_CLS_FACC[1]; /* File access */ /* Library Private Prototypes */ /******************************/ +/* Forward declaration of structs used below */ +struct H5O_fill_t; +struct H5T_t; + /* Package initialization routine */ H5_DLL herr_t H5P_init(void); diff --git a/src/H5Tbit.c b/src/H5Tbit.c index 12d1fd1..df6d2c3 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -11,10 +11,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Module Info: Operations on bit vectors. A bit vector is an array of bytes - * with the least-significant bits in the first byte. That is, - * the bytes are in little-endian order. +/* Module Info: Operations on bit vectors. A bit vector is an array of bytes + * with the least-significant bits in the first byte. That is, + * the bytes are in little-endian order. */ #include "H5Tmodule.h" /* This source code file is part of the H5T module */ @@ -29,14 +28,11 @@ /*------------------------------------------------------------------------- - * Function: H5T__bit_copy + * Function: H5T__bit_copy * - * Purpose: Copies bits from one vector to another. + * Purpose: Copies bits from one vector to another. * - * Return: void - * - * Programmer: Robb Matzke - * Wednesday, June 10, 1998 + * Return: void * *------------------------------------------------------------------------- */ @@ -50,8 +46,7 @@ H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, FUNC_ENTER_PACKAGE_NOERR - /* - * Normalize the offset to be a byte number and a bit offset within that + /* Normalize the offset to be a byte number and a bit offset within that * byte. */ s_idx = src_offset / 8; @@ -59,8 +54,7 @@ H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, src_offset %= 8; dst_offset %= 8; - /* - * Get things rolling. This means copying bits until we're aligned on a + /* Get things rolling. This means copying bits until we're aligned on a * source byte. This the following example, five bits are copied to the * destination. * @@ -75,30 +69,29 @@ H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, * ...+---------------+---------------+ * dst[d_idx+1] dst[d_idx] */ - while(src_offset && size > 0) { - size_t nbits = MIN3(size, 8 - dst_offset, 8 - src_offset); - size_t mask = ((size_t)1 << nbits) - 1; - - dst[d_idx] &= (uint8_t)~(mask << dst_offset); - dst[d_idx] = (uint8_t)(dst[d_idx] | (((src[s_idx] >> src_offset) & (uint8_t)mask) << dst_offset)); - - src_offset += nbits; - if(src_offset >= 8) { - s_idx++; - src_offset %= 8; - } /* end if */ - - dst_offset += nbits; - if(dst_offset >= 8) { - d_idx++; - dst_offset %= 8; - } /* end if */ - - size -= nbits; - } /* end while */ - - /* - * The middle bits. We are aligned on a source byte which needs to be + while (src_offset && size > 0) { + size_t nbits = MIN3(size, 8 - dst_offset, 8 - src_offset); + size_t mask = ((size_t)1 << nbits) - 1; + + dst[d_idx] &= (uint8_t)~(mask << dst_offset); + dst[d_idx] = (uint8_t)(dst[d_idx] | (((src[s_idx] >> src_offset) & (uint8_t)mask) << dst_offset)); + + src_offset += nbits; + if (src_offset >= 8) { + s_idx++; + src_offset %= 8; + } + + dst_offset += nbits; + if (dst_offset >= 8) { + d_idx++; + dst_offset %= 8; + } + + size -= nbits; + } + + /* The middle bits. We are aligned on a source byte which needs to be * copied to two (or one in the degenerate case) destination bytes. * * src[s_idx] @@ -122,48 +115,48 @@ H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, mask_lo = ((size_t)1 << (8 - shift)) - 1; mask_hi = (~mask_lo) & 0xff; - for(/*void*/; size > 8; size -= 8, d_idx++, s_idx++) { - if(shift) { - dst[d_idx + 0] &= (uint8_t)(~(mask_lo << shift)); - dst[d_idx + 0] |= (uint8_t)((src[s_idx] & mask_lo) << shift); - dst[d_idx + 1] &= (uint8_t)(~(mask_hi >> (8 - shift))); - dst[d_idx + 1] |= (uint8_t)((src[s_idx] & mask_hi) >> (8 - shift)); - } /* end if */ + for (/*void*/; size > 8; size -= 8, d_idx++, s_idx++) { + if (shift) { + dst[d_idx + 0] &= (uint8_t)(~(mask_lo << shift)); + dst[d_idx + 0] |= (uint8_t)((src[s_idx] & mask_lo) << shift); + dst[d_idx + 1] &= (uint8_t)(~(mask_hi >> (8 - shift))); + dst[d_idx + 1] |= (uint8_t)((src[s_idx] & mask_hi) >> (8 - shift)); + } else - dst[d_idx] = src[s_idx]; - } /* end for */ + dst[d_idx] = src[s_idx]; + } /* Finish up */ - while(size > 0) { - size_t nbits = (size_t)MIN3 (size, 8 - dst_offset, 8 - src_offset); - size_t mask = ((size_t)1 << nbits) - 1; + while (size > 0) { + size_t nbits = (size_t)MIN3 (size, 8 - dst_offset, 8 - src_offset); + size_t mask = ((size_t)1 << nbits) - 1; - dst[d_idx] &= (uint8_t)(~(mask << dst_offset)); - dst[d_idx] = (uint8_t)(dst[d_idx] | (((src[s_idx] >> src_offset) & (uint8_t)mask) << dst_offset)); + dst[d_idx] &= (uint8_t)(~(mask << dst_offset)); + dst[d_idx] = (uint8_t)(dst[d_idx] | (((src[s_idx] >> src_offset) & (uint8_t)mask) << dst_offset)); - src_offset += nbits; - if(src_offset >= 8) { - s_idx++; - src_offset %= 8; - } /* end if */ + src_offset += nbits; + if (src_offset >= 8) { + s_idx++; + src_offset %= 8; + } - dst_offset += nbits; - if(dst_offset >= 8) { - d_idx++; - dst_offset %= 8; - } /* end if */ + dst_offset += nbits; + if (dst_offset >= 8) { + d_idx++; + dst_offset %= 8; + } - size -= nbits; - } /* end while */ + size -= nbits; + } FUNC_LEAVE_NOAPI_VOID } /* end H5T__bit_copy() */ /*------------------------------------------------------------------------- - * Function: H5T__bit_shift + * Function: H5T__bit_shift * - * Purpose: Simulation of hardware shifting. Shifts a bit vector + * Purpose: Simulation of hardware shifting. Shifts a bit vector * in a way similar to shifting a variable value, like * value <<= 3, or value >>= 16. SHIFT_DIST is positive for * left shift, negative for right shift. The bit vector starts @@ -173,10 +166,7 @@ H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, * For example, if we have a bit sequence 00011100, offset=2, * size=3, shift_dist=2, the result will be 00010000. * - * Return: void - * - * Programmer: Raymond Lu - * Monday, April 12, 2004 + * Return: void * *------------------------------------------------------------------------- */ @@ -193,25 +183,25 @@ H5T__bit_shift(uint8_t *buf, ssize_t shift_dist, size_t offset, size_t size) HDassert(buf); HDassert(size); - if(shift_dist) { + if (shift_dist) { size_t abs_shift_dist = (size_t)ABS(shift_dist); - if(abs_shift_dist >= size) + if (abs_shift_dist >= size) H5T__bit_set(buf, offset, size, 0); else { size_t buf_size = (size / 8) + 1; /* Size of shift buffer needed */ uint8_t *shift_buf; /* Pointer to shift buffer */ /* Wrap the local buffer for serialized header info */ - if(NULL == (wb = H5WB_wrap(tmp_buf, sizeof(tmp_buf)))) + if (NULL == (wb = H5WB_wrap(tmp_buf, sizeof(tmp_buf)))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't wrap buffer") /* Get a pointer to a buffer that's large enough */ - if(NULL == (shift_buf = (uint8_t *)H5WB_actual(wb, buf_size))) + if (NULL == (shift_buf = (uint8_t *)H5WB_actual(wb, buf_size))) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "can't get actual buffer") /* Shift vector by making copies */ - if(shift_dist > 0) { /* left shift */ + if (shift_dist > 0) { /* left shift */ /* Copy part to be shifted to a temporary buffer */ H5T__bit_copy(shift_buf, (size_t)0, buf, offset, size - abs_shift_dist); @@ -220,18 +210,18 @@ H5T__bit_shift(uint8_t *buf, ssize_t shift_dist, size_t offset, size_t size) /* Zero-set the left part*/ H5T__bit_set(buf, offset, abs_shift_dist, 0); - } /* end if */ + } else { /* right shift */ H5T__bit_copy(shift_buf, (size_t)0, buf, offset + abs_shift_dist, size - abs_shift_dist); H5T__bit_copy(buf, offset, shift_buf, (size_t)0, size - abs_shift_dist); H5T__bit_set(buf, offset + size - abs_shift_dist, abs_shift_dist, 0); - } /* end else */ + } } /* end else */ } /* end if */ done: /* Release resources */ - if(wb && H5WB_unwrap(wb) < 0) + if (wb && H5WB_unwrap(wb) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer") FUNC_LEAVE_NOAPI(ret_value) @@ -239,27 +229,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5T__bit_get_d + * Function: H5T__bit_get_d * - * Purpose: Return a small bit sequence as a number. Bit vector starts + * Purpose: Return a small bit sequence as a number. Bit vector starts * at OFFSET and is SIZE bits long. * - * Return: Success: The bit sequence interpretted as an unsigned - * integer. - * - * Failure: 0 + * Return: Success: The bit sequence interpretted as an unsigned + * integer. * - * Programmer: Robb Matzke - * Tuesday, June 23, 1998 + * Failure: 0 * *------------------------------------------------------------------------- */ uint64_t H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size) { - uint64_t val = 0; - size_t i, hs; - uint64_t ret_value = 0; /* Return value */ + uint64_t val = 0; + size_t i, hs; + uint64_t ret_value = 0; /* Return value */ FUNC_ENTER_PACKAGE_NOERR @@ -271,11 +258,11 @@ H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size) break; case H5T_ORDER_BE: - for(i = 0, hs = sizeof(val) / 2; i < hs; i++) { + for (i = 0, hs = sizeof(val) / 2; i < hs; i++) { uint8_t tmp = ((uint8_t*)&val)[i]; ((uint8_t*)&val)[i] = ((uint8_t*)&val)[sizeof(val) - (i + 1)]; ((uint8_t*)&val)[sizeof(val) - (i + 1)] = tmp; - } /* end for */ + } break; case H5T_ORDER_ERROR: @@ -285,7 +272,7 @@ H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size) default: /* Unknown endianness. Bail out. */ HGOTO_DONE(UFAIL) - } /* end switch */ + } /* Set return value */ ret_value = val; @@ -296,14 +283,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5T__bit_set_d + * Function: H5T__bit_set_d * - * Purpose: Sets part of a bit vector to the specified unsigned value. + * Purpose: Sets part of a bit vector to the specified unsigned value. * - * Return: void - * - * Programmer: Robb Matzke - * Wednesday, June 24, 1998 + * Return: void * *------------------------------------------------------------------------- */ @@ -321,11 +305,11 @@ H5T__bit_set_d(uint8_t *buf, size_t offset, size_t size, uint64_t val) break; case H5T_ORDER_BE: - for(i = 0, hs = sizeof(val) / 2; i < hs; i++) { + for (i = 0, hs = sizeof(val) / 2; i < hs; i++) { uint8_t tmp = ((uint8_t *)&val)[i]; ((uint8_t *)&val)[i] = ((uint8_t *)&val)[sizeof(val) - (i + 1)]; ((uint8_t *)&val)[sizeof(val) - (i + 1)] = tmp; - } /* end for */ + } break; case H5T_ORDER_ERROR: @@ -334,7 +318,7 @@ H5T__bit_set_d(uint8_t *buf, size_t offset, size_t size, uint64_t val) case H5T_ORDER_MIXED: default: HDabort(); - } /* end switch */ + } H5T__bit_copy(buf, offset, (uint8_t*)&val, (size_t)0, size); @@ -343,24 +327,19 @@ H5T__bit_set_d(uint8_t *buf, size_t offset, size_t size, uint64_t val) /*------------------------------------------------------------------------- - * Function: H5T__bit_set + * Function: H5T__bit_set * - * Purpose: Sets or clears bits in a contiguous region of a vector - * beginning at bit OFFSET and continuing for SIZE bits. + * Purpose: Sets or clears bits in a contiguous region of a vector + * beginning at bit OFFSET and continuing for SIZE bits. * - * Return: void - * - * Programmer: Robb Matzke - * Wednesday, June 10, 1998 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ void H5T__bit_set(uint8_t *buf, size_t offset, size_t size, hbool_t value) { - int idx; + int idx; FUNC_ENTER_PACKAGE_NOERR @@ -369,54 +348,51 @@ H5T__bit_set(uint8_t *buf, size_t offset, size_t size, hbool_t value) offset %= 8; /* The first partial byte */ - if(size && offset % 8) { - size_t nbits = MIN(size, 8 - offset); - unsigned mask = ((unsigned)1 << nbits) - 1; + if (size && offset % 8) { + size_t nbits = MIN(size, 8 - offset); + unsigned mask = ((unsigned)1 << nbits) - 1; - if(value) - buf[idx] = (uint8_t)(buf[idx] | (mask << offset)); - else - buf[idx] &= (uint8_t)(~(mask << offset)); + if (value) + buf[idx] = (uint8_t)(buf[idx] | (mask << offset)); + else + buf[idx] &= (uint8_t)(~(mask << offset)); - idx++; - size -= nbits; - } /* end if */ + idx++; + size -= nbits; + } /* The middle bytes */ - while(size >= 8) { - buf[idx++] = value ? 0xff : 0x00; - size -= 8; - } /* end while */ + while (size >= 8) { + buf[idx++] = value ? 0xff : 0x00; + size -= 8; + } /* The last partial byte */ - if(size) { - if(value) - buf[idx] |= (uint8_t)(((unsigned)1 << size) - 1); - else - buf[idx] &= (uint8_t)(~(((unsigned)1 << size) - 1)); - } /* end if */ + if (size) { + if (value) + buf[idx] |= (uint8_t)(((unsigned)1 << size) - 1); + else + buf[idx] &= (uint8_t)(~(((unsigned)1 << size) - 1)); + } FUNC_LEAVE_NOAPI_VOID } /* end H5T__bit_set() */ /*------------------------------------------------------------------------- - * Function: H5T__bit_find + * Function: H5T__bit_find * - * Purpose: Finds the first bit with the specified VALUE within a region - * of a bit vector. The region begins at OFFSET and continues - * for SIZE bits, but the region can be searched from the least - * significat end toward the most significant end(H5T_BIT_LSB - * as DIRECTION), or from the most significant end to the least - * significant end(H5T_BIT_MSB as DIRECTION). + * Purpose: Finds the first bit with the specified VALUE within a region + * of a bit vector. The region begins at OFFSET and continues + * for SIZE bits, but the region can be searched from the least + * significat end toward the most significant end(H5T_BIT_LSB + * as DIRECTION), or from the most significant end to the least + * significant end(H5T_BIT_MSB as DIRECTION). * - * Return: Success: The position of the bit found, relative to - * the offset. + * Return: Success: The position of the bit found, relative to + * the offset. * - * Failure: -1 - * - * Programmer: Robb Matzke - * Wednesday, June 10, 1998 + * Failure: -1 * *------------------------------------------------------------------------- */ @@ -424,9 +400,9 @@ ssize_t H5T__bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, hbool_t value) { - ssize_t base = (ssize_t)offset; - ssize_t idx, i; - size_t iu; + ssize_t base = (ssize_t)offset; + ssize_t idx, i; + size_t iu; ssize_t ret_value = (-1); /* Return value */ /* Use FUNC_ENTER_PACKAGE_NOERR here to avoid performance issues */ @@ -435,16 +411,16 @@ H5T__bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, /* Some functions call this with value=TRUE */ HDassert(TRUE == 1); - switch(direction) { + switch (direction) { case H5T_BIT_LSB: /* Calculate index */ idx = (ssize_t)(offset / 8); offset %= 8; /* Beginning */ - if(offset) { - for(iu = offset; iu < 8 && size > 0; iu++, size--) - if(value == (hbool_t)((buf[idx] >> iu) & 0x01)) + if (offset) { + for (iu = offset; iu < 8 && size > 0; iu++, size--) + if (value == (hbool_t)((buf[idx] >> iu) & 0x01)) HGOTO_DONE(8 * idx + (ssize_t)iu - base); offset = 0; @@ -452,10 +428,10 @@ H5T__bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, } /* end if */ /* Middle */ - while(size >= 8) { - if((value ? 0x00 : 0xff) != buf[idx]) - for(i = 0; i < 8; i++) - if(value == (hbool_t)((buf[idx] >> i) & 0x01)) + while (size >= 8) { + if ((value ? 0x00 : 0xff) != buf[idx]) + for (i = 0; i < 8; i++) + if (value == (hbool_t)((buf[idx] >> i) & 0x01)) HGOTO_DONE(8 * idx + i - base); size -= 8; @@ -463,8 +439,8 @@ H5T__bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, } /* end while */ /* End */ - for(i = 0; i < (ssize_t)size; i++) - if(value == (hbool_t)((buf[idx] >> i) & 0x01)) + for (i = 0; i < (ssize_t)size; i++) + if (value == (hbool_t)((buf[idx] >> i) & 0x01)) HGOTO_DONE(8 * idx + i - base); break; @@ -474,19 +450,19 @@ H5T__bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, offset %= 8; /* Beginning */ - if(size > 8 - offset && (offset + size) % 8) { - for(iu = (offset + size) % 8; iu > 0; --iu, --size) - if(value == (hbool_t)((buf[idx] >> (iu - 1)) & 0x01)) + if (size > 8 - offset && (offset + size) % 8) { + for (iu = (offset + size) % 8; iu > 0; --iu, --size) + if (value == (hbool_t)((buf[idx] >> (iu - 1)) & 0x01)) HGOTO_DONE(8 * idx + (ssize_t)(iu - 1) - base); --idx; } /* end if */ /* Middle */ - while(size >= 8) { - if((value ? 0x00 : 0xff) != buf[idx]) { - for(i = 7; i >= 0; --i) - if(value == (hbool_t)((buf[idx] >> i) & 0x01)) + while (size >= 8) { + if ((value ? 0x00 : 0xff) != buf[idx]) { + for (i = 7; i >= 0; --i) + if (value == (hbool_t)((buf[idx] >> i) & 0x01)) HGOTO_DONE(8 * idx + i - base); } /* end if */ @@ -495,11 +471,11 @@ H5T__bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, } /* end while */ /* End */ - if(size > 0) { - for(iu = offset + size; iu > offset; --iu) - if(value == (hbool_t)((buf[idx] >> (iu - 1)) & 0x01)) + if (size > 0) { + for (iu = offset + size; iu > offset; --iu) + if (value == (hbool_t)((buf[idx] >> (iu - 1)) & 0x01)) HGOTO_DONE(8 * idx + (ssize_t)(iu - 1) - base); - } /* end if */ + } break; default: @@ -519,17 +495,14 @@ done: * * Return: The carry-out value. TRUE if overflows, FALSE otherwise. * - * Programmer: Robb Matzke - * Friday, June 26, 1998 - * *------------------------------------------------------------------------- */ hbool_t H5T__bit_inc(uint8_t *buf, size_t start, size_t size) { - size_t idx = start / 8; - unsigned carry = 1; - unsigned acc, mask; + size_t idx = start / 8; + unsigned carry = 1; + unsigned acc, mask; /* Use FUNC_ENTER_PACKAGE_NOERR here to avoid performance issues */ FUNC_ENTER_PACKAGE_NOERR @@ -539,7 +512,7 @@ H5T__bit_inc(uint8_t *buf, size_t start, size_t size) start %= 8; /* The first partial byte */ - if(start) { + if (start) { if(size + start < 8) mask = ((unsigned)1 << size) - 1; else @@ -552,34 +525,34 @@ H5T__bit_inc(uint8_t *buf, size_t start, size_t size) size -= MIN(size, 8 - start); start = 0; idx++; - } /* end if */ + } /* The middle */ - while(carry && size >= 8) { + while (carry && size >= 8) { acc = buf[idx]; acc++; carry = acc & 0x100; buf[idx] = acc & 0xff; idx++; size -= 8; - } /* end while */ + } /* The last bits */ - if(carry && size > 0) { + if (carry && size > 0) { mask = ((unsigned)1 << size) - 1; acc = buf[idx] & mask; acc++; carry = acc & ((unsigned)1 << size); buf[idx] &= (uint8_t)(~mask); buf[idx] |= (uint8_t)(acc & mask); - } /* end if */ + } FUNC_LEAVE_NOAPI(carry ? TRUE : FALSE) } /* end H5T__bit_inc() */ /*------------------------------------------------------------------------- - * Function: H5T__bit_dec + * Function: H5T__bit_dec * * Purpose: Decrement part of a bit field by substracting 1. The bit * field starts with bit position START and is SIZE bits long. @@ -587,18 +560,15 @@ H5T__bit_inc(uint8_t *buf, size_t start, size_t size) * Return: The "borrow-in" value. It's TRUE if underflows, FALSE * otherwise. * - * Programmer: Raymond Lu - * March 17, 2004 - * *------------------------------------------------------------------------- */ hbool_t H5T__bit_dec(uint8_t *buf, size_t start, size_t size) { - size_t idx = start / 8; + size_t idx = start / 8; size_t pos = start % 8; uint8_t tmp; - unsigned borrow = 0; + unsigned borrow = 0; /* Use FUNC_ENTER_PACKAGE_NOERR here to avoid performance issues */ FUNC_ENTER_PACKAGE_NOERR @@ -607,71 +577,72 @@ H5T__bit_dec(uint8_t *buf, size_t start, size_t size) HDassert(size); /* The first partial byte */ - if((size + start - 1) / 8 > idx) { /*bit sequence doesn't end in the same byte as starts*/ + if ((size + start - 1) / 8 > idx) { + /* The bit sequence doesn't end in the same byte as starts */ + /* Example: a sequence like 11000100 and start = 3. We substract 00001000 from * it and get 10111100. If a sequence is 00000111, we do right shift for START * bits and get 00000000. So we need to borrow from higher byte when we substract * 00001000. */ - if(!(buf[idx] >> pos)) + if (!(buf[idx] >> pos)) borrow = 1; buf[idx] = (uint8_t)(buf[idx] - (1 << pos)); idx++; size -= (8 - pos); /* The middle bytes */ - while(borrow && size >= 8) { - if(buf[idx]) + while (borrow && size >= 8) { + if (buf[idx]) borrow = 0; buf[idx]--; idx++; size -= 8; - } /* end while */ + } /* The last partial byte */ - if(borrow && size > 0) { + if (borrow && size > 0) { /* Similar to the first byte case, where sequence ends in the same byte as starts */ tmp = buf[idx]; buf[idx]--; - if((buf[idx] >> size) != tmp >> size) + if ((buf[idx] >> size) != tmp >> size) buf[idx] = (uint8_t)(buf[idx] + (1 << size)); - } /* end if */ - } /* end if */ - else { /* bit sequence ends in the same byte as starts */ + } + } + else { + /* The bit sequence ends in the same byte as starts */ + /* Example: a sequence like 11000100 and pos=3, size=3. We substract 00001000 * and get 10111100. A bit is borrowed from 6th bit(buf[idx]>>6=00000010, tmp>>6=00000011, * not equal). We need to put this bit back by increment 1000000. */ tmp = buf[idx]; buf[idx] = (uint8_t)(buf[idx] - (1 << pos)); - if((buf[idx] >> (pos + size)) != tmp >> (pos + size)) { + if ((buf[idx] >> (pos + size)) != tmp >> (pos + size)) { buf[idx] = (uint8_t)(buf[idx] + (1 << (pos + size))); borrow = 1; - } /* end if */ - } /* end else */ + } + } FUNC_LEAVE_NOAPI(borrow ? TRUE : FALSE) } /* end H5T__bit_dec() */ /*------------------------------------------------------------------------- - * Function: H5T__bit_neg - * - * Purpose: negate part of a bit sequence. The bit - * field starts with bit position START and is SIZE bits long. + * Function: H5T__bit_neg * - * Return: void + * Purpose: Negate part of a bit sequence. The bit field starts with + * bit position START and is SIZE bits long. * - * Programmer: Raymond Lu - * March 19, 2004 + * Return: void * *------------------------------------------------------------------------- */ void H5T__bit_neg(uint8_t *buf, size_t start, size_t size) { - size_t idx = start / 8; + size_t idx = start / 8; size_t pos = start % 8; uint8_t tmp[1]; @@ -695,17 +666,19 @@ H5T__bit_neg(uint8_t *buf, size_t start, size_t size) buf[idx] = (uint8_t)~(buf[idx]); idx++; size -= 8; - } /* end while */ + } /* The last partial byte */ if(size > 0) { /* Similar to the first byte case, where sequence ends in the same byte as starts */ tmp[0] = (uint8_t)~buf[idx]; H5T__bit_copy(&(buf[idx]), (size_t)0, tmp, (size_t)0, size); - } /* end if */ - } /* end if */ - else /* bit sequence ends in the same byte as starts */ + } + } + else { + /* bit sequence ends in the same byte as starts */ H5T__bit_copy(&(buf[idx]), pos, tmp, pos, size); + } FUNC_LEAVE_NOAPI_VOID } /* end H5T__bit_neg() */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 76d1b0c..02a6add 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -26,14 +26,15 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FOprivate.h" /* File objects */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5Tpkg.h" /* Datatypes */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FOprivate.h" /* File objects */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5MMprivate.h" /* Memory Management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5Tpkg.h" /* Datatypes */ /****************/ diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 84a997e..3f4b489 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -4079,13 +4079,15 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, sp = dp = (uint8_t*)buf; direction = 1; olap = nelmts; - } else if (src_p->shared->size>=dst_p->shared->size) { + } + else if (src_p->shared->size>=dst_p->shared->size) { double olap_d = HDceil((double)(dst_p->shared->size)/ (double)(src_p->shared->size-dst_p->shared->size)); olap = (size_t)olap_d; sp = dp = (uint8_t*)buf; direction = 1; - } else { + } + else { double olap_d = HDceil((double)(src_p->shared->size)/ (double)(dst_p->shared->size-src_p->shared->size)); olap = (size_t)olap_d; @@ -4127,7 +4129,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if (direction>0) { s = sp; d = elmtno<olap ? dbuf : dp; - } else { + } + else { s = sp; d = elmtno+olap >= nelmts ? dbuf : dp; } @@ -4136,7 +4139,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if (d==dbuf) { HDassert((dp>=sp && dp<sp+src_p->shared->size) || (sp>=dp && sp<dp+dst_p->shared->size)); - } else { + } + else { HDassert((dp<sp && dp+dst_p->shared->size<=sp) || (sp<dp && sp+src_p->shared->size<=dp)); } @@ -4154,7 +4158,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, s[src_p->shared->size-(i+1)] = s[i]; s[i] = tmp1; } - } else if (H5T_ORDER_VAX==src.order) { + } + else if (H5T_ORDER_VAX==src.order) { tsize = src_p->shared->size; HDassert(0 == tsize % 2); @@ -4187,7 +4192,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, H5T__bit_set (d, dst.u.f.epos, dst.u.f.esize, FALSE); H5T__bit_set (d, dst.u.f.mpos, dst.u.f.msize, FALSE); goto padding; - } else if (H5T__bit_find (s, src.u.f.epos, src.u.f.esize, + } + else if (H5T__bit_find (s, src.u.f.epos, src.u.f.esize, H5T_BIT_LSB, FALSE)<0) { /* +Inf or -Inf */ if(cb_struct.func) { /*If user's exception handler is present, use it*/ @@ -4210,16 +4216,19 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, *this case.*/ if (H5T_NORM_NONE==dst.u.f.norm) H5T__bit_set (d, dst.u.f.mpos+dst.u.f.msize-1, (size_t)1, TRUE); - } else if(except_ret == H5T_CONV_HANDLED) { + } + else if(except_ret == H5T_CONV_HANDLED) { /*No need to reverse the order of destination because user handles it*/ reverse = FALSE; goto next; - } else if(except_ret == H5T_CONV_ABORT) + } + else if(except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") goto padding; } - } else if (H5T_NORM_NONE==src.u.f.norm && H5T__bit_find (s, src.u.f.mpos, src.u.f.msize-1, + } + else if (H5T_NORM_NONE==src.u.f.norm && H5T__bit_find (s, src.u.f.mpos, src.u.f.msize-1, H5T_BIT_LSB, TRUE)<0 && H5T__bit_find (s, src.u.f.epos, src.u.f.esize, H5T_BIT_LSB, FALSE)<0) { /*This is a special case for the source of no implied mantissa bit. @@ -4246,11 +4255,13 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, *this case.*/ if (H5T_NORM_NONE==dst.u.f.norm) H5T__bit_set (d, dst.u.f.mpos+dst.u.f.msize-1, (size_t)1, TRUE); - } else if(except_ret == H5T_CONV_HANDLED) { + } + else if(except_ret == H5T_CONV_HANDLED) { /*No need to reverse the order of destination because user handles it*/ reverse = FALSE; goto next; - } else if(except_ret == H5T_CONV_ABORT) + } + else if(except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") goto padding; @@ -4259,7 +4270,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * still need to handle legacy VAX files so this code must * remain in place. */ - } else if (H5T__bit_find (s, src.u.f.epos, src.u.f.esize, + } + else if (H5T__bit_find (s, src.u.f.epos, src.u.f.esize, H5T_BIT_LSB, FALSE)<0) { /* NaN */ if(cb_struct.func) { /*If user's exception handler is present, use it*/ @@ -4275,11 +4287,13 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, H5T__bit_copy (d, dst.u.f.sign, s, src.u.f.sign, (size_t)1); H5T__bit_set (d, dst.u.f.epos, dst.u.f.esize, TRUE); H5T__bit_set(d, dst.u.f.mpos, dst.u.f.msize, TRUE); - } else if(except_ret == H5T_CONV_HANDLED) { + } + else if(except_ret == H5T_CONV_HANDLED) { /*No need to reverse the order of destination because user handles it*/ reverse = FALSE; goto next; - } else if(except_ret == H5T_CONV_ABORT) + } + else if(except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") goto padding; @@ -4292,7 +4306,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, */ expo = (int64_t)H5T__bit_get_d(s, src.u.f.epos, src.u.f.esize); - if(expo==0) + if (expo==0) denormalized=TRUE; /* @@ -4302,16 +4316,19 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, implied = 1; mpos = src.u.f.mpos; mrsh = 0; - if(0 == expo || H5T_NORM_NONE == src.u.f.norm) { - if((bitno = H5T__bit_find(s, src.u.f.mpos, src.u.f.msize, H5T_BIT_MSB, TRUE)) > 0) { + if (0 == expo || H5T_NORM_NONE == src.u.f.norm) { + if ((bitno = H5T__bit_find(s, src.u.f.mpos, src.u.f.msize, H5T_BIT_MSB, TRUE)) > 0) { msize = (size_t)bitno; - } else if (0==bitno) { + } + else if (0==bitno) { msize = 1; H5T__bit_set(s, src.u.f.mpos, (size_t)1, FALSE); } - } else if (H5T_NORM_IMPLIED==src.u.f.norm) { + } + else if (H5T_NORM_IMPLIED==src.u.f.norm) { msize = src.u.f.msize; - } else { + } + else { HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "normalization method not implemented yet") } @@ -4328,9 +4345,11 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if (0==expo || H5T_NORM_NONE==src.u.f.norm) { HDassert(bitno>=0); expo -= (int64_t)((src.u.f.ebias - 1) + (src.u.f.msize - (size_t)bitno)); - } else if (H5T_NORM_IMPLIED==src.u.f.norm) { + } + else if (H5T_NORM_IMPLIED==src.u.f.norm) { expo -= (int64_t)src.u.f.ebias; - } else { + } + else { HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "normalization method not implemented yet") } @@ -4353,7 +4372,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, expo = 0; H5T__bit_set(d, dst.u.f.mpos, dst.u.f.msize, FALSE); msize = 0; - } else if (expo<=0) { + } + else if (expo<=0) { /* * The exponent is too small to fit in the exponent field, * but by shifting the mantissa to the right we can @@ -4363,7 +4383,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, mrsh += (size_t)(1 - expo); expo = 0; denormalized=TRUE; - } else if (expo>=expo_max) { + } + else if (expo>=expo_max) { /* * The exponent is too large to fit in the available region * or it results in the maximum possible value. Use positive @@ -4383,7 +4404,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, expo = expo_max; H5T__bit_set(d, dst.u.f.mpos, dst.u.f.msize, FALSE); msize = 0; - } else if(except_ret == H5T_CONV_ABORT) + } + else if(except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") else if(except_ret == H5T_CONV_HANDLED) { reverse = FALSE; @@ -4410,7 +4432,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(carry) implied = 2; } - } else if(H5T__bit_get_d(s, (mpos + (size_t)bitno) - 1, (size_t)1) && denormalized) + } + else if(H5T__bit_get_d(s, (mpos + (size_t)bitno) - 1, (size_t)1) && denormalized) /* For either source or destination, denormalized value doesn't increment carry.*/ H5T__bit_inc(s, mpos + (size_t)bitno - 1, 1 + msize - (size_t)bitno); } @@ -4422,13 +4445,16 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, */ if (mrsh>dst.u.f.msize+1) { H5T__bit_set(d, dst.u.f.mpos, dst.u.f.msize, FALSE); - } else if (mrsh==dst.u.f.msize+1) { + } + else if (mrsh==dst.u.f.msize+1) { H5T__bit_set(d, dst.u.f.mpos+1, dst.u.f.msize-1, FALSE); H5T__bit_set(d, dst.u.f.mpos, (size_t)1, TRUE); - } else if (mrsh==dst.u.f.msize) { + } + else if (mrsh==dst.u.f.msize) { H5T__bit_set(d, dst.u.f.mpos, dst.u.f.msize, FALSE); H5T__bit_set_d(d, dst.u.f.mpos, MIN(2, dst.u.f.msize), (hsize_t)implied); - } else { + } + else { if (mrsh>0) { H5T__bit_set(d, dst.u.f.mpos+dst.u.f.msize-mrsh, mrsh, FALSE); @@ -4439,7 +4465,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, H5T__bit_copy(d, dst.u.f.mpos, s, (mpos+msize+mrsh-dst.u.f.msize), dst.u.f.msize-mrsh); - } else { + } + else { H5T__bit_copy(d, dst.u.f.mpos+dst.u.f.msize-(mrsh+msize), s, mpos, msize); H5T__bit_set(d, dst.u.f.mpos, dst.u.f.msize-(mrsh+msize), @@ -4469,7 +4496,8 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(except_ret == H5T_CONV_UNHANDLED) { expo = expo_max; H5T__bit_set(d, dst.u.f.mpos, dst.u.f.msize, FALSE); - } else if(except_ret == H5T_CONV_ABORT) + } + else if(except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") else if(except_ret == H5T_CONV_HANDLED) { reverse = FALSE; diff --git a/src/H5Tdbg.c b/src/H5Tdbg.c index f434543..eb648f3 100644 --- a/src/H5Tdbg.c +++ b/src/H5Tdbg.c @@ -32,9 +32,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Tpkg.h" /* Datatypes */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Tpkg.h" /* Datatypes */ /****************/ @@ -74,28 +74,21 @@ /*------------------------------------------------------------------------- - * Function: H5T__print_stats + * Function: H5T__print_stats * - * Purpose: Print statistics about a conversion path. Statistics are - * printed only if all the following conditions are true: + * Purpose: Print statistics about a conversion path. Statistics are + * printed only if all the following conditions are true: * - * 1. The library was compiled with H5T_DEBUG defined. - * 2. Data type debugging is turned on at run time. - * 3. The path was called at least one time. + * 1. The library was compiled with H5T_DEBUG defined. + * 2. Data type debugging is turned on at run time. + * 3. The path was called at least one time. * - * The optional NPRINT argument keeps track of the number of - * conversions paths for which statistics have been shown. If - * its value is zero then table headers are printed before the - * first line of output. + * The optional NPRINT argument keeps track of the number of + * conversions paths for which statistics have been shown. If + * its value is zero then table headers are printed before the + * first line of output. * - * Return: Success: non-negative - * - * Failure: negative - * - * Programmer: Robb Matzke - * Monday, December 14, 1998 - * - * Modifications: + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -110,34 +103,34 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED * path, int H5_ATTR_UNUSED * nprint/* FUNC_ENTER_PACKAGE_NOERR #ifdef H5T_DEBUG - if(H5DEBUG(T) && path->stats.ncalls > 0) { - if(nprint && 0 == (*nprint)++) { - HDfprintf(H5DEBUG(T), "H5T: type conversion statistics:\n"); - HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", - "Conversion", "Elmts", "Calls", "User", - "System", "Elapsed", "Bandwidth"); - HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", - "----------", "-----", "-----", "----", - "------", "-------", "---------"); - } - if(path->src && path->dst) + if (H5DEBUG(T) && path->stats.ncalls > 0) { + if (nprint && 0 == (*nprint)++) { + HDfprintf(H5DEBUG(T), "H5T: type conversion statistics:\n"); + HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", + "Conversion", "Elmts", "Calls", "User", + "System", "Elapsed", "Bandwidth"); + HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", + "----------", "-----", "-----", "----", + "------", "-------", "---------"); + } + if (path->src && path->dst) nbytes = MAX(H5T_get_size(path->src), H5T_get_size(path->dst)); - else if(path->src) + else if (path->src) nbytes = H5T_get_size(path->src); - else if(path->dst) + else if (path->dst) nbytes = H5T_get_size(path->dst); else nbytes = 0; - nbytes *= path->stats.nelmts; - H5_bandwidth(bandwidth, (double)nbytes, path->stats.timer.etime); - HDfprintf(H5DEBUG(T), " %-16s %10Hd %10d %8.2f %8.2f %8.2f %10s\n", - path->name, - path->stats.nelmts, - path->stats.ncalls, - path->stats.timer.utime, - path->stats.timer.stime, - path->stats.timer.etime, - bandwidth); + nbytes *= path->stats.nelmts; + H5_bandwidth(bandwidth, (double)nbytes, path->stats.timer.etime); + HDfprintf(H5DEBUG(T), " %-16s %10Hd %10d %8.2f %8.2f %8.2f %10s\n", + path->name, + path->stats.nelmts, + path->stats.ncalls, + path->stats.timer.utime, + path->stats.timer.stime, + path->stats.timer.etime, + bandwidth); } #endif FUNC_LEAVE_NOAPI(SUCCEED) @@ -145,24 +138,20 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED * path, int H5_ATTR_UNUSED * nprint/* /*------------------------------------------------------------------------- - * Function: H5T_debug - * - * Purpose: Prints information about a data type. + * Function: H5T_debug * - * Return: Non-negative on success/Negative on failure + * Purpose: Prints information about a data type. * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * - * Modifications: + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5T_debug(const H5T_t *dt, FILE *stream) { - const char *s1 = "", *s2 = ""; - unsigned i; + const char *s1 = ""; + const char *s2 = ""; + unsigned i; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -171,7 +160,7 @@ H5T_debug(const H5T_t *dt, FILE *stream) HDassert(dt); HDassert(stream); - switch(dt->shared->type) { + switch (dt->shared->type) { case H5T_NO_CLASS: HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "no class"); break; @@ -221,9 +210,9 @@ H5T_debug(const H5T_t *dt, FILE *stream) default: s1 = ""; break; - } /* end switch */ + } /* end switch */ - switch(dt->shared->state) { + switch (dt->shared->state) { case H5T_STATE_TRANSIENT: s2 = "[transient]"; break; @@ -245,14 +234,14 @@ H5T_debug(const H5T_t *dt, FILE *stream) break; default: HDassert(0 && "This Should never be executed!"); - } /* end switch */ + } /* end switch */ - fprintf(stream, "%s%s {nbytes=%lu", s1, s2, (unsigned long)(dt->shared->size)); + HDfprintf(stream, "%s%s {nbytes=%lu", s1, s2, (unsigned long)(dt->shared->size)); - if(H5T_IS_ATOMIC(dt->shared)) { - uint64_t tmp; + if (H5T_IS_ATOMIC(dt->shared)) { + uint64_t tmp; - switch(dt->shared->u.atomic.order) { + switch (dt->shared->u.atomic.order) { case H5T_ORDER_ERROR: HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "order error"); break; @@ -277,17 +266,16 @@ H5T_debug(const H5T_t *dt, FILE *stream) default: s1 = "order?"; break; - } /* end switch */ + } /* end switch */ + + HDfprintf(stream, ", %s", s1); - fprintf(stream, ", %s", s1); + if (dt->shared->u.atomic.offset) + HDfprintf(stream, ", offset=%lu", (unsigned long) (dt->shared->u.atomic.offset)); + if (dt->shared->u.atomic.prec != 8 * dt->shared->size) + HDfprintf(stream, ", prec=%lu", (unsigned long) (dt->shared->u.atomic.prec)); - if(dt->shared->u.atomic.offset) - fprintf(stream, ", offset=%lu", - (unsigned long) (dt->shared->u.atomic.offset)); - if(dt->shared->u.atomic.prec != 8 * dt->shared->size) - fprintf(stream, ", prec=%lu", - (unsigned long) (dt->shared->u.atomic.prec)); - switch(dt->shared->type) { + switch (dt->shared->type) { case H5T_NO_CLASS: HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "no class"); break; @@ -313,7 +301,7 @@ H5T_debug(const H5T_t *dt, FILE *stream) } /* end switch */ if(s1) - fprintf(stream, ", %s", s1); + HDfprintf(stream, ", %s", s1); break; case H5T_FLOAT: @@ -339,23 +327,24 @@ H5T_debug(const H5T_t *dt, FILE *stream) break; } /* end switch */ - fprintf(stream, ", sign=%lu+1", + HDfprintf(stream, ", sign=%lu+1", (unsigned long)(dt->shared->u.atomic.u.f.sign)); - fprintf(stream, ", mant=%lu+%lu (%s)", + HDfprintf(stream, ", mant=%lu+%lu (%s)", (unsigned long)(dt->shared->u.atomic.u.f.mpos), (unsigned long)(dt->shared->u.atomic.u.f.msize), s1); - fprintf(stream, ", exp=%lu+%lu", + HDfprintf(stream, ", exp=%lu+%lu", (unsigned long)(dt->shared->u.atomic.u.f.epos), (unsigned long)(dt->shared->u.atomic.u.f.esize)); tmp = dt->shared->u.atomic.u.f.ebias >> 32; - if(tmp) { + if (tmp) { size_t hi = (size_t)tmp; size_t lo = (size_t)(dt->shared->u.atomic.u.f.ebias & 0xffffffff); - fprintf(stream, " bias=0x%08lx%08lx", + HDfprintf(stream, " bias=0x%08lx%08lx", (unsigned long)hi, (unsigned long)lo); - } else { + } + else { size_t lo = (size_t)(dt->shared->u.atomic.u.f.ebias & 0xffffffff); - fprintf(stream, " bias=0x%08lx", (unsigned long)lo); + HDfprintf(stream, " bias=0x%08lx", (unsigned long)lo); } break; @@ -372,69 +361,73 @@ H5T_debug(const H5T_t *dt, FILE *stream) default: /* No additional info */ break; - } /* end switch */ - } else if(H5T_COMPOUND == dt->shared->type) { - /* Compound data type */ - for(i = 0; i < dt->shared->u.compnd.nmembs; i++) { - fprintf(stream, "\n\"%s\" @%lu", - dt->shared->u.compnd.memb[i].name, - (unsigned long)(dt->shared->u.compnd.memb[i].offset)); - fprintf(stream, " "); - H5T_debug(dt->shared->u.compnd.memb[i].type, stream); - } /* end for */ - fprintf(stream, "\n"); - } else if(H5T_VLEN == dt->shared->type) { - switch(dt->shared->u.vlen.loc) { + } /* end switch */ + } + else if (H5T_COMPOUND == dt->shared->type) { + /* Compound data type */ + for (i = 0; i < dt->shared->u.compnd.nmembs; i++) { + HDfprintf(stream, "\n\"%s\" @%lu", + dt->shared->u.compnd.memb[i].name, + (unsigned long)(dt->shared->u.compnd.memb[i].offset)); + HDfprintf(stream, " "); + H5T_debug(dt->shared->u.compnd.memb[i].type, stream); + } /* end for */ + HDfprintf(stream, "\n"); + } + else if (H5T_VLEN == dt->shared->type) { + switch (dt->shared->u.vlen.loc) { case H5T_LOC_BADLOC: HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "invalid datatype location"); break; case H5T_LOC_MEMORY: - fprintf(stream, ", loc=memory"); + HDfprintf(stream, ", loc=memory"); break; case H5T_LOC_DISK: - fprintf(stream, ", loc=disk"); + HDfprintf(stream, ", loc=disk"); break; case H5T_LOC_MAXLOC: default: - fprintf(stream, ", loc=UNKNOWN"); + HDfprintf(stream, ", loc=UNKNOWN"); break; } /* end switch */ - if(H5T_IS_VL_STRING(dt->shared)) + if (H5T_IS_VL_STRING(dt->shared)) /* Variable length string datatype */ - fprintf(stream, ", variable-length"); + HDfprintf(stream, ", variable-length"); else { /* Variable length sequence datatype */ - fprintf(stream, " VLEN "); + HDfprintf(stream, " VLEN "); H5T_debug(dt->shared->parent, stream); - fprintf(stream, "\n"); + HDfprintf(stream, "\n"); } /* end else */ - } else if(H5T_ENUM == dt->shared->type) { + } + else if (H5T_ENUM == dt->shared->type) { size_t base_size; - /* Enumeration data type */ - fprintf(stream, " "); - H5T_debug(dt->shared->parent, stream); - base_size = dt->shared->parent->shared->size; - for(i = 0; i < dt->shared->u.enumer.nmembs; i++) { + /* Enumeration data type */ + HDfprintf(stream, " "); + H5T_debug(dt->shared->parent, stream); + base_size = dt->shared->parent->shared->size; + for (i = 0; i < dt->shared->u.enumer.nmembs; i++) { size_t k; - fprintf(stream, "\n\"%s\" = 0x", dt->shared->u.enumer.name[i]); - for(k = 0; k < base_size; k++) - fprintf(stream, "%02lx", - (unsigned long)(dt->shared->u.enumer.value + (i * base_size) + k)); - } /* end for */ - fprintf(stream, "\n"); - } else if(H5T_OPAQUE == dt->shared->type) { - fprintf(stream, ", tag=\"%s\"", dt->shared->u.opaque.tag); - } else { - /* Unknown */ - fprintf(stream, "unknown class %d\n", (int)(dt->shared->type)); + HDfprintf(stream, "\n\"%s\" = 0x", dt->shared->u.enumer.name[i]); + for (k = 0; k < base_size; k++) + HDfprintf(stream, "%02lx", (unsigned long)(dt->shared->u.enumer.value + (i * base_size) + k)); + } /* end for */ + HDfprintf(stream, "\n"); + } + else if (H5T_OPAQUE == dt->shared->type) { + HDfprintf(stream, ", tag=\"%s\"", dt->shared->u.opaque.tag); + } + else { + /* Unknown */ + HDfprintf(stream, "unknown class %d\n", (int)(dt->shared->type)); } - fprintf(stream, "}"); + HDfprintf(stream, "}"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 42acd8d..5272361 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -27,9 +27,9 @@ typedef struct H5T_t H5T_t; #include "H5MMpublic.h" /* Memory management */ /* Private headers needed by this file */ -#include "H5private.h" /* Generic Functions */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Rprivate.h" /* References */ +#include "H5private.h" /* Generic Functions */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Rprivate.h" /* References */ /* Macro for size of temporary buffers to contain a single element */ #define H5T_ELEM_BUF_SIZE 256 diff --git a/src/H5private.h b/src/H5private.h index ca4ebcf..2f33cff 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -53,7 +53,6 @@ # include <limits.h> # include <math.h> # include <signal.h> -# include <stdarg.h> # include <stdio.h> # include <stdlib.h> # include <string.h> @@ -1688,25 +1687,25 @@ extern char *strdup(const char *s); * information about the package in H5_init_library(). */ typedef enum { - H5_PKG_A, /*Attributes */ - H5_PKG_AC, /*Meta data cache */ - H5_PKG_B, /*B-trees */ - H5_PKG_D, /*Datasets */ - H5_PKG_E, /*Error handling */ - H5_PKG_F, /*Files */ - H5_PKG_G, /*Groups */ - H5_PKG_HG, /*Global heap */ - H5_PKG_HL, /*Local heap */ - H5_PKG_I, /*Interface */ - H5_PKG_MF, /*File memory management */ - H5_PKG_MM, /*Core memory management */ - H5_PKG_O, /*Object headers */ - H5_PKG_P, /*Property lists */ - H5_PKG_S, /*Data spaces */ - H5_PKG_T, /*Data types */ - H5_PKG_V, /*Vector functions */ - H5_PKG_Z, /*Raw data filters */ - H5_NPKGS /*Must be last */ + H5_PKG_A, /* Attributes */ + H5_PKG_AC, /* Metadata cache */ + H5_PKG_B, /* B-trees */ + H5_PKG_D, /* Datasets */ + H5_PKG_E, /* Error handling */ + H5_PKG_F, /* Files */ + H5_PKG_G, /* Groups */ + H5_PKG_HG, /* Global heaps */ + H5_PKG_HL, /* Local heaps */ + H5_PKG_I, /* IDs */ + H5_PKG_MF, /* File memory management */ + H5_PKG_MM, /* Core memory management */ + H5_PKG_O, /* Object headers */ + H5_PKG_P, /* Property lists */ + H5_PKG_S, /* Dataspaces */ + H5_PKG_T, /* Datatypes */ + H5_PKG_V, /* Vector functions */ + H5_PKG_Z, /* Raw data filters */ + H5_NPKGS /* Must be last */ } H5_pkg_t; typedef struct H5_debug_open_stream_t { @@ -1735,76 +1734,90 @@ extern H5_debug_t H5_debug_g; extern char H5libhdf5_settings[]; /* embedded library information */ /*------------------------------------------------------------------------- - * Purpose: These macros are inserted automatically just after the - * FUNC_ENTER() macro of API functions and are used to trace - * application program execution. Unless H5_DEBUG_API has been - * defined they are no-ops. + * Purpose: These macros are inserted automatically just after the + * FUNC_ENTER() macro of API functions and are used to trace + * application program execution. Unless H5_DEBUG_API has been + * defined they are no-ops. * - * Arguments: R - Return type encoded as a string - * T - Argument types encoded as a string - * A0-An - Arguments. The number at the end of the macro name - * indicates the number of arguments. + * Arguments: R - Return type encoded as a string + * T - Argument types encoded as a string + * A0-An - Arguments. The number at the end of the macro name + * indicates the number of arguments. * - * Programmer: Robb Matzke - * - * Modifications: *------------------------------------------------------------------------- */ #ifdef H5_DEBUG_API -#define H5TRACE_DECL const char *RTYPE=NULL; \ - double CALLTIME; -#define H5TRACE0(R,T) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T) -#define H5TRACE1(R,T,A0) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0) -#define H5TRACE2(R,T,A0,A1) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1) -#define H5TRACE3(R,T,A0,A1,A2) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2) -#define H5TRACE4(R,T,A0,A1,A2,A3) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3) -#define H5TRACE5(R,T,A0,A1,A2,A3,A4) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ - #A4,A4) -#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ - #A4,A4,#A5,A5) -#define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ - #A4,A4,#A5,A5,#A6,A6) -#define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ - #A4,A4,#A5,A5,#A6,A6,#A7,A7) -#define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ - #A4,A4,#A5,A5,#A6,A6,#A7,A7,#A8,A8) -#define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ - #A4,A4,#A5,A5,#A6,A6,#A7,A7,#A8,A8,#A9,A9) -#define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ - #A4,A4,#A5,A5,#A6,A6,#A7,A7,#A8,A8,#A9,A9, \ - #A10,A10) -#define H5TRACE_RETURN(V) if (RTYPE) { \ - H5_trace(&CALLTIME,FUNC,RTYPE,NULL,V); \ - RTYPE=NULL; \ - } + +#define H5TRACE_DECL \ + const char *RTYPE = NULL; \ + double CALLTIME; + +#define H5TRACE0(R,T) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T) +#define H5TRACE1(R,T,A0) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0) +#define H5TRACE2(R,T,A0,A1) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1) +#define H5TRACE3(R,T,A0,A1,A2) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2) +#define H5TRACE4(R,T,A0,A1,A2,A3) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3) +#define H5TRACE5(R,T,A0,A1,A2,A3,A4) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4) +#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5) +#define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6) +#define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7) +#define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7, \ + #A8,A8) +#define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7, \ + #A8,A8,#A9,A9) +#define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7, \ + #A8,A8,#A9,A9,#A10,A10) +#define H5TRACE12(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11) \ + RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7, \ + #A8,A8,#A9,A9,#A10,A10,#A11,A11) + +#define H5TRACE_RETURN(V) \ + if (RTYPE) { \ + H5_trace(&CALLTIME, FUNC, RTYPE, NULL, V); \ + RTYPE = NULL; \ + } #else -#define H5TRACE_DECL /*void*/ -#define H5TRACE0(R,T) /*void*/ -#define H5TRACE1(R,T,A0) /*void*/ -#define H5TRACE2(R,T,A0,A1) /*void*/ -#define H5TRACE3(R,T,A0,A1,A2) /*void*/ -#define H5TRACE4(R,T,A0,A1,A2,A3) /*void*/ -#define H5TRACE5(R,T,A0,A1,A2,A3,A4) /*void*/ -#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) /*void*/ -#define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) /*void*/ -#define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) /*void*/ -#define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) /*void*/ -#define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) /*void*/ -#define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) /*void*/ -#define H5TRACE_RETURN(V) /*void*/ -#endif +#define H5TRACE_DECL /*void*/ +#define H5TRACE0(R,T) /*void*/ +#define H5TRACE1(R,T,A0) /*void*/ +#define H5TRACE2(R,T,A0,A1) /*void*/ +#define H5TRACE3(R,T,A0,A1,A2) /*void*/ +#define H5TRACE4(R,T,A0,A1,A2,A3) /*void*/ +#define H5TRACE5(R,T,A0,A1,A2,A3,A4) /*void*/ +#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) /*void*/ +#define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) /*void*/ +#define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) /*void*/ +#define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) /*void*/ +#define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) /*void*/ +#define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) /*void*/ +#define H5TRACE12(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11) /*void*/ +#define H5TRACE_RETURN(V) /*void*/ +#endif /* H5_DEBUG_API */ H5_DLL double H5_trace(const double *calltime, const char *func, const char *type, ...); diff --git a/src/H5public.h b/src/H5public.h index 40e6e6e..58d0cd1 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -39,6 +39,7 @@ #endif #ifdef H5_STDC_HEADERS # include <limits.h> /*for H5T_NATIVE_CHAR defn in H5Tpublic.h */ +# include <stdarg.h> /*for variadic functions in H5VLpublic.h */ #endif #ifndef __cplusplus # ifdef H5_HAVE_STDINT_H diff --git a/src/H5system.c b/src/H5system.c index a1cdf19..a8726c2 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -977,7 +977,7 @@ Wround(double arg) float Wroundf(float arg) { - return arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F); + return (float)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F)); } #endif /* H5_HAVE_WIN32_API */ diff --git a/src/H5trace.c b/src/H5trace.c index 56fb472..5f8ccd1 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -226,9 +226,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...) * name is the null pointer then don't print the argument or the * following `='. This is used for return values. */ - argname = va_arg(ap, char *); /*lint !e64 Type mismatch not really occuring */ + argname = va_arg(ap, char *); if(argname) { - unsigned n = (unsigned)MAX (0, (int)HDstrlen(argname) - 3); /*lint !e666 Allow expression with side effects */ + unsigned n = (unsigned)MAX (0, (int)HDstrlen(argname) - 3); if(!HDstrcmp(argname + n, "_id")) { HDstrncpy(buf, argname, (size_t)MIN((int)sizeof(buf) - 1, n)); @@ -242,7 +242,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) /* The value */ if(ptr) - vp = va_arg(ap, void *); /*lint !e64 Type mismatch not really occuring */ + vp = va_arg(ap, void *); switch(type[0]) { case 'a': if(ptr) { @@ -252,7 +252,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - haddr_t addr = va_arg(ap, haddr_t); /*lint !e732 Loss of sign not really occuring */ + haddr_t addr = va_arg(ap, haddr_t); HDfprintf(out, "%a", addr); } /* end else */ @@ -807,7 +807,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - H5E_error2_t *error = va_arg(ap, H5E_error2_t *); /*lint !e64 Type mismatch not really occuring */ + H5E_error2_t *error = va_arg(ap, H5E_error2_t *); fprintf(out, "0x%lx", (unsigned long)error); } /* end else */ @@ -1099,7 +1099,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - H5G_stat_t *statbuf = va_arg(ap, H5G_stat_t*); /*lint !e64 Type mismatch not really occuring */ + H5G_stat_t *statbuf = va_arg(ap, H5G_stat_t*); fprintf(out, "0x%lx", (unsigned long)statbuf); } @@ -1133,7 +1133,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - hsize_t hsize = va_arg(ap, hsize_t); /*lint !e732 Loss of sign not really occuring */ + hsize_t hsize = va_arg(ap, hsize_t); if(H5S_UNLIMITED == hsize) HDfprintf(out, "H5S_UNLIMITED"); @@ -1559,7 +1559,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - unsigned iu = va_arg(ap, unsigned); /*lint !e732 Loss of sign not really occuring */ + unsigned iu = va_arg(ap, unsigned); fprintf(out, "%u", iu); asize[argno] = iu; @@ -1803,7 +1803,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - hobj_ref_t ref = va_arg(ap, hobj_ref_t); /*lint !e732 Loss of sign not really occuring */ + hobj_ref_t ref = va_arg(ap, hobj_ref_t); HDfprintf(out, "Reference Object=%a", ref); } /* end else */ @@ -2001,7 +2001,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - const char *str = va_arg(ap, const char *); /*lint !e64 Type mismatch not really occuring */ + const char *str = va_arg(ap, const char *); fprintf(out, "\"%s\"", str); } /* end else */ @@ -2428,7 +2428,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - unsigned long iul = va_arg(ap, unsigned long); /*lint !e732 Loss of sign not really occuring */ + unsigned long iul = va_arg(ap, unsigned long); fprintf(out, "%lu", iul); asize[argno] = (hssize_t)iul; @@ -2452,7 +2452,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - unsigned long long iull = va_arg(ap, unsigned long long); /*lint !e732 Loss of sign not really occuring */ + unsigned long long iull = va_arg(ap, unsigned long long); fprintf(out, "%llu", iull); asize[argno] = (hssize_t)iull; @@ -2486,7 +2486,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - vp = va_arg (ap, void *); /*lint !e64 Type mismatch not really occuring */ + vp = va_arg (ap, void *); if(vp) fprintf(out, "0x%lx", (unsigned long)vp); @@ -2512,7 +2512,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - size_t size = va_arg(ap, size_t); /*lint !e732 Loss of sign not really occuring */ + size_t size = va_arg(ap, size_t); HDfprintf(out, "%Zu", size); asize[argno] = (hssize_t)size; @@ -2559,7 +2559,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - H5Z_class2_t *filter = va_arg(ap, H5Z_class2_t*); /*lint !e64 Type mismatch not really occuring */ + H5Z_class2_t *filter = va_arg(ap, H5Z_class2_t*); fprintf(out, "0x%lx", (unsigned long)filter); } /* end else */ @@ -20,35 +20,35 @@ #define _HDF5_H #include "H5public.h" -#include "H5Apublic.h" /* Attributes */ -#include "H5ACpublic.h" /* Metadata cache */ -#include "H5Dpublic.h" /* Datasets */ -#include "H5Epublic.h" /* Errors */ -#include "H5Fpublic.h" /* Files */ -#include "H5FDpublic.h" /* File drivers */ -#include "H5Gpublic.h" /* Groups */ -#include "H5Ipublic.h" /* ID management */ -#include "H5Lpublic.h" /* Links */ -#include "H5MMpublic.h" /* Memory management */ -#include "H5Opublic.h" /* Object headers */ -#include "H5Ppublic.h" /* Property lists */ -#include "H5PLpublic.h" /* Plugins */ -#include "H5Rpublic.h" /* References */ -#include "H5Spublic.h" /* Dataspaces */ -#include "H5Tpublic.h" /* Datatypes */ -#include "H5Zpublic.h" /* Data filters */ +#include "H5Apublic.h" /* Attributes */ +#include "H5ACpublic.h" /* Metadata cache */ +#include "H5Dpublic.h" /* Datasets */ +#include "H5Epublic.h" /* Errors */ +#include "H5Fpublic.h" /* Files */ +#include "H5FDpublic.h" /* File drivers */ +#include "H5Gpublic.h" /* Groups */ +#include "H5Ipublic.h" /* ID management */ +#include "H5Lpublic.h" /* Links */ +#include "H5MMpublic.h" /* Memory management */ +#include "H5Opublic.h" /* Object headers */ +#include "H5Ppublic.h" /* Property lists */ +#include "H5PLpublic.h" /* Plugins */ +#include "H5Rpublic.h" /* References */ +#include "H5Spublic.h" /* Dataspaces */ +#include "H5Tpublic.h" /* Datatypes */ +#include "H5Zpublic.h" /* Data filters */ /* Predefined file drivers */ -#include "H5FDcore.h" /* Files stored entirely in memory */ -#include "H5FDdirect.h" /* Linux direct I/O */ -#include "H5FDfamily.h" /* File families */ -#include "H5FDlog.h" /* sec2 driver with I/O logging (for debugging) */ -#include "H5FDmpi.h" /* MPI-based file drivers */ -#include "H5FDmulti.h" /* Usage-partitioned file family */ -#include "H5FDsec2.h" /* POSIX unbuffered file I/O */ -#include "H5FDstdio.h" /* Standard C buffered I/O */ +#include "H5FDcore.h" /* Files stored entirely in memory */ +#include "H5FDdirect.h" /* Linux direct I/O */ +#include "H5FDfamily.h" /* File families */ +#include "H5FDlog.h" /* sec2 driver with I/O logging (for debugging) */ +#include "H5FDmpi.h" /* MPI-based file drivers */ +#include "H5FDmulti.h" /* Usage-partitioned file family */ +#include "H5FDsec2.h" /* POSIX unbuffered file I/O */ +#include "H5FDstdio.h" /* Standard C buffered I/O */ #ifdef H5_HAVE_WINDOWS -#include "H5FDwindows.h" /* Windows buffered I/O */ +#include "H5FDwindows.h" /* Win32 I/O */ #endif #endif diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 99ab49c..9c79968 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -3631,11 +3631,14 @@ error: static unsigned check_invalid_tag_application(void) { +#if H5C_DO_TAGGING_SANITY_CHECKS /* Variables */ H5F_t * f = NULL; - hid_t fid, dxpl_id = -1; + hid_t fid = -1; + hid_t dxpl_id = -1; haddr_t addr; H5HL_t * lheap = NULL; +#endif /* H5C_DO_TAGGING_SANITY_CHECKS */ /* Testing Macro */ TESTING("failure on invalid tag application"); @@ -3683,8 +3686,8 @@ check_invalid_tag_application(void) PASSED(); #else SKIPPED(); - printf(" test skipped because sanity checking on tag value is disabled.\n"); -#endif + HDprintf(" test skipped because sanity checking on tag value is disabled.\n"); +#endif /* H5C_DO_TAGGING_SANITY_CHECKS */ return 0; @@ -3791,10 +3794,10 @@ main(void) HDremove(FILENAME2); /* Return Errors */ - return(nerrs > 0); + return nerrs > 0; error: /* Return with Error */ - return(1); + return 1; } /* main */ diff --git a/test/h5test.c b/test/h5test.c index af45589..bbdd58b 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -104,68 +104,6 @@ static herr_t h5_errors(hid_t estack, void *client_data); static char * h5_fixname_real(const char *base_name, hid_t fapl, const char *suffix, char *fullname, size_t size, hbool_t nest_printf); - - -/* A non-usable VFD class and its functions. - * - * Usable for testing things like ID handling where we shouldn't mess with the real VFDs. - */ -static H5FD_t *dummy_vfd_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static H5FD_t *dummy_vfd_open(const char H5_ATTR_UNUSED *name, unsigned H5_ATTR_UNUSED flags, hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED maxaddr) { return NULL; } - -static herr_t dummy_vfd_close(H5FD_t *_file); -static herr_t dummy_vfd_close(H5FD_t H5_ATTR_UNUSED *_file) { return FAIL; } - -static haddr_t dummy_vfd_get_eoa(const H5FD_t *file, H5FD_mem_t type); -static haddr_t dummy_vfd_get_eoa(const H5FD_t H5_ATTR_UNUSED *file, H5FD_mem_t H5_ATTR_UNUSED type) { return HADDR_UNDEF; } - -static herr_t dummy_vfd_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); -static herr_t dummy_vfd_set_eoa(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t H5_ATTR_UNUSED addr) { return FAIL; } - -static haddr_t dummy_vfd_get_eof(const H5FD_t *file, H5FD_mem_t type); -static haddr_t dummy_vfd_get_eof(const H5FD_t H5_ATTR_UNUSED *file, H5FD_mem_t H5_ATTR_UNUSED type) { return HADDR_UNDEF; } - -static herr_t dummy_vfd_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); -static herr_t dummy_vfd_read(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, void H5_ATTR_UNUSED *buf) { return FAIL; } - -static herr_t dummy_vfd_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t dummy_vfd_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, const void H5_ATTR_UNUSED *buf) { return FAIL; } - -static H5FD_class_t dummy_vfd_class_g = { - "fake", /* name */ - 1, /* maxaddr */ - H5F_CLOSE_WEAK, /* fc_degree */ - NULL, /* terminate */ - NULL, /* sb_size */ - NULL, /* sb_encode */ - NULL, /* sb_decode */ - 0, /* fapl_size */ - NULL, /* fapl_get */ - NULL, /* fapl_copy */ - NULL, /* fapl_free */ - 0, /* dxpl_size */ - NULL, /* dxpl_copy */ - NULL, /* dxpl_free */ - dummy_vfd_open, /* open */ - dummy_vfd_close, /* close */ - NULL, /* cmp */ - NULL, /* query */ - NULL, /* get_type_map */ - NULL, /* alloc */ - NULL, /* free */ - dummy_vfd_get_eoa, /* get_eoa */ - dummy_vfd_set_eoa, /* set_eoa */ - dummy_vfd_get_eof, /* get_eof */ - NULL, /* get_handle */ - dummy_vfd_read, /* read */ - dummy_vfd_write, /* write */ - NULL, /* flush */ - NULL, /* truncate */ - NULL, /* lock */ - NULL, /* unlock */ - H5FD_FLMAP_DEFAULT /* fl_map */ -}; - /*------------------------------------------------------------------------- * Function: h5_errors @@ -1890,6 +1828,33 @@ error: return FAIL; } /* h5_wait_message() */ +/* Functions for the dummy VFD class (see below). + * + * Useful for testing things like ID handling where we shouldn't mess with the + * real VFDs. + */ +static H5FD_t *dummy_vfd_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); +static H5FD_t *dummy_vfd_open(const char H5_ATTR_UNUSED *name, unsigned H5_ATTR_UNUSED flags, hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED maxaddr) { return NULL; } + +static herr_t dummy_vfd_close(H5FD_t *_file); +static herr_t dummy_vfd_close(H5FD_t H5_ATTR_UNUSED *_file) { return FAIL; } + +static haddr_t dummy_vfd_get_eoa(const H5FD_t *file, H5FD_mem_t type); +static haddr_t dummy_vfd_get_eoa(const H5FD_t H5_ATTR_UNUSED *file, H5FD_mem_t H5_ATTR_UNUSED type) { return HADDR_UNDEF; } + +static herr_t dummy_vfd_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static herr_t dummy_vfd_set_eoa(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t H5_ATTR_UNUSED addr) { return FAIL; } + +static haddr_t dummy_vfd_get_eof(const H5FD_t *file, H5FD_mem_t type); +static haddr_t dummy_vfd_get_eof(const H5FD_t H5_ATTR_UNUSED *file, H5FD_mem_t H5_ATTR_UNUSED type) { return HADDR_UNDEF; } + +static herr_t dummy_vfd_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); +static herr_t dummy_vfd_read(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, void H5_ATTR_UNUSED *buf) { return FAIL; } + +static herr_t dummy_vfd_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); +static herr_t dummy_vfd_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, const void H5_ATTR_UNUSED *buf) { return FAIL; } + + /*------------------------------------------------------------------------- * Function: h5_get_dummy_vfd_class() * @@ -1913,12 +1878,24 @@ error: H5FD_class_t * h5_get_dummy_vfd_class(void) { - H5FD_class_t *vfd_class = NULL; + H5FD_class_t *vfd_class = NULL; /* Dummy VFD that will be returned */ - if(NULL == (vfd_class = (H5FD_class_t *)HDmalloc(sizeof(H5FD_class_t)))) + /* Create the class and initialize everything to zero/NULL */ + if(NULL == (vfd_class = (H5FD_class_t *)HDcalloc((size_t)1, sizeof(H5FD_class_t)))) TEST_ERROR; - HDmemcpy(vfd_class, &dummy_vfd_class_g, sizeof(H5FD_class_t)); + /* Fill in the minimum parameters to make a VFD that + * can be registered. + */ + vfd_class->name = "dummy"; + vfd_class->maxaddr = 1; + vfd_class->open = dummy_vfd_open; + vfd_class->close = dummy_vfd_close; + vfd_class->get_eoa = dummy_vfd_get_eoa; + vfd_class->set_eoa = dummy_vfd_set_eoa; + vfd_class->get_eof = dummy_vfd_get_eof; + vfd_class->read = dummy_vfd_read; + vfd_class->write = dummy_vfd_write; return vfd_class; diff --git a/test/tarray.c b/test/tarray.c index a35b8a3..b2e0ee7 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -679,7 +679,7 @@ test_array_compound_atomic(void) /* Check the 1st field's name */ mname = H5Tget_member_name(tid2, 0); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(HDstrcmp(mname, "i") != 0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname); H5free_memory(mname); @@ -698,7 +698,7 @@ test_array_compound_atomic(void) /* Check the 2nd field's name */ mname = H5Tget_member_name(tid2, 1); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(HDstrcmp(mname, "f") != 0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname); H5free_memory(mname); @@ -897,7 +897,7 @@ test_array_compound_array(void) /* Check the 1st field's name */ mname=H5Tget_member_name(tid2,0); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(HDstrcmp(mname,"i")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); H5free_memory(mname); @@ -916,7 +916,7 @@ test_array_compound_array(void) /* Check the 2nd field's name */ mname=H5Tget_member_name(tid2,1); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(HDstrcmp(mname,"f")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); H5free_memory(mname); @@ -1604,7 +1604,7 @@ test_array_bkg(void) /* Initialize the data */ /* ------------------- */ dtsinfo = (CmpDTSinfo *)HDmalloc(sizeof(CmpDTSinfo)); - CHECK(dtsinfo, NULL, "HDmalloc"); + CHECK_PTR(dtsinfo, "HDmalloc"); HDmemset(dtsinfo, 0, sizeof(CmpDTSinfo)); for (i = 0; i < LENGTH; i++) { for (j = 0; j < ALEN; j++) { @@ -1927,7 +1927,7 @@ test_compat(void) /* Check the 1st field's name */ mname=H5Tget_member_name(tid1,0); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(HDstrcmp(mname,"i")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); H5free_memory(mname); @@ -1946,7 +1946,7 @@ test_compat(void) /* Check the 2nd field's name */ mname=H5Tget_member_name(tid1,1); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(HDstrcmp(mname,"f")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); H5free_memory(mname); @@ -1965,7 +1965,7 @@ test_compat(void) /* Check the 3rd field's name */ mname=H5Tget_member_name(tid1,2); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(HDstrcmp(mname,"l")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); H5free_memory(mname); @@ -2009,7 +2009,7 @@ test_compat(void) /* Check the 1st field's name */ mname=H5Tget_member_name(tid1,0); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(mname && HDstrcmp(mname,"i")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); if(mname) H5free_memory(mname); @@ -2028,7 +2028,7 @@ test_compat(void) /* Check the 2nd field's name */ mname=H5Tget_member_name(tid1,1); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(mname && HDstrcmp(mname,"f")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); if(mname) H5free_memory(mname); @@ -2073,7 +2073,7 @@ test_compat(void) /* Check the 3rd field's name */ mname=H5Tget_member_name(tid1,2); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(mname && HDstrcmp(mname,"l")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); if(mname) H5free_memory(mname); @@ -2118,7 +2118,7 @@ test_compat(void) /* Check the 4th field's name */ mname=H5Tget_member_name(tid1,3); - CHECK(mname, NULL, "H5Tget_member_name"); + CHECK_PTR(mname, "H5Tget_member_name"); if(mname && HDstrcmp(mname,"d")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); if(mname) H5free_memory(mname); diff --git a/test/tattr.c b/test/tattr.c index 3786d0d..2d333e9 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -277,7 +277,7 @@ test_attr_basic_write(hid_t fapl) if(attr_name_size > 0) { attr_name = (char*)HDcalloc((size_t)(attr_name_size + 1), sizeof(char)); - CHECK(attr_name, NULL, "HDcalloc"); + CHECK_PTR(attr_name, "HDcalloc"); if(attr_name) { ret = (herr_t)H5Aget_name(attr, (size_t)(attr_name_size + 1), attr_name); @@ -313,7 +313,7 @@ test_attr_basic_write(hid_t fapl) if(attr_name_size > 0) { attr_name = (char*)HDcalloc((size_t)(attr_name_size+1), sizeof(char)); - CHECK(attr_name, NULL, "HDcalloc"); + CHECK_PTR(attr_name, "HDcalloc"); if(attr_name) { ret = (herr_t)H5Aget_name(attr2, (size_t)(attr_name_size + 1), attr_name); @@ -6862,7 +6862,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Allocate the "visited link" array */ iter_info.max_visit = max_compact * 2; visited = (hbool_t*)HDmalloc(sizeof(hbool_t) * iter_info.max_visit); - CHECK(visited, NULL, "HDmalloc"); + CHECK_PTR(visited, "HDmalloc"); iter_info.visited = visited; /* Loop over operating on different indices on link fields */ @@ -8040,7 +8040,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) /* Allocate & initialize "big" attribute data */ big_value = (unsigned *)HDmalloc((size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3) * sizeof(unsigned)); - CHECK(big_value, NULL, "HDmalloc"); + CHECK_PTR(big_value, "HDmalloc"); HDmemset(big_value, 1, sizeof(unsigned) * (size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3)); /* Create dataspace for dataset */ @@ -8371,7 +8371,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Allocate & initialize "big" attribute data */ big_value = (unsigned *)HDmalloc((size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3) * sizeof(unsigned)); - CHECK(big_value, NULL, "HDmalloc"); + CHECK_PTR(big_value, "HDmalloc"); HDmemset(big_value, 1, sizeof(unsigned) * (size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3)); /* Create dataspace for dataset */ @@ -8817,7 +8817,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Allocate & initialize "big" attribute data */ big_value = (unsigned *)HDmalloc((size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3) * sizeof(unsigned)); - CHECK(big_value, NULL, "HDmalloc"); + CHECK_PTR(big_value, "HDmalloc"); HDmemset(big_value, 1, sizeof(unsigned) * (size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3)); /* Create dataspace for dataset */ @@ -9186,7 +9186,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Allocate & initialize "big" attribute data */ big_value = (unsigned *)HDmalloc((size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3) * sizeof(unsigned)); - CHECK(big_value, NULL, "HDmalloc"); + CHECK_PTR(big_value, "HDmalloc"); HDmemset(big_value, 1, sizeof(unsigned) * (size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3)); /* Create dataspace for dataset */ diff --git a/test/tchecksum.c b/test/tchecksum.c index febaacc..ffbab45 100644 --- a/test/tchecksum.c +++ b/test/tchecksum.c @@ -187,7 +187,7 @@ test_chksum_large(void) /* Allocate the buffer */ large_buf = (uint8_t *)HDmalloc((size_t)BUF_LEN); - CHECK(large_buf, NULL, "HDmalloc"); + CHECK_PTR(large_buf, "HDmalloc"); /* Initialize buffer w/known data */ for(u = 0; u < BUF_LEN; u++) diff --git a/test/testhdf5.h b/test/testhdf5.h index 2cbe6c6..127c687 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -30,130 +30,147 @@ /* Use %ld to print the value because long should cover most cases. */ /* Used to make certain a return value _is_not_ a value */ -#define CHECK(ret, val, where) do { \ - if (VERBOSE_HI) print_func(" Call to routine: %15s at line %4d " \ - "in %s returned %ld \n", \ - where, (int)__LINE__, __FILE__, \ - (long)(ret)); \ - if ((ret) == (val)) { \ - TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ - "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \ - H5Eprint2(H5E_DEFAULT, stdout); \ - } \ +#define CHECK(ret, val, where) do { \ + if (VERBOSE_HI) { \ + print_func(" Call to routine: %15s at line %4d " \ + "in %s returned %ld \n", \ + where, (int)__LINE__, __FILE__, \ + (long)(ret)); \ + } \ + if ((ret) == (val)) { \ + TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ + "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \ + H5Eprint2(H5E_DEFAULT, stdout); \ + } \ } while(0) -#define CHECK_I(ret,where) { \ - if (VERBOSE_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s returned %ld\n", \ - (where), (int)__LINE__, __FILE__, (long)(ret)); \ - } \ - if ((ret)<0) { \ - TestErrPrintf ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \ - (where), (long)(ret), (int)__LINE__, __FILE__); \ - H5Eprint2(H5E_DEFAULT, stdout); \ - } \ +#define CHECK_I(ret,where) { \ + if (VERBOSE_HI) { \ + print_func(" Call to routine: %15s at line %4d in %s returned %ld\n", \ + (where), (int)__LINE__, __FILE__, (long)(ret)); \ + } \ + if ((ret)<0) { \ + TestErrPrintf ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \ + (where), (long)(ret), (int)__LINE__, __FILE__); \ + H5Eprint2(H5E_DEFAULT, stdout); \ + } \ } -#define CHECK_PTR(ret,where) { \ - if (VERBOSE_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \ - (where), (int)__LINE__, __FILE__, (ret)); \ - } \ - if (!(ret)) { \ - TestErrPrintf ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \ - (where), (int)__LINE__, __FILE__); \ - H5Eprint2(H5E_DEFAULT, stdout); \ - } \ +/* Check that a pointer is valid (i.e.: not NULL) */ +#define CHECK_PTR(ret,where) { \ + if (VERBOSE_HI) { \ + print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \ + (where), (int)__LINE__, __FILE__, (ret)); \ + } \ + if (!(ret)) { \ + TestErrPrintf ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \ + (where), (int)__LINE__, __FILE__); \ + H5Eprint2(H5E_DEFAULT, stdout); \ + } \ } -#define CHECK_PTR_NULL(ret,where) { \ - if (VERBOSE_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \ - (where), (int)__LINE__, __FILE__, (ret)); \ - } \ - if (ret) { \ - TestErrPrintf ("*** UNEXPECTED RETURN from %s is not NULL line %4d in %s\n", \ - (where), (int)__LINE__, __FILE__); \ - H5Eprint2(H5E_DEFAULT, stdout); \ - } \ +/* Check that a pointer is NULL */ +#define CHECK_PTR_NULL(ret,where) { \ + if (VERBOSE_HI) { \ + print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \ + (where), (int)__LINE__, __FILE__, (ret)); \ + } \ + if (ret) { \ + TestErrPrintf ("*** UNEXPECTED RETURN from %s is not NULL line %4d in %s\n", \ + (where), (int)__LINE__, __FILE__); \ + H5Eprint2(H5E_DEFAULT, stdout); \ + } \ +} + +/* Check that two pointers are equal */ +#define CHECK_PTR_EQ(ret, val, where) { \ + if (VERBOSE_HI) { \ + print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \ + (where), (int)__LINE__, __FILE__, (const void *)(ret)); \ + } \ + if (ret != val) { \ + TestErrPrintf ("*** UNEXPECTED RETURN from %s: returned value of %p is not equal to %p line %4d in %s\n", \ + (where), (const void *)(ret), (const void *)(val), (int)__LINE__, __FILE__); \ + H5Eprint2(H5E_DEFAULT, stdout); \ + } \ } /* Used to make certain a return value _is_ a value */ -#define VERIFY(_x, _val, where) do { \ - long __x = (long)_x, __val = (long)_val; \ - if(VERBOSE_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s had value " \ - "%ld \n", (where), (int)__LINE__, __FILE__, __x); \ - } \ - if((__x) != (__val)) { \ - TestErrPrintf("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \ - "in %s\n", (where), __val, __x, (int)__LINE__, __FILE__); \ - H5Eprint2(H5E_DEFAULT, stdout); \ - } \ +#define VERIFY(_x, _val, where) do { \ + long __x = (long)_x, __val = (long)_val; \ + if(VERBOSE_HI) { \ + print_func(" Call to routine: %15s at line %4d in %s had value " \ + "%ld \n", (where), (int)__LINE__, __FILE__, __x); \ + } \ + if((__x) != (__val)) { \ + TestErrPrintf("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \ + "in %s\n", (where), __val, __x, (int)__LINE__, __FILE__); \ + H5Eprint2(H5E_DEFAULT, stdout); \ + } \ } while(0) /* Used to make certain a (non-'long' type's) return value _is_ a value */ -#define VERIFY_TYPE(_x, _val, _type, _format, where) do { \ - _type __x = (_type)_x, __val = (_type)_val; \ - if(VERBOSE_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s had value " \ - _format " \n", (where), (int)__LINE__, __FILE__, __x); \ - } \ - if((__x) != (__val)) { \ - TestErrPrintf("*** UNEXPECTED VALUE from %s should be " _format ", but is " _format " at line %4d " \ - "in %s\n", (where), __val, __x, (int)__LINE__, __FILE__); \ - H5Eprint2(H5E_DEFAULT, stdout); \ - } \ +#define VERIFY_TYPE(_x, _val, _type, _format, where) do { \ + _type __x = (_type)_x, __val = (_type)_val; \ + if(VERBOSE_HI) { \ + print_func(" Call to routine: %15s at line %4d in %s had value " \ + _format " \n", (where), (int)__LINE__, __FILE__, __x); \ + } \ + if((__x) != (__val)) { \ + TestErrPrintf("*** UNEXPECTED VALUE from %s should be " _format ", but is " _format " at line %4d " \ + "in %s\n", (where), __val, __x, (int)__LINE__, __FILE__); \ + H5Eprint2(H5E_DEFAULT, stdout); \ + } \ } while(0) /* Used to make certain a string return value _is_ a value */ -#define VERIFY_STR(x, val, where) do { \ - if (VERBOSE_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s had value " \ - "%s \n", (where), (int)__LINE__, __FILE__, x); \ - } \ - if (HDstrcmp(x, val)) { \ - TestErrPrintf("*** UNEXPECTED VALUE from %s should be %s, but is %s at line %4d " \ - "in %s\n", where, val, x, (int)__LINE__, __FILE__); \ - H5Eprint2(H5E_DEFAULT, stdout); \ - } \ +#define VERIFY_STR(x, val, where) do { \ + if (VERBOSE_HI) { \ + print_func(" Call to routine: %15s at line %4d in %s had value " \ + "%s \n", (where), (int)__LINE__, __FILE__, x); \ + } \ + if (HDstrcmp(x, val)) { \ + TestErrPrintf("*** UNEXPECTED VALUE from %s should be %s, but is %s at line %4d " \ + "in %s\n", where, val, x, (int)__LINE__, __FILE__); \ + H5Eprint2(H5E_DEFAULT, stdout); \ + } \ } while(0) /* Used to document process through a test and to check for errors */ -#define RESULT(ret,func) do { \ - if (VERBOSE_MED) { \ - print_func(" Call to routine: %15s at line %4d in %s returned " \ - "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \ - } \ - if (VERBOSE_HI) \ - H5Eprint2(H5E_DEFAULT, stdout); \ - if ((ret) == FAIL) { \ - TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ - "in %s\n", func, (long)(ret), (int)__LINE__, __FILE__); \ - H5Eprint2(H5E_DEFAULT, stdout); \ - } \ +#define RESULT(ret,func) do { \ + if (VERBOSE_MED) { \ + print_func(" Call to routine: %15s at line %4d in %s returned " \ + "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \ + } \ + if (VERBOSE_HI) \ + H5Eprint2(H5E_DEFAULT, stdout); \ + if ((ret) == FAIL) { \ + TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ + "in %s\n", func, (long)(ret), (int)__LINE__, __FILE__); \ + H5Eprint2(H5E_DEFAULT, stdout); \ + } \ } while(0) /* Used to document process through a test */ #if defined(H5_HAVE_PARALLEL) && defined(H5_PARALLEL_TEST) -#define MESSAGE(V,A) { \ - int mpi_rank; \ - \ - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); \ - if(mpi_rank == 0 && HDGetTestVerbosity() > (V)) \ - print_func A ; \ +#define MESSAGE(V,A) { \ + int mpi_rank; \ + \ + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); \ + if(mpi_rank == 0 && HDGetTestVerbosity() > (V)) \ + print_func A ; \ } #else /* H5_HAVE_PARALLEL */ #define MESSAGE(V,A) {if (HDGetTestVerbosity() > (V)) print_func A;} #endif /* H5_HAVE_PARALLEL */ /* Used to indicate an error that is complex to check for */ -#define ERROR(where) do { \ - if(VERBOSE_HI) \ - print_func(" Call to routine: %15s at line %4d in %s returned " \ - "invalid result\n", where, (int)__LINE__, __FILE__); \ - TestErrPrintf("*** UNEXPECTED RESULT from %s at line %4d in %s\n", \ - where, (int)__LINE__, __FILE__); \ +#define ERROR(where) do { \ + if(VERBOSE_HI) \ + print_func(" Call to routine: %15s at line %4d in %s returned " \ + "invalid result\n", where, (int)__LINE__, __FILE__); \ + TestErrPrintf("*** UNEXPECTED RESULT from %s at line %4d in %s\n", \ + where, (int)__LINE__, __FILE__); \ } while(0) /* definitions for command strings */ diff --git a/test/tfile.c b/test/tfile.c index 41c920f..653fd12 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1196,7 +1196,7 @@ test_get_obj_ids(void) VERIFY(oid_count, (NGROUPS + NDSETS + 1), "H5Fget_obj_count"); oid_list = (hid_t *)HDcalloc((size_t)oid_list_size, sizeof(hid_t)); - CHECK(oid_list, NULL, "HDcalloc"); + CHECK_PTR(oid_list, "HDcalloc"); /* Call the public function H5F_get_obj_ids to use H5F_get_objects. User reported having problem here. * that the returned size (ret_count) from H5Fget_obj_ids is one greater than the size passed in @@ -1259,7 +1259,7 @@ test_get_obj_ids(void) VERIFY(oid_count, NDSETS, "H5Fget_obj_count"); oid_list = (hid_t *)HDcalloc((size_t)oid_count, sizeof(hid_t)); - CHECK(oid_list, NULL, "HDcalloc"); + CHECK_PTR(oid_list, "HDcalloc"); /* Get the list of all opened objects */ ret_count = H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)oid_count, oid_list); @@ -2791,7 +2791,7 @@ cal_chksum(const char *file, uint32_t *chksum) /* Allocate space for the file data */ file_data = HDmalloc((size_t)sb.st_size); - CHECK(file_data, NULL, "HDmalloc"); + CHECK_PTR(file_data, "HDmalloc"); if(file_data) { /* Read file's data into memory */ diff --git a/test/th5o.c b/test/th5o.c index 4baac20..144ea4c 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -783,9 +783,9 @@ test_h5o_link(void) /* Allocate memory buffers */ /* (These are treated as 2-D buffers) */ wdata = (int *)HDmalloc((size_t)(TEST6_DIM1 * TEST6_DIM2) * sizeof(int)); - CHECK(wdata, NULL, "HDmalloc"); + CHECK_PTR(wdata, "HDmalloc"); rdata = (int *)HDmalloc((size_t)(TEST6_DIM1 * TEST6_DIM2) * sizeof(int)); - CHECK(rdata, NULL, "HDmalloc"); + CHECK_PTR(rdata, "HDmalloc"); /* Initialize the raw data */ for(i = n = 0; i < (TEST6_DIM1 * TEST6_DIM2); i++) diff --git a/test/theap.c b/test/theap.c index 3c23025..7b2fadb 100644 --- a/test/theap.c +++ b/test/theap.c @@ -88,11 +88,11 @@ test_heap_init(void) /* Allocate arrays */ rand_num = (test_obj *)HDmalloc(sizeof(test_obj) * NUM_ELEMS); - CHECK(rand_num, NULL, "HDmalloc"); + CHECK_PTR(rand_num, "HDmalloc"); inc_sort_num = (test_obj *)HDmalloc(sizeof(test_obj) * NUM_ELEMS); - CHECK(inc_sort_num, NULL, "HDmalloc"); + CHECK_PTR(inc_sort_num, "HDmalloc"); dec_sort_num = (test_obj *)HDmalloc(sizeof(test_obj) * NUM_ELEMS); - CHECK(dec_sort_num, NULL, "HDmalloc"); + CHECK_PTR(dec_sort_num, "HDmalloc"); /* Create randomized set of numbers */ curr_time = HDtime(NULL); @@ -127,7 +127,7 @@ test_heap_create(void) /* Try creating a maximum Heap */ heap=H5HP_create(H5HP_MAX_HEAP); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Try closing the heap */ ret=H5HP_close(heap); @@ -135,7 +135,7 @@ test_heap_create(void) /* Try creating a minimum Heap */ heap=H5HP_create(H5HP_MIN_HEAP); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Try closing the heap */ ret=H5HP_close(heap); @@ -163,7 +163,7 @@ test_heap_insert_min(void) /* Create a Heap */ heap=H5HP_create(H5HP_MIN_HEAP); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Check that the heap has no elements */ num=H5HP_count(heap); @@ -237,7 +237,7 @@ test_heap_insert_max(void) /* Create a Heap */ heap=H5HP_create(H5HP_MAX_HEAP); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Check that the heap has no elements */ num=H5HP_count(heap); @@ -325,7 +325,7 @@ test_heap_insert_many_core(H5HP_type_t heap_type, test_obj *arr, size_t nelem, i /* Create a Heap */ heap=H5HP_create(heap_type); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Check that the heap has no elements */ num=H5HP_count(heap); @@ -405,7 +405,7 @@ test_heap_remove_min(void) /* Create a Heap */ heap=H5HP_create(H5HP_MIN_HEAP); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Check that the heap has no elements */ num=H5HP_count(heap); @@ -434,19 +434,19 @@ test_heap_remove_min(void) ret=H5HP_remove(heap,&val,&ptr); CHECK(ret, FAIL, "H5HP_remove"); VERIFY(val, 5, "H5HP_remove"); - VERIFY(ptr, &obj2, "H5HP_remove"); + CHECK_PTR_EQ(ptr, &obj2, "H5HP_remove"); /* Remove second maximum value from heap */ ret=H5HP_remove(heap,&val,&ptr); CHECK(ret, FAIL, "H5HP_remove"); VERIFY(val, 10, "H5HP_remove"); - VERIFY(ptr, &obj1, "H5HP_remove"); + CHECK_PTR_EQ(ptr, &obj1, "H5HP_remove"); /* Remove third maximum value from heap */ ret=H5HP_remove(heap,&val,&ptr); CHECK(ret, FAIL, "H5HP_remove"); VERIFY(val, 20, "H5HP_remove"); - VERIFY(ptr, &obj3, "H5HP_remove"); + CHECK_PTR_EQ(ptr, &obj3, "H5HP_remove"); /* Try removing an object from an empty heap */ ret=H5HP_remove(heap,&val,&ptr); @@ -479,7 +479,7 @@ test_heap_remove_max(void) /* Create a Heap */ heap=H5HP_create(H5HP_MAX_HEAP); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Check that the heap has no elements */ num=H5HP_count(heap); @@ -508,19 +508,19 @@ test_heap_remove_max(void) ret=H5HP_remove(heap,&val,&ptr); CHECK(ret, FAIL, "H5HP_remove"); VERIFY(val, 20, "H5HP_remove"); - VERIFY(ptr, &obj3, "H5HP_remove"); + CHECK_PTR_EQ(ptr, &obj3, "H5HP_remove"); /* Remove second maximum value from heap */ ret=H5HP_remove(heap,&val,&ptr); CHECK(ret, FAIL, "H5HP_remove"); VERIFY(val, 10, "H5HP_remove"); - VERIFY(ptr, &obj1, "H5HP_remove"); + CHECK_PTR_EQ(ptr, &obj1, "H5HP_remove"); /* Remove third maximum value from heap */ ret=H5HP_remove(heap,&val,&ptr); CHECK(ret, FAIL, "H5HP_remove"); VERIFY(val, 5, "H5HP_remove"); - VERIFY(ptr, &obj2, "H5HP_remove"); + CHECK_PTR_EQ(ptr, &obj2, "H5HP_remove"); /* Try removing an object from an empty heap */ ret=H5HP_remove(heap,&val,&ptr); @@ -567,7 +567,7 @@ static void test_heap_remove_many_core(H5HP_type_t heap_type, test_obj *arr, siz /* Create a Heap */ heap=H5HP_create(heap_type); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Check that the heap has no elements */ num=H5HP_count(heap); @@ -714,7 +714,7 @@ test_heap_change_min(void) /* Create a Heap */ heap=H5HP_create(H5HP_MIN_HEAP); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Check that the heap has no elements */ num=H5HP_count(heap); @@ -788,7 +788,7 @@ test_heap_change_max(void) /* Create a Heap */ heap=H5HP_create(H5HP_MAX_HEAP); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Check that the heap has no elements */ num=H5HP_count(heap); @@ -880,7 +880,7 @@ test_heap_incdec_min(void) /* Create a Heap */ heap=H5HP_create(H5HP_MIN_HEAP); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Check that the heap has no elements */ num=H5HP_count(heap); @@ -955,7 +955,7 @@ test_heap_incdec_max(void) /* Create a Heap */ heap=H5HP_create(H5HP_MAX_HEAP); - CHECK(heap, NULL, "H5HP_create"); + CHECK_PTR(heap, "H5HP_create"); /* Check that the heap has no elements */ num=H5HP_count(heap); @@ -16,223 +16,225 @@ #include "testhdf5.h" #include "hdf5.h" - /* Include H5Ipkg.h to calculate max number of groups */ +/* Include H5Ipkg.h to calculate max number of groups */ #define H5I_FRIEND /*suppress error about including H5Ipkg */ #include "H5Ipkg.h" - /* Test basic functionality of registering and deleting types and IDs */ +/* Test basic functionality of registering and deleting types and IDs */ static int basic_id_test(void) { - H5I_type_t myType = H5I_BADID; - hid_t arrayID = H5I_INVALID_HID; - void* testObj = NULL; - void* testPtr = NULL; - char nameString[10]; - hid_t testID; - ssize_t testSize = -1; - herr_t err; - int num_ref; - hsize_t num_members; - + H5I_type_t myType = H5I_BADID; + hid_t arrayID = H5I_INVALID_HID; + void* testObj = NULL; + void* testPtr = NULL; + char nameString[10]; + hid_t testID; + ssize_t testSize = -1; + herr_t err; + int num_ref; + hsize_t num_members; + + + /* Try to register an ID with ficticious types */ + H5E_BEGIN_TRY + arrayID = H5Iregister((H5I_type_t) 420, testObj); + H5E_END_TRY - /* Try to register an ID with ficticious types */ - H5E_BEGIN_TRY - arrayID = H5Iregister((H5I_type_t) 420, testObj); - H5E_END_TRY + VERIFY(arrayID, H5I_INVALID_HID, "H5Iregister"); + if(arrayID != H5I_INVALID_HID) + goto out; - VERIFY(arrayID, H5I_INVALID_HID, "H5Iregister"); - if(arrayID != H5I_INVALID_HID) - goto out; + H5E_BEGIN_TRY + arrayID = H5Iregister((H5I_type_t) -1, testObj); + H5E_END_TRY - H5E_BEGIN_TRY - arrayID = H5Iregister((H5I_type_t) -1, testObj); - H5E_END_TRY + VERIFY(arrayID, H5I_INVALID_HID, "H5Iregister"); + if(arrayID != H5I_INVALID_HID) + goto out; - VERIFY(arrayID, H5I_INVALID_HID, "H5Iregister"); - if(arrayID != H5I_INVALID_HID) - goto out; + /* Try to access IDs with ficticious types */ + H5E_BEGIN_TRY + testPtr = H5Iobject_verify((hid_t)100, (H5I_type_t) 0); + H5E_END_TRY - /* Try to access IDs with ficticious types */ - H5E_BEGIN_TRY - testPtr = H5Iobject_verify((hid_t)100, (H5I_type_t) 0); - H5E_END_TRY + CHECK_PTR_NULL(testPtr, "H5Iobject_verify"); + if(testPtr != NULL) + goto out; - VERIFY(testPtr, NULL, "H5Iobject_verify"); - if(testPtr != NULL) - goto out; + H5E_BEGIN_TRY + testPtr = H5Iobject_verify((hid_t)700, (H5I_type_t) 700); + H5E_END_TRY - H5E_BEGIN_TRY - testPtr = H5Iobject_verify((hid_t)700, (H5I_type_t) 700); - H5E_END_TRY + CHECK_PTR_NULL(testPtr, "H5Iobject_verify"); + if(testPtr != NULL) + goto out; - VERIFY(testPtr, NULL, "H5Iobject_verify"); - if(testPtr != NULL) - goto out; + /* Register a type */ + myType = H5Iregister_type((size_t)64, 0, (H5I_free_t) free ); - /* Register a type */ - myType = H5Iregister_type((size_t)64, 0, (H5I_free_t) free ); + CHECK(myType, H5I_BADID, "H5Iregister_type"); + if(myType == H5I_BADID) + goto out; - CHECK(myType, H5I_BADID, "H5Iregister_type"); - if(myType == H5I_BADID) - goto out; + /* Register an ID and retrieve the object it points to. + * Once the ID has been registered, testObj will be freed when + * its ID type is destroyed. + */ + testObj = HDmalloc(7 * sizeof(int)); + arrayID = H5Iregister(myType, testObj); - /* Register an ID and retrieve the object it points to. - * Once the ID has been registered, testObj will be freed when - * its ID type is destroyed. */ - testObj = HDmalloc(7 * sizeof(int)); - arrayID = H5Iregister(myType, testObj); + CHECK(arrayID, H5I_INVALID_HID, "H5Iregister"); + if(arrayID == H5I_INVALID_HID) { + HDfree(testObj); + goto out; + } - CHECK(arrayID, H5I_INVALID_HID, "H5Iregister"); - if(arrayID == H5I_INVALID_HID) - { - HDfree(testObj); - goto out; - } + testPtr = (int *)H5Iobject_verify(arrayID, myType); - testPtr = (int *) H5Iobject_verify(arrayID, myType); + CHECK_PTR_EQ(testPtr, testObj, "H5Iobject_verify"); + if(testPtr != testObj) + goto out; - VERIFY(testPtr, testObj, "H5Iobject_verify"); - if(testPtr != testObj) - goto out; + /* Ensure that H5Iget_file_id and H5Iget_name() fail, since this + * is an hid_t for the wrong kind of object + */ + H5E_BEGIN_TRY + testID = H5Iget_file_id(arrayID); + H5E_END_TRY - /* Ensure that H5Iget_file_id and H5Iget_name() fail, since this - * is an hid_t for the wrong kind of object */ - H5E_BEGIN_TRY - testID = H5Iget_file_id(arrayID); - H5E_END_TRY + VERIFY(testID, H5I_INVALID_HID, "H5Iget_file_id"); + if(testID != H5I_INVALID_HID) + goto out; - VERIFY(testID, H5I_INVALID_HID, "H5Iget_file_id"); - if(testID != H5I_INVALID_HID) - goto out; + H5E_BEGIN_TRY + testSize = H5Iget_name(arrayID, nameString, (size_t)9); + H5E_END_TRY - H5E_BEGIN_TRY - testSize = H5Iget_name(arrayID, nameString, (size_t)9); - H5E_END_TRY + VERIFY(testSize, -1, "H5Iget_name"); + if(testSize != -1) + goto out; - VERIFY(testSize, -1, "H5Iget_name"); - if(testSize != -1) - goto out; + /* Make sure H5Iremove_verify catches objects of the wrong type */ + H5E_BEGIN_TRY + testPtr = (int*) H5Iremove_verify(arrayID, (H5I_type_t) 0); + H5E_END_TRY - /* Make sure H5Iremove_verify catches objects of the wrong type */ - H5E_BEGIN_TRY - testPtr = (int*) H5Iremove_verify(arrayID, (H5I_type_t) 0); - H5E_END_TRY + CHECK_PTR_NULL(testPtr, "H5Iremove_verify"); + if(testPtr != NULL) + goto out; - VERIFY(testPtr, NULL, "H5Iremove_verify"); - if(testPtr != NULL) - goto out; + H5E_BEGIN_TRY + testPtr = (int*) H5Iremove_verify(arrayID, (H5I_type_t) ((int) myType-1)); + H5E_END_TRY - H5E_BEGIN_TRY - testPtr = (int*) H5Iremove_verify(arrayID, (H5I_type_t) ((int) myType-1)); - H5E_END_TRY + CHECK_PTR_NULL(testPtr, "H5Iremove_verify"); + if(testPtr != NULL) + goto out; - VERIFY(testPtr, NULL, "H5Iremove_verify"); - if(testPtr != NULL) - goto out; + /* Remove an ID and make sure we can't access it */ + testPtr = (int*) H5Iremove_verify(arrayID, myType); - /* Remove an ID and make sure we can't access it */ - testPtr = (int*) H5Iremove_verify(arrayID, myType); + CHECK_PTR(testPtr, "H5Iremove_verify"); + if(testPtr == NULL) + goto out; - CHECK(testPtr, NULL, "H5Iremove_verify"); - if(testPtr == NULL) - goto out; + H5E_BEGIN_TRY + testPtr = (int*) H5Iobject_verify(arrayID, myType); + H5E_END_TRY - H5E_BEGIN_TRY - testPtr = (int*) H5Iobject_verify(arrayID, myType); - H5E_END_TRY + CHECK_PTR_NULL(testPtr, "H5Iobject_verify"); + if(testPtr != NULL) + goto out; - VERIFY(testPtr, NULL, "H5Iobject_verify"); - if(testPtr != NULL) - goto out; + /* Delete the type and make sure we can't access objects within it */ + arrayID = H5Iregister(myType, testObj); - /* Delete the type and make sure we can't access objects within it */ - arrayID = H5Iregister(myType, testObj); + err = H5Idestroy_type(myType); + VERIFY(err, 0, "H5Idestroy_type"); + if( err != 0) + goto out; + VERIFY(H5Itype_exists(myType), 0, "H5Itype_exists"); + if(H5Itype_exists(myType) != 0) + goto out; - err = H5Idestroy_type(myType); - VERIFY(err, 0, "H5Idestroy_type"); - if( err != 0) - goto out; - VERIFY(H5Itype_exists(myType), 0, "H5Itype_exists"); - if(H5Itype_exists(myType) != 0) + H5E_BEGIN_TRY + VERIFY(H5Inmembers(myType, NULL), -1, "H5Inmembers"); + if(H5Inmembers(myType, NULL) != -1) goto out; + H5E_END_TRY - H5E_BEGIN_TRY - VERIFY(H5Inmembers(myType, NULL), -1, "H5Inmembers"); - if(H5Inmembers(myType, NULL) != -1) - goto out; - H5E_END_TRY - - /* Register another type and another object in that type */ - myType = H5Iregister_type((size_t)64, 0, (H5I_free_t) free ); + /* Register another type and another object in that type */ + myType = H5Iregister_type((size_t)64, 0, (H5I_free_t) free ); - CHECK(myType, H5I_BADID, "H5Iregister_type"); - if(myType == H5I_BADID) - goto out; + CHECK(myType, H5I_BADID, "H5Iregister_type"); + if(myType == H5I_BADID) + goto out; - /* The memory that testObj pointed to should already have been - * freed when the previous type was destroyed. Allocate new - * memory for it. - */ - testObj = HDmalloc(7 * sizeof(int)); - arrayID = H5Iregister(myType, testObj); + /* The memory that testObj pointed to should already have been + * freed when the previous type was destroyed. Allocate new + * memory for it. + */ + testObj = HDmalloc(7 * sizeof(int)); + arrayID = H5Iregister(myType, testObj); - CHECK(arrayID, H5I_INVALID_HID, "H5Iregister"); - if(arrayID == H5I_INVALID_HID) - { - HDfree(testObj); - goto out; - } + CHECK(arrayID, H5I_INVALID_HID, "H5Iregister"); + if(arrayID == H5I_INVALID_HID) { + HDfree(testObj); + goto out; + } - err = H5Inmembers(myType, &num_members); - CHECK(err, -1, "H5Inmembers"); - if (err < 0) - goto out; - VERIFY(num_members, 1, "H5Inmembers"); - if(num_members != 1) - goto out; + err = H5Inmembers(myType, &num_members); + CHECK(err, -1, "H5Inmembers"); + if (err < 0) + goto out; + VERIFY(num_members, 1, "H5Inmembers"); + if(num_members != 1) + goto out; - /* Increment references to type and ensure that dec_type_ref - doesn't destroy the type */ - num_ref = H5Iinc_type_ref(myType); - VERIFY(num_ref, 2, "H5Iinc_type_ref"); - if( num_ref != 2) - goto out; - num_ref = H5Idec_type_ref(myType); - VERIFY(num_ref, 1, "H5Idec_type_ref"); - if(num_ref != 1) - goto out; - err = H5Inmembers(myType, &num_members); - CHECK(err, -1, "H5Inmembers"); - if (err < 0) - goto out; - VERIFY(num_members, 1, "H5Inmembers"); - if(num_members != 1) - goto out; + /* Increment references to type and ensure that dec_type_ref + * doesn't destroy the type + */ + num_ref = H5Iinc_type_ref(myType); + VERIFY(num_ref, 2, "H5Iinc_type_ref"); + if( num_ref != 2) + goto out; + num_ref = H5Idec_type_ref(myType); + VERIFY(num_ref, 1, "H5Idec_type_ref"); + if(num_ref != 1) + goto out; + err = H5Inmembers(myType, &num_members); + CHECK(err, -1, "H5Inmembers"); + if (err < 0) + goto out; + VERIFY(num_members, 1, "H5Inmembers"); + if(num_members != 1) + goto out; - /* This call to dec_type_ref should destroy the type */ - num_ref = H5Idec_type_ref(myType); - VERIFY(num_ref, 0, "H5Idec_type_ref"); - if(num_ref != 0) - goto out; - VERIFY(H5Itype_exists(myType), 0, "H5Itype_exists"); - if (H5Itype_exists(myType) != 0) - goto out; + /* This call to dec_type_ref should destroy the type */ + num_ref = H5Idec_type_ref(myType); + VERIFY(num_ref, 0, "H5Idec_type_ref"); + if(num_ref != 0) + goto out; + VERIFY(H5Itype_exists(myType), 0, "H5Itype_exists"); + if (H5Itype_exists(myType) != 0) + goto out; - H5E_BEGIN_TRY + H5E_BEGIN_TRY err = H5Inmembers(myType, &num_members); - if(err >= 0) - goto out; - H5E_END_TRY + if(err >= 0) + goto out; + H5E_END_TRY - return 0; + return 0; out: - /* Clean up type if it has been allocated and free memory used - * by testObj */ - if(myType >= 0) - H5Idestroy_type(myType); + /* Clean up type if it has been allocated and free memory used + * by testObj + */ + if(myType >= 0) + H5Idestroy_type(myType); - return -1; + return -1; } @@ -263,7 +265,7 @@ static int id_predefined_test(void ) testPtr = H5Isearch(H5I_GENPROP_LST, (H5I_search_func_t) test_search_func, testObj); H5E_END_TRY - VERIFY(testPtr, NULL, "H5Isearch"); + CHECK_PTR_NULL(testPtr, "H5Isearch"); if(testPtr != NULL) goto out; @@ -301,7 +303,7 @@ static int id_predefined_test(void ) testPtr = H5Iremove_verify(typeID, H5I_DATATYPE); H5E_END_TRY - VERIFY(testPtr, NULL, "H5Iremove_verify"); + CHECK_PTR_NULL(testPtr, "H5Iremove_verify"); if(testPtr != NULL) goto out; @@ -309,7 +311,7 @@ static int id_predefined_test(void ) testPtr = H5Iobject_verify(typeID, H5I_DATATYPE); H5E_END_TRY - VERIFY(testPtr, NULL, "H5Iobject_verify"); + CHECK_PTR_NULL(testPtr, "H5Iobject_verify"); if(testPtr != NULL) goto out; diff --git a/test/titerate.c b/test/titerate.c index aad62c9..231bd2e 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -159,7 +159,7 @@ test_iter_group(hid_t fapl, hbool_t new_format) /* Keep a copy of the dataset names around for later */ lnames[i] = HDstrdup(name); - CHECK(lnames[i], NULL, "strdup"); + CHECK_PTR(lnames[i], "strdup"); ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); @@ -170,13 +170,13 @@ test_iter_group(hid_t fapl, hbool_t new_format) CHECK(ret, FAIL, "H5Gcreate2"); lnames[NDATASETS] = HDstrdup("grp"); - CHECK(lnames[NDATASETS], NULL, "strdup"); + CHECK_PTR(lnames[NDATASETS], "strdup"); ret = H5Tcommit2(file, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Tcommit2"); lnames[NDATASETS + 1] = HDstrdup("dtype"); - CHECK(lnames[NDATASETS], NULL, "strdup"); + CHECK_PTR(lnames[NDATASETS], "strdup"); /* Close everything up */ ret = H5Tclose(datatype); @@ -412,7 +412,7 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format) /* Keep a copy of the attribute names around for later */ anames[i] = HDstrdup(name); - CHECK(anames[i], NULL, "strdup"); + CHECK_PTR(anames[i], "strdup"); ret = H5Aclose(attribute); CHECK(ret, FAIL, "H5Aclose"); @@ -596,7 +596,7 @@ test_iter_group_large(hid_t fapl) /* Allocate & initialize array */ names = (iter_info *)HDcalloc(sizeof(iter_info), (ITER_NGROUPS + 2)); - CHECK(names, NULL, "HDcalloc"); + CHECK_PTR(names, "HDcalloc"); /* Output message about test being performed */ MESSAGE(5, ("Testing Large Group Iteration Functionality\n")); @@ -733,7 +733,7 @@ static void test_grp_memb_funcs(hid_t fapl) /* Keep a copy of the dataset names around for later */ dnames[i] = HDstrdup(name); - CHECK(dnames[i], NULL, "strdup"); + CHECK_PTR(dnames[i], "strdup"); ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); @@ -744,13 +744,13 @@ static void test_grp_memb_funcs(hid_t fapl) CHECK(ret, FAIL, "H5Gcreate2"); dnames[NDATASETS] = HDstrdup("grp"); - CHECK(dnames[NDATASETS], NULL, "strdup"); + CHECK_PTR(dnames[NDATASETS], "strdup"); ret = H5Tcommit2(file, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Tcommit2"); dnames[NDATASETS + 1] = HDstrdup("dtype"); - CHECK(dnames[NDATASETS], NULL, "strdup"); + CHECK_PTR(dnames[NDATASETS], "strdup"); /* Close everything up */ ret = H5Tclose(datatype); @@ -797,7 +797,7 @@ static void test_grp_memb_funcs(hid_t fapl) /* Keep a copy of the dataset names around for later */ obj_names[i] = HDstrdup(dataset_name); - CHECK(obj_names[i], NULL, "strdup"); + CHECK_PTR(obj_names[i], "strdup"); ret = H5Oget_info_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_idx"); diff --git a/test/tmisc.c b/test/tmisc.c index 6da4589..f0e595b 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -723,7 +723,7 @@ create_struct3(void) herr_t ret; /* For error checking */ str3hndl = (misc5_struct3_hndl *)HDmalloc(sizeof(misc5_struct3_hndl)); - CHECK(str3hndl,NULL,"malloc"); + CHECK_PTR(str3hndl, "malloc"); str3hndl->st3h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct3)); CHECK(str3hndl->st3h_base, FAIL, "H5Tcreate"); @@ -766,7 +766,7 @@ create_struct2(void) herr_t ret; /* For error checking */ str2hndl = (misc5_struct2_hndl *)HDmalloc(sizeof(misc5_struct2_hndl)); - CHECK(str2hndl, NULL, "malloc"); + CHECK_PTR(str2hndl, "HDmalloc"); str2hndl->st2h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct2)); CHECK(str2hndl->st2h_base, FAIL, "H5Tcreate"); @@ -775,7 +775,7 @@ create_struct2(void) CHECK(ret, FAIL, "H5Tinsert"); str2hndl->st2h_st3hndl = create_struct3(); - CHECK(str2hndl->st2h_st3hndl,NULL,"create_struct3"); + CHECK_PTR(str2hndl->st2h_st3hndl, "create_struct3"); ret = H5Tinsert(str2hndl->st2h_base, "st2_el2", HOFFSET(misc5_struct2, st2_el2), str2hndl->st2h_st3hndl->st3h_id); CHECK(ret,FAIL,"H5Tinsert"); @@ -811,7 +811,7 @@ set_struct2(misc5_struct2 *buf) buf->st2_el2.len = MISC5_DBGNELM3; buf->st2_el2.p = HDmalloc((buf->st2_el2.len)*sizeof(misc5_struct3)); - CHECK(buf->st2_el2.p,NULL,"malloc"); + CHECK_PTR(buf->st2_el2.p, "HDmalloc"); for(i=0; i<(buf->st2_el2.len); i++) set_struct3(&(((misc5_struct3 *)(buf->st2_el2.p))[i])); @@ -832,7 +832,7 @@ create_struct1(void) herr_t ret; /* For error checking */ str1hndl = (misc5_struct1_hndl *)HDmalloc(sizeof(misc5_struct1_hndl)); - CHECK(str1hndl, NULL, "malloc"); + CHECK_PTR(str1hndl, "HDmalloc"); str1hndl->st1h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct1)); CHECK(str1hndl->st1h_base, FAIL, "H5Tcreate"); @@ -841,7 +841,7 @@ create_struct1(void) CHECK(ret, FAIL, "H5Tinsert"); str1hndl->st1h_st2hndl=create_struct2(); - CHECK(str1hndl->st1h_st2hndl,NULL,"create_struct2"); + CHECK_PTR(str1hndl->st1h_st2hndl, "create_struct2"); ret = H5Tinsert(str1hndl->st1h_base, "st1_el2", HOFFSET(misc5_struct1, st1_el2), str1hndl->st1h_st2hndl->st2h_id); CHECK(ret,FAIL,"H5Tinsert"); @@ -877,7 +877,7 @@ set_struct1(misc5_struct1 *buf) buf->st1_el2.len=MISC5_DBGNELM2; buf->st1_el2.p=HDmalloc((buf->st1_el2.len)*sizeof(misc5_struct2)); - CHECK(buf->st1_el2.p,NULL,"malloc"); + CHECK_PTR(buf->st1_el2.p, "HDmalloc"); for(i=0; i<(buf->st1_el2.len); i++) set_struct2(&(((misc5_struct2 *)(buf->st1_el2.p))[i])); @@ -913,7 +913,7 @@ test_misc5(void) /* Create the memory structure to write */ str1hndl = create_struct1(); - CHECK(str1hndl, NULL, "create_struct1"); + CHECK_PTR(str1hndl, "create_struct1"); /* Create the dataspace */ dims[0] = MISC5_NELMTOPLVL; @@ -927,7 +927,7 @@ test_misc5(void) /* Create the variable-length buffer */ buf.len = MISC5_DBGNELM1; buf.p = HDmalloc((buf.len) * sizeof(misc5_struct1)); - CHECK(buf.p, NULL, "malloc"); + CHECK_PTR(buf.p, "HDmalloc"); /* Create the top-level VL information */ for(i = 0; i < MISC5_DBGNELM1; i++) @@ -1253,10 +1253,10 @@ test_misc8(void) /* Allocate space for the data to write & read */ wdata = (int *)HDmalloc(sizeof(int) * MISC8_DIM0 * MISC8_DIM1); - CHECK(wdata,NULL,"malloc"); + CHECK_PTR(wdata, "HDmalloc"); #ifdef VERIFY_DATA rdata = (int *)HDmalloc(sizeof(int) * MISC8_DIM0 * MISC8_DIM1); - CHECK(rdata,NULL,"malloc"); + CHECK_PTR(rdata, "HDmalloc"); #endif /* VERIFY_DATA */ /* Initialize values */ @@ -2144,7 +2144,7 @@ misc13_verify_dataset(hid_t loc_id, const char *name, const unsigned *data) /* Create a data buffer for the dataset read */ read_data = (unsigned *)HDcalloc(MISC13_DIM1, sizeof(unsigned)); - CHECK(read_data, NULL, "HDcalloc"); + CHECK_PTR(read_data, "HDcalloc"); /* Open the contiguous dataset in the root group */ dsid = H5Dopen2(loc_id, name, H5P_DEFAULT); @@ -2270,14 +2270,14 @@ misc13_insert_user_block(const char *old_name, const char *new_name, const char /* Allocate space for the user block */ user_block = HDcalloc(size, (size_t)1); - CHECK(user_block, NULL, "HDcalloc"); + CHECK_PTR(user_block, "HDcalloc"); /* Copy in the user block data */ HDmemcpy(user_block, str, strlen(str)); /* Open the new file */ new_fp = HDfopen(new_name,"wb"); - CHECK(new_fp, NULL, "HDfopen"); + CHECK_PTR(new_fp, "HDfopen"); /* Write the user block to the new file */ written = HDfwrite(user_block, (size_t)1, size, new_fp); @@ -2285,11 +2285,11 @@ misc13_insert_user_block(const char *old_name, const char *new_name, const char /* Open the old file */ old_fp = HDfopen(old_name,"rb"); - CHECK(old_fp, NULL, "HDfopen"); + CHECK_PTR(old_fp, "HDfopen"); /* Allocate space for the copy buffer */ copy_buf = HDmalloc((size_t)MISC13_COPY_BUF_SIZE); - CHECK(copy_buf, NULL, "HDmalloc"); + CHECK_PTR(copy_buf, "HDmalloc"); /* Copy data from the old file to the new file */ while((read_in = HDfread(copy_buf, (size_t)1, (size_t)MISC13_COPY_BUF_SIZE, old_fp)) > 0) { @@ -2439,7 +2439,7 @@ test_misc13(void) /* Create a data buffer for the datasets */ data = (unsigned *)HDcalloc(MISC13_DIM1, sizeof(unsigned)); - CHECK(data, NULL, "HDcalloc"); + CHECK_PTR(data, "HDcalloc"); /* Initialize data to write */ misc13_init_data(data); @@ -3446,7 +3446,7 @@ test_misc19(void) /* Get a VFD class to register */ vfd_cls = h5_get_dummy_vfd_class(); - CHECK(vfd_cls, NULL, "h5_get_dummy_vfd_class"); + CHECK_PTR(vfd_cls, "h5_get_dummy_vfd_class"); /* Register a virtual file driver */ vfdid = H5FDregister(vfd_cls); diff --git a/test/trefstr.c b/test/trefstr.c index 40ce344..83e2951 100644 --- a/test/trefstr.c +++ b/test/trefstr.c @@ -67,7 +67,7 @@ test_refstr_create(void) /* Try creating a ref-counted string */ rs=H5RS_create("foo"); - CHECK(rs, NULL, "H5RS_create"); + CHECK_PTR(rs, "H5RS_create"); /* Get the reference count on the string */ count=H5RS_get_count(rs); @@ -97,7 +97,7 @@ test_refstr_count(void) /* Try creating a ref-counted string */ rs=H5RS_create("foo"); - CHECK(rs, NULL, "H5RS_create"); + CHECK_PTR(rs, "H5RS_create"); /* Get the reference count on the string */ count=H5RS_get_count(rs); @@ -144,7 +144,7 @@ test_refstr_dup(void) /* Try creating a ref-counted string */ rs1=H5RS_create("foo"); - CHECK(rs1, NULL, "H5RS_create"); + CHECK_PTR(rs1, "H5RS_create"); /* Get the reference count on the string */ count=H5RS_get_count(rs1); @@ -152,7 +152,7 @@ test_refstr_dup(void) /* Duplicate r-string */ rs2=H5RS_dup(rs1); - CHECK(rs2, NULL, "H5RS_dup"); + CHECK_PTR(rs2, "H5RS_dup"); /* Get the reference count on the strings */ count=H5RS_get_count(rs1); @@ -194,11 +194,11 @@ test_refstr_cmp(void) /* Create first reference counted string */ rs1=H5RS_create("foo"); - CHECK(rs1, NULL, "H5RS_create"); + CHECK_PTR(rs1, "H5RS_create"); /* Create second reference counted string */ rs2=H5RS_create("foo2"); - CHECK(rs2, NULL, "H5RS_create"); + CHECK_PTR(rs2, "H5RS_create"); /* Compare the strings in various ways */ cmp=H5RS_cmp(rs1,rs1); @@ -246,12 +246,12 @@ test_refstr_wrap(void) /* Wrap ref-counted string around existing buffer */ rs=H5RS_wrap(buf); - CHECK(rs, NULL, "H5RS_wrap"); + CHECK_PTR(rs, "H5RS_wrap"); /* Get pointer to raw string in ref-counted string */ s=H5RS_get_str(rs); - CHECK(s, NULL, "H5RS_get_str"); - VERIFY(s, buf, "wrapping"); + CHECK_PTR(s, "H5RS_get_str"); + CHECK_PTR_EQ(s, buf, "wrapping"); cmp=HDstrcmp(s,buf); VERIFY(cmp, 0, "HDstrcmp"); @@ -264,7 +264,7 @@ test_refstr_wrap(void) /* Get pointer to raw string in ref-counted string */ s=H5RS_get_str(rs); - CHECK(s, NULL, "H5RS_get_str"); + CHECK_PTR(s, "H5RS_get_str"); CHECK(s, buf, "wrapping"); cmp=HDstrcmp(s,buf); if(cmp<=0) @@ -299,17 +299,17 @@ test_refstr_own(void) /* Initialize buffer */ s = (char *)H5FL_BLK_MALLOC(str_buf,HDstrlen("foo") + 1); - CHECK(s, NULL, "H5FL_BLK_MALLOC"); + CHECK_PTR(s, "H5FL_BLK_MALLOC"); HDstrcpy(s, "foo"); /* Transfer ownership of dynamically allocated string to ref-counted string */ rs=H5RS_own(s); - CHECK(rs, NULL, "H5RS_own"); + CHECK_PTR(rs, "H5RS_own"); /* Get pointer to raw string in ref-counted string */ t=H5RS_get_str(rs); - CHECK(t, NULL, "H5RS_get_str"); - VERIFY(t, s, "transferring"); + CHECK_PTR(t, "H5RS_get_str"); + CHECK_PTR_EQ(t, s, "transferring"); cmp=HDstrcmp(s,t); VERIFY(cmp, 0, "HDstrcmp"); @@ -322,8 +322,8 @@ test_refstr_own(void) /* Get pointer to raw string in ref-counted string */ t=H5RS_get_str(rs); - CHECK(t, NULL, "H5RS_get_str"); - VERIFY(t, s, "transferring"); + CHECK_PTR(t, "H5RS_get_str"); + CHECK_PTR_EQ(t, s, "transferring"); cmp=HDstrcmp(t,s); VERIFY(cmp, 0, "HDstrcmp"); diff --git a/test/tselect.c b/test/tselect.c index 85c21bb..2022a11 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -228,9 +228,9 @@ test_select_hyper(hid_t xfer_plist) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -432,9 +432,9 @@ test_select_point(hid_t xfer_plist) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -710,9 +710,9 @@ test_select_all(hid_t xfer_plist) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE4_DIM1; i++) @@ -797,9 +797,9 @@ test_select_all_hyper(hid_t xfer_plist) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -939,9 +939,9 @@ test_select_combo(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -1106,9 +1106,9 @@ test_select_hyper_stride(hid_t xfer_plist) /* Allocate write & read buffers */ wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -1234,9 +1234,9 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist) /* Allocate write & read buffers */ wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -1364,9 +1364,9 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist) /* Allocate write & read buffers */ wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE8_DIM1; i++) @@ -1491,9 +1491,9 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist) /* Allocate write & read buffers */ wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE8_DIM4; i++) @@ -1735,9 +1735,9 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, /* Allocate buffers */ small_cube_buf_1 = (uint16_t *)HDcalloc(sizeof(uint16_t), small_cube_size); - CHECK(small_cube_buf_1, NULL, "HDcalloc"); + CHECK_PTR(small_cube_buf_1, "HDcalloc"); large_cube_buf_1 = (uint16_t *)HDcalloc(sizeof(uint16_t), large_cube_size); - CHECK(large_cube_buf_1, NULL, "HDcalloc"); + CHECK_PTR(large_cube_buf_1, "HDcalloc"); /* Create a dataset transfer property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); @@ -2342,7 +2342,7 @@ test_select_hyper_contig_dr(hid_t dset_type, hid_t xfer_plist) /* Allocate cube buffer for writing values */ cube_buf = (uint16_t *)HDmalloc(sizeof(uint16_t) * max_cube_size); - CHECK(cube_buf, NULL, "HDmalloc"); + CHECK_PTR(cube_buf, "HDmalloc"); /* Initialize the cube buffer */ cube_ptr = cube_buf; @@ -2351,7 +2351,7 @@ test_select_hyper_contig_dr(hid_t dset_type, hid_t xfer_plist) /* Allocate cube buffer for zeroing values on disk */ zero_buf = (uint16_t *)HDcalloc(sizeof(uint16_t), max_cube_size); - CHECK(zero_buf, NULL, "HDcalloc"); + CHECK_PTR(zero_buf, "HDcalloc"); for(large_rank = 1; large_rank <= max_rank; large_rank++) { for(small_rank = 1; small_rank < large_rank; small_rank++) { @@ -2811,9 +2811,9 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ /* Allocate & initialize buffers */ small_cube_buf_1 = (uint16_t *)HDcalloc(sizeof(uint16_t), small_cube_size); - CHECK(small_cube_buf_1, NULL, "HDcalloc"); + CHECK_PTR(small_cube_buf_1, "HDcalloc"); large_cube_buf_1 = (uint16_t *)HDcalloc(sizeof(uint16_t), large_cube_size); - CHECK(large_cube_buf_1, NULL, "HDcalloc"); + CHECK_PTR(large_cube_buf_1, "HDcalloc"); /* Create a dataset transfer property list */ @@ -3574,7 +3574,7 @@ test_select_hyper_checker_board_dr(hid_t dset_type, hid_t xfer_plist) /* Allocate cube buffer for writing values */ cube_buf = (uint16_t *)HDmalloc(sizeof(uint16_t) * max_cube_size); - CHECK(cube_buf, NULL, "HDmalloc"); + CHECK_PTR(cube_buf, "HDmalloc"); /* Initialize the cube buffer */ cube_ptr = cube_buf; @@ -3583,7 +3583,7 @@ test_select_hyper_checker_board_dr(hid_t dset_type, hid_t xfer_plist) /* Allocate cube buffer for zeroing values on disk */ zero_buf = (uint16_t *)HDcalloc(sizeof(uint16_t), max_cube_size); - CHECK(zero_buf, NULL, "HDcalloc"); + CHECK_PTR(zero_buf, "HDcalloc"); for(large_rank = 1; large_rank <= max_rank; large_rank++) { for(small_rank = 1; small_rank < large_rank; small_rank++) { @@ -3651,11 +3651,11 @@ test_select_hyper_copy(void) /* Allocate write & read buffers */ wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); rbuf2 = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf2, NULL, "HDcalloc"); + CHECK_PTR(rbuf2, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -3813,11 +3813,11 @@ test_select_point_copy(void) /* Allocate write & read buffers */ wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); rbuf2 = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf2, NULL, "HDcalloc"); + CHECK_PTR(rbuf2, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -3991,9 +3991,9 @@ test_select_hyper_offset(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -4149,9 +4149,9 @@ test_select_hyper_offset2(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE7_DIM1 * SPACE7_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE7_DIM1 * SPACE7_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++) @@ -4272,9 +4272,9 @@ test_select_point_offset(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -4452,9 +4452,9 @@ test_select_hyper_union(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -5319,9 +5319,9 @@ test_select_hyper_and_2d(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -5448,9 +5448,9 @@ test_select_hyper_xor_2d(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -5579,9 +5579,9 @@ test_select_hyper_notb_2d(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -5709,9 +5709,9 @@ test_select_hyper_nota_2d(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -5869,9 +5869,9 @@ test_select_hyper_union_random_5d(hid_t read_plist) /* Allocate write & read buffers */ wbuf = (int *)HDmalloc(sizeof(int) * SPACE5_DIM1 * SPACE5_DIM2 * SPACE5_DIM3 * SPACE5_DIM4 * SPACE5_DIM5); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (int *)HDcalloc(sizeof(int), (size_t)(SPACE5_DIM1 * SPACE5_DIM2 * SPACE5_DIM3 * SPACE5_DIM4 * SPACE5_DIM5)); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE5_DIM1; i++) @@ -6061,9 +6061,9 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist) /* Allocate the transfer buffers */ data = (short *)HDmalloc(sizeof(short) * X * Y * Z); - CHECK(data, NULL, "HDmalloc"); + CHECK_PTR(data, "HDmalloc"); data_out = (short *)HDcalloc((size_t)(NX * NY * NZ), sizeof(short)); - CHECK(data_out, NULL, "HDcalloc"); + CHECK_PTR(data_out, "HDcalloc"); /* * Data buffer initialization. @@ -6296,9 +6296,9 @@ test_select_point_chunk(void) /* Allocate the transfer buffers */ data = (unsigned *)HDmalloc(sizeof(unsigned) * SPACE7_DIM1 * SPACE7_DIM2); - CHECK(data, NULL, "HDmalloc"); + CHECK_PTR(data, "HDmalloc"); data_out = (unsigned *)HDcalloc((size_t)(SPACE7_DIM1 * SPACE7_DIM2), sizeof(unsigned)); - CHECK(data_out, NULL, "HDcalloc"); + CHECK_PTR(data_out, "HDcalloc"); /* * Data buffer initialization. @@ -7057,7 +7057,7 @@ test_select_fill_all(void) /* Allocate memory buffer */ wbuf = (unsigned *)HDmalloc(sizeof(unsigned) * SPACE7_DIM1 * SPACE7_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); /* Initialize memory buffer */ for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++) @@ -7133,7 +7133,7 @@ test_select_fill_point(hssize_t *offset) /* Allocate memory buffer */ wbuf = (unsigned *)HDmalloc(sizeof(unsigned) * SPACE7_DIM1 * SPACE7_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); /* Initialize memory buffer */ for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++) @@ -7230,7 +7230,7 @@ test_select_fill_hyper_simple(hssize_t *offset) /* Allocate memory buffer */ wbuf = (unsigned *)HDmalloc(sizeof(unsigned) * SPACE7_DIM1 * SPACE7_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); /* Initialize memory buffer */ for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++) @@ -7337,7 +7337,7 @@ test_select_fill_hyper_regular(hssize_t *offset) /* Allocate memory buffer */ wbuf = (unsigned *)HDmalloc(sizeof(unsigned) * SPACE7_DIM1 * SPACE7_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); /* Initialize memory buffer */ for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++) @@ -7456,7 +7456,7 @@ test_select_fill_hyper_irregular(hssize_t *offset) /* Allocate memory buffer */ wbuf = (unsigned *)HDmalloc(sizeof(unsigned) * SPACE7_DIM1 * SPACE7_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); /* Initialize memory buffer */ for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++) @@ -7558,9 +7558,9 @@ test_select_none(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE7_DIM1 * SPACE7_DIM2); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), SPACE7_DIM1 * SPACE7_DIM2); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++) @@ -7661,9 +7661,9 @@ test_scalar_select(void) /* Allocate write & read buffers */ wbuf_uint8 = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE7_DIM1 * SPACE7_DIM2); - CHECK(wbuf_uint8, NULL, "HDmalloc"); + CHECK_PTR(wbuf_uint8, "HDmalloc"); wbuf_ushort = (unsigned short *)HDmalloc(sizeof(unsigned short) * SPACE7_DIM1 * SPACE7_DIM2); - CHECK(wbuf_ushort, NULL, "HDmalloc"); + CHECK_PTR(wbuf_ushort, "HDmalloc"); /* Initialize write buffers */ for(i=0, tbuf_uint8=wbuf_uint8, tbuf_ushort=wbuf_ushort; i<SPACE7_DIM1; i++) @@ -12581,9 +12581,9 @@ test_select_hyper_chunk_offset(void) /* Allocate buffers */ wbuf = (int *)HDmalloc(sizeof(int) * SPACE10_DIM1); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (int *)HDcalloc(sizeof(int), SPACE10_DIM1); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize the write buffer */ for(i=0; i<SPACE10_DIM1; i++) diff --git a/test/tskiplist.c b/test/tskiplist.c index b9b00df..2806afe 100644 --- a/test/tskiplist.c +++ b/test/tskiplist.c @@ -66,11 +66,11 @@ test_skiplist_init(void) /* Allocate arrays */ rand_num = (int *)HDmalloc(sizeof(int) * NUM_ELEMS); - CHECK(rand_num, NULL, "HDmalloc"); + CHECK_PTR(rand_num, "HDmalloc"); sort_rand_num = (int *)HDmalloc(sizeof(int) * NUM_ELEMS); - CHECK(sort_rand_num, NULL, "HDmalloc"); + CHECK_PTR(sort_rand_num, "HDmalloc"); rev_sort_rand_num = (int *)HDmalloc(sizeof(int) * NUM_ELEMS); - CHECK(rev_sort_rand_num, NULL, "HDmalloc"); + CHECK_PTR(rev_sort_rand_num, "HDmalloc"); /* Initialize random number seed */ curr_time = HDtime(NULL); @@ -125,7 +125,7 @@ test_skiplist_create(void) /* Try creating a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Try closing the skip list */ ret=H5SL_close(slist); @@ -155,7 +155,7 @@ test_skiplist_insert(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -164,7 +164,7 @@ test_skiplist_insert(void) /* Try searching for item in empty skip list */ key=37; found_item=(int *)H5SL_search(slist,&key); - VERIFY(found_item, NULL, "H5SL_search"); + CHECK_PTR_NULL(found_item, "H5SL_search"); /* Insert an object into the skip list */ key=2; item=10; @@ -177,13 +177,13 @@ test_skiplist_insert(void) /* Search for the item just inserted */ found_item=(int *)H5SL_search(slist,&key); - CHECK(found_item, NULL, "H5SL_search"); - VERIFY(*found_item,item,"H5SL_search"); + CHECK_PTR(found_item, "H5SL_search"); + VERIFY(*found_item, item, "H5SL_search"); /* Search for an item not in list */ search_key=37; found_item=(int *)H5SL_search(slist,&search_key); - VERIFY(found_item, NULL, "H5SL_search"); + CHECK_PTR_NULL(found_item, "H5SL_search"); /* Attempt to insert duplicate key (should fail) */ search_key=2; @@ -216,7 +216,7 @@ test_skiplist_insert_many(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -235,7 +235,7 @@ test_skiplist_insert_many(void) /* Search for all objects in the skip list */ for(u=0; u<NUM_ELEMS; u++) { found_item=(int *)H5SL_search(slist,&rand_num[u]); - CHECK(found_item, NULL, "H5SL_search"); + CHECK_PTR(found_item, "H5SL_search"); VERIFY(*found_item,rand_num[u],"H5SL_search"); } /* end for */ @@ -290,7 +290,7 @@ test_skiplist_remove(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -299,7 +299,7 @@ test_skiplist_remove(void) /* Try removing an item in empty skip list */ search_key=37; found_item=(int *)H5SL_remove(slist,&search_key); - VERIFY(found_item, NULL, "H5SL_remove"); + CHECK_PTR_NULL(found_item, "H5SL_remove"); /* Insert three objects into the skip list */ key1=15; @@ -321,18 +321,18 @@ test_skiplist_remove(void) /* Try removing items from skip list */ search_key=key1; found_item=(int *)H5SL_remove(slist,&search_key); - CHECK(found_item, NULL, "H5SL_remove"); - VERIFY(found_item, &key1, "H5SL_remove"); + CHECK_PTR(found_item, "H5SL_remove"); + CHECK_PTR_EQ(found_item, &key1, "H5SL_remove"); search_key=key2; found_item=(int *)H5SL_remove(slist,&search_key); - CHECK(found_item, NULL, "H5SL_remove"); - VERIFY(found_item, &key2, "H5SL_remove"); + CHECK_PTR(found_item, "H5SL_remove"); + CHECK_PTR_EQ(found_item, &key2, "H5SL_remove"); search_key=key3; found_item=(int *)H5SL_remove(slist,&search_key); - CHECK(found_item, NULL, "H5SL_remove"); - VERIFY(found_item, &key3, "H5SL_remove"); + CHECK_PTR(found_item, "H5SL_remove"); + CHECK_PTR_EQ(found_item, &key3, "H5SL_remove"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -341,7 +341,7 @@ test_skiplist_remove(void) /* Try removing items from empty skip list (after its been worked on) */ search_key=key1; found_item=(int *)H5SL_remove(slist,&search_key); - VERIFY(found_item, NULL, "H5SL_remove"); + CHECK_PTR_NULL(found_item, "H5SL_remove"); /* Close the skip list */ ret=H5SL_close(slist); @@ -369,7 +369,7 @@ test_skiplist_remove_many(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -388,7 +388,7 @@ test_skiplist_remove_many(void) /* Remove all objects from the skip list (in random order) */ for(u=0; u<NUM_ELEMS; u++) { found_item=(int *)H5SL_remove(slist,&rand_num[u]); - CHECK(found_item, NULL, "H5SL_remove"); + CHECK_PTR(found_item, "H5SL_remove"); VERIFY(*found_item,rand_num[u],"H5SL_remove"); } /* end for */ @@ -411,7 +411,7 @@ test_skiplist_remove_many(void) /* Remove all objects from the skip list */ for(u=0; u<NUM_ELEMS; u++) { found_item=(int *)H5SL_remove(slist,&sort_rand_num[u]); - CHECK(found_item, NULL, "H5SL_remove"); + CHECK_PTR(found_item, "H5SL_remove"); VERIFY(*found_item,sort_rand_num[u],"H5SL_remove"); } /* end for */ @@ -434,7 +434,7 @@ test_skiplist_remove_many(void) /* Remove all objects from the skip list */ for(u=0; u<NUM_ELEMS; u++) { found_item=(int *)H5SL_remove(slist,&rev_sort_rand_num[u]); - CHECK(found_item, NULL, "H5SL_remove"); + CHECK_PTR(found_item, "H5SL_remove"); VERIFY(*found_item,rev_sort_rand_num[u],"H5SL_remove"); } /* end for */ @@ -469,7 +469,7 @@ test_skiplist_firstnext(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -477,7 +477,7 @@ test_skiplist_firstnext(void) VERIFY(num, 0, "H5SL_count"); /* Check that the list appears empty */ node=H5SL_first(slist); - VERIFY(node, NULL, "H5SL_first"); + CHECK_PTR_NULL(node, "H5SL_first"); /* Insert many objects into the skip list */ for(u=0; u<NUM_ELEMS; u++) { @@ -491,7 +491,7 @@ test_skiplist_firstnext(void) /* Iterate over all the nodes in the skip list */ node=H5SL_first(slist); - CHECK(node, NULL, "H5SL_first"); + CHECK_PTR(node, "H5SL_first"); u=0; while(node!=NULL) { found_item=(int *)H5SL_item(node); @@ -506,7 +506,7 @@ test_skiplist_firstnext(void) /* Check that the list appears empty again */ node=H5SL_first(slist); - VERIFY(node, NULL, "H5SL_first"); + CHECK_PTR_NULL(node, "H5SL_first"); /* Close the skip list */ ret=H5SL_close(slist); @@ -562,7 +562,7 @@ test_skiplist_string(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_STR, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -624,7 +624,7 @@ test_skiplist_iterate(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -674,7 +674,7 @@ test_skiplist_hsize(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_HSIZE, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -729,7 +729,7 @@ test_skiplist_unsigned(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -784,7 +784,7 @@ test_skiplist_obj(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_OBJ, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -862,7 +862,7 @@ test_skiplist_generic(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_GENERIC, test_skiplist_generic_cmp); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -916,7 +916,7 @@ test_skiplist_lastprev(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Check that the skip list has no elements */ num=H5SL_count(slist); @@ -924,7 +924,7 @@ test_skiplist_lastprev(void) /* Check that the list appears empty */ node=H5SL_last(slist); - VERIFY(node, NULL, "H5SL_last"); + CHECK_PTR_NULL(node, "H5SL_last"); /* Insert many objects into the skip list */ for(u=0; u<NUM_ELEMS; u++) { @@ -938,7 +938,7 @@ test_skiplist_lastprev(void) /* Iterate over all the nodes in the skip list */ node=H5SL_last(slist); - CHECK(node, NULL, "H5SL_last"); + CHECK_PTR(node, "H5SL_last"); u=NUM_ELEMS-1; while(node!=NULL) { found_item=(int *)H5SL_item(node); @@ -953,7 +953,7 @@ test_skiplist_lastprev(void) /* Check that the list appears empty again */ node=H5SL_last(slist); - VERIFY(node, NULL, "H5SL_last"); + CHECK_PTR_NULL(node, "H5SL_last"); /* Close the skip list */ ret=H5SL_close(slist); @@ -984,7 +984,7 @@ test_skiplist_find(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u=0; u<10; u++) { @@ -995,7 +995,7 @@ test_skiplist_find(void) /* Find the element with key==30 in the skip list */ find_item=30; node=H5SL_find(slist,&find_item); - CHECK(node, NULL, "H5SL_find"); + CHECK_PTR(node, "H5SL_find"); /* Iterate over the rest of the nodes in the skip list */ u=4; @@ -1009,7 +1009,7 @@ test_skiplist_find(void) /* Check for trying to locate non-existent item */ find_item=81; node=H5SL_find(slist,&find_item); - VERIFY(node, NULL, "H5SL_find"); + CHECK_PTR_NULL(node, "H5SL_find"); /* Close the skip list */ ret=H5SL_close(slist); @@ -1040,7 +1040,7 @@ test_skiplist_add(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u=0; u<10; u++) { @@ -1051,11 +1051,11 @@ test_skiplist_add(void) /* Add the element with key==12 in the skip list */ new_item=12; node=H5SL_add(slist,&new_item,&new_item); - CHECK(node, NULL, "H5SL_add"); + CHECK_PTR(node, "H5SL_add"); /* Advance to next node in list */ node=H5SL_next(node); - CHECK(node, NULL, "H5SL_next"); + CHECK_PTR(node, "H5SL_next"); /* Iterate over the rest of the nodes in the skip list */ u=2; @@ -1102,7 +1102,7 @@ test_skiplist_destroy(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u=0; u<NUM_ELEMS; u++) { @@ -1138,7 +1138,7 @@ test_skiplist_free(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u=0; u<NUM_ELEMS; u++) { @@ -1210,8 +1210,8 @@ static herr_t test_tfs_iter(void *_obj, void *key, void *_udata) { test_tfs_it_ud_t *udata = (test_tfs_it_ud_t *)_udata; /* Check consistency */ - VERIFY((void *)&obj->idx, key, "obj->idx"); - VERIFY(obj, &udata->obj_list->list[obj->idx], "obj_list->list[obj->idx]"); + CHECK_PTR_EQ((void *)&obj->idx, key, "obj->idx"); + CHECK_PTR_EQ(obj, &udata->obj_list->list[obj->idx], "obj_list->list[obj->idx]"); /* Increment number of calls */ udata->ncalls++; @@ -1236,8 +1236,8 @@ static htri_t test_tfs_free(void *_obj, void *key, void *_obj_list) { htri_t ret_value; /* Check consistency */ - VERIFY((void *)&obj->idx, key, "obj->idx"); - VERIFY(obj, &obj_list->list[obj->idx], "obj_list->list[obj->idx]"); + CHECK_PTR_EQ((void *)&obj->idx, key, "obj->idx"); + CHECK_PTR_EQ(obj, &obj_list->list[obj->idx], "obj_list->list[obj->idx]"); /* Mark this object as freed (to make sure it isn't recursively freed, that * is not something we support, we will undo this if we decide later not to @@ -1269,7 +1269,7 @@ static htri_t test_tfs_free(void *_obj, void *key, void *_obj_list) { else { /* Remove the object */ obj_ret = (test_tfs_obj_t *)H5SL_remove(obj_list->slist, &j); - CHECK(obj_ret, NULL, "H5SL_remove"); + CHECK_PTR(obj_ret, "H5SL_remove"); obj_ret->nfrees++; obj_list->nobjs_rem--; } /* end else */ @@ -1324,7 +1324,7 @@ test_skiplist_try_free_safe(void) /* Create a skip list */ obj_list.slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(obj_list.slist, NULL, "H5SL_create"); + CHECK_PTR(obj_list.slist, "H5SL_create"); /* Init obj_list.list */ obj_list.list = list; @@ -1396,7 +1396,7 @@ test_skiplist_less(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u=0; u<10; u++) { @@ -1430,7 +1430,7 @@ test_skiplist_less(void) VERIFY(*found_item,5,"H5SL_less"); find_item=4; found_item=(unsigned *)H5SL_less(slist,&find_item); - VERIFY(found_item,NULL,"H5SL_less"); + CHECK_PTR_NULL(found_item, "H5SL_less"); /* Close the skip list */ ret=H5SL_close(slist); @@ -1460,7 +1460,7 @@ test_skiplist_greater(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u = 0; u < 10; u++) { @@ -1488,7 +1488,7 @@ test_skiplist_greater(void) VERIFY(*found_item, 90, "H5SL_greater"); find_item = 100; found_item = (unsigned *)H5SL_greater(slist, &find_item); - VERIFY(found_item, NULL, "H5SL_greater"); + CHECK_PTR_NULL(found_item, "H5SL_greater"); find_item = 6; found_item = (unsigned *)H5SL_greater(slist, &find_item); VERIFY(*found_item, 10, "H5SL_greater"); @@ -1525,7 +1525,7 @@ test_skiplist_below(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u = 0; u < 10; u++) { @@ -1536,44 +1536,44 @@ test_skiplist_below(void) /* Check for exact match of items in various positions */ find_item = 20; node = H5SL_below(slist, &find_item); - CHECK(node, NULL, "H5SL_below"); + CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_below"); find_item = 90; node = H5SL_below(slist, &find_item); - CHECK(node, NULL, "H5SL_below"); + CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_below"); find_item = 5; node = H5SL_below(slist, &find_item); - CHECK(node, NULL, "H5SL_below"); + CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_below"); /* Find item less than a missing key, in various positions */ find_item = 19; node = H5SL_below(slist, &find_item); - CHECK(node, NULL, "H5SL_below"); + CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 15, "H5SL_below"); find_item = 89; node = H5SL_below(slist, &find_item); - CHECK(node, NULL, "H5SL_below"); + CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 80, "H5SL_below"); find_item = 100; node = H5SL_below(slist, &find_item); - CHECK(node, NULL, "H5SL_below"); + CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 90, "H5SL_below"); find_item = 9; node = H5SL_below(slist, &find_item); - CHECK(node, NULL, "H5SL_below"); + CHECK_PTR(node, "H5SL_below"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 5, "H5SL_below"); find_item = 4; node = (H5SL_node_t *)H5SL_less(slist, &find_item); - VERIFY(node, NULL, "H5SL_below"); + CHECK_PTR_NULL(node, "H5SL_below"); /* Close the skip list */ ret = H5SL_close(slist); @@ -1604,7 +1604,7 @@ test_skiplist_above(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u = 0; u < 10; u++) { @@ -1615,42 +1615,42 @@ test_skiplist_above(void) /* Check for exact match of items in various positions */ find_item = 20; node = H5SL_above(slist, &find_item); - CHECK(node, NULL, "H5SL_above"); + CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_above"); find_item = 90; node = H5SL_above(slist, &find_item); - CHECK(node, NULL, "H5SL_above"); + CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_above"); find_item = 5; node = H5SL_above(slist, &find_item); - CHECK(node, NULL, "H5SL_above"); + CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, find_item, "H5SL_above"); /* Find item greater than a missing key, in various positions */ find_item = 19; node = H5SL_above(slist, &find_item); - CHECK(node, NULL, "H5SL_above"); + CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 20, "H5SL_above"); find_item = 89; node = H5SL_above(slist, &find_item); - CHECK(node, NULL, "H5SL_above"); + CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 90, "H5SL_above"); find_item = 100; node = H5SL_above(slist, &find_item); - VERIFY(node, NULL, "H5SL_above"); + CHECK_PTR_NULL(node, "H5SL_above"); find_item = 6; node = H5SL_above(slist, &find_item); - CHECK(node, NULL, "H5SL_above"); + CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 10, "H5SL_above"); find_item = 4; node = H5SL_above(slist, &find_item); - CHECK(node, NULL, "H5SL_above"); + CHECK_PTR(node, "H5SL_above"); found_item = (unsigned *)H5SL_item(node); VERIFY(*found_item, 5, "H5SL_above"); @@ -1681,7 +1681,7 @@ test_skiplist_remove_first(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u = 0; u < 10; u++) { @@ -1697,7 +1697,7 @@ test_skiplist_remove_first(void) /* Check for removing object from empty list */ found_item = (unsigned *)H5SL_remove_first(slist); - VERIFY(found_item, NULL, "H5SL_remove_first"); + CHECK_PTR_NULL(found_item, "H5SL_remove_first"); /* Close the skip list */ ret = H5SL_close(slist); @@ -1725,7 +1725,7 @@ test_skiplist_remove_first_many(void) /* Create a skip list */ slist = H5SL_create(H5SL_TYPE_INT, NULL); - CHECK(slist, NULL, "H5SL_create"); + CHECK_PTR(slist, "H5SL_create"); /* Insert objects into the skip list */ for(u = 0; u < NUM_ELEMS; u++) { @@ -1742,7 +1742,7 @@ test_skiplist_remove_first_many(void) /* Check for removing object from empty list */ found_item = (int *)H5SL_remove_first(slist); - VERIFY(found_item, NULL, "H5SL_remove_first"); + CHECK_PTR_NULL(found_item, "H5SL_remove_first"); /* Close the skip list */ ret = H5SL_close(slist); diff --git a/test/ttst.c b/test/ttst.c index b26d582..c5912c5 100644 --- a/test/ttst.c +++ b/test/ttst.c @@ -157,7 +157,7 @@ test_tst_create(void) /* Try creating a TST */ tree=H5ST_create(); - CHECK(tree, NULL, "H5ST_create"); + CHECK_PTR(tree, "H5ST_create"); /* Try closing a real tree */ ret=H5ST_close(tree); @@ -186,7 +186,7 @@ test_tst_insert(void) /* Create the TST */ tree=H5ST_create(); - CHECK(tree, NULL, "H5ST_create"); + CHECK_PTR(tree, "H5ST_create"); /* Insert unique words into TST, in random order */ for(u=0; u<num_uniq_words; u++) { @@ -202,13 +202,13 @@ test_tst_insert(void) /* Check that the value "payloads" are correct */ found=H5ST_find(tree,uniq_words[u]); - CHECK(found, NULL, "H5ST_find"); + CHECK_PTR(found, "H5ST_find"); if(HDstrcmp((const char *)found->eqkid,uniq_words[u])) TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, uniq_words[%u]=%s\n",__LINE__,(char *)found->eqkid,(unsigned)u,uniq_words[u]); obj=H5ST_locate(tree,uniq_words[u]); - CHECK(obj, NULL, "H5ST_locate"); + CHECK_PTR(obj, "H5ST_locate"); if(HDstrcmp((const char *)obj,uniq_words[u])) TestErrPrintf("%d: TST objects don't match!, obj=%s, uniq_words[%u]=%s\n",__LINE__,(char *)obj,(unsigned)u,uniq_words[u]); @@ -246,7 +246,7 @@ test_tst_iterate(void) /* Create the TST */ tree=H5ST_create(); - CHECK(tree, NULL, "H5ST_create"); + CHECK_PTR(tree, "H5ST_create"); /* Insert unique words into TST, in random order */ for(u=0; u<num_uniq_words; u++) { @@ -256,7 +256,7 @@ test_tst_iterate(void) /* Use findfirst/findnext calls to iterate through TST */ found=H5ST_findfirst(tree); - CHECK(found, NULL, "H5ST_findfirst"); + CHECK_PTR(found, "H5ST_findfirst"); u=0; do { /* Check that the strings in the TST are in the correct order */ @@ -294,7 +294,7 @@ test_tst_remove(void) /* Create the TST */ tree=H5ST_create(); - CHECK(tree, NULL, "H5ST_create"); + CHECK_PTR(tree, "H5ST_create"); /* Insert unique words into TST, in random order */ for(u=0; u<num_uniq_words; u++) { @@ -305,7 +305,7 @@ test_tst_remove(void) /* Remove strings from TST in random order */ for(u=0; u<num_uniq_words; u++) { obj=H5ST_remove(tree,rand_uniq_words[u]); - CHECK(obj, NULL, "H5ST_remove"); + CHECK_PTR(obj, "H5ST_remove"); /* Check that the correct string was removed from TST */ if(HDstrcmp((const char *)obj,rand_uniq_words[u])) @@ -326,7 +326,7 @@ test_tst_remove(void) for(u=0; u<num_uniq_words; u++) { /* Get the pointer to the node to delete */ found=H5ST_find(tree,rand_uniq_words[u]); - CHECK(found, NULL, "H5ST_find"); + CHECK_PTR(found, "H5ST_find"); /* Check that the correct object will be removed from TST */ if(HDstrcmp((const char *)found->eqkid,rand_uniq_words[u])) diff --git a/test/tvltypes.c b/test/tvltypes.c index 5121a66..0c4cb9d 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -1015,9 +1015,9 @@ test_vltypes_compound_vlen_vlen(void) /* Allocate and initialize VL data to write */ wdata = (s1 *)HDmalloc(sizeof(s1) * SPACE3_DIM1); - CHECK(wdata, NULL, "HDmalloc"); + CHECK_PTR(wdata, "HDmalloc"); rdata = (s1 *)HDmalloc(sizeof(s1) * SPACE3_DIM1); - CHECK(rdata, NULL, "HDmalloc"); + CHECK_PTR(rdata, "HDmalloc"); for(i = 0; i < SPACE3_DIM1; i++) { wdata[i].i = (int)(i * 10); wdata[i].f = (float)(i * 20) / 3.0F; @@ -2503,7 +2503,7 @@ test_vltypes_fill_value(void) /* Allocate space for the buffer to read data */ rbuf = (dtype1_struct *)HDmalloc(SPACE4_DIM_LARGE * sizeof(dtype1_struct)); - CHECK(rbuf, NULL, "HDmalloc"); + CHECK_PTR(rbuf, "HDmalloc"); /* Create the small & large dataspaces to use */ |