summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeInstallation.cmake18
-rw-r--r--CMakeLists.txt13
-rw-r--r--MANIFEST5
-rw-r--r--c++/CMakeLists.txt2
-rw-r--r--c++/examples/CMakeLists.txt2
-rw-r--r--c++/src/CMakeLists.txt51
-rw-r--r--c++/src/H5AbstractDs.cpp1
-rw-r--r--c++/src/H5ArrayType.cpp8
-rw-r--r--c++/src/H5AtomType.cpp13
-rw-r--r--c++/src/H5Attribute.cpp1
-rw-r--r--c++/src/H5CommonFG.cpp1
-rw-r--r--c++/src/H5CompType.cpp39
-rw-r--r--c++/src/H5Cpp.h1
-rw-r--r--c++/src/H5CppDoc.h13
-rw-r--r--c++/src/H5DataSet.cpp14
-rw-r--r--c++/src/H5DataSpace.cpp20
-rw-r--r--c++/src/H5DataType.cpp10
-rw-r--r--c++/src/H5DcreatProp.cpp29
-rw-r--r--c++/src/H5DxferProp.cpp9
-rw-r--r--c++/src/H5EnumType.cpp1
-rw-r--r--c++/src/H5FaccProp.cpp48
-rw-r--r--c++/src/H5FcreatProp.cpp25
-rw-r--r--c++/src/H5File.cpp6
-rw-r--r--c++/src/H5FloatType.cpp1
-rw-r--r--c++/src/H5Group.cpp21
-rw-r--r--c++/src/H5IntType.cpp1
-rw-r--r--c++/src/H5LcreatProp.cpp146
-rw-r--r--c++/src/H5LcreatProp.h71
-rw-r--r--c++/src/H5Library.cpp9
-rw-r--r--c++/src/H5Location.cpp482
-rw-r--r--c++/src/H5Location.h86
-rw-r--r--c++/src/H5Object.cpp7
-rw-r--r--c++/src/H5OcreatProp.cpp14
-rw-r--r--c++/src/H5PredType.cpp1
-rw-r--r--c++/src/H5StrType.cpp5
-rw-r--r--c++/src/H5VarLenType.cpp1
-rw-r--r--c++/src/Makefile.am34
-rw-r--r--c++/src/cpp_doc_config4
-rw-r--r--c++/src/footer.html4
-rw-r--r--c++/test/CMakeLists.txt2
-rw-r--r--c++/test/tlinks.cpp503
-rwxr-xr-xconfig/cmake/CTestScript.cmake2
-rw-r--r--config/cmake/HDF518_Examples.cmake.in2
-rw-r--r--config/cmake/HDF5_Examples.cmake.in2
-rw-r--r--config/cmake/UseJava.cmake74
-rwxr-xr-xconfig/cmake/libh5cc.in32
-rwxr-xr-xconfig/cmake/libhdf5.pc.in14
-rwxr-xr-xconfig/cmake/scripts/CTestScript.cmake2
-rwxr-xr-xconfig/cmake/scripts/HDF5config.cmake2
-rw-r--r--config/cmake_ext_mod/FindMPI.cmake1514
-rw-r--r--config/cmake_ext_mod/FindMPI/fortranparam_mpi.f90.in4
-rw-r--r--config/cmake_ext_mod/FindMPI/libver_mpi.c19
-rw-r--r--config/cmake_ext_mod/FindMPI/libver_mpi.f90.in7
-rw-r--r--config/cmake_ext_mod/FindMPI/mpiver.f90.in10
-rw-r--r--config/cmake_ext_mod/FindMPI/test_mpi.c37
-rw-r--r--config/cmake_ext_mod/FindMPI/test_mpi.f90.in6
-rw-r--r--examples/CMakeLists.txt2
-rw-r--r--fortran/CMakeLists.txt2
-rw-r--r--fortran/examples/CMakeLists.txt2
-rw-r--r--fortran/src/CMakeLists.txt2
-rw-r--r--fortran/test/CMakeLists.txt2
-rw-r--r--fortran/testpar/CMakeLists.txt2
-rw-r--r--hl/CMakeLists.txt2
-rw-r--r--hl/c++/CMakeLists.txt2
-rw-r--r--hl/c++/examples/CMakeLists.txt2
-rw-r--r--hl/c++/src/CMakeLists.txt49
-rw-r--r--hl/c++/test/CMakeLists.txt2
-rw-r--r--hl/examples/CMakeLists.txt2
-rw-r--r--hl/fortran/CMakeLists.txt2
-rw-r--r--hl/fortran/examples/CMakeLists.txt2
-rw-r--r--hl/fortran/src/CMakeLists.txt2
-rw-r--r--hl/fortran/test/CMakeLists.txt2
-rw-r--r--hl/src/CMakeLists.txt48
-rw-r--r--hl/test/CMakeLists.txt2
-rw-r--r--hl/tools/CMakeLists.txt2
-rw-r--r--hl/tools/gif2h5/CMakeLists.txt2
-rw-r--r--hl/tools/h5watch/CMakeLists.txt2
-rw-r--r--java/CMakeLists.txt2
-rw-r--r--java/examples/CMakeLists.txt2
-rw-r--r--java/examples/datasets/CMakeLists.txt2
-rw-r--r--java/examples/datatypes/CMakeLists.txt2
-rw-r--r--java/examples/groups/CMakeLists.txt2
-rw-r--r--java/examples/intro/CMakeLists.txt2
-rw-r--r--java/src/CMakeLists.txt2
-rw-r--r--java/src/hdf/CMakeLists.txt2
-rw-r--r--java/src/hdf/hdf5lib/CMakeLists.txt2
-rw-r--r--java/src/jni/CMakeLists.txt2
-rw-r--r--java/test/CMakeLists.txt2
-rw-r--r--java/test/TestH5Pfapl.java2
-rw-r--r--release_docs/INSTALL44
-rw-r--r--release_docs/INSTALL_CMake.txt5
-rw-r--r--release_docs/RELEASE.txt132
-rw-r--r--release_docs/USING_HDF5_CMake.txt4
-rw-r--r--src/CMakeLists.txt50
-rw-r--r--src/H5Abtree2.c4
-rw-r--r--src/H5Adense.c4
-rw-r--r--src/H5Gbtree2.c4
-rw-r--r--src/H5Gdense.c20
-rw-r--r--src/H5HFcache.c2
-rw-r--r--src/H5Oainfo.c5
-rw-r--r--src/H5Oattr.c8
-rw-r--r--src/H5Obogus.c5
-rw-r--r--src/H5Obtreek.c5
-rw-r--r--src/H5Ocache.c4
-rw-r--r--src/H5Ocache_image.c4
-rw-r--r--src/H5Ocont.c5
-rw-r--r--src/H5Odrvinfo.c5
-rw-r--r--src/H5Odtype.c4
-rw-r--r--src/H5Oefl.c5
-rw-r--r--src/H5Ofill.c10
-rw-r--r--src/H5Ofsinfo.c6
-rw-r--r--src/H5Oginfo.c5
-rw-r--r--src/H5Olayout.c5
-rw-r--r--src/H5Olinfo.c5
-rw-r--r--src/H5Olink.c5
-rw-r--r--src/H5Omessage.c4
-rw-r--r--src/H5Omtime.c10
-rw-r--r--src/H5Oname.c5
-rw-r--r--src/H5Opkg.h4
-rw-r--r--src/H5Opline.c93
-rw-r--r--src/H5Oprivate.h2
-rw-r--r--src/H5Orefcount.c5
-rw-r--r--src/H5Osdspace.c5
-rw-r--r--src/H5Oshared.c2
-rw-r--r--src/H5Oshared.h8
-rw-r--r--src/H5Oshmesg.c5
-rw-r--r--src/H5Ostab.c5
-rw-r--r--src/H5Pdcpl.c2
-rw-r--r--src/H5Pfapl.c202
-rw-r--r--src/H5S.c4
-rw-r--r--src/H5SM.c16
-rw-r--r--src/H5T.c13
-rw-r--r--src/H5Tprivate.h2
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/CMakeVFDTests.cmake15
-rw-r--r--test/dsets.c8
-rw-r--r--test/dtypes.c681
-rw-r--r--test/gen_bounds.c25
-rw-r--r--test/objcopy.c4
-rw-r--r--test/tfile.c2
-rw-r--r--test/th5s.c4
-rw-r--r--testpar/CMakeLists.txt2
-rw-r--r--testpar/CMakeTests.cmake4
-rw-r--r--testpar/t_cache_image.c34
-rw-r--r--tools/CMakeLists.txt2
-rw-r--r--tools/lib/CMakeLists.txt2
-rw-r--r--tools/src/CMakeLists.txt2
-rw-r--r--tools/src/h5copy/CMakeLists.txt2
-rw-r--r--tools/src/h5diff/CMakeLists.txt2
-rw-r--r--tools/src/h5dump/CMakeLists.txt2
-rw-r--r--tools/src/h5format_convert/CMakeLists.txt2
-rw-r--r--tools/src/h5import/CMakeLists.txt2
-rw-r--r--tools/src/h5jam/CMakeLists.txt2
-rw-r--r--tools/src/h5ls/CMakeLists.txt2
-rw-r--r--tools/src/h5repack/CMakeLists.txt2
-rw-r--r--tools/src/h5stat/CMakeLists.txt2
-rw-r--r--tools/src/misc/CMakeLists.txt2
-rw-r--r--tools/test/CMakeLists.txt2
-rw-r--r--tools/test/h5copy/CMakeLists.txt2
-rw-r--r--tools/test/h5diff/CMakeLists.txt2
-rw-r--r--tools/test/h5dump/CMakeLists.txt2
-rw-r--r--tools/test/h5format_convert/CMakeLists.txt2
-rw-r--r--tools/test/h5import/CMakeLists.txt2
-rw-r--r--tools/test/h5jam/CMakeLists.txt2
-rw-r--r--tools/test/h5ls/CMakeLists.txt2
-rw-r--r--tools/test/h5repack/CMakeLists.txt2
-rw-r--r--tools/test/h5repack/CMakeTests.cmake69
-rw-r--r--tools/test/h5repack/h5repack.sh.in98
-rw-r--r--tools/test/h5repack/testfiles/bounds_latest_latest.h5bin0 -> 82048 bytes
-rw-r--r--tools/test/h5stat/CMakeLists.txt2
-rw-r--r--tools/test/misc/CMakeLists.txt2
-rw-r--r--tools/test/misc/vds/CMakeLists.txt2
-rw-r--r--tools/test/perform/CMakeLists.txt2
173 files changed, 2861 insertions, 2489 deletions
diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake
index 0bfb2cc..4a09d2d 100644
--- a/CMakeInstallation.cmake
+++ b/CMakeInstallation.cmake
@@ -144,24 +144,6 @@ install (
)
#-----------------------------------------------------------------------------
-# Create pkgconfig files
-#-----------------------------------------------------------------------------
-#foreach (libs ${LINK_LIBS})
-# set (LIBS "${LIBS} -l${libs}")
-#endforeach ()
-#foreach (libs ${HDF5_LIBRARIES_TO_EXPORT})
-# set (HDF5LIBS "${HDF5LIBS} -l${libs}")
-#endforeach ()
-#configure_file (
-# ${HDF_RESOURCES_DIR}/libhdf5.pc.in
-# ${HDF5_BINARY_DIR}/CMakeFiles/libhdf5.pc @ONLY
-#)
-#install (
-# FILES ${HDF5_BINARY_DIR}/CMakeFiles/libhdf5.pc
-# DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig
-#)
-
-#-----------------------------------------------------------------------------
# Configure the HDF518_Examples.cmake file and the examples
#-----------------------------------------------------------------------------
option (HDF5_PACK_EXAMPLES "Package the HDF5 Library Examples Compressed File" OFF)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e7dda17..5ac4c60 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5 C CXX)
#-----------------------------------------------------------------------------
@@ -671,12 +671,6 @@ if (HDF5_ENABLE_THREADSAFE)
endif ()
endif ()
-# -----------------------------------------------------------------------
-# wrapper script variables
-#
-#set (CFLAGS "${C_DEFINES}")
-#set (CXXFLAGS "${CXX_DEFINES}")
-
#-----------------------------------------------------------------------------
# Add the HDF5 Library Target to the build
#-----------------------------------------------------------------------------
@@ -806,11 +800,6 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for
endif ()
endif ()
- # -----------------------------------------------------------------------
- # wrapper script variables
- #
-# set (FCFLAGS "${Fortran_DEFINES}")
-
add_subdirectory (fortran)
if (HDF5_BUILD_HL_LIB)
if (EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran")
diff --git a/MANIFEST b/MANIFEST
index f365884..805c8d9 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -374,6 +374,8 @@
./c++/src/H5IntType.h
./c++/src/H5LaccProp.cpp
./c++/src/H5LaccProp.h
+./c++/src/H5LcreatProp.cpp
+./c++/src/H5LcreatProp.h
./c++/src/H5Library.cpp
./c++/src/H5Library.h
./c++/src/H5Location.cpp
@@ -2441,6 +2443,7 @@
#test files for h5repack
./tools/test/h5repack/testfiles/README
+./tools/test/h5repack/testfiles/bounds_latest_latest.h5
./tools/test/h5repack/testfiles/h5repack_aggr.h5
./tools/test/h5repack/testfiles/h5repack_attr.h5
./tools/test/h5repack/testfiles/h5repack_attr_refs.h5
@@ -3083,6 +3086,8 @@
./config/cmake/HDF5Macros.cmake
./config/cmake/HDF5UseFortran.cmake
./config/cmake/jrunTest.cmake
+./config/cmake/libh5cc.in
+./config/cmake/libhdf5.pc.in
./config/cmake/libhdf5.settings.cmake.in
./config/cmake/mccacheinit.cmake
./config/cmake/patch.xml
diff --git a/c++/CMakeLists.txt b/c++/CMakeLists.txt
index 2d3ab0f..2c161f1 100644
--- a/c++/CMakeLists.txt
+++ b/c++/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_CPP)
#-----------------------------------------------------------------------------
diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt
index 397c300..22ecb19 100644
--- a/c++/examples/CMakeLists.txt
+++ b/c++/examples/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_CPP_EXAMPLES)
# --------------------------------------------------------------------
diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt
index 921497f..1136d6a 100644
--- a/c++/src/CMakeLists.txt
+++ b/c++/src/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_CPP_SRC)
#-----------------------------------------------------------------------------
@@ -33,6 +33,7 @@ set (CPP_SOURCES
${HDF5_CPP_SRC_SOURCE_DIR}/H5IdComponent.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5IntType.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5LaccProp.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5LcreatProp.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5Library.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5Location.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5Object.cpp
@@ -70,6 +71,7 @@ set (CPP_HDRS
${HDF5_CPP_SRC_SOURCE_DIR}/H5Include.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5IntType.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5LaccProp.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5LcreatProp.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5Library.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5Location.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5Object.h
@@ -139,3 +141,50 @@ if (HDF5_EXPORTED_TARGETS)
INCLUDES DESTINATION include
)
endif ()
+
+#-----------------------------------------------------------------------------
+# Create pkgconfig files
+#-----------------------------------------------------------------------------
+set (_PKG_CONFIG_PREFIX ${CMAKE_INSTALL_PREFIX})
+set (_PKG_CONFIG_EXEC_PREFIX \${prefix})
+set (_PKG_CONFIG_LIBDIR \${exec_prefix}/lib)
+set (_PKG_CONFIG_INCLUDEDIR \${prefix}/include)
+set (_PKG_CONFIG_LIBNAME "${HDF5_CPP_LIB_CORENAME}")
+set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}")
+
+set (_PKG_CONFIG_LIBS_PRIVATE)
+
+set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_CPP_LIB_CORENAME}")
+if (BUILD_SHARED_LIBS)
+ set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_CPP_LIB_CORENAME}")
+endif ()
+
+set (_PKG_CONFIG_REQUIRES "${HDF5_LIB_CORENAME}")
+set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_LIB_CORENAME}")
+
+configure_file (
+ ${HDF_RESOURCES_DIR}/libhdf5.pc.in
+ ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_CPP_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc
+ @ONLY
+)
+install (
+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_CPP_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc
+ DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig
+ COMPONENT cpplibraries
+)
+
+if (NOT WIN32)
+ set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER})
+ configure_file (
+ ${HDF_RESOURCES_DIR}/libh5cc.in
+ ${HDF5_BINARY_DIR}/CMakeFiles/h5c++
+ @ONLY
+ )
+ install (
+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5c++
+ DESTINATION ${HDF5_INSTALL_BIN_DIR}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+ COMPONENT cpplibraries
+ )
+endif ()
+
diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp
index b900b90..823e873 100644
--- a/c++/src/H5AbstractDs.cpp
+++ b/c++/src/H5AbstractDs.cpp
@@ -22,6 +22,7 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp
index 15ac140..49c31d2 100644
--- a/c++/src/H5ArrayType.cpp
+++ b/c++/src/H5ArrayType.cpp
@@ -19,6 +19,7 @@
#include "H5PropList.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
@@ -119,7 +120,6 @@ ArrayType::ArrayType(const H5Location& loc, const H5std_string& dtype_name) : Da
// Closes the id on the lhs object first with setId, then copies
// each data member from the rhs object. (Issue HDFFV-9562)
// Programmer Binh-Minh Ribler - Mar 2016
-// Modification
//--------------------------------------------------------------------------
ArrayType& ArrayType::operator=(const ArrayType& rhs)
{
@@ -165,9 +165,6 @@ DataType* ArrayType::decode() const
///\return Number of dimensions
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May 2004
-// Modification
-// Apr, 2016
-// Became const.
//--------------------------------------------------------------------------
int ArrayType::getArrayNDims() const
{
@@ -188,9 +185,6 @@ int ArrayType::getArrayNDims() const
///\return Number of dimensions
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May 2004
-// Modification
-// Apr, 2016
-// Became const.
//--------------------------------------------------------------------------
int ArrayType::getArrayDims(hsize_t* dims) const
{
diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp
index 5e709af..5c24cf9 100644
--- a/c++/src/H5AtomType.cpp
+++ b/c++/src/H5AtomType.cpp
@@ -19,6 +19,7 @@
#include "H5PropList.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
@@ -175,8 +176,8 @@ size_t AtomType::getPrecision() const
///\param precision - IN: Number of bits of precision
///\exception H5::DataTypeIException
///\par Description
-/// For information, please see C layer Reference Manuat at:
-/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetPrecision
+/// For information, please refer to the H5Tset_precision API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void AtomType::setPrecision(size_t precision) const
@@ -195,8 +196,8 @@ void AtomType::setPrecision(size_t precision) const
///\return Offset value
///\exception H5::DataTypeIException
///\par Description
-/// For information, please see C layer Reference Manuat at:
-/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetOffset
+/// For information, please refer to the H5Tget_offset API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
// Modification
// 12/05/00: due to C API change
@@ -222,8 +223,8 @@ int AtomType::getOffset() const
///\param offset - IN: Offset of first significant bit
///\exception H5::DataTypeIException
///\par Description
-/// For information, please see C layer Reference Manuat at:
-/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetOffset
+/// For information, please refer to the H5Tset_offset API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void AtomType::setOffset(size_t offset) const
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp
index cbf3029..d90857f 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -27,6 +27,7 @@
#include "H5FcreatProp.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index af5ba0e..979816b 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -22,6 +22,7 @@
#include "H5DxferProp.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp
index d357fbc..3731fd4 100644
--- a/c++/src/H5CompType.cpp
+++ b/c++/src/H5CompType.cpp
@@ -20,6 +20,7 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
@@ -303,7 +304,7 @@ DataType CompType::getMemberDataType(unsigned member_num) const
ArrayType CompType::getMemberArrayType(unsigned member_num) const
{
try {
- ArrayType arraytype(p_get_member_type(member_num));
+ ArrayType arraytype;
f_DataType_setId(&arraytype, p_get_member_type(member_num));
return(arraytype);
}
@@ -323,10 +324,10 @@ ArrayType CompType::getMemberArrayType(unsigned member_num) const
//--------------------------------------------------------------------------
CompType CompType::getMemberCompType(unsigned member_num) const
{
- try {
- CompType comptype(p_get_member_type(member_num));
+ try {
+ CompType comptype;
f_DataType_setId(&comptype, p_get_member_type(member_num));
- return(comptype);
+ return(comptype);
}
catch (DataTypeIException& E) {
throw DataTypeIException("CompType::getMemberCompType", E.getDetailMsg());
@@ -344,10 +345,10 @@ CompType CompType::getMemberCompType(unsigned member_num) const
//--------------------------------------------------------------------------
EnumType CompType::getMemberEnumType(unsigned member_num) const
{
- try {
- EnumType enumtype(p_get_member_type(member_num));
+ try {
+ EnumType enumtype;
f_DataType_setId(&enumtype, p_get_member_type(member_num));
- return(enumtype);
+ return(enumtype);
}
catch (DataTypeIException& E) {
throw DataTypeIException("CompType::getMemberEnumType", E.getDetailMsg());
@@ -365,10 +366,10 @@ EnumType CompType::getMemberEnumType(unsigned member_num) const
//--------------------------------------------------------------------------
IntType CompType::getMemberIntType(unsigned member_num) const
{
- try {
- IntType inttype(p_get_member_type(member_num));
+ try {
+ IntType inttype;
f_DataType_setId(&inttype, p_get_member_type(member_num));
- return(inttype);
+ return(inttype);
}
catch (DataTypeIException& E) {
throw DataTypeIException("CompType::getMemberIntType", E.getDetailMsg());
@@ -386,10 +387,10 @@ IntType CompType::getMemberIntType(unsigned member_num) const
//--------------------------------------------------------------------------
FloatType CompType::getMemberFloatType(unsigned member_num) const
{
- try {
- FloatType floatype(p_get_member_type(member_num));
+ try {
+ FloatType floatype;
f_DataType_setId(&floatype, p_get_member_type(member_num));
- return(floatype);
+ return(floatype);
}
catch (DataTypeIException& E) {
throw DataTypeIException("CompType::getMemberFloatType", E.getDetailMsg());
@@ -407,10 +408,10 @@ FloatType CompType::getMemberFloatType(unsigned member_num) const
//--------------------------------------------------------------------------
StrType CompType::getMemberStrType(unsigned member_num) const
{
- try {
- StrType strtype(p_get_member_type(member_num));
+ try {
+ StrType strtype;
f_DataType_setId(&strtype, p_get_member_type(member_num));
- return(strtype);
+ return(strtype);
}
catch (DataTypeIException& E) {
throw DataTypeIException("CompType::getMemberStrType", E.getDetailMsg());
@@ -428,10 +429,10 @@ StrType CompType::getMemberStrType(unsigned member_num) const
//--------------------------------------------------------------------------
VarLenType CompType::getMemberVarLenType(unsigned member_num) const
{
- try {
- VarLenType varlentype(p_get_member_type(member_num));
+ try {
+ VarLenType varlentype;
f_DataType_setId(&varlentype, p_get_member_type(member_num));
- return(varlentype);
+ return(varlentype);
}
catch (DataTypeIException& E) {
throw DataTypeIException("CompType::getMemberVarLenType", E.getDetailMsg());
diff --git a/c++/src/H5Cpp.h b/c++/src/H5Cpp.h
index 09914e8..b9da80a 100644
--- a/c++/src/H5Cpp.h
+++ b/c++/src/H5Cpp.h
@@ -25,6 +25,7 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5CppDoc.h b/c++/src/H5CppDoc.h
index bfab9cd..6eb85bf 100644
--- a/c++/src/H5CppDoc.h
+++ b/c++/src/H5CppDoc.h
@@ -26,12 +26,9 @@
*
* The C++ API provides C++ wrappers for the HDF5 C Library.
*
- * It is assumed that the user has knowledge of the
- * <a href="https://support.hdfgroup.org/HDF5/doc/H5.format.html">
- * HDF5 file format</a> and its components.
- * For more information on the HDF5 C Library, see the
- * <a href="https://support.hdfgroup.org/HDF5/doc/index.html">
- * HDF5 Software Documentation</a> page.
+ * It is assumed that the user has knowledge of the HDF5 file format and its
+ * components. For more information on the HDF5 C Library, please refer to
+ * the HDF5 Software Documentation page.
*
* Because the HDF5 C Library maps very well to
* the object oriented design approach, classes in the C++ API can
@@ -51,15 +48,13 @@
Datatype Interface (H5T) DataType and subclasses
\endverbatim
*
- * This <a href="https://support.hdfgroup.org/HDF5/doc/cpplus_RM/C2Cppfunction_map.mht">
+ * This <a href="./C2Cppfunction_map.mht">
* table </a> provides a map from the C APIs to the C++ member functions.
* <br />
* \section install_sec Installation
*
* The HDF5 C++ API is included with the HDF5 source code and can
* be obtained from
- * <a href="https://support.hdfgroup.org/HDF5/release/obtainsrc.html">
- * https://support.hdfgroup.org/HDF5/release/obtainsrc.html</a>.
*
* Please refer to the release_docs/INSTALL file under the top directory
* of the HDF5 source code for information about installing, building,
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index 32377bc..fb9b57e 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -28,6 +28,7 @@
#include "H5OcreatProp.h"
#include "H5DxferProp.h"
#include "H5DcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
@@ -90,9 +91,6 @@ DataSet::DataSet(const DataSet& original) : H5Object(), AbstractDs(), id(origina
/// \c loc can be DataSet, Group, H5File, or named DataType, that
/// is a datatype that has been named by DataType::commit.
// Programmer Binh-Minh Ribler - Oct, 2006
-// Modification
-// Jul, 2008
-// Added for application convenience.
//--------------------------------------------------------------------------
DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), AbstractDs(), id(H5I_INVALID_HID)
{
@@ -109,9 +107,6 @@ DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, co
///\param plist - IN: Property list - default to PropList::DEFAULT
///\exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
-// Modification
-// Jul, 2008
-// Added for application convenience.
//--------------------------------------------------------------------------
DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), AbstractDs(), id(H5I_INVALID_HID)
{
@@ -577,10 +572,8 @@ int DataSet::iterateElems(void* buf, const DataType& type, const DataSpace& spac
///\param size - IN: Array containing the new magnitude of each dimension
///\exception H5::DataSetIException
///\par Description
-/// For more information, please see the Description section in
-/// C layer Reference Manual at:
-///\par
-/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-Extend
+/// For information, please refer to the H5Dset_extent API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSet::extend(const hsize_t* size) const
@@ -600,7 +593,6 @@ void DataSet::extend(const hsize_t* size) const
///\param space - IN: Dataspace describing memory buffer & containing selection to use
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2014
-// Modification
//--------------------------------------------------------------------------
void DataSet::fillMemBuf(const void *fill, const DataType& fill_type, void *buf, const DataType& buf_type, const DataSpace& space) const
{
diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp
index 379de2f..b563da4 100644
--- a/c++/src/H5DataSpace.cpp
+++ b/c++/src/H5DataSpace.cpp
@@ -466,9 +466,8 @@ hssize_t DataSpace::getSelectElemNpoints () const
///\param buf - IN: List of element points selected
///\exception H5::DataSpaceIException
///\par Description
-/// For more information, please refer to the C layer Reference
-/// Manual at:
-/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectElemPointList
+/// For information, please refer to the C API
+/// H5Sget_select_elem_pointlist in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSpace::getSelectElemPointlist (hsize_t startpoint, hsize_t numpoints, hsize_t *buf) const
@@ -490,9 +489,8 @@ void DataSpace::getSelectElemPointlist (hsize_t startpoint, hsize_t numpoints, h
/// the coordinates of the diagonally opposite corner
///\exception H5::DataSpaceIException
///\par Description
-/// For more information, please refer to the C layer Reference
-/// Manual at:
-/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectBounds
+/// For information, please refer to the H5Sget_select_bounds API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSpace::getSelectBounds (hsize_t* start, hsize_t* end) const
@@ -516,9 +514,8 @@ void DataSpace::getSelectBounds (hsize_t* start, hsize_t* end) const
/// specifying the coordinates of the elements being selected
///\exception H5::DataSpaceIException
///\par Description
-/// For more information, please refer to the C layer Reference
-/// Manual at:
-/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectElements
+/// For information, please refer to the H5Sselect_elements API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSpace::selectElements (H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const
@@ -598,9 +595,8 @@ bool DataSpace::selectValid () const
///\param block - IN: Size of block in the hyperslab - default to \c NULL
///\exception H5::DataSpaceIException
///\par Description
-/// For more information, please refer to the C layer Reference
-/// Manual at:
-/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectHyperslab
+/// For information, please refer to the H5Sselect_hyperslab API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSpace::selectHyperslab(H5S_seloper_t op, const hsize_t *count, const hsize_t *start, const hsize_t *stride, const hsize_t *block) const
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index 444a77a..032937d 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -28,6 +28,7 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
@@ -96,9 +97,6 @@ DataType::DataType(const H5T_class_t type_class, size_t size) : H5Object(), enco
///\param plist - IN: Property list - default to PropList::DEFAULT
///\exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
-// Modification
-// Jul, 2008
-// Added for application convenience.
//--------------------------------------------------------------------------
DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), encoded_buf(NULL), buf_size(0)
{
@@ -247,6 +245,7 @@ void DataType::copy(const DataSet& dset)
throw DataTypeIException(inMemFunc("copy"), "H5Tcopy failed");
}
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: DataType::p_decode
// Purpose Returns an id of a type by decoding the binary object
@@ -275,6 +274,7 @@ hid_t DataType::p_decode() const
return(encoded_dtype_id);
}
}
+#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: DataType::decode
@@ -653,8 +653,8 @@ DataType DataType::getSuper() const
/// destination datatypes.
///\exception H5::DataTypeIException
///\par Description
-/// For more information, please see:
-/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Register
+/// For information, please refer to the H5Tregister API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataType::registerFunc(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func) const
diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp
index fd3cd17..6ed77e3 100644
--- a/c++/src/H5DcreatProp.cpp
+++ b/c++/src/H5DcreatProp.cpp
@@ -20,6 +20,7 @@
#include "H5PropList.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
@@ -158,8 +159,8 @@ int DSetCreatPropList::getChunk(int max_ndims, hsize_t* dim) const
///\param layout - IN: Type of storage layout for raw data
///\exception H5::PropListIException
///\par Description
-/// For information on valid layout types, please refer to
-/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetLayout
+/// For information, please refer to the H5Pset_layout API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::setLayout(H5D_layout_t layout) const
@@ -233,9 +234,8 @@ void DSetCreatPropList::setDeflate(int level) const
///\par Description
/// The associate C function sets an SZIP compression filter,
/// H5Z_FILTER_SZIP, for a dataset. For more information about
-/// SZIP and usage, please refer to the C layer Reference
-/// Manual at:
-/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSzip
+/// SZIP and usage, please refer to the H5Pset_szip API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - Jan, 2007
//--------------------------------------------------------------------------
void DSetCreatPropList::setSzip(unsigned int options_mask, unsigned int pixels_per_block) const
@@ -255,9 +255,8 @@ void DSetCreatPropList::setSzip(unsigned int options_mask, unsigned int pixels_p
///\par Description
/// The associate C function sets an Nbit compression filter,
/// H5Z_FILTER_NBIT, for a dataset. For more information about
-/// Nbit compression, please refer to the C layer Reference
-/// Manual at:
-/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-setNbit
+/// Nbit compression, please refer to the H5Pset_nbit API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - Apr, 2016
//--------------------------------------------------------------------------
void DSetCreatPropList::setNbit() const
@@ -284,8 +283,7 @@ void DSetCreatPropList::setNbit() const
/// according to the actual dataset datatype.
///\par
/// For information on setting fill value, please refer to the
-/// C layer Reference Manual at:
-/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFillValue
+/// H5Pset_fill_value API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::setFillValue(const DataType& fvalue_type, const void* value) const
@@ -534,9 +532,8 @@ bool DSetCreatPropList::allFiltersAvail() const
///
///\exception H5::PropListIException
///\par Description
-/// Please refer to the Reference Manual of \c H5Pset_shuffle for
-/// details.
-/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetShuffle
+/// For information, please refer to the H5Pset_shuffle API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::setShuffle() const
@@ -752,7 +749,8 @@ void DSetCreatPropList::getExternal(unsigned idx, size_t name_size, char* name,
/// an unlimited selection
///\exception H5::PropListIException
///\par Description
-/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetVirtual
+/// For information, please refer to the H5Pset_virtual API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - Mar, 2017
//--------------------------------------------------------------------------
void DSetCreatPropList::setVirtual(const DataSpace& vspace, const char *src_fname, const char *src_dsname, const DataSpace& sspace) const
@@ -779,7 +777,8 @@ void DSetCreatPropList::setVirtual(const DataSpace& vspace, const char *src_fnam
/// an unlimited selection
///\exception H5::PropListIException
///\par Description
-/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetVirtual
+/// For information, please refer to the H5Pset_virtual API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - Mar, 2017
//--------------------------------------------------------------------------
void DSetCreatPropList::setVirtual(const DataSpace& vspace, const H5std_string src_fname, const H5std_string src_dsname, const DataSpace& sspace) const
diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp
index 3a72b28..21e18e7 100644
--- a/c++/src/H5DxferProp.cpp
+++ b/c++/src/H5DxferProp.cpp
@@ -434,8 +434,8 @@ void DSetMemXferPropList::getVlenMemManager(H5MM_allocate_t& alloc_func, void**
///\param size - IN: Maximum size, in bytes, of the small data block.
///\exception H5::PropListIException
///\par Description
-/// For detail, please refer to the C layer Reference Manual at:
-/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSmallData
+/// For detail, please refer to the H5Pset_small_data_block_size
+/// API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void DSetMemXferPropList::setSmallDataBlockSize(hsize_t size) const
@@ -473,9 +473,8 @@ hsize_t DSetMemXferPropList::getSmallDataBlockSize() const
///
///\exception H5::PropListIException
///\par Description
-/// For information, please refer to the C layer Reference
-/// Manual at:
-/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetHyperVectorSize
+/// For detail, please refer to the H5Pset_hyper_vector_size
+/// API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void DSetMemXferPropList::setHyperVectorSize(size_t vector_size) const
diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp
index 02ae5a3..91866d7 100644
--- a/c++/src/H5EnumType.cpp
+++ b/c++/src/H5EnumType.cpp
@@ -22,6 +22,7 @@
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
#include "H5DataSpace.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp
index b414294..9e1098b 100644
--- a/c++/src/H5FaccProp.cpp
+++ b/c++/src/H5FaccProp.cpp
@@ -124,8 +124,8 @@ void FileAccPropList::setStdio() const
///\return A low-level driver ID which is the same ID used when the
/// driver was set for the property list. The driver ID is
/// only valid as long as the file driver remains registered.
-/// Valid driver identifiers can be found at:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetDriver
+/// For detail on valid driver identifiers, please refer to the
+/// H5Pget_driver API in the HDF5 C Reference Manual.
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
@@ -146,9 +146,8 @@ hid_t FileAccPropList::getDriver() const
///\param new_driver_info - IN: Struct containing the driver-specific properites
///\exception H5::PropListIException
///\par Description
-/// For a list of valid driver identifiers, please see the C
-/// layer Reference Manual at:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetDriver
+/// For information, please refer to the H5Pset_driver API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void FileAccPropList::setDriver(hid_t new_driver_id, const void *new_driver_info) const
@@ -205,8 +204,7 @@ hsize_t FileAccPropList::getFamilyOffset() const
///\exception H5::PropListIException
///\par Description
/// For more details on the use of \c H5FD_CORE driver, please
-/// refer to
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFaplCore
+/// refer to the H5Pset_fapl_core API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void FileAccPropList::setCore (size_t increment, hbool_t backing_store) const
@@ -309,8 +307,8 @@ FileAccPropList FileAccPropList::getFamily(hsize_t& memb_size) const
///\param raw_ext - IN: Raw data filename extension as \c char*
///\exception H5::PropListIException
///\par Description
-/// Temporary - For information, please refer to:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFaplSplit
+/// For information, please refer to the H5Pset_fapl_split API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccPropList& raw_plist, const char* meta_ext, const char* raw_ext) const
@@ -369,8 +367,8 @@ size_t FileAccPropList::getSieveBufSize() const
///\param bufsize - IN: Maximum size, in bytes, of data sieve buffer
///\exception H5::PropListIException
///\par Description
-/// For detail on data sieving, please refer to
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSieveBufSize
+/// For more detail, please refer to the H5Pset_sieve_buf_size
+/// API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void FileAccPropList::setSieveBufSize(size_t bufsize) const
@@ -389,8 +387,8 @@ void FileAccPropList::setSieveBufSize(size_t bufsize) const
/// block allocations
///\exception H5::PropListIException
///\par Description
-/// For more detail, please see the C layer Reference Manual at:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetMetaBlockSize
+/// For information, please refer to the H5Pset_meta_block_size
+/// API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void FileAccPropList::setMetaBlockSize(hsize_t &block_size) const
@@ -429,8 +427,8 @@ hsize_t FileAccPropList::getMetaBlockSize() const
///\param buf_size - IN: Size of the logging buffer
///\exception H5::PropListIException
///\par Description
-/// For detail on \a flags, please refer to
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFaplLog
+/// For information, please refer to the H5Pset_fapl_log API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void FileAccPropList::setLog(const char *logfile, unsigned flags, size_t buf_size) const
@@ -486,8 +484,8 @@ void FileAccPropList::setSec2() const
/// effect of a special case, forcing everything to be aligned.
/// The parameter \a alignment must have a positive value.
///
-/// For detail on \a setting alignment, please refer to
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetAlignment
+/// For more detail, please refer to the H5Pset_alignment API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void FileAccPropList::setAlignment(hsize_t threshold, hsize_t alignment) const
@@ -523,8 +521,8 @@ void FileAccPropList::getAlignment(hsize_t &threshold, hsize_t &alignment) const
///\param dtype - IN: Type of data
///\exception H5::PropListIException
///\par Description
-/// More details and valid values for \a dtype can be found at:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetMultiType
+/// For information, please refer to the H5Pset_multi_type API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void FileAccPropList::setMultiType(H5FD_mem_t dtype) const
@@ -542,8 +540,8 @@ void FileAccPropList::setMultiType(H5FD_mem_t dtype) const
///\return The data type property
///\exception H5::PropListIException
///\par Description
-/// More details and possible returned values can be found at:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetMultiType
+/// For information, please refer to the H5Pget_multi_type API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
H5FD_mem_t FileAccPropList::getMultiType() const
@@ -643,8 +641,8 @@ H5F_close_degree_t FileAccPropList::getFcloseDegree() const
/// on (1) or off (0).
///\exception H5::PropListIException
///\par Description
-/// For detail on \a fapl, please refer to
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetGCReferences
+/// For information, please refer to the H5Pset_gc_references API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void FileAccPropList::setGcReferences(unsigned gc_ref) const
@@ -694,8 +692,8 @@ unsigned FileAccPropList::getGcReferences() const
/// \li \c H5F_LIBVER_18
/// \li \c H5F_LIBVER_LATEST (Default)
///
-/// For more details, please refer to
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetLibverBounds
+/// For more detail, please refer to the H5Pset_libver_bounds API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - March, 2015
//--------------------------------------------------------------------------
void FileAccPropList::setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const
diff --git a/c++/src/H5FcreatProp.cpp b/c++/src/H5FcreatProp.cpp
index 9674c0a..98a35cb 100644
--- a/c++/src/H5FcreatProp.cpp
+++ b/c++/src/H5FcreatProp.cpp
@@ -173,9 +173,8 @@ hsize_t FileCreatPropList::getUserblock() const
///\param sizeof_size - IN: Size of an object length in bytes.
///\exception H5::PropListIException
///\par Description
-/// For information on setting sizes, please refer to the
-/// C layer Reference Manual at:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSizes
+/// For information, please refer to the H5Pset_sizes API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void FileCreatPropList::setSizes(size_t sizeof_addr, size_t sizeof_size) const
@@ -214,8 +213,8 @@ void FileCreatPropList::getSizes(size_t& sizeof_addr, size_t& sizeof_size) const
///\param lk - IN: Symbol table node size
///\exception H5::PropListIException
///\par Description
-/// For information, please see the C layer Reference Manual at:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSymK
+/// For information, please refer to the H5Pset_sym_k API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void FileCreatPropList::setSymk(unsigned ik, unsigned lk) const
@@ -235,8 +234,8 @@ void FileCreatPropList::setSymk(unsigned ik, unsigned lk) const
///
///\exception H5::PropListIException
///\par Description
-/// For information, please see
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetSymK
+/// For information, please refer to the H5Pget_sym_k API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void FileCreatPropList::getSymk(unsigned& ik, unsigned& lk) const
@@ -256,8 +255,8 @@ void FileCreatPropList::getSymk(unsigned& ik, unsigned& lk) const
///\param ik - IN: 1/2 rank of chunked storage B-tree
///\exception H5::PropListIException
///\par Description
-/// For information, please see the C layer Reference Manual at:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetIstoreK
+/// For information, please refer to the H5Pset_istore_k API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void FileCreatPropList::setIstorek(unsigned ik) const
@@ -276,8 +275,8 @@ void FileCreatPropList::setIstorek(unsigned ik) const
///\return 1/2 rank of chunked storage B-tree
///\exception H5::PropListIException
///\par Description
-/// For information, please see
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetIstoreK
+/// For information, please refer to the H5Pget_istore_k API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
unsigned FileCreatPropList::getIstorek() const
@@ -306,8 +305,8 @@ unsigned FileCreatPropList::getIstorek() const
/// changed and the existing strategy will be retained.
/// If the given threshold value is zero, the property will not be
/// changed and the existing threshold will be retained.
-/// For information, please see the C layer Reference Manual at:
-/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFileSpace
+/// For information, please refer to the H5Pset_file_space_strategy
+/// API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - Feb, 2017
//--------------------------------------------------------------------------
void FileCreatPropList::setFileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold) const
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index 3a0b54d..2c7ac51 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -27,6 +27,7 @@
#include "H5OcreatProp.h"
#include "H5DxferProp.h"
#include "H5DcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
@@ -72,9 +73,8 @@ H5File::H5File() : Group(), id(H5I_INVALID_HID) {}
/// exists, and fail, otherwise
///\par
/// For info on file creation in the case of an already-open file,
-/// please refer to the \b Special \b case section in the C layer
-/// Reference Manual at:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-Create
+/// please refer to the \b Special \b case section of the H5Fcreate
+/// API in the C Reference Manual.
// Notes With a PGI compiler (~2012-2013,) the exception thrown by
// p_get_file could not be caught in the applications. Added try
// block here to catch then re-throw it. -BMR 2013/03/21
diff --git a/c++/src/H5FloatType.cpp b/c++/src/H5FloatType.cpp
index 794c27d..9703149 100644
--- a/c++/src/H5FloatType.cpp
+++ b/c++/src/H5FloatType.cpp
@@ -20,6 +20,7 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp
index c0e0dd1..c4c7017 100644
--- a/c++/src/H5Group.cpp
+++ b/c++/src/H5Group.cpp
@@ -27,6 +27,7 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
@@ -123,26 +124,6 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const
}
//--------------------------------------------------------------------------
-// Function: Group overload constructor - dereference
-// brief Given a reference, ref, to an hdf5 group, creates a Group objec
-// param attr - IN: Specifying location where the referenced object is i
-// param ref - IN: Reference pointer
-// param ref_type - IN: Reference type - default to H5R_OBJECT
-// param plist - IN: Property list - default to PropList::DEFAULT
-// exception H5::ReferenceException
-// Programmer Binh-Minh Ribler - Oct, 2006
-// Modification
-// Mar, 2017
-// Removed in 1.10.1 because H5Location is Attribute's baseclass
-// now. -BMR
-//--------------------------------------------------------------------------
-/* 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");
-}
- */
-
-//--------------------------------------------------------------------------
// Function: Group::getNumObjs
///\brief Returns the number of objects in this group.
///\return Number of objects
diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp
index f68e858..38191bc 100644
--- a/c++/src/H5IntType.cpp
+++ b/c++/src/H5IntType.cpp
@@ -20,6 +20,7 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5LcreatProp.cpp b/c++/src/H5LcreatProp.cpp
new file mode 100644
index 0000000..4f8bffc
--- /dev/null
+++ b/c++/src/H5LcreatProp.cpp
@@ -0,0 +1,146 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <string>
+
+#include "H5Include.h"
+#include "H5Exception.h"
+#include "H5IdComponent.h"
+#include "H5PropList.h"
+#include "H5LcreatProp.h"
+
+namespace H5 {
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+// This DOXYGEN_SHOULD_SKIP_THIS block is a work-around approach to control
+// the order of creation and deletion of the global constants. See Design Notes
+// in "H5PredType.cpp" for information.
+
+// Initialize a pointer for the constant
+LinkCreatPropList* LinkCreatPropList::DEFAULT_ = 0;
+
+//--------------------------------------------------------------------------
+// Function: LinkCreatPropList::getConstant
+// Creates a LinkCreatPropList object representing the HDF5 constant
+// H5P_LINK_CREATE, pointed to by LinkCreatPropList::DEFAULT_
+// exception H5::PropListIException
+// Description
+// If LinkCreatPropList::DEFAULT_ already points to an allocated
+// object, throw a PropListIException. This scenario should not
+// happen.
+// December, 2016
+//--------------------------------------------------------------------------
+LinkCreatPropList* LinkCreatPropList::getConstant()
+{
+ // Tell the C library not to clean up, H5Library::termH5cpp will call
+ // H5close - more dependency if use H5Library::dontAtExit()
+ if (!IdComponent::H5dontAtexit_called)
+ {
+ (void) H5dont_atexit();
+ IdComponent::H5dontAtexit_called = true;
+ }
+
+ // If the constant pointer is not allocated, allocate it. Otherwise,
+ // throw because it shouldn't be.
+ if (DEFAULT_ == 0)
+ DEFAULT_ = new LinkCreatPropList(H5P_LINK_CREATE);
+ else
+ throw PropListIException("LinkCreatPropList::getConstant", "LinkCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return(DEFAULT_);
+}
+
+//--------------------------------------------------------------------------
+// Function: LinkCreatPropList::deleteConstants
+// Purpose: Deletes the constant object that LinkCreatPropList::DEFAULT_
+// points to.
+// exception H5::PropListIException
+// December, 2016
+//--------------------------------------------------------------------------
+void LinkCreatPropList::deleteConstants()
+{
+ if (DEFAULT_ != 0)
+ delete DEFAULT_;
+}
+
+//--------------------------------------------------------------------------
+// Purpose: Constant for default property
+//--------------------------------------------------------------------------
+const LinkCreatPropList& LinkCreatPropList::DEFAULT = *getConstant();
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+//--------------------------------------------------------------------------
+// Function: Default Constructor
+///\brief Creates a file access property list
+// December, 2016
+//--------------------------------------------------------------------------
+LinkCreatPropList::LinkCreatPropList() : PropList(H5P_LINK_CREATE) {}
+
+//--------------------------------------------------------------------------
+// Function: LinkCreatPropList copy constructor
+///\brief Copy Constructor: makes a copy of the original
+///\param original - IN: LinkCreatPropList instance to copy
+// December, 2016
+//--------------------------------------------------------------------------
+LinkCreatPropList::LinkCreatPropList(const LinkCreatPropList& original) : PropList(original) {}
+
+//--------------------------------------------------------------------------
+// Function: LinkCreatPropList overloaded constructor
+///\brief Creates a file access property list using the id of an
+/// existing one.
+// December, 2016
+//--------------------------------------------------------------------------
+LinkCreatPropList::LinkCreatPropList(const hid_t plist_id) : PropList(plist_id) {}
+
+//--------------------------------------------------------------------------
+// Function: LinkCreatPropList::setCharEncoding
+///\brief Sets the character encoding of the string.
+///\exception H5::PropListIException
+// March, 2018
+//--------------------------------------------------------------------------
+void LinkCreatPropList::setCharEncoding(H5T_cset_t encoding) const
+{
+ herr_t ret_value = H5Pset_char_encoding(id, encoding);
+ // Throw exception if H5Pset_char_encoding returns failure
+ if (ret_value < 0)
+ {
+ throw PropListIException("setCharEncoding", "H5Pset_char_encoding failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: LinkCreatPropList::getCharEncoding
+///\brief Gets the character encoding of the string.
+///\exception H5::PropListIException
+// March, 2018
+//--------------------------------------------------------------------------
+H5T_cset_t LinkCreatPropList::getCharEncoding() const
+{
+ H5T_cset_t encoding;
+ herr_t ret_value = H5Pget_char_encoding(id, &encoding);
+ // Throw exception if H5Pget_char_encoding returns failure
+ if (ret_value < 0)
+ {
+ throw PropListIException("getCharEncoding", "H5Pget_char_encoding failed");
+ }
+ return(encoding);
+}
+
+//--------------------------------------------------------------------------
+// Function: LinkCreatPropList destructor
+///\brief Noop destructor
+// December, 2016
+//--------------------------------------------------------------------------
+LinkCreatPropList::~LinkCreatPropList() {}
+
+} // end namespace
diff --git a/c++/src/H5LcreatProp.h b/c++/src/H5LcreatProp.h
new file mode 100644
index 0000000..4ac2191
--- /dev/null
+++ b/c++/src/H5LcreatProp.h
@@ -0,0 +1,71 @@
+// C++ informative line for the emacs editor: -*- C++ -*-
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+// Class LinkCreatPropList represents the HDF5 file access property list and
+// inherits from DataType.
+
+#ifndef __H5LinkCreatPropList_H
+#define __H5LinkCreatPropList_H
+
+namespace H5 {
+
+/*! \class LinkCreatPropList
+ \brief Class LinkCreatPropList inherits from PropList and provides
+ wrappers for the HDF5 file access property list.
+*/
+// Inheritance: PropList -> IdComponent
+class H5_DLLCPP LinkCreatPropList : public PropList {
+ public:
+ ///\brief Default file access property list.
+ static const LinkCreatPropList& DEFAULT;
+
+ // Creates a file access property list.
+ LinkCreatPropList();
+
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("LinkCreatPropList"); }
+
+ // Copy constructor: creates a copy of a LinkCreatPropList object.
+ LinkCreatPropList(const LinkCreatPropList& original);
+
+ // Creates a copy of an existing file access property list
+ // using the property list id.
+ LinkCreatPropList (const hid_t plist_id);
+
+ // Sets the character encoding of the string.
+ void setCharEncoding(H5T_cset_t encoding) const;
+
+ // Gets the character encoding of the string.
+ H5T_cset_t getCharEncoding() const;
+
+ // Noop destructor
+ virtual ~LinkCreatPropList();
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
+
+ private:
+ static LinkCreatPropList* DEFAULT_;
+
+ // Creates the global constant, should only be used by the library
+ static LinkCreatPropList* getConstant();
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+}; // end of LinkCreatPropList
+} // namespace H5
+
+#endif // __H5LinkCreatPropList_H
diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp
index 9293622..55f82f5 100644
--- a/c++/src/H5Library.cpp
+++ b/c++/src/H5Library.cpp
@@ -24,6 +24,7 @@
#include "H5OcreatProp.h"
#include "H5DxferProp.h"
#include "H5DcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
@@ -110,8 +111,7 @@ void H5Library::getLibVersion(unsigned& majnum, unsigned& minnum, unsigned& reln
///\exception H5::LibraryIException
///\par Description
/// For information about library version, please refer to
-/// the C layer Reference Manual at:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5.html#Library-VersCheck
+/// the H5check_version API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void H5Library::checkVersion(unsigned majnum, unsigned minnum, unsigned relnum)
@@ -240,9 +240,8 @@ void H5Library::termH5cpp()
///\exception H5::LibraryIException
///\par Description
/// Setting a value of -1 for a limit means no limit of that type.
-/// For more information on free list limits, please refer to C
-/// layer Reference Manual at:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5.html#Library-SetFreeListLimits
+/// For more information on free list limits, please refer to
+/// the H5set_free_list_limits API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
void H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim,
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp
index d0b5f9d..2dceb6e 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -12,6 +12,8 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <string>
+#include <iostream>
+using namespace std;
#include "H5private.h" // for HDmemset
#include "H5Include.h"
@@ -24,6 +26,7 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
@@ -230,7 +233,6 @@ void H5Location::setComment(const H5std_string& name, const H5std_string& commen
/// It differs from the above function in that it doesn't take
/// an object name.
// Programmer Binh-Minh Ribler - Sep 2013
-// Modification
//--------------------------------------------------------------------------
void H5Location::setComment(const char* comment) const
{
@@ -513,9 +515,6 @@ void H5Location::reference(void* ref, const H5std_string& name, H5R_type_t ref_t
// from_func - IN: Name of the calling function
// Exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
-// Modification
-// May 2008 - BMR
-// Moved from IdComponent.
//--------------------------------------------------------------------------
hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist, const char* from_func)
{
@@ -544,9 +543,6 @@ hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_ty
///\param plist - IN: Property list - default to PropList::DEFAULT
///\exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
-// Modification
-// May, 2008
-// Corrected missing parameters. - BMR
//--------------------------------------------------------------------------
void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist)
{
@@ -563,8 +559,6 @@ void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t
// exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
// Modification
-// May, 2008
-// Corrected missing parameters. -BMR
// Mar, 2017
// Removed in 1.10.1 because H5Location is Attribute's baseclass
// now. -BMR
@@ -759,7 +753,53 @@ DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const
//--------------------------------------------------------------------------
// Function: H5Location::createGroup
-///\brief Creates a new group at this location.
+///\brief Creates a new group at this location, which can be a file,
+/// group, dataset, attribute, or named datatype.
+///\param name - IN: Name of the group to create
+///\param size_hint - IN: Indicates the number of bytes to reserve for
+/// the names that will appear in the group
+///\return Group instance
+///\exception H5::FileIException/H5::GroupIException/H5::LocationException
+///\par Description
+/// The optional \a size_hint specifies how much file space to
+/// reserve for storing the names that will appear in this new
+/// group. If a non-positive value is provided for the \a size_hint
+/// then a default size is chosen.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Group H5Location::createGroup(const char* name, const LinkCreatPropList& lcpl) const
+{
+ // Call C routine H5Gcreate2 to create the named group, giving the
+ // location id which can be a file id or a group id
+ hid_t group_id = H5Gcreate2(getId(), name, lcpl.getId(), H5P_DEFAULT, H5P_DEFAULT);
+
+ // If the creation of the group failed, throw an exception
+ if (group_id < 0)
+ throwException("createGroup", "H5Gcreate2 failed");
+
+ // No failure, create and return the Group object
+ Group group;
+ H5Location *ptr = &group;
+ ptr->p_setId(group_id);
+ return(group);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::createGroup
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Group H5Location::createGroup(const H5std_string& name, const LinkCreatPropList& lcpl) const
+{
+ return(createGroup( name.c_str(), lcpl));
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::createGroup
+///\brief Creates a new group at this location, which can be a file,
+/// group, dataset, attribute, or named datatype.
///\param name - IN: Name of the group to create
///\param size_hint - IN: Indicates the number of bytes to reserve for
/// the names that will appear in the group
@@ -804,7 +844,6 @@ Group H5Location::createGroup(const char* name, size_t size_hint) const
// No failure, create and return the Group object
Group group;
- //group.p_setId(group_id);
H5Location *ptr = &group;
ptr->p_setId(group_id);
return(group);
@@ -942,6 +981,134 @@ DataSet H5Location::openDataSet(const H5std_string& name) const
//--------------------------------------------------------------------------
// Function: H5Location::link
+///\brief Creates a soft link from \a link_name to \a target_name.
+///\param target_name - IN: Name of object, can be a non-existing object
+///\param link_name - IN: Link name for the target name
+///\param lcpl - IN: Link creation plist - default to LinkCreatPropList::DEFAULT
+///\param lapl - IN: Link access plist - default to LinkAccPropList::DEFAULT
+///\exception H5::FileIException or H5::GroupIException
+///\par Description
+/// Note that both names are interpreted relative to the current
+/// location.
+/// For information on creating a soft link, please refer to the
+/// H5Lcreate_soft APIs in the HDF5 C Reference Manual.
+// March 2018
+//--------------------------------------------------------------------------
+void H5Location::link(const char *target_name, const char *link_name,
+ const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+{
+ herr_t ret_value = -1;
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
+
+ ret_value = H5Lcreate_soft(target_name, getId(), link_name, lcpl_id, lapl_id);
+ if (ret_value < 0)
+ throwException("link", "creating soft link failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::link
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a target_name and \a link_name.
+///\exception H5::FileIException or H5::GroupIException
+// March, 2018
+//--------------------------------------------------------------------------
+void H5Location::link(const H5std_string& target_name, const H5std_string&
+ link_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+{
+ link(target_name.c_str(), link_name.c_str(), lcpl, lapl);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::link
+///\brief Creates a hard link from \a new_name to \a curr_name.
+///\param curr_name - IN: Name of the existing object
+///\param new_loc - IN: New group or root group
+///\param new_name - IN: New name for the object
+///\param lcpl - IN: Link creation plist - default to LinkCreatPropList::DEFAULT
+///\param lapl - IN: Link access plist - default to LinkAccPropList::DEFAULT
+///\exception H5::FileIException or H5::GroupIException
+///\par Description
+/// Note that both names are interpreted relative to the
+/// specified location.
+/// For information on creating a hard link, please refer to the
+/// H5Lcreate_hard APIs in the HDF5 C Reference Manual.
+// March 2018
+//--------------------------------------------------------------------------
+void H5Location::link(const char *curr_name, const Group& new_loc,
+ const char *new_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+{
+ herr_t ret_value = -1;
+ hid_t new_loc_id = new_loc.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
+
+ ret_value = H5Lcreate_hard(getId(), curr_name, new_loc.getId(), new_name, H5P_DEFAULT, H5P_DEFAULT);
+ if (ret_value < 0)
+ throwException("link", "creating link failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::link
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a curr_name and \a new_name.
+///\exception H5::FileIException or H5::GroupIException
+// March, 2018
+//--------------------------------------------------------------------------
+void H5Location::link(const H5std_string& curr_name, const Group& new_loc,
+ const H5std_string& new_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+{
+ link(curr_name.c_str(), new_loc, new_name.c_str(), lcpl, lapl);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::link
+///\brief Creates a hard link from \a new_name to \a curr_name - can be
+/// used to pass in H5L_SAME_LOC.
+///\param curr_name - IN: Name of the existing object
+///\param loc_id - IN: Group or root group ID, or H5L_SAME_LOC
+///\param new_name - IN: New name for the link
+///\param lcpl - IN: Link creation plist - default to LinkCreatPropList::DEFAULT
+///\param lapl - IN: Link access plist - default to LinkAccPropList::DEFAULT
+///\exception H5::FileIException or H5::GroupIException
+///\par Description
+/// Note that both names are interpreted relative to the
+/// specified location.
+/// For information on creating a hard link, please refer to the
+/// H5Lcreate_hard APIs in the HDF5 C Reference Manual.
+// March 2018
+//--------------------------------------------------------------------------
+void H5Location::link(const char *curr_name, const hid_t same_loc,
+ const char *new_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+{
+ herr_t ret_value = -1;
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
+
+ ret_value = H5Lcreate_hard(getId(), curr_name, same_loc, new_name, H5P_DEFAULT, H5P_DEFAULT);
+
+ if (ret_value < 0)
+ throwException("link", "creating link failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::link
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a curr_name and \a new_name.
+///\exception H5::FileIException or H5::GroupIException
+// March, 2018
+//--------------------------------------------------------------------------
+void H5Location::link(const H5std_string& curr_name, const hid_t same_loc,
+ const H5std_string& new_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+{
+ link(curr_name.c_str(), same_loc, new_name.c_str(), lcpl, lapl);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::link
///\brief Creates a link of the specified type from \a new_name to
/// \a curr_name.
///\param link_type - IN: Link type; possible values are
@@ -955,12 +1122,14 @@ DataSet H5Location::openDataSet(const H5std_string& name) const
/// Note that both names are interpreted relative to the
/// specified location.
/// For information on creating hard link and soft link, please
-/// refer to the C layer Reference Manual at:
-/// http://hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-CreateHard and
-/// http://hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-CreateSoft
+/// refer to the H5Lcreate_hard and H5Lcreate_soft APIs in the
+/// HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
// Modification
// 2007: QAK modified to use H5L APIs - BMR
+// Mar 2018: Inadequate functionality, new hard link is only in
+// H5L_SAME_LOC. This function will be retired in favor of
+// its replacement. - BMR
//--------------------------------------------------------------------------
void H5Location::link(H5L_type_t link_type, const char* curr_name, const char* new_name) const
{
@@ -1000,65 +1169,245 @@ void H5Location::link(H5L_type_t link_type, const H5std_string& curr_name, const
}
//--------------------------------------------------------------------------
-// Function: H5Location::unlink
-///\brief Removes the specified name at this location.
-///\param name - IN: Name of the object to be removed
-///\exception H5::FileIException/H5::GroupIException/H5::LocationException
-// Programmer Binh-Minh Ribler - 2000
-// Modification
-// 2007: QAK modified to use H5L APIs - BMR
+// Function: H5Location::copyLink
+///\brief Copies a link from one group to another.
+///\param src_name - IN: Original name
+///\param dst - IN: Destination location
+///\param dst_name - IN: New name
+///\param lcpl - IN: Link creation plist - default LinkCreatPropList::DEFAULT
+///\param lapl - IN: Link access plist - default LinkAccPropList::DEFAULT
+///\exception H5::FileIException or H5::GroupIException
+// March, 2018
//--------------------------------------------------------------------------
-void H5Location::unlink(const char* name) const
+void H5Location::copyLink(const char *src_name,
+ const Group& dst, const char *dst_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
{
- herr_t ret_value = H5Ldelete(getId(), name, H5P_DEFAULT);
+ herr_t ret_value;
+ hid_t dst_id = dst.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
+
+ ret_value = H5Lcopy(getId(), src_name, dst_id, dst_name, lcpl_id, lapl_id);
+ if(ret_value < 0)
+ throwException("copyLink", "H5Lcopy failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::copyLink
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a src_name and \a dst_name.
+///\exception H5::FileIException or H5::GroupIException
+// March, 2018
+//--------------------------------------------------------------------------
+void H5Location::copyLink(const H5std_string& src_name,
+ const Group& dst, const H5std_string& dst_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ copyLink(src_name.c_str(), dst, dst_name.c_str(), lcpl, lapl);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::copyLink
+///\brief Copies a link from a group in the same location.
+///\param src_name - IN: Original name
+///\param dst_name - IN: New name
+///\param lcpl - IN: Link creation plist - default LinkCreatPropList::DEFAULT
+///\param lapl - IN: Link access plist - default LinkAccPropList::DEFAULT
+///\exception H5::FileIException or H5::GroupIException
+// March, 2018
+//--------------------------------------------------------------------------
+void H5Location::copyLink(const char *src_name,
+ const char *dst_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ herr_t ret_value;
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
+
+ ret_value = H5Lcopy(getId(), src_name, H5L_SAME_LOC, dst_name, lcpl_id, lapl_id);
+ if(ret_value < 0)
+ throwException("copyLink", "H5Lcopy H5L_SAME_LOC failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::copyLink
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a src_name and \a dst_name.
+///\exception H5::FileIException or H5::GroupIException
+// March, 2018
+//--------------------------------------------------------------------------
+void H5Location::copyLink(const H5std_string& src_name,
+ const H5std_string& dst_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ copyLink(src_name.c_str(), dst_name.c_str(), lcpl, lapl);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::moveLink
+///\brief Renames a link in this group and moves it to a new location.
+///\param src_name - IN: Original name
+///\param dst - IN: Destination location
+///\param dst_name - IN: New name
+///\param lcpl - IN: Link creation plist - default LinkCreatPropList::DEFAULT
+///\param lapl - IN: Link access plist - default LinkAccPropList::DEFAULT
+///\exception H5::FileIException or H5::GroupIException
+///\note
+/// Exercise care in moving groups as it is possible to render
+/// data in a file inaccessible with H5Location::moveLink. Please refer
+/// to the Group Interface in the HDF5 User's Guide for details.
+// March, 2018
+//--------------------------------------------------------------------------
+void H5Location::moveLink(const char* src_name, const Group& dst, const char* dst_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+{
+ herr_t ret_value;
+ hid_t dst_id = dst.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
+
+ ret_value = H5Lmove(getId(), src_name, dst_id, dst_name, lcpl_id, lapl_id);
if (ret_value < 0)
- throwException("unlink", "H5Ldelete failed");
+ throwException("moveLink", "H5Lmove failed");
}
//--------------------------------------------------------------------------
-// Function: H5Location::unlink
+// Function: H5Location::moveLink
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+/// \c H5std_string for \a src_name and \a dst_name.
+///\exception H5::FileIException or H5::GroupIException
+// March, 2018
+//--------------------------------------------------------------------------
+void H5Location::moveLink(const H5std_string& src_name, const Group& dst, const H5std_string& dst_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+{
+ moveLink(src_name.c_str(), dst, dst_name.c_str(), lcpl, lapl);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::moveLink
+///\brief Renames a link in this group.
+///\param src_name - IN: Original name
+///\param dst_name - IN: New name
+///\param lcpl - IN: Link creation plist - default LinkCreatPropList::DEFAULT
+///\param lapl - IN: Link access plist - default LinkAccPropList::DEFAULT
+///\exception H5::FileIException or H5::GroupIException
+///\note
+/// Exercise care in moving groups as it is possible to render
+/// data in a file inaccessible with H5Location::moveLink. Please refer
+/// to the Group Interface in the HDF5 User's Guide for details.
+// March, 2018
//--------------------------------------------------------------------------
-void H5Location::unlink(const H5std_string& name) const
+void H5Location::moveLink(const char* src_name, const char* dst_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
{
- unlink(name.c_str());
+ herr_t ret_value;
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
+
+ ret_value = H5Lmove(getId(), src_name, H5L_SAME_LOC, dst_name, lcpl_id, lapl_id);
+ if (ret_value < 0)
+ throwException("moveLink", "H5Lmove H5L_SAME_LOC failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::moveLink
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a src_name and \a dst_name.
+///\exception H5::FileIException or H5::GroupIException
+// March, 2018
+//--------------------------------------------------------------------------
+void H5Location::moveLink(const H5std_string& src_name, const H5std_string& dst_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+{
+ moveLink(src_name.c_str(), dst_name.c_str(), lcpl, lapl);
}
//--------------------------------------------------------------------------
// Function: H5Location::move
-///\brief Renames an object at this location.
+///\brief Renames an object at this location. - Deprecated due to inadequate functionality
///\param src - IN: Object's original name
///\param dst - IN: Object's new name
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
///\note
/// Exercise care in moving groups as it is possible to render
/// data in a file inaccessible with H5Location::move. Please refer
-/// to the Group Interface in the HDF5 User's Guide for details at:
-/// https://www.hdfgroup.org/HDF5/doc/UG/HDF5_Users_Guide-Responsive%20HTML5/index.html#t=HDF5_Users_Guide%2FGroups%2FHDF5_Groups.htm
-// Programmer Binh-Minh Ribler - 2000
+/// to the Group Interface in the HDF5 User's Guide for details.
// Modification
-// 2007: QAK modified to use H5L APIs - BMR
+// 2007: QAK modified to use H5L APIs - BMR
+// 2018: Will be replaced by H5Location::moveLink() -BMR
//--------------------------------------------------------------------------
void H5Location::move(const char* src, const char* dst) const
{
- herr_t ret_value = H5Lmove(getId(), src, H5L_SAME_LOC, dst, H5P_DEFAULT, H5P_DEFAULT);
- if (ret_value < 0)
- throwException("move", "H5Lmove failed");
+ moveLink(src, dst, LinkCreatPropList::DEFAULT, LinkAccPropList::DEFAULT);
}
//--------------------------------------------------------------------------
// Function: H5Location::move
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function in that it takes an
-/// \c H5std_string for \a src and \a dst.
-// Programmer Binh-Minh Ribler - 2000
+/// \c H5std_string for \a src and \a dst. - Deprecated due to inadequate functionality
+// Modification
+// 2018: Will be replaced by H5Location::moveLink() -BMR
//--------------------------------------------------------------------------
void H5Location::move(const H5std_string& src, const H5std_string& dst) const
{
- move(src.c_str(), dst.c_str());
+ moveLink(src.c_str(), dst.c_str(), LinkCreatPropList::DEFAULT, LinkAccPropList::DEFAULT);
+}
+
+#if 0
+//--------------------------------------------------------------------------
+// Function: H5Location::deleteLink
+///\brief Removes the specified link from this group.
+///\param name - IN: Name of the object to be removed
+///\exception H5::FileIException/H5::GroupIException/H5::LocationException
+// March, 2018
+//--------------------------------------------------------------------------
+void H5Location::deleteLink(const char* name, const LinkAccPropList& lapl) const
+{
+ herr_t ret_value = H5Ldelete(getId(), name, H5P_DEFAULT);
+ if (ret_value < 0)
+ throwException("deleteLink", "H5Ldelete failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::deleteLink
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// March, 2018
+//--------------------------------------------------------------------------
+void H5Location::deleteLink(const H5std_string& name, const LinkAccPropList& lapl) const
+{
+ deleteLink(name.c_str());
+}
+
+#endif
+//--------------------------------------------------------------------------
+// Function: H5Location::unlink
+///\brief Removes the specified link from this group.
+///\param name - IN: Name of the object to be removed
+///\exception H5::FileIException/H5::GroupIException/H5::LocationException
+// March, 2018
+//--------------------------------------------------------------------------
+void H5Location::unlink(const char* name, const LinkAccPropList& lapl) const
+{
+ herr_t ret_value = H5Ldelete(getId(), name, lapl.getId());
+ if (ret_value < 0)
+ throwException("unlink", "H5Ldelete failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::unlink
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// March, 2018
+//--------------------------------------------------------------------------
+void H5Location::unlink(const H5std_string& name, const LinkAccPropList& lapl) const
+{
+ unlink(name.c_str(), lapl);
}
#ifndef H5_NO_DEPRECATED_SYMBOLS
@@ -1070,10 +1419,9 @@ void H5Location::move(const H5std_string& src, const H5std_string& dst) const
///\param statbuf - OUT: Buffer to return information about the object
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
///\par Description
-/// For more information, please refer to the C layer Reference
-/// Manual at:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5G.html#Group-GetObjinfo
-// Programmer Binh-Minh Ribler - 2000
+/// For information, please refer to the H5Gget_objinfo API in
+/// the HDF5 C Reference Manual.
+// 2000
//--------------------------------------------------------------------------
void H5Location::getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const
{
@@ -1099,8 +1447,7 @@ void H5Location::getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_s
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above functions in that it doesn't have
/// the paramemter \a follow_link.
-// Programmer Binh-Minh Ribler - Nov, 2005
-// Note: need to modify to use H5Oget_info and H5Lget_info - BMR
+// Nov, 2005
//--------------------------------------------------------------------------
void H5Location::getObjinfo(const char* name, H5G_stat_t& statbuf) const
{
@@ -1123,13 +1470,44 @@ void H5Location::getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const
#endif /* H5_NO_DEPRECATED_SYMBOLS */
//--------------------------------------------------------------------------
+// Function: H5Location::getLinkInfo
+///\brief Returns the information of the named link.
+///\param link_name - IN: Symbolic link to the object
+///\param size - IN: Maximum number of characters of value to be returned
+///\return Name of the object
+///\exception H5::FileIException/H5::GroupIException/H5::LocationException
+// 2000
+//--------------------------------------------------------------------------
+H5L_info_t H5Location::getLinkInfo(const char* link_name, const LinkAccPropList& lapl) const
+{
+ H5L_info_t linkinfo; // link info structure
+
+ herr_t ret_value = H5Lget_info(getId(), link_name, &linkinfo, lapl.getId());
+ if (ret_value < 0)
+ throwException("getLinkInfo", "H5Lget_info to find buffer size failed");
+
+ return(linkinfo);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::getLinkInfo
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a link_name.
+//--------------------------------------------------------------------------
+H5L_info_t H5Location::getLinkInfo(const H5std_string& link_name, const LinkAccPropList& lapl) const
+{
+ return(getLinkInfo(link_name.c_str(), lapl));
+}
+
+//--------------------------------------------------------------------------
// Function: H5Location::getLinkval
///\brief Returns the name of the object that the symbolic link points to.
///\param name - IN: Symbolic link to the object
///\param size - IN: Maximum number of characters of value to be returned
///\return Name of the object
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
-// Programmer Binh-Minh Ribler - 2000
+// 2000
//--------------------------------------------------------------------------
H5std_string H5Location::getLinkval(const char* name, size_t size) const
{
@@ -1435,8 +1813,8 @@ ssize_t H5Location::getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size
/// \li \c H5O_TYPE_GROUP
/// \li \c H5O_TYPE_DATASET
/// \li \c H5O_TYPE_NAMED_DATATYPE
-/// Refer to the C API documentation for more details:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo
+/// For information, please refer to the H5Oget_info_by_name API in
+/// the HDF5 C Reference Manual.
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
/// Exception will be thrown when:
/// - an error returned by the C API
@@ -1501,8 +1879,8 @@ H5O_type_t H5Location::childObjType(const H5std_string& objname) const
/// \li \c H5O_TYPE_GROUP
/// \li \c H5O_TYPE_DATASET
/// \li \c H5O_TYPE_NAMED_DATATYPE
-/// Refer to the C API documentation for more details:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo
+/// For information, please refer to the H5Oget_info_by_idx API in
+/// the HDF5 C Reference Manual.
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
/// Exception will be thrown when:
/// - an error returned by the C API
@@ -1679,7 +2057,7 @@ H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) cons
// Programmer Binh-Minh Ribler - 2000
// Modification
// August 2017 - BMR
-// Keep Group::throwException and H5File::throwException to
+// Keep H5Location::throwException and H5File::throwException to
// maintain backward compatibility. For other subclasses, throw
// LocationException.
//--------------------------------------------------------------------------
diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h
index e5fbc84..19c49ea 100644
--- a/c++/src/H5Location.h
+++ b/c++/src/H5Location.h
@@ -90,6 +90,10 @@ class H5_DLLCPP H5Location : public IdComponent {
// Retrieves a dataspace with the region pointed to selected.
DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
+ // Create a new group with using link create property list.
+ Group createGroup(const char* name, const LinkCreatPropList& lcpl) const;
+ Group createGroup(const H5std_string& name, const LinkCreatPropList& lcpl) const;
+
// From CommonFG
// Creates a new group at this location which can be a file
// or another group.
@@ -109,6 +113,9 @@ class H5_DLLCPP H5Location : public IdComponent {
DataSet openDataSet(const char* name) const;
DataSet openDataSet(const H5std_string& name) const;
+ H5L_info_t getLinkInfo(const char* link_name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ H5L_info_t getLinkInfo(const H5std_string& link_name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
// Returns the value of a symbolic link.
H5std_string getLinkval(const char* link_name, size_t size=0) const;
H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const;
@@ -154,26 +161,95 @@ class H5_DLLCPP H5Location : public IdComponent {
int iterateElems(const H5std_string& name, int *idx, H5G_iterate_t op, void *op_data);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ // Creates a soft link from link_name to target_name.
+ void link(const char *target_name, const char *link_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void link(const H5std_string& target_name,
+ const H5std_string& link_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Creates a hard link from new_name to curr_name.
+ void link(const char *curr_name,
+ const Group& new_loc, const char *new_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void link(const H5std_string& curr_name,
+ const Group& new_loc, const H5std_string& new_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Creates a hard link from new_name to curr_name in same location.
+ void link(const char *curr_name,
+ const hid_t same_loc, const char *new_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void link(const H5std_string& curr_name,
+ const hid_t same_loc, const H5std_string& new_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
// Creates a link of the specified type from new_name to current_name;
// both names are interpreted relative to the specified location id.
+ // Deprecated due to inadequate functionality.
void link(H5L_type_t link_type, const char* curr_name, const char* new_name) const;
void link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const;
- // Removes the specified name at this location.
- void unlink(const char* name) const;
- void unlink(const H5std_string& name) const;
+ // Removes the specified link from this location.
+ void unlink(const char *link_name,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void unlink(const H5std_string& link_name,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
// Mounts the file 'child' onto this location.
void mount(const char* name, const H5File& child, const PropList& plist) const;
- //void mount(const char* name, H5File& child, PropList& plist) const; // removed from 1.8.18 and 1.10.1
void mount(const H5std_string& name, const H5File& child, const PropList& plist) const;
- //void mount(const H5std_string& name, H5File& child, PropList& plist) const; // removed from 1.8.18 and 1.10.1
// Unmounts the file named 'name' from this parent location.
void unmount(const char* name) const;
void unmount(const H5std_string& name) const;
+ // Copies a link from a group to another.
+ void copyLink(const char *src_name,
+ const Group& dst, const char *dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void copyLink(const H5std_string& src_name,
+ const Group& dst, const H5std_string& dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Makes a copy of a link in the same group.
+ void copyLink(const char *src_name, const char *dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void copyLink(const H5std_string& src_name,
+ const H5std_string& dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Renames a link in this group and moves to a new location.
+ void moveLink(const char* src_name,
+ const Group& dst, const char* dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void moveLink(const H5std_string& src_name,
+ const Group& dst, const H5std_string& dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Renames a link in this group.
+ void moveLink(const char* src_name, const char* dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void moveLink(const H5std_string& src_name,
+ const H5std_string& dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
// Renames an object at this location.
+ // Deprecated due to inadequate functionality.
void move(const char* src, const char* dst) const;
void move(const H5std_string& src, const H5std_string& dst) const;
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index 3eed168..27881c4 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -23,6 +23,7 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
@@ -224,9 +225,8 @@ Attribute H5Object::openAttribute(const unsigned int idx) const
///\par Description
/// The signature of user_op is
/// void (*)(H5::H5Location&, H5std_string, void*).
-/// For information, please refer to the C layer Reference Manual
-/// at:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Iterate
+/// For information, please refer to the H5Aiterate2 API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_data)
@@ -421,7 +421,6 @@ ssize_t H5Object::getObjName(char *obj_name, size_t buf_size) const
///\return Name of the object
///\exception H5::Exception
// Programmer Binh-Minh Ribler - Mar, 2014
-// Modification
//--------------------------------------------------------------------------
H5std_string H5Object::getObjName() const
{
diff --git a/c++/src/H5OcreatProp.cpp b/c++/src/H5OcreatProp.cpp
index ec6c08e..121198c 100644
--- a/c++/src/H5OcreatProp.cpp
+++ b/c++/src/H5OcreatProp.cpp
@@ -113,8 +113,7 @@ ObjCreatPropList::ObjCreatPropList(const hid_t plist_id) : PropList(plist_id) {}
///\par Description
/// If \c max_compact is set to 0, dense storage will be used.
/// For more detail about on attribute storage, please refer to the
-/// C layer Reference Manual at:
-/// https://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetAttrPhaseChange
+/// H5Pset_attr_phase_change API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
void ObjCreatPropList::setAttrPhaseChange(unsigned max_compact, unsigned min_dense) const
@@ -137,8 +136,7 @@ void ObjCreatPropList::setAttrPhaseChange(unsigned max_compact, unsigned min_den
///\par Description
/// If \c max_compact is set to 0, dense storage will be used.
/// For more detail about on attribute storage, please refer to the
-/// C layer Reference Manual at:
-/// https://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetAttrPhaseChange
+/// H5Pget_attr_phase_change API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
void ObjCreatPropList::getAttrPhaseChange(unsigned& max_compact, unsigned& min_dense) const
@@ -166,8 +164,8 @@ void ObjCreatPropList::getAttrPhaseChange(unsigned& max_compact, unsigned& min_d
/// tracked not indexed. Note that HDF5 currently provides no
/// mechanism to turn on attribute creation order tracking at object
/// creation time and to build the index later.
-/// The C layer Reference Manual at can be found at:
-/// https://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetAttrCreationOrder
+/// For detail, please refer to the H5Pset_attr_creation_order API
+/// in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
void ObjCreatPropList::setAttrCrtOrder(unsigned crt_order_flags) const
@@ -188,8 +186,8 @@ void ObjCreatPropList::setAttrCrtOrder(unsigned crt_order_flags) const
///\par Description
/// When no flag is set, i.e. crt_order_flags = 0, attribute
/// creation order is neither tracked not indexed.
-/// The C layer Reference Manual at can be found at:
-/// https://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetAttrCreationOrder
+/// For detail, please refer to the H5Pget_attr_creation_order API
+/// in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
unsigned ObjCreatPropList::getAttrCrtOrder() const
diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp
index 53d525c..704a617 100644
--- a/c++/src/H5PredType.cpp
+++ b/c++/src/H5PredType.cpp
@@ -19,6 +19,7 @@
#include "H5PropList.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp
index d2d87e9..4c0b3d2 100644
--- a/c++/src/H5StrType.cpp
+++ b/c++/src/H5StrType.cpp
@@ -20,6 +20,7 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
@@ -281,8 +282,8 @@ H5T_str_t StrType::getStrpad() const
///\param strpad - IN: String padding type
///\exception H5::DataTypeIException
///\par Description
-/// For detail, please refer to the C layer Reference Manual at:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetStrpad
+/// For information, please refer to the H5Tset_strpad API in
+/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void StrType::setStrpad(H5T_str_t strpad) const
diff --git a/c++/src/H5VarLenType.cpp b/c++/src/H5VarLenType.cpp
index 5b29682..188ee41 100644
--- a/c++/src/H5VarLenType.cpp
+++ b/c++/src/H5VarLenType.cpp
@@ -19,6 +19,7 @@
#include "H5PropList.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/Makefile.am b/c++/src/Makefile.am
index efe17dc..c02a9e7 100644
--- a/c++/src/Makefile.am
+++ b/c++/src/Makefile.am
@@ -32,27 +32,29 @@ bin_SCRIPTS=h5c++
# Source files for the library
libhdf5_cpp_la_SOURCES=H5Exception.cpp H5IdComponent.cpp \
- H5DataSpace.cpp H5PropList.cpp H5Library.cpp \
- H5FaccProp.cpp H5FcreatProp.cpp H5LaccProp.cpp \
- H5DxferProp.cpp H5DcreatProp.cpp H5Location.cpp \
- H5AbstractDs.cpp H5Attribute.cpp H5Object.cpp \
- H5OcreatProp.cpp H5DataType.cpp H5AtomType.cpp \
- H5PredType.cpp H5EnumType.cpp H5IntType.cpp \
- H5FloatType.cpp H5StrType.cpp H5ArrayType.cpp \
- H5VarLenType.cpp H5CompType.cpp H5DataSet.cpp \
- H5CommonFG.cpp H5Group.cpp H5File.cpp
+ H5DataSpace.cpp H5PropList.cpp H5Library.cpp \
+ H5FaccProp.cpp H5FcreatProp.cpp H5LcreatProp.cpp \
+ H5LaccProp.cpp H5DxferProp.cpp H5DcreatProp.cpp \
+ H5Location.cpp H5AbstractDs.cpp H5Attribute.cpp \
+ H5Object.cpp H5OcreatProp.cpp H5DataType.cpp \
+ H5AtomType.cpp H5PredType.cpp H5EnumType.cpp \
+ H5IntType.cpp H5FloatType.cpp H5StrType.cpp \
+ H5ArrayType.cpp H5VarLenType.cpp H5CompType.cpp \
+ H5DataSet.cpp H5CommonFG.cpp H5Group.cpp H5File.cpp
# HDF5 C++ library depends on HDF5 Library.
libhdf5_cpp_la_LIBADD=$(LIBHDF5)
# Public headers
-include_HEADERS=H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h H5Classes.h \
- H5CommonFG.h H5CompType.h H5DataSet.h H5DataSpace.h H5DataType.h \
- H5OcreatProp.h H5DcreatProp.h H5DxferProp.h H5EnumType.h \
- H5Exception.h H5FaccProp.h H5FcreatProp.h H5File.h H5FloatType.h \
- H5Group.h H5IdComponent.h H5Include.h H5IntType.h H5LaccProp.h \
- H5Library.h H5Location.h H5Object.h H5PredType.h H5PropList.h \
- H5StrType.h H5CppDoc.h H5ArrayType.h H5VarLenType.h
+include_HEADERS=H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h \
+ H5Classes.h H5CommonFG.h H5CompType.h H5DataSet.h \
+ H5DataSpace.h H5DataType.h H5OcreatProp.h H5DcreatProp.h\
+ H5DxferProp.h H5EnumType.h H5Exception.h H5FaccProp.h \
+ H5FcreatProp.h H5File.h H5FloatType.h H5Group.h \
+ H5IdComponent.h H5Include.h H5IntType.h H5LcreatProp.h \
+ H5LaccProp.h H5Library.h H5Location.h H5Object.h \
+ H5PredType.h H5PropList.h H5StrType.h H5CppDoc.h \
+ H5ArrayType.h H5VarLenType.h
# h5c++ and libhdf5.settings are generated during configure. Remove only when
# distclean.
diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config
index 56ea1e6..3943f7b 100644
--- a/c++/src/cpp_doc_config
+++ b/c++/src/cpp_doc_config
@@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.
-PROJECT_NAME = "HDF5 C++ API"
+PROJECT_NAME =
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
@@ -51,7 +51,7 @@ PROJECT_BRIEF =
# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
# to the output directory.
-PROJECT_LOGO = ./header_files/hdf_logo.jpg
+PROJECT_LOGO =
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is
diff --git a/c++/src/footer.html b/c++/src/footer.html
index ba37ee7..5ad9b7c 100644
--- a/c++/src/footer.html
+++ b/c++/src/footer.html
@@ -11,8 +11,8 @@
</address>
</td><td width="5%">&nbsp;</td>
<td align="right">
- <a href="https://www.hdfgroup.org/HDF5/doc/Copyright.html">Copyright</a> by
- <a href="https://www.hdfgroup.org">The HDF Group</a>
+ Copyright by
+ The HDF Group
<br>
and the Board of Trustees of the University of Illinois
</td>
diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt
index 5194865..b4fb0fc 100644
--- a/c++/test/CMakeLists.txt
+++ b/c++/test/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_CPP_TEST)
# --------------------------------------------------------------------
# Notes: When creating unit test executables they should be prefixed
diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp
index e348d64..b8560aa 100644
--- a/c++/test/tlinks.cpp
+++ b/c++/test/tlinks.cpp
@@ -323,11 +323,9 @@ static const char *FILENAME[] = {
* Purpose Test building a file with assorted links.
*
* Return Success: 0
- *
* Failure: -1
*
- * Programmer Binh-Minh Ribler
- * October 16, 2009
+ * October 16, 2009
*-------------------------------------------------------------------------
*/
static void test_basic_links(hid_t fapl_id, hbool_t new_format)
@@ -434,7 +432,369 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format)
{
issue_fail_msg("test_basic_links()", __LINE__, __FILE__, E.getCDetailMsg());
}
-}
+} // test_basic_links
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_lcpl
+ *
+ * Purpose: Tests link creation property lists, specifically, the
+ * character encoding property.
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ * March, 2018
+ *-------------------------------------------------------------------------
+ */
+const H5std_string GROUP1NAME("First_group");
+const H5std_string GROUP2NAME("Second_group");
+static void
+test_lcpl(hid_t fapl_id, hbool_t new_format)
+{
+ H5L_info_t linfo;
+ char filename[1024];
+ hsize_t dims[2];
+
+ if(new_format)
+ SUBTEST("Link creation property lists (w/new group format)")
+ else
+ SUBTEST("Link creation property lists")
+
+ try
+ {
+ FileAccPropList fapl(fapl_id);
+
+ // Create a new file.
+ h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename);
+ H5File file(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+
+ // Create and link a group with the default LCPL.
+ Group grp_1(file.createGroup(GROUP1NAME));
+ grp_1.close();
+
+ // Check that its character encoding is the default.
+ linfo = file.getLinkInfo(GROUP1NAME);
+ if(linfo.cset != H5T_CSET_ASCII)
+ throw InvalidActionException("H5Lget_info", "Character encoding is not default");
+
+ // Create and commit a datatype with the default LCPL.
+ IntType dtype(PredType::NATIVE_INT);
+ dtype.commit(file, "/type");
+ dtype.close();
+
+ // Check that its character encoding is the default.
+ linfo = file.getLinkInfo("/type");
+ verify_val(linfo.cset, H5T_CSET_ASCII, "Character encoding is not default", __LINE__, __FILE__);
+
+ // Create a simple dataspace.
+ dims[0] = H5L_DIM1;
+ dims[1] = H5L_DIM2;
+ DataSpace dspace(2 ,dims);
+
+ // Create a dataset using the default LCPL.
+ DataSet dset(file.createDataSet("/dataset", PredType::NATIVE_INT, dspace));
+ dset.close();
+
+ // Check that its character encoding is the default.
+ linfo = file.getLinkInfo("/dataset");
+ verify_val(linfo.cset, H5T_CSET_ASCII, "Character encoding is not default", __LINE__, __FILE__);
+
+ // Create a link creation property list with the UTF-8 character encoding.
+ LinkCreatPropList lcpl;
+ lcpl.setCharEncoding(H5T_CSET_UTF8);
+
+ // Create and link a group with the new LCPL.
+ Group grp_2(file.createGroup(GROUP2NAME, lcpl));
+ grp_2.close();
+
+ // Check that its character encoding is UTF-8.
+ linfo = file.getLinkInfo(GROUP2NAME);
+ verify_val(linfo.cset, H5T_CSET_UTF8, "Character encoding is not UTF-8", __LINE__, __FILE__);
+
+ PASSED();
+ } // end of try block
+ catch (Exception& E)
+ {
+ issue_fail_msg("test_num_links()", __LINE__, __FILE__, E.getCDetailMsg());
+ }
+} // end test_lcpl()
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_move
+ *
+ * Purpose: Tests wrappers of H5Lmove()
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ * March, 2018
+ *-------------------------------------------------------------------------
+ */
+static void
+test_move(hid_t fapl_id, hbool_t new_format)
+{
+ char filename[1024];
+
+ if(new_format)
+ SUBTEST("Group::moveLink (w/new group format)")
+ else
+ SUBTEST("Group::moveLink")
+
+ try
+ {
+ FileAccPropList fapl(fapl_id);
+
+ // Create two new files
+ h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename);
+ H5File file_a(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+ h5_fixname(FILENAME[1], fapl_id, filename, sizeof filename);
+ H5File file_b(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+
+ // Create groups in first file
+ Group grp_1(file_a.createGroup(GROUP1NAME));
+ Group grp_2(file_a.createGroup(GROUP2NAME));
+ Group grp_move(grp_1.createGroup("group_move"));
+
+ // Create hard and soft links
+ grp_1.link(H5L_TYPE_HARD, "group_move", "hard");
+ grp_2.link(H5L_TYPE_SOFT, "/First_group/group_copy", "soft");
+
+ // Move a group across files, should fail
+ try {
+ grp_1.moveLink("group_move", file_b, "group_new_name");
+
+ // Should throw an exception but didn't
+ H5_FAILED();
+ cerr << " Group group_move should not be moved across files" << endl;
+ } catch (Exception& E) {
+ // expected
+ }
+
+ // Move a soft link across files, should succeed
+ grp_2.moveLink("soft", file_b, "soft_new_name");
+ if(file_b.exists("soft_new_name") != TRUE)
+ throw InvalidActionException("H5File::exists", "grp1/soft doesn't exist");
+
+ // Move a group across groups in the same file while renaming it
+ grp_1.moveLink("group_move", grp_2, "group_new_name");
+
+ // Open the group just moved to the new location. */
+ Group moved_grp = grp_2.openGroup("group_new_name");
+ moved_grp.close();
+
+ // Verify that the group is no longer in the original location
+ try {
+ moved_grp = grp_1.openGroup("group_move");
+
+ // Should throw an exception but didn't
+ H5_FAILED();
+ cerr << " Group group_move should not be in original location" << endl;
+ } catch (Exception& E) {
+ // expected
+ }
+
+ // Use H5Lmove to rename a group without moving it
+ H5std_string new_name("group_new_name");
+ H5std_string newer_name("group_newer_name");
+ grp_2.moveLink(new_name, newer_name);
+
+ // Open the group
+ moved_grp = grp_2.openGroup("group_newer_name");
+ moved_grp.close();
+
+ // Use H5Lmove to move a group without renaming it
+ grp_2.moveLink(newer_name, grp_1, newer_name);
+
+ // Open the group
+ moved_grp = grp_1.openGroup("group_newer_name");
+ moved_grp.close();
+
+ // Move the group while giving long paths
+ file_a.moveLink("/First_group/group_newer_name", grp_2, "/Second_group/group_newest_name");
+
+ // Open the group just moved to the new location
+ moved_grp = grp_2.openGroup("group_newest_name");
+ moved_grp.close();
+
+ // Verify that the groups are not in previous locations
+ try {
+ moved_grp = grp_1.openGroup("group_newer_name");
+ moved_grp.close();
+
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_newer_name should not be in GROUP1NAME" << endl;
+ } catch (Exception& E) {
+ // expected
+ }
+ try {
+ moved_grp = grp_2.openGroup("group_newer_name");
+ moved_grp.close();
+
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_newer_name should not be in GROUP2NAME" << endl;
+ } catch (Exception& E) {
+ // expected
+ }
+ try {
+ moved_grp = grp_2.openGroup("group_new_name");
+ moved_grp.close();
+
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_new_name should not be in GROUP2NAME" << endl;
+ } catch (Exception& E) {
+ // expected
+ }
+ try {
+ moved_grp = grp_1.openGroup("group_copy");
+ moved_grp.close();
+
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_copy should not be in GROUP1NAME" << endl;
+ } catch (Exception& E) {
+ // expected
+ }
+ PASSED();
+ } // end of try block
+ catch (Exception& E)
+ {
+ issue_fail_msg("test_num_links()", __LINE__, __FILE__, E.getCDetailMsg());
+ }
+} // test_move
+
+/*-------------------------------------------------------------------------
+ * Function: test_copy
+ *
+ * Purpose: Tests wrappers of H5Lcopy()
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ * March, 2018
+ *-------------------------------------------------------------------------
+ */
+static void test_copy(hid_t fapl_id, hbool_t new_format)
+{
+ char filename[1024];
+
+ if(new_format)
+ SUBTEST("Group::copyLink (w/new group format)")
+ else
+ SUBTEST("Group::copyLink")
+
+ try
+ {
+ // Create two new files
+ h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename);
+ H5File file_a(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl_id);
+ h5_fixname(FILENAME[1], fapl_id, filename, sizeof filename);
+ H5File file_b(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl_id);
+
+ // Create groups in first file
+ Group grp_1(file_a.createGroup(GROUP1NAME));
+ Group grp_2(file_a.createGroup(GROUP2NAME));
+ Group grp_move(grp_1.createGroup("group_copy"));
+
+ // Create hard and soft links
+ grp_1.link("group_copy", H5L_SAME_LOC, "hard");
+ grp_2.link("/First_group/group_copy", "soft");
+
+ // Copy a group across files, should fail
+ try {
+ grp_1.copyLink("group_copy", file_b, "group_new_name");
+ } catch (Exception& E) {
+ // expected
+ }
+
+ // Copy a soft link across files, should succeed
+ grp_2.copyLink("soft", file_b, "soft_new_name");
+ if (file_b.exists("soft_new_name") != TRUE)
+ throw InvalidActionException("H5File::exists", "soft_new_name doesn't exist");
+
+ // Move a group across groups in the same file while renaming it
+ H5std_string copy_name("group_copy");
+ H5std_string new_name("group_new_name");
+ grp_1.copyLink(copy_name, grp_2, new_name);
+
+ // Open the group just moved to the new location.
+ Group moved_grp(grp_2.openGroup("group_new_name"));
+ moved_grp.close();
+
+ // Verify that the group is also in the original location
+ moved_grp = grp_1.openGroup("group_copy");
+ moved_grp.close();
+
+ // Create a group in the same location with a different name
+ grp_2.copyLink("group_new_name", "group_newer_name");
+
+ // Open the group
+ moved_grp = grp_2.openGroup("group_newer_name");
+ moved_grp.close();
+
+ // Verify that the group is also in the original location
+ moved_grp = grp_2.openGroup("group_new_name");
+ moved_grp.close();
+
+ // Use H5Lcopy to copy to a different location with the same name
+ grp_2.copyLink("group_newer_name", grp_1, "group_newer_name");
+
+ // Open the group
+ moved_grp = grp_1.openGroup("group_newer_name");
+ moved_grp.close();
+
+ // Verify that the group is still in the previous location
+ moved_grp = grp_2.openGroup("group_new_name");
+ moved_grp.close();
+
+ // Copy the group while giving long paths
+ file_a.copyLink("/First_group/group_newer_name", grp_2, "/Second_group/group_newest_name");
+
+ // Open the newest group just moved to the new location
+ moved_grp = grp_2.openGroup("group_newest_name");
+ moved_grp.close();
+
+ // Verify that the group is still in all previous original locations
+ moved_grp = grp_1.openGroup("group_newer_name");
+ moved_grp.close();
+
+ moved_grp = grp_2.openGroup("group_newer_name");
+ moved_grp.close();
+
+ moved_grp = grp_2.openGroup("group_new_name");
+ moved_grp.close();
+
+ moved_grp = grp_1.openGroup("group_copy");
+ moved_grp.close();
+
+ // Delete "group_newer_name" from group 2, then try to open it.
+ grp_2.unlink("group_newer_name");
+ try {
+ moved_grp = grp_2.openGroup("group_newer_name");
+ moved_grp.close();
+
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_newer_name should not be in GROUP2NAME" << endl;
+ } catch (Exception& E) {
+ // expected
+ }
+
+ // Delete "group_copy" from group 1, then try to open it.
+ grp_1.unlink("group_copy");
+ try {
+ moved_grp = grp_1.openGroup("group_copy");
+ moved_grp.close();
+
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_copy should not be in GROUP1NAME" << endl;
+ } catch (Exception& E) {
+ // expected
+ }
+
+ PASSED();
+ } // end of try block
+ catch (Exception& E)
+ {
+ issue_fail_msg("test_num_links()", __LINE__, __FILE__, E.getCDetailMsg());
+ }
+} // test_copy
/*-------------------------------------------------------------------------
@@ -443,11 +803,9 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format)
* Purpose Test setting and getting limit of number of links
*
* Return Success: 0
- *
* Failure: -1
*
- * Programmer Binh-Minh Ribler
- * October 16, 2009
+ * October 16, 2009
*-------------------------------------------------------------------------
*/
static void test_num_links(hid_t fapl_id, hbool_t new_format)
@@ -491,8 +849,7 @@ static void test_num_links(hid_t fapl_id, hbool_t new_format)
*
* Return None
*
- * Programmer Binh-Minh Ribler
- * October 16, 2009
+ * October 16, 2009
*-------------------------------------------------------------------------
*/
extern "C"
@@ -516,9 +873,10 @@ void test_links()
if((fapl2_id = H5Pcopy(fapl_id)) < 0)
throw Exception("test_links", "H5Pcopy failed");
- /* Set the "use the latest version of the format" bounds for creating objects in the file */
+ /* Set the "use the latest version of the format" bounds for creating
+ objects in the file */
if(H5Pset_libver_bounds(fapl2_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- throw Exception("test_links", "H5Pset_libver_bounds failed");
+ throw Exception("test_links", "H5Pset_libver_bounds failed");
/* Loop over using new group format */
for(new_format = FALSE; new_format <= TRUE; new_format++)
@@ -534,124 +892,11 @@ void test_links()
/* General tests... (on both old & new format groups */
// FileAccPropList may be passed in instead of fapl id
test_basic_links(my_fapl_id, new_format);
-#if 0
-// these tests are from the C test links.c and left here for future
-// implementation of H5L API
- nerrors += test_basic_links(fapl_id, new_format) < 0 ? 1 : 0;
- nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += ck_new_links(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += long_links(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += toomany(my_fapl, new_format) < 0 ? 1 : 0;
-
- /* Test new H5L link creation routine */
- nerrors += test_lcpl(my_fapl, new_format);
- nerrors += test_move(my_fapl, new_format);
- nerrors += test_copy(my_fapl, new_format);
- nerrors += test_move_preserves(my_fapl, new_format);
-#ifndef H5_NO_DEPRECATED_SYMBOLS
- nerrors += test_deprec(my_fapl, new_format);
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
- nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_self(envval, my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_pingpong(envval, my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_toomany(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_closing(envval, my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_endian(new_format) < 0 ? 1 : 0;
- nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0;
-
- /* tests for external link */
- nerrors += external_link_env(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_cwd(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_abstar(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_abstar_cur(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0;
- nerrors += external_set_elink_acc_flags(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_set_elink_cb(my_fapl, new_format) < 0 ? 1 : 0;
-
-#ifdef H5_HAVE_WINDOW_PATH
- nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win3(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win4(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win5(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win6(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win7(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win8(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win9(my_fapl, new_format) < 0 ? 1 : 0;
-#endif
- /* These tests assume that external links are a form of UD links,
- * so assume that everything that passed for external links
- * above has already been tested for UD links.
- */
- if(new_format == TRUE) {
- nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */
- nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */
- } /* end if */
-
- nerrors += ud_callbacks(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += ud_link_errors(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += lapl_udata(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += lapl_nlinks(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += linkinfo(my_fapl, new_format) < 0 ? 1 : 0;
-
- /* Misc. extra tests, useful for both new & old format files */
- nerrors += link_visit(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += link_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += obj_visit(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += obj_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += obj_visit_stop(my_fapl, new_format) < 0 ? 1 : 0;
-
- /* Keep this test last, it's testing files that are used above */
- /* do not do this for files used by external link tests */
- nerrors += check_all_closed(my_fapl, new_format, EXTSTOP) < 0 ? 1 : 0;
-#endif // 0
+ test_move(my_fapl_id, new_format);
+ test_copy(my_fapl_id, new_format);
+ test_lcpl(my_fapl_id, new_format);
} /* end for */
-#if 0
- /* New group revision feature tests */
- nerrors += corder_create_empty(fapl2) < 0 ? 1 : 0;
-/* XXX: when creation order indexing is fully working, go back and add checks
-* to these tests to make certain that the creation order values are
-* correct.
-*/
- nerrors += corder_create_compact(fapl2) < 0 ? 1 : 0;
- nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0;
- nerrors += corder_transition(fapl2) < 0 ? 1 : 0;
- nerrors += corder_delete(fapl2) < 0 ? 1 : 0;
- nerrors += link_info_by_idx(fapl2) < 0 ? 1 : 0;
- nerrors += delete_by_idx(fapl2) < 0 ? 1 : 0;
- nerrors += link_iterate(fapl2) < 0 ? 1 : 0;
- nerrors += open_by_idx(fapl2) < 0 ? 1 : 0;
- nerrors += object_info(fapl2) < 0 ? 1 : 0;
- nerrors += group_info(fapl2) < 0 ? 1 : 0;
- nerrors += timestamps(fapl2) < 0 ? 1 : 0;
-
- /* Test new API calls on old-style groups */
- nerrors += link_info_by_idx_old(fapl) < 0 ? 1 : 0;
- nerrors += delete_by_idx_old(fapl) < 0 ? 1 : 0;
- nerrors += link_iterate_old(fapl) < 0 ? 1 : 0;
- nerrors += open_by_idx_old(fapl) < 0 ? 1 : 0;
- nerrors += object_info_old(fapl) < 0 ? 1 : 0;
- nerrors += group_info_old(fapl) < 0 ? 1 : 0;
-
-#endif
/* Close 2nd FAPL */
H5Pclose(fapl2_id);
@@ -683,5 +928,9 @@ extern "C"
void cleanup_links()
{
HDremove(FILENAME[0]);
+ HDremove(FILENAME[1]);
}
+
+
+
diff --git a/config/cmake/CTestScript.cmake b/config/cmake/CTestScript.cmake
index 27ae3a0..0269ba8 100755
--- a/config/cmake/CTestScript.cmake
+++ b/config/cmake/CTestScript.cmake
@@ -9,7 +9,7 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
-cmake_minimum_required (VERSION 3.3.2 FATAL_ERROR)
+cmake_minimum_required (VERSION 3.10)
########################################################
# For any comments please contact cdashhelp@hdfgroup.org
#
diff --git a/config/cmake/HDF518_Examples.cmake.in b/config/cmake/HDF518_Examples.cmake.in
index 0e81217..1f4f479 100644
--- a/config/cmake/HDF518_Examples.cmake.in
+++ b/config/cmake/HDF518_Examples.cmake.in
@@ -9,7 +9,7 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
-cmake_minimum_required (VERSION 3.3.2 FATAL_ERROR)
+cmake_minimum_required (VERSION 3.10)
###############################################################################################################
# This script will build and run the examples from a folder
# Execute from a command line:
diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in
index 6453b16..eb57685 100644
--- a/config/cmake/HDF5_Examples.cmake.in
+++ b/config/cmake/HDF5_Examples.cmake.in
@@ -9,7 +9,7 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
-cmake_minimum_required (VERSION 3.3.2 FATAL_ERROR)
+cmake_minimum_required (VERSION 3.10)
###############################################################################################################
# This script will build and run the examples from a folder
# Execute from a command line:
diff --git a/config/cmake/UseJava.cmake b/config/cmake/UseJava.cmake
index c70f52e..60b1758 100644
--- a/config/cmake/UseJava.cmake
+++ b/config/cmake/UseJava.cmake
@@ -19,6 +19,7 @@
# [VERSION version]
# [OUTPUT_NAME name]
# [OUTPUT_DIR dir]
+# [GENERATE_NATIVE_HEADERS target [DESTINATION dir]]
# )
#
# This command creates a <target_name>.jar. It compiles the given
@@ -34,6 +35,14 @@
# The default OUTPUT_DIR can also be changed by setting the variable
# CMAKE_JAVA_TARGET_OUTPUT_DIR.
#
+# Optionally, using option GENERATE_NATIVE_HEADERS, native header files can be generated
+# for methods declared as native. These files provide the connective glue that allow your
+# Java and C code to interact. An INTERFACE target will be created for an easy usage
+# of generated files. Sub-option DESTINATION can be used to specify output directory for
+# generated header files.
+#
+# GENERATE_NATIVE_HEADERS option requires, at least, version 1.8 of the JDK.
+#
# Additional instructions:
#
# ::
@@ -167,6 +176,22 @@
#
#
#
+# ::
+#
+# For an optimum usage of option GENERATE_NATIVE_HEADERS, it is recommended to
+# include module JNI before any call to add_jar. The produced target for native
+# headers can then be used to compile C/C++ sources with command
+# target_link_libraries.
+#
+#
+# ::
+#
+# find_package(JNI)
+# add_jar(foo foo.java GENERATE_NATIVE_HEADERS foo-native)
+# add_library(bar bar.cpp)
+# target_link_libraries(bar PRIVATE foo-native)
+#
+#
# Target Properties:
#
# ::
@@ -358,6 +383,10 @@
# Create C header files from java classes. These files provide the connective glue
# that allow your Java and C code to interact.
#
+# This command will no longer be supported starting with version 1.10 of the JDK due
+# to the `suppression of javah tool <http://openjdk.java.net/jeps/313>`_.
+# Command ``add_jar(GENERATE_NATIVE_HEADERS)`` must be used instead.
+#
# There are two main signatures for create_javah. The first signature
# returns generated files through variable specified by GENERATED_FILES option:
#
@@ -449,7 +478,7 @@ function(add_jar _TARGET_NAME)
cmake_parse_arguments(_add_jar
""
"VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT;MANIFEST"
- "SOURCES;INCLUDE_JARS"
+ "SOURCES;INCLUDE_JARS;GENERATE_NATIVE_HEADERS"
${ARGN}
)
@@ -495,6 +524,31 @@ function(add_jar _TARGET_NAME)
get_filename_component (_MANIFEST_VALUE "${_add_jar_MANIFEST}" ABSOLUTE)
endif ()
+ unset (_GENERATE_NATIVE_HEADERS)
+ if (_add_jar_GENERATE_NATIVE_HEADERS)
+ # Raise an error if JDK version is less than 1.8 because javac -h is not supported
+ # by earlier versions.
+ if ("${Java_VERSION}" VERSION_LESS 1.8)
+ message (FATAL_ERROR "ADD_JAR: GENERATE_NATIVE_HEADERS is not supported with this version of Java.")
+ endif()
+ cmake_parse_arguments (_add_jar_GENERATE_NATIVE_HEADERS "" "DESTINATION" "" ${_add_jar_GENERATE_NATIVE_HEADERS})
+ if (NOT _add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS)
+ message (FATAL_ERROR "ADD_JAR: GENERATE_NATIVE_HEADERS: missing required argument.")
+ endif()
+ list (LENGTH _add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS length)
+ if (length GREATER 1)
+ list (REMOVE_AT _add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS 0)
+ message (FATAL_ERROR "ADD_JAR: GENERATE_NATIVE_HEADERS: ${_add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS}: unexpected argument(s).")
+ endif()
+ if (NOT _add_jar_GENERATE_NATIVE_HEADERS_DESTINATION)
+ set (_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir/native_headers")
+ endif()
+
+ set (_GENERATE_NATIVE_HEADERS_TARGET ${_add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS})
+ set (_GENERATE_NATIVE_HEADERS_OUTPUT_DIR "${_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION}")
+ set (_GENERATE_NATIVE_HEADERS -h "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}")
+ endif()
+
if (LIBRARY_OUTPUT_PATH)
set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH})
else ()
@@ -626,6 +680,7 @@ function(add_jar _TARGET_NAME)
${CMAKE_JAVA_COMPILE_FLAGS}
-classpath "${CMAKE_JAVA_INCLUDE_PATH_FINAL}"
-d ${CMAKE_JAVA_CLASS_OUTPUT_PATH}
+ ${_GENERATE_NATIVE_HEADERS}
${_JAVA_SOURCES_FILELISTS}
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME}
DEPENDS ${_JAVA_COMPILE_FILES} ${_JAVA_COMPILE_FILELISTS} ${_JAVA_COMPILE_DEPENDS}
@@ -736,6 +791,17 @@ function(add_jar _TARGET_NAME)
${CMAKE_JAVA_CLASS_OUTPUT_PATH}
)
+ if (_GENERATE_NATIVE_HEADERS)
+ # create an INTERFACE library encapsulating include directory for generated headers
+ add_library (${_GENERATE_NATIVE_HEADERS_TARGET} INTERFACE)
+ target_include_directories (${_GENERATE_NATIVE_HEADERS_TARGET} INTERFACE
+ "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}"
+ ${JNI_INCLUDE_DIRS})
+ # this INTERFACE library depends on jar generation
+ add_dependencies (${_GENERATE_NATIVE_HEADERS_TARGET} ${_TARGET_NAME})
+
+ set_property (DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}")
+ endif()
endfunction()
function(INSTALL_JAR _TARGET_NAME)
@@ -1307,6 +1373,12 @@ function(create_javadoc _target)
endfunction()
function (create_javah)
+ if ("${Java_VERSION}" VERSION_GREATER_EQUAL 1.10)
+ message (FATAL_ERROR "create_javah: not supported with this Java version. Use add_jar(GENERATE_NATIVE_HEADERS) instead.")
+ elseif ("${Java_VERSION}" VERSION_GREATER_EQUAL 1.8)
+ message (DEPRECATION "create_javah: this command will no longer be supported starting with version 1.10 of JDK. Update your project by using command add_jar(GENERATE_NATIVE_HEADERS) instead.")
+ endif()
+
cmake_parse_arguments(_create_javah
""
"TARGET;GENERATED_FILES;OUTPUT_NAME;OUTPUT_DIR"
diff --git a/config/cmake/libh5cc.in b/config/cmake/libh5cc.in
new file mode 100755
index 0000000..f462d56
--- /dev/null
+++ b/config/cmake/libh5cc.in
@@ -0,0 +1,32 @@
+#! /bin/sh
+##
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the COPYING file, which can be found at the root of the source code
+# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
+##
+
+prg=$0
+if [ ! -e "$prg" ]; then
+ case $prg in
+ (*/*) exit 1;;
+ (*) prg=$(command -v -- "$prg") || exit;;
+ esac
+fi
+dir=$(
+ cd -P -- "$(dirname -- "$prg")/.." && pwd -P
+) || exit
+prg=$dir/$(basename -- "$prg") || exit
+
+printf '%s\n' "$prg"
+printf 'dir is %s\n' "$dir"
+
+export PKG_CONFIG_PATH=$dir/lib/pkgconfig
+
+@_PKG_CONFIG_COMPILER@ `pkg-config --define-variable=prefix=$dir --cflags --libs @_PKG_CONFIG_LIBNAME@-@_PKG_CONFIG_VERSION@` $@
diff --git a/config/cmake/libhdf5.pc.in b/config/cmake/libhdf5.pc.in
new file mode 100755
index 0000000..4a2ebaa
--- /dev/null
+++ b/config/cmake/libhdf5.pc.in
@@ -0,0 +1,14 @@
+prefix=@_PKG_CONFIG_PREFIX@
+exec_prefix=@_PKG_CONFIG_EXEC_PREFIX@
+libdir=@_PKG_CONFIG_LIBDIR@
+includedir=@_PKG_CONFIG_INCLUDEDIR@
+
+Name: @_PKG_CONFIG_LIBNAME@
+Description: HDF5 (Hierarchical Data Format 5) Software Library
+Version: @_PKG_CONFIG_VERSION@
+
+Cflags: -I${includedir}
+Libs: -L${libdir} @_PKG_CONFIG_SH_LIBS@
+Requires: @_PKG_CONFIG_REQUIRES@
+Libs.private: @_PKG_CONFIG_LIBS_PRIVATE@ @_PKG_CONFIG_LIBS@
+Requires.private: @_PKG_CONFIG_REQUIRES_PRIVATE@
diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake
index cfad6f1..670196b 100755
--- a/config/cmake/scripts/CTestScript.cmake
+++ b/config/cmake/scripts/CTestScript.cmake
@@ -9,7 +9,7 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
-cmake_minimum_required (VERSION 3.3.2 FATAL_ERROR)
+cmake_minimum_required (VERSION 3.10)
########################################################
# This dashboard is maintained by The HDF Group
# For any comments please contact cdashhelp@hdfgroup.org
diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake
index 88843fa..7eaf80a 100755
--- a/config/cmake/scripts/HDF5config.cmake
+++ b/config/cmake/scripts/HDF5config.cmake
@@ -15,7 +15,7 @@
### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201764 -C Release -VV -O hdf5.log ###
#############################################################################################
-cmake_minimum_required (VERSION 3.3.2 FATAL_ERROR)
+cmake_minimum_required (VERSION 3.10)
############################################################################
# Usage:
# ctest -S HDF5config.cmake,OPTION=VALUE -C Release -VV -O test.log
diff --git a/config/cmake_ext_mod/FindMPI.cmake b/config/cmake_ext_mod/FindMPI.cmake
deleted file mode 100644
index d01dd35..0000000
--- a/config/cmake_ext_mod/FindMPI.cmake
+++ /dev/null
@@ -1,1514 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See https://cmake.org/licensing for details.
-
-#.rst:
-# FindMPI
-# -------
-#
-# Find a Message Passing Interface (MPI) implementation.
-#
-# The Message Passing Interface (MPI) is a library used to write
-# high-performance distributed-memory parallel applications, and is
-# typically deployed on a cluster. MPI is a standard interface (defined
-# by the MPI forum) for which many implementations are available.
-#
-# Variables for using MPI
-# ^^^^^^^^^^^^^^^^^^^^^^^
-#
-# The module exposes the components ``C``, ``CXX``, ``MPICXX`` and ``Fortran``.
-# Each of these controls the various MPI languages to search for.
-# The difference between ``CXX`` and ``MPICXX`` is that ``CXX`` refers to the
-# MPI C API being usable from C++, whereas ``MPICXX`` refers to the MPI-2 C++ API
-# that was removed again in MPI-3.
-#
-# Depending on the enabled components the following variables will be set:
-#
-# ``MPI_FOUND``
-# Variable indicating that MPI settings for all requested languages have been found.
-# If no components are specified, this is true if MPI settings for all enabled languages
-# were detected. Note that the ``MPICXX`` component does not affect this variable.
-# ``MPI_VERSION``
-# Minimal version of MPI detected among the requested languages, or all enabled languages
-# if no components were specified.
-#
-# This module will set the following variables per language in your
-# project, where ``<lang>`` is one of C, CXX, or Fortran:
-#
-# ``MPI_<lang>_FOUND``
-# Variable indicating the MPI settings for ``<lang>`` were found and that
-# simple MPI test programs compile with the provided settings.
-# ``MPI_<lang>_COMPILER``
-# MPI compiler for ``<lang>`` if such a program exists.
-# ``MPI_<lang>_COMPILE_OPTIONS``
-# Compilation options for MPI programs in ``<lang>``, given as a :ref:`;-list <CMake Language Lists>`.
-# ``MPI_<lang>_COMPILE_DEFINITIONS``
-# Compilation definitions for MPI programs in ``<lang>``, given as a :ref:`;-list <CMake Language Lists>`.
-# ``MPI_<lang>_INCLUDE_DIRS``
-# Include path(s) for MPI header.
-# ``MPI_<lang>_LINK_FLAGS``
-# Linker flags for MPI programs.
-# ``MPI_<lang>_LIBRARIES``
-# All libraries to link MPI programs against.
-#
-# Additionally, the following :prop_tgt:`IMPORTED` targets are defined:
-#
-# ``MPI::MPI_<lang>``
-# Target for using MPI from ``<lang>``.
-#
-# The following variables indicating which bindings are present will be defined:
-#
-# ``MPI_MPICXX_FOUND``
-# Variable indicating whether the MPI-2 C++ bindings are present (introduced in MPI-2, removed with MPI-3).
-# ``MPI_Fortran_HAVE_F77_HEADER``
-# True if the Fortran 77 header ``mpif.h`` is available.
-# ``MPI_Fortran_HAVE_F90_MODULE``
-# True if the Fortran 90 module ``mpi`` can be used for accessing MPI (MPI-2 and higher only).
-# ``MPI_Fortran_HAVE_F08_MODULE``
-# True if the Fortran 2008 ``mpi_f08`` is available to MPI programs (MPI-3 and higher only).
-#
-# If possible, the MPI version will be determined by this module. The facilities to detect the MPI version
-# were introduced with MPI-1.2, and therefore cannot be found for older MPI versions.
-#
-# ``MPI_<lang>_VERSION_MAJOR``
-# Major version of MPI implemented for ``<lang>`` by the MPI distribution.
-# ``MPI_<lang>_VERSION_MINOR``
-# Minor version of MPI implemented for ``<lang>`` by the MPI distribution.
-# ``MPI_<lang>_VERSION``
-# MPI version implemented for ``<lang>`` by the MPI distribution.
-#
-# Note that there's no variable for the C bindings being accessible through ``mpi.h``, since the MPI standards
-# always have required this binding to work in both C and C++ code.
-#
-# For running MPI programs, the module sets the following variables
-#
-# ``MPIEXEC_EXECUTABLE``
-# Executable for running MPI programs, if such exists.
-# ``MPIEXEC_NUMPROC_FLAG``
-# Flag to pass to ``mpiexec`` before giving it the number of processors to run on.
-# ``MPIEXEC_MAX_NUMPROCS``
-# Number of MPI processors to utilize. Defaults to the number
-# of processors detected on the host system.
-# ``MPIEXEC_PREFLAGS``
-# Flags to pass to ``mpiexec`` directly before the executable to run.
-# ``MPIEXEC_POSTFLAGS``
-# Flags to pass to ``mpiexec`` after other flags.
-#
-# Variables for locating MPI
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# This module performs a three step search for an MPI implementation:
-#
-# 1. Check if the compiler has MPI support built-in. This is the case if the user passed a
-# compiler wrapper as ``CMAKE_<LANG>_COMPILER`` or if they're on a Cray system.
-# 2. Attempt to find an MPI compiler wrapper and determine the compiler information from it.
-# 3. Try to find an MPI implementation that does not ship such a wrapper by guessing settings.
-# Currently, only Microsoft MPI and MPICH2 on Windows are supported.
-#
-# For controlling the second step, the following variables may be set:
-#
-# ``MPI_<lang>_COMPILER``
-# Search for the specified compiler wrapper and use it.
-# ``MPI_<lang>_COMPILER_FLAGS``
-# Flags to pass to the MPI compiler wrapper during interrogation. Some compiler wrappers
-# support linking debug or tracing libraries if a specific flag is passed and this variable
-# may be used to obtain them.
-# ``MPI_COMPILER_FLAGS``
-# Used to initialize ``MPI_<lang>_COMPILER_FLAGS`` if no language specific flag has been given.
-# Empty by default.
-# ``MPI_EXECUTABLE_SUFFIX``
-# A suffix which is appended to all names that are being looked for. For instance you may set this
-# to ``.mpich`` or ``.openmpi`` to prefer the one or the other on Debian and its derivatives.
-#
-# In order to control the guessing step, the following variable may be set:
-#
-# ``MPI_GUESS_LIBRARY_NAME``
-# Valid values are ``MSMPI`` and ``MPICH2``. If set, only the given library will be searched for.
-# By default, ``MSMPI`` will be preferred over ``MPICH2`` if both are available.
-# This also sets ``MPI_SKIP_COMPILER_WRAPPER`` to ``true``, which may be overridden.
-#
-# Each of the search steps may be skipped with the following control variables:
-#
-# ``MPI_ASSUME_NO_BUILTIN_MPI``
-# If true, the module assumes that the compiler itself does not provide an MPI implementation and
-# skips to step 2.
-# ``MPI_SKIP_COMPILER_WRAPPER``
-# If true, no compiler wrapper will be searched for.
-# ``MPI_SKIP_GUESSING``
-# If true, the guessing step will be skipped.
-#
-# Additionally, the following control variable is available to change search behavior:
-#
-# ``MPI_CXX_SKIP_MPICXX``
-# Add some definitions that will disable the MPI-2 C++ bindings.
-# Currently supported are MPICH, Open MPI, Platform MPI and derivatives thereof,
-# for example MVAPICH or Intel MPI.
-#
-# If the find procedure fails for a variable ``MPI_<lang>_WORKS``, then the settings detected by or passed to
-# the module did not work and even a simple MPI test program failed to compile.
-#
-# If all of these parameters were not sufficient to find the right MPI implementation, a user may
-# disable the entire autodetection process by specifying both a list of libraries in ``MPI_<lang>_LIBRARIES``
-# and a list of include directories in ``MPI_<lang>_ADDITIONAL_INCLUDE_DIRS``.
-# Any other variable may be set in addition to these two. The module will then validate the MPI settings and store the
-# settings in the cache.
-#
-# Cache variables for MPI
-# ^^^^^^^^^^^^^^^^^^^^^^^
-#
-# The variable ``MPI_<lang>_INCLUDE_DIRS`` will be assembled from the following variables.
-# For C and CXX:
-#
-# ``MPI_<lang>_HEADER_DIR``
-# Location of the ``mpi.h`` header on disk.
-#
-# For Fortran:
-#
-# ``MPI_Fortran_F77_HEADER_DIR``
-# Location of the Fortran 77 header ``mpif.h``, if it exists.
-# ``MPI_Fortran_MODULE_DIR``
-# Location of the ``mpi`` or ``mpi_f08`` modules, if available.
-#
-# For all languages the following variables are additionally considered:
-#
-# ``MPI_<lang>_ADDITIONAL_INCLUDE_DIRS``
-# A :ref:`;-list <CMake Language Lists>` of paths needed in addition to the normal include directories.
-# ``MPI_<include_name>_INCLUDE_DIR``
-# Path variables for include folders referred to by ``<include_name>``.
-# ``MPI_<lang>_ADDITIONAL_INCLUDE_VARS``
-# A :ref:`;-list <CMake Language Lists>` of ``<include_name>`` that will be added to the include locations of ``<lang>``.
-#
-# The variable ``MPI_<lang>_LIBRARIES`` will be assembled from the following variables:
-#
-# ``MPI_<lib_name>_LIBRARY``
-# The location of a library called ``<lib_name>`` for use with MPI.
-# ``MPI_<lang>_LIB_NAMES``
-# A :ref:`;-list <CMake Language Lists>` of ``<lib_name>`` that will be added to the include locations of ``<lang>``.
-#
-# Usage of mpiexec
-# ^^^^^^^^^^^^^^^^
-#
-# When using ``MPIEXEC_EXECUTABLE`` to execute MPI applications, you should typically
-# use all of the ``MPIEXEC_EXECUTABLE`` flags as follows:
-#
-# ::
-#
-# ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS}
-# ${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS
-#
-# where ``EXECUTABLE`` is the MPI program, and ``ARGS`` are the arguments to
-# pass to the MPI program.
-#
-# Advanced variables for using MPI
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#
-# The module can perform some advanced feature detections upon explicit request.
-#
-# **Important notice:** The following checks cannot be performed without *executing* an MPI test program.
-# Consider the special considerations for the behavior of :command:`try_run` during cross compilation.
-# Moreover, running an MPI program can cause additional issues, like a firewall notification on some systems.
-# You should only enable these detections if you absolutely need the information.
-#
-# If the following variables are set to true, the respective search will be performed:
-#
-# ``MPI_DETERMINE_Fortran_CAPABILITIES``
-# Determine for all available Fortran bindings what the values of ``MPI_SUBARRAYS_SUPPORTED`` and
-# ``MPI_ASYNC_PROTECTS_NONBLOCKING`` are and make their values available as ``MPI_Fortran_<binding>_SUBARRAYS``
-# and ``MPI_Fortran_<binding>_ASYNCPROT``, where ``<binding>`` is one of ``F77_HEADER``, ``F90_MODULE`` and
-# ``F08_MODULE``.
-# ``MPI_DETERMINE_LIBRARY_VERSION``
-# For each language, find the output of ``MPI_Get_library_version`` and make it available as ``MPI_<lang>_LIBRARY_VERSION``.
-# This information is usually tied to the runtime component of an MPI implementation and might differ depending on ``<lang>``.
-# Note that the return value is entirely implementation defined. This information might be used to identify
-# the MPI vendor and for example pick the correct one of multiple third party binaries that matches the MPI vendor.
-#
-# Backward Compatibility
-# ^^^^^^^^^^^^^^^^^^^^^^
-#
-# For backward compatibility with older versions of FindMPI, these
-# variables are set, but deprecated:
-#
-# ::
-#
-# MPI_COMPILER MPI_LIBRARY MPI_EXTRA_LIBRARY
-# MPI_COMPILE_FLAGS MPI_INCLUDE_PATH MPI_LINK_FLAGS
-# MPI_LIBRARIES
-#
-# In new projects, please use the ``MPI_<lang>_XXX`` equivalents.
-# Additionally, the following variables are deprecated:
-#
-# ``MPI_<lang>_COMPILE_FLAGS``
-# Use ``MPI_<lang>_COMPILE_OPTIONS`` and ``MPI_<lang>_COMPILE_DEFINITIONS`` instead.
-# ``MPI_<lang>_INCLUDE_PATH``
-# For consumption use ``MPI_<lang>_INCLUDE_DIRS`` and for specifying folders use ``MPI_<lang>_ADDITIONAL_INCLUDE_DIRS`` instead.
-# ``MPIEXEC``
-# Use ``MPIEXEC_EXECUTABLE`` instead.
-
-cmake_policy(PUSH)
-cmake_policy(SET CMP0057 NEW) # if IN_LIST
-
-# include this to handle the QUIETLY and REQUIRED arguments
-include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
-include(GetPrerequisites)
-
-# Generic compiler names
-set(_MPI_C_GENERIC_COMPILER_NAMES mpicc mpcc mpicc_r mpcc_r)
-set(_MPI_CXX_GENERIC_COMPILER_NAMES mpicxx mpiCC mpcxx mpCC mpic++ mpc++
- mpicxx_r mpiCC_r mpcxx_r mpCC_r mpic++_r mpc++_r)
-set(_MPI_Fortran_GENERIC_COMPILER_NAMES mpif95 mpif95_r mpf95 mpf95_r
- mpif90 mpif90_r mpf90 mpf90_r
- mpif77 mpif77_r mpf77 mpf77_r
- mpifc)
-
-# GNU compiler names
-set(_MPI_GNU_C_COMPILER_NAMES mpigcc mpgcc mpigcc_r mpgcc_r)
-set(_MPI_GNU_CXX_COMPILER_NAMES mpig++ mpg++ mpig++_r mpg++_r mpigxx)
-set(_MPI_GNU_Fortran_COMPILER_NAMES mpigfortran mpgfortran mpigfortran_r mpgfortran_r
- mpig77 mpig77_r mpg77 mpg77_r)
-
-# Intel MPI compiler names on Windows
-if(WIN32)
- list(APPEND _MPI_C_GENERIC_COMPILER_NAMES mpicc.bat)
- list(APPEND _MPI_CXX_GENERIC_COMPILER_NAMES mpicxx.bat)
- list(APPEND _MPI_Fortran_GENERIC_COMPILER_NAMES mpifc.bat)
-
- # Intel MPI compiler names
- set(_MPI_Intel_C_COMPILER_NAMES mpiicc.bat)
- set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc.bat)
- set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort.bat mpif77.bat mpif90.bat)
-
- # Intel MPI compiler names for MSMPI
- set(_MPI_MSVC_C_COMPILER_NAMES mpicl.bat)
- set(_MPI_MSVC_CXX_COMPILER_NAMES mpicl.bat)
-else()
- # Intel compiler names
- set(_MPI_Intel_C_COMPILER_NAMES mpiicc)
- set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc mpiicxx mpiic++)
- set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort mpiif95 mpiif90 mpiif77)
-endif()
-
-# PGI compiler names
-set(_MPI_PGI_C_COMPILER_NAMES mpipgcc mppgcc)
-set(_MPI_PGI_CXX_COMPILER_NAMES mpipgCC mppgCC)
-set(_MPI_PGI_Fortran_COMPILER_NAMES mpipgf95 mpipgf90 mppgf95 mppgf90 mpipgf77 mppgf77)
-
-# XLC MPI Compiler names
-set(_MPI_XL_C_COMPILER_NAMES mpxlc mpxlc_r mpixlc mpixlc_r)
-set(_MPI_XL_CXX_COMPILER_NAMES mpixlcxx mpixlC mpixlc++ mpxlcxx mpxlc++ mpixlc++ mpxlCC
- mpixlcxx_r mpixlC_r mpixlc++_r mpxlcxx_r mpxlc++_r mpixlc++_r mpxlCC_r)
-set(_MPI_XL_Fortran_COMPILER_NAMES mpixlf95 mpixlf95_r mpxlf95 mpxlf95_r
- mpixlf90 mpixlf90_r mpxlf90 mpxlf90_r
- mpixlf77 mpixlf77_r mpxlf77 mpxlf77_r
- mpixlf mpixlf_r mpxlf mpxlf_r)
-
-# Prepend vendor-specific compiler wrappers to the list. If we don't know the compiler,
-# attempt all of them.
-# By attempting vendor-specific compiler names first, we should avoid situations where the compiler wrapper
-# stems from a proprietary MPI and won't know which compiler it's being used for. For instance, Intel MPI
-# controls its settings via the I_MPI_CC environment variables if the generic name is being used.
-# If we know which compiler we're working with, we can use the most specialized wrapper there is in order to
-# pick up the right settings for it.
-foreach (LANG IN ITEMS C CXX Fortran)
- set(_MPI_${LANG}_COMPILER_NAMES "")
- foreach (id IN ITEMS GNU Intel MSVC PGI XL)
- if (NOT CMAKE_${LANG}_COMPILER_ID OR CMAKE_${LANG}_COMPILER_ID STREQUAL id)
- list(APPEND _MPI_${LANG}_COMPILER_NAMES ${_MPI_${id}_${LANG}_COMPILER_NAMES}${MPI_EXECUTABLE_SUFFIX})
- endif()
- unset(_MPI_${id}_${LANG}_COMPILER_NAMES)
- endforeach()
- list(APPEND _MPI_${LANG}_COMPILER_NAMES ${_MPI_${LANG}_GENERIC_COMPILER_NAMES}${MPI_EXECUTABLE_SUFFIX})
- unset(_MPI_${LANG}_GENERIC_COMPILER_NAMES)
-endforeach()
-
-# Names to try for mpiexec
-# Only mpiexec commands are guaranteed to behave as described in the standard,
-# mpirun commands are not covered by the standard in any way whatsoever.
-# lamexec is the executable for LAM/MPI, srun is for SLURM or Open MPI with SLURM support.
-# srun -n X <executable> is however a valid command, so it behaves 'like' mpiexec.
-set(_MPIEXEC_NAMES_BASE mpiexec mpiexec.hydra mpiexec.mpd mpirun lamexec srun)
-
-unset(_MPIEXEC_NAMES)
-foreach(_MPIEXEC_NAME IN LISTS _MPIEXEC_NAMES_BASE)
- list(APPEND _MPIEXEC_NAMES "${_MPIEXEC_NAME}${MPI_EXECUTABLE_SUFFIX}")
-endforeach()
-unset(_MPIEXEC_NAMES_BASE)
-
-function (_MPI_check_compiler LANG QUERY_FLAG OUTPUT_VARIABLE RESULT_VARIABLE)
- if(DEFINED MPI_${LANG}_COMPILER_FLAGS)
- separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS NATIVE_COMMAND "${MPI_${LANG}_COMPILER_FLAGS}")
- else()
- separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS NATIVE_COMMAND "${MPI_COMPILER_FLAGS}")
- endif()
- execute_process(
- COMMAND ${MPI_${LANG}_COMPILER} ${_MPI_COMPILER_WRAPPER_OPTIONS} ${QUERY_FLAG}
- OUTPUT_VARIABLE WRAPPER_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_VARIABLE WRAPPER_OUTPUT ERROR_STRIP_TRAILING_WHITESPACE
- RESULT_VARIABLE WRAPPER_RETURN)
- # Some compiler wrappers will yield spurious zero return values, for example
- # Intel MPI tolerates unknown arguments and if the MPI wrappers loads a shared
- # library that has invalid or missing version information there would be warning
- # messages emitted by ld.so in the compiler output. In either case, we'll treat
- # the output as invalid.
- if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available|command not found")
- set(WRAPPER_RETURN 255)
- endif()
- # Ensure that no error output might be passed upwards.
- if(NOT WRAPPER_RETURN EQUAL 0)
- unset(WRAPPER_OUTPUT)
- endif()
- set(${OUTPUT_VARIABLE} "${WRAPPER_OUTPUT}" PARENT_SCOPE)
- set(${RESULT_VARIABLE} "${WRAPPER_RETURN}" PARENT_SCOPE)
-endfunction()
-
-function (_MPI_interrogate_compiler lang)
- unset(MPI_COMPILE_CMDLINE)
- unset(MPI_LINK_CMDLINE)
-
- unset(MPI_COMPILE_OPTIONS_WORK)
- unset(MPI_COMPILE_DEFINITIONS_WORK)
- unset(MPI_INCLUDE_DIRS_WORK)
- unset(MPI_LINK_FLAGS_WORK)
- unset(MPI_LIB_NAMES_WORK)
- unset(MPI_LIB_FULLPATHS_WORK)
-
- # Check whether the -showme:compile option works. This indicates that we have either Open MPI
- # or a newer version of LAM/MPI, and implies that -showme:link will also work.
- # Open MPI also supports -show, but separates linker and compiler information
- _MPI_check_compiler(${LANG} "-showme:compile" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN)
- if (MPI_COMPILER_RETURN EQUAL 0)
- _MPI_check_compiler(${LANG} "-showme:link" MPI_LINK_CMDLINE MPI_COMPILER_RETURN)
-
- if (NOT MPI_COMPILER_RETURN EQUAL 0)
- unset(MPI_COMPILE_CMDLINE)
- endif()
- endif()
-
- # MPICH and MVAPICH offer -compile-info and -link-info.
- # For modern versions, both do the same as -show. However, for old versions, they do differ
- # when called for mpicxx and mpif90 and it's necessary to use them over -show in order to find the
- # removed MPI C++ bindings.
- if (NOT MPI_COMPILER_RETURN EQUAL 0)
- _MPI_check_compiler(${LANG} "-compile-info" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN)
-
- if (MPI_COMPILER_RETURN EQUAL 0)
- _MPI_check_compiler(${LANG} "-link-info" MPI_LINK_CMDLINE MPI_COMPILER_RETURN)
-
- if (NOT MPI_COMPILER_RETURN EQUAL 0)
- unset(MPI_COMPILE_CMDLINE)
- endif()
- endif()
- endif()
-
- # MPICH, MVAPICH2 and Intel MPI just use "-show". Open MPI also offers this, but the
- # -showme commands are more specialized.
- if (NOT MPI_COMPILER_RETURN EQUAL 0)
- _MPI_check_compiler(${LANG} "-show" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN)
- endif()
-
- # Older versions of LAM/MPI have "-showme". Open MPI also supports this.
- # Unknown to MPICH, MVAPICH and Intel MPI.
- if (NOT MPI_COMPILER_RETURN EQUAL 0)
- _MPI_check_compiler(${LANG} "-showme" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN)
- endif()
-
- if (NOT (MPI_COMPILER_RETURN EQUAL 0) OR NOT (DEFINED MPI_COMPILE_CMDLINE))
- # Cannot interrogate this compiler, so exit.
- set(MPI_${LANG}_WRAPPER_FOUND FALSE PARENT_SCOPE)
- return()
- endif()
- unset(MPI_COMPILER_RETURN)
-
- # We have our command lines, but we might need to copy MPI_COMPILE_CMDLINE
- # into MPI_LINK_CMDLINE, if we didn't find the link line.
- if (NOT DEFINED MPI_LINK_CMDLINE)
- set(MPI_LINK_CMDLINE "${MPI_COMPILE_CMDLINE}")
- endif()
-
- # At this point, we obtained some output from a compiler wrapper that works.
- # We'll now try to parse it into variables with meaning to us.
- if("${LANG}" STREQUAL "Fortran")
- # Some MPICH-1 and MVAPICH-1 versions return a three command answer for Fortran, consisting
- # out of a symlink command for mpif.h, the actual compiler command and a deletion of the
- # created symlink. We need to detect that case, remember the include path and drop the
- # symlink/deletion operation to obtain the link/compile lines we'd usually expect.
- if("${MPI_COMPILE_CMDLINE}" MATCHES "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h")
- get_filename_component(MPI_INCLUDE_DIRS_WORK "${CMAKE_MATCH_1}" DIRECTORY)
- string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}")
- string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}")
- string(REGEX REPLACE "\nrm -f mpif.h$" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}")
- string(REGEX REPLACE "\nrm -f mpif.h$" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}")
- endif()
- endif()
-
- # The Intel MPI wrapper on Linux will emit some objcopy commands after its compile command
- # if -static_mpi was passed to the wrapper. To avoid spurious matches, we need to drop these lines.
- if(UNIX)
- string(REGEX REPLACE "(^|\n)objcopy[^\n]+(\n|$)" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}")
- string(REGEX REPLACE "(^|\n)objcopy[^\n]+(\n|$)" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}")
- endif()
-
- # Extract compile options from the compile command line.
- string(REGEX MATCHALL "(^| )-f([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_OPTIONS "${MPI_COMPILE_CMDLINE}")
-
- foreach(_MPI_COMPILE_OPTION IN LISTS MPI_ALL_COMPILE_OPTIONS)
- string(REGEX REPLACE "^ " "" _MPI_COMPILE_OPTION "${_MPI_COMPILE_OPTION}")
- # Ignore -fstack-protector directives: These occur on MPICH and MVAPICH when the libraries
- # themselves were built with this flag. However, this flag is unrelated to using MPI, and
- # we won't match the accompanying --param-ssp-size and -Wp,-D_FORTIFY_SOURCE flags and therefore
- # produce inconsistent results with the regularly flags.
- # Similarly, aliasing flags do not belong into our flag array.
- if(NOT "${_MPI_COMPILE_OPTION}" MATCHES "^-f(stack-protector|(no-|)strict-aliasing|PI[CE]|pi[ce])")
- list(APPEND MPI_COMPILE_OPTIONS_WORK "${_MPI_COMPILE_OPTION}")
- endif()
- endforeach()
-
- # Same deal, with the definitions. We also treat arguments passed to the preprocessor directly.
- string(REGEX MATCHALL "(^| )(-Wp,|-Xpreprocessor |)[-/]D([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_DEFINITIONS "${MPI_COMPILE_CMDLINE}")
-
- foreach(_MPI_COMPILE_DEFINITION IN LISTS MPI_ALL_COMPILE_DEFINITIONS)
- string(REGEX REPLACE "^ ?(-Wp,|-Xpreprocessor )?[-/]D" "" _MPI_COMPILE_DEFINITION "${_MPI_COMPILE_DEFINITION}")
- string(REPLACE "\"" "" _MPI_COMPILE_DEFINITION "${_MPI_COMPILE_DEFINITION}")
- if(NOT "${_MPI_COMPILE_DEFINITION}" MATCHES "^_FORTIFY_SOURCE.*")
- list(APPEND MPI_COMPILE_DEFINITIONS_WORK "${_MPI_COMPILE_DEFINITION}")
- endif()
- endforeach()
-
- # Extract include paths from compile command line
- string(REGEX MATCHALL "(^| )[-/]I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}")
-
- # If extracting failed to work, we'll try using -showme:incdirs.
- if (NOT MPI_ALL_INCLUDE_PATHS)
- _MPI_check_compiler(${LANG} "-showme:incdirs" MPI_INCDIRS_CMDLINE MPI_INCDIRS_COMPILER_RETURN)
- if(MPI_INCDIRS_COMPILER_RETURN)
- separate_arguments(MPI_ALL_INCLUDE_PATHS NATIVE_COMMAND "${MPI_INCDIRS_CMDLINE}")
- endif()
- endif()
-
- foreach(_MPI_INCLUDE_PATH IN LISTS MPI_ALL_INCLUDE_PATHS)
- string(REGEX REPLACE "^ ?[-/]I" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}")
- string(REPLACE "\"" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}")
- get_filename_component(_MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}" REALPATH)
- list(APPEND MPI_INCLUDE_DIRS_WORK "${_MPI_INCLUDE_PATH}")
- endforeach()
-
- # Extract linker paths from the link command line
- string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker |)(-L|[/-]LIBPATH:|[/-]libpath:)([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}")
-
- # If extracting failed to work, we'll try using -showme:libdirs.
- if (NOT MPI_ALL_LINK_PATHS)
- _MPI_check_compiler(${LANG} "-showme:libdirs" MPI_LIBDIRS_CMDLINE MPI_LIBDIRS_COMPILER_RETURN)
- if(MPI_LIBDIRS_COMPILER_RETURN)
- separate_arguments(MPI_ALL_LINK_PATHS NATIVE_COMMAND "${MPI_LIBDIRS_CMDLINE}")
- endif()
- endif()
-
- foreach(_MPI_LPATH IN LISTS MPI_ALL_LINK_PATHS)
- string(REGEX REPLACE "^ ?(-Wl,|-Xlinker )?(-L|[/-]LIBPATH:|[/-]libpath:)" "" _MPI_LPATH "${_MPI_LPATH}")
- string(REPLACE "\"" "" _MPI_LPATH "${_MPI_LPATH}")
- get_filename_component(_MPI_LPATH "${_MPI_LPATH}" REALPATH)
- list(APPEND MPI_LINK_DIRECTORIES_WORK "${_MPI_LPATH}")
- endforeach()
-
- # Extract linker flags from the link command line
- string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker )([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")
-
- foreach(_MPI_LINK_FLAG IN LISTS MPI_ALL_LINK_FLAGS)
- string(STRIP "${_MPI_LINK_FLAG}" _MPI_LINK_FLAG)
- # MPI might be marked to build with non-executable stacks but this should not propagate.
- if (NOT "${_MPI_LINK_FLAG}" MATCHES "(-Wl,|-Xlinker )-z,noexecstack")
- if (MPI_LINK_FLAGS_WORK)
- string(APPEND MPI_LINK_FLAGS_WORK " ${_MPI_LINK_FLAG}")
- else()
- set(MPI_LINK_FLAGS_WORK "${_MPI_LINK_FLAG}")
- endif()
- endif()
- endforeach()
-
- # Extract the set of libraries to link against from the link command
- # line
- string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
-
- foreach(_MPI_LIB_NAME IN LISTS MPI_LIBNAMES)
- string(REGEX REPLACE "^ ?-l" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}")
- string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}")
- get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY)
- if(NOT "${_MPI_LIB_PATH}" STREQUAL "")
- list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}")
- else()
- list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}")
- endif()
- endforeach()
-
- if(WIN32)
- # A compiler wrapper on Windows will just have the name of the
- # library to link on its link line, potentially with a full path
- string(REGEX MATCHALL "(^| )([^\" ]+\\.lib|\"[^\"]+\\.lib\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
- foreach(_MPI_LIB_NAME IN LISTS MPI_LIBNAMES)
- string(REGEX REPLACE "^ " "" _MPI_LIB_NAME "${_MPI_LIB_NAME}")
- string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}")
- get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY)
- if(NOT "${_MPI_LIB_PATH}" STREQUAL "")
- list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}")
- else()
- list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}")
- endif()
- endforeach()
- else()
- # On UNIX platforms, archive libraries can be given with full path.
- string(REGEX MATCHALL "(^| )([^\" ]+\\.a|\"[^\"]+\\.a\")" MPI_LIBFULLPATHS "${MPI_LINK_CMDLINE}")
- foreach(_MPI_LIB_NAME IN LISTS MPI_LIBFULLPATHS)
- string(REGEX REPLACE "^ " "" _MPI_LIB_NAME "${_MPI_LIB_NAME}")
- string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}")
- get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY)
- if(NOT "${_MPI_LIB_PATH}" STREQUAL "")
- list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}")
- else()
- list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}")
- endif()
- endforeach()
- endif()
-
- # An MPI compiler wrapper could have its MPI libraries in the implictly
- # linked directories of the compiler itself.
- if(DEFINED CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES)
- list(APPEND MPI_LINK_DIRECTORIES_WORK "${CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES}")
- endif()
-
- # Determine full path names for all of the libraries that one needs
- # to link against in an MPI program
- unset(MPI_PLAIN_LIB_NAMES_WORK)
- foreach(_MPI_LIB_NAME IN LISTS MPI_LIB_NAMES_WORK)
- get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB_NAME}" NAME_WE)
- list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}")
- find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY
- NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}"
- HINTS ${MPI_LINK_DIRECTORIES_WORK}
- DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI"
- )
- mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY)
- endforeach()
-
- # Deal with the libraries given with full path next
- unset(MPI_DIRECT_LIB_NAMES_WORK)
- foreach(_MPI_LIB_FULLPATH IN LISTS MPI_LIB_FULLPATHS_WORK)
- get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB_FULLPATH}" NAME_WE)
- get_filename_component(_MPI_LIB_NAME "${_MPI_LIB_FULLPATH}" NAME)
- get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_FULLPATH}" DIRECTORY)
- list(APPEND MPI_DIRECT_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}")
- find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY
- NAMES "${_MPI_LIB_NAME}"
- HINTS ${_MPI_LIB_PATH}
- DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI"
- )
- mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY)
- endforeach()
- if(MPI_DIRECT_LIB_NAMES_WORK)
- set(MPI_PLAIN_LIB_NAMES_WORK "${MPI_DIRECT_LIB_NAMES_WORK};${MPI_PLAIN_LIB_NAMES_WORK}")
- endif()
-
- # MPI might require pthread to work. The above mechanism wouldn't detect it, but we need to
- # link it in that case. -lpthread is covered by the normal library treatment on the other hand.
- if("${MPI_COMPILE_CMDLINE}" MATCHES "-pthread")
- list(APPEND MPI_COMPILE_OPTIONS_WORK "-pthread")
- if(MPI_LINK_FLAGS_WORK)
- string(APPEND MPI_LINK_FLAGS_WORK " -pthread")
- else()
- set(MPI_LINK_FLAGS_WORK "-pthread")
- endif()
- endif()
-
- if(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS)
- list(APPEND MPI_COMPILE_DEFINITIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS}")
- endif()
- if(MPI_${LANG}_EXTRA_COMPILE_OPTIONS)
- list(APPEND MPI_COMPILE_OPTIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_OPTIONS}")
- endif()
- if(MPI_${LANG}_EXTRA_LIB_NAMES)
- list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${MPI_${LANG}_EXTRA_LIB_NAMES}")
- endif()
-
- # If we found MPI, set up all of the appropriate cache entries
- if(NOT MPI_${LANG}_COMPILE_OPTIONS)
- set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_COMPILE_OPTIONS_WORK} CACHE STRING "MPI ${LANG} compilation options" FORCE)
- endif()
- if(NOT MPI_${LANG}_COMPILE_DEFINITIONS)
- set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_COMPILE_DEFINITIONS_WORK} CACHE STRING "MPI ${LANG} compilation definitions" FORCE)
- endif()
- if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)
- set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_INCLUDE_DIRS_WORK} CACHE STRING "MPI ${LANG} additional include directories" FORCE)
- endif()
- if(NOT MPI_${LANG}_LINK_FLAGS)
- set(MPI_${LANG}_LINK_FLAGS ${MPI_LINK_FLAGS_WORK} CACHE STRING "MPI ${LANG} linker flags" FORCE)
- endif()
- if(NOT MPI_${LANG}_LIB_NAMES)
- set(MPI_${LANG}_LIB_NAMES ${MPI_PLAIN_LIB_NAMES_WORK} CACHE STRING "MPI ${LANG} libraries to link against" FORCE)
- endif()
- set(MPI_${LANG}_WRAPPER_FOUND TRUE PARENT_SCOPE)
-endfunction()
-
-function(_MPI_guess_settings LANG)
- set(MPI_GUESS_FOUND FALSE)
- # Currently only MSMPI and MPICH2 on Windows are supported, so we can skip this search if we're not targeting that.
- if(WIN32)
- # MSMPI
-
- # The environment variables MSMPI_INC and MSMPILIB32/64 are the only ways of locating the MSMPI_SDK,
- # which is installed separately from the runtime. Thus it's possible to have mpiexec but not MPI headers
- # or import libraries and vice versa.
- if(NOT MPI_GUESS_LIBRARY_NAME OR "${MPI_GUESS_LIBRARY_NAME}" STREQUAL "MSMPI")
- # We first attempt to locate the msmpi.lib. Should be find it, we'll assume that the MPI present is indeed
- # Microsoft MPI.
- if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
- set(MPI_MSMPI_LIB_PATH "$ENV{MSMPI_LIB64}")
- set(MPI_MSMPI_INC_PATH_EXTRA "$ENV{MSMPI_INC}/x64")
- else()
- set(MPI_MSMPI_LIB_PATH "$ENV{MSMPI_LIB32}")
- set(MPI_MSMPI_INC_PATH_EXTRA "$ENV{MSMPI_INC}/x86")
- endif()
-
- find_library(MPI_msmpi_LIBRARY
- NAMES msmpi
- HINTS ${MPI_MSMPI_LIB_PATH}
- DOC "Location of the msmpi library for Microsoft MPI")
- mark_as_advanced(MPI_msmpi_LIBRARY)
-
- if(MPI_msmpi_LIBRARY)
- # Next, we attempt to locate the MPI header. Note that for Fortran we know that mpif.h is a way
- # MSMPI can be used and therefore that header has to be present.
- if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)
- get_filename_component(MPI_MSMPI_INC_DIR "$ENV{MSMPI_INC}" REALPATH)
- set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_MSMPI_INC_DIR}" CACHE STRING "MPI ${LANG} additional include directories" FORCE)
- unset(MPI_MSMPI_INC_DIR)
- endif()
-
- # For MSMPI, one can compile the MPI module by building the mpi.f90 shipped with the MSMPI SDK,
- # thus it might be present or provided by the user. Figuring out which is supported is done later on.
- # The PGI Fortran compiler for instance ships a prebuilt set of modules in its own include folder.
- # Should a user be employing PGI or have built its own set and provided it via cache variables, the
- # splitting routine would have located the module files.
-
- # For C and C++, we're done here (MSMPI does not ship the MPI-2 C++ bindings) - however, for Fortran
- # we need some extra library to glue Fortran support together:
- # MSMPI ships 2-4 Fortran libraries, each for different Fortran compiler behaviors. The library names
- # ending with a c are using the cdecl calling convention, whereas those ending with an s are for Fortran
- # implementations using stdcall. Therefore, the 64-bit MSMPI only ships those ending in 'c', whereas the 32-bit
- # has both variants available.
- # The second difference is the last but one letter, if it's an e(nd), the length of a string argument is
- # passed by the Fortran compiler after all other arguments on the parameter list, if it's an m(ixed),
- # it's passed immediately after the string address.
-
- # To summarize:
- # - msmpifec: CHARACTER length passed after the parameter list and using cdecl calling convention
- # - msmpifmc: CHARACTER length passed directly after string address and using cdecl calling convention
- # - msmpifes: CHARACTER length passed after the parameter list and using stdcall calling convention
- # - msmpifms: CHARACTER length passed directly after string address and using stdcall calling convention
- # 32-bit MSMPI ships all four libraries, 64-bit MSMPI ships only the first two.
-
- # As is, Intel Fortran and PGI Fortran both use the 'ec' variant of the calling convention, whereas
- # the old Compaq Visual Fortran compiler defaulted to the 'ms' version. It's possible to make Intel Fortran
- # use the CVF calling convention using /iface:cvf, but we assume - and this is also assumed in FortranCInterface -
- # this isn't the case. It's also possible to make CVF use the 'ec' variant, using /iface=(cref,nomixed_str_len_arg).
-
- # Our strategy is now to locate all libraries, but enter msmpifec into the LIB_NAMES array.
- # Should this not be adequate it's a straightforward way for a user to change the LIB_NAMES array and
- # have his library found. Still, this should not be necessary outside of exceptional cases, as reasoned.
- if ("${LANG}" STREQUAL "Fortran")
- set(MPI_MSMPI_CALLINGCONVS c)
- if("${CMAKE_SIZEOF_VOID_P}" EQUAL 4)
- list(APPEND MPI_MSMPI_CALLINGCONVS s)
- endif()
- foreach(mpistrlenpos IN ITEMS e m)
- foreach(mpicallingconv IN LISTS MPI_MSMPI_CALLINGCONVS)
- find_library(MPI_msmpif${mpistrlenpos}${mpicallingconv}_LIBRARY
- NAMES msmpif${mpistrlenpos}${mpicallingconv}
- HINTS "${MPI_MSMPI_LIB_PATH}"
- DOC "Location of the msmpi${mpistrlenpos}${mpicallingconv} library for Microsoft MPI")
- mark_as_advanced(MPI_msmpif${mpistrlenpos}${mpicallingconv}_LIBRARY)
- endforeach()
- endforeach()
- if(NOT MPI_${LANG}_LIB_NAMES)
- set(MPI_${LANG}_LIB_NAMES "msmpi;msmpifec" CACHE STRING "MPI ${LANG} libraries to link against" FORCE)
- endif()
-
- # At this point we're *not* done. MSMPI requires an additional include file for Fortran giving the value
- # of MPI_AINT. This file is called mpifptr.h located in the x64 and x86 subfolders, respectively.
- find_path(MPI_mpifptr_INCLUDE_DIR
- NAMES "mpifptr.h"
- HINTS "${MPI_MSMPI_INC_PATH_EXTRA}"
- DOC "Location of the mpifptr.h extra header for Microsoft MPI")
- if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_VARS)
- set(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS "mpifptr" CACHE STRING "MPI ${LANG} additional include directory variables, given in the form MPI_<name>_INCLUDE_DIR." FORCE)
- endif()
- mark_as_advanced(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS MPI_mpifptr_INCLUDE_DIR)
- else()
- if(NOT MPI_${LANG}_LIB_NAMES)
- set(MPI_${LANG}_LIB_NAMES "msmpi" CACHE STRING "MPI ${LANG} libraries to link against" FORCE)
- endif()
- endif()
- mark_as_advanced(MPI_${LANG}_LIB_NAMES)
- set(MPI_GUESS_FOUND TRUE)
- endif()
- endif()
-
- # At this point there's not many MPIs that we could still consider.
- # OpenMPI 1.6.x and below supported Windows, but these ship compiler wrappers that still work.
- # The only other relevant MPI implementation without a wrapper is MPICH2, which had Windows support in 1.4.1p1 and older.
- if(NOT MPI_GUESS_LIBRARY_NAME OR "${MPI_GUESS_LIBRARY_NAME}" STREQUAL "MPICH2")
- set(MPI_MPICH_PREFIX_PATHS
- "$ENV{ProgramW6432}/MPICH2/lib"
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]/../lib"
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH2;Path]/lib"
- )
-
- # All of C, C++ and Fortran will need mpi.lib, so we'll look for this first
- find_library(MPI_mpi_LIBRARY
- NAMES mpi
- HINTS ${MPI_MPICH_PREFIX_PATHS})
- mark_as_advanced(MPI_mpi_LIBRARY)
- # If we found mpi.lib, we detect the rest of MPICH2
- if(MPI_mpi_LIBRARY)
- set(MPI_MPICH_LIB_NAMES "mpi")
- # If MPI-2 C++ bindings are requested, we need to locate cxx.lib as well.
- # Otherwise, MPICH_SKIP_MPICXX will be defined and these bindings aren't needed.
- if("${LANG}" STREQUAL "CXX" AND NOT MPI_CXX_SKIP_MPICXX)
- find_library(MPI_cxx_LIBRARY
- NAMES cxx
- HINTS ${MPI_MPICH_PREFIX_PATHS})
- mark_as_advanced(MPI_cxx_LIBRARY)
- list(APPEND MPI_MPICH_LIB_NAMES "cxx")
- # For Fortran, MPICH2 provides three different libraries:
- # fmpich2.lib which uses uppercase symbols and cdecl,
- # fmpich2s.lib which uses uppercase symbols and stdcall (32-bit only),
- # fmpich2g.lib which uses lowercase symbols with double underscores and cdecl.
- # fmpich2s.lib would be useful for Compaq Visual Fortran, fmpich2g.lib has to be used with GNU g77 and is also
- # provided in the form of an .a archive for MinGW and Cygwin. From our perspective, fmpich2.lib is the only one
- # we need to try, and if it doesn't work with the given Fortran compiler we'd find out later on during validation
- elseif("${LANG}" STREQUAL "Fortran")
- find_library(MPI_fmpich2_LIBRARY
- NAMES fmpich2
- HINTS ${MPI_MPICH_PREFIX_PATHS})
- find_library(MPI_fmpich2s_LIBRARY
- NAMES fmpich2s
- HINTS ${MPI_MPICH_PREFIX_PATHS})
- find_library(MPI_fmpich2g_LIBRARY
- NAMES fmpich2g
- HINTS ${MPI_MPICH_PREFIX_PATHS})
- mark_as_advanced(MPI_fmpich2_LIBRARY MPI_fmpich2s_LIBRARY MPI_fmpich2g_LIBRARY)
- list(APPEND MPI_MPICH_LIB_NAMES "fmpich2")
- endif()
-
- if(NOT MPI_${LANG}_LIB_NAMES)
- set(MPI_${LANG}_LIB_NAMES "${MPI_MPICH_LIB_NAMES}" CACHE STRING "MPI ${LANG} libraries to link against" FORCE)
- endif()
- unset(MPI_MPICH_LIB_NAMES)
-
- if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)
- # For MPICH2, the include folder would be in ../include relative to the library folder.
- get_filename_component(MPI_MPICH_ROOT_DIR "${MPI_mpi_LIBRARY}" DIRECTORY)
- get_filename_component(MPI_MPICH_ROOT_DIR "${MPI_MPICH_ROOT_DIR}" DIRECTORY)
- if(IS_DIRECTORY "${MPI_MPICH_ROOT_DIR}/include")
- set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_MPICH_ROOT_DIR}/include" CACHE STRING "MPI ${LANG} additional include directory variables, given in the form MPI_<name>_INCLUDE_DIR." FORCE)
- endif()
- unset(MPI_MPICH_ROOT_DIR)
- endif()
- set(MPI_GUESS_FOUND TRUE)
- endif()
- unset(MPI_MPICH_PREFIX_PATHS)
- endif()
- endif()
- set(MPI_${LANG}_GUESS_FOUND "${MPI_GUESS_FOUND}" PARENT_SCOPE)
-endfunction()
-
-function(_MPI_adjust_compile_definitions LANG)
- if("${LANG}" STREQUAL "CXX")
- # To disable the C++ bindings, we need to pass some definitions since the mpi.h header has to deal with both C and C++
- # bindings in MPI-2.
- if(MPI_CXX_SKIP_MPICXX AND NOT MPI_${LANG}_COMPILE_DEFINITIONS MATCHES "SKIP_MPICXX")
- # MPICH_SKIP_MPICXX is being used in MPICH and derivatives like MVAPICH or Intel MPI
- # OMPI_SKIP_MPICXX is being used in Open MPI
- # _MPICC_H is being used for IBM Platform MPI
- list(APPEND MPI_${LANG}_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX" "OMPI_SKIP_MPICXX" "_MPICC_H")
- set(MPI_${LANG}_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}" CACHE STRING "MPI ${LANG} compilation definitions" FORCE)
- endif()
- endif()
-endfunction()
-
-macro(_MPI_assemble_libraries LANG)
- set(MPI_${LANG}_LIBRARIES "")
- # Only for libraries do we need to check whether the compiler's linking stage is separate.
- if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS_IMPLICIT)
- foreach(mpilib IN LISTS MPI_${LANG}_LIB_NAMES)
- list(APPEND MPI_${LANG}_LIBRARIES ${MPI_${mpilib}_LIBRARY})
- endforeach()
- endif()
-endmacro()
-
-macro(_MPI_assemble_include_dirs LANG)
- if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}")
- set(MPI_${LANG}_INCLUDE_DIRS "")
- else()
- set(MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}")
- if("${LANG}" MATCHES "(C|CXX)")
- if(MPI_${LANG}_HEADER_DIR)
- list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}")
- endif()
- else() # Fortran
- if(MPI_${LANG}_F77_HEADER_DIR)
- list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}")
- endif()
- if(MPI_${LANG}_MODULE_DIR AND NOT "${MPI_${LANG}_MODULE_DIR}" IN_LIST MPI_${LANG}_INCLUDE_DIRS)
- list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}")
- endif()
- endif()
- if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS)
- foreach(MPI_ADDITIONAL_INC_DIR IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS)
- list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${MPI_ADDITIONAL_INC_DIR}_INCLUDE_DIR}")
- endforeach()
- endif()
- endif()
-endmacro()
-
-function(_MPI_split_include_dirs LANG)
- if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}")
- return()
- endif()
- # Backwards compatibility: Search INCLUDE_PATH if given.
- if(MPI_${LANG}_INCLUDE_PATH)
- list(APPEND MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_INCLUDE_PATH}")
- endif()
-
- # We try to find the headers/modules among those paths (and system paths)
- # For C/C++, we just need to have a look for mpi.h.
- if("${LANG}" MATCHES "(C|CXX)")
- find_path(MPI_${LANG}_HEADER_DIR "mpi.h"
- HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}
- )
- mark_as_advanced(MPI_${LANG}_HEADER_DIR)
- if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)
- list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}")
- endif()
- # Fortran is more complicated here: An implementation could provide
- # any of the Fortran 77/90/2008 APIs for MPI. For example, MSMPI
- # only provides Fortran 77 and - if mpi.f90 is built - potentially
- # a Fortran 90 module.
- elseif("${LANG}" STREQUAL "Fortran")
- find_path(MPI_${LANG}_F77_HEADER_DIR "mpif.h"
- HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}
- )
- find_path(MPI_${LANG}_MODULE_DIR
- NAMES "mpi.mod" "mpi_f08.mod"
- HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}
- )
- if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)
- list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS
- "${MPI_${LANG}_F77_HEADER_DIR}"
- "${MPI_${LANG}_MODULE_DIR}"
- )
- endif()
- mark_as_advanced(MPI_${LANG}_F77_HEADER_DIR MPI_${LANG}_MODULE_DIR)
- endif()
- # Remove duplicates and default system directories from the list.
- if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)
- list(REMOVE_DUPLICATES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)
- foreach(MPI_IMPLICIT_INC_DIR IN LISTS CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES)
- list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_IMPLICIT_INC_DIR})
- endforeach()
- endif()
- set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories" FORCE)
-endfunction()
-
-macro(_MPI_create_imported_target LANG)
- if(NOT TARGET MPI::MPI_${LANG})
- add_library(MPI::MPI_${LANG} INTERFACE IMPORTED)
- endif()
-
- set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_OPTIONS "${MPI_${LANG}_COMPILE_OPTIONS}")
- set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}")
-
- set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_LIBRARIES "")
- if(MPI_${LANG}_LINK_FLAGS)
- set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${MPI_${LANG}_LINK_FLAGS}")
- endif()
- # If the compiler links MPI implicitly, no libraries will be found as they're contained within
- # CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES already.
- if(MPI_${LANG}_LIBRARIES)
- set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${MPI_${LANG}_LIBRARIES}")
- endif()
- # Given the new design of FindMPI, INCLUDE_DIRS will always be located, even under implicit linking.
- set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${MPI_${LANG}_INCLUDE_DIRS}")
-endmacro()
-
-function(_MPI_try_staged_settings LANG MPI_TEST_FILE_NAME MODE RUN_BINARY)
- set(WORK_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI")
- set(SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/FindMPI")
- set(BIN_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI/${MPI_TEST_FILE_NAME}_${LANG}.bin")
- unset(MPI_TEST_COMPILE_DEFINITIONS)
- if("${LANG}" STREQUAL "Fortran")
- if("${MODE}" STREQUAL "F90_MODULE")
- set(MPI_Fortran_INCLUDE_LINE "use mpi\n implicit none")
- elseif("${MODE}" STREQUAL "F08_MODULE")
- set(MPI_Fortran_INCLUDE_LINE "use mpi_f08\n implicit none")
- else() # F77 header
- set(MPI_Fortran_INCLUDE_LINE "implicit none\n include 'mpif.h'")
- endif()
- configure_file("${SRC_DIR}/${MPI_TEST_FILE_NAME}.f90.in" "${WORK_DIR}/${MPI_TEST_FILE_NAME}.f90" @ONLY)
- set(MPI_TEST_SOURCE_FILE "${WORK_DIR}/${MPI_TEST_FILE_NAME}.f90")
- elseif("${LANG}" STREQUAL "CXX")
- configure_file("${SRC_DIR}/${MPI_TEST_FILE_NAME}.c" "${WORK_DIR}/${MPI_TEST_FILE_NAME}.cpp" COPYONLY)
- set(MPI_TEST_SOURCE_FILE "${WORK_DIR}/${MPI_TEST_FILE_NAME}.cpp")
- if("${MODE}" STREQUAL "TEST_MPICXX")
- set(MPI_TEST_COMPILE_DEFINITIONS TEST_MPI_MPICXX)
- endif()
- else() # C
- set(MPI_TEST_SOURCE_FILE "${SRC_DIR}/${MPI_TEST_FILE_NAME}.c")
- endif()
- if(RUN_BINARY)
- try_run(MPI_RUN_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} MPI_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}
- "${CMAKE_BINARY_DIR}" SOURCES "${MPI_TEST_SOURCE_FILE}"
- COMPILE_DEFINITIONS ${MPI_TEST_COMPILE_DEFINITIONS}
- LINK_LIBRARIES MPI::MPI_${LANG}
- RUN_OUTPUT_VARIABLE MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE})
- set(MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} "${MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}}" PARENT_SCOPE)
- else()
- try_compile(MPI_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}
- "${CMAKE_BINARY_DIR}" SOURCES "${MPI_TEST_SOURCE_FILE}"
- COMPILE_DEFINITIONS ${MPI_TEST_COMPILE_DEFINITIONS}
- LINK_LIBRARIES MPI::MPI_${LANG}
- COPY_FILE "${BIN_FILE}")
- endif()
-endfunction()
-
-macro(_MPI_check_lang_works LANG)
- # For Fortran we may have by the MPI-3 standard an implementation that provides:
- # - the mpi_f08 module
- # - *both*, the mpi module and 'mpif.h'
- # Since older MPI standards (MPI-1) did not define anything but 'mpif.h', we need to check all three individually.
- if( NOT MPI_${LANG}_WORKS )
- if("${LANG}" STREQUAL "Fortran")
- set(MPI_Fortran_INTEGER_LINE "(kind=MPI_INTEGER_KIND)")
- _MPI_try_staged_settings(${LANG} test_mpi F77_HEADER FALSE)
- _MPI_try_staged_settings(${LANG} test_mpi F90_MODULE FALSE)
- _MPI_try_staged_settings(${LANG} test_mpi F08_MODULE FALSE)
-
- set(MPI_${LANG}_WORKS FALSE)
-
- foreach(mpimethod IN ITEMS F77_HEADER F08_MODULE F90_MODULE)
- if(MPI_RESULT_${LANG}_test_mpi_${mpimethod})
- set(MPI_${LANG}_WORKS TRUE)
- set(MPI_${LANG}_HAVE_${mpimethod} TRUE)
- else()
- set(MPI_${LANG}_HAVE_${mpimethod} FALSE)
- endif()
- endforeach()
- # MPI-1 versions had no MPI_INTGER_KIND defined, so we need to try without it.
- # However, MPI-1 also did not define the Fortran 90 and 08 modules, so we only try the F77 header.
- unset(MPI_Fortran_INTEGER_LINE)
- if(NOT MPI_${LANG}_WORKS)
- _MPI_try_staged_settings(${LANG} test_mpi F77_HEADER_NOKIND FALSE)
- if(MPI_RESULT_${LANG}_test_mpi_F77_HEADER_NOKIND)
- set(MPI_${LANG}_WORKS TRUE)
- set(MPI_${LANG}_HAVE_F77_HEADER TRUE)
- endif()
- endif()
- else()
- _MPI_try_staged_settings(${LANG} test_mpi normal FALSE)
- # If 'test_mpi' built correctly, we've found valid MPI settings. There might not be MPI-2 C++ support, but there can't
- # be MPI-2 C++ support without the C bindings being present, so checking for them is sufficient.
- set(MPI_${LANG}_WORKS "${MPI_RESULT_${LANG}_test_mpi_normal}")
- endif()
- endif()
-endmacro()
-
-# Some systems install various MPI implementations in separate folders in some MPI prefix
-# This macro enumerates all such subfolders and adds them to the list of hints that will be searched.
-macro(MPI_search_mpi_prefix_folder PREFIX_FOLDER)
- if(EXISTS "${PREFIX_FOLDER}")
- file(GLOB _MPI_folder_children RELATIVE "${PREFIX_FOLDER}" "${PREFIX_FOLDER}/*")
- foreach(_MPI_folder_child IN LISTS _MPI_folder_children)
- if(IS_DIRECTORY "${PREFIX_FOLDER}/${_MPI_folder_child}")
- list(APPEND MPI_HINT_DIRS "${PREFIX_FOLDER}/${_MPI_folder_child}")
- endif()
- endforeach()
- endif()
-endmacro()
-
-set(MPI_HINT_DIRS ${MPI_HOME} $ENV{MPI_HOME} $ENV{I_MPI_ROOT})
-if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux")
- # SUSE Linux Enterprise Server stores its MPI implementations under /usr/lib64/mpi/gcc/<name>
- # We enumerate the subfolders and append each as a prefix
- MPI_search_mpi_prefix_folder("/usr/lib64/mpi/gcc")
-elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
- # MSMPI stores its runtime in a special folder, this adds the possible locations to the hints.
- list(APPEND MPI_HINT_DIRS $ENV{MSMPI_BIN} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MPI;InstallRoot]")
-elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "FreeBSD")
- # FreeBSD ships mpich under the normal system paths - but available openmpi implementations
- # will be found in /usr/local/mpi/<name>
- MPI_search_mpi_prefix_folder("/usr/local/mpi")
-endif()
-
-# Most MPI distributions have some form of mpiexec or mpirun which gives us something we can look for.
-# The MPI standard does not mandate the existence of either, but instead only makes requirements if a distribution
-# ships an mpiexec program (mpirun executables are not regulated by the standard).
-find_program(MPIEXEC_EXECUTABLE
- NAMES ${_MPIEXEC_NAMES}
- PATH_SUFFIXES bin sbin
- HINTS ${MPI_HINT_DIRS}
- DOC "Executable for running MPI programs.")
-
-# call get_filename_component twice to remove mpiexec and the directory it exists in (typically bin).
-# This gives us a fairly reliable base directory to search for /bin /lib and /include from.
-get_filename_component(_MPI_BASE_DIR "${MPIEXEC_EXECUTABLE}" PATH)
-get_filename_component(_MPI_BASE_DIR "${_MPI_BASE_DIR}" PATH)
-
-# According to the MPI standard, section 8.8 -n is a guaranteed, and the only guaranteed way to
-# launch an MPI process using mpiexec if such a program exists.
-set(MPIEXEC_NUMPROC_FLAG "-n" CACHE STRING "Flag used by MPI to specify the number of processes for mpiexec; the next option will be the number of processes.")
-set(MPIEXEC_PREFLAGS "" CACHE STRING "These flags will be directly before the executable that is being run by mpiexec.")
-set(MPIEXEC_POSTFLAGS "" CACHE STRING "These flags will be placed after all flags passed to mpiexec.")
-
-# Set the number of processes to the physical processor count
-cmake_host_system_information(RESULT _MPIEXEC_NUMPROCS QUERY NUMBER_OF_PHYSICAL_CORES)
-set(MPIEXEC_MAX_NUMPROCS "${_MPIEXEC_NUMPROCS}" CACHE STRING "Maximum number of processors available to run MPI applications.")
-unset(_MPIEXEC_NUMPROCS)
-mark_as_advanced(MPIEXEC_EXECUTABLE MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS)
-
-#=============================================================================
-# Backward compatibility input hacks. Propagate the FindMPI hints to C and
-# CXX if the respective new versions are not defined. Translate the old
-# MPI_LIBRARY and MPI_EXTRA_LIBRARY to respective MPI_${LANG}_LIBRARIES.
-#
-# Once we find the new variables, we translate them back into their old
-# equivalents below.
-if(NOT MPI_IGNORE_LEGACY_VARIABLES)
- foreach (LANG IN ITEMS C CXX)
- # Old input variables.
- set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS)
-
- # Set new vars based on their old equivalents, if the new versions are not already set.
- foreach (var ${_MPI_OLD_INPUT_VARS})
- if (NOT MPI_${LANG}_${var} AND MPI_${var})
- set(MPI_${LANG}_${var} "${MPI_${var}}")
- endif()
- endforeach()
-
- # Chop the old compile flags into options and definitions
-
- unset(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS)
- unset(MPI_${LANG}_EXTRA_COMPILE_OPTIONS)
- if(MPI_${LANG}_COMPILE_FLAGS)
- separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}")
- foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS)
- if("${_MPI_FLAG}" MATCHES "^ *[-/D]([^ ]+)")
- list(APPEND MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}")
- else()
- list(APPEND MPI_${LANG}_EXTRA_COMPILE_OPTIONS "${_MPI_FLAG}")
- endif()
- endforeach()
- unset(MPI_SEPARATE_FLAGS)
- endif()
-
- # If a list of libraries was given, we'll split it into new-style cache variables
- unset(MPI_${LANG}_EXTRA_LIB_NAMES)
- if(NOT MPI_${LANG}_LIB_NAMES)
- foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY)
- if(_MPI_LIB)
- get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE)
- get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME)
- get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY)
- list(APPEND MPI_${LANG}_EXTRA_LIB_NAMES "${_MPI_PLAIN_LIB_NAME}")
- find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY
- NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}"
- HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB}
- DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI"
- )
- mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY)
- endif()
- endforeach()
- endif()
- endforeach()
-endif()
-#=============================================================================
-
-unset(MPI_VERSION)
-unset(MPI_VERSION_MAJOR)
-unset(MPI_VERSION_MINOR)
-
-unset(_MPI_MIN_VERSION)
-
-# If the user specified a library name we assume they prefer that library over a wrapper. If not, they can disable skipping manually.
-if(NOT DEFINED MPI_SKIP_COMPILER_WRAPPER AND MPI_GUESS_LIBRARY_NAME)
- set(MPI_SKIP_COMPILER_WRAPPER TRUE)
-endif()
-
-# This loop finds the compilers and sends them off for interrogation.
-foreach(LANG IN ITEMS C CXX Fortran)
- if(CMAKE_${LANG}_COMPILER_LOADED)
- if(NOT MPI_FIND_COMPONENTS)
- set(_MPI_FIND_${LANG} TRUE)
- elseif( ${LANG} IN_LIST MPI_FIND_COMPONENTS)
- set(_MPI_FIND_${LANG} TRUE)
- elseif( ${LANG} STREQUAL CXX AND NOT MPI_CXX_SKIP_MPICXX AND MPICXX IN_LIST MPI_FIND_COMPONENTS )
- set(_MPI_FIND_${LANG} TRUE)
- else()
- set(_MPI_FIND_${LANG} FALSE)
- endif()
- else()
- set(_MPI_FIND_${LANG} FALSE)
- endif()
- if(_MPI_FIND_${LANG})
- if( ${LANG} STREQUAL CXX AND NOT MPICXX IN_LIST MPI_FIND_COMPONENTS )
- set(MPI_CXX_SKIP_MPICXX FALSE CACHE BOOL "If true, the MPI-2 C++ bindings are disabled using definitions.")
- mark_as_advanced(MPI_CXX_SKIP_MPICXX)
- endif()
- if(NOT (MPI_${LANG}_LIB_NAMES AND (MPI_${LANG}_INCLUDE_PATH OR MPI_${LANG}_INCLUDE_DIRS OR MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)))
- set(MPI_${LANG}_TRIED_IMPLICIT FALSE)
- set(MPI_${LANG}_WORKS_IMPLICIT FALSE)
- if(NOT MPI_${LANG}_COMPILER AND NOT MPI_ASSUME_NO_BUILTIN_MPI)
- # Should the imported targets be empty, we effectively try whether the compiler supports MPI on its own, which is the case on e.g.
- # Cray PrgEnv.
- _MPI_create_imported_target(${LANG})
- _MPI_check_lang_works(${LANG})
-
- # If the compiler can build MPI code on its own, it functions as an MPI compiler and we'll set the variable to point to it.
- if(MPI_${LANG}_WORKS)
- set(MPI_${LANG}_COMPILER "${CMAKE_${LANG}_COMPILER}" CACHE FILEPATH "MPI compiler for ${LANG}" FORCE)
- set(MPI_${LANG}_WORKS_IMPLICIT TRUE)
- endif()
- set(MPI_${LANG}_TRIED_IMPLICIT TRUE)
- endif()
-
- if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS)
- set(MPI_${LANG}_WRAPPER_FOUND FALSE)
- set(MPI_PINNED_COMPILER FALSE)
-
- if(NOT MPI_SKIP_COMPILER_WRAPPER)
- if(MPI_${LANG}_COMPILER)
- # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler.
- if (NOT IS_ABSOLUTE "${MPI_${LANG}_COMPILER}")
- # Get rid of our default list of names and just search for the name the user wants.
- set(_MPI_${LANG}_COMPILER_NAMES "${MPI_${LANG}_COMPILER}")
- unset(MPI_${LANG}_COMPILER CACHE)
- endif()
- # If the user specifies a compiler, we don't want to try to search libraries either.
- set(MPI_PINNED_COMPILER TRUE)
- endif()
-
- # If we have an MPI base directory, we'll try all compiler names in that one first.
- # This should prevent mixing different MPI environments
- if(_MPI_BASE_DIR)
- find_program(MPI_${LANG}_COMPILER
- NAMES ${_MPI_${LANG}_COMPILER_NAMES}
- PATH_SUFFIXES bin sbin
- HINTS ${_MPI_BASE_DIR}
- NO_DEFAULT_PATH
- DOC "MPI compiler for ${LANG}"
- )
- endif()
-
- # If the base directory did not help (for example because the mpiexec isn't in the same directory as the compilers),
- # we shall try searching in the default paths.
- find_program(MPI_${LANG}_COMPILER
- NAMES ${_MPI_${LANG}_COMPILER_NAMES}
- PATH_SUFFIXES bin sbin
- DOC "MPI compiler for ${LANG}"
- )
-
- if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}")
- set(MPI_PINNED_COMPILER TRUE)
-
- # If we haven't made the implicit compiler test yet, perform it now.
- if(NOT MPI_${LANG}_TRIED_IMPLICIT)
- _MPI_create_imported_target(${LANG})
- _MPI_check_lang_works(${LANG})
- endif()
-
- # Should the MPI compiler not work implicitly for MPI, still interrogate it.
- # Otherwise, MPI compilers for which CMake has separate linking stages, e.g. Intel MPI on Windows where link.exe is being used
- # directly during linkage instead of CMAKE_<LANG>_COMPILER will not work.
- if(NOT MPI_${LANG}_WORKS)
- set(MPI_${LANG}_WORKS_IMPLICIT FALSE)
- _MPI_interrogate_compiler(${LANG})
- else()
- set(MPI_${LANG}_WORKS_IMPLICIT TRUE)
- endif()
- elseif(MPI_${LANG}_COMPILER)
- _MPI_interrogate_compiler(${LANG})
- endif()
- endif()
-
- if(NOT MPI_SKIP_GUESSING AND NOT MPI_${LANG}_WRAPPER_FOUND AND NOT MPI_PINNED_COMPILER)
- # For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the
- # settings for C. An MPI distribution that is in this situation would be IBM Platform MPI.
- if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND)
- set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" )
- set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" )
- set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories")
- set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" )
- set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" )
- else()
- _MPI_guess_settings(${LANG})
- endif()
- endif()
- endif()
- endif()
-
- _MPI_split_include_dirs(${LANG})
- _MPI_assemble_include_dirs(${LANG})
- _MPI_assemble_libraries(${LANG})
-
- _MPI_adjust_compile_definitions(${LANG})
- # We always create imported targets even if they're empty
- _MPI_create_imported_target(${LANG})
-
- if(NOT MPI_${LANG}_WORKS)
- _MPI_check_lang_works(${LANG})
- endif()
-
- # Next, we'll initialize the MPI variables that have not been previously set.
- set(MPI_${LANG}_COMPILE_OPTIONS "" CACHE STRING "MPI ${LANG} compilation flags" )
- set(MPI_${LANG}_COMPILE_DEFINITIONS "" CACHE STRING "MPI ${LANG} compilation definitions" )
- set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "MPI ${LANG} additional include directories")
- set(MPI_${LANG}_LINK_FLAGS "" CACHE STRING "MPI ${LANG} linker flags" )
- if(NOT MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER)
- set(MPI_${LANG}_LIB_NAMES "" CACHE STRING "MPI ${LANG} libraries to link against" )
- endif()
- mark_as_advanced(MPI_${LANG}_COMPILE_OPTIONS MPI_${LANG}_COMPILE_DEFINITIONS MPI_${LANG}_LINK_FLAGS
- MPI_${LANG}_LIB_NAMES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS MPI_${LANG}_COMPILER)
-
- # If we've found MPI, then we'll perform additional analysis: Determine the MPI version, MPI library version, supported
- # MPI APIs (i.e. MPI-2 C++ bindings). For Fortran we also need to find specific parameters if we're under MPI-3.
- if(MPI_${LANG}_WORKS)
- if("${LANG}" STREQUAL "CXX" AND NOT DEFINED MPI_MPICXX_FOUND)
- if(NOT MPI_CXX_SKIP_MPICXX AND NOT MPI_CXX_VALIDATE_SKIP_MPICXX)
- _MPI_try_staged_settings(${LANG} test_mpi MPICXX FALSE)
- if(MPI_RESULT_${LANG}_test_mpi_MPICXX)
- set(MPI_MPICXX_FOUND TRUE)
- else()
- set(MPI_MPICXX_FOUND FALSE)
- endif()
- else()
- set(MPI_MPICXX_FOUND FALSE)
- endif()
- endif()
-
- # At this point, we know the bindings present but not the MPI version or anything else.
- if(NOT DEFINED MPI_${LANG}_VERSION)
- unset(MPI_${LANG}_VERSION_MAJOR)
- unset(MPI_${LANG}_VERSION_MINOR)
- endif()
- set(MPI_BIN_FOLDER ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI)
-
- # For Fortran, we'll want to use the most modern MPI binding to test capabilities other than the
- # Fortran parameters, since those depend on the method of consumption.
- # For C++, we can always use the C bindings, and should do so, since the C++ bindings do not exist in MPI-3
- # whereas the C bindings do, and the C++ bindings never offered any feature advantage over their C counterparts.
- if("${LANG}" STREQUAL "Fortran")
- if(MPI_${LANG}_HAVE_F08_MODULE)
- set(MPI_${LANG}_HIGHEST_METHOD F08_MODULE)
- elseif(MPI_${LANG}_HAVE_F90_MODULE)
- set(MPI_${LANG}_HIGHEST_METHOD F90_MODULE)
- else()
- set(MPI_${LANG}_HIGHEST_METHOD F77_HEADER)
- endif()
-
- # Another difference between C and Fortran is that we can't use the preprocessor to determine whether MPI_VERSION
- # and MPI_SUBVERSION are provided. These defines did not exist in MPI 1.0 and 1.1 and therefore might not
- # exist. For C/C++, test_mpi.c will handle the MPI_VERSION extraction, but for Fortran, we need mpiver.f90.
- if(NOT DEFINED MPI_${LANG}_VERSION)
- _MPI_try_staged_settings(${LANG} mpiver ${MPI_${LANG}_HIGHEST_METHOD} FALSE)
- if(MPI_RESULT_${LANG}_mpiver_${MPI_${LANG}_HIGHEST_METHOD})
- file(STRINGS ${MPI_BIN_FOLDER}/mpiver_${LANG}.bin _MPI_VERSION_STRING LIMIT_COUNT 1 REGEX "INFO:MPI-VER")
- if("${_MPI_VERSION_STRING}" MATCHES ".*INFO:MPI-VER\\[([0-9]+)\\.([0-9]+)\\].*")
- set(MPI_${LANG}_VERSION_MAJOR "${CMAKE_MATCH_1}")
- set(MPI_${LANG}_VERSION_MINOR "${CMAKE_MATCH_2}")
- set(MPI_${LANG}_VERSION "${MPI_${LANG}_VERSION_MAJOR}.${MPI_${LANG}_VERSION_MINOR}")
- endif()
- endif()
- endif()
-
- # Finally, we want to find out which capabilities a given interface supports, compare the MPI-3 standard.
- # This is determined by interface specific parameters MPI_SUBARRAYS_SUPPORTED and MPI_ASYNC_PROTECTS_NONBLOCKING
- # and might vary between the different methods of consumption.
- if(MPI_DETERMINE_Fortran_CAPABILITIES AND NOT MPI_Fortran_CAPABILITIES_DETERMINED)
- foreach(mpimethod IN ITEMS F08_MODULE F90_MODULE F77_HEADER)
- if(MPI_${LANG}_HAVE_${mpimethod})
- set(MPI_${LANG}_${mpimethod}_SUBARRAYS FALSE)
- set(MPI_${LANG}_${mpimethod}_ASYNCPROT FALSE)
- _MPI_try_staged_settings(${LANG} fortranparam_mpi ${mpimethod} TRUE)
- if(MPI_RESULT_${LANG}_fortranparam_mpi_${mpimethod} AND
- NOT "${MPI_RUN_RESULT_${LANG}_fortranparam_mpi_${mpimethod}}" STREQUAL "FAILED_TO_RUN")
- if("${MPI_RUN_OUTPUT_${LANG}_fortranparam_mpi_${mpimethod}}" MATCHES
- ".*INFO:SUBARRAYS\\[ *([TF]) *\\]-ASYNCPROT\\[ *([TF]) *\\].*")
- if("${CMAKE_MATCH_1}" STREQUAL "T")
- set(MPI_${LANG}_${mpimethod}_SUBARRAYS TRUE)
- endif()
- if("${CMAKE_MATCH_2}" STREQUAL "T")
- set(MPI_${LANG}_${mpimethod}_ASYNCPROT TRUE)
- endif()
- endif()
- endif()
- endif()
- endforeach()
- set(MPI_Fortran_CAPABILITIES_DETERMINED TRUE)
- endif()
- else()
- set(MPI_${LANG}_HIGHEST_METHOD normal)
-
- # By the MPI-2 standard, MPI_VERSION and MPI_SUBVERSION are valid for both C and C++ bindings.
- if(NOT DEFINED MPI_${LANG}_VERSION)
- file(STRINGS ${MPI_BIN_FOLDER}/test_mpi_${LANG}.bin _MPI_VERSION_STRING LIMIT_COUNT 1 REGEX "INFO:MPI-VER")
- if("${_MPI_VERSION_STRING}" MATCHES ".*INFO:MPI-VER\\[([0-9]+)\\.([0-9]+)\\].*")
- set(MPI_${LANG}_VERSION_MAJOR "${CMAKE_MATCH_1}")
- set(MPI_${LANG}_VERSION_MINOR "${CMAKE_MATCH_2}")
- set(MPI_${LANG}_VERSION "${MPI_${LANG}_VERSION_MAJOR}.${MPI_${LANG}_VERSION_MINOR}")
- endif()
- endif()
- endif()
-
- unset(MPI_BIN_FOLDER)
-
- # At this point, we have dealt with determining the MPI version and parameters for each Fortran method available.
- # The one remaining issue is to determine which MPI library is installed.
- # Determining the version and vendor of the MPI library is only possible via MPI_Get_library_version() at runtime,
- # and therefore we cannot do this while cross-compiling (a user may still define MPI_<lang>_LIBRARY_VERSION_STRING
- # themselves and we'll attempt splitting it, which is equivalent to provide the try_run output).
- # It's also worth noting that the installed version string can depend on the language, or on the system the binary
- # runs on if MPI is not statically linked.
- if(MPI_DETERMINE_LIBRARY_VERSION AND NOT MPI_${LANG}_LIBRARY_VERSION_STRING)
- _MPI_try_staged_settings(${LANG} libver_mpi ${MPI_${LANG}_HIGHEST_METHOD} TRUE)
- if(MPI_RESULT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD} AND
- "${MPI_RUN_RESULT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD}}" EQUAL "0")
- string(STRIP "${MPI_RUN_OUTPUT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD}}"
- MPI_${LANG}_LIBRARY_VERSION_STRING)
- else()
- set(MPI_${LANG}_LIBRARY_VERSION_STRING "NOTFOUND")
- endif()
- endif()
- endif()
-
- set(MPI_${LANG}_FIND_QUIETLY ${MPI_FIND_QUIETLY})
- set(MPI_${LANG}_FIND_VERSION ${MPI_FIND_VERSION})
- set(MPI_${LANG}_FIND_VERSION_EXACT ${MPI_FIND_VERSION_EXACT})
-
- unset(MPI_${LANG}_REQUIRED_VARS)
- if (NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}")
- foreach(mpilibname IN LISTS MPI_${LANG}_LIB_NAMES)
- list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpilibname}_LIBRARY")
- endforeach()
- list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_LIB_NAMES")
- if("${LANG}" STREQUAL "Fortran")
- # For Fortran we only need one of the module or header directories to have *some* support for MPI.
- if(NOT MPI_${LANG}_MODULE_DIR)
- list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_F77_HEADER_DIR")
- endif()
- if(NOT MPI_${LANG}_F77_HEADER_DIR)
- list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_MODULE_DIR")
- endif()
- else()
- list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_HEADER_DIR")
- endif()
- if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS)
- foreach(mpiincvar IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS)
- list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpiincvar}_INCLUDE_DIR")
- endforeach()
- endif()
- # Append the works variable now. If the settings did not work, this will show up properly.
- list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_WORKS")
- else()
- # If the compiler worked implicitly, use its path as output.
- # Should the compiler variable be set, we also require it to work.
- list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_COMPILER")
- if(MPI_${LANG}_COMPILER)
- list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_WORKS")
- endif()
- endif()
- find_package_handle_standard_args(MPI_${LANG} REQUIRED_VARS ${MPI_${LANG}_REQUIRED_VARS}
- VERSION_VAR MPI_${LANG}_VERSION)
-
- if(DEFINED MPI_${LANG}_VERSION)
- if(NOT _MPI_MIN_VERSION OR _MPI_MIN_VERSION VERSION_GREATER MPI_${LANG}_VERSION)
- set(_MPI_MIN_VERSION MPI_${LANG}_VERSION)
- endif()
- endif()
- endif()
-endforeach()
-
-unset(_MPI_REQ_VARS)
-foreach(LANG IN ITEMS C CXX Fortran)
- if((NOT MPI_FIND_COMPONENTS AND CMAKE_${LANG}_COMPILER_LOADED) OR LANG IN_LIST MPI_FIND_COMPONENTS)
- list(APPEND _MPI_REQ_VARS "MPI_${LANG}_FOUND")
- endif()
-endforeach()
-
-if(MPICXX IN_LIST MPI_FIND_COMPONENTS)
- list(APPEND _MPI_REQ_VARS "MPI_MPICXX_FOUND")
-endif()
-
-find_package_handle_standard_args(MPI
- REQUIRED_VARS ${_MPI_REQ_VARS}
- VERSION_VAR ${_MPI_MIN_VERSION}
- HANDLE_COMPONENTS)
-
-#=============================================================================
-# More backward compatibility stuff
-
-# For compatibility reasons, we also define MPIEXEC
-set(MPIEXEC "${MPIEXEC_EXECUTABLE}")
-
-# Copy over MPI_<LANG>_INCLUDE_PATH from the assembled INCLUDE_DIRS.
-foreach(LANG IN ITEMS C CXX Fortran)
- if(MPI_${LANG}_FOUND)
- set(MPI_${LANG}_INCLUDE_PATH "${MPI_${LANG}_INCLUDE_DIRS}")
- unset(MPI_${LANG}_COMPILE_FLAGS)
- if(MPI_${LANG}_COMPILE_OPTIONS)
- set(MPI_${LANG}_COMPILE_FLAGS "${MPI_${LANG}_COMPILE_OPTIONS}")
- endif()
- if(MPI_${LANG}_COMPILE_DEFINITIONS)
- foreach(_MPI_DEF IN LISTS MPI_${LANG}_COMPILE_DEFINITIONS)
- string(APPEND MPI_${LANG}_COMPILE_FLAGS " -D${_MPI_DEF}")
- endforeach()
- endif()
- endif()
-endforeach()
-
-# Bare MPI sans ${LANG} vars are set to CXX then C, depending on what was found.
-# This mimics the behavior of the old language-oblivious FindMPI.
-set(_MPI_OLD_VARS COMPILER INCLUDE_PATH COMPILE_FLAGS LINK_FLAGS LIBRARIES)
-if (MPI_CXX_FOUND)
- foreach (var ${_MPI_OLD_VARS})
- set(MPI_${var} ${MPI_CXX_${var}})
- endforeach()
-elseif (MPI_C_FOUND)
- foreach (var ${_MPI_OLD_VARS})
- set(MPI_${var} ${MPI_C_${var}})
- endforeach()
-endif()
-
-# Chop MPI_LIBRARIES into the old-style MPI_LIBRARY and MPI_EXTRA_LIBRARY, and set them in cache.
-if (MPI_LIBRARIES)
- list(GET MPI_LIBRARIES 0 MPI_LIBRARY_WORK)
- set(MPI_LIBRARY "${MPI_LIBRARY_WORK}")
- unset(MPI_LIBRARY_WORK)
-else()
- set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND")
-endif()
-
-list(LENGTH MPI_LIBRARIES MPI_NUMLIBS)
-if (MPI_NUMLIBS GREATER 1)
- set(MPI_EXTRA_LIBRARY_WORK "${MPI_LIBRARIES}")
- list(REMOVE_AT MPI_EXTRA_LIBRARY_WORK 0)
- set(MPI_EXTRA_LIBRARY "${MPI_EXTRA_LIBRARY_WORK}")
- unset(MPI_EXTRA_LIBRARY_WORK)
-else()
- set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND")
-endif()
-set(MPI_IGNORE_LEGACY_VARIABLES TRUE)
-#=============================================================================
-
-# unset these vars to cleanup namespace
-unset(_MPI_OLD_VARS)
-unset(_MPI_PREFIX_PATH)
-unset(_MPI_BASE_DIR)
-foreach (lang C CXX Fortran)
- unset(_MPI_${LANG}_COMPILER_NAMES)
-endforeach()
-
-cmake_policy(POP)
diff --git a/config/cmake_ext_mod/FindMPI/fortranparam_mpi.f90.in b/config/cmake_ext_mod/FindMPI/fortranparam_mpi.f90.in
deleted file mode 100644
index 30f912c..0000000
--- a/config/cmake_ext_mod/FindMPI/fortranparam_mpi.f90.in
+++ /dev/null
@@ -1,4 +0,0 @@
- program mpi_ver
- @MPI_Fortran_INCLUDE_LINE@
- print *, 'INFO:SUBARRAYS[', MPI_SUBARRAYS_SUPPORTED, ']-ASYNCPROT[', MPI_ASYNC_PROTECTS_NONBLOCKING, ']'
- end program mpi_ver
diff --git a/config/cmake_ext_mod/FindMPI/libver_mpi.c b/config/cmake_ext_mod/FindMPI/libver_mpi.c
deleted file mode 100644
index be9d19d..0000000
--- a/config/cmake_ext_mod/FindMPI/libver_mpi.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <mpi.h>
-
-#ifdef __cplusplus
-#include <cstdio>
-#else
-#include <stdio.h>
-#endif
-
-int main(int argc, char* argv[])
-{
- char mpilibver_str[MPI_MAX_LIBRARY_VERSION_STRING];
- int mpilibver_len;
- MPI_Get_library_version(mpilibver_str, &mpilibver_len);
-#ifdef __cplusplus
- std::puts(mpilibver_str);
-#else
- puts(mpilibver_str);
-#endif
-}
diff --git a/config/cmake_ext_mod/FindMPI/libver_mpi.f90.in b/config/cmake_ext_mod/FindMPI/libver_mpi.f90.in
deleted file mode 100644
index 7938587..0000000
--- a/config/cmake_ext_mod/FindMPI/libver_mpi.f90.in
+++ /dev/null
@@ -1,7 +0,0 @@
- program mpi_ver
- @MPI_Fortran_INCLUDE_LINE@
- character(len=MPI_MAX_LIBRARY_VERSION_STRING) :: mpilibver_str
- integer(kind=MPI_INTEGER_KIND) :: ierror, reslen
- call MPI_GET_LIBRARY_VERSION(mpilibver_str, reslen, ierror)
- print *, mpilibver_str
- end program mpi_ver
diff --git a/config/cmake_ext_mod/FindMPI/mpiver.f90.in b/config/cmake_ext_mod/FindMPI/mpiver.f90.in
deleted file mode 100644
index a254523..0000000
--- a/config/cmake_ext_mod/FindMPI/mpiver.f90.in
+++ /dev/null
@@ -1,10 +0,0 @@
- program mpi_ver
- @MPI_Fortran_INCLUDE_LINE@
- integer(kind=kind(MPI_VERSION)), parameter :: zero = ichar('0')
- character, dimension(17), parameter :: mpiver_str =&
- (/ 'I', 'N', 'F', 'O', ':', 'M', 'P', 'I', '-', 'V', 'E', 'R', '[', &
- char(zero + MPI_VERSION), &
- '.', &
- char(zero + MPI_SUBVERSION), ']' /)
- print *, mpiver_str
- end program mpi_ver
diff --git a/config/cmake_ext_mod/FindMPI/test_mpi.c b/config/cmake_ext_mod/FindMPI/test_mpi.c
deleted file mode 100644
index b8a308a..0000000
--- a/config/cmake_ext_mod/FindMPI/test_mpi.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <mpi.h>
-
-#ifdef __cplusplus
-#include <cstdio>
-#else
-#include <stdio.h>
-#endif
-
-#if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
-const char mpiver_str[] = { 'I', 'N',
- 'F', 'O',
- ':', 'M',
- 'P', 'I',
- '-', 'V',
- 'E', 'R',
- '[', ('0' + MPI_VERSION),
- '.', ('0' + MPI_SUBVERSION),
- ']', '\0' };
-#endif
-
-int main(int argc, char* argv[])
-{
-#if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
-#ifdef __cplusplus
- std::puts(mpiver_str);
-#else
- puts(mpiver_str);
-#endif
-#endif
-#ifdef TEST_MPI_MPICXX
- MPI::MPI_Init(&argc, &argv);
- MPI::MPI_Finalize();
-#else
- MPI_Init(&argc, &argv);
- MPI_Finalize();
-#endif
-}
diff --git a/config/cmake_ext_mod/FindMPI/test_mpi.f90.in b/config/cmake_ext_mod/FindMPI/test_mpi.f90.in
deleted file mode 100644
index 4d43a04..0000000
--- a/config/cmake_ext_mod/FindMPI/test_mpi.f90.in
+++ /dev/null
@@ -1,6 +0,0 @@
- program hello
- @MPI_Fortran_INCLUDE_LINE@
- integer@MPI_Fortran_INTEGER_LINE@ ierror
- call MPI_INIT(ierror)
- call MPI_FINALIZE(ierror)
- end program
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index e9430d9..4da8405 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_EXAMPLES)
#-----------------------------------------------------------------------------
diff --git a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt
index 7864f2d..8c7b8f6 100644
--- a/fortran/CMakeLists.txt
+++ b/fortran/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_F90 C CXX Fortran)
if (H5_HAVE_PARALLEL)
diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt
index 9adf8bd..8b7333a 100644
--- a/fortran/examples/CMakeLists.txt
+++ b/fortran/examples/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_F90_EXAMPLES C CXX Fortran)
# --------------------------------------------------------------------
# Notes: When creating examples they should be prefixed
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt
index 9bf1719..64cf739 100644
--- a/fortran/src/CMakeLists.txt
+++ b/fortran/src/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_F90_SRC C CXX Fortran)
#-----------------------------------------------------------------------------
diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt
index 67d377f..b71a8eb 100644
--- a/fortran/test/CMakeLists.txt
+++ b/fortran/test/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_FORTRAN_TESTS C CXX Fortran)
#-----------------------------------------------------------------------------
diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt
index b1cf9d2..979d305 100644
--- a/fortran/testpar/CMakeLists.txt
+++ b/fortran/testpar/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_FORTRAN_TESTPAR C CXX Fortran)
#-----------------------------------------------------------------------------
diff --git a/hl/CMakeLists.txt b/hl/CMakeLists.txt
index eac6df0..54d5976 100644
--- a/hl/CMakeLists.txt
+++ b/hl/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_HL C CXX)
#-----------------------------------------------------------------------------
diff --git a/hl/c++/CMakeLists.txt b/hl/c++/CMakeLists.txt
index c5b4a72..71e5bb3 100644
--- a/hl/c++/CMakeLists.txt
+++ b/hl/c++/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_HL_CPP)
#-----------------------------------------------------------------------------
diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt
index bf96fba..25158f2 100644
--- a/hl/c++/examples/CMakeLists.txt
+++ b/hl/c++/examples/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_HL_CPP_EXAMPLES)
#-----------------------------------------------------------------------------
diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt
index 0f187c5..c0cc09e 100644
--- a/hl/c++/src/CMakeLists.txt
+++ b/hl/c++/src/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_HL_CPP_SRC)
#-----------------------------------------------------------------------------
@@ -69,3 +69,50 @@ if (HDF5_EXPORTED_TARGETS)
INCLUDES DESTINATION include
)
endif ()
+
+#-----------------------------------------------------------------------------
+# Create pkgconfig files
+#-----------------------------------------------------------------------------
+set (_PKG_CONFIG_PREFIX ${CMAKE_INSTALL_PREFIX})
+set (_PKG_CONFIG_EXEC_PREFIX \${prefix})
+set (_PKG_CONFIG_LIBDIR \${exec_prefix}/lib)
+set (_PKG_CONFIG_INCLUDEDIR \${prefix}/include)
+set (_PKG_CONFIG_LIBNAME "${HDF5_HL_CPP_LIB_CORENAME}")
+set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}")
+
+set (_PKG_CONFIG_LIBS_PRIVATE)
+
+set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_CPP_LIB_CORENAME}")
+if (BUILD_SHARED_LIBS)
+ set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_HL_CPP_LIB_CORENAME}")
+endif ()
+
+set (_PKG_CONFIG_REQUIRES "${HDF5_HL_LIB_CORENAME}")
+set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_HL_LIB_CORENAME}")
+
+configure_file (
+ ${HDF_RESOURCES_DIR}/libhdf5.pc.in
+ ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_CPP_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc
+ @ONLY
+)
+install (
+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_CPP_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc
+ DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig
+ COMPONENT hlcpplibraries
+)
+
+if (NOT WIN32)
+ set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER})
+ configure_file (
+ ${HDF_RESOURCES_DIR}/libh5cc.in
+ ${HDF5_BINARY_DIR}/CMakeFiles/h5hlc++
+ @ONLY
+ )
+ install (
+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5hlc++
+ DESTINATION ${HDF5_INSTALL_BIN_DIR}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+ COMPONENT hlcpplibraries
+ )
+endif ()
+
diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt
index 28b5eb8..b48d147 100644
--- a/hl/c++/test/CMakeLists.txt
+++ b/hl/c++/test/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_HL_CPP_TEST)
#-----------------------------------------------------------------------------
diff --git a/hl/examples/CMakeLists.txt b/hl/examples/CMakeLists.txt
index dd94da0..79dfee1 100644
--- a/hl/examples/CMakeLists.txt
+++ b/hl/examples/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_HL_EXAMPLES )
#-----------------------------------------------------------------------------
diff --git a/hl/fortran/CMakeLists.txt b/hl/fortran/CMakeLists.txt
index 37c5cc9..7955de2 100644
--- a/hl/fortran/CMakeLists.txt
+++ b/hl/fortran/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_HL_F90 C CXX Fortran)
#-----------------------------------------------------------------------------
diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt
index ff0403a..411ceea 100644
--- a/hl/fortran/examples/CMakeLists.txt
+++ b/hl/fortran/examples/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_HL_F90_EXAMPLES C CXX Fortran)
#-----------------------------------------------------------------------------
diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt
index 7a2eff1..82be551 100644
--- a/hl/fortran/src/CMakeLists.txt
+++ b/hl/fortran/src/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT(HDF5_HL_F90_SRC C CXX Fortran)
#-----------------------------------------------------------------------------
diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt
index 1ec4b93..5c83d03 100644
--- a/hl/fortran/test/CMakeLists.txt
+++ b/hl/fortran/test/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_HL_FORTRAN_TESTS C CXX Fortran)
#-----------------------------------------------------------------------------
diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt
index d21a3ea..0daa86e 100644
--- a/hl/src/CMakeLists.txt
+++ b/hl/src/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_HL_SRC)
#-----------------------------------------------------------------------------
@@ -88,3 +88,49 @@ if (HDF5_EXPORTED_TARGETS)
INCLUDES DESTINATION include
)
endif ()
+
+#-----------------------------------------------------------------------------
+# Create pkgconfig files
+#-----------------------------------------------------------------------------
+set (_PKG_CONFIG_PREFIX ${CMAKE_INSTALL_PREFIX})
+set (_PKG_CONFIG_EXEC_PREFIX \${prefix})
+set (_PKG_CONFIG_LIBDIR \${exec_prefix}/lib)
+set (_PKG_CONFIG_INCLUDEDIR \${prefix}/include)
+set (_PKG_CONFIG_LIBNAME "${HDF5_HL_LIB_CORENAME}")
+set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}")
+
+set (_PKG_CONFIG_LIBS_PRIVATE)
+
+set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_LIB_CORENAME}")
+if (BUILD_SHARED_LIBS)
+ set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_HL_LIB_CORENAME}")
+endif ()
+
+set (_PKG_CONFIG_REQUIRES "${HDF5_LIB_CORENAME}")
+set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_LIB_CORENAME}")
+
+configure_file (
+ ${HDF_RESOURCES_DIR}/libhdf5.pc.in
+ ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc
+ @ONLY
+)
+install (
+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc
+ DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig
+ COMPONENT hllibraries
+)
+
+if (NOT WIN32)
+ set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER})
+ configure_file (
+ ${HDF_RESOURCES_DIR}/libh5cc.in
+ ${HDF5_BINARY_DIR}/CMakeFiles/h5chl
+ @ONLY
+ )
+ install (
+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5chl
+ DESTINATION ${HDF5_INSTALL_BIN_DIR}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+ COMPONENT hllibraries
+ )
+endif ()
diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt
index 1f2ea17..6b3c764 100644
--- a/hl/test/CMakeLists.txt
+++ b/hl/test/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_HL_TEST)
# --------------------------------------------------------------------
# Notes: When creating unit test executables they should be prefixed
diff --git a/hl/tools/CMakeLists.txt b/hl/tools/CMakeLists.txt
index ab71a7e..67e0ccb 100644
--- a/hl/tools/CMakeLists.txt
+++ b/hl/tools/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_HL_TOOLS C CXX)
add_subdirectory (gif2h5)
diff --git a/hl/tools/gif2h5/CMakeLists.txt b/hl/tools/gif2h5/CMakeLists.txt
index b50bbf7..2697dfd 100644
--- a/hl/tools/gif2h5/CMakeLists.txt
+++ b/hl/tools/gif2h5/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_HL_TOOLS_GIF2H5)
#-----------------------------------------------------------------------------
diff --git a/hl/tools/h5watch/CMakeLists.txt b/hl/tools/h5watch/CMakeLists.txt
index a1697cd..5de655e 100644
--- a/hl/tools/h5watch/CMakeLists.txt
+++ b/hl/tools/h5watch/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_HL_TOOLS_H5WATCH)
#-----------------------------------------------------------------------------
diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt
index d8cd358..fc057f7 100644
--- a/java/CMakeLists.txt
+++ b/java/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT ( HDF5_JAVA C Java )
set (CMAKE_MODULE_PATH "${HDF_RESOURCES_DIR};${HDF_RESOURCES_EXT_DIR}")
diff --git a/java/examples/CMakeLists.txt b/java/examples/CMakeLists.txt
index d43b49f..3d1e30e 100644
--- a/java/examples/CMakeLists.txt
+++ b/java/examples/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDFJAVA_EXAMPLES)
add_subdirectory (datasets)
diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt
index ed4559c..6a90cd1 100644
--- a/java/examples/datasets/CMakeLists.txt
+++ b/java/examples/datasets/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDFJAVA_EXAMPLES_DATASETS Java)
set (CMAKE_VERBOSE_MAKEFILE 1)
diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt
index 71cf83e..73111ed 100644
--- a/java/examples/datatypes/CMakeLists.txt
+++ b/java/examples/datatypes/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDFJAVA_EXAMPLES_DATATYPES Java)
set (CMAKE_VERBOSE_MAKEFILE 1)
diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt
index dc5d834..6b55359 100644
--- a/java/examples/groups/CMakeLists.txt
+++ b/java/examples/groups/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDFJAVA_EXAMPLES_GROUPS Java)
set (CMAKE_VERBOSE_MAKEFILE 1)
diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt
index 59fe48b..65db3fe 100644
--- a/java/examples/intro/CMakeLists.txt
+++ b/java/examples/intro/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDFJAVA_EXAMPLES_INTRO Java)
set (CMAKE_VERBOSE_MAKEFILE 1)
diff --git a/java/src/CMakeLists.txt b/java/src/CMakeLists.txt
index 7075d32..0c00923 100644
--- a/java/src/CMakeLists.txt
+++ b/java/src/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT ( HDF5_JAVA_SRC C Java )
#-----------------------------------------------------------------------------
diff --git a/java/src/hdf/CMakeLists.txt b/java/src/hdf/CMakeLists.txt
index 35b436d..ecff984 100644
--- a/java/src/hdf/CMakeLists.txt
+++ b/java/src/hdf/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_JAVA_HDF)
add_subdirectory (hdf5lib)
diff --git a/java/src/hdf/hdf5lib/CMakeLists.txt b/java/src/hdf/hdf5lib/CMakeLists.txt
index 1f2587e..9506fc1 100644
--- a/java/src/hdf/hdf5lib/CMakeLists.txt
+++ b/java/src/hdf/hdf5lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_JAVA_HDF_HDF5 Java)
set (CMAKE_VERBOSE_MAKEFILE 1)
diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt
index 8ab275e..96e7035 100644
--- a/java/src/jni/CMakeLists.txt
+++ b/java/src/jni/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_JAVA_JNI C CXX)
set (HDF5_JAVA_JNI_CSRCS
diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt
index 329c602..6158055 100644
--- a/java/test/CMakeLists.txt
+++ b/java/test/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_JAVA_TEST Java)
set (CMAKE_VERBOSE_MAKEFILE 1)
diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java
index 51fa4df..0651502 100644
--- a/java/test/TestH5Pfapl.java
+++ b/java/test/TestH5Pfapl.java
@@ -1388,7 +1388,7 @@ public class TestH5Pfapl {
}
catch (HDF5PropertyListInterfaceException err) {
// parallel is not supported
- if (err.getMinorErrorNumber() != HDF5Constants.H5E_CANTSET) {
+ if (err.getMinorErrorNumber() != HDF5Constants.H5E_UNSUPPORTED) {
err.printStackTrace();
fail("H5P_evict_on_close: " + err);
}
diff --git a/release_docs/INSTALL b/release_docs/INSTALL
index 2dcb9be..3709a58 100644
--- a/release_docs/INSTALL
+++ b/release_docs/INSTALL
@@ -305,7 +305,7 @@ CONTENTS
to enable symbolic debugging of a production version of HDF5, one
might say:
- $ CFLAGS=-g ./configure --enable-production
+ $ CFLAGS=-g ./configure --enable-build-mode=production
4.3.5. Compiling HDF5 wrapper libraries
One can optionally build the Fortran and/or C++ interfaces to the
@@ -414,35 +414,35 @@ CONTENTS
The library can be compiled to provide symbolic debugging support
so it can be debugged with gdb, dbx, ddd, etc., or it can be
compiled with various optimizations. To compile for symbolic
- debugging (the default for snapshots), say `--disable-production';
- to compile with optimizations (the default for supported public
- releases), say `--enable-production'. On some systems the library
- can also be compiled for profiling with gprof by saying
+ debugging (the default for snapshots), say
+ `--enable-build-mode=production'; to compile with optimizations
+ (the default for supported public releases),
+ say `--enable-build-mode=production'. On some systems the
+ library can also be compiled for profiling with gprof by saying
`--enable-production=profile'.
- $ ./configure --disable-production #symbolic debugging
- $ ./configure --enable-production #optimized code
- $ ./configure --enable-production=profile #for use with gprof
+ $ ./configure --enable-build-mode=debug #symbolic debugging
+ $ ./configure --enable-build-mode=production #optimized code
+ $ ./configure --enable-production=profile #for use with gprof
Regardless of whether support for symbolic debugging is enabled,
the library can also perform runtime debugging of certain packages
(such as type conversion execution times and extensive invariant
- condition checking). To enable this debugging, supply a
- comma-separated list of package names to to the `--enable-debug'
- switch. See "Debugging HDF5 Applications" for a list of package
- names:
+ condition checking). To enable this debugging, supply a
+ comma-separated list of package names to the `--enable-internal-debug'
+ switch. See "Debugging HDF5 Applications" for a list of package names:
http://www.hdfgroup.org/HDF5/doc/H5.user/Debugging.html
- Debugging can be disabled by saying `--disable-debug'.
+ Debugging can be disabled by saying `--disable-internal-debug'.
The default debugging level for snapshots is a subset of the
available packages; the default for supported releases is no
debugging (debugging can incur a significant runtime penalty).
- $ ./configure --enable-debug=s,t #debug only H5S and H5T
- $ ./configure --enable-debug #debug normal packages
- $ ./configure --enable-debug=all #debug all packages
- $ ./configure --disable-debug #no debugging
+ $ ./configure --enable-internal-debug=s,t #debug only H5S and H5T
+ $ ./configure --enable-internal-debug #debug normal packages
+ $ ./configure --enable-internal-debug=all #debug all packages
+ $ ./configure --disable-internal-debug #no debugging
HDF5 can also print a trace of all API function calls, their
arguments, and the return values. To enable or disable the
@@ -466,15 +466,17 @@ CONTENTS
http://www.hdfgroup.org/HDF5/doc/TechNotes/ThreadSafeLibrary.html
4.3.12. Backward compatibility
- The 1.8 version of the HDF5 Library can be configured to operate
- identically to the v1.6 library with the
+ The 1.10 version of the HDF5 Library can be configured to operate
+ identically to the v1.8 library with the
+ --with-default-api-version=v18
+ configure flag, or identically to the v1.6 library with the
--with-default-api-version=v16
configure flag. This allows existing code to be compiled with the
- v1.8 library without requiring immediate changes to the application
+ v1.10 library without requiring immediate changes to the application
source code. For addtional configuration options and other details,
see "API Compatibility Macros in HDF5":
- http://www.hdfgroup.org/HDF5/doc/RM/APICompatMacros.html
+ https://support.hdfgroup.org/HDF5/doc/RM/APICompatMacros.html
4.4. Building
The library, confidence tests, and programs can be built by
diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt
index f54ca4b..f30c1b3 100644
--- a/release_docs/INSTALL_CMake.txt
+++ b/release_docs/INSTALL_CMake.txt
@@ -165,8 +165,9 @@ To build HDF5 with the SZIP and ZLIB external libraries you will need to:
III. Quick Step Building HDF5 C Static Libraries and Tools with CMake
========================================================================
Notes: This short set of instructions is written for users who want to
- quickly build the just the HDF5 C static library and tools from
+ quickly build just the HDF5 C static library and tools from
the HDF5 source code package using the CMake command line tools.
+ Avoid the use of drive letters in paths on Windows.
Go through these steps:
@@ -647,7 +648,7 @@ adding an option (${CTEST_SCRIPT_ARG}) to the platform configuration script.
### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201764 -C Release -VV -O hdf5.log ###
#############################################################################################
-cmake_minimum_required (VERSION 3.3.2 FATAL_ERROR)
+cmake_minimum_required (VERSION 3.10)
############################################################################
# Usage:
# ctest -S HDF5config.cmake,OPTION=VALUE -C Release -VV -O test.log
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 480bb14..81a052a 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -56,6 +56,26 @@ New Features
-------------
- CMake
+ Change minimum version to 3.10.
+
+ This change removes the need to support a copy of the FindMPI.cmake module,
+ which has been removed, along with its subfolder in the config/cmake_ext_mod
+ location.
+
+ (ADB - 2018/03/09)
+
+ - CMake
+
+ Add pkg-config file generation
+
+ Added pkg-config file generation for the C, C++, HL, and HL C++ libraries.
+ In addition, builds on linux will create h5cXXX scripts that use the pkg-config
+ files. This is a limited implementation of a script like autotools h5cc.
+
+ (ADB - 2018/03/08, HDFFV-4359)
+
+ - CMake
+
Refactor use of CMAKE_BUILD_TYPE for new variable, which understands
the type of generator in use.
@@ -141,7 +161,63 @@ New Features
C++ Library:
------------
- -
+ - The following wrappers are added:
+
+ + H5Lcreate_soft:
+ // Creates a soft link from link_name to target_name.
+ void link(const char *target_name, const char *link_name,...)
+ void link(const H5std_string& target_name,...)
+
+ + H5Lcreate_hard:
+ // Creates a hard link from new_name to curr_name.
+ void link(const char *curr_name, const Group& new_loc,...)
+ void link(const H5std_string& curr_name, const Group& new_loc,...)
+
+ // Creates a hard link from new_name to curr_name in same location.
+ void link(const char *curr_name, const hid_t same_loc,...)
+ void link(const H5std_string& curr_name, const hid_t same_loc,...)
+
+ Note: previous version of H5Location::link will be deprecated.
+
+ + H5Lcopy:
+ // Copy an object from a group of file to another.
+ void copyLink(const char *src_name, const Group& dst,...)
+ void copyLink(const H5std_string& src_name, const Group& dst,...)
+
+ // Copy an object from a group of file to the same location.
+ void copyLink(const char *src_name, const char *dst_name,...)
+ void copyLink(const H5std_string& src_name,...)
+
+ + H5Lmove:
+ // Rename an object in a group or file to a new location.
+ void moveLink(const char* src_name, const Group& dst,...)
+ void moveLink(const H5std_string& src_name, const Group& dst,...)
+
+ // Rename an object in a group or file to the same location.
+ void moveLink(const char* src_name, const char* dst_name,...)
+ void moveLink(const H5std_string& src_name,...)
+
+ Note: previous version H5Location::move will be deprecated.
+
+ + H5Ldelete:
+ // Removes the specified link from this location.
+ void unlink(const char *link_name,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT)
+ void unlink(const H5std_string& link_name,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT)
+
+ - Added class LinkCreatPropList
+
+ - Added overloaded functions H5Location::createGroup to take a link
+ creation property list
+ Group createGroup(const char* name, const LinkCreatPropList& lcpl)
+ Group createGroup(const H5std_string& name, const LinkCreatPropList& lcpl)
+ - Added wrapper for H5Lget_info() to H5Location
+ // Returns the information of the named link.
+ H5L_info_t getLinkInfo(const H5std_string& link_name,...)
+
+ (BMR - 2018/03/11, HDFFV-10149)
+
Java Library:
----------------
@@ -195,6 +271,18 @@ Bug Fixes since HDF5-1.10.1 release
Library
-------
+ - H5Pset_evict_on_close in H5Pfapl.c
+
+ Changed the minor error number from H5E_CANTSET to H5E_UNSUPPORTED for
+ parallel library.
+ (ADB - 2018/03/6, HDFFV-10414)
+
+ - Utility function can not handle lowercase Windows drive letters
+
+ Added call to toupper function for drive letter.
+
+ (ADB - 2017/12/18, HDFFV-10307)
+
- filter plugin handling in H5PL.c and H5Z.c
It was discovered that the dynamic loading process used by
@@ -232,6 +320,48 @@ Bug Fixes since HDF5-1.10.1 release
(DER - 2017/11/21, HDFFV-10330)
+ - If an HDF5 file contains a filter pipeline message with a 'number of
+ filters' field that exceeds the maximum number of allowed filters,
+ the error handling code will attempt to dereference a NULL pointer.
+
+ This issue was reported to The HDF Group as issue #CVE-2017-17505.
+
+ NOTE: The HDF5 C library cannot produce such a file. This condition
+ should only occur in a corrupt (or deliberately altered) file
+ or a file created by third-party software.
+
+ This problem arose because the error handling code assumed that
+ the 'number of filters' field implied that a dynamic array of that
+ size had already been created and that the cleanup code should
+ iterate over that array and clean up each element's resources. If
+ an error occurred before the array has been allocated, this will
+ not be true.
+
+ This has been changed so that the number of filters is set to
+ zero on errors. Additionally, the filter array traversal in the
+ error handling code now requires that the filter array not be NULL.
+
+ (DER - 2018/02/06, HDFFV-10354)
+
+ - If an HDF5 file contains a filter pipeline message which contains
+ a 'number of filters' field that exceeds the actual number of
+ filters in the message, the HDF5 C library will read off the end of
+ the read buffer.
+
+ This issue was reported to The HDF Group as issue #CVE-2017-17506.
+
+ NOTE: The HDF5 C library cannot produce such a file. This condition
+ should only occur in a corrupt (or deliberately altered) file
+ or a file created by third-party software.
+
+ The problem was fixed by passing the buffer size with the buffer
+ and ensuring that the pointer cannot be incremented off the end
+ of the buffer. A mismatch between the number of filters declared
+ and the actual number of filters will now invoke normal HDF5
+ error handling.
+
+ (DER - 2018/02/26, HDFFV-10355)
+
- If an HDF5 file contains a malformed compound type which contains
a member of size zero, a division by zero error will occur while
processing the type.
diff --git a/release_docs/USING_HDF5_CMake.txt b/release_docs/USING_HDF5_CMake.txt
index 8dd47c2..b516056 100644
--- a/release_docs/USING_HDF5_CMake.txt
+++ b/release_docs/USING_HDF5_CMake.txt
@@ -180,7 +180,7 @@ Given the preconditions in section I, create a CMakeLists.txt file at the
source root. Include the following text in the file:
##########################################################
-cmake_minimum_required (VERSION 3.10.1)
+cmake_minimum_required (VERSION 3.10)
project (HDF5MyApp C CXX)
set (LIB_TYPE STATIC) # or SHARED
@@ -229,7 +229,7 @@ your application with an installed HDF5 binary.
ctest use of HDF5_Examples.cmake and HDF5_Examples_options.cmake
========================================================================
-cmake_minimum_required (VERSION 3.3.2 FATAL_ERROR)
+cmake_minimum_required (VERSION 3.10)
###############################################################################################################
# This script will build and run the examples from a folder
# Execute from a command line:
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index bf7fb07..c506ebb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_SRC C CXX)
#-----------------------------------------------------------------------------
@@ -991,3 +991,51 @@ if (HDF5_EXPORTED_TARGETS)
INCLUDES DESTINATION include
)
endif ()
+
+#-----------------------------------------------------------------------------
+# Create pkgconfig files
+#-----------------------------------------------------------------------------
+set (_PKG_CONFIG_PREFIX ${CMAKE_INSTALL_PREFIX})
+set (_PKG_CONFIG_EXEC_PREFIX \${prefix})
+set (_PKG_CONFIG_LIBDIR \${exec_prefix}/lib)
+set (_PKG_CONFIG_INCLUDEDIR \${prefix}/include)
+set (_PKG_CONFIG_LIBNAME "${HDF5_LIB_CORENAME}")
+set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}")
+
+foreach (libs ${LINK_LIBS} ${LINK_COMP_LIBS})
+ set (_PKG_CONFIG_LIBS_PRIVATE "${_PKG_CONFIG_LIBS_PRIVATE} -l${libs}")
+endforeach ()
+
+set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_LIB_CORENAME}")
+if (BUILD_SHARED_LIBS)
+ set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_LIB_CORENAME}")
+endif ()
+
+set (_PKG_CONFIG_REQUIRES)
+set (_PKG_CONFIG_REQUIRES_PRIVATE)
+
+configure_file (
+ ${HDF_RESOURCES_DIR}/libhdf5.pc.in
+ ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc
+ @ONLY
+)
+install (
+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc
+ DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig
+ COMPONENT libraries
+)
+
+if (NOT WIN32)
+ set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER})
+ configure_file (
+ ${HDF_RESOURCES_DIR}/libh5cc.in
+ ${HDF5_BINARY_DIR}/CMakeFiles/h5cc
+ @ONLY
+ )
+ install (
+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5cc
+ DESTINATION ${HDF5_INSTALL_BIN_DIR}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+ COMPONENT libraries
+ )
+endif ()
diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c
index ed67e0f..8b79aa5 100644
--- a/src/H5Abtree2.c
+++ b/src/H5Abtree2.c
@@ -158,7 +158,7 @@ const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */
*-------------------------------------------------------------------------
*/
static herr_t
-H5A__dense_fh_name_cmp(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
+H5A__dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata)
{
H5A_fh_ud_cmp_t *udata = (H5A_fh_ud_cmp_t *)_udata; /* User data for 'op' callback */
H5A_t *attr = NULL; /* Pointer to attribute created from heap object */
@@ -168,7 +168,7 @@ H5A__dense_fh_name_cmp(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_ud
FUNC_ENTER_STATIC
/* Decode attribute information */
- if(NULL == (attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_ATTR_ID, (const unsigned char *)obj)))
+ if(NULL == (attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_ATTR_ID, obj_len, (const unsigned char *)obj)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "can't decode attribute")
/* Compare the string values */
diff --git a/src/H5Adense.c b/src/H5Adense.c
index b1903a4..ba0578e 100644
--- a/src/H5Adense.c
+++ b/src/H5Adense.c
@@ -843,7 +843,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5A__dense_copy_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
+H5A__dense_copy_fh_cb(const void *obj, size_t obj_len, void *_udata)
{
H5A_fh_ud_cp_t *udata = (H5A_fh_ud_cp_t *)_udata; /* User data for fractal heap 'op' callback */
herr_t ret_value = SUCCEED; /* Return value */
@@ -857,7 +857,7 @@ H5A__dense_copy_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_uda
* HDF5 routine, it could attempt to re-protect that direct block for the
* heap, causing the HDF5 routine called to fail)
*/
- if(NULL == (udata->attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_ATTR_ID, (const unsigned char *)obj)))
+ if(NULL == (udata->attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_ATTR_ID, obj_len, (const unsigned char *)obj)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, FAIL, "can't decode attribute")
/* Set the creation order index for the attribute */
diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c
index 71d15e5..4702c46 100644
--- a/src/H5Gbtree2.c
+++ b/src/H5Gbtree2.c
@@ -155,7 +155,7 @@ const H5B2_class_t H5G_BT2_CORDER[1]={{ /* B-tree class information */
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_dense_fh_name_cmp(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
+H5G_dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata)
{
H5G_fh_ud_cmp_t *udata = (H5G_fh_ud_cmp_t *)_udata; /* User data for 'op' callback */
H5O_link_t *lnk; /* Pointer to link created from heap object */
@@ -164,7 +164,7 @@ H5G_dense_fh_name_cmp(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_uda
FUNC_ENTER_NOAPI_NOINIT
/* Decode link information */
- if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj)))
+ if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj)))
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
/* Compare the string values */
diff --git a/src/H5Gdense.c b/src/H5Gdense.c
index 4ae6800..de11541 100644
--- a/src/H5Gdense.c
+++ b/src/H5Gdense.c
@@ -599,7 +599,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_dense_lookup_by_idx_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
+H5G_dense_lookup_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata)
{
H5G_fh_ud_lbi_t *udata = (H5G_fh_ud_lbi_t *)_udata; /* User data for fractal heap 'op' callback */
H5O_link_t *tmp_lnk = NULL; /* Temporary pointer to link */
@@ -608,7 +608,7 @@ H5G_dense_lookup_by_idx_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, vo
FUNC_ENTER_NOAPI_NOINIT
/* Decode link information & keep a copy */
- if(NULL == (tmp_lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj)))
+ if(NULL == (tmp_lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj)))
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
/* Copy link information */
@@ -889,7 +889,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_dense_iterate_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
+H5G_dense_iterate_fh_cb(const void *obj, size_t obj_len, void *_udata)
{
H5G_fh_ud_it_t *udata = (H5G_fh_ud_it_t *)_udata; /* User data for fractal heap 'op' callback */
herr_t ret_value = SUCCEED; /* Return value */
@@ -903,7 +903,7 @@ H5G_dense_iterate_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_u
* HDF5 routine, it could attempt to re-protect that direct block for the
* heap, causing the HDF5 routine called to fail - QAK)
*/
- if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj)))
+ if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj)))
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
done:
@@ -1101,7 +1101,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_dense_get_name_by_idx_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
+H5G_dense_get_name_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata)
{
H5G_fh_ud_gnbi_t *udata = (H5G_fh_ud_gnbi_t *)_udata; /* User data for fractal heap 'op' callback */
H5O_link_t *lnk; /* Pointer to link created from heap object */
@@ -1110,7 +1110,7 @@ H5G_dense_get_name_by_idx_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len,
FUNC_ENTER_NOAPI_NOINIT
/* Decode link information */
- if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj)))
+ if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj)))
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
/* Get the length of the name */
@@ -1308,7 +1308,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_dense_remove_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
+H5G_dense_remove_fh_cb(const void *obj, size_t obj_len, void *_udata)
{
H5G_fh_ud_rm_t *udata = (H5G_fh_ud_rm_t *)_udata; /* User data for fractal heap 'op' callback */
H5O_link_t *lnk = NULL; /* Pointer to link created from heap object */
@@ -1318,7 +1318,7 @@ H5G_dense_remove_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_ud
FUNC_ENTER_NOAPI_NOINIT
/* Decode link information */
- if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj)))
+ if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj)))
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
/* Check for removing the link from the creation order index */
@@ -1485,7 +1485,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_dense_remove_by_idx_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
+H5G_dense_remove_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata)
{
H5G_fh_ud_rmbi_t *udata = (H5G_fh_ud_rmbi_t *)_udata; /* User data for fractal heap 'op' callback */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1493,7 +1493,7 @@ H5G_dense_remove_by_idx_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, vo
FUNC_ENTER_NOAPI_NOINIT
/* Decode link information */
- if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj)))
+ if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj)))
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, H5_ITER_ERROR, "can't decode link")
/* Can't operate on link here because the fractal heap block is locked */
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 069bf17..c940161 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -572,7 +572,7 @@ H5HF__cache_hdr_deserialize(const void *_image, size_t len, void *_udata,
UINT32DECODE(image, hdr->pline_root_direct_filter_mask);
/* Decode I/O filter information */
- if(NULL == (pline = (H5O_pline_t *)H5O_msg_decode(hdr->f, udata->dxpl_id, NULL, H5O_PLINE_ID, image)))
+ if(NULL == (pline = (H5O_pline_t *)H5O_msg_decode(hdr->f, udata->dxpl_id, NULL, H5O_PLINE_ID, len, image)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, NULL, "can't decode I/O pipeline filters")
/* Advance past filter info to checksum */
diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c
index d8298a4..b85337a 100644
--- a/src/H5Oainfo.c
+++ b/src/H5Oainfo.c
@@ -35,7 +35,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_ainfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_ainfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_ainfo_copy(const void *_mesg, void *_dest);
static size_t H5O_ainfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -105,7 +105,8 @@ H5FL_DEFINE_STATIC(H5O_ainfo_t);
*/
static void *
H5O_ainfo_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_ainfo_t *ainfo = NULL; /* Attribute info */
unsigned char flags; /* Flags for encoding attribute info */
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index 773a16b..79a0a52 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -26,7 +26,7 @@
/* PRIVATE PROTOTYPES */
static herr_t H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg);
static void *H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static void *H5O_attr_copy(const void *_mesg, void *_dest);
static size_t H5O_attr_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_attr_free(void *mesg);
@@ -121,7 +121,7 @@ H5FL_EXTERN(H5S_extent_t);
--------------------------------------------------------------------------*/
static void *
H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
- unsigned *ioflags, const uint8_t *p)
+ unsigned *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5A_t *attr = NULL;
H5S_extent_t *extent; /*extent dimensionality information */
@@ -185,7 +185,7 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED
/* Decode the attribute's datatype */
if(NULL == (attr->shared->dt = (H5T_t *)(H5O_MSG_DTYPE->decode)(f, dxpl_id, open_oh,
- ((flags & H5O_ATTR_FLAG_TYPE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p)))
+ ((flags & H5O_ATTR_FLAG_TYPE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, attr->shared->dt_size, p)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype")
if(attr->shared->version < H5O_ATTR_VERSION_2)
p += H5O_ALIGN_OLD(attr->shared->dt_size);
@@ -200,7 +200,7 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED
/* Decode attribute's dataspace extent */
if((extent = (H5S_extent_t *)(H5O_MSG_SDSPACE->decode)(f, dxpl_id, open_oh,
- ((flags & H5O_ATTR_FLAG_SPACE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p)) == NULL)
+ ((flags & H5O_ATTR_FLAG_SPACE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, attr->shared->ds_size, p)) == NULL)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute dataspace")
/* Copy the extent information to the dataspace */
diff --git a/src/H5Obogus.c b/src/H5Obogus.c
index a3531ed..02e0e6a 100644
--- a/src/H5Obogus.c
+++ b/src/H5Obogus.c
@@ -38,7 +38,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_bogus_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_bogus_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static size_t H5O_bogus_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
static herr_t H5O_bogus_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream,
@@ -111,7 +111,8 @@ const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1] = {{
*/
static void *
H5O_bogus_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_bogus_t *mesg = NULL;
void *ret_value; /* Return value */
diff --git a/src/H5Obtreek.c b/src/H5Obtreek.c
index 4fd0577..1d2b607 100644
--- a/src/H5Obtreek.c
+++ b/src/H5Obtreek.c
@@ -28,7 +28,7 @@
#include "H5MMprivate.h" /* Memory management */
static void *H5O_btreek_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_btreek_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_btreek_copy(const void *_mesg, void *_dest);
static size_t H5O_btreek_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -79,7 +79,8 @@ const H5O_msg_class_t H5O_MSG_BTREEK[1] = {{
*/
static void *
H5O_btreek_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_btreek_t *mesg; /* Native message */
void *ret_value = NULL; /* Return value */
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 8f4c155..94049ef 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -1515,7 +1515,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
H5O_cont_t *cont;
/* Decode continuation message */
- cont = (H5O_cont_t *)(H5O_MSG_CONT->decode)(udata->f, udata->dxpl_id, NULL, 0, &ioflags, mesg->raw);
+ cont = (H5O_cont_t *)(H5O_MSG_CONT->decode)(udata->f, udata->dxpl_id, NULL, 0, &ioflags, mesg->raw_size, mesg->raw);
H5_CHECKED_ASSIGN(cont->chunkno, unsigned, udata->cont_msg_info->nmsgs + 1, size_t); /* the next continuation message/chunk */
/* Save 'native' form of continuation message */
@@ -1531,7 +1531,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
/* Decode ref. count message */
HDassert(oh->version > H5O_VERSION_1);
- refcount = (H5O_refcount_t *)(H5O_MSG_REFCOUNT->decode)(udata->f, udata->dxpl_id, NULL, 0, &ioflags, mesg->raw);
+ refcount = (H5O_refcount_t *)(H5O_MSG_REFCOUNT->decode)(udata->f, udata->dxpl_id, NULL, 0, &ioflags, mesg->raw_size, mesg->raw);
/* Save 'native' form of ref. count message */
mesg->native = refcount;
diff --git a/src/H5Ocache_image.c b/src/H5Ocache_image.c
index a427b49..d2b65bb 100644
--- a/src/H5Ocache_image.c
+++ b/src/H5Ocache_image.c
@@ -38,7 +38,7 @@
/* Callbacks for message class */
static void *H5O__mdci_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O__mdci_encode(H5F_t *f, hbool_t disable_shared,
uint8_t *p, const void *_mesg);
static void *H5O__mdci_copy(const void *_mesg, void *_dest);
@@ -99,7 +99,7 @@ H5FL_DEFINE(H5O_mdci_t);
static void *
H5O__mdci_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id,
H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
- unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_mdci_t *mesg; /* Native message */
void *ret_value = NULL; /* Return value */
diff --git a/src/H5Ocont.c b/src/H5Ocont.c
index b002a32..f9a9768 100644
--- a/src/H5Ocont.c
+++ b/src/H5Ocont.c
@@ -37,7 +37,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_cont_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_cont_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static size_t H5O_cont_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
static herr_t H5O_cont_free(void *mesg);
@@ -90,7 +90,8 @@ H5FL_DEFINE(H5O_cont_t);
*/
static void *
H5O_cont_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_cont_t *cont = NULL;
void *ret_value = NULL; /* Return value */
diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c
index b9dea26..5921be3 100644
--- a/src/H5Odrvinfo.c
+++ b/src/H5Odrvinfo.c
@@ -28,7 +28,7 @@
#include "H5MMprivate.h" /* Memory management */
static void *H5O_drvinfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_drvinfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_drvinfo_copy(const void *_mesg, void *_dest);
static size_t H5O_drvinfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -80,7 +80,8 @@ const H5O_msg_class_t H5O_MSG_DRVINFO[1] = {{
*/
static void *
H5O_drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_drvinfo_t *mesg; /* Native message */
void *ret_value = NULL; /* Return value */
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index c51e31d..c557b5c 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -30,7 +30,7 @@
/* PRIVATE PROTOTYPES */
static herr_t H5O_dtype_encode(H5F_t *f, uint8_t *p, const void *mesg);
static void *H5O_dtype_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static void *H5O_dtype_copy(const void *_mesg, void *_dest);
static size_t H5O_dtype_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_dtype_reset(void *_mesg);
@@ -1094,7 +1094,7 @@ done:
--------------------------------------------------------------------------*/
static void *
H5O_dtype_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
- unsigned *ioflags/*in,out*/, const uint8_t *p)
+ unsigned *ioflags/*in,out*/, size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5T_t *dt = NULL;
void *ret_value = NULL; /* Return value */
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index ba7a6ee..f066964 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -28,7 +28,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_efl_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_efl_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_efl_copy(const void *_mesg, void *_dest);
static size_t H5O_efl_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -88,7 +88,8 @@ const H5O_msg_class_t H5O_MSG_EFL[1] = {{
*/
static void *
H5O_efl_decode(H5F_t *f, hid_t dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_efl_t *mesg = NULL;
int version;
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index 74f69d1..849435c 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -33,11 +33,11 @@
static void *H5O_fill_old_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_fill_old_encode(H5F_t *f, uint8_t *p, const void *_mesg);
static size_t H5O_fill_old_size(const H5F_t *f, const void *_mesg);
static void *H5O_fill_new_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_fill_new_encode(H5F_t *f, uint8_t *p, const void *_mesg);
static size_t H5O_fill_new_size(const H5F_t *f, const void *_mesg);
static void *H5O_fill_copy(const void *_mesg, void *_dest);
@@ -193,7 +193,8 @@ H5FL_BLK_EXTERN(type_conv);
*/
static void *
H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_fill_t *fill = NULL;
void *ret_value = NULL; /* Return value */
@@ -307,7 +308,8 @@ done:
*/
static void *
H5O_fill_old_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_fill_t *fill = NULL; /* Decoded fill value message */
void *ret_value = NULL; /* Return value */
diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c
index 4d62f49..8369ae1 100644
--- a/src/H5Ofsinfo.c
+++ b/src/H5Ofsinfo.c
@@ -32,7 +32,8 @@
#include "H5Opkg.h" /* Object headers */
/* PRIVATE PROTOTYPES */
-static void *H5O_fsinfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+static void *H5O_fsinfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags,
+ unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_fsinfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_fsinfo_copy(const void *_mesg, void *_dest);
static size_t H5O_fsinfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -86,7 +87,8 @@ H5FL_DEFINE_STATIC(H5O_fsinfo_t);
*/
static void *
H5O_fsinfo_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_fsinfo_t *fsinfo = NULL; /* File space info message */
H5F_mem_page_t ptype; /* Memory type for iteration */
diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c
index 468e07a..e551f28 100644
--- a/src/H5Oginfo.c
+++ b/src/H5Oginfo.c
@@ -33,7 +33,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_ginfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_ginfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_ginfo_copy(const void *_mesg, void *_dest);
static size_t H5O_ginfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -95,7 +95,8 @@ H5FL_DEFINE_STATIC(H5O_ginfo_t);
*/
static void *
H5O_ginfo_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_ginfo_t *ginfo = NULL; /* Pointer to group information message */
unsigned char flags; /* Flags for encoding group info */
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 85d7791..553013c 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -39,7 +39,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O__layout_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O__layout_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O__layout_copy(const void *_mesg, void *_dest);
static size_t H5O__layout_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -101,7 +101,8 @@ H5FL_DEFINE(H5O_layout_t);
*/
static void *
H5O__layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_layout_t *mesg = NULL;
uint8_t *heap_block = NULL;
diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c
index cac4ed1..9917927 100644
--- a/src/H5Olinfo.c
+++ b/src/H5Olinfo.c
@@ -37,7 +37,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_linfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_linfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_linfo_copy(const void *_mesg, void *_dest);
static size_t H5O_linfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -114,7 +114,8 @@ H5FL_DEFINE_STATIC(H5O_linfo_t);
*/
static void *
H5O_linfo_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_linfo_t *linfo = NULL; /* Link info */
unsigned char index_flags; /* Flags for encoding link index info */
diff --git a/src/H5Olink.c b/src/H5Olink.c
index 77872ad..7e7885c 100644
--- a/src/H5Olink.c
+++ b/src/H5Olink.c
@@ -39,7 +39,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_link_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_link_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_link_copy(const void *_mesg, void *_dest);
static size_t H5O_link_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -118,7 +118,8 @@ H5FL_DEFINE_STATIC(H5O_link_t);
*/
static void *
H5O_link_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_link_t *lnk = NULL; /* Pointer to link message */
size_t len = 0; /* Length of a string in the message */
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index 158701b..809c6e9 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -1811,7 +1811,7 @@ done:
*/
void *
H5O_msg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id,
- const unsigned char *buf)
+ size_t buf_size, const unsigned char *buf)
{
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
unsigned ioflags = 0; /* Flags for decode routine */
@@ -1826,7 +1826,7 @@ H5O_msg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id,
HDassert(type);
/* decode */
- if((ret_value = (type->decode)(f, dxpl_id, open_oh, 0, &ioflags, buf)) == NULL)
+ if((ret_value = (type->decode)(f, dxpl_id, open_oh, 0, &ioflags, buf_size, buf)) == NULL)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode message")
done:
diff --git a/src/H5Omtime.c b/src/H5Omtime.c
index 7e7baea..47bc0b1 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -28,12 +28,12 @@
static void *H5O_mtime_new_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_mtime_new_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static size_t H5O_mtime_new_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
static void *H5O_mtime_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_mtime_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_mtime_copy(const void *_mesg, void *_dest);
static size_t H5O_mtime_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -119,7 +119,8 @@ H5FL_DEFINE(time_t);
*/
static void *
H5O_mtime_new_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
time_t *mesg;
uint32_t tmp_time; /* Temporary copy of the time */
@@ -175,7 +176,8 @@ done:
*/
static void *
H5O_mtime_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
time_t *mesg, the_time;
struct tm tm;
diff --git a/src/H5Oname.c b/src/H5Oname.c
index 6292883..627a0f5 100644
--- a/src/H5Oname.c
+++ b/src/H5Oname.c
@@ -33,7 +33,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_name_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_name_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_name_copy(const void *_mesg, void *_dest);
static size_t H5O_name_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -84,7 +84,8 @@ const H5O_msg_class_t H5O_MSG_NAME[1] = {{
*/
static void *
H5O_name_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_name_t *mesg;
void *ret_value = NULL; /* Return value */
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 649ee3b..e970406 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -186,7 +186,7 @@
\
/* Decode the message */ \
HDassert(msg_type->decode); \
- if(NULL == ((MSG)->native = (msg_type->decode)((F), (DXPL), (OH), (MSG)->flags, &ioflags, (MSG)->raw))) \
+ if(NULL == ((MSG)->native = (msg_type->decode)((F), (DXPL), (OH), (MSG)->flags, &ioflags, (MSG)->raw_size, (MSG)->raw))) \
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, ERR, "unable to decode message") \
\
/* Mark the message dirty if it was changed by decoding */ \
@@ -228,7 +228,7 @@ struct H5O_msg_class_t {
const char *name; /*for debugging */
size_t native_size; /*size of native message */
unsigned share_flags; /* Message sharing settings */
- void *(*decode)(H5F_t *, hid_t, H5O_t *, unsigned, unsigned *, const uint8_t *);
+ void *(*decode)(H5F_t *, hid_t, H5O_t *, unsigned, unsigned *, size_t, const uint8_t *);
herr_t (*encode)(H5F_t *, hbool_t, uint8_t *, const void *);
void *(*copy)(const void *, void *); /*copy native value */
size_t (*raw_size)(const H5F_t *, hbool_t, const void *);/*sizeof encoded message */
diff --git a/src/H5Opline.c b/src/H5Opline.c
index e817f9a..e59e192 100644
--- a/src/H5Opline.c
+++ b/src/H5Opline.c
@@ -34,7 +34,7 @@
/* PRIVATE PROTOTYPES */
static herr_t H5O_pline_encode(H5F_t *f, uint8_t *p, const void *mesg);
static void *H5O_pline_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static void *H5O_pline_copy(const void *_mesg, void *_dest);
static size_t H5O_pline_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_pline_reset(void *_mesg);
@@ -115,12 +115,14 @@ H5FL_DEFINE(H5O_pline_t);
*/
static void *
H5O_pline_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t p_size, const uint8_t *p)
{
H5O_pline_t *pline = NULL; /* Pipeline message */
H5Z_filter_info_t *filter; /* Filter to decode */
size_t name_length; /* Length of filter name */
size_t i; /* Local index variable */
+ const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -130,17 +132,24 @@ H5O_pline_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5
/* Allocate space for I/O pipeline message */
if(NULL == (pline = H5FL_CALLOC(H5O_pline_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Version */
pline->version = *p++;
if(pline->version < H5O_PLINE_VERSION_1 || pline->version > H5O_PLINE_VERSION_LATEST)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, NULL, "bad version number for filter pipeline message")
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, NULL, "bad version number for filter pipeline message")
/* Number of filters */
pline->nused = *p++;
- if(pline->nused > H5Z_MAX_NFILTERS)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, NULL, "filter pipeline message has too many filters")
+ if(pline->nused > H5Z_MAX_NFILTERS) {
+
+ /* Reset the number of filters used to avoid array traversal in error
+ * handling code.
+ */
+ pline->nused = 0;
+
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, NULL, "filter pipeline message has too many filters")
+ }
/* Reserved */
if(pline->version == H5O_PLINE_VERSION_1)
@@ -149,12 +158,12 @@ H5O_pline_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5
/* Allocate array for filters */
pline->nalloc = pline->nused;
if(NULL == (pline->filter = (H5Z_filter_info_t *)H5MM_calloc(pline->nalloc * sizeof(pline->filter[0]))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Decode filters */
for(i = 0, filter = &pline->filter[0]; i < pline->nused; i++, filter++) {
/* Filter ID */
- UINT16DECODE(p, filter->id);
+ UINT16DECODE(p, filter->id);
/* Length of filter name */
if(pline->version > H5O_PLINE_VERSION_1 && filter->id < H5Z_FILTER_RESERVED)
@@ -166,18 +175,18 @@ H5O_pline_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5
} /* end if */
/* Filter flags */
- UINT16DECODE(p, filter->flags);
+ UINT16DECODE(p, filter->flags);
/* Number of filter parameters ("client data elements") */
- UINT16DECODE(p, filter->cd_nelmts);
+ UINT16DECODE(p, filter->cd_nelmts);
/* Filter name, if there is one */
- if(name_length) {
+ if(name_length) {
size_t actual_name_length; /* Actual length of name */
/* Determine actual name length (without padding, but with null terminator) */
- actual_name_length = HDstrlen((const char *)p) + 1;
- HDassert(actual_name_length <= name_length);
+ actual_name_length = HDstrlen((const char *)p) + 1;
+ HDassert(actual_name_length <= name_length);
/* Allocate space for the filter name, or use the internal buffer */
if(actual_name_length > H5Z_COMMON_NAME_LEN) {
@@ -188,12 +197,12 @@ H5O_pline_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5
else
filter->name = filter->_name;
- HDstrncpy(filter->name, (const char *)p, actual_name_length);
- p += name_length;
- } /* end if */
+ HDstrncpy(filter->name, (const char *)p, actual_name_length);
+ p += name_length;
+ } /* end if */
/* Filter parameters */
- if(filter->cd_nelmts) {
+ if(filter->cd_nelmts) {
size_t j; /* Local index variable */
/* Allocate space for the client data elements, or use the internal buffer */
@@ -205,15 +214,20 @@ H5O_pline_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5
else
filter->cd_values = filter->_cd_values;
- /*
- * Read the client data values and the padding
- */
- for(j = 0; j < filter->cd_nelmts; j++)
- UINT32DECODE(p, filter->cd_values[j]);
+ /*
+ * Read the client data values and the padding
+ */
+ for (j = 0; j < filter->cd_nelmts; j++) {
+ if (p + 4 - 1 <= p_end)
+ UINT32DECODE(p, filter->cd_values[j])
+ else
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "ran off the end of the buffer: current p = %p, p_size = %zu, p_end = %p", p, p_size, p_end)
+ }
+
if(pline->version == H5O_PLINE_VERSION_1)
if(filter->cd_nelmts % 2)
p += 4; /*padding*/
- } /* end if */
+ } /* end if */
} /* end for */
/* Set return value */
@@ -502,23 +516,30 @@ H5O_pline_reset(void *mesg)
FUNC_ENTER_NOAPI_NOINIT_NOERR
+ /* NOTE: This function can be called during error processing from
+ * other API calls so DO NOT ASSUME THAT ANY VALUES ARE SANE.
+ */
+
HDassert(pline);
- /* Free information for each filter */
- for(i = 0; i < pline->nused; i++) {
- if(pline->filter[i].name && pline->filter[i].name != pline->filter[i]._name)
- HDassert((HDstrlen(pline->filter[i].name) + 1) > H5Z_COMMON_NAME_LEN);
- if(pline->filter[i].name != pline->filter[i]._name)
- pline->filter[i].name = (char *)H5MM_xfree(pline->filter[i].name);
- if(pline->filter[i].cd_values && pline->filter[i].cd_values != pline->filter[i]._cd_values)
- HDassert(pline->filter[i].cd_nelmts > H5Z_COMMON_CD_VALUES);
- if(pline->filter[i].cd_values != pline->filter[i]._cd_values)
- pline->filter[i].cd_values = (unsigned *)H5MM_xfree(pline->filter[i].cd_values);
- } /* end for */
+ /* Free the filter information and array */
+ if (pline->filter) {
+
+ /* Free information for each filter */
+ for(i = 0; i < pline->nused; i++) {
+ if(pline->filter[i].name && pline->filter[i].name != pline->filter[i]._name)
+ HDassert((HDstrlen(pline->filter[i].name) + 1) > H5Z_COMMON_NAME_LEN);
+ if(pline->filter[i].name != pline->filter[i]._name)
+ pline->filter[i].name = (char *)H5MM_xfree(pline->filter[i].name);
+ if(pline->filter[i].cd_values && pline->filter[i].cd_values != pline->filter[i]._cd_values)
+ HDassert(pline->filter[i].cd_nelmts > H5Z_COMMON_CD_VALUES);
+ if(pline->filter[i].cd_values != pline->filter[i]._cd_values)
+ pline->filter[i].cd_values = (unsigned *)H5MM_xfree(pline->filter[i].cd_values);
+ } /* end for */
- /* Free filter array */
- if(pline->filter)
+ /* Free filter array */
pline->filter = (H5Z_filter_info_t *)H5MM_xfree(pline->filter);
+ }
/* Reset # of filters */
pline->nused = pline->nalloc = 0;
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 2253bb2..9f01a9a 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -935,7 +935,7 @@ H5_DLL herr_t H5O_msg_get_crt_index(unsigned type_id, const void *mesg,
H5_DLL herr_t H5O_msg_encode(H5F_t *f, unsigned type_id, hbool_t disable_shared,
unsigned char *buf, const void *obj);
H5_DLL void* H5O_msg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned type_id, const unsigned char *buf);
+ unsigned type_id, size_t buf_size, const unsigned char *buf);
H5_DLL herr_t H5O_msg_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
unsigned type_id, void *mesg);
H5_DLL herr_t H5O_msg_get_flags(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id, uint8_t *flags);
diff --git a/src/H5Orefcount.c b/src/H5Orefcount.c
index af68417..6f052ce 100644
--- a/src/H5Orefcount.c
+++ b/src/H5Orefcount.c
@@ -33,7 +33,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_refcount_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_refcount_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_refcount_copy(const void *_mesg, void *_dest);
static size_t H5O_refcount_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -90,7 +90,8 @@ H5FL_DEFINE_STATIC(H5O_refcount_t);
*/
static void *
H5O_refcount_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_refcount_t *refcount = NULL; /* Reference count */
void *ret_value = NULL; /* Return value */
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index 12a9bb6..f5d3c61 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -26,7 +26,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_sdspace_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg);
static void *H5O_sdspace_copy(const void *_mesg, void *_dest);
static size_t H5O_sdspace_size(const H5F_t *f, const void *_mesg);
@@ -110,7 +110,8 @@ H5FL_ARR_EXTERN(hsize_t);
--------------------------------------------------------------------------*/
static void *
H5O_sdspace_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5S_extent_t *sdim = NULL;/* New extent dimensionality structure */
unsigned flags, version;
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index db2d0cc..9217d3d 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -156,7 +156,7 @@ H5O_shared_read(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned *ioflags,
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "can't read message from fractal heap.")
/* Decode the message */
- if(NULL == (ret_value = (type->decode)(f, dxpl_id, open_oh, 0, ioflags, mesg_ptr)))
+ if(NULL == (ret_value = (type->decode)(f, dxpl_id, open_oh, 0, ioflags, mesg_size, mesg_ptr)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "can't decode shared message.")
} /* end if */
else {
diff --git a/src/H5Oshared.h b/src/H5Oshared.h
index 2465e65..93cc11f 100644
--- a/src/H5Oshared.h
+++ b/src/H5Oshared.h
@@ -47,7 +47,7 @@
*/
static H5_INLINE void *
H5O_SHARED_DECODE(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags,
- unsigned *ioflags, const uint8_t *p)
+ unsigned *ioflags, size_t p_size, const uint8_t *p)
{
void *ret_value = NULL; /* Return value */
@@ -67,7 +67,7 @@ H5O_SHARED_DECODE(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags,
if(mesg_flags & H5O_MSG_FLAG_SHARED) {
/* Retrieve native message info indirectly through shared message */
if(NULL == (ret_value = H5O_shared_decode(f, dxpl_id, open_oh, ioflags, p, H5O_SHARED_TYPE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message")
/* We currently do not support automatically fixing shared messages */
#ifdef H5_STRICT_FORMAT_CHECKS
@@ -79,8 +79,8 @@ H5O_SHARED_DECODE(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags,
} /* end if */
else {
/* Decode native message directly */
- if(NULL == (ret_value = H5O_SHARED_DECODE_REAL(f, dxpl_id, open_oh, mesg_flags, ioflags, p)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode native message")
+ if(NULL == (ret_value = H5O_SHARED_DECODE_REAL(f, dxpl_id, open_oh, mesg_flags, ioflags, p_size, p)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode native message")
} /* end else */
done:
diff --git a/src/H5Oshmesg.c b/src/H5Oshmesg.c
index 1cbfb05..f3fe9d1 100644
--- a/src/H5Oshmesg.c
+++ b/src/H5Oshmesg.c
@@ -28,7 +28,7 @@
#include "H5MMprivate.h" /* Memory management */
static void *H5O_shmesg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_shmesg_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_shmesg_copy(const void *_mesg, void *_dest);
static size_t H5O_shmesg_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -76,7 +76,8 @@ const H5O_msg_class_t H5O_MSG_SHMESG[1] = {{
*/
static void *
H5O_shmesg_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_shmesg_table_t *mesg; /* Native message */
void *ret_value = NULL; /* Return value */
diff --git a/src/H5Ostab.c b/src/H5Ostab.c
index 5c840a6..6f02d72 100644
--- a/src/H5Ostab.c
+++ b/src/H5Ostab.c
@@ -36,7 +36,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_stab_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_stab_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_stab_copy(const void *_mesg, void *_dest);
static size_t H5O_stab_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -97,7 +97,8 @@ H5FL_DEFINE_STATIC(H5O_stab_t);
*/
static void *
H5O_stab_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_stab_t *stab = NULL;
void *ret_value = NULL; /* Return value */
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index 3b4c159..894f6cb 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -1115,7 +1115,7 @@ H5P__dcrt_fill_value_dec(const void **_pp, void *_value)
dt_size = (size_t)enc_value;
/* Decode type */
- if(NULL == (fill->type = H5T_decode(*pp)))
+ if(NULL == (fill->type = H5T_decode(dt_size, *pp)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "can't decode fill value datatype")
*pp += dt_size;
} /* end if */
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 7802535..148c247 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -387,7 +387,7 @@ static const size_t H5F_def_page_buf_size_g = H5F_ACS_PAGE_BUFFER_SIZE_DEF;
static const unsigned H5F_def_page_buf_min_meta_perc_g = H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEF; /* Default page buffer minimum metadata size */
static const unsigned H5F_def_page_buf_min_raw_perc_g = H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEF; /* Default page buffer minumum raw data size */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_reg_prop
*
@@ -627,7 +627,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_reg_prop() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_alignment
*
@@ -685,7 +685,7 @@ done:
FUNC_LEAVE_API(ret_value)
}
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_alignment
*
@@ -726,7 +726,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_alignment() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_set_driver
*
@@ -774,7 +774,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_set_driver() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_driver
*
@@ -817,7 +817,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_driver() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_peek_driver
*
@@ -861,7 +861,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_peek_driver() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_driver
*
@@ -902,7 +902,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_driver() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_peek_driver_info
*
@@ -944,7 +944,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_peek_driver_info() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_driver_info
*
@@ -984,7 +984,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_driver_info() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__file_driver_copy
*
@@ -1050,7 +1050,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__file_driver_copy() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__file_driver_free
*
@@ -1102,7 +1102,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__file_driver_free() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_driver_create
*
@@ -1131,7 +1131,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_create() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_driver_set
*
@@ -1164,7 +1164,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_set() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_driver_get
*
@@ -1197,7 +1197,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_get() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_driver_del
*
@@ -1226,7 +1226,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_del() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_driver_copy
*
@@ -1255,7 +1255,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_copy() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_driver_cmp
*
@@ -1314,7 +1314,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_cmp() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_driver_close
*
@@ -1343,7 +1343,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_close() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_family_offset
*
@@ -1382,7 +1382,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_family_offset() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_family_offset
*
@@ -1423,7 +1423,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_family_offset() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_multi_type
*
@@ -1462,7 +1462,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_multi_type() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_multi_type
*
@@ -1503,7 +1503,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_multi_type() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_cache
*
@@ -1557,7 +1557,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_cache() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_cache
*
@@ -1609,7 +1609,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_cache() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_mdc_image_config
*
@@ -1653,7 +1653,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pset_mdc_image_config() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_mdc_image_config
*
@@ -1704,7 +1704,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pget_mdc_image_config() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_mdc_config
*
@@ -1748,7 +1748,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pset_mdc_config() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_mdc_config
*
@@ -1799,7 +1799,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pget_mdc_config() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_gc_references
*
@@ -1852,7 +1852,7 @@ done:
FUNC_LEAVE_API(ret_value)
}
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_gc_references
*
@@ -1895,7 +1895,7 @@ done:
FUNC_LEAVE_API(ret_value)
}
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_fclose_degree
*
@@ -1931,7 +1931,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_fclose_degree() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_fclose_degree
*
@@ -1966,7 +1966,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_fclose_degree() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_meta_block_size
*
@@ -2017,7 +2017,7 @@ done:
FUNC_LEAVE_API(ret_value)
}
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_meta_block_size
*
@@ -2061,7 +2061,7 @@ done:
FUNC_LEAVE_API(ret_value)
}
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_sieve_buf_size
*
@@ -2112,7 +2112,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_sieve_buf_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_sieve_buf_size
*
@@ -2155,7 +2155,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_sieve_buf_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_small_data_block_size
*
@@ -2201,7 +2201,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_small_data_block_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_small_data_block_size
*
@@ -2240,7 +2240,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_small_data_block_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_libver_bounds
*
@@ -2338,7 +2338,7 @@ done:
* 5) H5F_LIBVER_LATEST, H5F_LIBVER_LATEST
* See detailed description in the RFC: Setting Bounds for Object Creation in HDF5 1.10.0.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Sunday, December 30, 2007
@@ -2382,11 +2382,11 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_libver_bounds() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_libver_bounds
*
- * Purpose: Returns the current settings for the library version format bounds
+ * Purpose: Returns the current settings for the library version format bounds
* from a file access property list.
*
* Return: Non-negative on success/Negative on failure
@@ -2409,7 +2409,7 @@ H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low/*out*/,
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
-
+
/* Get values */
if(low) {
if(H5P_get(plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, low) < 0)
@@ -2425,7 +2425,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_libver_bounds() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_elink_file_cache_size
*
@@ -2463,7 +2463,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_elink_file_cache_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_elink_file_cache_size
*
@@ -2502,7 +2502,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_elink_file_cache_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_file_image
*
@@ -2583,7 +2583,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_file_image() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_file_image
*
@@ -2672,7 +2672,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_file_image */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_file_image_callbacks
*
@@ -2749,7 +2749,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_file_image_callbacks() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_file_image_callbacks
*
@@ -2805,7 +2805,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_file_image_callbacks() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__file_image_info_copy
*
@@ -2883,7 +2883,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__file_image_info_copy() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__file_image_info_free
*
@@ -2938,7 +2938,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__file_image_info_free() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_cache_image_config_cmp
*
@@ -2981,7 +2981,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_cache_image_config_cmp() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_cache_image_config_enc
*
@@ -3027,7 +3027,7 @@ H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_cache_image_config_enc() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_cache_image_config_dec
*
@@ -3079,7 +3079,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_cache_image_config_dec() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_image_info_set
*
@@ -3112,7 +3112,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_image_info_set() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_image_info_get
*
@@ -3145,7 +3145,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_image_info_get() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_image_info_del
*
@@ -3176,7 +3176,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_image_info_del() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_image_info_copy
*
@@ -3206,7 +3206,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_image_info_copy() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_image_info_cmp
*
@@ -3265,7 +3265,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_image_info_cmp() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_image_info_close
*
@@ -3295,7 +3295,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_image_info_close() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_cache_config_cmp
*
@@ -3407,7 +3407,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_cache_config_cmp() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_cache_config_enc
*
@@ -3552,7 +3552,7 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_cache_config_enc() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_cache_config_dec
*
@@ -3687,7 +3687,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_cache_config_dec() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_fclose_degree_enc
*
@@ -3725,7 +3725,7 @@ H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_fclose_degree_enc() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_fclose_degree_dec
*
@@ -3760,7 +3760,7 @@ H5P__facc_fclose_degree_dec(const void **_pp, void *_value)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_fclose_degree_dec() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_multi_type_enc
*
@@ -3798,7 +3798,7 @@ H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_multi_type_enc() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_multi_type_dec
*
@@ -3833,7 +3833,7 @@ H5P__facc_multi_type_dec(const void **_pp, void *_value)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_multi_type_dec() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_libver_type_enc
*
@@ -3841,10 +3841,10 @@ H5P__facc_multi_type_dec(const void **_pp, void *_value)
* 'high' bound of library format versions property in the
* file access property list is encoded.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer
+ * Programmer
*
*-------------------------------------------------------------------------
*/
@@ -3870,7 +3870,7 @@ H5P__facc_libver_type_enc(const void *value, void **_pp, size_t *size)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_libver_type_enc() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_libver_type_dec
*
@@ -3878,10 +3878,10 @@ H5P__facc_libver_type_enc(const void *value, void **_pp, size_t *size)
* 'high' bound of library format versions property in the
* file access property list is decoded.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer:
+ * Programmer:
*
*-------------------------------------------------------------------------
*/
@@ -3904,9 +3904,9 @@ H5P__facc_libver_type_dec(const void **_pp, void *_value)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_libver_type_dec() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5Pset_core_write_tracking
+ * Function: H5Pset_core_write_tracking
*
* Purpose: Enables/disables core VFD write tracking and page
* aggregation size.
@@ -3945,7 +3945,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_core_write_tracking() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_core_write_tracking
*
@@ -3987,7 +3987,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_core_write_tracking() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_metadata_read_attempts
*
@@ -4030,7 +4030,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pset_metadata_read_attempts() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_metadata_read_attempts
*
@@ -4071,7 +4071,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_metadata_read_attempts() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_obj_flush_cb
*
@@ -4115,7 +4115,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pset_obj_flush_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_obj_flush_cb
*
@@ -4156,7 +4156,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pget_obj_flush_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_mdc_log_options
*
@@ -4208,7 +4208,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_mdc_log_options() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_mdc_log_options
*
@@ -4263,7 +4263,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_mdc_log_options() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_facc_mdc_log_location_enc
*
@@ -4316,7 +4316,7 @@ H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P_facc_mdc_log_location_enc() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_facc_mdc_log_location_dec
*
@@ -4370,7 +4370,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_facc_mdc_log_location_dec() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_facc_mdc_log_location_del
*
@@ -4393,7 +4393,7 @@ H5P_facc_mdc_log_location_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_U
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P_facc_mdc_log_location_del() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_facc_mdc_log_location_copy
*
@@ -4415,7 +4415,7 @@ H5P_facc_mdc_log_location_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_U
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P_facc_mdc_log_location_copy() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_facc_mdc_log_location_cmp
*
@@ -4447,7 +4447,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_facc_mdc_log_location_cmp() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_facc_mdc_log_location_close
*
@@ -4470,7 +4470,7 @@ H5P_facc_mdc_log_location_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P_facc_mdc_log_location_close() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_evict_on_close
*
@@ -4511,14 +4511,14 @@ H5Pset_evict_on_close(hid_t fapl_id, hbool_t evict_on_close)
if(H5P_set(plist, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, &evict_on_close) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set evict on close property")
#else
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "evict on close is currently not supported in parallel HDF5")
+ HGOTO_ERROR(H5E_PLIST, H5E_UNSUPPORTED, FAIL, "evict on close is currently not supported in parallel HDF5")
#endif /* H5_HAVE_PARALLEL */
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_evict_on_close() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_evict_on_close
*
@@ -4562,7 +4562,7 @@ done:
} /* end H5Pget_evict_on_close() */
#ifdef H5_HAVE_PARALLEL
-
+
/*-------------------------------------------------------------------------
* Function: H5P__encode_coll_md_read_flag_t
*
@@ -4600,7 +4600,7 @@ H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__encode_coll_md_read_flag_t() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__decode_coll_md_read_flag_t
*
@@ -4634,7 +4634,7 @@ H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__decode_coll_md_read_flag_t() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_all_coll_metadata_ops
*
@@ -4693,7 +4693,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_all_coll_metadata_ops() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_all_coll_metadata_ops
*
@@ -4751,7 +4751,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pget_all_coll_metadata_ops */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_coll_metadata_write
*
@@ -4790,7 +4790,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_coll_metadata_write() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_coll_metadata_write
*
@@ -4828,7 +4828,7 @@ done:
} /* end H5Pget_coll_metadata_write() */
#endif /* H5_HAVE_PARALLEL */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_page_buffer_size
*
@@ -4876,7 +4876,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_page_buffer_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_page_buffer_size
*
diff --git a/src/H5S.c b/src/H5S.c
index 8f3e132..c2f7d3f 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -1730,8 +1730,8 @@ H5S_decode(const unsigned char **p)
/* Decode the extent part of dataspace */
/* (pass mostly bogus file pointer and bogus DXPL) */
- if((extent = (H5S_extent_t *)H5O_msg_decode(f, H5P_DEFAULT, NULL, H5O_SDSPACE_ID, pp))==NULL)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode object")
+ if((extent = (H5S_extent_t *)H5O_msg_decode(f, H5P_DEFAULT, NULL, H5O_SDSPACE_ID, extent_size, pp)) == NULL)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode object")
pp += extent_size;
/* Copy the extent into dataspace structure */
diff --git a/src/H5SM.c b/src/H5SM.c
index d5ede7e..8e28529 100644
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -70,7 +70,7 @@ static herr_t H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
static herr_t H5SM_decr_ref(void *record, void *op_data, hbool_t *changed);
static herr_t H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
H5SM_index_header_t *header, const H5O_shared_t * mesg,
- unsigned *cache_flags, void ** /*out*/ encoded_mesg);
+ unsigned *cache_flags, size_t * /*out*/ mesg_size, void ** /*out*/ encoded_mesg);
static herr_t H5SM_type_to_flag(unsigned type_id, unsigned *type_flag);
static herr_t H5SM_read_iter_op(H5O_t *oh, H5O_mesg_t *mesg, unsigned sequence,
unsigned *oh_modified, void *_udata);
@@ -1549,6 +1549,7 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg)
unsigned cache_flags = H5AC__NO_FLAGS_SET;
H5SM_table_cache_ud_t cache_udata; /* User-data for callback */
ssize_t index_num;
+ size_t mesg_size = 0;
void *mesg_buf = NULL;
void *native_mesg = NULL;
unsigned type_id; /* Message type ID to operate on */
@@ -1578,8 +1579,8 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg)
* zero and any file space it uses needs to be freed. mesg_buf holds the
* serialized form of the message.
*/
- if(H5SM_delete_from_index(f, dxpl_id, open_oh, &(table->indexes[index_num]), sh_mesg, &cache_flags, &mesg_buf) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to delete mesage from SOHM index")
+ if(H5SM_delete_from_index(f, dxpl_id, open_oh, &(table->indexes[index_num]), sh_mesg, &cache_flags, &mesg_size, &mesg_buf) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to delete mesage from SOHM index")
/* Release the master SOHM table */
if(H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, cache_flags) < 0)
@@ -1591,7 +1592,7 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg)
* master table needs to be unprotected when we do this.
*/
if(mesg_buf) {
- if(NULL == (native_mesg = H5O_msg_decode(f, dxpl_id, open_oh, type_id, (const unsigned char *)mesg_buf)))
+ if(NULL == (native_mesg = H5O_msg_decode(f, dxpl_id, open_oh, type_id, mesg_size, (const unsigned char *)mesg_buf)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTDECODE, FAIL, "can't decode shared message.")
if(H5O_msg_delete(f, dxpl_id, open_oh, type_id, native_mesg) < 0)
@@ -1778,7 +1779,7 @@ H5SM_decr_ref(void *record, void *op_data, hbool_t *changed)
static herr_t
H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
H5SM_index_header_t *header, const H5O_shared_t *mesg,
- unsigned *cache_flags, void ** /*out*/ encoded_mesg)
+ unsigned *cache_flags, size_t * /*out*/ mesg_size, void ** /*out*/ encoded_mesg)
{
H5SM_list_t *list = NULL;
H5SM_mesg_key_t key;
@@ -1910,6 +1911,7 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
/* Return the message's encoding so anything it references can be freed */
*encoded_mesg = encoding_buf;
+ *mesg_size = buf_size;
/* If there are no messages left in the index, delete it */
if(header->num_messages == 0) {
@@ -1951,8 +1953,10 @@ done:
/* Free the message encoding, if we're not returning it in encoded_mesg
* or if there's been an error.
*/
- if(encoding_buf && (NULL == *encoded_mesg || ret_value < 0))
+ if(encoding_buf && (NULL == *encoded_mesg || ret_value < 0)) {
encoding_buf = H5MM_xfree(encoding_buf);
+ *mesg_size = 0;
+ }
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
} /* end H5SM_delete_from_index() */
diff --git a/src/H5T.c b/src/H5T.c
index ffa7bcb..3baa193 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -2822,8 +2822,13 @@ H5Tdecode(const void *buf)
if(buf == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer")
- /* Create datatype by decoding buffer */
- if(NULL == (dt = H5T_decode((const unsigned char *)buf)))
+ /* Create datatype by decoding buffer
+ * There is no way to get the size of the buffer, so we pass in
+ * SIZE_MAX and assume the caller knows what they are doing.
+ * Really fixing this will require an H5Tdecode2() call that
+ * takes a size parameter.
+ */
+ if(NULL == (dt = H5T_decode(SIZE_MAX, (const unsigned char *)buf)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "can't decode object")
/* Register the type and return the ID */
@@ -2912,7 +2917,7 @@ done:
*-------------------------------------------------------------------------
*/
H5T_t *
-H5T_decode(const unsigned char *buf)
+H5T_decode(size_t buf_size, const unsigned char *buf)
{
H5F_t *f = NULL; /* Fake file structure*/
H5T_t *ret_value = NULL; /* Return value */
@@ -2932,7 +2937,7 @@ H5T_decode(const unsigned char *buf)
HGOTO_ERROR(H5E_DATATYPE, H5E_VERSION, NULL, "unknown version of encoded datatype")
/* Decode the serialized datatype message */
- if(NULL == (ret_value = (H5T_t *)H5O_msg_decode(f, H5AC_noio_dxpl_id, NULL, H5O_DTYPE_ID, buf)))
+ if(NULL == (ret_value = (H5T_t *)H5O_msg_decode(f, H5AC_noio_dxpl_id, NULL, H5O_DTYPE_ID, buf_size, buf)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode object")
/* Mark datatype as being in memory now */
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 5272361..61e7c79 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -114,7 +114,7 @@ H5_DLL htri_t H5T_detect_class(const H5T_t *dt, H5T_class_t cls, hbool_t from_ap
H5_DLL size_t H5T_get_size(const H5T_t *dt);
H5_DLL int H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset);
H5_DLL herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc);
-H5_DLL H5T_t *H5T_decode(const unsigned char *buf);
+H5_DLL H5T_t *H5T_decode(size_t buf_size, const unsigned char *buf);
H5_DLL herr_t H5T_debug(const H5T_t *dt, FILE * stream);
H5_DLL struct H5O_loc_t *H5T_oloc(H5T_t *dt);
H5_DLL H5G_name_t *H5T_nameof(H5T_t *dt);
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index fd88b5f..b3b6f5c 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TEST)
#-----------------------------------------------------------------------------
diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake
index 995f4e0..be02110 100644
--- a/test/CMakeVFDTests.cmake
+++ b/test/CMakeVFDTests.cmake
@@ -32,8 +32,12 @@ endif ()
foreach (vfdtest ${VFD_LIST})
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}")
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles")
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles/plist_files")
if (BUILD_SHARED_LIBS)
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}-shared")
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles")
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles/plist_files")
endif ()
endforeach ()
@@ -64,6 +68,17 @@ foreach (vfdtest ${VFD_LIST})
endforeach ()
endforeach ()
+foreach (vfdtest ${VFD_LIST})
+ foreach (plistfile ${HDF5_REFERENCE_PLIST_FILES})
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles/plist_files/${plistfile}" "HDF5_VFDTEST_LIB_files")
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles/plist_files/def_${plistfile}" "HDF5_VFDTEST_LIB_files")
+ if (BUILD_SHARED_LIBS)
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles/plist_files/${plistfile}" "HDF5_VFDTEST_LIBSH_files")
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles/plist_files/def_${plistfile}" "HDF5_VFDTEST_LIBSH_files")
+ endif ()
+ endforeach ()
+endforeach ()
+
add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HDF5_VFDTEST_LIB tests" DEPENDS ${HDF5_VFDTEST_LIB_files_list})
if (BUILD_SHARED_LIBS)
add_custom_target(HDF5_VFDTEST_LIBSH_files ALL COMMENT "Copying files needed by HDF5_VFDTEST_LIBSH tests" DEPENDS ${HDF5_VFDTEST_LIBSH_files_list})
diff --git a/test/dsets.c b/test/dsets.c
index 17cf23c..0788bc8 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -750,10 +750,10 @@ test_compact_io(hid_t fapl)
hsize_t dims[2];
int wbuf[16][8], rbuf[16][8];
char filename[FILENAME_BUF_SIZE];
- H5F_libver_t low, high; /* File format bounds */
- H5F_t *fp; /* Internal file pointer */
- H5D_t *dsetp; /* Internal dataset pointer */
- int i, j, n;
+ H5F_libver_t low, high; /* File format bounds */
+ H5F_t *fp; /* Internal file pointer */
+ H5D_t *dsetp; /* Internal dataset pointer */
+ int i, j, n; /* Indices */
herr_t ret; /* Generic return value */
TESTING("compact dataset I/O");
diff --git a/test/dtypes.c b/test/dtypes.c
index 7e8047d..1a27634 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -18,7 +18,7 @@
* Purpose: Tests the datatype interface (H5T)
*/
-#include "h5test.h"
+#include "testhdf5.h"
#include "H5srcdir.h"
#include "H5Iprivate.h" /* For checking that datatype id's don't leak */
@@ -46,6 +46,16 @@
#define H5T_FRIEND /*suppress error about including H5Tpkg */
#include "H5Tpkg.h"
#endif
+
+/* Use in version bound test */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_TESTING
+#include "H5Fpkg.h" /* File access */
+
+/* Use in version bound test */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
+#include "H5Opkg.h" /* Object headers */
+
#define SET_ALIGNMENT(TYPE,VAL) \
H5T_NATIVE_##TYPE##_ALIGN_g=MAX(H5T_NATIVE_##TYPE##_ALIGN_g, VAL)
@@ -92,7 +102,15 @@ typedef enum dtype_t {
INT_SCHAR, INT_UCHAR, INT_SHORT, INT_USHORT, INT_INT, INT_UINT,
INT_LONG, INT_ULONG, INT_LLONG, INT_ULLONG, FLT_FLOAT, FLT_DOUBLE,
FLT_LDOUBLE, OTHER
-} dtype_t;
+} dtype_t; /* This doesn't seem to be used anywhere... -BMR */
+
+typedef enum {
+ E1_RED,
+ E1_GREEN,
+ E1_BLUE,
+ E1_ORANGE,
+ E1_YELLOW
+} color_t;
/* Constant for size of conversion buffer for int <-> float exception test */
#define CONVERT_SIZE 4
@@ -1678,7 +1696,7 @@ test_compound_9(void)
{
typedef struct cmpd_struct {
int i1;
- char* str;
+ const char* str;
int i2;
} cmpd_struct;
@@ -2526,7 +2544,7 @@ test_compound_14(void)
typedef struct cmpd_struct_1 {
char c1;
char c2;
- char* str;
+ const char* str;
} cmpd_struct_1;
typedef struct cmpd_struct_2 {
@@ -3299,7 +3317,7 @@ test_compound_18(void)
/* Create compound datatype, but don't insert fields */
tid = H5Tcreate(H5T_COMPOUND, (size_t)8);
- assert(tid > 0);
+ HDassert(tid > 0);
/* Attempt to create file with compound datatype that has no fields */
/* Create File */
@@ -3308,7 +3326,7 @@ test_compound_18(void)
/* Create a dataspace to use */
sid = H5Screate_simple(1, &dim, NULL);
- assert(sid > 0);
+ HDassert(sid > 0);
/* Create a dataset with the bad compound datatype */
H5E_BEGIN_TRY {
@@ -3321,7 +3339,7 @@ test_compound_18(void)
/* Create a group */
gid = H5Gcreate2(file, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- assert(gid > 0);
+ HDassert(gid > 0);
/* Create an attribute with the bad compound datatype */
H5E_BEGIN_TRY {
@@ -4672,7 +4690,7 @@ test_conv_enum_2(void)
/* Destination enum type */
dsttype = H5Tenum_create(H5T_NATIVE_INT);
- assert(H5Tget_size(dsttype) > H5Tget_size(srctype));
+ HDassert(H5Tget_size(dsttype) > H5Tget_size(srctype));
for (i=0; i<8; i++)
H5Tenum_insert(dsttype, mname[i], &i);
@@ -6682,7 +6700,7 @@ error:
} /* end test_named_indirect_reopen() */
static void create_del_obj_named_test_file(const char *filename, hid_t fapl,
- hbool_t new_format)
+ H5F_libver_t low, H5F_libver_t high)
{
hid_t file; /* File ID */
hid_t type; /* Datatype ID */
@@ -6692,93 +6710,97 @@ static void create_del_obj_named_test_file(const char *filename, hid_t fapl,
hid_t fcpl; /* File creation property list ID */
hid_t my_fapl; /* Copy of file access property list ID */
hid_t dcpl; /* Dataset creation property list ID */
+ unsigned use_at_least_v18;/* Whether to use old or new format */
herr_t status; /* Generic return value */
/* Make copy of FAPL */
my_fapl = H5Pcopy(fapl);
- assert(my_fapl > 0);
+ HDassert(my_fapl > 0);
- if(new_format) {
- /* Use latest version of file format */
- status = H5Pset_libver_bounds(my_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
- assert(status >= 0);
- } /* end if */
+ /* Use low/high version of file format */
+ status = H5Pset_libver_bounds(my_fapl, low, high);
+ HDassert(status >= 0);
+
+ /* Set new format flag. Note: the case high < low should be caught in the caller */
+ use_at_least_v18 = 0;
+ if (low >= H5F_LIBVER_V18)
+ use_at_least_v18 = 1;
/* Create a file creation property list (used for the root group's creation property list) */
fcpl = H5Pcreate(H5P_FILE_CREATE);
- assert(fcpl > 0);
+ HDassert(fcpl > 0);
- if(new_format) {
+ if(use_at_least_v18) {
/* Use dense link storage for all links in root group */
status = H5Pset_link_phase_change(fcpl, 0, 0);
- assert(status >= 0);
+ HDassert(status >= 0);
} /* end if */
/* Create file with attribute that uses committed datatype */
file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, my_fapl);
- assert(file > 0);
+ HDassert(file > 0);
/* Close FCPL */
status = H5Pclose(fcpl);
- assert(status >= 0);
+ HDassert(status >= 0);
/* Close FAPL */
status = H5Pclose(my_fapl);
- assert(status >= 0);
+ HDassert(status >= 0);
/* Create datatype to commit */
type = H5Tvlen_create(H5T_NATIVE_INT);
- assert(type > 0);
+ HDassert(type > 0);
/* Commit datatype */
status = H5Tcommit2(file, DEL_OBJ_NAMED_NAMED_DTYPE, type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- assert(status >= 0);
+ HDassert(status >= 0);
/* Create scalar dataspace */
space = H5Screate(H5S_SCALAR);
- assert(space > 0);
+ HDassert(space > 0);
/* Create a dataset creation property list */
dcpl = H5Pcreate(H5P_DATASET_CREATE);
- assert(dcpl > 0);
+ HDassert(dcpl > 0);
- if(new_format) {
+ if(use_at_least_v18) {
/* Use dense attribute storage for all attributes on dataset */
status = H5Pset_attr_phase_change(dcpl, 0, 0);
- assert(status >= 0);
+ HDassert(status >= 0);
} /* end if */
/* Create dataset */
dset = H5Dcreate2(file, DEL_OBJ_NAMED_DATASET, type, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- assert(dset > 0);
+ HDassert(dset > 0);
/* Close DCPL */
status = H5Pclose(dcpl);
- assert(status >= 0);
+ HDassert(status >= 0);
/* Close dataset */
status = H5Dclose(dset);
- assert(status >= 0);
+ HDassert(status >= 0);
/* Create attribute */
attr = H5Acreate_by_name(file, DEL_OBJ_NAMED_DATASET, DEL_OBJ_NAMED_ATTRIBUTE, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- assert(attr > 0);
+ HDassert(attr > 0);
/* Close dataspace */
status = H5Sclose(space);
- assert(status >= 0);
+ HDassert(status >= 0);
/* Close datatype */
status = H5Tclose(type);
- assert(status >= 0);
+ HDassert(status >= 0);
/* Close attribute */
status = H5Aclose(attr);
- assert(status >= 0);
+ HDassert(status >= 0);
/* Close file */
status = H5Fclose(file);
- assert(status >= 0);
+ HDassert(status >= 0);
} /* end create_del_obj_named_test_file() */
@@ -6803,7 +6825,7 @@ test_delete_obj_named(hid_t fapl)
hid_t attr = -1; /* Attribute ID */
hid_t dset = -1; /* Dataset ID */
hid_t fapl2 = -1; /* File access property list ID */
- unsigned new_format; /* Whether to use old or new format */
+ H5F_libver_t low, high; /* File format bounds */
char filename[1024], filename2[1024];
TESTING("deleting objects that use named datatypes");
@@ -6813,47 +6835,54 @@ test_delete_obj_named(hid_t fapl)
h5_fixname(FILENAME[8], fapl, filename, sizeof filename);
h5_fixname(FILENAME[9], fapl2, filename2, sizeof filename2);
- /* Loop over old & new format files */
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
- /* Create test file, with attribute that uses committed datatype */
- create_del_obj_named_test_file(filename, fapl, new_format);
+ /* Loop through all valid the combinations of low/high library format bounds,
+ to test delete objects that use named datatypes through different file IDs */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
-/* Test deleting dataset opened through different file ID */
- if((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
- if((filea2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ /* Skip invalid low/high combination */
+ if ((high == H5F_LIBVER_EARLIEST) || (low > high))
+ continue;
- if((dset = H5Dopen2(filea1, DEL_OBJ_NAMED_DATASET, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
+ /* Create test file, with attribute that uses committed datatype */
+ create_del_obj_named_test_file(filename, fapl, low, high);
- if(H5Fclose(filea1) < 0) FAIL_STACK_ERROR
+ /* Test deleting dataset opened through different file ID */
+ if((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if((filea2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
- if((fileb = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0) FAIL_STACK_ERROR
+ if((dset = H5Dopen2(filea1, DEL_OBJ_NAMED_DATASET, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
- if(H5Ldelete(filea2, DEL_OBJ_NAMED_DATASET, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Fclose(filea1) < 0) FAIL_STACK_ERROR
- if(H5Fclose(filea2) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fileb) < 0) FAIL_STACK_ERROR
+ if((fileb = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0) FAIL_STACK_ERROR
+ if(H5Ldelete(filea2, DEL_OBJ_NAMED_DATASET, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- /* Create test file, with attribute that uses committed datatype */
- create_del_obj_named_test_file(filename, fapl, new_format);
+ if(H5Fclose(filea2) < 0) FAIL_STACK_ERROR
+ if(H5Fclose(fileb) < 0) FAIL_STACK_ERROR
-/* Test deleting attribute opened through different file ID */
- if((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
- if((filea2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ /* Create test file, with attribute that uses committed datatype */
+ create_del_obj_named_test_file(filename, fapl, low, high);
- if((attr = H5Aopen_by_name(filea1, DEL_OBJ_NAMED_DATASET, DEL_OBJ_NAMED_ATTRIBUTE, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Aclose(attr) < 0) FAIL_STACK_ERROR
+ /* Test deleting attribute opened through different file ID */
+ if((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if((filea2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
- if(H5Fclose(filea1) < 0) FAIL_STACK_ERROR
+ if((attr = H5Aopen_by_name(filea1, DEL_OBJ_NAMED_DATASET, DEL_OBJ_NAMED_ATTRIBUTE, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Aclose(attr) < 0) FAIL_STACK_ERROR
- if((fileb = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0) FAIL_STACK_ERROR
+ if(H5Fclose(filea1) < 0) FAIL_STACK_ERROR
- if(H5Adelete_by_name(filea2, DEL_OBJ_NAMED_DATASET, DEL_OBJ_NAMED_ATTRIBUTE, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if((fileb = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0) FAIL_STACK_ERROR
- if(H5Fclose(filea2) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fileb) < 0) FAIL_STACK_ERROR
- } /* end for */
+ if(H5Adelete_by_name(filea2, DEL_OBJ_NAMED_DATASET, DEL_OBJ_NAMED_ATTRIBUTE, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ if(H5Fclose(filea2) < 0) FAIL_STACK_ERROR
+ if(H5Fclose(fileb) < 0) FAIL_STACK_ERROR
+ } /* end high */
+ } /* end low */
if(H5Pclose(fapl2) < 0) FAIL_STACK_ERROR
@@ -6898,7 +6927,7 @@ test_delete_obj_named_fileid(hid_t fapl)
hid_t attr = -1; /* Attribute ID */
hid_t dset = -1; /* Dataset ID */
hid_t fapl2 = -1; /* File access property list ID */
- unsigned new_format; /* Whether to use old or new format */
+ H5F_libver_t low, high; /* File format bounds */
char filename[1024], filename2[1024];
TESTING("deleting objects that use named datatypes");
@@ -6908,108 +6937,115 @@ test_delete_obj_named_fileid(hid_t fapl)
h5_fixname(FILENAME[8], fapl, filename, sizeof filename);
h5_fixname(FILENAME[9], fapl2, filename2, sizeof filename2);
- /* Loop over old & new format files */
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
- /* Create test file, with attribute that uses committed datatype */
- create_del_obj_named_test_file(filename, fapl, new_format);
+ /* Loop through all the combinations of low/high library format bounds */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
-/* Test getting file ID for dataset opened through different file ID */
- if((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ /* Skip invalid low/high combination */
+ if ((high == H5F_LIBVER_EARLIEST) || (low > high))
+ continue;
- if((filea2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ /* Create test file, with attribute that uses committed datatype */
+ create_del_obj_named_test_file(filename, fapl, low, high);
- if((dset = H5Dopen2(filea1, DEL_OBJ_NAMED_DATASET, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ /* Test getting file ID for dataset opened through different file ID */
+ if((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
- /* Verify file ID from dataset matches correct file */
- dset_fid = H5Iget_file_id(dset);
- if(dset_fid != filea1) TEST_ERROR
- H5Fclose(dset_fid);
+ if((filea2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
- /* Verify file ID from datatype (from dataset) matches correct file */
- type = H5Dget_type(dset);
- type_fid = H5Iget_file_id(type);
- if(type_fid != filea1) TEST_ERROR
- H5Fclose(type_fid);
- H5Tclose(type);
+ if((dset = H5Dopen2(filea1, DEL_OBJ_NAMED_DATASET, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
+ /* Verify file ID from dataset matches correct file */
+ dset_fid = H5Iget_file_id(dset);
+ if(dset_fid != filea1) TEST_ERROR
+ H5Fclose(dset_fid);
- if(H5Fclose(filea1) < 0) FAIL_STACK_ERROR
+ /* Verify file ID from datatype (from dataset) matches correct file */
+ type = H5Dget_type(dset);
+ type_fid = H5Iget_file_id(type);
+ if(type_fid != filea1) TEST_ERROR
+ H5Fclose(type_fid);
+ H5Tclose(type);
- if((fileb = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0) FAIL_STACK_ERROR
+ if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
- if((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if(H5Fclose(filea1) < 0) FAIL_STACK_ERROR
- if((dset = H5Dopen2(filea1, DEL_OBJ_NAMED_DATASET, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((fileb = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0) FAIL_STACK_ERROR
- /* Verify file ID from dataset matches correct file */
- dset_fid = H5Iget_file_id(dset);
- if(dset_fid != filea1) TEST_ERROR
- H5Fclose(dset_fid);
+ if((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
- /* Verify file ID from datatype (from dataset) matches correct file */
- type = H5Dget_type(dset);
- type_fid = H5Iget_file_id(type);
- if(type_fid != filea1) TEST_ERROR
- H5Fclose(type_fid);
- H5Tclose(type);
+ if((dset = H5Dopen2(filea1, DEL_OBJ_NAMED_DATASET, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
+ /* Verify file ID from dataset matches correct file */
+ dset_fid = H5Iget_file_id(dset);
+ if(dset_fid != filea1) TEST_ERROR
+ H5Fclose(dset_fid);
- if(H5Fclose(filea1) < 0) FAIL_STACK_ERROR
- if(H5Fclose(filea2) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fileb) < 0) FAIL_STACK_ERROR
+ /* Verify file ID from datatype (from dataset) matches correct file */
+ type = H5Dget_type(dset);
+ type_fid = H5Iget_file_id(type);
+ if(type_fid != filea1) TEST_ERROR
+ H5Fclose(type_fid);
+ H5Tclose(type);
+ if(H5Dclose(dset) < 0) FAIL_STACK_ERROR
- /* Create test file, with attribute that uses committed datatype */
- create_del_obj_named_test_file(filename, fapl, new_format);
+ if(H5Fclose(filea1) < 0) FAIL_STACK_ERROR
+ if(H5Fclose(filea2) < 0) FAIL_STACK_ERROR
+ if(H5Fclose(fileb) < 0) FAIL_STACK_ERROR
-/* Test getting file ID for attribute opened through different file ID */
- if((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
- if((filea2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
- if((attr = H5Aopen_by_name(filea1, DEL_OBJ_NAMED_DATASET, DEL_OBJ_NAMED_ATTRIBUTE, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ /* Create test file, with attribute that uses committed datatype */
+ create_del_obj_named_test_file(filename, fapl, low, high);
- /* Verify file ID from dataset matches correct file */
- attr_fid = H5Iget_file_id(attr);
- if(attr_fid != filea1) TEST_ERROR
- H5Fclose(attr_fid);
+ /* Test getting file ID for attribute opened through different file ID */
+ if((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if((filea2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
- /* Verify file ID from datatype (from dataset) matches correct file */
- type = H5Aget_type(attr);
- type_fid = H5Iget_file_id(type);
- if(type_fid != filea1) TEST_ERROR
- H5Fclose(type_fid);
- H5Tclose(type);
+ if((attr = H5Aopen_by_name(filea1, DEL_OBJ_NAMED_DATASET, DEL_OBJ_NAMED_ATTRIBUTE, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Aclose(attr) < 0) FAIL_STACK_ERROR
+ /* Verify file ID from dataset matches correct file */
+ attr_fid = H5Iget_file_id(attr);
+ if(attr_fid != filea1) TEST_ERROR
+ H5Fclose(attr_fid);
- if(H5Fclose(filea1) < 0) FAIL_STACK_ERROR
+ /* Verify file ID from datatype (from dataset) matches correct file */
+ type = H5Aget_type(attr);
+ type_fid = H5Iget_file_id(type);
+ if(type_fid != filea1) TEST_ERROR
+ H5Fclose(type_fid);
+ H5Tclose(type);
- if((fileb = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0) FAIL_STACK_ERROR
+ if(H5Aclose(attr) < 0) FAIL_STACK_ERROR
- if((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if(H5Fclose(filea1) < 0) FAIL_STACK_ERROR
- if((attr = H5Aopen_by_name(filea1, DEL_OBJ_NAMED_DATASET, DEL_OBJ_NAMED_ATTRIBUTE, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((fileb = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl2)) < 0) FAIL_STACK_ERROR
- /* Verify file ID from dataset matches correct file */
- attr_fid = H5Iget_file_id(attr);
- if(attr_fid != filea1) TEST_ERROR
- H5Fclose(attr_fid);
+ if((filea1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
- /* Verify file ID from datatype (from dataset) matches correct file */
- type = H5Aget_type(attr);
- type_fid = H5Iget_file_id(type);
- if(type_fid != filea1) TEST_ERROR
- H5Fclose(type_fid);
- H5Tclose(type);
+ if((attr = H5Aopen_by_name(filea1, DEL_OBJ_NAMED_DATASET, DEL_OBJ_NAMED_ATTRIBUTE, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Aclose(attr) < 0) FAIL_STACK_ERROR
+ /* Verify file ID from dataset matches correct file */
+ attr_fid = H5Iget_file_id(attr);
+ if(attr_fid != filea1) TEST_ERROR
+ H5Fclose(attr_fid);
- if(H5Fclose(filea1) < 0) FAIL_STACK_ERROR
- if(H5Fclose(filea2) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fileb) < 0) FAIL_STACK_ERROR
- } /* end for */
+ /* Verify file ID from datatype (from dataset) matches correct file */
+ type = H5Aget_type(attr);
+ type_fid = H5Iget_file_id(type);
+ if(type_fid != filea1) TEST_ERROR
+ H5Fclose(type_fid);
+ H5Tclose(type);
+
+ if(H5Aclose(attr) < 0) FAIL_STACK_ERROR
+
+ if(H5Fclose(filea1) < 0) FAIL_STACK_ERROR
+ if(H5Fclose(filea2) < 0) FAIL_STACK_ERROR
+ if(H5Fclose(fileb) < 0) FAIL_STACK_ERROR
+ } /* end high */
+ } /* end low */
if(H5Pclose(fapl2) < 0) FAIL_STACK_ERROR
@@ -7018,12 +7054,15 @@ test_delete_obj_named_fileid(hid_t fapl)
error:
H5E_BEGIN_TRY {
- H5Tclose(attr);
+ H5Aclose(attr);
+ H5Tclose(type);
H5Dclose(dset);
H5Pclose(fapl2);
H5Fclose(filea1);
H5Fclose(filea2);
H5Fclose(fileb);
+ H5Fclose(attr_fid);
+ H5Fclose(type_fid);
} H5E_END_TRY;
return 1;
} /* end test_delete_obj_named_fileid() */
@@ -7388,7 +7427,369 @@ error:
return 1;
}
+/*-------------------------------------------------------------------------
+ * Function: verify_version
+ *
+ * Purpose: Utility function to verify the datatype versions of nested
+ * datatype.
+ *
+ * Description:
+ * Verify the datatype message version
+ * --H5T_COMPOUND, H5T_ENUM, H5T_ARRAY:
+ * the library will set version according to low_bound
+ * --H5T_ARRAY:
+ * the earliest version the library will set is 2
+ * --H5T_INTEGER, H5T_FLOAT, H5T_TIME, H5T_STRING, H5T_BITFIELD,
+ * H5T_OPAQUE, H5T_REFERENCE:
+ * the library will only use basic version
+ *
+ *************************************************************************/
+static herr_t verify_version(hid_t dtype, H5F_libver_t low, unsigned *highest_version)
+{
+ hid_t base_dtype = -1;
+ hid_t mem_dtype = -1;
+ H5T_t *dtypep = NULL; /* Internal structure of a datatype */
+ H5T_class_t type_cls = H5T_NO_CLASS; /* Temporary var for datatype class */
+ int nmembers = 0;
+ unsigned i;
+ herr_t ret = SUCCEED; /* Generic return value */
+
+ dtypep = (H5T_t *)H5I_object(dtype);
+ if (dtypep == NULL) TEST_ERROR
+
+ /* Carry out the verification according to the class of the datatype.
+ For compound datatype, its members will be verified, recursively.
+ For array datatype, its element datatype will be verified, recursively.*/
+ type_cls = dtypep->shared->type;
+ switch (type_cls)
+ {
+ case H5T_ARRAY:
+ {
+ H5T_t *base_dtypep = NULL; /* Internal structure of a datatype */
+
+ if (low == H5F_LIBVER_EARLIEST)
+ VERIFY(dtypep->shared->version, H5O_DTYPE_VERSION_2, "H5O_dtype_ver_bounds");
+ else
+ VERIFY(dtypep->shared->version, H5O_dtype_ver_bounds[low], "H5O_dtype_ver_bounds");
+
+ /* Get the base datatype of this array type */
+ base_dtype = H5Tget_super(dtype);
+ CHECK(base_dtype, FAIL, "H5Tget_super");
+
+ /* Get the base type's internal structure for version */
+ base_dtypep = (H5T_t *)H5I_object(base_dtype);
+ if (base_dtypep == NULL) TEST_ERROR
+
+ /* Reset highest version if this datatype has higher version than
+ its outer type */
+ if (*highest_version < base_dtypep->shared->version)
+ *highest_version = base_dtypep->shared->version;
+
+ /* Verify the base datatype recursively */
+ ret = verify_version(base_dtype, low, highest_version);
+
+ /* Close the member datatype before checking for failure */
+ if ((H5Tclose(base_dtype)) < 0) TEST_ERROR
+
+ /* Check if verify_version fails */
+ if (ret < 0) TEST_ERROR
+
+ break;
+ }
+ case H5T_COMPOUND:
+ {
+ H5T_t *mem_dtypep = NULL; /* Internal structure of a datatype */
+ /* Get the number of members of this compound type */
+ if ((nmembers = H5Tget_nmembers(dtype)) < 0) TEST_ERROR
+
+ /* Go through all its member datatypes */
+ for (i = 0; i < (unsigned)nmembers; i++)
+ {
+ /* Get the member datatype to verify it recursively */
+ mem_dtype = H5Tget_member_type(dtype, i);
+ if (mem_dtype < 0) TEST_ERROR
+
+ /* Get the member type's internal structure for version */
+ mem_dtypep = (H5T_t *)H5I_object(mem_dtype);
+ if (mem_dtypep == NULL) TEST_ERROR
+
+ /* Reset highest version if this datatype has higher version than
+ its outer type */
+ if (*highest_version < mem_dtypep->shared->version)
+ *highest_version = mem_dtypep->shared->version;
+
+ /* Verify the datatype recursively */
+ ret = verify_version(mem_dtype, low, highest_version);
+
+ /* Close the member datatype before checking for failure */
+ if ((H5Tclose(mem_dtype)) < 0) TEST_ERROR
+
+ /* Check if verify_version fails */
+ if (ret < 0) TEST_ERROR
+ }
+ /* If this compound datatype contains a datatype of higher version, it
+ will be promoted to that version, thus, verify with highest version */
+ if (*highest_version > H5O_dtype_ver_bounds[low])
+ VERIFY(dtypep->shared->version, *highest_version, "verify_version");
+ else
+ VERIFY(dtypep->shared->version, H5O_dtype_ver_bounds[low], "verify_version");
+ break;
+ }
+ case H5T_ENUM:
+ VERIFY(dtypep->shared->version, H5O_dtype_ver_bounds[low], "verify_version");
+ break;
+ case H5T_VLEN:
+ case H5T_FLOAT:
+ case H5T_INTEGER:
+ VERIFY(dtypep->shared->version, H5O_dtype_ver_bounds[H5F_LIBVER_EARLIEST], "verify_version");
+ break;
+ case H5T_NCLASSES:
+ case H5T_NO_CLASS:
+ case H5T_TIME:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_REFERENCE:
+ default:
+ TEST_ERROR
+ } /* end switch */
+
+error:
+ H5E_BEGIN_TRY {
+ H5Tclose(base_dtype);
+ H5Tclose(mem_dtype);
+ } H5E_END_TRY;
+ return ret;
+} /* end of verify_version */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_versionbounds
+ *
+ * Purpose: Tests version bounds.
+ *
+ * Description:
+ * This function creates a datatype for a dataset as followed:
+ * outer_arr_type
+ * outer_cmp_type
+ * inner_cmp_type
+ * inner_arr_type
+ * simple_cmp_type
+ * H5T_NATIVE_INT
+ * H5T_ARRAY of H5T_NATIVE_CHAR
+ * vlen_floattype
+ * enum_type
+ * It then loops through all valid combination of the library version
+ * bounds to verify each datatype's version.
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ *-------------------------------------------------------------------------
+ */
+#define VERFNAME "tverbounds_dtype.h5"
+#define VERDSNAME "dataset 1"
+#define ARRAY_RANK 1
+#define ARRAY_LEN 10
+static int
+test_versionbounds(void)
+{
+ typedef struct { /* Struct for the simple compound type */
+ int single_int;
+ char char_arr[ARRAY_LEN];
+ } simple_cmp_t;
+
+ typedef struct { /* Struct for the inner compound type */
+ simple_cmp_t inner_arr[ARRAY_LEN];
+ hvl_t vlen_float;
+ } inner_cmp_t;
+
+ typedef struct { /* Struct for the outer compound type */
+ inner_cmp_t inner_cmp;
+ color_t enum_color;
+ } outer_cmp_t;
+
+ hid_t file = -1; /* File ID */
+ hid_t space = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ hid_t fcpl = -1; /* File creation property list ID */
+ hid_t fapl = -1; /* Copy of file access property list ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t dset_dtype = -1; /* Dataset's datatype */
+ hid_t arr_chartype = -1; /* Array of characters datatype */
+ hid_t vlen_floattype = -1; /* Vlen of float datatype */
+ hid_t enum_type = -1; /* Enumeration datatype */
+ hid_t outer_cmp_type = -1; /* Outer compound datatype */
+ hid_t inner_cmp_type = -1; /* Inner compound datatype */
+ hid_t simple_cmp_type = -1;/* Simple cmpd dtype, contains no other cmpd */
+ hid_t outer_arr_type = -1; /* Outermost array datatype */
+ hid_t inner_arr_type = -1; /* Inner array datatype */
+ H5F_t *filep = NULL; /* Pointer to internal structure of a file */
+ H5T_t *dtypep = NULL; /* Pointer to internal structure of a datatype */
+ hsize_t arr_dim[] = {ARRAY_LEN}; /* Length of the array */
+ H5F_libver_t low, high; /* File format bounds */
+ unsigned highest_version; /* Highest version in nested datatypes */
+ color_t enum_val; /* Enum type index */
+ herr_t ret = 0; /* Generic return value */
+
+ TESTING("version bounds with nested datatypes");
+
+ /* Create a file access property list */
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR
+
+ /* Create a file creation property list */
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR
+
+ /* Create a scalar dataspace */
+ if ((space = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR
+
+ /* Create a dataset creation property list */
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+
+ /* Create an array datatype of chars */
+ arr_chartype = H5Tarray_create2(H5T_NATIVE_CHAR, ARRAY_RANK, arr_dim);
+ if (arr_chartype < 0) TEST_ERROR
+
+ /* Create the simple compound datatype that has an integer and an
+ array of chars */
+ simple_cmp_type = H5Tcreate(H5T_COMPOUND, sizeof(simple_cmp_t));
+ if (simple_cmp_type < 0) TEST_ERROR
+
+ /* Insert integer field */
+ ret = H5Tinsert(simple_cmp_type, "single_int", HOFFSET(simple_cmp_t, single_int), H5T_NATIVE_INT);
+ if (ret < 0) TEST_ERROR
+ /* Insert array field */
+ ret = H5Tinsert(simple_cmp_type, "char_arr", HOFFSET(simple_cmp_t, char_arr), arr_chartype);
+ if (ret < 0) TEST_ERROR
+
+ /* Create an array datatype containing simple compound datatype */
+ inner_arr_type = H5Tarray_create2(simple_cmp_type, ARRAY_RANK, arr_dim);
+ if (inner_arr_type < 0) TEST_ERROR
+
+ /* Create a VL datatype of floats */
+ vlen_floattype = H5Tvlen_create(H5T_NATIVE_FLOAT);
+ if (vlen_floattype < 0) TEST_ERROR
+
+ /* Create the innermost compound datatype that houses inner_arr_type and vlen_floattype */
+ inner_cmp_type = H5Tcreate(H5T_COMPOUND, sizeof(inner_cmp_t));
+ if (inner_cmp_type < 0) TEST_ERROR
+
+ /* Insert integer field */
+ ret = H5Tinsert(inner_cmp_type, "inner_arr", HOFFSET(inner_cmp_t, inner_arr), inner_arr_type);
+ if (ret < 0) TEST_ERROR
+
+ /* Insert integer field */
+ ret = H5Tinsert(inner_cmp_type, "vlen_float", HOFFSET(inner_cmp_t, vlen_float), vlen_floattype);
+ if (ret < 0) TEST_ERROR
+
+ /* Create a enumerate datatype */
+ enum_type = H5Tcreate(H5T_ENUM, sizeof(color_t));
+ if (enum_type < 0) TEST_ERROR
+
+ enum_val = E1_RED;
+ ret = H5Tenum_insert(enum_type, "RED", &enum_val);
+ if (ret < 0) TEST_ERROR
+
+ enum_val++;
+ ret = H5Tenum_insert(enum_type, "GREEN", &enum_val);
+ if (ret < 0) TEST_ERROR
+
+ enum_val++;
+ ret = H5Tenum_insert(enum_type, "BLUE", &enum_val);
+ if (ret < 0) TEST_ERROR
+
+ enum_val++;
+ ret = H5Tenum_insert(enum_type, "ORANGE", &enum_val);
+ if (ret < 0) TEST_ERROR
+
+ enum_val++;
+ ret = H5Tenum_insert(enum_type, "YELLOW", &enum_val);
+ if (ret < 0) TEST_ERROR
+
+ /* Create the outer compound datatype that contains the inner compound datatype and the enum datatype */
+ outer_cmp_type = H5Tcreate(H5T_COMPOUND, sizeof(outer_cmp_t));
+ if (ret < 0) TEST_ERROR
+
+ /* Insert integer field */
+ ret = H5Tinsert(outer_cmp_type, "inner_cmp", HOFFSET(outer_cmp_t, inner_cmp), inner_cmp_type);
+ if (ret < 0) TEST_ERROR
+
+ /* Insert enum field */
+ ret = H5Tinsert(outer_cmp_type, "enum_color", HOFFSET(outer_cmp_t, enum_color), enum_type);
+ if (ret < 0) TEST_ERROR
+
+ /* Create an array datatype containing the outer compound datatype */
+ if ((outer_arr_type = H5Tarray_create2(outer_cmp_type, ARRAY_RANK, arr_dim)) < 0)
+ TEST_ERROR
+
+ /* Loop through all the combinations of low/high library format bounds,
+ skipping invalid combinations */
+ /* Create the file, create and write to a dataset with compound datatype */
+ /* Verify the dataset's datatype and its members */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+
+ /* Set version bounds */
+ H5E_BEGIN_TRY {
+ ret = H5Pset_libver_bounds(fapl, low, high);
+ } H5E_END_TRY;
+
+ if (ret < 0) /* Invalid low/high combinations */
+ continue;
+
+ /* Create a file */
+ file = H5Fcreate(VERFNAME, H5F_ACC_TRUNC, fcpl, fapl);
+ if (file < 0) TEST_ERROR
+
+ /* Get the internal file pointer if the create succeeds */
+ if ((filep = (H5F_t *)H5I_object(file)) == NULL) TEST_ERROR
+
+ /* Create dataset using the array type */
+ dset = H5Dcreate2(file, VERDSNAME, outer_arr_type, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ if (dset < 0) TEST_ERROR
+
+ /* Get the dataset's datatype */
+ if ((dset_dtype = H5Dget_type(dset)) < 0) TEST_ERROR
+
+ /* Get the version of this datatype */
+ dtypep = (H5T_t *)H5I_object(dset_dtype);
+ if (dtypep == NULL) TEST_ERROR
+ highest_version = dtypep->shared->version;
+
+ /* Verify version of the datatype recursevily */
+ ret = verify_version(dset_dtype, low, &highest_version);
+
+ /* Close the dataset's datatype */
+ if (H5Tclose(dset_dtype) < 0) TEST_ERROR
+
+ /* Close dataset and file */
+ if (H5Dclose(dset) < 0) TEST_ERROR
+ if (H5Fclose(file) < 0) TEST_ERROR
+
+ } /* for high */
+ } /* for low */
+
+ /* Close dataspace and property lists */
+ if (H5Sclose(space) < 0) TEST_ERROR
+ if (H5Pclose(fcpl) < 0) TEST_ERROR
+ if (H5Pclose(fapl) < 0) TEST_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(dset);
+ H5Sclose(space);
+ H5Tclose(dset_dtype);
+ H5Pclose(dcpl);
+ H5Pclose(fcpl);
+ H5Pclose(fapl);
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return 1;
+} /* end test_versionbounds() */
/*-------------------------------------------------------------------------
@@ -7411,7 +7812,7 @@ int
main(void)
{
long nerrors = 0;
- hid_t fapl = -1;
+ hid_t fapl = -1;
/* Set the random # seed */
HDsrandom((unsigned)HDtime(NULL));
@@ -7428,7 +7829,6 @@ main(void)
nerrors += test_detect();
nerrors += test_compound_1();
nerrors += test_query();
-
nerrors += test_transient(fapl);
nerrors += test_named(fapl);
nerrors += test_encode();
@@ -7473,6 +7873,7 @@ main(void)
nerrors += test_opaque();
nerrors += test_set_order();
nerrors += test_utf_ascii_conv();
+ nerrors += test_versionbounds();
if(nerrors) {
printf("***** %lu FAILURE%s! *****\n",
diff --git a/test/gen_bounds.c b/test/gen_bounds.c
index 9702176..7b670f7 100644
--- a/test/gen_bounds.c
+++ b/test/gen_bounds.c
@@ -267,11 +267,13 @@ error:
/***********************************************************************
* gen_latest_latest() creates file "bounds_latest_latest.h5"
*
- * File contents:
- * - Version 3 superblock (triggered by H5Fcreate with H5F_ACC_SWMR_WRITE)
- * - A chunked dataset with layout version 4, "DS_chunked_layout_4". (H5Pset_chunk_opts)
+ * NOTE: As of March 2018, latest is 1.10.
*
- * NOTE: As of Feb 2018, latest is 1.10.
+ * File contents:
+ * - Version 3 superblock (NOTE: this can also be triggered by passing in
+ * H5F_ACC_SWMR_WRITE, in place of H5F_ACC_TRUNC, to H5Fcreate)
+ * - A chunked dataset with layout version 4, "DS_chunked_layout_4".
+ * (triggered by H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS)
*
* Return: SUCCEED/FAIL
*
@@ -279,6 +281,7 @@ error:
static herr_t gen_latest_latest(void)
{
hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list ID */
hid_t dcpl = -1; /* Dataset creation property list ID */
hid_t space = -1; /* Dataspace ID */
hid_t dset = -1; /* Dataset ID */
@@ -289,8 +292,16 @@ static herr_t gen_latest_latest(void)
int i, j;
herr_t ret = SUCCEED; /* Generic return value */
- /* Create file with H5F_ACC_SWMR_WRITE, triggers version 3 superblock */
- fid = H5Fcreate(FILENAME_L_L, H5F_ACC_SWMR_WRITE, H5P_DEFAULT, H5P_DEFAULT);
+ /* Create file access property list */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
+
+ /* Set the "use the latest/latest version of the format" bounds
+ for creating objects in the file */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR;
+
+ /* Create the file with version 3 superblock */
+ fid = H5Fcreate(FILENAME_L_L, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
if (fid < 0) TEST_ERROR;
/*
@@ -351,6 +362,8 @@ error:
/***********************************************************************
* gen_v18_latest() creates file "bounds_v18_latest.h5"
*
+ * NOTE: As of March 2018, latest is 1.10.
+ *
* File contents:
* - Version 2 superblock
* - A chunked dataset with layout version 3, "DS_chunked_layout_3". (default)
diff --git a/test/objcopy.c b/test/objcopy.c
index 5d9d426..e88d508 100644
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -14271,10 +14271,10 @@ main(void)
FALSE, "H5Ocopy(): expand soft link");
nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl,
H5O_COPY_EXPAND_EXT_LINK_FLAG,
- FALSE, "H5Ocopy: expand external link");
+ FALSE, "H5Ocopy(): expand external link");
nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl,
H5O_COPY_EXPAND_SOFT_LINK_FLAG | H5O_COPY_EXPAND_EXT_LINK_FLAG,
- FALSE, "H5Ocopy: expand soft and external links");
+ FALSE, "H5Ocopy(): expand soft and external links");
nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl,
H5O_COPY_SHALLOW_HIERARCHY_FLAG,
FALSE, "H5Ocopy(): shallow group copy");
diff --git a/test/tfile.c b/test/tfile.c
index de1f362..f3d5a8f 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -4966,7 +4966,7 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create,
#define VERBFNAME "tverbounds_dspace.h5"
#define VERBDSNAME "dataset 1"
#define SPACE1_DIM1 3
-static int
+static void
test_libver_bounds_open(void)
{
hid_t file = -1; /* File ID */
diff --git a/test/th5s.c b/test/th5s.c
index 0b0a2e7..0619571 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -41,10 +41,6 @@
#define H5O_TESTING
#include "H5Opkg.h" /* Object header */
-#include "H5Bprivate.h"
-#include "H5Sprivate.h"
-#include "H5Pprivate.h"
-
#define TESTFILE "th5s.h5"
#define DATAFILE "th5s1.h5"
#define NULLFILE "th5s2.h5"
diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt
index 3cee808..b1b9ce1 100644
--- a/testpar/CMakeLists.txt
+++ b/testpar/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TEST_PAR)
#-----------------------------------------------------------------------------
diff --git a/testpar/CMakeTests.cmake b/testpar/CMakeTests.cmake
index cd9acda..87470f3 100644
--- a/testpar/CMakeTests.cmake
+++ b/testpar/CMakeTests.cmake
@@ -18,10 +18,6 @@
add_test (NAME TEST_PAR_testphdf5 COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:testphdf5> ${MPIEXEC_POSTFLAGS})
-if (WIN32)
- # t_cache_imagee uses fork() and execve(), will not run on Windows
- list (REMOVE_ITEM H5P_TESTS t_cache_image)
-endif ()
foreach (testp ${H5P_TESTS})
add_test (NAME TEST_PAR_${testp} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:${testp}> ${MPIEXEC_POSTFLAGS})
endforeach ()
diff --git a/testpar/t_cache_image.c b/testpar/t_cache_image.c
index 7fe0020..5b512d6 100644
--- a/testpar/t_cache_image.c
+++ b/testpar/t_cache_image.c
@@ -1882,6 +1882,14 @@ par_delete_dataset(int dset_num,
} /* par_delete_dataset() */
+/* This test uses many POSIX things that are not available on
+ * Windows. We're using a check for fork(2) here as a proxy for
+ * all POSIX/Unix/Linux things until this test can be made
+ * more platform-independent.
+ */
+#ifdef H5_HAVE_FORK
+
+
/*-------------------------------------------------------------------------
* Function: par_insert_cache_image()
*
@@ -1990,6 +1998,15 @@ par_insert_cache_image(int file_name_idx, int mpi_rank, int mpi_size )
return;
} /* par_insert_cache_image() */
+#else /* H5_HAVE_FORK */
+
+static void
+par_insert_cache_image(int file_name_idx, int mpi_rank, int mpi_size )
+{
+ return;
+} /* par_insert_cache_image() */
+
+#endif /* H5_HAVE_FORK */
/*-------------------------------------------------------------------------
@@ -4056,6 +4073,13 @@ smoke_check_1(MPI_Comm mpi_comm, MPI_Info mpi_info, int mpi_rank, int mpi_size)
} /* smoke_check_1() */
+/* This test uses many POSIX things that are not available on
+ * Windows. We're using a check for fork(2) here as a proxy for
+ * all POSIX/Unix/Linux things until this test can be made
+ * more platform-independent.
+ */
+#ifdef H5_HAVE_FORK
+
/*-------------------------------------------------------------------------
* Function: main
*
@@ -4271,4 +4295,14 @@ finish:
return(nerrs > 0);
} /* main() */
+#else /* H5_HAVE_FORK */
+
+int
+main(void)
+{
+ HDfprintf(stderr, "Non-POSIX platform. Skipping.\n");
+ return EXIT_SUCCESS;
+} /* end main() */
+
+#endif /* H5_HAVE_FORK */
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index e02d3eb..5576f5c 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS)
#-----------------------------------------------------------------------------
diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt
index addaf2e..db06b9a 100644
--- a/tools/lib/CMakeLists.txt
+++ b/tools/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_LIB)
#-----------------------------------------------------------------------------
diff --git a/tools/src/CMakeLists.txt b/tools/src/CMakeLists.txt
index 5a25f76..9364658 100644
--- a/tools/src/CMakeLists.txt
+++ b/tools/src/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_SRC)
#-----------------------------------------------------------------------------
diff --git a/tools/src/h5copy/CMakeLists.txt b/tools/src/h5copy/CMakeLists.txt
index 606516f..8423e5a 100644
--- a/tools/src/h5copy/CMakeLists.txt
+++ b/tools/src/h5copy/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_SRC_H5COPY)
#-----------------------------------------------------------------------------
diff --git a/tools/src/h5diff/CMakeLists.txt b/tools/src/h5diff/CMakeLists.txt
index 2ff5817..9e9f1ea 100644
--- a/tools/src/h5diff/CMakeLists.txt
+++ b/tools/src/h5diff/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_SRC_H5DIFF)
#-----------------------------------------------------------------------------
diff --git a/tools/src/h5dump/CMakeLists.txt b/tools/src/h5dump/CMakeLists.txt
index 491ec4b..1133218 100644
--- a/tools/src/h5dump/CMakeLists.txt
+++ b/tools/src/h5dump/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_SRC_H5DUMP)
#-----------------------------------------------------------------------------
diff --git a/tools/src/h5format_convert/CMakeLists.txt b/tools/src/h5format_convert/CMakeLists.txt
index 712dd87..4acc999 100644
--- a/tools/src/h5format_convert/CMakeLists.txt
+++ b/tools/src/h5format_convert/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_SRC_H5FC)
#-----------------------------------------------------------------------------
diff --git a/tools/src/h5import/CMakeLists.txt b/tools/src/h5import/CMakeLists.txt
index efb0ad2..d628c9b 100644
--- a/tools/src/h5import/CMakeLists.txt
+++ b/tools/src/h5import/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_SRC_H5IMPORT)
#-----------------------------------------------------------------------------
diff --git a/tools/src/h5jam/CMakeLists.txt b/tools/src/h5jam/CMakeLists.txt
index 9035ed9..59caf44 100644
--- a/tools/src/h5jam/CMakeLists.txt
+++ b/tools/src/h5jam/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_SRC_H5JAM)
#-----------------------------------------------------------------------------
diff --git a/tools/src/h5ls/CMakeLists.txt b/tools/src/h5ls/CMakeLists.txt
index 71b3d1d..e9ecd44 100644
--- a/tools/src/h5ls/CMakeLists.txt
+++ b/tools/src/h5ls/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_SRC_H5LS)
#-----------------------------------------------------------------------------
diff --git a/tools/src/h5repack/CMakeLists.txt b/tools/src/h5repack/CMakeLists.txt
index 3fefd24..211c947 100644
--- a/tools/src/h5repack/CMakeLists.txt
+++ b/tools/src/h5repack/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_SRC_H5REPACK)
#-----------------------------------------------------------------------------
diff --git a/tools/src/h5stat/CMakeLists.txt b/tools/src/h5stat/CMakeLists.txt
index cc8bee2..7842aa8 100644
--- a/tools/src/h5stat/CMakeLists.txt
+++ b/tools/src/h5stat/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_SRC_H5STAT)
#-----------------------------------------------------------------------------
diff --git a/tools/src/misc/CMakeLists.txt b/tools/src/misc/CMakeLists.txt
index 78ba238..948c6d4 100644
--- a/tools/src/misc/CMakeLists.txt
+++ b/tools/src/misc/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_SRC_MISC)
#-----------------------------------------------------------------------------
diff --git a/tools/test/CMakeLists.txt b/tools/test/CMakeLists.txt
index 54dd5a2..f194d7a 100644
--- a/tools/test/CMakeLists.txt
+++ b/tools/test/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_TEST)
#-----------------------------------------------------------------------------
diff --git a/tools/test/h5copy/CMakeLists.txt b/tools/test/h5copy/CMakeLists.txt
index 2f5f314..1f817fb 100644
--- a/tools/test/h5copy/CMakeLists.txt
+++ b/tools/test/h5copy/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_TEST_H5COPY)
#-----------------------------------------------------------------------------
diff --git a/tools/test/h5diff/CMakeLists.txt b/tools/test/h5diff/CMakeLists.txt
index cedc932..aae6327 100644
--- a/tools/test/h5diff/CMakeLists.txt
+++ b/tools/test/h5diff/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_TEST_H5DIFF)
#-----------------------------------------------------------------------------
diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt
index 1941764..6a12f5e 100644
--- a/tools/test/h5dump/CMakeLists.txt
+++ b/tools/test/h5dump/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_TEST_H5DUMP)
#-----------------------------------------------------------------------------
diff --git a/tools/test/h5format_convert/CMakeLists.txt b/tools/test/h5format_convert/CMakeLists.txt
index 5287ae0..a27c78a 100644
--- a/tools/test/h5format_convert/CMakeLists.txt
+++ b/tools/test/h5format_convert/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_TEST_H5FC)
#-----------------------------------------------------------------------------
diff --git a/tools/test/h5import/CMakeLists.txt b/tools/test/h5import/CMakeLists.txt
index 5492363..2cb212a 100644
--- a/tools/test/h5import/CMakeLists.txt
+++ b/tools/test/h5import/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_TEST_H5IMPORT)
#-----------------------------------------------------------------------------
diff --git a/tools/test/h5jam/CMakeLists.txt b/tools/test/h5jam/CMakeLists.txt
index 17dda3c..b623860 100644
--- a/tools/test/h5jam/CMakeLists.txt
+++ b/tools/test/h5jam/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_TEST_H5JAM)
#-----------------------------------------------------------------------------
diff --git a/tools/test/h5ls/CMakeLists.txt b/tools/test/h5ls/CMakeLists.txt
index e92533f..8549046 100644
--- a/tools/test/h5ls/CMakeLists.txt
+++ b/tools/test/h5ls/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_TEST_H5LS)
#-----------------------------------------------------------------------------
diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt
index a606ac6..50eb0af 100644
--- a/tools/test/h5repack/CMakeLists.txt
+++ b/tools/test/h5repack/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_TEST_H5REPACK)
#-----------------------------------------------------------------------------
diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake
index 13ebd17..f40c0b1 100644
--- a/tools/test/h5repack/CMakeTests.cmake
+++ b/tools/test/h5repack/CMakeTests.cmake
@@ -53,6 +53,7 @@
# Copy all the HDF5 files from the source directory into the test directory
# --------------------------------------------------------------------
set (LIST_HDF5_TEST_FILES
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/bounds_latest_latest.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_attr.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_attr_refs.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_deflate.h5
@@ -582,6 +583,62 @@
endif ()
endmacro ()
+# VERIFY_SUPERBLOCK
+ macro (ADD_H5_VERIFY_SUPERBLOCK testname testfile lowbound highbound superblock)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ testfiles/out-${testname}.${testfile}
+ testfiles/${testfile}-${testname}-v.out
+ testfiles/${testfile}-${testname}-v.out.err
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ endif ()
+ add_test (
+ NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}
+ COMMAND $<TARGET_FILE:h5repack> -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ )
+ set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects)
+ add_test (
+ NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}_DMP
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=-H;-B;out-${testname}.${testfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${testfile}-${testname}-v.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_FILTER:STRING=SUPERBLOCK_VERSION ${superblock}"
+ -D "TEST_REFERENCE=SUPERBLOCK_VERSION ${superblock}"
+ -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake"
+ )
+ set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname})
+ endif ()
+ endmacro ()
+
+ macro (ADD_H5_VERIFY_INVALIDBOUNDS testname resultcode lowbound highbound)
+ add_test (
+ NAME ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ testfiles/out-${testname}.${testfile}
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ endif ()
+ add_test (
+ NAME ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}
+ COMMAND $<TARGET_FILE:h5repack> -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ )
+ set_tests_properties (
+ ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} PROPERTIES
+ DEPENDS ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects
+ WILL_FAIL "true"
+ )
+ endmacro ()
+
macro (ADD_H5_TEST_META testname testfile)
# Remove any output file left over from previous test run
add_test (
@@ -1371,6 +1428,18 @@
ADD_H5_VERIFY_VDS (vds_conti ${TESTTYPE} 0 ${FILEV4} vds_dset CONTIGUOUS -l vds_dset:CONTI)
##############################################################################
+### V E R S I O N B O U N D S T E S T S
+##############################################################################
+# -j 0 -k 2, superblock will be 0
+ADD_H5_VERIFY_SUPERBLOCK (SB_IS_0 h5repack_layout.h5 0 2 0)
+# -j 1 -k 2, superblock will be 2
+ADD_H5_VERIFY_SUPERBLOCK (SB_IS_2 h5repack_layout.h5 1 2 2)
+# -j 2 -k 2, superblock will be 3
+ADD_H5_VERIFY_SUPERBLOCK (SB_IS_3 h5repack_layout.h5 2 2 3)
+# -j 0 -k 1, file cannot be opened
+ADD_H5_VERIFY_INVALIDBOUNDS (latest_latest_invalid bounds_latest_latest.h5 0 1)
+
+##############################################################################
### P L U G I N T E S T S
##############################################################################
ADD_H5_UD_TEST (plugin_version_test 0 h5repack_layout.h5 -v -f UD=260,0,4,9,${H5_VERS_MAJOR},${H5_VERS_MINOR},${H5_VERS_RELEASE})
diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in
index e474bc3..b0a2f99 100644
--- a/tools/test/h5repack/h5repack.sh.in
+++ b/tools/test/h5repack/h5repack.sh.in
@@ -82,6 +82,7 @@ test -d $TESTDIR || mkdir $TESTDIR
# Comment '#' without space can be used.
# --------------------------------------------------------------------
LIST_HDF5_TEST_FILES="
+$SRC_H5REPACK_TESTFILES/bounds_latest_latest.h5
$SRC_H5REPACK_TESTFILES/h5repack_attr.h5
$SRC_H5REPACK_TESTFILES/h5repack_attr_refs.h5
$SRC_H5REPACK_TESTFILES/h5repack_deflate.h5
@@ -340,8 +341,8 @@ VERIFY_LAYOUT_DSET()
fi
# clean up tmp files
- rm -f $outfile
- rm -f $layoutfile
+# rm -f $outfile
+# rm -f $layoutfile
}
#------------------------------------------
@@ -513,6 +514,87 @@ VERIFY_LAYOUT_ALL()
rm -f $layoutfile
}
+#--------------------------------------------------------------
+# Verifying superblock of a file with different version bounds
+VERIFY_SUPERBLOCK()
+{
+ lowbound=$1
+ highbound=$2
+ superblock=$3
+ infile=$4
+ layoutfile=verbounds-low$lowbound-high$highbound.$4
+ outfile=out-verbounds-low$lowbound-high$highbound.$infile
+ expectedsuperblock="SUPERBLOCK_VERSION $superblock"
+
+ shift
+ shift
+ shift
+ shift
+
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5REPACK_BIN -j $lowbound -k $highbound $infile $outfile
+ )
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ DIFFTEST $infile $outfile
+ fi
+
+ #---------------------------------
+ # check the layout from a dataset
+ VERIFY "superblock"
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5DUMP_BIN -H -B $outfile > $layoutfile
+ )
+ $GREP "$expectedsuperblock" $TESTDIR/$layoutfile > /dev/null
+ if [ $? -eq 0 ]; then
+ echo " PASSED"
+ else
+ echo " FAILED"
+ nerrors="`expr $nerrors + 1`"
+ fi
+
+ # clean up tmp files
+ rm -f $outfile
+ rm -f $layoutfile
+
+} # end of VERIFY_SUPERBLOCK
+
+#------------------------------------------------------------------
+# Verifying that a latest file cannot be opened with earlier bounds
+VERIFY_INVALIDBOUNDS()
+{
+ lowbound=$1
+ highbound=$2
+ infile=$3
+ outfile=out-verbounds-low$lowbound-high$highbound.$infile
+
+ #--------------------------------------
+ # check for failure with invalid bounds
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5REPACK_BIN -j $lowbound -k $highbound $infile $outfile
+ )
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ fi
+
+ # clean up tmp files
+ rm -f $outfile
+
+} # end of VERIFY_INVALIDBOUNDS
+
# same as TOOLTEST, but it uses the old syntax -i input_file -o output_file
#
TOOLTEST0()
@@ -1365,6 +1447,18 @@ else
VERIFY_LAYOUT_VDS vds_conti 4_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI
fi
+#########################################################
+# Testing version bounds
+#########################################################
+# -j 0 -k 2, superblock will be 0
+VERIFY_SUPERBLOCK 0 2 0 h5repack_layout.h5 -j 0 -k 2 h5repack_layout.h5
+# -j 1 -k 2, superblock will be 2
+VERIFY_SUPERBLOCK 1 2 2 h5repack_layout.h5 -j 1 -k 2 h5repack_layout.h5
+# -j 2 -k 2, superblock will be 3
+VERIFY_SUPERBLOCK 2 2 3 h5repack_layout.h5 -j 2 -k 2 h5repack_layout.h5
+# -j 0 -k 1, file cannot be opened
+VERIFY_INVALIDBOUNDS 0 1 bounds_latest_latest.h5
+
# Clean up temporary files/directories
CLEAN_TESTFILES_AND_TESTDIR
diff --git a/tools/test/h5repack/testfiles/bounds_latest_latest.h5 b/tools/test/h5repack/testfiles/bounds_latest_latest.h5
new file mode 100644
index 0000000..6e8bcad
--- /dev/null
+++ b/tools/test/h5repack/testfiles/bounds_latest_latest.h5
Binary files differ
diff --git a/tools/test/h5stat/CMakeLists.txt b/tools/test/h5stat/CMakeLists.txt
index 0d07753..5f645097 100644
--- a/tools/test/h5stat/CMakeLists.txt
+++ b/tools/test/h5stat/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_TEST_H5STAT)
#-----------------------------------------------------------------------------
diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt
index 178767a..084751a 100644
--- a/tools/test/misc/CMakeLists.txt
+++ b/tools/test/misc/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_TEST_MISC)
#-----------------------------------------------------------------------------
diff --git a/tools/test/misc/vds/CMakeLists.txt b/tools/test/misc/vds/CMakeLists.txt
index 5b34c43..50aade4 100644
--- a/tools/test/misc/vds/CMakeLists.txt
+++ b/tools/test/misc/vds/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_TEST_MISC_VDS)
#-----------------------------------------------------------------------------
diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt
index b7452e0..5104b90 100644
--- a/tools/test/perform/CMakeLists.txt
+++ b/tools/test/perform/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.3.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_TEST_PERFORM )
#-----------------------------------------------------------------------------