From a00ad64f468e8ea4d19c17675258694a06febe32 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Tue, 18 Nov 2014 19:29:26 -0500 Subject: [svn-r25825] Bring revisions #25509 - #25762 from trunk to revise_chunks. h5committested. --- CMakeInstallation.cmake | 46 ++-- MANIFEST | 6 +- README.txt | 2 +- bin/cmakehdf5 | 20 +- c++/src/H5ArrayType.cpp | 53 +++-- c++/src/H5Attribute.cpp | 12 +- c++/src/H5CommonFG.cpp | 17 ++ c++/src/H5DataSet.cpp | 8 +- c++/src/H5DataSpace.cpp | 2 +- c++/src/H5DataSpace.h | 12 +- c++/src/H5DataType.cpp | 8 +- c++/src/H5EnumType.cpp | 1 + c++/src/H5Exception.cpp | 6 + c++/src/H5File.cpp | 18 +- c++/src/H5Group.cpp | 8 +- c++/src/H5IdComponent.cpp | 5 +- c++/src/H5Location.cpp | 4 + c++/src/H5PropList.cpp | 7 +- c++/src/H5StrType.cpp | 14 ++ c++/src/Makefile.in | 4 +- c++/test/dsets.cpp | 1 + c++/test/tfile.cpp | 4 +- c++/test/th5s.cpp | 4 +- c++/test/tlinks.cpp | 2 +- config/apple | 24 ++ config/cmake/CMakePackageConfigHelpers.cmake | 321 +++++++++++++++++++++++++++ config/cmake/ConfigureChecks.cmake | 2 +- config/cmake/cacheinit.cmake | 4 - config/cmake/hdf5-config-version.cmake.in | 56 +++-- config/cmake/hdf5-config.cmake.build.in | 73 ------ config/cmake/hdf5-config.cmake.in | 86 +++++++ config/cmake/hdf5-config.cmake.install.in | 81 ------- config/cmake/mccacheinit.cmake | 4 - config/gnu-flags | 2 +- config/lt_vers.am | 4 +- configure | 30 +-- configure.ac | 10 +- fortran/src/CMakeLists.txt | 23 +- fortran/src/H5Sf.c | 46 ++-- fortran/src/H5Tf.c | 35 +-- fortran/src/H5Tff.f90 | 71 +++--- fortran/src/Makefile.in | 4 +- fortran/test/tH5L_F03.f90 | 2 +- fortran/test/tH5P_F03.f90 | 39 ++++ hl/c++/src/Makefile.in | 4 +- hl/fortran/src/Makefile.in | 4 +- hl/fortran/test/tsttable.f90 | 21 +- hl/src/H5DS.c | 71 +++++- hl/src/H5IM.c | 129 +++++++++-- hl/src/H5LT.c | 107 ++++++++- hl/src/H5PT.c | 15 ++ hl/src/H5TB.c | 111 ++++++++- hl/src/Makefile.in | 4 +- hl/test/test_lite.c | 38 ++++ hl/test/test_table.c | 9 +- perform/perf.c | 18 +- release_docs/INSTALL | 38 ++-- release_docs/INSTALL_CMake.txt | 17 +- release_docs/INSTALL_parallel | 8 +- release_docs/RELEASE.txt | 42 ++-- release_docs/USING_HDF5_CMake.txt | 6 +- release_docs/USING_HDF5_VS.txt | 6 +- src/H5Adeprec.c | 2 +- src/H5C.c | 2 +- src/H5Dchunk.c | 7 +- src/H5Dmpio.c | 8 +- src/H5FDcore.c | 13 +- src/H5FDdirect.c | 10 +- src/H5FDfamily.c | 10 +- src/H5FDlog.c | 13 +- src/H5FDmpio.c | 41 ++-- src/H5FDmulti.c | 2 +- src/H5FDsec2.c | 13 +- src/H5P.c | 4 +- src/H5PLextern.h | 40 +--- src/H5PLprivate.h | 14 +- src/H5S.c | 2 +- src/H5Smpio.c | 60 ++--- src/H5public.h | 4 +- src/Makefile.in | 4 +- test/CMakeTests.cmake | 1 + test/dtypes.c | 16 +- test/h5test.c | 115 ++++++++-- test/h5test.h | 4 +- test/links.c | 4 +- test/tattr.c | 82 +++---- test/th5s.c | 5 +- test/trefer.c | 13 +- testpar/t_coll_chunk.c | 2 +- testpar/t_dset.c | 7 +- testpar/testphdf5.c | 2 +- tools/h5copy/h5copy.c | 4 +- tools/h5diff/CMakeTests.cmake | 7 +- tools/h5dump/CMakeTests.cmake | 6 + tools/h5dump/h5dumpgentest.c | 154 +++++++++++++ tools/h5repack/h5repack.c | 2 +- tools/h5repack/h5repack_copy.c | 2 +- tools/lib/h5diff.c | 14 +- tools/lib/h5tools_dump.c | 8 +- tools/lib/h5tools_ref.c | 2 +- tools/testfiles/tbitnopaque.ddl | 293 ++++++++++++++++++++++++ tools/testfiles/tbitnopaque.h5 | Bin 0 -> 8240 bytes vms/src/h5pubconf.h | 7 +- 103 files changed, 2122 insertions(+), 706 deletions(-) create mode 100644 config/cmake/CMakePackageConfigHelpers.cmake delete mode 100644 config/cmake/hdf5-config.cmake.build.in create mode 100644 config/cmake/hdf5-config.cmake.in delete mode 100644 config/cmake/hdf5-config.cmake.install.in create mode 100644 tools/testfiles/tbitnopaque.ddl create mode 100644 tools/testfiles/tbitnopaque.h5 diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 4b132ca..f82d3b4 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -1,3 +1,4 @@ +include (${HDF_RESOURCES_DIR}/CMakePackageConfigHelpers.cmake) #----------------------------------------------------------------------------- # Add file(s) to CMake Install @@ -16,7 +17,7 @@ endif (NOT HDF5_INSTALL_NO_DEVELOPMENT) if (NOT HDF5_EXTERNALLY_CONFIGURED) install ( EXPORT ${HDF5_EXPORTED_TARGETS} - DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/${HDF5_PACKAGE} + DESTINATION ${HDF5_INSTALL_CMAKE_DIR} FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake COMPONENT configinstall ) @@ -33,19 +34,32 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) endif (NOT HDF5_EXTERNALLY_CONFIGURED) #----------------------------------------------------------------------------- -# Configure the hdf5-config.cmake file for the build directory +# Set includes needed for build #----------------------------------------------------------------------------- set (HDF5_INCLUDES_BUILD_TIME ${HDF5_SRC_DIR} ${HDF5_CPP_SRC_DIR} ${HDF5_HL_SRC_DIR} ${HDF5_TOOLS_SRC_DIR} ${HDF5_BINARY_DIR} ) + +#----------------------------------------------------------------------------- +# Set variables needed for installation +#----------------------------------------------------------------------------- set (HDF5_VERSION_STRING ${HDF5_PACKAGE_VERSION}) set (HDF5_VERSION_MAJOR ${HDF5_PACKAGE_VERSION_MAJOR}) set (HDF5_VERSION_MINOR ${HDF5_PACKAGE_VERSION_MINOR}) -configure_file ( - ${HDF_RESOURCES_DIR}/hdf5-config.cmake.build.in - ${HDF5_BINARY_DIR}/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake @ONLY +#----------------------------------------------------------------------------- +# Configure the hdf5-config.cmake file for the build directory +#----------------------------------------------------------------------------- +set(INCLUDE_INSTALL_DIR HDF5_INSTALL_INCLUDE_DIR ) +set(SHARE_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/${HDF5_INSTALL_CMAKE_DIR}" ) +set(CURRENT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" ) +configure_package_config_file ( + ${HDF_RESOURCES_DIR}/hdf5-config.cmake.in + "${HDF5_BINARY_DIR}/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake" + INSTALL_DESTINATION "${HDF5_INSTALL_CMAKE_DIR}" + PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR + INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}" ) #----------------------------------------------------------------------------- @@ -58,7 +72,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) ) install ( FILES ${HDF5_BINARY_DIR}/CMakeFiles/FindHDF5${HDF_PACKAGE_EXT}.cmake - DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/${HDF5_PACKAGE} + DESTINATION ${HDF5_INSTALL_CMAKE_DIR} COMPONENT configinstall ) endif (NOT HDF5_EXTERNALLY_CONFIGURED) @@ -66,14 +80,20 @@ endif (NOT HDF5_EXTERNALLY_CONFIGURED) #----------------------------------------------------------------------------- # Configure the hdf5-config.cmake file for the install directory #----------------------------------------------------------------------------- +set(INCLUDE_INSTALL_DIR HDF5_INSTALL_INCLUDE_DIR ) +set(SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${HDF5_INSTALL_CMAKE_DIR}" ) +set(CURRENT_BUILD_DIR "${CMAKE_INSTALL_PREFIX}" ) +configure_package_config_file ( + ${HDF_RESOURCES_DIR}/hdf5-config.cmake.in + "${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake" + INSTALL_DESTINATION "${HDF5_INSTALL_CMAKE_DIR}" + PATH_VARS HDF5_INSTALL_INCLUDE_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR +) + if (NOT HDF5_EXTERNALLY_CONFIGURED) - configure_file ( - ${HDF_RESOURCES_DIR}/hdf5-config.cmake.install.in - ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake @ONLY - ) install ( FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake - DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/${HDF5_PACKAGE} + DESTINATION ${HDF5_INSTALL_CMAKE_DIR} COMPONENT configinstall ) endif (NOT HDF5_EXTERNALLY_CONFIGURED) @@ -88,7 +108,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) ) install ( FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake - DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/${HDF5_PACKAGE} + DESTINATION ${HDF5_INSTALL_CMAKE_DIR} COMPONENT configinstall ) endif (NOT HDF5_EXTERNALLY_CONFIGURED) @@ -107,7 +127,7 @@ configure_file ( ) install ( FILES ${HDF5_BINARY_DIR}/libhdf5.settings - DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/${HDF5_PACKAGE} + DESTINATION ${HDF5_INSTALL_CMAKE_DIR} COMPONENT libraries ) diff --git a/MANIFEST b/MANIFEST index 4ce3645..8324d1b 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1513,6 +1513,8 @@ ./tools/testfiles/tbinregR.exp ./tools/testfiles/tbinregR.ddl ./tools/testfiles/tbitfields.h5 +./tools/testfiles/tbitnopaque.ddl +./tools/testfiles/tbitnopaque.h5 ./tools/testfiles/tboot1.ddl ./tools/testfiles/tboot2.ddl ./tools/testfiles/tboot2A.ddl @@ -2555,14 +2557,14 @@ # CMake-specific Files ./config/cmake/cacheinit.cmake +./config/cmake/CMakePackageConfigHelpers.cmake ./config/cmake/ConversionTests.c ./config/cmake/ConfigureChecks.cmake ./config/cmake/CTestCustom.cmake ./config/cmake/FindHDF5.cmake.in ./config/cmake/H5cxx_config.h.in ./config/cmake/H5pubconf.h.in -./config/cmake/hdf5-config.cmake.build.in -./config/cmake/hdf5-config.cmake.install.in +./config/cmake/hdf5-config.cmake.in ./config/cmake/hdf5-config-version.cmake.in ./config/cmake/HDF5Macros.cmake ./config/cmake/libhdf5.settings.cmake.in diff --git a/README.txt b/README.txt index e51bb10..f7b3620 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.192-swmr0 currently under development +HDF5 version 1.9.203-swmr0 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/bin/cmakehdf5 b/bin/cmakehdf5 index 5da3cca..68a550e 100755 --- a/bin/cmakehdf5 +++ b/bin/cmakehdf5 @@ -26,6 +26,16 @@ installlog="#${progname}_5install.log" srcdir="../hdf5" # expected source directory exit_code=0 +# Cmake build options +hdf5_src=../hdf5 +cacheinit=$hdf5_src/config/cmake/cacheinit.cmake +build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=ON # C++ interface default on +build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=ON # Fortran interface default on +build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=ON # High Level interface default on +build_testing=-DBUILD_TESTING:BOOL=ON # Build tests default on +build_tools=-DHDF5_BUILD_TOOLS:BOOL=ON # Build tools default on + + #============= # Function definitions #============= @@ -99,7 +109,13 @@ fi echo Running Cmake for HDF5-${version} ... # 4. Configure the C library, tools and tests with this command: -STEP "Configure..." "cmake -G 'Unix Makefiles' -DBUILD_TESTING:BOOL=ON -DHDF5_BUILD_TOOLS:BOOL=ON ../hdf5" $configlog +STEP "Configure..." "cmake \ + $build_cpp_lib \ + $build_fortran \ + $build_hl_lib \ + $build_testing \ + $build_tools \ + $hdf5_src" $configlog # 5. Build the C library, tools and tests with this command: STEP "Build the library, tools and tests, ..." "cmake --build . --config Release" $makelog @@ -197,7 +213,7 @@ set (SITE_BUILDNAME_SUFFIX "cmakehdf5") # -- URL set for internal check, default is to not update set (LOCAL_SKIP_UPDATE TRUE) -set (REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf5/branches/hdf5_1_8") +set (REPOSITORY_URL "http://svn.${hdfgroup_url}/hdf5/branches/hdf5_1_8") # -- Standard build options set (ADD_BUILD_OPTIONS "-DCMAKE_INSTALL_PREFIX:PATH=${CTEST_BINARY_DIRECTORY} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=\"SVN\" -DHDF5_PACKAGE_EXTLIBS:BOOL=ON") diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp index 852658b..8807dca 100644 --- a/c++/src/H5ArrayType.cpp +++ b/c++/src/H5ArrayType.cpp @@ -54,15 +54,16 @@ ArrayType::ArrayType( const hid_t existing_id ) : DataType( existing_id ) rank = H5Tget_array_ndims(existing_id); if (rank < 0) { - throw DataTypeIException("ArrayType overloaded constructor", "H5Tget_array_ndims failed"); + throw DataTypeIException("ArrayType constructor (existing id)", "H5Tget_array_ndims failed"); } - // Get the dimensions of the existing array and store it in this array - dimensions = new hsize_t[rank]; - //hsize_t rdims2[H5S_MAX_RANK]; - int ret_value = H5Tget_array_dims2(id, dimensions); - if (ret_value < 0) - throw DataTypeIException("ArrayType::getArrayDims", "H5Tget_array_dims2 failed"); + // Allocate space for the dimensions + dimensions = new hsize_t[rank]; + + // Get the dimensions of the existing array and store it in this array + int ret_value = H5Tget_array_dims2(id, dimensions); + if (ret_value < 0) + throw DataTypeIException("ArrayType constructor (existing id)", "H5Tget_array_dims2 failed"); } //-------------------------------------------------------------------------- @@ -72,10 +73,13 @@ ArrayType::ArrayType( const hid_t existing_id ) : DataType( existing_id ) //-------------------------------------------------------------------------- ArrayType::ArrayType( const ArrayType& original ) : DataType( original ) { - rank = original.rank; - dimensions = new hsize_t[rank]; - for (int i = 0; i < rank; i++) - dimensions[i] = original.dimensions[i]; + // Copy the rank of the original array + rank = original.rank; + + // Allocate space then copy the dimensions from the original array + dimensions = new hsize_t[rank]; + for (int i = 0; i < rank; i++) + dimensions[i] = original.dimensions[i]; } //-------------------------------------------------------------------------- @@ -90,14 +94,19 @@ ArrayType::ArrayType( const ArrayType& original ) : DataType( original ) //-------------------------------------------------------------------------- ArrayType::ArrayType(const DataType& base_type, int ndims, const hsize_t* dims) : DataType() { - hid_t new_type_id = H5Tarray_create2(base_type.getId(), ndims, dims); - if (new_type_id < 0) - throw DataTypeIException("ArrayType constructor", "H5Tarray_create2 failed"); - id = new_type_id; - rank = ndims; - dimensions = new hsize_t[rank]; - for (int i = 0; i < rank; i++) - dimensions[i] = dims[i]; + // Call C API to create an array data type + hid_t new_type_id = H5Tarray_create2(base_type.getId(), ndims, dims); + if (new_type_id < 0) + throw DataTypeIException("ArrayType constructor", "H5Tarray_create2 failed"); + + // Set the id and rank for this object + id = new_type_id; + rank = ndims; + + // Allocate space then set the dimensions as provided by caller + dimensions = new hsize_t[rank]; + for (int i = 0; i < rank; i++) + dimensions[i] = dims[i]; } //-------------------------------------------------------------------------- @@ -132,19 +141,19 @@ int ArrayType::getArrayNDims() //-------------------------------------------------------------------------- int ArrayType::getArrayDims(hsize_t* dims) { - // if the array's dimensions have not been stored, retrieve them via C API + // If the array's dimensions have not been stored, retrieve them via C API if (dimensions == NULL) { int ndims = H5Tget_array_dims2(id, dims); if (ndims < 0) throw DataTypeIException("ArrayType::getArrayDims", "H5Tget_array_dims2 failed"); - // store the array's info in memory + // Store the array's info in memory rank = ndims; dimensions = new hsize_t[rank]; for (int i = 0; i < rank; i++) dimensions[i] = dims[i]; } - // otherwise, simply copy what's in 'dimensions' to 'dims' + // Otherwise, simply copy what's in 'dimensions' to 'dims' for (int i = 0; i < rank; i++) dims[i] = dimensions[i]; return(rank); diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index bdd0ac0..a9e928d 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -50,7 +50,7 @@ class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate ///\brief Default constructor: Creates a stub attribute // Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- -Attribute::Attribute() : AbstractDs(), IdComponent(), id(0) {} +Attribute::Attribute() : AbstractDs(), IdComponent(), id(H5I_INVALID_HID) {} //-------------------------------------------------------------------------- // Function: Attribute copy constructor @@ -162,13 +162,13 @@ void Attribute::read( const DataType& mem_type, void *buf ) const // Mar 2008 // Corrected a misunderstanding that H5Aread would allocate // space for the buffer. Obtained the attribute size and -// allocated memory properly. - BMR +// allocated memory properly. -BMR // Apr 2009 -// Used getInMemDataSize to get attribute data size. - BMR +// Used getInMemDataSize to get attribute data size. -BMR // Jul 2009 // Divided into specific private functions for fixed- and // variable-len string data: p_read_fixed_len and -// p_read_variable_len. This should improve readability. +// p_read_variable_len. This should improve readability. -BMR //-------------------------------------------------------------------------- void Attribute::read(const DataType& mem_type, H5std_string& strg) const { @@ -586,7 +586,7 @@ void Attribute::p_read_fixed_len(const DataType& mem_type, H5std_string& strg) c // Modification // Jul 2009 // Separated the variable length case from the original -// Attribute::read +// Attribute::read. -BMR //-------------------------------------------------------------------------- void Attribute::p_read_variable_len(const DataType& mem_type, H5std_string& strg) const { @@ -650,7 +650,7 @@ void Attribute::close() throw AttributeIException("Attribute::close", "H5Aclose failed"); } // reset the id - id = 0; + id = H5I_INVALID_HID; } } diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index d296db4..3aa0386 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -33,6 +33,9 @@ #include "H5Alltypes.h" #include "H5private.h" // for HDstrcpy +#include +using namespace std; + // There are a few comments that are common to most of the functions // defined in this file so they are listed here. // - getLocId is called by all functions, that call a C API, to get @@ -440,7 +443,10 @@ H5std_string CommonFG::getLinkval( const char* name, size_t size ) const ret_value = H5Lget_val(getLocId(), name, value_C, val_size, H5P_DEFAULT); if( ret_value < 0 ) + { + delete []value_C; throwException("getLinkval", "H5Lget_val failed"); + } value = H5std_string(value_C); delete []value_C; @@ -913,6 +919,12 @@ H5std_string CommonFG::getObjnameByIdx(hsize_t idx) const name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name_C, name_len+1, H5P_DEFAULT); + if (name_len < 0) + { + delete []name_C; + throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); + } + // clean up and return the string H5std_string name = H5std_string(name_C); delete []name_C; @@ -957,10 +969,15 @@ ssize_t CommonFG::getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) char* name_C = new char[size+1]; // temporary C-string for object name HDmemset(name_C, 0, size+1); // clear buffer + // call overloaded function to get the name ssize_t name_len = getObjnameByIdx(idx, name_C, size+1); if(name_len < 0) + { + delete []name_C; throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); + } + // clean up and return the string name = H5std_string(name_C); delete []name_C; return (name_len); diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index c34769e..6728264 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -52,7 +52,7 @@ namespace H5 { ///\brief Default constructor: creates a stub DataSet. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataSet::DataSet() : AbstractDs(), H5Object(), id(0) {} +DataSet::DataSet() : AbstractDs(), H5Object(), id(H5I_INVALID_HID) {} //-------------------------------------------------------------------------- // Function: DataSet overloaded constructor @@ -95,7 +95,7 @@ DataSet::DataSet(const DataSet& original) : AbstractDs(original), H5Object(origi // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : AbstractDs(), H5Object(), id(0) +DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : AbstractDs(), H5Object(), id(H5I_INVALID_HID) { id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereferenced"); } @@ -114,7 +114,7 @@ DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, co // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : AbstractDs(), H5Object(), id(0) +DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : AbstractDs(), H5Object(), id(H5I_INVALID_HID) { id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference"); } @@ -788,7 +788,7 @@ void DataSet::close() throw DataSetIException("DataSet::close", "H5Dclose failed"); } // reset the id - id = 0; + id = H5I_INVALID_HID; } } diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index 6ad8c8d..20b4e5e 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -630,7 +630,7 @@ void DataSpace::close() throw DataSpaceIException("DataSpace::close", "H5Sclose failed"); } // reset the id - id = 0; + id = H5I_INVALID_HID; } } diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h index 9efecdf..b007fd0 100644 --- a/c++/src/H5DataSpace.h +++ b/c++/src/H5DataSpace.h @@ -33,6 +33,12 @@ class H5_DLLCPP DataSpace : public IdComponent { // Creates a simple dataspace DataSpace(int rank, const hsize_t * dims, const hsize_t * maxdims = NULL); + // Creates a DataSpace object using an existing dataspace id. + DataSpace(const hid_t space_id); + + // Copy constructor: makes a copy of the original DataSpace object. + DataSpace(const DataSpace& original); + // Assignment operator DataSpace& operator=( const DataSpace& rhs ); @@ -109,12 +115,6 @@ class H5_DLLCPP DataSpace : public IdComponent { ///\brief Returns this class name. virtual H5std_string fromClass () const { return("DataSpace"); } - // Creates a DataSpace object using an existing dataspace id. - DataSpace(const hid_t space_id); - - // Copy constructor: makes a copy of the original DataSpace object. - DataSpace(const DataSpace& original); - // Gets the dataspace id. virtual hid_t getId() const; diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index afc5678..a435b4e 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -53,7 +53,7 @@ namespace H5 { ///\brief Default constructor: Creates a stub datatype // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataType::DataType() : H5Object(), id(0) {} +DataType::DataType() : H5Object(), id(H5I_INVALID_HID) {} //-------------------------------------------------------------------------- // Function: DataType overloaded constructor @@ -105,7 +105,7 @@ DataType::DataType( const H5T_class_t type_class, size_t size ) : H5Object() // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(0) +DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(H5I_INVALID_HID) { id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference"); } @@ -124,7 +124,7 @@ DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, // Jul, 2008 // Added for application convenience. //-------------------------------------------------------------------------- -DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(0) +DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(H5I_INVALID_HID) { id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference"); } @@ -710,7 +710,7 @@ void DataType::close() throw DataTypeIException(inMemFunc("close"), "H5Tclose failed"); } // reset the id - id = 0; + id = H5I_INVALID_HID; } } diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp index 04bb9e0..a91c053 100644 --- a/c++/src/H5EnumType.cpp +++ b/c++/src/H5EnumType.cpp @@ -159,6 +159,7 @@ H5std_string EnumType::nameOf( void *value, size_t size ) const // If H5Tenum_nameof returns a negative value, raise an exception, if( ret_value < 0 ) { + delete []name_C; throw DataTypeIException("EnumType::nameOf", "H5Tenum_nameof failed"); } // otherwise, create the string to hold the datatype name and return it diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp index 5e7ccd4..f153c92 100644 --- a/c++/src/H5Exception.cpp +++ b/c++/src/H5Exception.cpp @@ -80,8 +80,11 @@ H5std_string Exception::getMajorString( hid_t err_major ) const // Check for failure again if( mesg_size < 0 ) + { + delete []mesg_C; throw IdComponentException("Exception::getMajorString", "H5Eget_msg failed"); + } // Convert the C error description and return H5std_string major_str(mesg_C); @@ -116,8 +119,11 @@ H5std_string Exception::getMinorString( hid_t err_minor ) const // Check for failure again if( mesg_size < 0 ) + { + delete []mesg_C; throw IdComponentException("Exception::getMinorString", "H5Eget_msg failed"); + } // Convert the C error description and return H5std_string minor_str(mesg_C); diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index e4ac4a1..45e08b2 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -50,7 +50,7 @@ namespace H5 { ///\brief Default constructor: creates a stub H5File object. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5File::H5File() : H5Location(), id(0) {} +H5File::H5File() : H5Location(), id(H5I_INVALID_HID) {} //-------------------------------------------------------------------------- // Function: H5File overloaded constructor @@ -69,6 +69,10 @@ H5File::H5File() : H5Location(), id(0) {} /// the file. /// \li \c H5F_ACC_EXCL - Fail if file already exists. /// \c H5F_ACC_TRUNC and \c H5F_ACC_EXCL are mutually exclusive +/// \li \c H5F_ACC_RDONLY - Open file as read-only, if it already +/// exists, and fail, otherwise +/// \li \c H5F_ACC_RDWR - Open file for read/write, if it already +/// exists, and fail, otherwise /// \li \c H5F_ACC_DEBUG - print debug information. This flag is /// used only by HDF5 library developers; it is neither /// tested nor supported for use in applications. @@ -82,7 +86,7 @@ H5File::H5File() : H5Location(), id(0) {} // to catch then re-throw it. -BMR 2013/03/21 // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(), id(0) +H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(), id(H5I_INVALID_HID) { try { p_get_file(name, flags, create_plist, access_plist); @@ -107,7 +111,7 @@ H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& c // to catch then re-throw it. -BMR 2013/03/21 // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(), id(0) +H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(), id(H5I_INVALID_HID) { try { p_get_file(name.c_str(), flags, create_plist, access_plist); @@ -121,12 +125,15 @@ H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPro // This function is private and contains common code between the // constructors taking a string or a char* // Programmer Binh-Minh Ribler - 2000 +// Modification +// - removed H5F_ACC_CREAT because H5Fcreate will fail with +// H5F_ACC_CREAT. - BMR, Sep 17, 2014 //-------------------------------------------------------------------------- void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist) { // These bits only set for creation, so if any of them are set, // create the file. - if( flags & (H5F_ACC_CREAT|H5F_ACC_EXCL|H5F_ACC_TRUNC|H5F_ACC_DEBUG)) + if( flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC|H5F_ACC_DEBUG)) { hid_t create_plist_id = create_plist.getId(); hid_t access_plist_id = access_plist.getId(); @@ -147,6 +154,7 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro } } } + #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- @@ -596,7 +604,7 @@ void H5File::close() throw FileIException("H5File::close", "H5Fclose failed"); } // reset the id - id = 0; + id = H5I_INVALID_HID; } } diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index 7679315..cad5e29 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -51,7 +51,7 @@ namespace H5 { ///\brief Default constructor: creates a stub Group. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Group::Group() : H5Object(), id(0) {} +Group::Group() : H5Object(), id(H5I_INVALID_HID) {} //-------------------------------------------------------------------------- // Function: Group copy constructor @@ -100,7 +100,7 @@ Group::Group(const hid_t existing_id) : H5Object() /// is a datatype that has been named by DataType::commit. // Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- -Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(0) +Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(H5I_INVALID_HID) { id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference"); } @@ -115,7 +115,7 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const ///\exception H5::ReferenceException // Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- -Group::Group(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(0) +Group::Group(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(H5I_INVALID_HID) { id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference"); } @@ -181,7 +181,7 @@ void Group::close() throw GroupIException("Group::close", "H5Gclose failed"); } // reset the id - id = 0; + id = H5I_INVALID_HID; } } diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index 99a8dc4..4a9dcac 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -145,7 +145,7 @@ int IdComponent::getCounter() const //-------------------------------------------------------------------------- H5I_type_t IdComponent::getHDFObjType(const hid_t obj_id) { - if (obj_id == 0) + if (obj_id <= 0) return H5I_BADID; // invalid H5I_type_t id_type = H5Iget_type(obj_id); if (id_type <= H5I_BADID || id_type >= H5I_NTYPES) @@ -317,6 +317,7 @@ H5std_string IdComponent::p_get_file_name() const // Check for failure again if( name_size < 0 ) { + delete []name_C; throw IdComponentException("", "H5Fget_name failed"); } @@ -339,7 +340,7 @@ H5std_string IdComponent::p_get_file_name() const //-------------------------------------------------------------------------- bool IdComponent::p_valid_id(const hid_t obj_id) { - if (obj_id == 0) + if (obj_id <= 0) return false; H5I_type_t id_type = H5Iget_type(obj_id); diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index 9d3d7bf..cd733c4 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -33,6 +33,9 @@ #include "H5DataSet.h" #include "H5Attribute.h" #include "H5private.h" // for HDmemset +#include +using namespace std; + #ifndef H5_NO_NAMESPACE namespace H5 { @@ -551,6 +554,7 @@ H5std_string H5Location::getComment(const char* name, size_t buf_size) const ssize_t comment_len = getComment(name, tmp_len+1, comment_C); if (comment_len < 0) { + delete []comment_C; throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed"); } diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 0b740d8..5afe80f 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -46,7 +46,7 @@ const PropList PropList::DEFAULT; ///\brief Default constructor: creates a stub property list object. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -PropList::PropList() : IdComponent(), id(0) {} +PropList::PropList() : IdComponent(), id(H5P_DEFAULT) {} //-------------------------------------------------------------------------- // Function: PropList copy constructor @@ -74,7 +74,7 @@ PropList::PropList(const PropList& original) : IdComponent(original) //-------------------------------------------------------------------------- PropList::PropList( const hid_t plist_id ) : IdComponent() { - if (plist_id == 0) + if (plist_id <= 0) id = H5P_DEFAULT; H5I_type_t id_type = H5Iget_type(plist_id); @@ -277,7 +277,7 @@ void PropList::close() throw PropListIException(inMemFunc("close"), "H5Pclose failed"); } // reset the id - id = 0; + id = H5I_INVALID_HID; } } @@ -402,6 +402,7 @@ H5std_string PropList::getProperty(const char* name) const // Throw exception if H5Pget returns failure if (ret_value < 0) { + delete []prop_strg_C; throw PropListIException(inMemFunc("getProperty"), "H5Pget failed"); } diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp index a906b72..5195bba 100644 --- a/c++/src/H5StrType.cpp +++ b/c++/src/H5StrType.cpp @@ -146,6 +146,13 @@ StrType::StrType( const DataSet& dataset ) : AtomType () ///\brief Retrieves the character set type of this string datatype. ///\return Character set type, which can be: /// \li \c H5T_CSET_ASCII (0) - Character set is US ASCII. +///\note +/// ASCII and UTF-8 Unicode are the only currently supported character +/// encodings. Extended ASCII encodings (for example, ISO 8859) are not +/// supported. This encoding policy is not enforced by the HDF5 Library. +/// Using encodings other than ASCII and UTF-8 can lead to compatibility +/// and usability problems. See the C API entry H5Pset_char_encoding for +/// more information. ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- @@ -166,6 +173,13 @@ H5T_cset_t StrType::getCset() const ///\brief Sets character set to be used. ///\param cset - IN: character set type, which can be: /// \li \c H5T_CSET_ASCII (0) - Character set is US ASCII. +///\note +/// ASCII and UTF-8 Unicode are the only currently supported character +/// encodings. Extended ASCII encodings (for example, ISO 8859) are not +/// supported. This encoding policy is not enforced by the HDF5 Library. +/// Using encodings other than ASCII and UTF-8 can lead to compatibility +/// and usability problems. See the C API entry H5Pset_char_encoding for +/// more information. ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index b24733d..462925e 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -680,8 +680,10 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. +# After making changes, run bin/reconfigure to update other configure related +# files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 182 +LT_VERS_REVISION = 193 LT_VERS_AGE = 0 # This is our main target diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index d1ced1d..fc0ea3a 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -1083,6 +1083,7 @@ void test_dset() // Close the file before testing data size. file.close(); + nerrors += test_datasize(fapl) <0 ? 1:0; } catch (Exception E) diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 1f53e61..ad5e6fc 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -598,7 +598,7 @@ static void test_file_attribute() } // end of try block catch (Exception E) { - issue_fail_msg("test_file_name()", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_file_attribute()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_file_attribute() @@ -622,7 +622,7 @@ extern "C" void test_file() { // Output message about test being performed - MESSAGE(5, ("Testing File I/O operations\n")); + MESSAGE(5, ("Testing File I/O Operations\n")); test_file_create(); // Test file creation (also creation templates) test_file_open(); // Test file opening diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index cfdeb1f..b7a39b4 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -317,7 +317,7 @@ static void test_h5s_scalar_read() SUBTEST("Scalar Dataspace Reading"); try { - // Create file + // Open file H5File fid1(DATAFILE, H5F_ACC_RDWR); // Create a dataset @@ -506,7 +506,7 @@ static void test_h5s_compound_scalar_read() // Output message about test being performed SUBTEST("Compound Dataspace Reading"); try { - // Create file + // Open file H5File fid1(DATAFILE, H5F_ACC_RDWR); // Create a dataset diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index fca5918..291b649 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -15,7 +15,7 @@ /***************************************************************************** FILE tlinks.cpp - HDF5 C++ testing functionalities associated with the - C attribute interface (H5L) + C link interface (H5L) ***************************************************************************/ diff --git a/config/apple b/config/apple index ac93ea5..5203695 100644 --- a/config/apple +++ b/config/apple @@ -31,6 +31,20 @@ if test "X-" = "X-$CC"; then *) CC=clang CC_BASENAME=clang + + # Production + PROD_CFLAGS="-O3" + PROD_CPPFLAGS= + + # Debug + DEBUG_CFLAGS="-g -O0" + DEBUG_CPPFLAGS= + + # Profile + # Use this for profiling with gprof + # Just "-g" for now. More later. + PROFILE_CFLAGS="-g" + PROFILE_CPPFLAGS= ;; esac fi @@ -89,6 +103,16 @@ if test "X-" = "X-$CXX"; then esac fi +case $CXX_BASENAME in + clang++) + PROD_CXXFLAGS="-O3" + DEBUG_CXXFLAGS="-g -O0" + # Use this for profiling with gprof + # Just "-g" for now. More later. + PROFILE_CXXFLAGS="-g" + ;; +esac + # compiler version strings case $CC in clang) diff --git a/config/cmake/CMakePackageConfigHelpers.cmake b/config/cmake/CMakePackageConfigHelpers.cmake new file mode 100644 index 0000000..c6dc141 --- /dev/null +++ b/config/cmake/CMakePackageConfigHelpers.cmake @@ -0,0 +1,321 @@ +#.rst: +# CMakePackageConfigHelpers +# ------------------------- +# +# Helpers functions for creating config files that can be included by other +# projects to find and use a package. +# +# Adds the :command:`configure_package_config_file()` and +# :command:`write_basic_package_version_file()` commands. +# +# Generating a Package Configuration File +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# .. command:: configure_package_config_file +# +# Create a config file for a project:: +# +# configure_package_config_file( INSTALL_DESTINATION +# [PATH_VARS ... ] +# [NO_SET_AND_CHECK_MACRO] +# [NO_CHECK_REQUIRED_COMPONENTS_MACRO] +# [INSTALL_PREFIX ]) +# +# +# ``configure_package_config_file()`` should be used instead of the plain +# :command:`configure_file()` command when creating the ``Config.cmake`` +# or ``-config.cmake`` file for installing a project or library. It helps +# making the resulting package relocatable by avoiding hardcoded paths in the +# installed ``Config.cmake`` file. +# +# In a ``FooConfig.cmake`` file there may be code like this to make the install +# destinations know to the using project: +# +# .. code-block:: cmake +# +# set(FOO_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@" ) +# set(FOO_DATA_DIR "@CMAKE_INSTALL_PREFIX@/@RELATIVE_DATA_INSTALL_DIR@" ) +# set(FOO_ICONS_DIR "@CMAKE_INSTALL_PREFIX@/share/icons" ) +# ...logic to determine installedPrefix from the own location... +# set(FOO_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@" ) +# +# All 4 options shown above are not sufficient, since the first 3 hardcode the +# absolute directory locations, and the 4th case works only if the logic to +# determine the ``installedPrefix`` is correct, and if ``CONFIG_INSTALL_DIR`` +# contains a relative path, which in general cannot be guaranteed. This has the +# effect that the resulting ``FooConfig.cmake`` file would work poorly under +# Windows and OSX, where users are used to choose the install location of a +# binary package at install time, independent from how +# :variable:`CMAKE_INSTALL_PREFIX` was set at build/cmake time. +# +# Using ``configure_package_config_file`` helps. If used correctly, it makes +# the resulting ``FooConfig.cmake`` file relocatable. Usage: +# +# 1. write a ``FooConfig.cmake.in`` file as you are used to +# 2. insert a line containing only the string ``@PACKAGE_INIT@`` +# 3. instead of ``set(FOO_DIR "@SOME_INSTALL_DIR@")``, use +# ``set(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@")`` (this must be after the +# ``@PACKAGE_INIT@`` line) +# 4. instead of using the normal :command:`configure_file()`, use +# ``configure_package_config_file()`` +# +# +# +# The ```` and ```` arguments are the input and output file, the +# same way as in :command:`configure_file()`. +# +# The ```` given to ``INSTALL_DESTINATION`` must be the destination where +# the ``FooConfig.cmake`` file will be installed to. This path can either be +# absolute, or relative to the ``INSTALL_PREFIX`` path. +# +# The variables ```` to ```` given as ``PATH_VARS`` are the +# variables which contain install destinations. For each of them the macro will +# create a helper variable ``PACKAGE_``. These helper variables must be +# used in the ``FooConfig.cmake.in`` file for setting the installed location. +# They are calculated by ``configure_package_config_file`` so that they are +# always relative to the installed location of the package. This works both for +# relative and also for absolute locations. For absolute locations it works +# only if the absolute location is a subdirectory of ``INSTALL_PREFIX``. +# +# If the ``INSTALL_PREFIX`` argument is passed, this is used as base path to +# calculate all the relative paths. The ```` argument must be an absolute +# path. If this argument is not passed, the :variable:`CMAKE_INSTALL_PREFIX` +# variable will be used instead. The default value is good when generating a +# FooConfig.cmake file to use your package from the install tree. When +# generating a FooConfig.cmake file to use your package from the build tree this +# option should be used. +# +# By default ``configure_package_config_file`` also generates two helper macros, +# ``set_and_check()`` and ``check_required_components()`` into the +# ``FooConfig.cmake`` file. +# +# ``set_and_check()`` should be used instead of the normal ``set()`` command for +# setting directories and file locations. Additionally to setting the variable +# it also checks that the referenced file or directory actually exists and fails +# with a ``FATAL_ERROR`` otherwise. This makes sure that the created +# ``FooConfig.cmake`` file does not contain wrong references. +# When using the ``NO_SET_AND_CHECK_MACRO``, this macro is not generated +# into the ``FooConfig.cmake`` file. +# +# ``check_required_components()`` should be called at the end of +# the ``FooConfig.cmake`` file if the package supports components. This macro +# checks whether all requested, non-optional components have been found, and if +# this is not the case, sets the ``Foo_FOUND`` variable to ``FALSE``, so that +# the package is considered to be not found. It does that by testing the +# ``Foo__FOUND`` variables for all requested required components. +# When using the ``NO_CHECK_REQUIRED_COMPONENTS_MACRO`` option, this macro is +# not generated into the ``FooConfig.cmake`` file. +# +# For an example see below the documentation for +# :command:`write_basic_package_version_file()`. +# +# Generating a Package Version File +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# .. command:: write_basic_package_version_file +# +# Create a version file for a project:: +# +# write_basic_package_version_file( +# [VERSION ] +# COMPATIBILITY ) +# +# +# Writes a file for use as ``ConfigVersion.cmake`` file to +# ````. See the documentation of :command:`find_package()` for +# details on this. +# +# ```` is the output filename, it should be in the build tree. +# ```` is the version number of the project to be installed. +# +# If no ``VERSION`` is given, the :variable:`PROJECT_VERSION` variable is used. +# If this hasn't been set, it errors out. +# +# The ``COMPATIBILITY`` mode ``AnyNewerVersion`` means that the installed +# package version will be considered compatible if it is newer or exactly the +# same as the requested version. This mode should be used for packages which +# are fully backward compatible, also across major versions. +# If ``SameMajorVersion`` is used instead, then the behaviour differs from +# ``AnyNewerVersion`` in that the major version number must be the same as +# requested, e.g. version 2.0 will not be considered compatible if 1.0 is +# requested. This mode should be used for packages which guarantee backward +# compatibility within the same major version. +# If ``ExactVersion`` is used, then the package is only considered compatible if +# the requested version matches exactly its own version number (not considering +# the tweak version). For example, version 1.2.3 of a package is only +# considered compatible to requested version 1.2.3. This mode is for packages +# without compatibility guarantees. +# If your project has more elaborated version matching rules, you will need to +# write your own custom ``ConfigVersion.cmake`` file instead of using this +# macro. +# +# Internally, this macro executes :command:`configure_file()` to create the +# resulting version file. Depending on the ``COMPATIBLITY``, either the file +# ``BasicConfigVersion-SameMajorVersion.cmake.in`` or +# ``BasicConfigVersion-AnyNewerVersion.cmake.in`` is used. Please note that +# these two files are internal to CMake and you should not call +# :command:`configure_file()` on them yourself, but they can be used as starting +# point to create more sophisticted custom ``ConfigVersion.cmake`` files. +# +# Example Generating Package Files +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# Example using both :command:`configure_package_config_file` and +# ``write_basic_package_version_file()``: +# +# ``CMakeLists.txt``: +# +# .. code-block:: cmake +# +# set(INCLUDE_INSTALL_DIR include/ ... CACHE ) +# set(LIB_INSTALL_DIR lib/ ... CACHE ) +# set(SYSCONFIG_INSTALL_DIR etc/foo/ ... CACHE ) +# ... +# include(CMakePackageConfigHelpers) +# configure_package_config_file(FooConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake +# INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake +# PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR) +# write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake +# VERSION 1.2.3 +# COMPATIBILITY SameMajorVersion ) +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake +# DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake ) +# +# ``FooConfig.cmake.in``: +# +# .. code-block:: cmake +# +# set(FOO_VERSION x.y.z) +# ... +# @PACKAGE_INIT@ +# ... +# set_and_check(FOO_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") +# set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@") +# +# check_required_components(Foo) + + +#============================================================================= +# Copyright 2012 Alexander Neundorf +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(CMakeParseArguments) + +include(WriteBasicConfigVersionFile) + +macro(WRITE_BASIC_PACKAGE_VERSION_FILE) + write_basic_config_version_file(${ARGN}) +endmacro() + +function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) + set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO) + set(oneValueArgs INSTALL_DESTINATION INSTALL_PREFIX) + set(multiValueArgs PATH_VARS ) + + cmake_parse_arguments(CCF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(CCF_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to CONFIGURE_PACKAGE_CONFIG_FILE(): \"${CCF_UNPARSED_ARGUMENTS}\"") + endif() + + if(NOT CCF_INSTALL_DESTINATION) + message(FATAL_ERROR "No INSTALL_DESTINATION given to CONFIGURE_PACKAGE_CONFIG_FILE()") + endif() + + if(DEFINED CCF_INSTALL_PREFIX) + if(IS_ABSOLUTE "${CCF_INSTALL_PREFIX}") + set(installPrefix "${CCF_INSTALL_PREFIX}") + else() + message(FATAL_ERROR "INSTALL_PREFIX must be an absolute path") + endif() + else() + set(installPrefix "${CMAKE_INSTALL_PREFIX}") + endif() + + if(IS_ABSOLUTE "${CCF_INSTALL_DESTINATION}") + set(absInstallDir "${CCF_INSTALL_DESTINATION}") + else() + set(absInstallDir "${installPrefix}/${CCF_INSTALL_DESTINATION}") + endif() + + file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${installPrefix}" ) + + foreach(var ${CCF_PATH_VARS}) + if(NOT DEFINED ${var}) + message(FATAL_ERROR "Variable ${var} does not exist") + else() + if(IS_ABSOLUTE "${${var}}") + string(REPLACE "${installPrefix}" "\${PACKAGE_PREFIX_DIR}" + PACKAGE_${var} "${${var}}") + else() + set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}") + endif() + endif() + endforeach() + + get_filename_component(inputFileName "${_inputFile}" NAME) + + set(PACKAGE_INIT " +####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() ####### +####### Any changes to this file will be overwritten by the next CMake run #### +####### The input file was ${inputFileName} ######## + +get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE_RELATIVE_PATH}\" ABSOLUTE) +") + + if("${absInstallDir}" MATCHES "^(/usr)?/lib(64)?/.+") + # Handle "/usr move" symlinks created by some Linux distros. + set(PACKAGE_INIT "${PACKAGE_INIT} +# Use original install prefix when loaded through a \"/usr move\" +# cross-prefix symbolic link such as /lib -> /usr/lib. +get_filename_component(_realCurr \"\${CMAKE_CURRENT_LIST_DIR}\" REALPATH) +get_filename_component(_realOrig \"${absInstallDir}\" REALPATH) +if(_realCurr STREQUAL _realOrig) + set(PACKAGE_PREFIX_DIR \"${installPrefix}\") +endif() +unset(_realOrig) +unset(_realCurr) +") + endif() + + if(NOT CCF_NO_SET_AND_CHECK_MACRO) + set(PACKAGE_INIT "${PACKAGE_INIT} +macro(set_and_check _var _file) + set(\${_var} \"\${_file}\") + if(NOT EXISTS \"\${_file}\") + message(FATAL_ERROR \"File or directory \${_file} referenced by variable \${_var} does not exist !\") + endif() +endmacro() +") + endif() + + + if(NOT CCF_NO_CHECK_REQUIRED_COMPONENTS_MACRO) + set(PACKAGE_INIT "${PACKAGE_INIT} +macro(check_required_components _NAME) + foreach(comp \${\${_NAME}_FIND_COMPONENTS}) + if(NOT \${_NAME}_\${comp}_FOUND) + if(\${_NAME}_FIND_REQUIRED_\${comp}) + set(\${_NAME}_FOUND FALSE) + endif() + endif() + endforeach() +endmacro() +") + endif() + + set(PACKAGE_INIT "${PACKAGE_INIT} +####################################################################################") + + configure_file("${_inputFile}" "${_outputFile}" @ONLY) + +endfunction() diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 9330546..444ce0b 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -91,7 +91,7 @@ set (H5_DEFAULT_VFD H5FD_SEC2) if (NOT DEFINED "H5_DEFAULT_PLUGINDIR") if (WINDOWS) - set (H5_DEFAULT_PLUGINDIR "%ALLUSERSPROFILE%/hdf5/lib/plugin") + set (H5_DEFAULT_PLUGINDIR "%ALLUSERSPROFILE%\\\\hdf5\\\\lib\\\\plugin") else (WINDOWS) set (H5_DEFAULT_PLUGINDIR "/usr/local/hdf5/lib/plugin") endif (WINDOWS) diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index e8a5029..2c34e69 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -65,10 +65,6 @@ set (HDF5_NO_PACKAGES OFF CACHE BOOL "CPACK - Disable packaging" FORCE) set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO SVN TGZ)" FORCE) set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO SVN TGZ) -set (ZLIB_SVN_URL "http://svn.hdfgroup.uiuc.edu/zlib/trunk" CACHE STRING "Use ZLib from HDF repository" FORCE) - -set (SZIP_SVN_URL "http://svn.hdfgroup.uiuc.edu/szip/trunk" CACHE STRING "Use SZip from HDF repository" FORCE) - set (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE) set (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE) diff --git a/config/cmake/hdf5-config-version.cmake.in b/config/cmake/hdf5-config-version.cmake.in index 148a659..5911fa7 100644 --- a/config/cmake/hdf5-config-version.cmake.in +++ b/config/cmake/hdf5-config-version.cmake.in @@ -1,27 +1,47 @@ #----------------------------------------------------------------------------- # HDF5 Version file for install directory #----------------------------------------------------------------------------- +# +# The created file sets PACKAGE_VERSION_EXACT if the current version string and +# the requested version string are exactly the same and it sets +# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version, +# but only if the requested major.minor version is the same as the current one. +# The variable HDF5_VERSION_STRING must be set before calling configure_file(). -set (PACKAGE_VERSION @HDF5_VERSION_STRING@) +set (PACKAGE_VERSION "@HDF5_VERSION_STRING@") -if ("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL @H5_VERS_MAJOR@) - - # exact match for version @H5_VERS_MAJOR@.@H5_VERS_MINOR@ - if ("${PACKAGE_FIND_VERSION_MINOR}" EQUAL @H5_VERS_MINOR@) - - # compatible with any version @H5_VERS_MAJOR@.@H5_VERS_MINOR@.x - set (PACKAGE_VERSION_COMPATIBLE 1) +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + if ("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "@H5_VERS_MAJOR@") - if ("${PACKAGE_FIND_VERSION_PATCH}" EQUAL @H5_VERS_RELEASE@) - set (PACKAGE_VERSION_EXACT 1) - - if ("${PACKAGE_FIND_VERSION_TWEAK}" EQUAL @H5_VERS_SUBRELEASE@) - # not using this yet - endif ("${PACKAGE_FIND_VERSION_TWEAK}" EQUAL @H5_VERS_SUBRELEASE@) - - endif ("${PACKAGE_FIND_VERSION_PATCH}" EQUAL @H5_VERS_RELEASE@) + # exact match for version @H5_VERS_MAJOR@.@H5_VERS_MINOR@ + if ("${PACKAGE_FIND_VERSION_MINOR}" STREQUAL "@H5_VERS_MINOR@") - endif ("${PACKAGE_FIND_VERSION_MINOR}" EQUAL @H5_VERS_MINOR@) -endif ("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL @H5_VERS_MAJOR@) + # compatible with any version @H5_VERS_MAJOR@.@H5_VERS_MINOR@.x + set (PACKAGE_VERSION_COMPATIBLE TRUE) + + if ("${PACKAGE_FIND_VERSION_PATCH}" STREQUAL "@H5_VERS_RELEASE@") + set (PACKAGE_VERSION_EXACT TRUE) + + if ("${PACKAGE_FIND_VERSION_TWEAK}" STREQUAL "@H5_VERS_SUBRELEASE@") + # not using this yet + endif ("${PACKAGE_FIND_VERSION_TWEAK}" STREQUAL "@H5_VERS_SUBRELEASE@") + endif ("${PACKAGE_FIND_VERSION_PATCH}" STREQUAL "@H5_VERS_RELEASE@") + else ("${PACKAGE_FIND_VERSION_MINOR}" STREQUAL "@H5_VERS_MINOR@") + set (PACKAGE_VERSION_COMPATIBLE FALSE) + endif ("${PACKAGE_FIND_VERSION_MINOR}" STREQUAL "@H5_VERS_MINOR@") + endif ("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "@H5_VERS_MAJOR@") +endif() +# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") + return() +endif() +# check that the installed version has the same 32/64bit-ness as the one which is currently searching: +if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@") + math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8") + set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) +endif() diff --git a/config/cmake/hdf5-config.cmake.build.in b/config/cmake/hdf5-config.cmake.build.in deleted file mode 100644 index 0276ea7..0000000 --- a/config/cmake/hdf5-config.cmake.build.in +++ /dev/null @@ -1,73 +0,0 @@ -#----------------------------------------------------------------------------- -# HDF5 Config file for compiling against hdf5 build directory -#----------------------------------------------------------------------------- -GET_FILENAME_COMPONENT (SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) - -#----------------------------------------------------------------------------- -# User Options -#----------------------------------------------------------------------------- -set (HDF5_ENABLE_PARALLEL @HDF5_ENABLE_PARALLEL@) -set (HDF5_BUILD_FORTRAN @HDF5_BUILD_FORTRAN@) -set (HDF5_ENABLE_F2003 @HDF5_ENABLE_F2003@) -set (HDF5_BUILD_CPP_LIB @HDF5_BUILD_CPP_LIB@) -set (HDF5_BUILD_TOOLS @HDF5_BUILD_TOOLS@) -set (HDF5_BUILD_HL_LIB @HDF5_BUILD_HL_LIB@) -set (HDF5_ENABLE_Z_LIB_SUPPORT @HDF5_ENABLE_Z_LIB_SUPPORT@) -set (HDF5_ENABLE_SZIP_SUPPORT @HDF5_ENABLE_SZIP_SUPPORT@) -set (HDF5_ENABLE_SZIP_ENCODING @HDF5_ENABLE_SZIP_ENCODING@) -set (HDF5_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@) - -#----------------------------------------------------------------------------- -# Dependencies -#----------------------------------------------------------------------------- -IF(HDF5_ENABLE_PARALLEL) - SET(HDF5_MPI_C_INCLUDE_PATH "@MPI_C_INCLUDE_PATH@") - SET(HDF5_MPI_C_LIBRARIES "@MPI_C_LIBRARIES@") -ENDIF(HDF5_ENABLE_PARALLEL) - -#----------------------------------------------------------------------------- -# Directories -#----------------------------------------------------------------------------- -set (HDF5_INCLUDE_DIR "@HDF5_INCLUDES_BUILD_TIME@" "${HDF5_MPI_C_INCLUDE_PATH}" ) - -if (HDF5_BUILD_FORTRAN) - set (HDF5_INCLUDE_DIR_FORTRAN "@CMAKE_Fortran_MODULE_DIRECTORY@" ) -endif (HDF5_BUILD_FORTRAN) - -if (HDF5_BUILD_CPP_LIB) - set (HDF5_INCLUDE_DIR_CPP ${HDF5_INCLUDE_DIR} ) -endif (HDF5_BUILD_CPP_LIB) - -if (HDF5_BUILD_HL_LIB) - set (HDF5_INCLUDE_DIR_HL ${HDF5_INCLUDE_DIR} ) -endif (HDF5_BUILD_HL_LIB) - -if (HDF5_BUILD_HL_LIB AND HDF5_BUILD_CPP_LIB) - set (HDF5_INCLUDE_DIR_HL_CPP ${HDF5_INCLUDE_DIR} ) -endif (HDF5_BUILD_HL_LIB AND HDF5_BUILD_CPP_LIB) - -if (HDF5_BUILD_TOOLS) - set (HDF5_INCLUDE_DIR_TOOLS ${HDF5_INCLUDE_DIR} ) -endif (HDF5_BUILD_TOOLS) - -if (HDF5_BUILD_SHARED_LIBS) - set (H5_BUILT_AS_DYNAMIC_LIB 1 ) -else (HDF5_BUILD_SHARED_LIBS) - set (H5_BUILT_AS_STATIC_LIB 1 ) -endif (HDF5_BUILD_SHARED_LIBS) - -#----------------------------------------------------------------------------- -# Version Strings -#----------------------------------------------------------------------------- -set (HDF5_VERSION_STRING @HDF5_VERSION_STRING@) -set (HDF5_VERSION_MAJOR @HDF5_VERSION_MAJOR@) -set (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@) - -#----------------------------------------------------------------------------- -# Don't include targets if this file is being picked up by another -# project which has already build hdf5 as a subproject -#----------------------------------------------------------------------------- -if (NOT TARGET "@HDF5_PACKAGE@") - include (${SELF_DIR}/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake) - set (HDF5_LIBRARIES "@HDF5_LIBRARIES_TO_EXPORT@") -endif (NOT TARGET "@HDF5_PACKAGE@") diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in new file mode 100644 index 0000000..3e74aa7 --- /dev/null +++ b/config/cmake/hdf5-config.cmake.in @@ -0,0 +1,86 @@ +#----------------------------------------------------------------------------- +# HDF5 Config file for compiling against hdf5 build/install directory +#----------------------------------------------------------------------------- +@PACKAGE_INIT@ + +#----------------------------------------------------------------------------- +# User Options +#----------------------------------------------------------------------------- +set (HDF5_ENABLE_PARALLEL @HDF5_ENABLE_PARALLEL@) +set (HDF5_BUILD_FORTRAN @HDF5_BUILD_FORTRAN@) +set (HDF5_ENABLE_F2003 @HDF5_ENABLE_F2003@) +set (HDF5_BUILD_CPP_LIB @HDF5_BUILD_CPP_LIB@) +set (HDF5_BUILD_TOOLS @HDF5_BUILD_TOOLS@) +set (HDF5_BUILD_HL_LIB @HDF5_BUILD_HL_LIB@) +set (HDF5_ENABLE_Z_LIB_SUPPORT @HDF5_ENABLE_Z_LIB_SUPPORT@) +set (HDF5_ENABLE_SZIP_SUPPORT @HDF5_ENABLE_SZIP_SUPPORT@) +set (HDF5_ENABLE_SZIP_ENCODING @HDF5_ENABLE_SZIP_ENCODING@) +set (HDF5_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@) +set (HDF5_PACKAGE_EXTLIBS @HDF5_PACKAGE_EXTLIBS@) + +#----------------------------------------------------------------------------- +# Dependencies +#----------------------------------------------------------------------------- +IF(HDF5_ENABLE_PARALLEL) + SET(HDF5_MPI_C_INCLUDE_PATH "@MPI_C_INCLUDE_PATH@") + SET(HDF5_MPI_C_LIBRARIES "@MPI_C_LIBRARIES@") +ENDIF(HDF5_ENABLE_PARALLEL) + +#----------------------------------------------------------------------------- +# Directories +#----------------------------------------------------------------------------- +set (HDF5_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@" "${HDF5_MPI_C_INCLUDE_PATH}" ) + +set (HDF5_SHARE_DIR "@PACKAGE_SHARE_INSTALL_DIR@") +set_and_check (HDF5_BUILD_DIR "@PACKAGE_CURRENT_BUILD_DIR@") + +if (HDF5_BUILD_FORTRAN) + set (HDF5_INCLUDE_DIR_FORTRAN "@PACKAGE_INCLUDE_INSTALL_DIR@" ) +endif (HDF5_BUILD_FORTRAN) + +if (HDF5_BUILD_CPP_LIB) + set (HDF5_INCLUDE_DIR_CPP "@PACKAGE_INCLUDE_INSTALL_DIR@" ) +endif (HDF5_BUILD_CPP_LIB) + +if (HDF5_BUILD_HL_LIB) + set (HDF5_INCLUDE_DIR_HL "@PACKAGE_INCLUDE_INSTALL_DIR@" ) +endif (HDF5_BUILD_HL_LIB) + +if (HDF5_BUILD_HL_LIB AND HDF5_BUILD_CPP_LIB) + set (HDF5_INCLUDE_DIR_HL_CPP "@PACKAGE_INCLUDE_INSTALL_DIR@" ) +endif (HDF5_BUILD_HL_LIB AND HDF5_BUILD_CPP_LIB) + +if (HDF5_BUILD_TOOLS) + set (HDF5_INCLUDE_DIR_TOOLS "@PACKAGE_INCLUDE_INSTALL_DIR@" ) + set_and_check (HDF5_TOOLS_DIR "@PACKAGE_CURRENT_BUILD_DIR@/bin" ) +endif (HDF5_BUILD_TOOLS) + +if (HDF5_BUILD_SHARED_LIBS) + set (H5_BUILT_AS_DYNAMIC_LIB 1 ) +else (HDF5_BUILD_SHARED_LIBS) + set (H5_BUILT_AS_STATIC_LIB 1 ) +endif (HDF5_BUILD_SHARED_LIBS) + +#----------------------------------------------------------------------------- +# Version Strings +#----------------------------------------------------------------------------- +set (HDF5_VERSION_STRING @HDF5_VERSION_STRING@) +set (HDF5_VERSION_MAJOR @HDF5_VERSION_MAJOR@) +set (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@) + +#----------------------------------------------------------------------------- +# Don't include targets if this file is being picked up by another +# project which has already built hdf5 as a subproject +#----------------------------------------------------------------------------- +if (NOT TARGET "@HDF5_PACKAGE@") + if (HDF5_ENABLE_Z_LIB_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "zlib") + include (@PACKAGE_SHARE_INSTALL_DIR@/ZLIB/@ZLIB_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) + endif (HDF5_ENABLE_Z_LIB_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "zlib") + if (HDF5_ENABLE_SZIP_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "szip") + include (@PACKAGE_SHARE_INSTALL_DIR@/SZIP/@SZIP_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) + endif (HDF5_ENABLE_SZIP_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "szip") + include (@PACKAGE_SHARE_INSTALL_DIR@/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake) + set (HDF5_LIBRARIES "@HDF5_LIBRARIES_TO_EXPORT@") +endif (NOT TARGET "@HDF5_PACKAGE@") + +check_required_components(hdf5) diff --git a/config/cmake/hdf5-config.cmake.install.in b/config/cmake/hdf5-config.cmake.install.in deleted file mode 100644 index c275511..0000000 --- a/config/cmake/hdf5-config.cmake.install.in +++ /dev/null @@ -1,81 +0,0 @@ -#----------------------------------------------------------------------------- -# HDF5 Config file for compiling against hdf5 install directory -#----------------------------------------------------------------------------- -GET_FILENAME_COMPONENT (SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${SELF_DIR}" PATH) -GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) -if (NOT WIN32) - GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) -endif (NOT WIN32) - -#----------------------------------------------------------------------------- -# User Options -#----------------------------------------------------------------------------- -set (HDF5_ENABLE_PARALLEL @HDF5_ENABLE_PARALLEL@) -set (HDF5_BUILD_FORTRAN @HDF5_BUILD_FORTRAN@) -set (HDF5_ENABLE_F2003 @HDF5_ENABLE_F2003@) -set (HDF5_BUILD_CPP_LIB @HDF5_BUILD_CPP_LIB@) -set (HDF5_BUILD_TOOLS @HDF5_BUILD_TOOLS@) -set (HDF5_BUILD_HL_LIB @HDF5_BUILD_HL_LIB@) -set (HDF5_ENABLE_Z_LIB_SUPPORT @HDF5_ENABLE_Z_LIB_SUPPORT@) -set (HDF5_ENABLE_SZIP_SUPPORT @HDF5_ENABLE_SZIP_SUPPORT@) -set (HDF5_ENABLE_SZIP_ENCODING @HDF5_ENABLE_SZIP_ENCODING@) -set (HDF5_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@) -set (HDF5_PACKAGE_EXTLIBS @HDF5_PACKAGE_EXTLIBS@) - -#----------------------------------------------------------------------------- -# Dependencies -#----------------------------------------------------------------------------- -IF(HDF5_ENABLE_PARALLEL) - SET(HDF5_MPI_C_INCLUDE_PATH "@MPI_C_INCLUDE_PATH@") - SET(HDF5_MPI_C_LIBRARIES "@MPI_C_LIBRARIES@") -ENDIF(HDF5_ENABLE_PARALLEL) - -#----------------------------------------------------------------------------- -# Directories -#----------------------------------------------------------------------------- -set (HDF5_INCLUDE_DIR "${_IMPORT_PREFIX}/include" "${HDF5_MPI_C_INCLUDE_PATH}" ) - -if (HDF5_BUILD_FORTRAN) - set (HDF5_INCLUDE_DIR_FORTRAN "${_IMPORT_PREFIX}/include/fortran" ) -endif (HDF5_BUILD_FORTRAN) - -if (HDF5_BUILD_CPP_LIB) - set (HDF5_INCLUDE_DIR_CPP "${_IMPORT_PREFIX}/include/cpp" ) -endif (HDF5_BUILD_CPP_LIB) - -if (HDF5_BUILD_HL_LIB) - set (HDF5_INCLUDE_DIR_HL "${_IMPORT_PREFIX}/include/hl" ) -endif (HDF5_BUILD_HL_LIB) - -if (HDF5_BUILD_HL_LIB AND HDF5_BUILD_CPP_LIB) - set (HDF5_INCLUDE_DIR_HL_CPP "${_IMPORT_PREFIX}/include/hl/cpp" ) -endif (HDF5_BUILD_HL_LIB AND HDF5_BUILD_CPP_LIB) - -if (HDF5_BUILD_TOOLS) - set (HDF5_INCLUDE_DIR_TOOLS "${_IMPORT_PREFIX}/include" ) - set (HDF5_TOOLS_DIR "${_IMPORT_PREFIX}/bin" ) -endif (HDF5_BUILD_TOOLS) - -#----------------------------------------------------------------------------- -# Version Strings -#----------------------------------------------------------------------------- -set (HDF5_VERSION_STRING @HDF5_VERSION_STRING@) -set (HDF5_VERSION_MAJOR @HDF5_VERSION_MAJOR@) -set (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@) - -#----------------------------------------------------------------------------- -# Don't include targets if this file is being picked up by another -# project which has already built hdf5 as a subproject -#----------------------------------------------------------------------------- -if (NOT TARGET "@HDF5_PACKAGE@") - if (HDF5_ENABLE_Z_LIB_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "zlib") - include (${SELF_DIR}/../ZLIB/@ZLIB_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) - endif (HDF5_ENABLE_Z_LIB_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "zlib") - if (HDF5_ENABLE_SZIP_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "szip") - include (${SELF_DIR}/../SZIP/@SZIP_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) - endif (HDF5_ENABLE_SZIP_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "szip") - include (${SELF_DIR}/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake) - set (HDF5_LIBRARIES "@HDF5_LIBRARIES_TO_EXPORT@") -endif (NOT TARGET "@HDF5_PACKAGE@") - diff --git a/config/cmake/mccacheinit.cmake b/config/cmake/mccacheinit.cmake index 2913f32..a07e278 100644 --- a/config/cmake/mccacheinit.cmake +++ b/config/cmake/mccacheinit.cmake @@ -65,10 +65,6 @@ set (HDF5_NO_PACKAGES ON CACHE BOOL "CPACK - Disable packaging" FORCE) set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO SVN TGZ)" FORCE) set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO SVN TGZ) -set (ZLIB_SVN_URL "http://svn.hdfgroup.uiuc.edu/zlib/trunk" CACHE STRING "Use ZLib from HDF repository" FORCE) - -set (SZIP_SVN_URL "http://svn.hdfgroup.uiuc.edu/szip/trunk" CACHE STRING "Use SZip from HDF repository" FORCE) - set (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE) set (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE) diff --git a/config/gnu-flags b/config/gnu-flags index 5f36eaa..6c33808 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -321,7 +321,7 @@ case "$cc_vendor-$cc_version" in H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" # Append more extra warning flags that only gcc 4.5+ know about - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" + H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init" # Append more extra warning flags that only gcc 4.6+ know about H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" diff --git a/config/lt_vers.am b/config/lt_vers.am index f237db3..76bd50a 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -16,8 +16,10 @@ ## # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. +# After making changes, run bin/reconfigure to update other configure related +# files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 182 +LT_VERS_REVISION = 193 LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and diff --git a/configure b/configure index 7334480..653d614 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac Id: configure.ac 22697 2012-08-19 14:35:47Z hdftest . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for HDF5 1.9.192-swmr0. +# Generated by GNU Autoconf 2.69 for HDF5 1.9.203-swmr0. # # Report bugs to . # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='HDF5' PACKAGE_TARNAME='hdf5' -PACKAGE_VERSION='1.9.192-swmr0' -PACKAGE_STRING='HDF5 1.9.192-swmr0' +PACKAGE_VERSION='1.9.203-swmr0' +PACKAGE_STRING='HDF5 1.9.203-swmr0' PACKAGE_BUGREPORT='help@hdfgroup.org' PACKAGE_URL='' @@ -1489,7 +1489,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures HDF5 1.9.192-swmr0 to adapt to many kinds of systems. +\`configure' configures HDF5 1.9.203-swmr0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1559,7 +1559,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of HDF5 1.9.192-swmr0:";; + short | recursive ) echo "Configuration of HDF5 1.9.203-swmr0:";; esac cat <<\_ACEOF @@ -1752,7 +1752,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -HDF5 configure 1.9.192-swmr0 +HDF5 configure 1.9.203-swmr0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2846,7 +2846,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by HDF5 $as_me 1.9.192-swmr0, which was +It was created by HDF5 $as_me 1.9.203-swmr0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3717,7 +3717,7 @@ fi # Define the identity of the package. PACKAGE='hdf5' - VERSION='1.9.192-swmr0' + VERSION='1.9.203-swmr0' cat >>confdefs.h <<_ACEOF @@ -4003,7 +4003,11 @@ AM_CFLAGS="${AM_CFLAGS}" AM_CXXFLAGS="${AM_CXXFLAGS}" AM_FCFLAGS="${AM_FCFLAGS}" AM_CPPFLAGS="${AM_CPPFLAGS}" -AM_LDFLAGS="${AM_LDFLAGS}" +if test "x$prefix" = xNONE; then + AM_LDFLAGS="${AM_LDFLAGS} -L$ac_default_prefix/lib" +else + AM_LDFLAGS="$AM_LDFLAGS -L$prefix/lib" +fi CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" FCFLAGS="${FCFLAGS}" @@ -26240,7 +26244,7 @@ $as_echo_n "checking for szlib encoder... " >&6; } if test -z "$LD_LIBRARY_PATH"; then export LD_LIBRARY_PATH="$szlib_lib" else - export LD_LIBRARY_PATH="$szlib_lib:$LD_LIBRARY_PATH" + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$szlib_lib" fi LL_PATH="$LD_LIBRARY_PATH" @@ -31732,7 +31736,7 @@ Usage: $0 [OPTIONS] Report bugs to ." lt_cl_version="\ -HDF5 config.lt 1.9.192-swmr0 +HDF5 config.lt 1.9.203-swmr0 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. @@ -33874,7 +33878,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by HDF5 $as_me 1.9.192-swmr0, which was +This file was extended by HDF5 $as_me 1.9.203-swmr0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -33940,7 +33944,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -HDF5 config.status 1.9.192-swmr0 +HDF5 config.status 1.9.203-swmr0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 96ad6f8..8a4b350 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.9.192-swmr0], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.203-swmr0], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADER([src/H5config.h]) @@ -115,7 +115,11 @@ AM_CFLAGS="${AM_CFLAGS}" AM_CXXFLAGS="${AM_CXXFLAGS}" AM_FCFLAGS="${AM_FCFLAGS}" AM_CPPFLAGS="${AM_CPPFLAGS}" -AM_LDFLAGS="${AM_LDFLAGS}" +if test "x$prefix" = xNONE; then + AM_LDFLAGS="${AM_LDFLAGS} -L$ac_default_prefix/lib" +else + AM_LDFLAGS="$AM_LDFLAGS -L$prefix/lib" +fi CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" FCFLAGS="${FCFLAGS}" @@ -1904,7 +1908,7 @@ if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then if test -z "$LD_LIBRARY_PATH"; then export LD_LIBRARY_PATH="$szlib_lib" else - export LD_LIBRARY_PATH="$szlib_lib:$LD_LIBRARY_PATH" + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$szlib_lib" fi AC_SUBST([LL_PATH]) LL_PATH="$LD_LIBRARY_PATH" diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index a4407e5..c91d9e8 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -38,7 +38,6 @@ else (FORTRAN_HAVE_STORAGE_SIZE) add_executable (H5test_FortranHavekind ${HDF5_F90_SRC_SOURCE_DIR}/H5test_kind.f90 ) - set (H5_TEST_KIND_NAME "h5test_kind_mod") endif (FORTRAN_HAVE_SIZEOF) endif (FORTRAN_HAVE_STORAGE_SIZE) if (WIN32 AND MSVC) @@ -279,7 +278,6 @@ if (WIN32) install ( FILES ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5fortran_types.mod - ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/${H5_TEST_KIND_NAME}.mod ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/hdf5.mod ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5global.mod ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5a.mod @@ -312,11 +310,20 @@ if (WIN32) COMPONENT fortheaders ) + if (H5_TEST_KIND_NAME) + install ( + FILES + ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/${H5_TEST_KIND_NAME}.mod + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR} + COMPONENT + fortheaders + ) + endif (H5_TEST_KIND_NAME) else (WIN32) install ( FILES ${CMAKE_Fortran_MODULE_DIRECTORY}/h5fortran_types.mod - ${CMAKE_Fortran_MODULE_DIRECTORY}/${H5_TEST_KIND_NAME}.mod ${CMAKE_Fortran_MODULE_DIRECTORY}/hdf5.mod ${CMAKE_Fortran_MODULE_DIRECTORY}/h5global.mod ${CMAKE_Fortran_MODULE_DIRECTORY}/h5f.mod @@ -350,6 +357,16 @@ else (WIN32) COMPONENT fortheaders ) + if (H5_TEST_KIND_NAME) + install ( + FILES + ${CMAKE_Fortran_MODULE_DIRECTORY}/${H5_TEST_KIND_NAME}.mod + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR} + COMPONENT + fortheaders + ) + endif (H5_TEST_KIND_NAME) endif (WIN32) #----------------------------------------------------------------------------- diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c index 8e17026..f6803ac 100644 --- a/fortran/src/H5Sf.c +++ b/fortran/src/H5Sf.c @@ -97,7 +97,7 @@ nh5sclose_c ( hid_t_f *space_id ) int ret_value = 0; hid_t c_space_id; - c_space_id = *space_id; + c_space_id = (hid_t)*space_id; if ( H5Sclose(c_space_id) < 0 ) ret_value = -1; return ret_value; } @@ -163,7 +163,7 @@ nh5scopy_c( hid_t_f *space_id , hid_t_f *new_space_id) hid_t c_new_space_id; hid_t c_space_id; - c_space_id = *space_id; + c_space_id = (hid_t)*space_id; c_new_space_id = H5Scopy(c_space_id); if ( c_new_space_id < 0 ) ret_value = -1; @@ -201,7 +201,7 @@ nh5sget_select_hyper_nblocks_c( hid_t_f *space_id , hssize_t_f * num_blocks) hid_t c_space_id; hssize_t c_num_blocks; - c_space_id = *space_id; + c_space_id = (hid_t)*space_id; c_num_blocks = H5Sget_select_hyper_nblocks(c_space_id); if ( c_num_blocks < 0 ) ret_value = -1; @@ -239,7 +239,7 @@ nh5sget_select_elem_npoints_c( hid_t_f *space_id , hssize_t_f * num_points) hid_t c_space_id; hssize_t c_num_points; - c_space_id = *space_id; + c_space_id = (hid_t)*space_id; c_num_points = H5Sget_select_elem_npoints(c_space_id); if ( c_num_points < 0 ) ret_value = -1; @@ -278,8 +278,8 @@ nh5sget_select_elem_npoints_c( hid_t_f *space_id , hssize_t_f * num_points) */ int_f -nh5sget_select_hyper_blocklist_c( hid_t_f *space_id ,hsize_t_f * startblock, - hsize_t_f * num_blocks, hsize_t_f * buf) +nh5sget_select_hyper_blocklist_c( hid_t_f *space_id ,hsize_t_f *startblock, + hsize_t_f *num_blocks, hsize_t_f *buf) /******/ { int ret_value = -1; @@ -291,8 +291,8 @@ nh5sget_select_hyper_blocklist_c( hid_t_f *space_id ,hsize_t_f * startblock, int rank; hsize_t c_startblock, *c_buf; - c_space_id = *space_id; - c_num_blocks = * num_blocks; + c_space_id = (hid_t)*space_id; + c_num_blocks = (hsize_t)*num_blocks; rank = H5Sget_simple_extent_ndims(c_space_id); if (rank < 0 ) return ret_value; @@ -360,7 +360,7 @@ nh5sget_select_bounds_c( hid_t_f *space_id , hsize_t_f * start, hsize_t_f * end) int i, rank; int_f ret_value = 0; - c_space_id = *space_id; + c_space_id = (hid_t)*space_id; rank = H5Sget_simple_extent_ndims(c_space_id); if(rank < 0 ) HGOTO_DONE(FAIL) @@ -418,7 +418,7 @@ nh5sget_select_elem_pointlist_c( hid_t_f *space_id ,hsize_t_f * startpoint, int rank; int j,i2; - c_space_id = *space_id; + c_space_id = (hid_t)*space_id; c_num_points = (hsize_t)* numpoints; rank = H5Sget_simple_extent_ndims(c_space_id); @@ -479,7 +479,7 @@ nh5sselect_all_c ( hid_t_f *space_id ) int ret_value = 0; hid_t c_space_id; - c_space_id = *space_id; + c_space_id = (hid_t)*space_id; if ( H5Sselect_all(c_space_id) < 0 ) ret_value = -1; return ret_value; } @@ -508,7 +508,7 @@ nh5sselect_none_c ( hid_t_f *space_id ) int ret_value = 0; hid_t c_space_id; - c_space_id = *space_id; + c_space_id = (hid_t)*space_id; if ( H5Sselect_none(c_space_id) < 0 ) ret_value = -1; return ret_value; } @@ -542,7 +542,7 @@ nh5sselect_valid_c ( hid_t_f *space_id , int_f *flag ) hid_t c_space_id; htri_t status; - c_space_id = *space_id; + c_space_id = (hid_t)*space_id; status = H5Sselect_valid(c_space_id); *flag = (int_f)status; if ( status < 0 ) ret_value = -1; @@ -577,7 +577,7 @@ nh5sget_simple_extent_npoints_c ( hid_t_f *space_id , hsize_t_f *npoints ) hid_t c_space_id; hssize_t c_npoints; - c_space_id = *space_id; + c_space_id = (hid_t)*space_id; c_npoints = H5Sget_simple_extent_npoints(c_space_id); if ( c_npoints == 0 ) ret_value = -1; *npoints = (hsize_t_f)c_npoints; @@ -612,7 +612,7 @@ nh5sget_select_npoints_c ( hid_t_f *space_id , hssize_t_f *npoints ) hssize_t c_npoints; hid_t c_space_id; - c_space_id = *space_id; + c_space_id = (hid_t)*space_id; c_npoints = H5Sget_select_npoints(c_space_id); if ( c_npoints < 0 ) ret_value = -1; *npoints = (hssize_t_f)c_npoints; @@ -647,7 +647,7 @@ nh5sget_simple_extent_ndims_c ( hid_t_f *space_id , int_f *ndims ) hid_t c_space_id; int c_ndims; - c_space_id = *space_id; + c_space_id = (hid_t)*space_id; c_ndims = H5Sget_simple_extent_ndims(c_space_id); if ( c_ndims < 0 ) ret_value = -1; *ndims = (int_f)c_ndims; @@ -683,7 +683,7 @@ nh5sget_simple_extent_type_c ( hid_t_f *space_id , int_f *classtype) hid_t c_space_id; H5S_class_t c_classtype; - c_space_id = *space_id; + c_space_id = (hid_t)*space_id; c_classtype = H5Sget_simple_extent_type(c_space_id); if ( c_classtype < 0 ) ret_value = -1; *classtype = c_classtype; @@ -724,7 +724,7 @@ nh5soffset_simple_c ( hid_t_f *space_id , hssize_t_f *offset) int i; int_f ret_value = 0; - c_space_id = *space_id; + c_space_id = (hid_t)*space_id; rank = H5Sget_simple_extent_ndims(c_space_id); if(rank < 0) HGOTO_DONE(FAIL) @@ -820,7 +820,7 @@ nh5sget_simple_extent_dims_c ( hid_t_f *space_id , hsize_t_f *dims, hsize_t_f *m int i; int_f ret_value; - c_space_id = *space_id; + c_space_id = (hid_t)*space_id; rank = H5Sget_simple_extent_ndims(c_space_id); if(rank < 0) HGOTO_DONE(FAIL) @@ -871,7 +871,7 @@ nh5sis_simple_c ( hid_t_f *space_id , int_f *flag ) hid_t c_space_id; htri_t status; - c_space_id = *space_id; + c_space_id = (hid_t)*space_id; status = H5Sis_simple(c_space_id); *flag = (int_f)status; if ( status < 0 ) ret_value = -1; @@ -905,8 +905,8 @@ nh5sextent_copy_c ( hid_t_f *dest_space_id , hid_t_f *source_space_id) hid_t c_dest_space_id, c_source_space_id; herr_t status; - c_dest_space_id = *dest_space_id; - c_source_space_id = *source_space_id; + c_dest_space_id = (hid_t)*dest_space_id; + c_source_space_id = (hid_t)*source_space_id; status = H5Sextent_copy(c_dest_space_id, c_source_space_id); if ( status < 0 ) ret_value = -1; return ret_value; @@ -937,7 +937,7 @@ nh5sset_extent_none_c ( hid_t_f *space_id ) hid_t c_space_id; herr_t status; - c_space_id = *space_id; + c_space_id = (hid_t)*space_id; status = H5Sset_extent_none(c_space_id); if ( status < 0 ) ret_value = -1; return ret_value; diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c index df581ee..32cdb72 100644 --- a/fortran/src/H5Tf.c +++ b/fortran/src/H5Tf.c @@ -225,31 +225,32 @@ nh5tequal_c ( hid_t_f *type1_id , hid_t_f *type2_id, int_f *c_flag) return ret_value; } - /****if* H5Tf/h5tget_class_c * NAME - * h5tget_class_c + * h5tget_class_c * PURPOSE - * Call H5Tget_class to determine the datatype class + * Call H5Tget_class to determine the datatype class * INPUTS - * type_id - identifier of the dataspace + * type_id - identifier of the dataspace * OUTPUTS - * classtype - class type; possible values are: - * H5T_NO_CLASS_F (-1) - * H5T_INTEGER_F (0) - * H5T_FLOAT_F (1) - * H5T_TIME_F (2) - * H5T_STRING_F (3) - * H5T_BITFIELD_F (4) - * H5T_OPAQUE_F (5) - * H5T_COMPOUNDF (6) - * H5T_REFERENCE_F (7) - * H5T_ENUMF (8) + * classtype - class type; possible values are: + * H5T_NO_CLASS_F (-1) + * H5T_INTEGER_F (0) + * H5T_FLOAT_F (1) + * H5T_TIME_F (2) + * H5T_STRING_F (3) + * H5T_BITFIELD_F (4) + * H5T_OPAQUE_F (5) + * H5T_COMPOUNDF (6) + * H5T_REFERENCE_F (7) + * H5T_ENUM_F (8) + * H5T_VLEN_F (9) + * H5T_ARRAY_F (10) * RETURNS - * 0 on success, -1 on failure + * 0 on success, -1 on failure * AUTHOR * Elena Pourmal - * Saturday, August 14, 1999 + * Saturday, August 14, 1999 * HISTORY * * SOURCE diff --git a/fortran/src/H5Tff.f90 b/fortran/src/H5Tff.f90 index 89bd972..0e1dbb0 100644 --- a/fortran/src/H5Tff.f90 +++ b/fortran/src/H5Tff.f90 @@ -335,20 +335,22 @@ CONTAINS ! Returns the datatype class identifier. ! ! INPUTS -! type_id - datatype identifier +! type_id - Datatype identifier ! OUTPUTS -! class - class, possible values are: -! H5T_NO_CLASS_F (-1) -! H5T_INTEGER_F (0) -! H5T_FLOAT_F (1) -! H5T_TIME_F (2) -! H5T_STRING_F (3) -! H5T_BITFIELD_F (4) -! H5T_OPAQUE_F (5) -! H5T_COMPOUND_F (6) -! H5T_REFERENCE_F (7) -! H5T_ENUM_F (8) -! hdferr - Returns 0 if successful and -1 if fails +! class - Class, possible values are: +! H5T_NO_CLASS_F (-1) +! H5T_INTEGER_F (0) +! H5T_FLOAT_F (1) +! H5T_TIME_F (2) +! H5T_STRING_F (3) +! H5T_BITFIELD_F (4) +! H5T_OPAQUE_F (5) +! H5T_COMPOUND_F (6) +! H5T_REFERENCE_F (7) +! H5T_ENUM_F (8) +! H5T_VLEN_F (9) +! H5T_ARRAY_F (10) +! hdferr - Returns 0 if successful and -1 if fails ! ! AUTHOR ! Elena Pourmal @@ -361,35 +363,24 @@ CONTAINS ! ! SOURCE SUBROUTINE h5tget_class_f(type_id, class, hdferr) - IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier - INTEGER, INTENT(OUT) :: class - ! Datatype class, possible values are: - ! H5T_NO_CLASS_F (-1) - ! H5T_INTEGER_F (0) - ! H5T_FLOAT_F (1) - ! H5T_TIME_F (2) - ! H5T_STRING_F (3) - ! H5T_BITFIELD_F (4) - ! H5T_OPAQUE_F (5) - ! H5T_COMPOUND_F (6) - ! H5T_REFERENCE_F (7) - ! H5T_ENUM_F (8) - INTEGER, INTENT(OUT) :: hdferr ! Error code + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: type_id + INTEGER, INTENT(OUT) :: class + INTEGER, INTENT(OUT) :: hdferr !***** - INTERFACE - INTEGER FUNCTION h5tget_class_c(type_id, class) - USE H5GLOBAL - !DEC$IF DEFINED(HDF5F90_WINDOWS) - !DEC$ATTRIBUTES C,reference,decorate,alias:'H5TGET_CLASS_C'::h5tget_class_c - !DEC$ENDIF - INTEGER(HID_T), INTENT(IN) :: type_id - INTEGER, INTENT(OUT) :: class - END FUNCTION h5tget_class_c - END INTERFACE + INTERFACE + INTEGER FUNCTION h5tget_class_c(type_id, class) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5TGET_CLASS_C'::h5tget_class_c + !DEC$ENDIF + INTEGER(HID_T), INTENT(IN) :: type_id + INTEGER, INTENT(OUT) :: class + END FUNCTION h5tget_class_c + END INTERFACE - hdferr = h5tget_class_c(type_id, class) - END SUBROUTINE h5tget_class_f + hdferr = h5tget_class_c(type_id, class) + END SUBROUTINE h5tget_class_f ! !****s* H5T/h5tget_size_f ! diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index 315636c..79f6f42 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -731,8 +731,10 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. +# After making changes, run bin/reconfigure to update other configure related +# files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 182 +LT_VERS_REVISION = 193 LT_VERS_AGE = 0 AM_FCLIBS = $(LIBHDF5) diff --git a/fortran/test/tH5L_F03.f90 b/fortran/test/tH5L_F03.f90 index 8cc17fb..795f1e2 100644 --- a/fortran/test/tH5L_F03.f90 +++ b/fortran/test/tH5L_F03.f90 @@ -58,7 +58,7 @@ CONTAINS !** !*************************************************************** - INTEGER FUNCTION liter_cb(group, name, link_info, op_data) bind(C) + INTEGER(KIND=C_INT) FUNCTION liter_cb(group, name, link_info, op_data) bind(C) USE HDF5 USE ISO_C_BINDING diff --git a/fortran/test/tH5P_F03.f90 b/fortran/test/tH5P_F03.f90 index ae48114..945d0a5 100644 --- a/fortran/test/tH5P_F03.f90 +++ b/fortran/test/tH5P_F03.f90 @@ -111,6 +111,10 @@ SUBROUTINE test_create(total_error) INTEGER(SIZE_T) :: h5off TYPE(C_PTR) :: f_ptr LOGICAL :: differ1, differ2 + CHARACTER(LEN=1) :: cfill + INTEGER :: ifill + REAL :: rfill + REAL(KIND=dp) :: dpfill !/* ! * Create a file. @@ -162,6 +166,41 @@ SUBROUTINE test_create(total_error) f_ptr = C_LOC(fill_ctype) + ! Test various fill values + CALL H5Pset_fill_value_f(dcpl, H5T_NATIVE_CHARACTER, 'X', error) + CALL check("H5Pset_fill_value_f",error, total_error) + CALL h5pget_fill_value_f(dcpl, H5T_NATIVE_CHARACTER, cfill, error) + CALL check("H5Pget_fill_value_f",error, total_error) + IF(cfill.NE.'X')THEN + PRINT*,"***ERROR: Returned wrong fill value (character)" + total_error = total_error + 1 + ENDIF + CALL H5Pset_fill_value_f(dcpl, H5T_NATIVE_INTEGER, 9, error) + CALL check("H5Pset_fill_value_f",error, total_error) + CALL h5pget_fill_value_f(dcpl, H5T_NATIVE_INTEGER, ifill, error) + CALL check("H5Pget_fill_value_f",error, total_error) + IF(ifill.NE.9)THEN + PRINT*,"***ERROR: Returned wrong fill value (integer)" + total_error = total_error + 1 + ENDIF + CALL H5Pset_fill_value_f(dcpl, H5T_NATIVE_DOUBLE, 1.0_dp, error) + CALL check("H5Pset_fill_value_f",error, total_error) + CALL h5pget_fill_value_f(dcpl, H5T_NATIVE_DOUBLE, dpfill, error) + CALL check("H5Pget_fill_value_f",error, total_error) + IF(.NOT.dreal_eq( REAL(dpfill,dp), 1.0_dp))THEN + PRINT*,"***ERROR: Returned wrong fill value (double)" + total_error = total_error + 1 + ENDIF + CALL H5Pset_fill_value_f(dcpl, H5T_NATIVE_REAL, 2.0, error) + CALL check("H5Pset_fill_value_f",error, total_error) + CALL h5pget_fill_value_f(dcpl, H5T_NATIVE_REAL, rfill, error) + CALL check("H5Pget_fill_value_f",error, total_error) + IF(.NOT.dreal_eq( REAL(rfill,dp), REAL(2.0,dp)))THEN + PRINT*,"***ERROR: Returned wrong fill value (real)" + total_error = total_error + 1 + ENDIF + + ! For the actual compound type CALL H5Pset_fill_value_f(dcpl, comp_type_id, f_ptr, error) CALL check("H5Pget_fill_value_f",error, total_error) diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in index c321eaf..ec5e670 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -672,8 +672,10 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. +# After making changes, run bin/reconfigure to update other configure related +# files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 182 +LT_VERS_REVISION = 193 LT_VERS_AGE = 0 # This is our main target diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index c8b6f7d..2122d72 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -687,8 +687,10 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. +# After making changes, run bin/reconfigure to update other configure related +# files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 182 +LT_VERS_REVISION = 193 LT_VERS_AGE = 0 # Our main target, the high-level fortran library diff --git a/hl/fortran/test/tsttable.f90 b/hl/fortran/test/tsttable.f90 index 66ec5c6..bb88abf 100644 --- a/hl/fortran/test/tsttable.f90 +++ b/hl/fortran/test/tsttable.f90 @@ -175,13 +175,30 @@ SUBROUTINE test_table1() CALL h5tbwrite_field_name_f(file_id,dsetname1,field_names(4),start,nrecords,type_sizer,& bufr,errcode) - !------------------------------------------------------------------------- ! read field !------------------------------------------------------------------------- + ! Read an invalid field, should fail + CALL h5tbread_field_name_f(file_id,dsetname1,'DoesNotExist',start,nrecords,type_sizec,& + bufsr,errcode) + + IF(errcode.GE.0)THEN + PRINT *, 'error in h5tbread_field_name_f' + CALL h5fclose_f(file_id, errcode) + CALL h5close_f(errcode) + STOP + ENDIF + + ! Read a valid field, should pass CALL h5tbread_field_name_f(file_id,dsetname1,field_names(1),start,nrecords,type_sizec,& bufsr,errcode) + IF(errcode.LT.0)THEN + PRINT *, 'error in h5tbread_field_name_f' + CALL h5fclose_f(file_id, errcode) + CALL h5close_f(errcode) + STOP + ENDIF ! ! compare read and write buffers. @@ -329,8 +346,6 @@ SUBROUTINE test_table1() ! we insert a field callsed "field5" with the same type and buffer as field 4 (Real) !------------------------------------------------------------------------- - - CALL test_begin(' Insert field ') CALL h5tbinsert_field_f(file_id,dsetname1,"field5",field_types(4),4,bufr,errcode) diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 15d2f21..f4b754a 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -1444,6 +1444,9 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) if (H5I_DATASET != it) return FAIL; + if (label == NULL) + return FAIL; + /* get dataset space */ if ((sid = H5Dget_space(did)) < 0) return FAIL; @@ -1546,7 +1549,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) /* free the ptr that will be replaced by label */ if (buf[idx]) - HDfree((void *)buf[idx]); + HDfree(buf[idx]); /* store the label information in the required index */ buf[idx] = label; @@ -1562,7 +1565,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) for (i = 0; i < (unsigned int) rank; i++) { if (buf[i]) - HDfree((void *)buf[i]); + HDfree(buf[i]); } /* close */ @@ -1589,7 +1592,7 @@ out: for (i = 0; i < (unsigned int) rank; i++) { if (buf[i]) - HDfree((void *)buf[i]); + HDfree(buf[i]); } HDfree(buf); } @@ -1912,11 +1915,12 @@ out: htri_t H5DSis_scale(hid_t did) { hid_t tid = -1; /* attribute type ID */ - hid_t aid; /* attribute ID */ + hid_t aid = -1; /* attribute ID */ herr_t has_class; /* has the "CLASS" attribute */ htri_t is_ds; /* boolean return value */ H5I_type_t it; /* ID type */ - char buf[20]; + char *buf; /* Name of attribute */ + hsize_t storage_size; /* Size of storage for attribute */ /*------------------------------------------------------------------------- * parameter checking @@ -1944,19 +1948,41 @@ htri_t H5DSis_scale(hid_t did) if((tid = H5Aget_type(aid)) < 0) goto out; + /* check to make sure attribute is a string */ + if(H5T_STRING != H5Tget_class(tid)) + goto out; + + /* check to make sure string is null-terminated */ + if(H5T_STR_NULLTERM != H5Tget_strpad(tid)) + goto out; + + /* allocate buffer large enough to hold string */ + if((storage_size = H5Aget_storage_size(aid)) == 0) + goto out; + + buf = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1); + if(buf == NULL) + goto out; + + /* Read the attribute */ if(H5Aread(aid, tid, buf) < 0) - goto out; + goto out; - if(strcmp(buf, DIMENSION_SCALE_CLASS)==0) + /* compare strings */ + if(HDstrncmp(buf, DIMENSION_SCALE_CLASS, MIN(HDstrlen(DIMENSION_SCALE_CLASS),HDstrlen(buf)))==0) is_ds = 1; else is_ds = 0; + HDfree(buf); + if(H5Tclose(tid) < 0) goto out; if (H5Aclose(aid) < 0) goto out; + + } return is_ds; @@ -2118,7 +2144,8 @@ herr_t H5DS_is_reserved(hid_t did) int has_class; hid_t tid = -1; hid_t aid = -1; - char buf[40]; + char *buf; /* Name of attribute */ + hsize_t storage_size; /* Size of storage for attribute */ herr_t ret; /* try to find the attribute "CLASS" on the dataset */ @@ -2135,16 +2162,36 @@ herr_t H5DS_is_reserved(hid_t did) if((tid = H5Aget_type(aid)) < 0) goto out; + /* check to make sure attribute is a string */ + if(H5T_STRING != H5Tget_class(tid)) + goto out; + + /* check to make sure string is null-terminated */ + if(H5T_STR_NULLTERM != H5Tget_strpad(tid)) + goto out; + + /* allocate buffer large enough to hold string */ + if((storage_size = H5Aget_storage_size(aid)) == 0) + goto out; + + buf = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1); + if(buf == NULL) + goto out; + + /* Read the attribute */ if(H5Aread(aid, tid, buf) < 0) - goto out; + goto out; + - if(strcmp(buf, IMAGE_CLASS) == 0 || - strcmp(buf, PALETTE_CLASS) == 0 || - strcmp(buf, TABLE_CLASS) == 0 ) + if(HDstrncmp(buf, IMAGE_CLASS, MIN(HDstrlen(IMAGE_CLASS),HDstrlen(buf))) == 0 || + HDstrncmp(buf, PALETTE_CLASS, MIN(HDstrlen(PALETTE_CLASS),HDstrlen(buf))) == 0 || + HDstrncmp(buf, TABLE_CLASS, MIN(HDstrlen(TABLE_CLASS),HDstrlen(buf))) == 0 ) ret = 1; else ret = 0; + HDfree(buf); + if (H5Tclose(tid) < 0) goto out; diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c index 9239e4e..aeda6ab 100644 --- a/hl/src/H5IM.c +++ b/hl/src/H5IM.c @@ -46,6 +46,10 @@ herr_t H5IMmake_image_8bit( hid_t loc_id, { hsize_t dims[IMAGE8_RANK]; + /* check the arguments */ + if (dset_name == NULL) + return -1; + /* Initialize the image dimensions */ dims[0] = height; dims[1] = width; @@ -103,9 +107,16 @@ herr_t H5IMmake_image_24bit( hid_t loc_id, { hsize_t dims[IMAGE24_RANK]; + /* check the arguments */ + if (interlace == NULL) + return -1; + if (dset_name == NULL) + return -1; + + /* Initialize the image dimensions */ - if ( strcmp( interlace, "INTERLACE_PIXEL" ) == 0 ) + if ( HDstrncmp( interlace, "INTERLACE_PIXEL",15 ) == 0 ) { /* Number of color planes is defined as the third dimension */ dims[0] = height; @@ -113,7 +124,7 @@ herr_t H5IMmake_image_24bit( hid_t loc_id, dims[2] = IMAGE24_RANK; } else - if ( strcmp( interlace, "INTERLACE_PLANE" ) == 0 ) + if ( HDstrncmp( interlace, "INTERLACE_PLANE",15 ) == 0 ) { /* Number of color planes is defined as the first dimension */ dims[0] = IMAGE24_RANK; @@ -172,6 +183,10 @@ static herr_t find_palette(hid_t loc_id, { int ret = H5_ITER_CONT; + /* check the arguments */ + if (name == NULL) + return -1; + /* Shut compiler up */ loc_id = loc_id; ainfo = ainfo; op_data = op_data; @@ -179,7 +194,7 @@ static herr_t find_palette(hid_t loc_id, * cause the iterator to immediately return that positive value, * indicating short-circuit success */ - if(strcmp(name, "PALETTE") == 0) + if(HDstrncmp(name, "PALETTE",7) == 0) ret = H5_ITER_STOP; return ret; @@ -250,6 +265,12 @@ herr_t H5IMget_image_info( hid_t loc_id, int has_pal; int has_attr; + /* check the arguments */ + if (dset_name == NULL) + return -1; + if (interlace == NULL) + return -1; + /*assume initially we have no palettes attached*/ *npals = 0; @@ -294,7 +315,7 @@ herr_t H5IMget_image_info( hid_t loc_id, /* This is a 24 bit image */ { - if ( strcmp( interlace, "INTERLACE_PIXEL" ) == 0 ) + if ( HDstrncmp( interlace, "INTERLACE_PIXEL", 15 ) == 0 ) { /* Number of color planes is defined as the third dimension */ *height = dims[0]; @@ -302,14 +323,14 @@ herr_t H5IMget_image_info( hid_t loc_id, *planes = dims[2]; } else - if ( strcmp( interlace, "INTERLACE_PLANE" ) == 0 ) + if ( HDstrncmp( interlace, "INTERLACE_PLANE", 15 ) == 0 ) { /* Number of color planes is defined as the first dimension */ *planes = dims[0]; *height = dims[1]; *width = dims[2]; } - else return -1; + else return -1; } else /* This is a 8 bit image */ @@ -410,6 +431,10 @@ herr_t H5IMread_image( hid_t loc_id, { hid_t did; + /* check the arguments */ + if (dset_name == NULL) + return -1; + /* Open the dataset. */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; @@ -460,6 +485,10 @@ herr_t H5IMmake_palette( hid_t loc_id, int has_pal; + /* check the arguments */ + if (pal_name == NULL) + return -1; + /* Check if the dataset already exists */ has_pal = H5LTfind_dataset( loc_id, pal_name ); @@ -523,6 +552,13 @@ herr_t H5IMlink_palette( hid_t loc_id, hsize_t dim_ref; int ok_pal; + + /* check the arguments */ + if (image_name == NULL) + return -1; + if (pal_name == NULL) + return -1; + /* The image dataset may or may not have the attribute "PALETTE" * First we try to open to see if it is already there; if not, it is created. * If it exists, the array of references is extended to hold the reference @@ -685,6 +721,12 @@ herr_t H5IMunlink_palette( hid_t loc_id, H5T_class_t aclass; int ok_pal, has_pal; + /* check the arguments */ + if(image_name == NULL) + return -1; + if(pal_name == NULL) + return -1; + /* Try to find the palette dataset */ has_pal = H5LTfind_dataset( loc_id, pal_name ); @@ -780,6 +822,10 @@ herr_t H5IMget_npalettes( hid_t loc_id, H5T_class_t aclass; int has_pal; + /* check the arguments */ + if(image_name == NULL) + return -1; + /*assume initially we have no palettes attached*/ *npals = 0; @@ -875,6 +921,10 @@ herr_t H5IMget_palette_info( hid_t loc_id, hid_t pal_space_id; hsize_t pal_maxdims[2]; + /* check the arguments */ + if (image_name == NULL) + return -1; + /* Open the dataset. */ if((did = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0) return -1; @@ -986,6 +1036,13 @@ herr_t H5IMget_palette( hid_t loc_id, hobj_ref_t *refbuf; /* buffer to read references */ hid_t pal_id; + /* check the arguments */ + if (image_name == NULL) + return -1; + if (pal_data == NULL) + return -1; + + /* Open the dataset. */ if((did = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0) return -1; @@ -1078,10 +1135,15 @@ herr_t H5IMis_image( hid_t loc_id, hid_t did; int has_class; hid_t atid; - hid_t aid; - char attr_data[20]; + hid_t aid = -1; + char* attr_data; /* Name of attribute */ + hsize_t storage_size; /* Size of storage for attribute */ herr_t ret; + /* check the arguments */ + if (dset_name == NULL) + return -1; + /* Assume initially fail condition */ ret = -1; @@ -1106,17 +1168,32 @@ herr_t H5IMis_image( hid_t loc_id, if((atid = H5Aget_type(aid)) < 0) goto out; - if(H5Tget_class(atid) < 0) - goto out; + /* check to make sure attribute is a string */ + if(H5T_STRING != H5Tget_class(atid)) + goto out; + + /* check to make sure string is null-terminated */ + if(H5T_STR_NULLTERM != H5Tget_strpad(atid)) + goto out; + + /* allocate buffer large enough to hold string */ + if((storage_size = H5Aget_storage_size(aid)) == 0) + goto out; + + attr_data = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1); + if(attr_data == NULL) + goto out; if(H5Aread(aid, atid, attr_data) < 0) goto out; - if(strcmp(attr_data, IMAGE_CLASS) == 0) + if(HDstrncmp(attr_data, IMAGE_CLASS, MIN(HDstrlen(IMAGE_CLASS),HDstrlen(attr_data))) == 0) ret = 1; else ret = 0; + HDfree(attr_data); + if ( H5Tclose( atid ) < 0) goto out; @@ -1163,10 +1240,15 @@ herr_t H5IMis_palette( hid_t loc_id, hid_t did; int has_class; hid_t atid; - hid_t aid; - char attr_data[20]; + hid_t aid = -1; + char* attr_data; /* Name of attribute */ + hsize_t storage_size; /* Size of storage for attribute */ herr_t ret; + /* check the arguments */ + if (dset_name == NULL) + return -1; + /* Assume initially fail condition */ ret = -1; @@ -1191,17 +1273,32 @@ herr_t H5IMis_palette( hid_t loc_id, if((atid = H5Aget_type(aid)) < 0) goto out; - if(H5Tget_class(atid) < 0) - goto out; + /* check to make sure attribute is a string */ + if(H5T_STRING != H5Tget_class(atid)) + goto out; + + /* check to make sure string is null-terminated */ + if(H5T_STR_NULLTERM != H5Tget_strpad(atid)) + goto out; + + /* allocate buffer large enough to hold string */ + if((storage_size = H5Aget_storage_size(aid)) == 0) + goto out; + + attr_data = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1); + if(attr_data == NULL) + goto out; if(H5Aread(aid, atid, attr_data) < 0) goto out; - if(strcmp(attr_data, PALETTE_CLASS) == 0) + if(HDstrncmp(attr_data, PALETTE_CLASS, MIN(HDstrlen(PALETTE_CLASS),HDstrlen(attr_data))) == 0) ret = 1; else ret = 0; + HDfree(attr_data); + if ( H5Tclose( atid ) < 0) goto out; diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 6003c60..ed725a3 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -523,6 +523,10 @@ H5LT_make_dataset_numerical( hid_t loc_id, { hid_t did = -1, sid = -1; + /* check the arguments */ + if (dset_name == NULL) + return -1; + /* Create the data space for the dataset. */ if((sid = H5Screate_simple(rank, dims, NULL)) < 0) return -1; @@ -798,6 +802,10 @@ herr_t H5LTmake_dataset_string(hid_t loc_id, hid_t tid = -1; size_t size; + /* check the arguments */ + if (dset_name == NULL) + return -1; + /* create a string data type */ if((tid = H5Tcopy(H5T_C_S1)) < 0 ) goto out; @@ -976,6 +984,10 @@ H5LT_read_dataset_numerical(hid_t loc_id, const char *dset_name, hid_t tid, void { hid_t did; + /* check the arguments */ + if (dset_name == NULL) + return -1; + /* Open the dataset. */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; @@ -1167,6 +1179,10 @@ herr_t H5LTread_dataset_string( hid_t loc_id, hid_t did = -1; hid_t tid = -1; + /* check the arguments */ + if (dset_name == NULL) + return -1; + /* Open the dataset. */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; @@ -1216,6 +1232,10 @@ herr_t H5LTget_dataset_ndims( hid_t loc_id, hid_t did = -1; hid_t sid = -1; + /* check the arguments */ + if (dset_name == NULL) + return -1; + /* Open the dataset. */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; @@ -1272,6 +1292,10 @@ herr_t H5LTget_dataset_info( hid_t loc_id, hid_t tid = -1; hid_t sid = -1; + /* check the arguments */ + if (dset_name == NULL) + return -1; + /* open the dataset. */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; @@ -1345,6 +1369,10 @@ find_dataset(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *op_d */ int ret = 0; + /* check the arguments */ + if (name == NULL) + return ret; + /* Shut the compiler up */ loc_id = loc_id; linfo = linfo; @@ -1353,7 +1381,7 @@ find_dataset(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *op_d * cause the iterator to immediately return that positive value, * indicating short-circuit success */ - if(HDstrcmp(name, (char *)op_data) == 0) + if(HDstrncmp(name, (char *)op_data, HDstrlen((char *)op_data)) == 0) ret = 1; return ret; @@ -1428,6 +1456,14 @@ herr_t H5LTset_attribute_string( hid_t loc_id, int has_attr; size_t attr_size; + /* check the arguments */ + if (obj_name == NULL) + return -1; + if (attr_name == NULL) + return -1; + if (attr_data == NULL) + return -1; + /* Open the object */ if ((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) return -1; @@ -1517,6 +1553,12 @@ herr_t H5LT_set_attribute_numerical( hid_t loc_id, hsize_t dim_size=size; int has_attr; + /* check the arguments */ + if (obj_name == NULL) + return -1; + if (attr_name == NULL) + return -1; + /* Open the object */ if ((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) return -1; @@ -1928,6 +1970,10 @@ find_attr(hid_t loc_id, const char *name, const H5A_info_t *ainfo, { int ret = H5_ITER_CONT; + /* check the arguments */ + if (name == NULL) + return H5_ITER_CONT; + /* Shut compiler up */ loc_id = loc_id; ainfo = ainfo; @@ -1935,7 +1981,7 @@ find_attr(hid_t loc_id, const char *name, const H5A_info_t *ainfo, * cause the iterator to immediately return that positive value, * indicating short-circuit success */ - if(HDstrcmp(name, (char *)op_data) == 0) + if(HDstrncmp(name, (char *)op_data, HDstrlen((char *)op_data)) == 0) ret = H5_ITER_STOP; return ret; @@ -2020,6 +2066,12 @@ herr_t H5LTget_attribute_ndims( hid_t loc_id, hid_t sid; hid_t obj_id; + /* check the arguments */ + if (obj_name == NULL) + return -1; + if (attr_name == NULL) + return -1; + /* Open the object */ if((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) return -1; @@ -2087,6 +2139,12 @@ herr_t H5LTget_attribute_info( hid_t loc_id, hid_t sid; hid_t obj_id; + /* check the arguments */ + if (obj_name == NULL) + return -1; + if (attr_name == NULL) + return -1; + /* Open the object */ if((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) return -1; @@ -2162,6 +2220,10 @@ hid_t H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type) { hid_t type_id; + /* check the arguments */ + if (text == NULL) + return -1; + if(lang_type <= H5LT_LANG_ERR || lang_type >= H5LT_NO_LANG) goto out; @@ -2205,6 +2267,8 @@ out: static char* realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, char *str_to_add) { + size_t size_str_to_add, size_str; + if(_no_user_buf) { /* If the buffer isn't big enough, reallocate it. Otherwise, go to do strcat. */ if(str_to_add && ((ssize_t)(*len - (HDstrlen(buf) + HDstrlen(str_to_add) + 1)) < LIMIT)) { @@ -2219,8 +2283,25 @@ realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, char *str_to_ad if(!buf) goto out; - if(str_to_add) - HDstrcat(buf, str_to_add); + if(str_to_add) { + /* find the size of the buffer to add */ + size_str_to_add = HDstrlen(str_to_add); + /* find the size of the current buffer */ + size_str = HDstrlen(buf); + + /* Check to make sure the appended string does not + * extend past the allocated buffer; if it does then truncate the string + */ + if(size_str < *len - 1) { + if( size_str + size_str_to_add < *len - 1) { + HDstrncat(buf, str_to_add, size_str_to_add); + } else { + HDstrncat(buf, str_to_add, (*len - 1) - size_str); + } + } else { + buf[*len-1] = '\0'; /* buffer is full, null terminate */ + } + } return buf; @@ -3019,6 +3100,12 @@ herr_t H5LTget_attribute_string( hid_t loc_id, /* identifiers */ hid_t obj_id; + /* check the arguments */ + if (obj_name == NULL) + return -1; + if (attr_name == NULL) + return -1; + /* Open the object */ if ((obj_id = H5Oopen( loc_id, obj_name, H5P_DEFAULT)) < 0) return -1; @@ -3439,6 +3526,12 @@ static herr_t H5LT_get_attribute_mem(hid_t loc_id, hid_t obj_id = -1; hid_t attr_id = -1; + /* check the arguments */ + if (obj_name == NULL) + return -1; + if (attr_name == NULL) + return -1; + /* Open the object */ if((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) goto out; @@ -3618,6 +3711,12 @@ H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid) /* Initialize */ ret_value = FALSE; + /* check the arguments */ + if (path == NULL) { + ret_value = FAIL; + goto done; + } + /* Find the type of loc_id */ if((obj_type = H5Iget_type(loc_id)) == H5I_BADID) { ret_value = FAIL; diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c index d3a03cd..7a0bc20 100644 --- a/hl/src/H5PT.c +++ b/hl/src/H5PT.c @@ -84,6 +84,11 @@ hid_t H5PTcreate_fl ( hid_t loc_id, hsize_t maxdims[1]; hid_t ret_value; + /* check the arguments */ + if (dset_name == NULL) { + goto out; + } + /* Register the packet table ID type if this is the first table created */ if(H5PT_ptable_id_type < 0) if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0) @@ -178,6 +183,11 @@ hid_t H5PTcreate_vl ( hid_t loc_id, hid_t ret_value=H5I_BADID; hid_t vltype; + /* check the arguments */ + if (dset_name == NULL) { + goto out; + } + /* Create a variable length type that uses single bytes as its base type */ vltype = H5Tvlen_create(H5T_NATIVE_UCHAR); if(vltype < 0) @@ -232,6 +242,11 @@ hid_t H5PTopen( hid_t loc_id, hid_t ret_value; hsize_t dims[1]; + /* check the arguments */ + if (dset_name == NULL) { + goto out; + } + /* Register the packet table ID type if this is the first table created */ if( H5PT_ptable_id_type < 0) if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0) diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index a1456ea..1ca41a8 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -94,6 +94,17 @@ herr_t H5TBmake_table(const char *table_title, hsize_t i; herr_t ret_val = -1; + /* check the arguments */ + if (table_title == NULL) { + goto out; + } + if (dset_name == NULL) { + goto out; + } + if (field_names == NULL) { + goto out; + } + dims[0] = nrecords; dims_chunk[0] = chunk_size; @@ -290,6 +301,10 @@ herr_t H5TBappend_records(hid_t loc_id, hsize_t nfields; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + /* get the original number of records and fields */ if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords_orig) < 0) goto out; @@ -360,6 +375,10 @@ herr_t H5TBwrite_records(hid_t loc_id, hsize_t dims[1]; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + /* open the dataset. */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; @@ -459,6 +478,12 @@ herr_t H5TBwrite_fields_name(hid_t loc_id, size_t size_native; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + if (field_names == NULL) + goto out; + /* create xfer properties to preserve initialized data */ if((preserve_id = H5Pcreate(H5P_DATASET_XFER)) < 0) goto out; @@ -616,6 +641,10 @@ herr_t H5TBwrite_fields_index(hid_t loc_id, char *member_name = NULL; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + /* create xfer properties to preserve initialized data */ if((preserve_id = H5Pcreate(H5P_DATASET_XFER)) < 0) goto out; @@ -773,6 +802,10 @@ herr_t H5TBread_table(hid_t loc_id, hsize_t dims[1]; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + /* open the dataset. */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; @@ -846,6 +879,10 @@ herr_t H5TBread_records(hid_t loc_id, hsize_t nfields; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + /* get the number of records and fields */ if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords_orig) < 0) goto out; @@ -922,6 +959,13 @@ herr_t H5TBread_fields_name(hid_t loc_id, hssize_t i, j; herr_t ret_val = -1; + + /* check the arguments */ + if (dset_name == NULL) + goto out; + if (field_names == NULL) + goto out; + /* open the dataset */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; @@ -938,7 +982,7 @@ herr_t H5TBread_fields_name(hid_t loc_id, if((mem_type_id = H5Tcreate(H5T_COMPOUND, type_size)) < 0) goto out; - /* iterate tru the members */ + /* iterate through the members */ for(i = 0, j = 0; i < nfields; i++) { /* get the member name */ if(NULL == (member_name = H5Tget_member_name(ftype_id, (unsigned)i))) @@ -984,6 +1028,10 @@ herr_t H5TBread_fields_name(hid_t loc_id, member_name = NULL; } /* end for */ + /* check to make sure field was found, no reason to continue if it does not exist */ + if(j == 0) + goto out; + /* get the dataspace handle */ if((sid = H5Dget_space(did)) < 0) goto out; @@ -1074,6 +1122,10 @@ herr_t H5TBread_fields_index(hid_t loc_id, char *member_name = NULL; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + /* open the dataset. */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; @@ -1231,6 +1283,11 @@ herr_t H5TBdelete_record(hid_t loc_id, unsigned char *tmp_buf = NULL; herr_t ret_val = -1; + + /* check the arguments */ + if (dset_name == NULL) + goto out; + /*------------------------------------------------------------------------- * first we get information about type size and offsets on disk *------------------------------------------------------------------------- @@ -1390,6 +1447,10 @@ herr_t H5TBinsert_record(hid_t loc_id, unsigned char *tmp_buf = NULL; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + /*------------------------------------------------------------------------- * read the records after the inserted one(s) *------------------------------------------------------------------------- @@ -1541,6 +1602,12 @@ herr_t H5TBadd_records_from(hid_t loc_id, unsigned char *tmp_buf = NULL; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name1 == NULL) + goto out; + if (dset_name2 == NULL) + goto out; + /*------------------------------------------------------------------------- * first we get information about type size and offsets on disk *------------------------------------------------------------------------- @@ -1688,6 +1755,14 @@ herr_t H5TBcombine_tables(hid_t loc_id1, htri_t has_fill; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name1 == NULL) + goto out; + if (dset_name2 == NULL) + goto out; + if (dset_name3 == NULL) + goto out; + /*------------------------------------------------------------------------- * first we get information about type size and offsets on disk *------------------------------------------------------------------------- @@ -2043,6 +2118,12 @@ herr_t H5TBinsert_field(hid_t loc_id, hbool_t inserted; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + if (field_name == NULL) + goto out; + /* get the number of records and fields */ if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0) goto out; @@ -2451,6 +2532,13 @@ herr_t H5TBdelete_field(hid_t loc_id, htri_t has_fill = FALSE; herr_t ret_val = -1; + + /* check the arguments */ + if (dset_name == NULL) + goto out; + if (field_name == NULL) + goto out; + /* get the number of records and fields */ if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0) goto out; @@ -2859,6 +2947,7 @@ out: herr_t H5TBAget_title(hid_t loc_id, char *table_title) { + /* Get the TITLE attribute */ if(H5LT_get_attribute_disk(loc_id, "TITLE", table_title) < 0) return -1; @@ -2894,6 +2983,10 @@ htri_t H5TBAget_fill(hid_t loc_id, htri_t has_fill = FALSE; htri_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + /* get the number of records and fields */ if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0) goto out; @@ -2962,6 +3055,10 @@ herr_t H5TBget_table_info(hid_t loc_id, int num_members; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + /* open the dataset. */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; @@ -3049,6 +3146,10 @@ herr_t H5TBget_field_info(hid_t loc_id, hssize_t i; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + /* open the dataset. */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; @@ -3153,6 +3254,12 @@ hbool_t H5TB_find_field(const char *field, const char *field_list) const char *start = field_list; const char *end; + /* check the arguments */ + if (field == NULL) + return FALSE; + if (field_list == NULL) + return FALSE; + while((end = HDstrstr(start, ",")) != 0) { ptrdiff_t count = end - start; @@ -3161,7 +3268,7 @@ hbool_t H5TB_find_field(const char *field, const char *field_list) start = end + 1; } /* end while */ - if(HDstrcmp(start, field) == 0) + if(HDstrncmp(start, field, HDstrlen(field)) == 0) return TRUE; return FALSE; diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in index d1bbaed..157c03c 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -668,8 +668,10 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. +# After making changes, run bin/reconfigure to update other configure related +# files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 182 +LT_VERS_REVISION = 193 LT_VERS_AGE = 0 # This library is our main target. diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index cb13061..d61d6cf 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -1238,6 +1238,41 @@ static int test_strings(void) } HDfree(dt_str); + /* Length of the character buffer is larger then needed */ + str_len = str_len + 10; + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) + goto out; + + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); + goto out; + } + if(HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", str_len-1)) { + printf("dt=\n%s\n", dt_str); + HDfree(dt_str); + goto out; + } + + /* Length of the character buffer is smaller then needed */ + str_len = 21; + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) + goto out; + + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); + goto out; + } + /* check the truncated string */ + if(strlen(dt_str) != str_len-1) goto out; + str_len = strlen(dt_str); + if(HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", str_len)) { + printf("dt=\n%s\n", dt_str); + HDfree(dt_str); + goto out; + } + + HDfree(dt_str); + if(H5Tclose(dtype)<0) goto out; @@ -1245,6 +1280,9 @@ static int test_strings(void) return 0; out: + if(dt_str) + HDfree(dt_str); + H5_FAILED(); return -1; } diff --git a/hl/test/test_table.c b/hl/test/test_table.c index 488cbe2..c312296 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -1186,14 +1186,19 @@ static int test_table(hid_t fid, int do_write) goto out; } - /* read the "Pressure" field */ start = 0; nrecords = NRECORDS; + + /* read an invalid field, should fail */ + if ( H5TBread_fields_name(fid,"table10","DoesNotExist",start,nrecords, + sizeof(float),0,field_sizes_pre,pressure_out) >=0) + goto out; + + /* read the "Pressure" field */ if ( H5TBread_fields_name(fid,"table10","Pressure",start,nrecords, sizeof(float),0,field_sizes_pre,pressure_out)<0) goto out; - /* Compare the extracted table with the initial values */ for( i = 0; i < NRECORDS; i++ ) { diff --git a/perform/perf.c b/perform/perf.c index f006afb..7d329f0 100644 --- a/perform/perf.c +++ b/perform/perf.c @@ -46,7 +46,6 @@ # include #endif - /* Macro definitions */ /* Verify: * if val is false (0), print mesg and if fatal is true (non-zero), die. @@ -64,6 +63,8 @@ } \ } while(0) #define RANK 1 +#define MAX_PATH 1024 + hsize_t dims[RANK]; /* dataset dim sizes */ hsize_t block[RANK], stride[RANK], count[RANK]; hssize_t start[RANK]; @@ -90,6 +91,11 @@ char opt_file[256] = "perftest.out"; char opt_pvfstab[256] = "notset"; int opt_pvfstab_set = 0; +const char *FILENAME[] = { + opt_file, + NULL +}; + /* function prototypes */ static int parse_args(int argc, char **argv); @@ -114,6 +120,7 @@ int main(int argc, char **argv) MPI_File fh; MPI_Status status; int nchars; + char filename[MAX_PATH]; herr_t ret; /* Generic return value */ /* startup MPI and determine the rank of this process */ @@ -126,7 +133,6 @@ int main(int argc, char **argv) if (mynod == 0) printf("# Using hdf5-io calls.\n"); - /* kindof a weird hack- if the location of the pvfstab file was * specified on the command line, then spit out this location into * the appropriate environment variable: */ @@ -198,8 +204,10 @@ int main(int argc, char **argv) } } + h5_fixname_no_suffix(FILENAME[0], acc_tpl, filename, sizeof filename); + /* create the parallel file */ - fid = H5Fcreate(opt_file, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl); VRFY((fid >= 0), "H5Fcreate succeeded", H5FATAL); /* define a contiquous dataset of opt_iter*nprocs*opt_block chars */ @@ -261,7 +269,7 @@ int main(int argc, char **argv) MPI_Barrier(MPI_COMM_WORLD); /* reopen the file for reading */ - fid=H5Fopen(opt_file,H5F_ACC_RDONLY,acc_tpl); + fid=H5Fopen(filename,H5F_ACC_RDONLY,acc_tpl); VRFY((fid >= 0), "", H5FATAL); /* open the dataset */ @@ -382,6 +390,7 @@ die_jar_jar_die: free(tmp); if (opt_correct) free(tmp2); + MPI_Finalize(); return(0); @@ -405,6 +414,7 @@ parse_args(int argc, char **argv) break; case 'f': /* filename */ strncpy(opt_file, optarg, 255); + FILENAME[0] = opt_file; break; case 'p': /* pvfstab file */ strncpy(opt_pvfstab, optarg, 255); diff --git a/release_docs/INSTALL b/release_docs/INSTALL index 96f4f6e..2dcb9be 100644 --- a/release_docs/INSTALL +++ b/release_docs/INSTALL @@ -132,27 +132,31 @@ CONTENTS filter will succeed but the data will not be compressed. 3.2. Szip (optional) - The HDF5 Library includes a predefined compression filter that - uses the extended-Rice lossless compression algorithm for chunked - datasets. For more information about Szip compression and license + The HDF5 Library includes a predefined compression filter that + uses the extended-Rice lossless compression algorithm for chunked + datasets. For more information about Szip compression and license terms, see http://hdfgroup.org/doc_resource/SZIP/. - Precompiled Szip binaries for each supported platform and a source - tar file can be found at ftp://ftp.hdfgroup.org/lib-external/szip/. - - To configure the HDF5 Library with the Szip compression filter, use - the '--with-szlib=/PATH_TO_SZIP' flag. For more information, see + The Szip source code can be obtained from the HDF5 Download page + http://www.hdfgroup.org/HDF5/release/obtain5.html#extlibs. Building + instructions are available with the Szip source code. + + The HDF Group does not distribute separate Szip precompiled libraries, + but the HDF5 binaries available from + http://www.hdfgroup.org/HDF5/release/obtain5.html include + the Szip encoder enabled binary for the corresponding platform. + + To configure the HDF5 Library with the Szip compression filter, use + the '--with-szlib=/PATH_TO_SZIP' flag. For more information, see section 4.3.7, "Specifying other libraries and headers." - Starting with release 1.6.3, Szip library binaries are distributed - with the encoder enabled (a license may be required to use this binary) - and with the encoder disabled (freely usable without a license). - If the encoder enabled binary is used, Szip compression encoding is - available for an HDF5 application; if the encoder disabled binary is - used, Szip compression is not available. Szip decoding is always - available for applications (i.e., an HDF5 application can always read - Szip-compressed data) if the Szip filter is present, regardless of the - binary used. + Please notice that if HDF5 configure cannot find a valid Szip library, + configure will not fail; in this case, the compression filter will + not be available to the applications. + + To check if Szip compression was successfully configured in, + check the "I/O filters (external):" line in the configure output, + summary section, printed to the standard output. 3.3. MPI and MPI-IO The parallel version of the library is built upon the foundation diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 31e3917..b831071 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -292,9 +292,8 @@ Notes: CMake and HDF5 how CMake support can be improved on any system. Visit the KitWare site for more information about CMake. - 3. Build and test results can be submitted to our CDash server at: - cdash.hdfgroup.uiuc.edu. - Please read the HDF and CDash document at: + 3. Build and test results can be submitted to our CDash server, + please read the HDF and CDash document at: www.hdfgroup.org/CDash/HowToSubmit. 4. See the appendix at the bottom of this file for examples of using @@ -404,8 +403,6 @@ These five steps are described in detail below. set (HDF5_NO_PACKAGES OFF CACHE BOOL "CPACK - Disable packaging" FORCE) set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO SVN TGZ)" FORCE) set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO SVN TGZ) - set (ZLIB_SVN_URL "http://svn.hdfgroup.uiuc.edu/zlib/trunk" CACHE STRING "Use ZLib from HDF repository" FORCE) - set (SZIP_SVN_URL "http://svn.hdfgroup.uiuc.edu/szip/trunk" CACHE STRING "Use SZip from HDF repository" FORCE) set (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE) set (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE) set (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE) @@ -468,9 +465,9 @@ These five steps are described in detail below. -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING="SVN" The options to control the SVN URL (config/cmake/cacheinit.cmake file) are: - ZLIB_SVN_URL:STRING="http://svn.hdfgroup.uiuc.edu/zlib/trunk" - SZIP_SVN_URL:STRING="http://svn.hdfgroup.uiuc.edu/szip/trunk" - These should be changed to your location. Also define CMAKE_BUILD_TYPE + ZLIB_SVN_URL:STRING="http://${svn_url}/zlib/trunk" + SZIP_SVN_URL:STRING="http://${svn_url}/szip/trunk" + ${svn_url} should be changed to your location. Also define CMAKE_BUILD_TYPE to be the configuration type. 3.2.2 Or the external libraries (zlib and szip) can be configured @@ -641,7 +638,7 @@ cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR) set(CTEST_SOURCE_NAME hdf5-1.8.13) # this is the location of the source with ctest parameter hdf5src # "ctest -S HDF518LinuxCmake.cmake,hdf5src -C Release -O hdf518static.log" -set(CTEST_SOURCE_NAME ${CTEST_SCRIPT_ARG}) +#set(CTEST_SOURCE_NAME ${CTEST_SCRIPT_ARG}) # this is the location of the build directory set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build) @@ -693,7 +690,7 @@ set(SITE_BUILDNAME_SUFFIX "SHARED") ######### Following controls source update ########## #set(LOCAL_UPDATE "TRUE") ######### Following controls source repository ########## -#set(REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf5/branches/hdf5_1_8") +#set(REPOSITORY_URL "http://svn.${hdfgroup_url}/hdf5/branches/hdf5_1_8") #comment to use a uncompressed source folder set(CTEST_USE_TAR_SOURCE "hdf5-1.8.13") ################################################################### diff --git a/release_docs/INSTALL_parallel b/release_docs/INSTALL_parallel index 6f60165..e5be615 100644 --- a/release_docs/INSTALL_parallel +++ b/release_docs/INSTALL_parallel @@ -23,8 +23,7 @@ with your system support staff of information how to compile an MPI program, how to run an MPI application, and how to access the parallel file system. There are sample MPI-IO C and Fortran programs in the appendix section of "Sample programs". You can use them to run simple tests of your MPI compilers -and the parallel file system. Also, the t_posix_compliant test in testpar -verifies if the file system is POSIX compliant. +and the parallel file system. 1.2. Further Help @@ -322,11 +321,6 @@ non-zero code. Failure to support file size greater than 2GB is not a fatal error for HDF5 because HDF5 can use other file-drivers such as families of files to bypass the file size limit. -The t_posix_compliant tests if the file system is POSIX compliant when POSIX -and MPI IO APIs are used. This is for information only and it always exits -with 0 even when non-compliance errors have occurred. This is to prevent -the test from aborting the remaining parallel HDF5 tests unnecessarily. - The t_cache does many small sized I/O requests and may not run well in a slow file system such as NFS disk. If it takes a long time to run it, try set the environment variable $HDF5_PARAPREFIX to a file system more suitable diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index e38beb5..44943ce 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.192-swmr0 currently under development +HDF5 version 1.9.203-swmr0 currently under development INTRODUCTION @@ -1171,9 +1171,6 @@ Supported Platforms #1 SMP x86_64 GNU/Linux compilers for 64-bit applications; (koala) Version 4.1.2 20080704 (Red Hat 4.1.2-54) Version 4.8.2 - PGI C, Fortran, C++ for 64-bit target on - x86-64; - Version 13.7-0 Intel(R) C, C++, Fortran Compilers for applications running on Intel(R) 64; Version 14.0.2 (Build 20140120) @@ -1189,11 +1186,12 @@ Supported Platforms compilers: Version 14.0.2 (Build 20140120) - Linux 2.6.32-431.11.2.el6.ppc64 gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3) - #1 SMP ppc64 GNU/Linux g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3) - (ostrich) GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3) - IBM XL C/C++ V11.1 - IBM XL Fortran V13.1 + Linux 2.6.32-431.29.2.el6.ppc64 gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4) + #1 SMP ppc64 GNU/Linux g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4) + (ostrich) GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4) + IBM XL C/C++ V13.1 + IBM XL Fortran V15.1 + Linux 2.6.32-220.23.1.1chaos Intel C, C++, Fortran Compilers ch5.x86_64 GNU/Linux Version 12.1.5.339 (LLNL Aztec) @@ -1209,16 +1207,20 @@ Supported Platforms Windows 7 Visual Studio 2008 w/ Intel Fortran 14 (cmake) Visual Studio 2010 w/ Intel Fortran 14 (cmake) Visual Studio 2012 w/ Intel Fortran 14 (cmake) - Cygwin(CYGWIN_NT-6.1 1.7.28(0.271/5/3) gcc(4.8.2) compiler and gfortran) + Visual Studio 2013 w/ Intel Fortran 14 (cmake) + Cygwin(CYGWIN_NT-6.1 1.7.32(0.274/5/3) gcc(4.8.3) compiler and gfortran) (cmake and autotools) Windows 7 x64 Visual Studio 2008 w/ Intel Fortran 14 (cmake) Visual Studio 2010 w/ Intel Fortran 14 (cmake) Visual Studio 2012 w/ Intel Fortran 14 (cmake) + Visual Studio 2013 w/ Intel Fortran 14 (cmake) Windows 8.1 Visual Studio 2012 w/ Intel Fortran 14 (cmake) + Visual Studio 2013 w/ Intel Fortran 14 (cmake) Windows 8.1 x64 Visual Studio 2012 w/ Intel Fortran 14 (cmake) + Visual Studio 2013 w/ Intel Fortran 14 (cmake) Mac OS X Lion 10.7.3 gcc i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 from Xcode 4.2.1 32- and 64-bit g++ i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 from Xcode 4.2.1 @@ -1303,12 +1305,12 @@ More Tested Platforms ===================== The following platforms are not supported but have been tested for this release. - Linux 2.6.18-308.13.1.el5PAE MPICH mpich 3.1 compiled with - #1 SMP i686 i686 i386 gcc 4.8.2 and gfortran 4.8.2 + Linux 2.6.18-308.13.1.el5PAE MPICH mpich 3.1.2 compiled with + #1 SMP i686 i686 i386 gcc 4.9.1 and gfortran 4.9.1 (jam) g95 (GCC 4.0.3 (g95 0.94!) - Linux 2.6.18-431.11.2.el6 MPICH mpich 3.1 compiled with - #1 SMP x86_64 GNU/Linux gcc 4.8.2 and gfortran 4.8.2 + Linux 2.6.18-431.11.2.el6 MPICH mpich 3.1.2 compiled with + #1 SMP x86_64 GNU/Linux gcc 4.9.1 and gfortran 4.9.1 (platypus) g95 (GCC 4.0.3 (g95 0.94!) FreeBSD 8.2-STABLE i386 gcc 4.2.1 [FreeBSD] 20070719 @@ -1351,14 +1353,14 @@ The following platforms are not supported but have been tested for this release. GNU Fortran (SUSE Linux) 4.8.1 (cmake and autotools) - Ubuntu 14.04 3.13.0-32-generic #57-Ubuntu SMP i686 GNU/Linux - gcc (Ubuntu/Linaro 4.8.2-19ubuntu1) 4.8.2 - GNU Fortran (Ubuntu/Linaro 4.8.2-19ubuntu1) 4.8.2 + Ubuntu 14.04 3.13.0-35-generic #62-Ubuntu SMP i686 GNU/Linux + gcc (Ubuntu/Linaro 4.9.1-0ubuntu1) 4.9.1 + GNU Fortran (Ubuntu/Linaro 4.9.1-0ubuntu1) 4.9.1 (cmake and autotools) - Ubuntu 14.04 3.13.0-32-generic #57-Ubuntu SMP x86_64 GNU/Linux - gcc (Ubuntu/Linaro 4.8.2-19ubuntu1) 4.8.2 - GNU Fortran (Ubuntu/Linaro 4.8.2-19ubuntu1) 4.8.2 + Ubuntu 14.04 3.13.0-35-generic #62-Ubuntu SMP x86_64 GNU/Linux + gcc (Ubuntu/Linaro 4.9.1-0ubuntu1) 4.9.1 + GNU Fortran (Ubuntu/Linaro 4.9.1-0ubuntu1) 4.9.1 (cmake and autotools) Cray Linux Environment (CLE) PrgEnv-pgi/4.0.46 diff --git a/release_docs/USING_HDF5_CMake.txt b/release_docs/USING_HDF5_CMake.txt index 8d09b22..6195dc3 100644 --- a/release_docs/USING_HDF5_CMake.txt +++ b/release_docs/USING_HDF5_CMake.txt @@ -27,7 +27,7 @@ Notes: This short instruction is written for users who want to quickly 3. See the appendix at the bottom of this file for an example of using a ctest script for building and testing. See - CMake.txt for more information. + INSTALL_CMake.txt for more information. @@ -69,7 +69,7 @@ Go through these steps to build HDF5 applications with CMake. 1. Run CMake 2. Configure the cache settings 3. Build HDF5 Applications - 4. Test HDF5 Applications. + 4. Test HDF5 Applications These steps are described in more detail below. @@ -254,7 +254,7 @@ set(SITE_COMPILER_NAME "compiler name") set(SITE_COMPILER_VERSION "compiler version") # needed for source updates, change as required -set(REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf5-examples/trunk/1_8") +set(REPOSITORY_URL "http://svn.${hdfgroup_url}/hdf5-examples/trunk/1_8") set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/hdf5Examples-1.8") diff --git a/release_docs/USING_HDF5_VS.txt b/release_docs/USING_HDF5_VS.txt index 9bf301e..9063ea6 100644 --- a/release_docs/USING_HDF5_VS.txt +++ b/release_docs/USING_HDF5_VS.txt @@ -18,12 +18,12 @@ Using Visual Studio 2010 with HDF5 Libraries built with Visual Studio 2010 1. Set up path for external libraries and headers - The path settings will need to be in project property sheets per project. + The path settings will need to be in the project property sheets per project. Go to "Project" and select "Properties", find "Configuration Properties", and then "VC++ Directories". 1.1 If you are building on 64-bit Windows, find the "Platform" dropdown - and select "x64". + and select "x64". 1.2 Add the header path to the "Include Directories" setting. @@ -42,7 +42,7 @@ Using Visual Studio 2010 with HDF5 Libraries built with Visual Studio 2010 Using Visual Studio 2008 with HDF5 Libraries built with Visual Studio 2008 ========================================================================== - 2. Set up path for external libraries and headers + 2. Set up the path for external libraries and headers Invoke Microsoft Visual Studio and go to "Tools" and select "Options", find "Projects", and then "VC++ Directories". diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 124ce7c..ccc7659 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -186,7 +186,7 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") /* Go do the real work for attaching the attribute to the dataset */ - if((attr = H5A_create(&loc, name, type, space, plist_id, H5AC_dxpl_id)) < 0) + if(NULL==(attr = H5A_create(&loc, name, type, space, plist_id, H5AC_dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") /* Register the new attribute and get an ID for it */ diff --git a/src/H5C.c b/src/H5C.c index 212952d..23c9051 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -9729,7 +9729,7 @@ H5C_tag_entry(H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr, hid_t dxpl_id) { H5P_genplist_t *dxpl; /* dataset transfer property list */ H5C_tag_t tag; /* Tag structure */ - hid_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index bb4f30f..2557d1a 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -4317,9 +4317,10 @@ H5D__chunk_collective_fill(const H5D_t *dset, hid_t dxpl_id, blocks++; } - /* MSC - should use this if MPI_type_create_hindexed block is working */ - //mpi_code = MPI_Type_create_hindexed_block(blocks, block_len, chunk_disp_array, - //MPI_BYTE, &file_type); + /* MSC + * should use this if MPI_type_create_hindexed block is working + * mpi_code = MPI_Type_create_hindexed_block(blocks, block_len, chunk_disp_array, MPI_BYTE, &file_type); + */ mpi_code = MPI_Type_create_hindexed(blocks, block_lens, chunk_disp_array, MPI_BYTE, &file_type); if(mpi_code != MPI_SUCCESS) diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index a5e8903..88c6075 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -994,15 +994,15 @@ if(H5DEBUG(D)) } /* end for */ /* Create final MPI derived datatype for the file */ - if(MPI_SUCCESS != (mpi_code = MPI_Type_struct((int)num_chunk, chunk_mpi_file_counts, chunk_disp_array, chunk_ftype, &chunk_final_ftype))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_struct failed", mpi_code) + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct((int)num_chunk, chunk_mpi_file_counts, chunk_disp_array, chunk_ftype, &chunk_final_ftype))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code) if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&chunk_final_ftype))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) chunk_final_ftype_is_derived = TRUE; /* Create final MPI derived datatype for memory */ - if(MPI_SUCCESS != (mpi_code = MPI_Type_struct((int)num_chunk, chunk_mpi_mem_counts, chunk_mem_disp_array, chunk_mtype, &chunk_final_mtype))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_struct failed", mpi_code) + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct((int)num_chunk, chunk_mpi_mem_counts, chunk_mem_disp_array, chunk_mtype, &chunk_final_mtype))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code) if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&chunk_final_mtype))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) chunk_final_mtype_is_derived = TRUE; diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 2f44d8c..d604a8a 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -436,17 +436,22 @@ done: * * Purpose: Initializes any interface-specific data or routines. * - * Return: Success: The driver ID for the core driver. - * Failure: Negative. + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ static herr_t H5FD_core_init_interface(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + herr_t ret_value = SUCCEED; - FUNC_LEAVE_NOAPI(H5FD_core_init()) + FUNC_ENTER_NOAPI_NOINIT + + if(H5FD_core_init() < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize core VFD") + +done: + FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_core_init_interface() */ diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 3aa1c4f..19f9bda 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -203,9 +203,15 @@ DESCRIPTION static herr_t H5FD_direct_init_interface(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT - FUNC_LEAVE_NOAPI(H5FD_direct_init()) + if(H5FD_direct_init() < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize direct VFD") + +done: + FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_direct_init_interface() */ diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 75c75ad..1728d13 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -161,9 +161,15 @@ DESCRIPTION static herr_t H5FD_family_init_interface(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT - FUNC_LEAVE_NOAPI(H5FD_family_init()) + if(H5FD_family_init() < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize family VFD") + +done: + FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_family_init_interface() */ diff --git a/src/H5FDlog.c b/src/H5FDlog.c index f23ec46..ca6cada 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -235,17 +235,22 @@ H5FL_DEFINE_STATIC(H5FD_log_t); * * Purpose: Initializes any interface-specific data or routines. * - * Return: Success: The driver ID for the log driver. - * Failure: Negative. + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ static herr_t H5FD_log_init_interface(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + if(H5FD_log_init() < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize log VFD") - FUNC_LEAVE_NOAPI(H5FD_log_init()) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_log_init_interface() */ diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 8162ccd..73237b7 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -180,9 +180,15 @@ DESCRIPTION static herr_t H5FD_mpio_init_interface(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + if(H5FD_mpio_init() < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize mpio VFD") - FUNC_LEAVE_NOAPI(H5FD_mpio_init()) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_mpio_init_interface() */ @@ -1448,10 +1454,10 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add int mpi_code; /* mpi return code */ MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */ int size_i; /* Integer copy of 'size' to read */ - int bytes_read; /* Number of bytes read in */ + MPI_Count bytes_read; /* Number of bytes read in */ int n; - int type_size; /* MPI datatype used for I/O's size */ - int io_size; /* Actual number of bytes requested */ + MPI_Count type_size; /* MPI datatype used for I/O's size */ + MPI_Count io_size; /* Actual number of bytes requested */ H5P_genplist_t *plist = NULL; /* Property list pointer */ hbool_t use_view_this_time = FALSE; herr_t ret_value = SUCCEED; @@ -1568,16 +1574,11 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add } /* How many bytes were actually read? */ - /* [This works because the "basic elements" we use for all our MPI derived - * types are MPI_BYTE. We should be using the 'buf_type' for the MPI - * datatype in this call though... (We aren't because using it causes - * the LANL "qsc" machine to dump core - 12/19/03) - QAK] - */ - if (MPI_SUCCESS != (mpi_code=MPI_Get_elements(&mpi_stat, MPI_BYTE, &bytes_read))) + if (MPI_SUCCESS != (mpi_code=MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_read))) HMPI_GOTO_ERROR(FAIL, "MPI_Get_elements failed", mpi_code) /* Get the type's size */ - if (MPI_SUCCESS != (mpi_code=MPI_Type_size(buf_type,&type_size))) + if (MPI_SUCCESS != (mpi_code=MPI_Type_size_x(buf_type,&type_size))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_size failed", mpi_code) /* Compute the actual number of bytes requested */ @@ -1733,9 +1734,10 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, MPI_Status mpi_stat; /* Status from I/O operation */ MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */ int mpi_code; /* MPI return code */ - int size_i, bytes_written; - int type_size; /* MPI datatype used for I/O's size */ - int io_size; /* Actual number of bytes requested */ + MPI_Count bytes_written; + int size_i; + MPI_Count type_size; /* MPI datatype used for I/O's size */ + MPI_Count io_size; /* Actual number of bytes requested */ hbool_t use_view_this_time = FALSE; H5P_genplist_t *plist = NULL; /* Property list pointer */ herr_t ret_value = SUCCEED; @@ -1862,16 +1864,11 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, } /* How many bytes were actually written? */ - /* [This works because the "basic elements" we use for all our MPI derived - * types are MPI_BYTE. We should be using the 'buf_type' for the MPI - * datatype in this call though... (We aren't because using it causes - * the LANL "qsc" machine to dump core - 12/19/03) - QAK] - */ - if(MPI_SUCCESS != (mpi_code = MPI_Get_elements(&mpi_stat, MPI_BYTE, &bytes_written))) + if(MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_written))) HMPI_GOTO_ERROR(FAIL, "MPI_Get_elements failed", mpi_code) /* Get the type's size */ - if(MPI_SUCCESS != (mpi_code = MPI_Type_size(buf_type, &type_size))) + if(MPI_SUCCESS != (mpi_code = MPI_Type_size_x(buf_type, &type_size))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_size failed", mpi_code) /* Compute the actual number of bytes requested */ diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 0a899a9..38097c8 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -491,7 +491,7 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, } if (!memb_addr) { for (mt=H5FD_MEM_DEFAULT; mt= 4) /* GCC 4.x has support for visibility options */ - #define H5PLUGIN_DLL __attribute__ ((visibility("default"))) - #endif - #else - /* plugins always export */ - #if defined (_MSC_VER) /* MSVC Compiler Case */ - #define H5PLUGIN_DLL __declspec(dllexport) - #elif (__GNUC__ >= 4) /* GCC 4.x has support for visibility options */ - #define H5PLUGIN_DLL __attribute__ ((visibility("default"))) - #endif - #endif - -#elif defined(H5_BUILT_AS_STATIC_LIB) - #define H5PLUGIN_DLL +/* plugins always export */ +#if defined (_MSC_VER) /* MSVC Compiler Case */ + #define H5PLUGIN_DLL __declspec(dllexport) +#elif (__GNUC__ >= 4) /* GCC 4.x has support for visibility options */ + #define H5PLUGIN_DLL __attribute__ ((visibility("default"))) #else - - #if defined(H5_HAVE_WIN32_API) - #if defined(_HDF5DLL_) - #pragma warning(disable: 4273) /* Disable the dll linkage warnings */ - #define H5PLUGIN_DLL __declspec(dllimport) - #elif defined(_HDF5USEDLL_) - #define H5PLUGIN_DLL __declspec(dllexport) - #endif /* _HDF5DLL_ */ - #else /*H5_HAVE_WIN32_API*/ - #define H5PLUGIN_DLL - #endif /*H5_HAVE_WIN32_API*/ - -#endif /* H5_BUILT_AS_xxx_LIB */ + #define H5PLUGIN_DLL +#endif #ifdef __cplusplus extern "C" { diff --git a/src/H5PLprivate.h b/src/H5PLprivate.h index b117613..587a51b 100644 --- a/src/H5PLprivate.h +++ b/src/H5PLprivate.h @@ -19,8 +19,18 @@ #ifndef _H5PLprivate_H #define _H5PLprivate_H -/* Include package's "external" header */ -#include "H5PLextern.h" +/* Keep the following in sync with the package's "external" header */ + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/* Plugin type */ +typedef enum H5PL_type_t { + H5PL_TYPE_ERROR = -1, /*error */ + H5PL_TYPE_FILTER = 0, /*filter */ + H5PL_TYPE_NONE = 1 /*this must be last! */ +} H5PL_type_t; /* Private headers needed by this file */ #include "H5private.h" /* Generic Functions */ diff --git a/src/H5S.c b/src/H5S.c index 381081a..1146ab4 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -467,7 +467,7 @@ H5Sextent_copy(hid_t dst_id,hid_t src_id) { H5S_t *src; H5S_t *dst; - hid_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) H5TRACE2("e", "ii", dst_id, src_id); diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 1644bd3..9a1b5a6 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -500,9 +500,9 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, hsize_t max_xtent[H5S_MAX_RANK]; H5S_hyper_dim_t *diminfo; /* [rank] */ unsigned rank; - int block_length[3]; - MPI_Datatype inner_type, outer_type, old_types[3]; - MPI_Aint extent_len, displacement[3]; + MPI_Datatype inner_type, outer_type; + MPI_Aint extent_len, start_disp, new_extent; + MPI_Aint lb; /* Needed as an argument for MPI_Type_get_extent */ unsigned u; /* Local index variable */ int i; /* Local index variable */ int mpi_code; /* MPI return code */ @@ -669,42 +669,30 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, * Then build the dimension type as (start, vector type, xtent). ****************************************/ /* calculate start and extent values of this dimension */ - displacement[1] = d[i].start * offset[i] * elmt_size; - displacement[2] = (MPI_Aint)elmt_size * max_xtent[i]; - if(MPI_SUCCESS != (mpi_code = MPI_Type_extent(outer_type, &extent_len))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_extent failed", mpi_code) + start_disp = d[i].start * offset[i] * elmt_size; + new_extent = (MPI_Aint)elmt_size * max_xtent[i]; + if(MPI_SUCCESS != (mpi_code = MPI_Type_get_extent(outer_type, &lb, &extent_len))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_get_extent failed", mpi_code) /************************************************* * Restructure this datatype ("outer_type") * so that it still starts at 0, but its extent * is the full extent in this dimension. *************************************************/ - if(displacement[1] > 0 || (int)extent_len < displacement[2]) { + if(start_disp > 0 || extent_len < new_extent) { + MPI_Datatype interm_type; + int block_len = 1; - block_length[0] = 1; - block_length[1] = 1; - block_length[2] = 1; - - displacement[0] = 0; - - old_types[0] = MPI_LB; - old_types[1] = outer_type; - old_types[2] = MPI_UB; -#ifdef H5S_DEBUG - if(H5DEBUG(S)) - HDfprintf(H5DEBUG(S), "%s: i=%d Extending struct type\n" - "***displacements: %ld, %ld, %ld\n", - FUNC, i, (long)displacement[0], (long)displacement[1], (long)displacement[2]); -#endif - - mpi_code = MPI_Type_struct(3, /* count */ - block_length, /* blocklengths */ - displacement, /* displacements */ - old_types, /* old types */ - &inner_type); /* new type */ + HDassert(0 == lb); + mpi_code = MPI_Type_create_hindexed(1, &block_len, &start_disp, outer_type, &interm_type); MPI_Type_free(&outer_type); - if(mpi_code != MPI_SUCCESS) + if(mpi_code != MPI_SUCCESS) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) + + mpi_code = MPI_Type_create_resized(interm_type, lb, new_extent, &inner_type); + MPI_Type_free(&interm_type); + if(mpi_code != MPI_SUCCESS) HMPI_GOTO_ERROR(FAIL, "couldn't resize MPI vector type", mpi_code) } /* end if */ else @@ -884,8 +872,8 @@ H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span, outercount++; } /* end while */ - if(MPI_SUCCESS != (mpi_code = MPI_Type_hindexed((int)outercount, blocklen, disp, *elmt_type, span_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_hindexed failed", mpi_code) + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)outercount, blocklen, disp, *elmt_type, span_type))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) span_type_valid = TRUE; } /* end if */ else { @@ -935,9 +923,9 @@ H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span, /* Build the MPI datatype for this node */ stride = (*down) * elmt_size; H5_CHECK_OVERFLOW(tspan->nelem, hsize_t, int) - if(MPI_SUCCESS != (mpi_code = MPI_Type_hvector((int)tspan->nelem, 1, stride, down_type, &inner_type[outercount]))) { + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector((int)tspan->nelem, 1, stride, down_type, &inner_type[outercount]))) { MPI_Type_free(&down_type); - HMPI_GOTO_ERROR(FAIL, "MPI_Type_hvector failed", mpi_code) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code) } /* end if */ /* Release MPI datatype for next dimension down */ @@ -950,8 +938,8 @@ H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span, /* building the whole vector datatype */ H5_CHECK_OVERFLOW(outercount, size_t, int) - if(MPI_SUCCESS != (mpi_code = MPI_Type_struct((int)outercount, blocklen, disp, inner_type, span_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_struct failed", mpi_code) + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct((int)outercount, blocklen, disp, inner_type, span_type))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code) span_type_valid = TRUE; /* Release inner node types */ diff --git a/src/H5public.h b/src/H5public.h index b2afca8..b3582f4 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -94,10 +94,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 192 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 203 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "swmr0" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.192-swmr0" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.203-swmr0" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/Makefile.in b/src/Makefile.in index b2319b7..bfcb103 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -733,8 +733,10 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. +# After making changes, run bin/reconfigure to update other configure related +# files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 182 +LT_VERS_REVISION = 193 LT_VERS_AGE = 0 # Our main target, the HDF5 library diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 4198a4f..4e22529 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -494,6 +494,7 @@ if (HDF5_TEST_VFD) ) endforeach (test ${H5_VFD_TESTS}) set_tests_properties (VFD-${vfdname}-flush1 PROPERTIES TIMEOUT 10) + set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES TIMEOUT 10) if (HDF5_TEST_FHEAP_VFD) add_test ( NAME VFD-${vfdname}-fheap diff --git a/test/dtypes.c b/test/dtypes.c index 33d2bbc..b2783c3 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -65,8 +65,8 @@ FAIL_STACK_ERROR \ if((NMEMBS) != H5I_nmembers(H5I_DATATYPE)) { \ H5_FAILED(); \ - printf(" #dtype ids expected: %lld; found: %d\n", (long long)NMEMBS, \ - H5I_nmembers(H5I_DATATYPE)); \ + printf(" #dtype ids expected: %lld; found: %lld\n", \ + (long long)NMEMBS, (long long)H5I_nmembers(H5I_DATATYPE)); \ goto error; \ } @@ -3008,7 +3008,7 @@ test_compound_16(void) if(H5Fget_obj_ids(file, H5F_OBJ_DATATYPE, (size_t)2, open_dtypes) < 0) TEST_ERROR if(open_dtypes[1]) { H5_FAILED(); AT(); - printf(" H5Fget_obj_ids returned as second id: %d; expected: 0\n", open_dtypes[1]); + printf(" H5Fget_obj_ids returned as second id: %lld; expected: 0\n", (long long)open_dtypes[1]); goto error; } @@ -3549,6 +3549,7 @@ test_transient (hid_t fapl) static hsize_t ds_size[2] = {10, 20}; hid_t file=-1, type=-1, space=-1, dset=-1, t2=-1; char filename[1024]; + hid_t ret_id; /* Generic hid_t return value */ herr_t status; TESTING("transient datatypes"); @@ -3583,9 +3584,9 @@ test_transient (hid_t fapl) /* It should not be possible to create an attribute for a transient type */ H5E_BEGIN_TRY { - status = H5Acreate2(type, "attr1", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT); + ret_id = H5Acreate2(type, "attr1", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT); } H5E_END_TRY; - if (status>=0) { + if (ret_id>=0) { H5_FAILED(); HDputs (" Attributes should not be allowed for transient types!"); goto error; @@ -5147,6 +5148,7 @@ test_encode(void) size_t enum_buf_size = 0; size_t vlstr_buf_size = 0; unsigned char *cmpd_buf=NULL, *enum_buf=NULL, *vlstr_buf=NULL; + hid_t ret_id; herr_t ret; TESTING("functions of encoding and decoding datatypes"); @@ -5247,9 +5249,9 @@ test_encode(void) /* Try decoding bogus buffer */ H5E_BEGIN_TRY { - ret = H5Tdecode(cmpd_buf); + ret_id = H5Tdecode(cmpd_buf); } H5E_END_TRY; - if(ret!=FAIL) { + if(ret_id!=FAIL) { H5_FAILED(); printf("Decoded bogus buffer!\n"); goto error; diff --git a/test/h5test.c b/test/h5test.c index d25b455..693760c 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -92,6 +92,8 @@ MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ static const char *multi_letters = "msbrglo"; 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); /*------------------------------------------------------------------------- @@ -268,9 +270,59 @@ h5_reset(void) char * h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) { + return (h5_fixname_real(base_name, fapl, ".h5", fullname, size)); +} + + +/*------------------------------------------------------------------------- + * Function: h5_fixname_no_suffix + * + * Purpose: Same as h5_fixname but with no suffix appended + * + * Return: Success: The FULLNAME pointer. + * + * Failure: NULL if BASENAME or FULLNAME is the null + * pointer or if FULLNAME isn't large enough for + * the result. + * + *------------------------------------------------------------------------- + */ +char * +h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t size) +{ + return (h5_fixname_real(base_name, fapl, NULL, fullname, size)); +} + + +/*------------------------------------------------------------------------- + * Function: h5_fixname_real + * + * Purpose: Create a file name from a file base name like `test' and + * return it through the FULLNAME (at most SIZE characters + * counting the null terminator). The full name is created by + * prepending the contents of HDF5_PREFIX (separated from the + * base name by a slash) and appending a file extension based on + * the driver supplied, resulting in something like + * `ufs:/u/matzke/test.h5'. + * + * Return: Success: The FULLNAME pointer. + * + * Failure: NULL if BASENAME or FULLNAME is the null + * pointer or if FULLNAME isn't large enough for + * the result. + * + * Programmer: Robb Matzke + * Thursday, November 19, 1998 + * + *------------------------------------------------------------------------- + */ +static char * +h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, + char *fullname, size_t size) +{ const char *prefix = NULL; - const char *suffix = ".h5"; /* suffix has default */ char *ptr, last = '\0'; + const char *suffix = _suffix; size_t i, j; hid_t driver = -1; int isppdriver = 0; /* if the driver is MPI parallel */ @@ -285,10 +337,12 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) if((driver = H5Pget_driver(fapl)) < 0) return NULL; - if(H5FD_FAMILY == driver) - suffix = "%05d.h5"; - else if (H5FD_MULTI == driver) - suffix = NULL; + if(suffix) { + if(H5FD_FAMILY == driver) + suffix = "%05d.h5"; + else if (H5FD_MULTI == driver) + suffix = NULL; + } } /* Must first check fapl is not H5P_DEFAULT (-1) because H5FD_XXX @@ -318,11 +372,11 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) */ if(isppdriver) { #ifdef H5_HAVE_PARALLEL - /* + /* * For parallel: * First use command line option, then the environment * variable, then try the constant - */ + */ static int explained = 0; prefix = (paraprefix ? paraprefix : getenv_all(MPI_COMM_WORLD, 0, "HDF5_PARAPREFIX")); @@ -335,12 +389,12 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) if (mpi_rank == 0) printf("*** Hint ***\n" - "You can use environment variable HDF5_PARAPREFIX to " - "run parallel test files in a\n" - "different directory or to add file type prefix. E.g.,\n" - " HDF5_PARAPREFIX=pfs:/PFS/user/me\n" - " export HDF5_PARAPREFIX\n" - "*** End of Hint ***\n"); + "You can use environment variable HDF5_PARAPREFIX to " + "run parallel test files in a\n" + "different directory or to add file type prefix. E.g.,\n" + " HDF5_PARAPREFIX=pfs:/PFS/user/me\n" + " export HDF5_PARAPREFIX\n" + "*** End of Hint ***\n"); explained = TRUE; #ifdef HDF5_PARAPREFIX @@ -352,7 +406,7 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) /* * For serial: * First use the environment variable, then try the constant - */ + */ prefix = HDgetenv("HDF5_PREFIX"); #ifdef HDF5_PREFIX @@ -425,18 +479,18 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) return NULL; } } else if (HDstrlen(base_name) >= size) { - /* Buffer is too small */ - return NULL; + /* Buffer is too small */ + return NULL; } else { - HDstrcpy(fullname, base_name); - } + HDstrcpy(fullname, base_name); + } /* Append a suffix */ if (suffix) { - if (HDstrlen(fullname) + HDstrlen(suffix) >= size) + if (HDstrlen(fullname) + HDstrlen(suffix) >= size) return NULL; - HDstrcat(fullname, suffix); + HDstrcat(fullname, suffix); } /* Remove any double slashes in the filename */ @@ -854,7 +908,7 @@ h5_get_file_size(const char *filename, hid_t fapl) { char temp[2048]; /* Temporary buffer for file names */ h5_stat_t sb; /* Structure for querying file info */ - int j = 0; + int j = 0; if(fapl == H5P_DEFAULT) { /* Get the file's statistics */ @@ -870,9 +924,6 @@ h5_get_file_size(const char *filename, hid_t fapl) /* Check for simple cases */ if(driver == H5FD_SEC2 || driver == H5FD_STDIO || driver == H5FD_CORE || -#ifdef H5_HAVE_PARALLEL - driver == H5FD_MPIO || -#endif /* H5_HAVE_PARALLEL */ #ifdef H5_HAVE_WINDOWS driver == H5FD_WINDOWS || #endif /* H5_HAVE_WINDOWS */ @@ -907,6 +958,22 @@ h5_get_file_size(const char *filename, hid_t fapl) /* Return total size */ return(tot_size); } /* end if */ +#ifdef H5_HAVE_PARALLEL + else if(driver == H5FD_MPIO) { + MPI_File fh; /* MPI file handle used to open the file and verify its size */ + int mpi_ret; + MPI_Offset file_size; + + mpi_ret = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, MPI_INFO_NULL, &fh); + if (mpi_ret != MPI_SUCCESS) return -1; + mpi_ret = MPI_File_get_size(fh, &file_size); + if (mpi_ret != MPI_SUCCESS) return -1; + mpi_ret = MPI_File_close(&fh); + if (mpi_ret != MPI_SUCCESS) return -1; + + return file_size; + } +#endif /* H5_HAVE_PARALLEL */ else if(driver == H5FD_FAMILY) { h5_stat_size_t tot_size = 0; diff --git a/test/h5test.h b/test/h5test.h index 7813b51..ce224d8 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -142,8 +142,8 @@ extern "C" { /* Generally useful testing routines */ H5TEST_DLL int h5_cleanup(const char *base_name[], hid_t fapl); -H5TEST_DLL char *h5_fixname(const char *base_name, hid_t fapl, char *fullname, - size_t size); +H5TEST_DLL char *h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size); +H5TEST_DLL char *h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t size); H5TEST_DLL hid_t h5_fileaccess(void); H5TEST_DLL void h5_no_hwconv(void); H5TEST_DLL const char *h5_rmprefix(const char *filename); diff --git a/test/links.c b/test/links.c index c01533f..9dd6791 100644 --- a/test/links.c +++ b/test/links.c @@ -12948,7 +12948,7 @@ open_by_idx(hid_t fapl) char valname[NAME_BUF_SIZE]; /* Link value */ haddr_t *objno = NULL; /* Addresses of the objects created */ unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t ret; /* Generic return value */ /* Create group creation property list */ if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR @@ -13173,7 +13173,7 @@ open_by_idx_old(hid_t fapl) char valname[NAME_BUF_SIZE]; /* Link value */ haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t ret; /* Generic return value */ /* Create file to mount */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); diff --git a/test/tattr.c b/test/tattr.c index 57b3263..2885124 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -178,6 +178,7 @@ test_attr_basic_write(hid_t fapl) hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2}; int read_data1[ATTR1_DIM1]={0}; /* Buffer for reading 1st attribute */ int i; + hid_t ret_id; /* Generic hid_t return value */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -228,8 +229,8 @@ test_attr_basic_write(hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Try to create the same attribute again (should fail) */ - ret = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Acreate2"); + ret_id = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Acreate2"); /* Write attribute information */ ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data1); @@ -366,8 +367,8 @@ test_attr_basic_write(hid_t fapl) VERIFY(attr_size, (ATTR2_DIM1 * ATTR2_DIM2 * sizeof(int)), "H5Aget_storage_size"); /* Try to create the same attribute again (should fail) */ - ret = H5Acreate2(group, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Acreate2"); + ret_id = H5Acreate2(group, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Acreate2"); /* Write attribute information */ ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data2); @@ -682,6 +683,7 @@ test_attr_compound_write(hid_t fapl) hid_t attr; /* Attribute ID */ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; hsize_t dims2[] = {ATTR4_DIM1,ATTR4_DIM2}; + hid_t ret_id; /* Generic hid_t return value */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -725,8 +727,8 @@ test_attr_compound_write(hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Try to create the same attribute again (should fail) */ - ret = H5Acreate2(dataset, ATTR4_NAME, tid1, sid2, H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Acreate2"); + ret_id = H5Acreate2(dataset, ATTR4_NAME, tid1, sid2, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Acreate2"); /* Write complex attribute data */ ret = H5Awrite(attr, tid1, attr_data4); @@ -917,6 +919,7 @@ test_attr_scalar_write(hid_t fapl) hid_t sid1,sid2; /* Dataspace ID */ hid_t attr; /* Attribute ID */ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hid_t ret_id; /* Generic hid_t return value */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -943,8 +946,8 @@ test_attr_scalar_write(hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Try to create the same attribute again (should fail) */ - ret = H5Acreate2(dataset, ATTR5_NAME, H5T_NATIVE_FLOAT, sid2, H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Acreate2"); + ret_id = H5Acreate2(dataset, ATTR5_NAME, H5T_NATIVE_FLOAT, sid2, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Acreate2"); /* Write attribute information */ ret = H5Awrite(attr, H5T_NATIVE_FLOAT, &attr_data5); @@ -1057,6 +1060,7 @@ test_attr_mult_write(hid_t fapl) hsize_t dims2[] = {ATTR1_DIM1}; hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2}; hsize_t dims4[] = {ATTR3_DIM1,ATTR3_DIM2,ATTR3_DIM3}; + hid_t ret_id; /* Generic hid_t return value */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1087,8 +1091,8 @@ test_attr_mult_write(hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Try to create the same attribute again (should fail) */ - ret = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Acreate2"); + ret_id = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Acreate2"); /* Write 1st attribute data */ ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data1); @@ -1111,8 +1115,8 @@ test_attr_mult_write(hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Try to create the same attribute again (should fail) */ - ret = H5Acreate2(dataset, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Acreate2"); + ret_id = H5Acreate2(dataset, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Acreate2"); /* Write 2nd attribute information */ ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data2); @@ -1135,8 +1139,8 @@ test_attr_mult_write(hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Try to create the same attribute again (should fail) */ - ret = H5Acreate2(dataset, ATTR3_NAME, H5T_NATIVE_DOUBLE, sid2, H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Acreate2"); + ret_id = H5Acreate2(dataset, ATTR3_NAME, H5T_NATIVE_DOUBLE, sid2, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Acreate2"); /* Write 3rd attribute information */ ret = H5Awrite(attr, H5T_NATIVE_DOUBLE, attr_data3); @@ -7203,6 +7207,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) char attrname[NAME_BUF_SIZE]; /* Name of attribute */ unsigned curr_dset; /* Current dataset to work on */ unsigned u; /* Local index variable */ + hid_t ret_id; /* Generic hid_t return value */ herr_t ret; /* Generic return value */ /* Create dataspace for dataset & attributes */ @@ -7297,8 +7302,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); /* Check for opening an attribute on an object with no attributes */ - ret = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen_by_idx"); + ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen_by_idx"); /* Create attributes, up to limit of compact form */ for(u = 0; u < max_compact; u++) { @@ -7330,8 +7335,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); /* Check for out of bound opening an attribute on an object */ - ret = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen_by_idx"); + ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen_by_idx"); /* Test opening attributes by index stored compactly */ ret = attr_open_by_idx_check(my_dataset, idx_type, order, u); @@ -7403,8 +7408,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end if */ /* Check for out of bound opening an attribute on an object */ - ret = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen_by_idx"); + ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen_by_idx"); /* Test opening attributes by index stored compactly */ ret = attr_open_by_idx_check(my_dataset, idx_type, order, u); @@ -7549,6 +7554,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) char attrname[NAME_BUF_SIZE]; /* Name of attribute */ unsigned curr_dset; /* Current dataset to work on */ unsigned u; /* Local index variable */ + hid_t ret_id; /* Generic hid_t return value */ herr_t ret; /* Generic return value */ /* Create dataspace for dataset & attributes */ @@ -7618,14 +7624,14 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); /* Check for opening a non-existant attribute on an object with no attributes */ - ret = H5Aopen(my_dataset, "foo", H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen"); + ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen"); - ret = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen_by_name"); + ret_id = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen_by_name"); - ret = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen_by_name"); + ret_id = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen_by_name"); /* Create attributes, up to limit of compact form */ for(u = 0; u < max_compact; u++) { @@ -7657,14 +7663,14 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); /* Check for opening a non-existant attribute on an object with compact attribute storage */ - ret = H5Aopen(my_dataset, "foo", H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen"); + ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen"); - ret = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen_by_name"); + ret_id = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen_by_name"); - ret = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen_by_name"); + ret_id = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen_by_name"); /* Test opening attributes stored compactly */ ret = attr_open_check(fid, dsetname, my_dataset, u); @@ -7739,14 +7745,14 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end if */ /* Check for opening a non-existant attribute on an object with dense attribute storage */ - ret = H5Aopen(my_dataset, "foo", H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen"); + ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen"); - ret = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen_by_name"); + ret_id = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen_by_name"); - ret = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen_by_name"); + ret_id = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen_by_name"); /* Test opening attributes stored compactly */ ret = attr_open_check(fid, dsetname, my_dataset, u); diff --git a/test/th5s.c b/test/th5s.c index ebbaa37..43ad1bb 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -1171,6 +1171,7 @@ test_h5s_encode(void) H5S_sel_type sel_type; H5S_class_t space_type; hssize_t nblocks; + hid_t ret_id; /* Generic hid_t return value */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1195,9 +1196,9 @@ test_h5s_encode(void) /* Try decoding bogus buffer */ H5E_BEGIN_TRY { - ret = H5Sdecode(sbuf); + ret_id = H5Sdecode(sbuf); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Sdecode"); + VERIFY(ret_id, FAIL, "H5Sdecode"); ret = H5Sencode(sid1, sbuf, &sbuf_size); CHECK(ret, FAIL, "H5Sencode"); diff --git a/test/trefer.c b/test/trefer.c index 7e08018..9cb7f26 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -83,6 +83,7 @@ test_reference_params(void) unsigned *tu32; /* Temporary pointer to uint32 data */ int i; /* counting variables */ const char *write_comment = "Foo!"; /* Comments for group */ + hid_t ret_id; /* Generic hid_t return value */ herr_t ret; /* Generic return value */ size_t name_size; /* Size of reference name */ @@ -210,12 +211,12 @@ test_reference_params(void) VERIFY(name_size, FAIL, "H5Rget_name type"); /* Test parameters to H5Rget_region */ - ret = H5Rget_region((hid_t)-1, H5R_OBJECT, &rbuf[0]); - VERIFY(ret, FAIL, "H5Rget_region loc_id"); - ret = H5Rget_region(fid1, H5R_OBJECT, NULL); - VERIFY(ret, FAIL, "H5Rget_region ref"); - ret = H5Rget_region(fid1, H5R_OBJECT, &rbuf[0]); - VERIFY(ret, FAIL, "H5Rget_region type"); + ret_id = H5Rget_region((hid_t)-1, H5R_OBJECT, &rbuf[0]); + VERIFY(ret_id, FAIL, "H5Rget_region loc_id"); + ret_id = H5Rget_region(fid1, H5R_OBJECT, NULL); + VERIFY(ret_id, FAIL, "H5Rget_region ref"); + ret_id = H5Rget_region(fid1, H5R_OBJECT, &rbuf[0]); + VERIFY(ret_id, FAIL, "H5Rget_region type"); /* Close disk dataspace */ ret = H5Sclose(sid1); diff --git a/testpar/t_coll_chunk.c b/testpar/t_coll_chunk.c index 11d7b10..ab9de09 100644 --- a/testpar/t_coll_chunk.c +++ b/testpar/t_coll_chunk.c @@ -1266,7 +1266,7 @@ ccdataset_vrfy(hsize_t start[], if (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED){ printf("Dataset Verify failed at [%lu][%lu]: expect %d, got %d\n", (unsigned long)i, (unsigned long)j, - *(original), *(dataset)); + *(oriptr), *(dataptr)); } } } diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 67a9451..1234f8e 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -4383,6 +4383,11 @@ test_dense_attr(void) hid_t atFileSpace, atid; hsize_t atDims[1] = {10000}; herr_t status; + const char *filename; + + /* get filename */ + filename = (const char *)GetTestParameters(); + HDassert( filename != NULL ); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -4394,7 +4399,7 @@ test_dense_attr(void) VRFY((status >= 0), "H5Pset_libver_bounds succeeded"); status = H5Pset_fapl_mpio(fpid, MPI_COMM_WORLD, MPI_INFO_NULL); VRFY((status >= 0), "H5Pset_fapl_mpio succeeded"); - fid = H5Fcreate("ph5Dense.h5", H5F_ACC_TRUNC, H5P_DEFAULT, fpid); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fpid); VRFY((fid > 0), "H5Fcreate succeeded"); status = H5Pclose(fpid); VRFY((status >= 0), "H5Pclose succeeded"); diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index df6257f..c55e2de 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -528,7 +528,7 @@ int main(int argc, char **argv) } AddTest("denseattr", test_dense_attr, NULL, - "Store Dense Attributes", NULL); + "Store Dense Attributes", PARATESTFILE); /* Display testing information */ diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c index b5965ba..278cd3e 100644 --- a/tools/h5copy/h5copy.c +++ b/tools/h5copy/h5copy.c @@ -475,7 +475,7 @@ main (int argc, const char *argv[]) /* free link info path */ if (linkinfo.trg_path) - HDfree((char*)linkinfo.trg_path); + HDfree(linkinfo.trg_path); /* close propertis */ if(H5Pclose(ocpl_id)<0) @@ -496,7 +496,7 @@ error: /* free link info path */ if (linkinfo.trg_path) - HDfree((char*)linkinfo.trg_path); + HDfree(linkinfo.trg_path); H5E_BEGIN_TRY { H5Pclose(ocpl_id); diff --git a/tools/h5diff/CMakeTests.cmake b/tools/h5diff/CMakeTests.cmake index 686803b..c650dbe 100644 --- a/tools/h5diff/CMakeTests.cmake +++ b/tools/h5diff/CMakeTests.cmake @@ -1072,12 +1072,7 @@ ADD_H5_TEST (h5diff_80 1 -v ${FILE7} ${FILE8}) ADD_H5_TEST (h5diff_90 0 -v ${FILE2} ${FILE2}) # 10. read by hyperslab, print indexes -#if test -n "$pmode" -a "$mydomainname" = hdfgroup.uiuc.edu; then -# # skip this test which sometimes hangs in some THG machines -# message (STATUS "SKIP -v ${FILE9} ${FILE10}) -#else -# ADD_H5_TEST (h5diff_100 1 -v ${FILE9} ${FILE10}) -#fi +ADD_H5_TEST (h5diff_100 1 -v ${FILE9} ${FILE10}) # 11. floating point comparison ADD_H5_TEST (h5diff_101 1 -v ${FILE1} ${FILE1} g1/d1 g1/d2) diff --git a/tools/h5dump/CMakeTests.cmake b/tools/h5dump/CMakeTests.cmake index f9ebc32..afb482e 100644 --- a/tools/h5dump/CMakeTests.cmake +++ b/tools/h5dump/CMakeTests.cmake @@ -50,6 +50,7 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/tbin4.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tbigdims.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tbitnopaque.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tboot1.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tboot2.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tboot2A.ddl @@ -206,6 +207,7 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/tattrreg.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tbigdims.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tbinary.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tbitnopaque.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tchar.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tcmpdattrintsize.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tcmpdintarray.h5 @@ -805,6 +807,8 @@ tbinregR.out.err tbigdims.out tbigdims.out.err + tbitnopaque.out + tbitnopaque.out.err tboot1.out tboot1.out.err tboot2.out @@ -1147,6 +1151,8 @@ ADD_H5ERR_MASK_TEST (tcomp-3 0 "--enable-error-stack;-t;/#6632;-g;/group2;tcompound.h5") # test complicated compound datatype ADD_H5_TEST (tcomp-4 0 --enable-error-stack tcompound_complex.h5) + # tests for bitfields and opaque data types + ADD_H5_TEST (tbitnopaque 0 --enable-error-stack tbitnopaque.h5) #test for the nested compound type ADD_H5_TEST (tnestcomp-1 0 --enable-error-stack tnestedcomp.h5) diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index bf3c97d..0857d80 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -110,6 +110,7 @@ #define FILE77 "tcmpdints.h5" #define FILE78 "tscalarintattrsize.h5" #define FILE79 "tintsattrs.h5" +#define FILE80 "tbitnopaque.h5" /*------------------------------------------------------------------------- * prototypes @@ -360,6 +361,8 @@ typedef struct s1_t { #define F77_DATASETNAME2 "CompoundRInts" #define F77_LENGTH 64 +#define F80_DIM32 32 + static void gent_group(void) { @@ -9667,6 +9670,156 @@ gent_intsattrs(void) H5Fclose(fid); } +static void gent_bitnopaquefields(void) +{ + /* Compound datatype */ + typedef struct s_t + { + unsigned char a; + unsigned int b; + unsigned long c; + unsigned long long d; + } s_t; + hid_t file, grp=-1, type=-1, space=-1, dset=-1; + size_t i; + hsize_t nelmts = F80_DIM32; + unsigned char buf[F80_DIM32]; /* bitfield, opaque */ + unsigned int buf2[F80_DIM32]; /* bitfield, opaque */ + unsigned long buf3[F80_DIM32]; /* bitfield, opaque */ + unsigned long long buf4[F80_DIM32]; /* bitfield, opaque */ + s_t buf5[F80_DIM32]; /* compound */ + + file = H5Fcreate(FILE80, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + if ((grp = H5Gcreate2(file, "bittypetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + /* bitfield_1 */ + if ((type = H5Tcopy(H5T_STD_B8LE)) >= 0) { + if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { + if ((dset = H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + for (i = 0; i < nelmts; i++) { + buf[i] = (unsigned char)0xff ^ (unsigned char)i; + } + H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + H5Dclose(dset); + } + H5Sclose(space); + } + H5Tclose(type); + } + + /* bitfield_2 */ + if ((type = H5Tcopy(H5T_STD_B16LE)) >= 0) { + if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { + if ((dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + for (i = 0; i < nelmts; i++) { + buf2[i] = (unsigned int)0xffff ^ (unsigned int)(i * 16); + } + H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2); + H5Dclose(dset); + } + H5Sclose(space); + } + H5Tclose(type); + } + + /* bitfield_3 */ + if ((type = H5Tcopy(H5T_STD_B32LE)) >= 0) { + if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { + if ((dset = H5Dcreate2(grp, "bitfield_3", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + for (i = 0; i < nelmts; i++) { + buf3[i] = (unsigned long)0xffffffff ^ (unsigned long)(i * 32); + } + H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf3); + H5Dclose(dset); + } + H5Sclose(space); + } + H5Tclose(type); + } + + /* bitfield_4 */ + if ((type = H5Tcopy(H5T_STD_B64LE)) >= 0) { + if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { + if ((dset = H5Dcreate2(grp, "bitfield_4", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + for (i = 0; i < nelmts; i++) { + buf4[i] = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64); + } + H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf4); + H5Dclose(dset); + } + H5Sclose(space); + } + H5Tclose(type); + } + + H5Gclose(grp); + } + + if ((grp = H5Gcreate2(file, "opaquetypetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + /* opaque_1 */ + if ((type = H5Tcreate(H5T_OPAQUE, 1)) >= 0) { + if ((H5Tset_tag(type, "1-byte opaque type")) >= 0) { + if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { + if ((dset = H5Dcreate2(grp, "opaque_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + for(i = 0; i < nelmts; i++) + buf[i] = (unsigned char)0xff ^ (unsigned char)i; + H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + H5Dclose(dset); + } + H5Sclose(space); + } + } + H5Tclose(type); + } + + /* opaque_2 */ + if ((type = H5Tcreate(H5T_OPAQUE, 2)) >= 0) { + if ((H5Tset_tag(type, "2-byte opaque type")) >= 0) { + if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { + if ((dset = H5Dcreate2(grp, "opaque_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + for(i = 0; i < nelmts; i++) + buf2[i] = (unsigned int)0xffff ^ (unsigned int)(i * 16); + + H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2); + H5Dclose(dset); + } + H5Sclose(space); + } + } + H5Tclose(type); + } + H5Gclose(grp); + } + + if ((grp = H5Gcreate2(file, "cmpdtypetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + /* compound_1 */ + if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) { + H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE); + H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE); + H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE); + H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE); + if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { + if ((dset = H5Dcreate2(grp, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + for(i = 0; i < nelmts; i++) { + buf5[i].a = (unsigned char)0xff ^ (unsigned char)i; + buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16); + buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32); + buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64); + } + + H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5); + H5Dclose(dset); + } + H5Sclose(space); + } + H5Tclose(type); + } + H5Gclose(grp); + } + + H5Fclose(file); +} + /*------------------------------------------------------------------------- * Function: main @@ -9758,6 +9911,7 @@ int main(void) gent_compound_ints(); gent_intattrscalars(); gent_intsattrs(); + gent_bitnopaquefields(); return 0; } diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index c79fea7..286d7f0 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -337,7 +337,7 @@ done: */ int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) { named_dt_t *dt = *named_dt_head_p; - hid_t ret_value = -1; + int ret_value = -1; while (dt) { /* Pop the datatype off the stack and free it */ diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 44bea47..b5f6861 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -68,7 +68,7 @@ static herr_t walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void /* get the major number from the error stack. */ static herr_t walk_error_callback(UNUSED unsigned n, const H5E_error2_t *err_desc, void *udata) { if (err_desc) - *((int *) udata) = err_desc->maj_num; + *((hid_t *) udata) = err_desc->maj_num; return 0; } diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 13cea23..badaf3c 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -549,7 +549,7 @@ static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo, done: if (lnk_info.trg_path) - HDfree((char *)lnk_info.trg_path); + HDfree(lnk_info.trg_path); return 0; } @@ -1064,9 +1064,9 @@ out: /* free link info buffer */ if (trg_linfo1.trg_path) - HDfree((char *)trg_linfo1.trg_path); + HDfree(trg_linfo1.trg_path); if (trg_linfo2.trg_path) - HDfree((char *)trg_linfo2.trg_path); + HDfree(trg_linfo2.trg_path); /* close */ H5E_BEGIN_TRY @@ -1905,9 +1905,9 @@ hsize_t diff(hid_t file1_id, /* free link info buffer */ if (linkinfo1.trg_path) - HDfree((char *)linkinfo1.trg_path); + HDfree(linkinfo1.trg_path); if (linkinfo2.trg_path) - HDfree((char *)linkinfo2.trg_path); + HDfree(linkinfo2.trg_path); return nfound; @@ -1948,9 +1948,9 @@ out2: /* free link info buffer */ if (linkinfo1.trg_path) - HDfree((char *)linkinfo1.trg_path); + HDfree(linkinfo1.trg_path); if (linkinfo2.trg_path) - HDfree((char *)linkinfo2.trg_path); + HDfree(linkinfo2.trg_path); /* close */ /* disable error reporting */ diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index b5c4251..3981b1e 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -1249,7 +1249,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf); if(H5Sclose(sm_space) < 0) - H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); if(sm_buf) HDfree(sm_buf); sm_buf = NULL; @@ -1479,7 +1479,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co CATCH if(f_space >= 0 && H5Sclose(f_space) < 0) - H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); return ret_value; } @@ -1659,9 +1659,9 @@ CATCH done: if(sm_space >= 0 && H5Sclose(sm_space) < 0) - H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); if(f_space >= 0 && H5Sclose(f_space) < 0) - H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); return ret_value; } diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c index caf71df..52d84f9 100644 --- a/tools/lib/h5tools_ref.c +++ b/tools/lib/h5tools_ref.c @@ -65,7 +65,7 @@ free_ref_path_info(void *item, void UNUSED *key, void UNUSED *operator_data/*in, { ref_path_node_t *node = (ref_path_node_t *)item; - HDfree((void *)node->path); + HDfree(node->path); HDfree(node); return(0); diff --git a/tools/testfiles/tbitnopaque.ddl b/tools/testfiles/tbitnopaque.ddl new file mode 100644 index 0000000..9000463 --- /dev/null +++ b/tools/testfiles/tbitnopaque.ddl @@ -0,0 +1,293 @@ +HDF5 "tbitnopaque.h5" { +GROUP "/" { + GROUP "bittypetests" { + DATASET "bitfield_1" { + DATATYPE H5T_STD_B8LE + DATASPACE SIMPLE { ( 32 ) / ( 32 ) } + DATA { + (0): 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0xf7, 0xf6, + (10): 0xf5, 0xf4, 0xf3, 0xf2, 0xf1, 0xf0, 0xef, 0xee, 0xed, 0xec, + (20): 0xeb, 0xea, 0xe9, 0xe8, 0xe7, 0xe6, 0xe5, 0xe4, 0xe3, 0xe2, + (30): 0xe1, 0xe0 + } + } + DATASET "bitfield_2" { + DATATYPE H5T_STD_B16LE + DATASPACE SIMPLE { ( 32 ) / ( 32 ) } + DATA { + (0): ff:ff, 00:00, ef:ff, 00:00, df:ff, 00:00, cf:ff, 00:00, bf:ff, + (9): 00:00, af:ff, 00:00, 9f:ff, 00:00, 8f:ff, 00:00, 7f:ff, 00:00, + (18): 6f:ff, 00:00, 5f:ff, 00:00, 4f:ff, 00:00, 3f:ff, 00:00, 2f:ff, + (27): 00:00, 1f:ff, 00:00, 0f:ff, 00:00 + } + } + DATASET "bitfield_3" { + DATATYPE H5T_STD_B32LE + DATASPACE SIMPLE { ( 32 ) / ( 32 ) } + DATA { + (0): ff:ff:ff:ff, 00:00:00:00, df:ff:ff:ff, 00:00:00:00, + (4): bf:ff:ff:ff, 00:00:00:00, 9f:ff:ff:ff, 00:00:00:00, + (8): 7f:ff:ff:ff, 00:00:00:00, 5f:ff:ff:ff, 00:00:00:00, + (12): 3f:ff:ff:ff, 00:00:00:00, 1f:ff:ff:ff, 00:00:00:00, + (16): ff:fe:ff:ff, 00:00:00:00, df:fe:ff:ff, 00:00:00:00, + (20): bf:fe:ff:ff, 00:00:00:00, 9f:fe:ff:ff, 00:00:00:00, + (24): 7f:fe:ff:ff, 00:00:00:00, 5f:fe:ff:ff, 00:00:00:00, + (28): 3f:fe:ff:ff, 00:00:00:00, 1f:fe:ff:ff, 00:00:00:00 + } + } + DATASET "bitfield_4" { + DATATYPE H5T_STD_B64LE + DATASPACE SIMPLE { ( 32 ) / ( 32 ) } + DATA { + (0): ff:ff:ff:ff:ff:ff:ff:ff, bf:ff:ff:ff:ff:ff:ff:ff, + (2): 7f:ff:ff:ff:ff:ff:ff:ff, 3f:ff:ff:ff:ff:ff:ff:ff, + (4): ff:fe:ff:ff:ff:ff:ff:ff, bf:fe:ff:ff:ff:ff:ff:ff, + (6): 7f:fe:ff:ff:ff:ff:ff:ff, 3f:fe:ff:ff:ff:ff:ff:ff, + (8): ff:fd:ff:ff:ff:ff:ff:ff, bf:fd:ff:ff:ff:ff:ff:ff, + (10): 7f:fd:ff:ff:ff:ff:ff:ff, 3f:fd:ff:ff:ff:ff:ff:ff, + (12): ff:fc:ff:ff:ff:ff:ff:ff, bf:fc:ff:ff:ff:ff:ff:ff, + (14): 7f:fc:ff:ff:ff:ff:ff:ff, 3f:fc:ff:ff:ff:ff:ff:ff, + (16): ff:fb:ff:ff:ff:ff:ff:ff, bf:fb:ff:ff:ff:ff:ff:ff, + (18): 7f:fb:ff:ff:ff:ff:ff:ff, 3f:fb:ff:ff:ff:ff:ff:ff, + (20): ff:fa:ff:ff:ff:ff:ff:ff, bf:fa:ff:ff:ff:ff:ff:ff, + (22): 7f:fa:ff:ff:ff:ff:ff:ff, 3f:fa:ff:ff:ff:ff:ff:ff, + (24): ff:f9:ff:ff:ff:ff:ff:ff, bf:f9:ff:ff:ff:ff:ff:ff, + (26): 7f:f9:ff:ff:ff:ff:ff:ff, 3f:f9:ff:ff:ff:ff:ff:ff, + (28): ff:f8:ff:ff:ff:ff:ff:ff, bf:f8:ff:ff:ff:ff:ff:ff, + (30): 7f:f8:ff:ff:ff:ff:ff:ff, 3f:f8:ff:ff:ff:ff:ff:ff + } + } + } + GROUP "cmpdtypetests" { + DATASET "compound_1" { + DATATYPE H5T_COMPOUND { + H5T_STD_B8LE "a"; + H5T_STD_B16LE "b"; + H5T_STD_B32LE "c"; + H5T_STD_B64LE "d"; + } + DATASPACE SIMPLE { ( 32 ) / ( 32 ) } + DATA { + (0): { + 0xff, + ff:ff, + ff:ff:ff:ff, + ff:ff:ff:ff:ff:ff:ff:ff + }, + (1): { + 0xfe, + ef:ff, + df:ff:ff:ff, + bf:ff:ff:ff:ff:ff:ff:ff + }, + (2): { + 0xfd, + df:ff, + bf:ff:ff:ff, + 7f:ff:ff:ff:ff:ff:ff:ff + }, + (3): { + 0xfc, + cf:ff, + 9f:ff:ff:ff, + 3f:ff:ff:ff:ff:ff:ff:ff + }, + (4): { + 0xfb, + bf:ff, + 7f:ff:ff:ff, + ff:fe:ff:ff:ff:ff:ff:ff + }, + (5): { + 0xfa, + af:ff, + 5f:ff:ff:ff, + bf:fe:ff:ff:ff:ff:ff:ff + }, + (6): { + 0xf9, + 9f:ff, + 3f:ff:ff:ff, + 7f:fe:ff:ff:ff:ff:ff:ff + }, + (7): { + 0xf8, + 8f:ff, + 1f:ff:ff:ff, + 3f:fe:ff:ff:ff:ff:ff:ff + }, + (8): { + 0xf7, + 7f:ff, + ff:fe:ff:ff, + ff:fd:ff:ff:ff:ff:ff:ff + }, + (9): { + 0xf6, + 6f:ff, + df:fe:ff:ff, + bf:fd:ff:ff:ff:ff:ff:ff + }, + (10): { + 0xf5, + 5f:ff, + bf:fe:ff:ff, + 7f:fd:ff:ff:ff:ff:ff:ff + }, + (11): { + 0xf4, + 4f:ff, + 9f:fe:ff:ff, + 3f:fd:ff:ff:ff:ff:ff:ff + }, + (12): { + 0xf3, + 3f:ff, + 7f:fe:ff:ff, + ff:fc:ff:ff:ff:ff:ff:ff + }, + (13): { + 0xf2, + 2f:ff, + 5f:fe:ff:ff, + bf:fc:ff:ff:ff:ff:ff:ff + }, + (14): { + 0xf1, + 1f:ff, + 3f:fe:ff:ff, + 7f:fc:ff:ff:ff:ff:ff:ff + }, + (15): { + 0xf0, + 0f:ff, + 1f:fe:ff:ff, + 3f:fc:ff:ff:ff:ff:ff:ff + }, + (16): { + 0xef, + ff:fe, + ff:fd:ff:ff, + ff:fb:ff:ff:ff:ff:ff:ff + }, + (17): { + 0xee, + ef:fe, + df:fd:ff:ff, + bf:fb:ff:ff:ff:ff:ff:ff + }, + (18): { + 0xed, + df:fe, + bf:fd:ff:ff, + 7f:fb:ff:ff:ff:ff:ff:ff + }, + (19): { + 0xec, + cf:fe, + 9f:fd:ff:ff, + 3f:fb:ff:ff:ff:ff:ff:ff + }, + (20): { + 0xeb, + bf:fe, + 7f:fd:ff:ff, + ff:fa:ff:ff:ff:ff:ff:ff + }, + (21): { + 0xea, + af:fe, + 5f:fd:ff:ff, + bf:fa:ff:ff:ff:ff:ff:ff + }, + (22): { + 0xe9, + 9f:fe, + 3f:fd:ff:ff, + 7f:fa:ff:ff:ff:ff:ff:ff + }, + (23): { + 0xe8, + 8f:fe, + 1f:fd:ff:ff, + 3f:fa:ff:ff:ff:ff:ff:ff + }, + (24): { + 0xe7, + 7f:fe, + ff:fc:ff:ff, + ff:f9:ff:ff:ff:ff:ff:ff + }, + (25): { + 0xe6, + 6f:fe, + df:fc:ff:ff, + bf:f9:ff:ff:ff:ff:ff:ff + }, + (26): { + 0xe5, + 5f:fe, + bf:fc:ff:ff, + 7f:f9:ff:ff:ff:ff:ff:ff + }, + (27): { + 0xe4, + 4f:fe, + 9f:fc:ff:ff, + 3f:f9:ff:ff:ff:ff:ff:ff + }, + (28): { + 0xe3, + 3f:fe, + 7f:fc:ff:ff, + ff:f8:ff:ff:ff:ff:ff:ff + }, + (29): { + 0xe2, + 2f:fe, + 5f:fc:ff:ff, + bf:f8:ff:ff:ff:ff:ff:ff + }, + (30): { + 0xe1, + 1f:fe, + 3f:fc:ff:ff, + 7f:f8:ff:ff:ff:ff:ff:ff + }, + (31): { + 0xe0, + 0f:fe, + 1f:fc:ff:ff, + 3f:f8:ff:ff:ff:ff:ff:ff + } + } + } + } + GROUP "opaquetypetests" { + DATASET "opaque_1" { + DATATYPE H5T_OPAQUE { + OPAQUE_TAG "1-byte opaque type"; + } + DATASPACE SIMPLE { ( 32 ) / ( 32 ) } + DATA { + (0): 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0xf7, 0xf6, + (10): 0xf5, 0xf4, 0xf3, 0xf2, 0xf1, 0xf0, 0xef, 0xee, 0xed, 0xec, + (20): 0xeb, 0xea, 0xe9, 0xe8, 0xe7, 0xe6, 0xe5, 0xe4, 0xe3, 0xe2, + (30): 0xe1, 0xe0 + } + } + DATASET "opaque_2" { + DATATYPE H5T_OPAQUE { + OPAQUE_TAG "2-byte opaque type"; + } + DATASPACE SIMPLE { ( 32 ) / ( 32 ) } + DATA { + (0): ff:ff, 00:00, ef:ff, 00:00, df:ff, 00:00, cf:ff, 00:00, bf:ff, + (9): 00:00, af:ff, 00:00, 9f:ff, 00:00, 8f:ff, 00:00, 7f:ff, 00:00, + (18): 6f:ff, 00:00, 5f:ff, 00:00, 4f:ff, 00:00, 3f:ff, 00:00, 2f:ff, + (27): 00:00, 1f:ff, 00:00, 0f:ff, 00:00 + } + } + } +} +} diff --git a/tools/testfiles/tbitnopaque.h5 b/tools/testfiles/tbitnopaque.h5 new file mode 100644 index 0000000..2b1f23d Binary files /dev/null and b/tools/testfiles/tbitnopaque.h5 differ diff --git a/vms/src/h5pubconf.h b/vms/src/h5pubconf.h index 1510dee..feba2f7 100644 --- a/vms/src/h5pubconf.h +++ b/vms/src/h5pubconf.h @@ -501,8 +501,7 @@ #define H5_PACKAGE_NAME "HDF5" /* Define to the full name and version of this package. */ -#define H5_PACKAGE_STRING "HDF5 1.9.192-swmr0" - +#define H5_PACKAGE_STRING "HDF5 1.9.203-swmr0" /* Define to the one symbol short name of this package. */ #define H5_PACKAGE_TARNAME "hdf5" @@ -510,7 +509,7 @@ #define H5_PACKAGE_URL "" /* Define to the version of this package. */ -#define H5_PACKAGE_VERSION "1.9.192-swmr0" +#define H5_PACKAGE_VERSION "1.9.203-swmr0" /* Width for printf() for type `long long' or `__int64', use `ll' */ #define H5_PRINTF_LL_WIDTH "ll" @@ -673,7 +672,7 @@ /* #undef H5_USING_MEMCHECKER */ /* Version number of package */ -#define H5_VERSION "1.9.192-swmr0" +#define H5_VERSION "1.9.203-swmr0" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ -- cgit v0.12