summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt535
-rw-r--r--CTestConfig.cmake2
-rw-r--r--MANIFEST22
-rw-r--r--c++/src/CMakeLists.txt114
-rw-r--r--c++/test/CMakeLists.txt5
-rwxr-xr-xconfig/cmake/CTestCustom.ctest16
-rw-r--r--config/cmake/ConfigureChecks.cmake93
-rw-r--r--config/cmake/FindMPI.cmake364
-rw-r--r--config/cmake/FindSZIP.cmake6
-rw-r--r--config/cmake/H5pubconf.h.in12
-rw-r--r--config/cmake/HDF5-config.cmake.build.in42
-rw-r--r--config/cmake/HDF5Tests.c8
-rw-r--r--config/cmake/hdf5-config-version.cmake.in27
-rw-r--r--config/cmake/hdf5-config.cmake.build.in49
-rw-r--r--config/cmake/hdf5-config.cmake.install.in (renamed from config/cmake/HDF5-config.cmake.install.in)61
-rw-r--r--config/cmake/hdf5_zlib.h.in1
-rw-r--r--config/cmake/runTest.cmake9
-rw-r--r--config/ibm-aix5
-rw-r--r--config/intel-flags2
-rw-r--r--config/pgi-flags4
-rw-r--r--config/powerpc-ibm-aix5.x5
-rwxr-xr-xconfigure8
-rw-r--r--configure.in4
-rw-r--r--fortran/CMakeLists.txt19
-rw-r--r--fortran/examples/CMakeLists.txt36
-rw-r--r--fortran/test/CMakeLists.txt2
-rw-r--r--fortran/testpar/CMakeLists.txt49
-rw-r--r--hl/CMakeLists.txt5
-rw-r--r--hl/c++/examples/CMakeLists.txt4
-rw-r--r--hl/c++/src/CMakeLists.txt5
-rw-r--r--hl/c++/test/CMakeLists.txt10
-rw-r--r--hl/fortran/CMakeLists.txt4
-rw-r--r--hl/fortran/examples/CMakeLists.txt4
-rw-r--r--hl/fortran/src/CMakeLists.txt10
-rw-r--r--hl/fortran/test/CMakeLists.txt2
-rw-r--r--hl/src/CMakeLists.txt2
-rw-r--r--hl/test/CMakeLists.txt11
-rw-r--r--hl/tools/CMakeLists.txt6
-rw-r--r--hl/tools/gif2h5/gif.h2
-rw-r--r--hl/tools/gif2h5/gif2hdf.c2
-rw-r--r--hl/tools/gif2h5/writehdf.c2
-rw-r--r--perform/CMakeLists.txt68
-rw-r--r--perform/sio_standalone.h3
-rw-r--r--release_docs/INSTALL22
-rw-r--r--release_docs/RELEASE.txt11
-rw-r--r--src/CMakeLists.txt31
-rw-r--r--src/H5A.c7
-rw-r--r--src/H5AC.c10
-rw-r--r--src/H5ACprivate.h2
-rw-r--r--src/H5Aint.c10
-rw-r--r--src/H5B.c4
-rw-r--r--src/H5B2hdr.c2
-rw-r--r--src/H5B2int.c94
-rw-r--r--src/H5C.c276
-rw-r--r--src/H5Cpkg.h21
-rw-r--r--src/H5Cprivate.h4
-rw-r--r--src/H5Dchunk.c11
-rw-r--r--src/H5Dcompact.c12
-rw-r--r--src/H5Dfill.c20
-rw-r--r--src/H5Dlayout.c9
-rw-r--r--src/H5Dproxy.c2
-rw-r--r--src/H5Dtest.c2
-rw-r--r--src/H5EAdblkpage.c2
-rw-r--r--src/H5EAdblock.c2
-rw-r--r--src/H5EAhdr.c2
-rw-r--r--src/H5EAiblock.c2
-rw-r--r--src/H5EAsblock.c2
-rw-r--r--src/H5F.c22
-rw-r--r--src/H5FAdblkpage.c2
-rw-r--r--src/H5FAdblock.c2
-rw-r--r--src/H5FAhdr.c2
-rw-r--r--src/H5FDdirect.c233
-rw-r--r--src/H5FDsec2.c42
-rw-r--r--src/H5FDstdio.c79
-rw-r--r--src/H5FS.c8
-rw-r--r--src/H5Faccum.c304
-rw-r--r--src/H5Fpkg.h2
-rw-r--r--src/H5Fsuper.c27
-rw-r--r--src/H5Gdeprec.c4
-rw-r--r--src/H5Gent.c4
-rw-r--r--src/H5Gname.c72
-rw-r--r--src/H5Gnode.c14
-rw-r--r--src/H5Gprivate.h4
-rw-r--r--src/H5Gtraverse.c109
-rw-r--r--src/H5HFdblock.c2
-rw-r--r--src/H5HFhdr.c2
-rw-r--r--src/H5HFiblock.c2
-rw-r--r--src/H5HFman.c12
-rw-r--r--src/H5HFsection.c48
-rw-r--r--src/H5HFtiny.c3
-rw-r--r--src/H5HG.c2
-rw-r--r--src/H5HL.c4
-rw-r--r--src/H5HLcache.c14
-rw-r--r--src/H5I.c50
-rw-r--r--src/H5Ipkg.h6
-rw-r--r--src/H5Itest.c98
-rw-r--r--src/H5Lexternal.c52
-rw-r--r--src/H5O.c71
-rw-r--r--src/H5Oalloc.c84
-rw-r--r--src/H5Oattribute.c23
-rw-r--r--src/H5Ochunk.c11
-rw-r--r--src/H5Ocopy.c12
-rw-r--r--src/H5Odtype.c2
-rw-r--r--src/H5Olayout.c13
-rw-r--r--src/H5Omtime.c43
-rw-r--r--src/H5Oprivate.h2
-rw-r--r--src/H5Osdspace.c8
-rw-r--r--src/H5Pdcpl.c4
-rwxr-xr-xsrc/H5SM.c6
-rw-r--r--src/H5SMcache.c5
-rw-r--r--src/H5SMmessage.c4
-rw-r--r--src/H5Shyper.c545
-rw-r--r--src/H5Sprivate.h1
-rw-r--r--src/H5Torder.c221
-rw-r--r--src/H5Tpublic.h3
-rw-r--r--src/H5Tvlen.c171
-rw-r--r--src/H5Z.c21
-rw-r--r--src/H5Zdeflate.c32
-rw-r--r--src/H5Znbit.c6
-rw-r--r--src/H5Zpublic.h2
-rw-r--r--src/H5Zscaleoffset.c23
-rw-r--r--src/H5Zszip.c6
-rw-r--r--src/H5Ztrans.c58
-rw-r--r--src/H5config.h.in9
-rw-r--r--src/H5dbg.c9
-rw-r--r--src/H5private.h16
-rw-r--r--src/H5win32defs.h6
-rwxr-xr-xsrc/Makefile.am2
-rw-r--r--src/Makefile.in7
-rw-r--r--test/CMakeLists.txt221
-rw-r--r--test/big.c9
-rw-r--r--test/cache_common.c2
-rw-r--r--test/cache_tagging.c2
-rw-r--r--test/cmpd_dset.c64
-rw-r--r--test/dsets.c454
-rw-r--r--test/dt_arith.c415
-rw-r--r--test/dtransform.c2
-rw-r--r--test/dtypes.c314
-rw-r--r--test/earray.c8
-rw-r--r--test/enum.c2
-rw-r--r--test/fillval.c2
-rw-r--r--test/freespace.c63
-rw-r--r--test/getname.c108
-rw-r--r--test/gheap.c69
-rw-r--r--test/h5test.h8
-rw-r--r--test/hyperslab.c30
-rw-r--r--test/links.c200
-rw-r--r--test/mtime.c12
-rwxr-xr-xtest/objcopy.c33
-rw-r--r--test/pool.c4
-rw-r--r--test/set_extent.c4
-rw-r--r--test/stab.c2
-rw-r--r--test/tattr.c16
-rw-r--r--test/testframe.c18
-rw-r--r--test/th5s.c4
-rw-r--r--test/trefer.c48
-rw-r--r--test/tselect.c2
-rw-r--r--test/tsohm.c198
-rw-r--r--test/tvlstr.c75
-rw-r--r--testpar/CMakeLists.txt9
-rw-r--r--testpar/t_cache.c141
-rw-r--r--testpar/t_rank_projection.c8
-rw-r--r--testpar/t_span_tree.c4
-rw-r--r--tools/h5copy/CMakeLists.txt52
-rw-r--r--tools/h5copy/h5copy.c2
-rw-r--r--tools/h5diff/CMakeLists.txt49
-rw-r--r--tools/h5diff/ph5diff_main.c1
-rw-r--r--tools/h5dump/CMakeLists.txt305
-rw-r--r--tools/h5dump/h5dump.c250
-rw-r--r--tools/h5dump/h5dumpgentest.c313
-rw-r--r--tools/h5dump/testh5dump.sh.in69
-rwxr-xr-xtools/h5dump/testh5dumpxml.sh.in3
-rw-r--r--tools/h5import/CMakeLists.txt35
-rw-r--r--tools/h5jam/CMakeLists.txt38
-rw-r--r--tools/h5jam/tellub.c2
-rw-r--r--tools/h5ls/CMakeLists.txt41
-rw-r--r--tools/h5ls/h5ls.c7
-rw-r--r--tools/h5repack/CMakeLists.txt136
-rwxr-xr-xtools/h5repack/h5repack.sh.in50
-rw-r--r--tools/h5repack/h5repack_copy.c16
-rw-r--r--tools/h5repack/h5repack_refs.c27
-rw-r--r--tools/h5stat/CMakeLists.txt43
-rw-r--r--tools/lib/CMakeLists.txt59
-rw-r--r--tools/lib/h5diff.c16
-rw-r--r--tools/lib/h5diff.h1
-rw-r--r--tools/lib/h5diff_array.c8
-rw-r--r--tools/lib/h5diff_util.c70
-rw-r--r--tools/lib/h5tools.c408
-rw-r--r--tools/lib/h5tools.h13
-rw-r--r--tools/lib/h5tools_str.c23
-rw-r--r--tools/lib/h5tools_str.h13
-rw-r--r--tools/lib/h5tools_utils.c193
-rw-r--r--tools/lib/h5tools_utils.h8
-rw-r--r--tools/lib/ph5diff.h2
-rw-r--r--tools/misc/CMakeLists.txt91
-rw-r--r--tools/testfiles/h5repack_filters.h5.ddl13
-rw-r--r--tools/testfiles/tbinregR.ddl21
-rw-r--r--tools/testfiles/tbinregR.exp7
-rw-r--r--tools/testfiles/texceedsubblock.ddl3
-rw-r--r--tools/testfiles/texceedsubcount.ddl3
-rw-r--r--tools/testfiles/texceedsubstart.ddl3
-rw-r--r--tools/testfiles/texceedsubstride.ddl3
-rw-r--r--tools/testfiles/tfpformat.h5.xml59
-rw-r--r--vms/src/make.com2
-rw-r--r--windows/proj/hdf5/hdf5.vcproj12
-rw-r--r--windows/proj/hdf5dll/hdf5dll.vcproj4
206 files changed, 6499 insertions, 3377 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cfae4d0..7e9ecc6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,6 +33,12 @@ PROJECT (HDF5 C CXX)
# name conflicts with system versions, then a prefix may be added
# to ensure that the correct versions configured are used.
#
+# HDF5_INSTALL_BIN_DIR, HDF5_INSTALL_LIB_DIR, HDF5_INSTALL_INCLUDE_DIR :
+# Customize the 'bin', 'lib', and 'include' installation directories.
+#
+# HDF5_INSTALL_NO_DEVELOPMENT :
+# Set to true to skip installation of headers and CMake package files.
+#
# Consider this example from the ParaView project, it builds its own zlib
# library and tells HDF5 to add it as a dependency - this ensures that
# any project making use of this build of HDF5 will use the correct zlib
@@ -41,52 +47,28 @@ PROJECT (HDF5 C CXX)
# SET(HDF5_EXTERNALLY_CONFIGURED 1)
# # Avoid duplicating names of installed libraries
# SET(HDF5_EXTERNAL_LIB_PREFIX "vtk")
-# # Targets linking to the HDF5 libs need to know their names
-# # if they are changed in the sub project, they should be here too
-# SET(HDF5_LIB_NAME "vtkhdf5")
-# SET(HDF5_HL_LIB_NAME "vtkhdf5_hl")
-# SET(HDF5_LIBRARY "${HDF5_LIB_NAME};${HDF5_HL_LIB_NAME}")
# # Export configuration to this export variable
# SET(HDF5_EXPORTED_TARGETS "paraview-targets")
#
# # Setup all necessary overrides for zlib so that HDF5 uses our
# # internally compiled zlib rather than any other version
# IF(HDF5_ENABLE_Z_LIB_SUPPORT)
-# # We must tell the main HDF5 library that it depends on our zlib
+# # We must tell the main HDF5 library that it depends on our zlib
# SET(HDF5_LIB_DEPENDENCIES vtkzlib)
# # Override the zlib header file
# IF(VTK_USE_SYSTEM_ZLIB)
# SET(H5_ZLIB_HEADER "zlib.h")
# ELSE(VTK_USE_SYSTEM_ZLIB)
-# SET(H5_ZLIB_HEADER "vtk_zlib.h")
+# SET(H5_ZLIB_HEADER "vtk_zlib.h")
# # Set vars that FindZlib would have set if used in sub project
# SET(ZLIB_INCLUDE_DIRS "${VTK_ZLIB_INCLUDE_DIRS}")
# SET(ZLIB_LIBRARIES vtkzlib)
# ENDIF(VTK_USE_SYSTEM_ZLIB)
-# ENDIF(HDF5_ENABLE_Z_LIB_SUPPORT)
-#
+# ENDIF(HDF5_ENABLE_Z_LIB_SUPPORT)
+#
# # Add the sub project
# ADD_SUBDIRECTORY(Utilities/hdf5-1.8)
-# # Add the HDf5 dirs to our include path
-# SET(HDF5_INCLUDE_DIR
-# ${ParaView_SOURCE_DIR}/Utilities/hdf5-1.8/src
-# ${ParaView_BINARY_DIR}/Utilities/hdf5-1.8
-# ${ParaView_SOURCE_DIR}/Utilities/hdf5-1.8/hl/src)
-#
-#-----------------------------------------------------------------------------
-
#-----------------------------------------------------------------------------
-# Basic HDF5 stuff here
-#-----------------------------------------------------------------------------
-SET (HDF5_PACKAGE "hdf5")
-SET (HDF5_PACKAGE_NAME "HDF5")
-SET (HDF5_PACKAGE_VERSION "${H5_VERS_MAJOR}.${H5_VERS_MINOR}.${H5_VERS_RELEASE}")
-SET (HDF5_PACKAGE_VERSION_MAJOR "${H5_VERS_MAJOR}.${H5_VERS_MINOR}")
-SET (HDF5_PACKAGE_VERSION_MINOR "${H5_VERS_RELEASE}")
-SET (HDF5_PACKAGE_STRING "${HDF5_PACKAGE_NAME} ${HDF5_PACKAGE_VERSION}")
-SET (HDF5_PACKAGE_TARNAME "hdf5")
-SET (HDF5_PACKAGE_URL "http://www.hdfgroup.org")
-SET (HDF5_PACKAGE_BUGREPORT "help@hdfgroup.org")
#-----------------------------------------------------------------------------
# Set the core names of all the libraries
@@ -121,17 +103,72 @@ SET (HDF5_HL_F90_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_HL_F90_LIB_CO
SET (HDF5_HL_F90_C_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_HL_F90_C_LIB_CORENAME}")
#-----------------------------------------------------------------------------
+# Set the target names of all the libraries
+#-----------------------------------------------------------------------------
+SET (HDF5_LIB_TARGET ${HDF5_LIB_CORENAME})
+SET (HDF5_TEST_LIB_TARGET ${HDF5_TEST_LIB_CORENAME})
+SET (HDF5_CPP_LIB_TARGET ${HDF5_CPP_LIB_CORENAME})
+SET (HDF5_HL_LIB_TARGET ${HDF5_HL_LIB_CORENAME})
+SET (HDF5_HL_CPP_LIB_TARGET ${HDF5_HL_CPP_LIB_CORENAME})
+SET (HDF5_TOOLS_LIB_TARGET ${HDF5_TOOLS_LIB_CORENAME})
+SET (HDF5_F90_LIB_TARGET ${HDF5_F90_LIB_CORENAME})
+SET (HDF5_F90_C_LIB_TARGET ${HDF5_F90_C_LIB_CORENAME})
+SET (HDF5_F90_TEST_LIB_TARGET ${HDF5_F90_TEST_LIB_CORENAME})
+SET (HDF5_F90_C_TEST_LIB_TARGET ${HDF5_F90_C_TEST_LIB_CORENAME})
+SET (HDF5_HL_F90_LIB_TARGET ${HDF5_HL_F90_LIB_CORENAME})
+SET (HDF5_HL_F90_C_LIB_TARGET ${HDF5_HL_F90_C_LIB_CORENAME})
+
+#-----------------------------------------------------------------------------
# Define some CMake variables for use later in the project
#-----------------------------------------------------------------------------
SET (HDF5_RESOURCES_DIR ${HDF5_SOURCE_DIR}/config/cmake)
SET (HDF5_SRC_DIR ${HDF5_SOURCE_DIR}/src)
-SET (HDF5_TEST_SOURCE_DIR ${HDF5_SOURCE_DIR}/test)
-SET (HDF5_CPP_SOURCE_DIR ${HDF5_SOURCE_DIR}/c++)
-SET (HDF5_CPP_TEST_DIR ${HDF5_CPP_SOURCE_DIR}/test)
-SET (HDF5_HL_SOURCE_DIR ${HDF5_SOURCE_DIR}/hl)
-SET (HDF5_TOOLS_SOURCE_DIR ${HDF5_SOURCE_DIR}/tools)
-SET (HDF5_PERFORM_SOURCE_DIR ${HDF5_SOURCE_DIR}/perform)
-SET (HDF5_F90_SOURCE_DIR ${HDF5_SOURCE_DIR}/fortran)
+SET (HDF5_TEST_SRC_DIR ${HDF5_SOURCE_DIR}/test)
+SET (HDF5_CPP_SRC_DIR ${HDF5_SOURCE_DIR}/c++)
+SET (HDF5_CPP_TST_DIR ${HDF5_SOURCE_DIR}/c++/test)
+SET (HDF5_HL_SRC_DIR ${HDF5_SOURCE_DIR}/hl)
+SET (HDF5_HL_CPP_SRC_DIR ${HDF5_SOURCE_DIR}/hl/c++)
+SET (HDF5_TOOLS_SRC_DIR ${HDF5_SOURCE_DIR}/tools)
+SET (HDF5_PERFORM_SRC_DIR ${HDF5_SOURCE_DIR}/perform)
+SET (HDF5_F90_SRC_DIR ${HDF5_SOURCE_DIR}/fortran)
+
+# set default prefix location
+SET (CMAKE_INSTALL_PREFIX "./hdf5" CACHE PATH "Install path prefix, prepended onto install directories")
+
+IF (NOT HDF5_INSTALL_BIN_DIR)
+ SET (HDF5_INSTALL_BIN_DIR bin)
+ENDIF (NOT HDF5_INSTALL_BIN_DIR)
+IF (NOT HDF5_INSTALL_LIB_DIR)
+ SET (HDF5_INSTALL_LIB_DIR lib)
+ENDIF (NOT HDF5_INSTALL_LIB_DIR)
+IF (NOT HDF5_INSTALL_INCLUDE_DIR)
+ SET (HDF5_INSTALL_INCLUDE_DIR include)
+ENDIF (NOT HDF5_INSTALL_INCLUDE_DIR)
+
+#-----------------------------------------------------------------------------
+# parse the full version number from H5public.h and include in H5_VERS_INFO
+#-----------------------------------------------------------------------------
+FILE (READ ${HDF5_SRC_DIR}/H5public.h _h5public_h_contents)
+STRING (REGEX REPLACE ".*#define[ \t]+H5_VERS_MAJOR[ \t]+([0-9]*).*$"
+ "\\1" H5_VERS_MAJOR ${_h5public_h_contents})
+STRING (REGEX REPLACE ".*#define[ \t]+H5_VERS_MINOR[ \t]+([0-9]*).*$"
+ "\\1" H5_VERS_MINOR ${_h5public_h_contents})
+STRING (REGEX REPLACE ".*#define[ \t]+H5_VERS_RELEASE[ \t]+([0-9]*).*$"
+ "\\1" H5_VERS_RELEASE ${_h5public_h_contents})
+#MESSAGE (STATUS "VERSION: ${H5_VERS_MAJOR}.${H5_VERS_MINOR}.${H5_VERS_RELEASE}-${H5_VERS_SUBRELEASE}")
+
+#-----------------------------------------------------------------------------
+# Basic HDF5 stuff here
+#-----------------------------------------------------------------------------
+SET (HDF5_PACKAGE "hdf5")
+SET (HDF5_PACKAGE_NAME "HDF5")
+SET (HDF5_PACKAGE_VERSION "${H5_VERS_MAJOR}.${H5_VERS_MINOR}.${H5_VERS_RELEASE}")
+SET (HDF5_PACKAGE_VERSION_MAJOR "${H5_VERS_MAJOR}.${H5_VERS_MINOR}")
+SET (HDF5_PACKAGE_VERSION_MINOR "${H5_VERS_RELEASE}")
+SET (HDF5_PACKAGE_STRING "${HDF5_PACKAGE_NAME} ${HDF5_PACKAGE_VERSION}")
+SET (HDF5_PACKAGE_TARNAME "hdf5")
+SET (HDF5_PACKAGE_URL "http://www.hdfgroup.org")
+SET (HDF5_PACKAGE_BUGREPORT "help@hdfgroup.org")
#-----------------------------------------------------------------------------
# Include some macros for reusable code
@@ -160,7 +197,7 @@ ELSE (NOT HDF5_EXTERNALLY_CONFIGURED)
IF (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
ENDIF (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
-ENDIF(NOT HDF5_EXTERNALLY_CONFIGURED)
+ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED)
#-----------------------------------------------------------------------------
# Targets built within this project are exported at Install time for use
@@ -175,7 +212,7 @@ ENDIF (NOT HDF5_EXPORTED_TARGETS)
# add it to this variable. This is NOT used by Make Install, but for projects
# which include hdf5 as a sub-project within their build tree
#-----------------------------------------------------------------------------
-SET_GLOBAL_VARIABLE(HDF5_LIBRARIES_TO_EXPORT "")
+SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "")
#-----------------------------------------------------------------------------
# Run all the CMake configuration tests for our build environment
@@ -212,7 +249,7 @@ IF (BUILD_SHARED_LIBS)
ELSE (BUILD_SHARED_LIBS)
IF (NOT WIN32)
# should this be a user setting : Everyone uses it anyway ?
- ADD_DEFINITIONS(-DPIC)
+ ADD_DEFINITIONS (-DPIC)
ENDIF (NOT WIN32)
IF (MSVC)
SET (CMAKE_MFC_FLAG 0)
@@ -239,22 +276,6 @@ IF (HDF5_ENABLE_COVERAGE)
ENDIF (HDF5_ENABLE_COVERAGE)
#-----------------------------------------------------------------------------
-# Set the target names of all the libraries
-#-----------------------------------------------------------------------------
-SET (HDF5_LIB_TARGET ${HDF5_LIB_CORENAME})
-SET (HDF5_TEST_LIB_TARGET ${HDF5_TEST_LIB_CORENAME})
-SET (HDF5_CPP_LIB_TARGET ${HDF5_CPP_LIB_CORENAME})
-SET (HDF5_HL_LIB_TARGET ${HDF5_HL_LIB_CORENAME})
-SET (HDF5_HL_CPP_LIB_TARGET ${HDF5_HL_CPP_LIB_CORENAME})
-SET (HDF5_TOOLS_LIB_TARGET ${HDF5_TOOLS_LIB_CORENAME})
-SET (HDF5_F90_LIB_TARGET ${HDF5_F90_LIB_CORENAME})
-SET (HDF5_F90_C_LIB_TARGET ${HDF5_F90_C_LIB_CORENAME})
-SET (HDF5_F90_TEST_LIB_TARGET ${HDF5_F90_TEST_LIB_CORENAME})
-SET (HDF5_F90_C_TEST_LIB_TARGET ${HDF5_F90_C_TEST_LIB_CORENAME})
-SET (HDF5_HL_F90_LIB_TARGET ${HDF5_HL_F90_LIB_CORENAME})
-SET (HDF5_HL_F90_C_LIB_TARGET ${HDF5_HL_F90_C_LIB_CORENAME})
-
-#-----------------------------------------------------------------------------
# When building utility executables that generate other (source) files :
# we make use of the following variables defined in the root CMakeLists.
# Certain systems may add /Debug or /Release to output paths
@@ -316,9 +337,9 @@ IF (HDF5_DISABLE_COMPILER_WARNINGS)
CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /w")
ENDIF (MSVC)
- IF(WIN32)
+ IF (WIN32)
ADD_DEFINITIONS (-D_CRT_SECURE_NO_WARNINGS)
- ENDIF(WIN32)
+ ENDIF (WIN32)
# Borland uses -w- to suppress warnings.
IF (BORLAND)
SET (HDF5_WARNINGS_BLOCKED 1)
@@ -343,18 +364,6 @@ IF (CMAKE_COMPILER_IS_GNUCXX)
ENDIF (CMAKE_COMPILER_IS_GNUCXX)
#-----------------------------------------------------------------------------
-# parse the full version number from H5public.h and include in H5_VERS_INFO
-#-----------------------------------------------------------------------------
-FILE (READ ${HDF5_SRC_DIR}/H5public.h _h5public_h_contents)
-STRING (REGEX REPLACE ".*#define[ \t]+H5_VERS_MAJOR[ \t]+([0-9]*).*$"
- "\\1" H5_VERS_MAJOR ${_h5public_h_contents})
-STRING (REGEX REPLACE ".*#define[ \t]+H5_VERS_MINOR[ \t]+([0-9]*).*$"
- "\\1" H5_VERS_MINOR ${_h5public_h_contents})
-STRING (REGEX REPLACE ".*#define[ \t]+H5_VERS_RELEASE[ \t]+([0-9]*).*$"
- "\\1" H5_VERS_RELEASE ${_h5public_h_contents})
-#MESSAGE (STATUS "VERSION: ${H5_VERS_MAJOR}.${H5_VERS_MINOR}.${H5_VERS_RELEASE}-${H5_VERS_SUBRELEASE}")
-
-#-----------------------------------------------------------------------------
# All libs/tests/examples need the main include directories
#-----------------------------------------------------------------------------
INCLUDE_DIRECTORIES (${HDF5_BINARY_DIR} ${HDF5_SRC_DIR})
@@ -362,6 +371,7 @@ INCLUDE_DIRECTORIES (${HDF5_BINARY_DIR} ${HDF5_SRC_DIR})
#-----------------------------------------------------------------------------
# Option to Enable MPI Parallel
#-----------------------------------------------------------------------------
+SET (CMAKE_MODULE_PATH ${HDF5_RESOURCES_DIR} ${CMAKE_MODULE_PATH})
OPTION (HDF5_ENABLE_PARALLEL "Enable parallel build (requires MPI)" OFF)
IF (HDF5_ENABLE_PARALLEL)
INCLUDE (FindMPI)
@@ -394,7 +404,7 @@ ENDIF (H5_HAVE_PARALLEL)
# Option to use 1.6.x API
#-----------------------------------------------------------------------------
OPTION (HDF5_USE_16_API_DEFAULT "Use the HDF5 1.6.x API by default" OFF)
-SET (USE_16_API_DEFAULT 0)
+SET (H5_USE_16_API_DEFAULT 0)
IF (HDF5_USE_16_API_DEFAULT)
SET (H5_USE_16_API_DEFAULT 1)
ENDIF (HDF5_USE_16_API_DEFAULT)
@@ -436,7 +446,6 @@ IF (HDF5_ENABLE_Z_LIB_SUPPORT)
SET (H5_HAVE_ZLIB_H 1)
SET (H5_HAVE_LIBZ 1)
ENDIF (NOT H5_ZLIB_HEADER)
- CONFIGURE_FILE (${HDF5_RESOURCES_DIR}/hdf5_zlib.h.in ${HDF5_BINARY_DIR}/hdf5_zlib.h @ONLY)
SET (LINK_LIBS ${LINK_LIBS} ${ZLIB_LIBRARIES})
INCLUDE_DIRECTORIES (${ZLIB_INCLUDE_DIRS})
MESSAGE (STATUS "Filter ZLIB is ON")
@@ -494,14 +503,25 @@ ENDIF (HDF5_BUILD_TOOLS AND BUILD_TESTING)
#-----------------------------------------------------------------------------
OPTION (BUILD_TESTING "Build HDF5 Unit Testing" OFF)
IF (BUILD_TESTING)
- SET (DART_TESTING_TIMEOUT 1200 CACHE INTEGER
- "Timeout in seconds for each test (default 1200=20minutes)")
+ SET (DART_TESTING_TIMEOUT 1200
+ CACHE INTEGER
+ "Timeout in seconds for each test (default 1200=20minutes)"
+ )
ENABLE_TESTING ()
INCLUDE (CTest)
IF (NOT HDF5_EXTERNALLY_CONFIGURED)
- ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/tools/lib ${PROJECT_BINARY_DIR}/tools/lib)
- ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/test ${PROJECT_BINARY_DIR}/test)
- ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/perform ${PROJECT_BINARY_DIR}/perform)
+ IF (EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test")
+ ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/tools/lib ${PROJECT_BINARY_DIR}/tools/lib)
+ ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/test ${PROJECT_BINARY_DIR}/test)
+ ENDIF (EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test")
+ IF (EXISTS "${HDF5_SOURCE_DIR}/perform" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/perform")
+ ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/perform ${PROJECT_BINARY_DIR}/perform)
+ ENDIF(EXISTS "${HDF5_SOURCE_DIR}/perform" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/perform")
+ IF (H5_HAVE_PARALLEL)
+ IF (EXISTS "${HDF5_SOURCE_DIR}/testpar" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/testpar")
+ ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/testpar ${PROJECT_BINARY_DIR}/testpar)
+ ENDIF (EXISTS "${HDF5_SOURCE_DIR}/testpar" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/testpar")
+ ENDIF (H5_HAVE_PARALLEL)
ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED)
INCLUDE (${HDF5_SOURCE_DIR}/CTestConfig.cmake)
ENDIF (BUILD_TESTING)
@@ -511,49 +531,62 @@ ENDIF (BUILD_TESTING)
# Make sure this appears before the CONFIGURE_FILE step
# so that fortran name mangling is detected before writing H5pubconf.h
#-----------------------------------------------------------------------------
-OPTION (HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF)
-IF (HDF5_BUILD_FORTRAN)
- # Set default name mangling : overridden by Fortran detection in fortran dir
- SET (H5_FC_FUNC "H5_FC_FUNC(name,NAME) name ## _")
- SET (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) name ## _")
- ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/fortran ${PROJECT_BINARY_DIR}/fortran)
-ELSE (HDF5_BUILD_FORTRAN)
- SET (H5_FC_FUNC "H5_FC_FUNC(name,NAME) name ## _")
- SET (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) name ## _")
-ENDIF (HDF5_BUILD_FORTRAN)
+# Set default name mangling : overridden by Fortran detection in fortran dir
+SET (H5_FC_FUNC "H5_FC_FUNC(name,NAME) name ## _")
+SET (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) name ## _")
+IF (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran")
+ OPTION (HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF)
+ IF (HDF5_BUILD_FORTRAN)
+ ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/fortran ${PROJECT_BINARY_DIR}/fortran)
+ IF (HDF5_BUILD_HL_LIB)
+ IF (EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran")
+ #-- Build the High Level Fortran source codes
+ ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/hl/fortran ${HDF5_BINARY_DIR}/hl/fortran)
+ ENDIF (EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran")
+ ENDIF (HDF5_BUILD_HL_LIB)
+ ENDIF (HDF5_BUILD_FORTRAN)
+ENDIF (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran")
#-----------------------------------------------------------------------------
# Option to build examples
#-----------------------------------------------------------------------------
-OPTION (HDF5_BUILD_EXAMPLES "Build HDF5 Library Examples" OFF)
-IF (HDF5_BUILD_EXAMPLES)
- ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/examples ${PROJECT_BINARY_DIR}/examples)
-ENDIF (HDF5_BUILD_EXAMPLES)
+IF (EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples")
+ OPTION (HDF5_BUILD_EXAMPLES "Build HDF5 Library Examples" OFF)
+ IF (HDF5_BUILD_EXAMPLES)
+ ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/examples ${PROJECT_BINARY_DIR}/examples)
+ ENDIF (HDF5_BUILD_EXAMPLES)
+ENDIF (EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples")
#-----------------------------------------------------------------------------
# Option to build HDF5 C++ Library
#-----------------------------------------------------------------------------
-OPTION (HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" OFF)
-IF (HDF5_BUILD_CPP_LIB)
- ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/c++ ${PROJECT_BINARY_DIR}/c++)
-ENDIF (HDF5_BUILD_CPP_LIB)
+IF (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++")
+ OPTION (HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" OFF)
+ IF (HDF5_BUILD_CPP_LIB)
+ ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/c++ ${PROJECT_BINARY_DIR}/c++)
+ ENDIF (HDF5_BUILD_CPP_LIB)
+ENDIF (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++")
#-----------------------------------------------------------------------------
# Option to build HDF5 Tools
#-----------------------------------------------------------------------------
-OPTION (HDF5_BUILD_TOOLS "Build HDF5 Tools" OFF)
-IF (HDF5_BUILD_TOOLS)
- ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/tools ${PROJECT_BINARY_DIR}/tools)
-ENDIF (HDF5_BUILD_TOOLS)
+IF (EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools")
+ OPTION (HDF5_BUILD_TOOLS "Build HDF5 Tools" OFF)
+ IF (HDF5_BUILD_TOOLS)
+ ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/tools ${PROJECT_BINARY_DIR}/tools)
+ ENDIF (HDF5_BUILD_TOOLS)
+ENDIF (EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools")
#-----------------------------------------------------------------------------
# Option to build High Level API's
#-----------------------------------------------------------------------------
-OPTION (HDF5_BUILD_HL_LIB "Build HIGH Level HDF5 Library" OFF)
-IF (HDF5_BUILD_HL_LIB)
- SET (H5_INCLUDE_HL 1)
- ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/hl ${PROJECT_BINARY_DIR}/hl)
-ENDIF (HDF5_BUILD_HL_LIB)
+IF (EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl")
+ OPTION (HDF5_BUILD_HL_LIB "Build HIGH Level HDF5 Library" OFF)
+ IF (HDF5_BUILD_HL_LIB)
+ SET (H5_INCLUDE_HL 1)
+ ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/hl ${PROJECT_BINARY_DIR}/hl)
+ ENDIF (HDF5_BUILD_HL_LIB)
+ENDIF (EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl")
#-----------------------------------------------------------------------------
# Generate the H5pubconf.h file containing user settings needed by compilation
@@ -563,174 +596,202 @@ CONFIGURE_FILE (${HDF5_RESOURCES_DIR}/H5pubconf.h.in ${HDF5_BINARY_DIR}/H5pubcon
#-----------------------------------------------------------------------------
# Add file(s) to CMake Install
#-----------------------------------------------------------------------------
-INSTALL (
- FILES
- ${PROJECT_BINARY_DIR}/H5pubconf.h
- DESTINATION
- include
- COMPONENT
- headers
-)
+IF (NOT HDF5_INSTALL_NO_DEVELOPMENT)
+ INSTALL (
+ FILES
+ ${PROJECT_BINARY_DIR}/H5pubconf.h
+ DESTINATION
+ ${HDF5_INSTALL_INCLUDE_DIR}
+ COMPONENT
+ headers
+ )
+ENDIF (NOT HDF5_INSTALL_NO_DEVELOPMENT)
#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install for import into other projects
#-----------------------------------------------------------------------------
-INSTALL (
- EXPORT
- ${HDF5_EXPORTED_TARGETS}
- DESTINATION
- lib
- FILE
- HDF5-targets.cmake
-)
+IF (NOT HDF5_EXTERNALLY_CONFIGURED)
+ INSTALL (
+ EXPORT
+ ${HDF5_EXPORTED_TARGETS}
+ DESTINATION
+ lib/cmake/hdf5-${HDF5_PACKAGE_VERSION}
+ FILE
+ hdf5-targets.cmake
+ )
+ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED)
#-----------------------------------------------------------------------------
# Export all exported targets to the build tree for use by parent project
#-----------------------------------------------------------------------------
-EXPORT (
- TARGETS
- ${HDF5_LIBRARIES_TO_EXPORT} ${HDF5_LIB_DEPENDENCIES}
- FILE
- HDF5-targets.cmake
-)
+IF (NOT HDF5_EXTERNALLY_CONFIGURED)
+ EXPORT (
+ TARGETS
+ ${HDF5_LIBRARIES_TO_EXPORT} ${HDF5_LIB_DEPENDENCIES}
+ FILE
+ hdf5-targets.cmake
+ )
+ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED)
#-----------------------------------------------------------------------------
-# Configure the HDF5-config.cmake file for the build directory
+# Configure the hdf5-config.cmake file for the build directory
#-----------------------------------------------------------------------------
SET (HDF5_INCLUDES_BUILD_TIME
- ${HDF5_SRC_DIR} ${HDF5_CPP_SOURCE_DIR} ${HDF5_HL_SOURCE_DIR}
- ${HDF5_TOOLS_SOURCE_DIR} ${HDF5_BINARY_DIR}
+ ${HDF5_SRC_DIR} ${HDF5_CPP_SRC_DIR} ${HDF5_HL_SRC_DIR}
+ ${HDF5_TOOLS_SRC_DIR} ${HDF5_BINARY_DIR}
)
SET (HDF5_VERSION_STRING @HDF5_PACKAGE_VERSION@)
SET (HDF5_VERSION_MAJOR @HDF5_PACKAGE_VERSION_MAJOR@)
SET (HDF5_VERSION_MINOR @HDF5_PACKAGE_VERSION_MINOR@)
CONFIGURE_FILE (
- ${HDF5_RESOURCES_DIR}/HDF5-config.cmake.build.in
- ${HDF5_BINARY_DIR}/HDF5-config.cmake @ONLY
+ ${HDF5_RESOURCES_DIR}/hdf5-config.cmake.build.in
+ ${HDF5_BINARY_DIR}/hdf5-config.cmake @ONLY
)
#-----------------------------------------------------------------------------
-# Configure the HDF5-config.cmake file for the install directory
+# Configure the hdf5-config.cmake file for the install directory
#-----------------------------------------------------------------------------
-INSTALL (CODE
- "SET (HDF5_INSTALL_SKIP_TARGETS 1)
- INCLUDE (${HDF5_BINARY_DIR}/HDF5-config.cmake)
- CONFIGURE_FILE (
- \"${HDF5_RESOURCES_DIR}/HDF5-config.cmake.install.in\"
- \"${CMAKE_INSTALL_PREFIX}/lib/HDF5-config.cmake\" @ONLY
- )
- "
-)
-
-#-----------------------------------------------------------------------------
-# Set the cpack variables
-#-----------------------------------------------------------------------------
-SET (CPACK_PACKAGE_VENDOR "The HDF Group")
-SET (CPACK_PACKAGE_NAME "${HDF5_PACKAGE_NAME}")
-SET (CPACK_PACKAGE_VERSION "${HDF5_PACKAGE_VERSION}")
-SET (CPACK_PACKAGE_VERSION_MAJOR "${HDF5_PACKAGE_VERSION_MAJOR}")
-SET (CPACK_PACKAGE_VERSION_MINOR "${HDF5_PACKAGE_VERSION_MINOR}")
-SET (CPACK_PACKAGE_VERSION_PATCH "")
-SET (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/COPYING")
-
-IF (WIN32)
- SET (CPACK_NSIS_PACKAGE_NAME "HDF5 ${HDF5_PACKAGE_VERSION}")
-ENDIF (WIN32)
-
-INCLUDE (CPack)
+IF (NOT HDF5_EXTERNALLY_CONFIGURED)
+ CONFIGURE_FILE (
+ ${HDF5_RESOURCES_DIR}/hdf5-config.cmake.install.in
+ ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config.cmake @ONLY
+ )
+ INSTALL (
+ FILES
+ ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config.cmake
+ DESTINATION
+ lib/cmake/hdf5-${HDF5_PACKAGE_VERSION}
+ )
+ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED)
#-----------------------------------------------------------------------------
-# Now list the cpack commands
+# Configure the hdf5-config-version .cmake file for the install directory
#-----------------------------------------------------------------------------
-CPACK_ADD_COMPONENT (applications
- DISPLAY_NAME "HDF5 Applications"
- DEPENDS libraries
- GROUP Applications
-)
-CPACK_ADD_COMPONENT (libraries
- DISPLAY_NAME "HDF5 Libraries"
- GROUP Runtime
-)
-CPACK_ADD_COMPONENT (headers
- DISPLAY_NAME "HDF5 Headers"
- DEPENDS libraries
- GROUP Development
-)
-
-IF (HDF5_BUILD_FORTRAN)
- CPACK_ADD_COMPONENT (fortlibraries
- DISPLAY_NAME "HDF5 Fortran Libraries"
- DEPENDS libraries
- GROUP Runtime
+IF (NOT HDF5_EXTERNALLY_CONFIGURED)
+ CONFIGURE_FILE (
+ ${HDF5_RESOURCES_DIR}/hdf5-config-version.cmake.in
+ ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config-version.cmake @ONLY
)
- CPACK_ADD_COMPONENT (fortheaders
- DISPLAY_NAME "HDF5 Fortran Headers"
- DEPENDS fortlibraries
- GROUP Development
+ INSTALL (
+ FILES
+ ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config-version.cmake
+ DESTINATION
+ lib/cmake/hdf5-${HDF5_PACKAGE_VERSION}
)
-ENDIF (HDF5_BUILD_FORTRAN)
+ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED)
-IF (HDF5_BUILD_CPP_LIB)
- CPACK_ADD_COMPONENT (cpplibraries
- DISPLAY_NAME "HDF5 C++ Libraries"
+#-----------------------------------------------------------------------------
+# Set the cpack variables
+#-----------------------------------------------------------------------------
+IF (NOT HDF5_EXTERNALLY_CONFIGURED AND EXISTS "${HDF5_SOURCE_DIR}/release_docs")
+ SET (CPACK_PACKAGE_VENDOR "The HDF Group")
+ SET (CPACK_PACKAGE_NAME "${HDF5_PACKAGE_NAME}")
+ SET (CPACK_PACKAGE_VERSION "${HDF5_PACKAGE_VERSION}")
+ SET (CPACK_PACKAGE_VERSION_MAJOR "${HDF5_PACKAGE_VERSION_MAJOR}")
+ SET (CPACK_PACKAGE_VERSION_MINOR "${HDF5_PACKAGE_VERSION_MINOR}")
+ SET (CPACK_PACKAGE_VERSION_PATCH "")
+ SET (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/COPYING")
+
+ IF (WIN32)
+ SET (CPACK_NSIS_PACKAGE_NAME "HDF5 ${HDF5_PACKAGE_VERSION}")
+ ENDIF (WIN32)
+
+ INCLUDE (CPack)
+
+ #---------------------------------------------------------------------------
+ # Now list the cpack commands
+ #---------------------------------------------------------------------------
+ CPACK_ADD_COMPONENT (applications
+ DISPLAY_NAME "HDF5 Applications"
DEPENDS libraries
- GROUP Runtime
- )
- CPACK_ADD_COMPONENT (cppheaders
- DISPLAY_NAME "HDF5 C++ Headers"
- DEPENDS cpplibraries
- GROUP Development
- )
-ENDIF (HDF5_BUILD_CPP_LIB)
-
-IF (HDF5_BUILD_TOOLS)
- CPACK_ADD_COMPONENT (toolsapplications
- DISPLAY_NAME "HDF5 Tools Applications"
- DEPENDS toolslibraries
GROUP Applications
)
- CPACK_ADD_COMPONENT (toolslibraries
- DISPLAY_NAME "HDF5 Tools Libraries"
- DEPENDS libraries
+ CPACK_ADD_COMPONENT (libraries
+ DISPLAY_NAME "HDF5 Libraries"
GROUP Runtime
)
- CPACK_ADD_COMPONENT (toolsheaders
- DISPLAY_NAME "HDF5 Tools Headers"
- DEPENDS toolslibraries
- GROUP Development
- )
-ENDIF (HDF5_BUILD_TOOLS)
-
-IF (HDF5_BUILD_HL_LIB)
- CPACK_ADD_COMPONENT (hllibraries
- DISPLAY_NAME "HDF5 HL Libraries"
+ CPACK_ADD_COMPONENT (headers
+ DISPLAY_NAME "HDF5 Headers"
DEPENDS libraries
- GROUP Runtime
- )
- CPACK_ADD_COMPONENT (hlheaders
- DISPLAY_NAME "HDF5 HL Headers"
- DEPENDS hllibraries
GROUP Development
)
- CPACK_ADD_COMPONENT (hltoolsapplications
- DISPLAY_NAME "HDF5 HL Tools Applications"
- DEPENDS hllibraries
- GROUP Applications
- )
- CPACK_ADD_COMPONENT (hlcpplibraries
- DISPLAY_NAME "HDF5 HL C++ Libraries"
- DEPENDS hllibraries
- GROUP Runtime
- )
- CPACK_ADD_COMPONENT (hlcppheaders
- DISPLAY_NAME "HDF5 HL C++ Headers"
- DEPENDS hlcpplibraries
- GROUP Development
- )
- CPACK_ADD_COMPONENT (hlfortlibraries
- DISPLAY_NAME "HDF5 HL Fortran Libraries"
- DEPENDS fortlibraries
- GROUP Runtime
- )
-ENDIF (HDF5_BUILD_HL_LIB)
+
+ IF (HDF5_BUILD_FORTRAN)
+ CPACK_ADD_COMPONENT (fortlibraries
+ DISPLAY_NAME "HDF5 Fortran Libraries"
+ DEPENDS libraries
+ GROUP Runtime
+ )
+ CPACK_ADD_COMPONENT (fortheaders
+ DISPLAY_NAME "HDF5 Fortran Headers"
+ DEPENDS fortlibraries
+ GROUP Development
+ )
+ ENDIF (HDF5_BUILD_FORTRAN)
+
+ IF (HDF5_BUILD_CPP_LIB)
+ CPACK_ADD_COMPONENT (cpplibraries
+ DISPLAY_NAME "HDF5 C++ Libraries"
+ DEPENDS libraries
+ GROUP Runtime
+ )
+ CPACK_ADD_COMPONENT (cppheaders
+ DISPLAY_NAME "HDF5 C++ Headers"
+ DEPENDS cpplibraries
+ GROUP Development
+ )
+ ENDIF (HDF5_BUILD_CPP_LIB)
+
+ IF (HDF5_BUILD_TOOLS)
+ CPACK_ADD_COMPONENT (toolsapplications
+ DISPLAY_NAME "HDF5 Tools Applications"
+ DEPENDS toolslibraries
+ GROUP Applications
+ )
+ CPACK_ADD_COMPONENT (toolslibraries
+ DISPLAY_NAME "HDF5 Tools Libraries"
+ DEPENDS libraries
+ GROUP Runtime
+ )
+ CPACK_ADD_COMPONENT (toolsheaders
+ DISPLAY_NAME "HDF5 Tools Headers"
+ DEPENDS toolslibraries
+ GROUP Development
+ )
+ ENDIF (HDF5_BUILD_TOOLS)
+
+ IF (HDF5_BUILD_HL_LIB)
+ CPACK_ADD_COMPONENT (hllibraries
+ DISPLAY_NAME "HDF5 HL Libraries"
+ DEPENDS libraries
+ GROUP Runtime
+ )
+ CPACK_ADD_COMPONENT (hlheaders
+ DISPLAY_NAME "HDF5 HL Headers"
+ DEPENDS hllibraries
+ GROUP Development
+ )
+ CPACK_ADD_COMPONENT (hltoolsapplications
+ DISPLAY_NAME "HDF5 HL Tools Applications"
+ DEPENDS hllibraries
+ GROUP Applications
+ )
+ CPACK_ADD_COMPONENT (hlcpplibraries
+ DISPLAY_NAME "HDF5 HL C++ Libraries"
+ DEPENDS hllibraries
+ GROUP Runtime
+ )
+ CPACK_ADD_COMPONENT (hlcppheaders
+ DISPLAY_NAME "HDF5 HL C++ Headers"
+ DEPENDS hlcpplibraries
+ GROUP Development
+ )
+ CPACK_ADD_COMPONENT (hlfortlibraries
+ DISPLAY_NAME "HDF5 HL Fortran Libraries"
+ DEPENDS fortlibraries
+ GROUP Runtime
+ )
+ ENDIF (HDF5_BUILD_HL_LIB)
+
+ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED AND EXISTS "${HDF5_SOURCE_DIR}/release_docs")
diff --git a/CTestConfig.cmake b/CTestConfig.cmake
index f2f45e1..eb7dbee 100644
--- a/CTestConfig.cmake
+++ b/CTestConfig.cmake
@@ -11,3 +11,5 @@ set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "nei.hdfgroup.uiuc.edu")
set(CTEST_DROP_LOCATION "/cdash/submit.php?project=HDF5+Trunk")
set(CTEST_DROP_SITE_CDASH TRUE)
+
+set(UPDATE_TYPE svn)
diff --git a/MANIFEST b/MANIFEST
index 2cccab3..01b728b 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -641,6 +641,7 @@
./src/H5Ipkg.h
./src/H5Iprivate.h
./src/H5Ipublic.h
+./src/H5Itest.c
./src/H5L.c
./src/H5Lexternal.c
./src/H5Lpkg.h
@@ -1196,6 +1197,8 @@
./tools/testfiles/tattrreg.h5
./tools/testfiles/tattrreg.ddl
./tools/testfiles/tattrregR.ddl
+./tools/testfiles/tbinregR.exp
+./tools/testfiles/tbinregR.ddl
./tools/testfiles/tbitfields.h5
./tools/testfiles/tchar.h5
./tools/testfiles/tchar1.ddl
@@ -1220,6 +1223,10 @@
./tools/testfiles/tempty.ddl
./tools/testfiles/tempty.h5
./tools/testfiles/tenum.h5
+./tools/testfiles/texceedsubblock.ddl
+./tools/testfiles/texceedsubcount.ddl
+./tools/testfiles/texceedsubstart.ddl
+./tools/testfiles/texceedsubstride.ddl
./tools/testfiles/textlink.h5
./tools/testfiles/textlink.h5.xml
./tools/testfiles/textlinkfar.ddl
@@ -1364,6 +1371,8 @@
./tools/testfiles/torderattr.h5
./tools/testfiles/tfpformat.ddl
./tools/testfiles/tfpformat.h5
+# h5dump h5repack validation
+./tools/testfiles/h5repack_filters.h5.ddl
# Expected output from h5ls tests
@@ -1436,6 +1445,7 @@
./tools/testfiles/tdset2.h5.xml
./tools/testfiles/tempty.h5.xml
./tools/testfiles/tenum.h5.xml
+./tools/testfiles/tfpformat.h5.xml
./tools/testfiles/tgroup.h5.xml
./tools/testfiles/thlink.h5.xml
./tools/testfiles/tloop.h5.xml
@@ -1496,7 +1506,6 @@
./tools/testfiles/torderattr1.h5.xml
-
#test files for h5diff
./tools/h5diff/testfiles/h5diff_10.txt
./tools/h5diff/testfiles/h5diff_11.txt
@@ -1680,8 +1689,6 @@
./tools/h5jam/testfiles/twithub513.h5
./tools/h5jam/testfiles/u513.txt
-
-
# test files for h5copy
./tools/h5copy/testfiles/h5copytst.h5
./tools/h5copy/testfiles/h5copytst.out.ls
@@ -1810,7 +1817,6 @@
./hl/tools/gif2h5/testfiles/image1.gif
./hl/tools/gif2h5/testfiles/h52giftst.h5
-
# hl fortran
./hl/fortran/COPYING
./hl/fortran/Makefile.am
@@ -1911,10 +1917,11 @@
./config/cmake/CheckTypeSize.cmake
./config/cmake/H5cxx_config.h.in
./config/cmake/H5pubconf.h.in
-./config/cmake/hdf5_zlib.h.in
./config/cmake/FindHDF5.cmake
-./config/cmake/HDF5-config.cmake.build.in
-./config/cmake/HDF5-config.cmake.install.in
+./config/cmake/FindMPI.cmake
+./config/cmake/hdf5-config.cmake.build.in
+./config/cmake/hdf5-config.cmake.install.in
+./config/cmake/hdf5-config-version.cmake.in
./config/cmake/HDF5Macros.cmake
./config/cmake/libhdf5.settings.cmake.in
./config/cmake/cacheinit.cmake
@@ -1934,6 +1941,7 @@
./fortran/examples/CMakeLists.txt
./fortran/src/CMakeLists.txt
./fortran/test/CMakeLists.txt
+./fortran/testpar/CMakeLists.txt
./hl/CMakeLists.txt
./hl/c++/CMakeLists.txt
./hl/c++/examples/CMakeLists.txt
diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt
index fee9a6a..4c6dd5f 100644
--- a/c++/src/CMakeLists.txt
+++ b/c++/src/CMakeLists.txt
@@ -19,66 +19,66 @@ CONFIGURE_FILE (${HDF5_RESOURCES_DIR}/H5cxx_config.h.in
# Define cpp Library
#-----------------------------------------------------------------------------
SET (CPP_SRCS
- ${HDF5_CPP_SOURCE_DIR}/src/H5AbstractDs.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5ArrayType.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5AtomType.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5Attribute.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5CommonFG.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5CompType.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5DataSet.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5DataSpace.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5DataType.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5DcreatProp.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5DxferProp.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5EnumType.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5Exception.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5FaccProp.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5FcreatProp.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5File.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5FloatType.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5Group.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5IdComponent.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5IntType.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5Library.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5Object.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5PredType.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5PropList.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5StrType.cpp
- ${HDF5_CPP_SOURCE_DIR}/src/H5VarLenType.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5AbstractDs.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5ArrayType.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5AtomType.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5Attribute.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5CommonFG.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5CompType.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5DataSet.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5DataSpace.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5DataType.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5DcreatProp.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5DxferProp.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5EnumType.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5Exception.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5FaccProp.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5FcreatProp.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5File.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5FloatType.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5Group.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5IdComponent.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5IntType.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5Library.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5Object.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5PredType.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5PropList.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5StrType.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5VarLenType.cpp
)
SET (CPP_HDRS
- ${HDF5_CPP_SOURCE_DIR}/src/H5AbstractDs.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5Alltypes.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5ArrayType.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5AtomType.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5Attribute.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5Classes.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5CommonFG.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5CompType.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5Cpp.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5CppDoc.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5DataSet.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5DataSpace.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5DataType.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5DcreatProp.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5DxferProp.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5EnumType.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5Exception.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5FaccProp.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5FcreatProp.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5File.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5FloatType.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5Group.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5IdComponent.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5Include.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5IntType.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5Library.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5Object.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5PredType.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5PropList.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5StrType.h
- ${HDF5_CPP_SOURCE_DIR}/src/H5VarLenType.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5AbstractDs.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5Alltypes.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5ArrayType.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5AtomType.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5Attribute.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5Classes.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5CommonFG.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5CompType.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5Cpp.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5CppDoc.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5DataSet.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5DataSpace.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5DataType.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5DcreatProp.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5DxferProp.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5EnumType.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5Exception.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5FaccProp.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5FcreatProp.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5File.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5FloatType.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5Group.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5IdComponent.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5Include.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5IntType.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5Library.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5Object.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5PredType.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5PropList.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5StrType.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5VarLenType.h
)
ADD_LIBRARY (${HDF5_CPP_LIB_TARGET} ${LIB_TYPE} ${CPP_SRCS} ${CPP_HDRS})
diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt
index 770348e..722bd37 100644
--- a/c++/test/CMakeLists.txt
+++ b/c++/test/CMakeLists.txt
@@ -1,4 +1,5 @@
cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_CPP_TEST)
# --------------------------------------------------------------------
# Notes: When creating unit test executables they should be prefixed
# with "cpp_". This allows for easier filtering of the test suite when
@@ -7,8 +8,6 @@ cmake_minimum_required (VERSION 2.8)
# which would only run the C++ based unit tests.
# --------------------------------------------------------------------
-PROJECT (HDF5_CPP_TEST)
-
#-----------------------------------------------------------------------------
# Define Sources
#-----------------------------------------------------------------------------
@@ -34,7 +33,7 @@ SET (srcdir ${CMAKE_CURRENT_SOURCE_DIR})
CONFIGURE_FILE (${HDF5_CPP_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY)
INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR})
-INCLUDE_DIRECTORIES (${HDF5_TEST_SOURCE_DIR} )
+INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR} )
ADD_EXECUTABLE (cpp_testhdf5 ${CPP_TEST_SRCS} )
H5_NAMING (cpp_testhdf5)
diff --git a/config/cmake/CTestCustom.ctest b/config/cmake/CTestCustom.ctest
index 23b4163..d55a559 100755
--- a/config/cmake/CTestCustom.ctest
+++ b/config/cmake/CTestCustom.ctest
@@ -1,2 +1,18 @@
SET (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 1500)
+SET (CTEST_CUSTOM_WARNING_EXCEPTION
+ ${CTEST_CUSTOM_WARNING_EXCEPTION}
+ "H5detect.c.[0-9]+. : warning C4090:"
+ "testhdf5.h.[0-9]+. : warning C4005:"
+ "disabling jobserver mode"
+)
+
+SET (CTEST_CUSTOM_MEMCHECK_IGNORE
+ ${CTEST_CUSTOM_MEMCHECK_IGNORE}
+ H5DUMP
+ H5DIFF
+ H5REPACK
+ H5STAT
+ H5COPY
+ H5LS
+)
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake
index 47e6521..3a16856 100644
--- a/config/cmake/ConfigureChecks.cmake
+++ b/config/cmake/ConfigureChecks.cmake
@@ -17,7 +17,15 @@ MESSAGE (STATUS " GetConsoleScreenBufferInfo function for Windows")
# Always SET this for now IF we are on an OS X box
#-----------------------------------------------------------------------------
IF (APPLE)
- SET (H5_AC_APPLE_UNIVERSAL_BUILD 1)
+ LIST(LENGTH CMAKE_OSX_ARCHITECTURES ARCH_LENGTH)
+ IF(ARCH_LENGTH GREATER 1)
+ set (CMAKE_OSX_ARCHITECTURES "" CACHE STRING "" FORCE)
+ message(FATAL_ERROR "Building Universal Binaries on OS X is NOT supported by the HDF5 project. This is"
+ "due to technical reasons. The best approach would be build each architecture in separate directories"
+ "and use the 'lipo' tool to combine them into a single executable or library. The 'CMAKE_OSX_ARCHITECTURES'"
+ "variable has been set to a blank value which will build the default architecture for this system.")
+ ENDIF()
+ SET (H5_AC_APPLE_UNIVERSAL_BUILD 0)
ENDIF (APPLE)
#-----------------------------------------------------------------------------
@@ -366,6 +374,8 @@ CHECK_FUNCTION_EXISTS (ioctl H5_HAVE_IOCTL)
CHECK_FUNCTION_EXISTS (difftime H5_HAVE_DIFFTIME)
CHECK_FUNCTION_EXISTS (fseeko H5_HAVE_FSEEKO)
CHECK_FUNCTION_EXISTS (ftello H5_HAVE_FTELLO)
+CHECK_FUNCTION_EXISTS (fseeko64 H5_HAVE_FSEEKO64)
+CHECK_FUNCTION_EXISTS (ftello64 H5_HAVE_FTELLO64)
CHECK_FUNCTION_EXISTS (fstat64 H5_HAVE_FSTAT64)
CHECK_FUNCTION_EXISTS (stat64 H5_HAVE_STAT64)
@@ -466,7 +476,7 @@ MACRO (HDF5_FUNCTION_TEST OTHER_TEST)
# (STATUS "Performing ${OTHER_TEST}")
TRY_COMPILE (${OTHER_TEST}
${CMAKE_BINARY_DIR}
- ${HDF5_RESOURCES_DIR}//HDF5Tests.c
+ ${HDF5_RESOURCES_DIR}/HDF5Tests.c
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
"${OTHER_TEST_ADD_LIBRARIES}"
OUTPUT_VARIABLE OUTPUT
@@ -491,6 +501,7 @@ ENDMACRO (HDF5_FUNCTION_TEST)
IF (WINDOWS)
SET (H5_HAVE_TIMEZONE 1)
SET (H5_HAVE_FUNCTION 1)
+ SET (H5_LONE_COLON 0)
ELSE (WINDOWS)
FOREACH (test
TIME_WITH_SYS_TIME
@@ -513,6 +524,7 @@ ELSE (WINDOWS)
HAVE_C99_FUNC
HAVE_C99_DESIGNATED_INITIALIZER
CXX_HAVE_OFFSETOF
+ LONE_COLON
)
HDF5_FUNCTION_TEST (${test})
ENDFOREACH (test)
@@ -523,7 +535,6 @@ ENDIF (WINDOWS)
#-----------------------------------------------------------------------------
IF (HAVE_OFF64_T)
CHECK_FUNCTION_EXISTS (lseek64 H5_HAVE_LSEEK64)
- CHECK_FUNCTION_EXISTS (fseek64 H5_HAVE_FSEEK64)
ENDIF (HAVE_OFF64_T)
#-----------------------------------------------------------------------------
@@ -551,44 +562,46 @@ ENDIF (INLINE_TEST___inline__)
#-----------------------------------------------------------------------------
# Check how to print a Long Long integer
#-----------------------------------------------------------------------------
-SET (H5_PRINTF_LL_WIDTH "H5_PRINTF_LL_WIDTH")
-IF (H5_PRINTF_LL_WIDTH MATCHES "^H5_PRINTF_LL_WIDTH$")
- SET (PRINT_LL_FOUND 0)
- MESSAGE (STATUS "Checking for appropriate format for 64 bit long:")
- FOREACH (HDF5_PRINTF_LL l64 l L q I64 ll)
- SET (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH=${HDF5_PRINTF_LL}")
- IF (H5_SIZEOF_LONG_LONG)
- SET (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG")
- ENDIF (H5_SIZEOF_LONG_LONG)
- TRY_RUN (HDF5_PRINTF_LL_TEST_RUN HDF5_PRINTF_LL_TEST_COMPILE
- ${HDF5_BINARY_DIR}/CMake
- ${HDF5_RESOURCES_DIR}/HDF5Tests.c
- CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CURRENT_TEST_DEFINITIONS}
- OUTPUT_VARIABLE OUTPUT
- )
- IF (HDF5_PRINTF_LL_TEST_COMPILE)
- IF (HDF5_PRINTF_LL_TEST_RUN MATCHES 0)
- SET (H5_PRINTF_LL_WIDTH "\"${HDF5_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll")
- SET (PRINT_LL_FOUND 1)
- ELSE (HDF5_PRINTF_LL_TEST_RUN MATCHES 0)
- MESSAGE ("Width with ${HDF5_PRINTF_LL} failed with result: ${HDF5_PRINTF_LL_TEST_RUN}")
- ENDIF (HDF5_PRINTF_LL_TEST_RUN MATCHES 0)
- ELSE (HDF5_PRINTF_LL_TEST_COMPILE)
- FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
- "Test H5_PRINTF_LL_WIDTH for ${HDF5_PRINTF_LL} failed with the following output:\n ${OUTPUT}\n"
+IF (NOT H5_PRINTF_LL_WIDTH OR H5_PRINTF_LL_WIDTH MATCHES "unknown")
+ SET (H5_PRINTF_LL_WIDTH "H5_PRINTF_LL_WIDTH")
+ IF (H5_PRINTF_LL_WIDTH MATCHES "^H5_PRINTF_LL_WIDTH$")
+ SET (PRINT_LL_FOUND 0)
+ MESSAGE (STATUS "Checking for appropriate format for 64 bit long:")
+ FOREACH (HDF5_PRINTF_LL l64 l L q I64 ll)
+ SET (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH=${HDF5_PRINTF_LL}")
+ IF (H5_SIZEOF_LONG_LONG)
+ SET (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG")
+ ENDIF (H5_SIZEOF_LONG_LONG)
+ TRY_RUN (HDF5_PRINTF_LL_TEST_RUN HDF5_PRINTF_LL_TEST_COMPILE
+ ${HDF5_BINARY_DIR}/CMake
+ ${HDF5_RESOURCES_DIR}/HDF5Tests.c
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CURRENT_TEST_DEFINITIONS}
+ OUTPUT_VARIABLE OUTPUT
)
- ENDIF (HDF5_PRINTF_LL_TEST_COMPILE)
- ENDFOREACH (HDF5_PRINTF_LL)
-
- IF (PRINT_LL_FOUND)
- MESSAGE (STATUS "Checking for apropriate format for 64 bit long: found ${H5_PRINTF_LL_WIDTH}")
- ELSE (PRINT_LL_FOUND)
- MESSAGE (STATUS "Checking for apropriate format for 64 bit long: not found")
- SET (H5_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL
- "Width for printf for type `long long' or `__int64', us. `ll"
- )
- ENDIF (PRINT_LL_FOUND)
-ENDIF (H5_PRINTF_LL_WIDTH MATCHES "^H5_PRINTF_LL_WIDTH$")
+ IF (HDF5_PRINTF_LL_TEST_COMPILE)
+ IF (HDF5_PRINTF_LL_TEST_RUN MATCHES 0)
+ SET (H5_PRINTF_LL_WIDTH "\"${HDF5_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll")
+ SET (PRINT_LL_FOUND 1)
+ ELSE (HDF5_PRINTF_LL_TEST_RUN MATCHES 0)
+ MESSAGE ("Width with ${HDF5_PRINTF_LL} failed with result: ${HDF5_PRINTF_LL_TEST_RUN}")
+ ENDIF (HDF5_PRINTF_LL_TEST_RUN MATCHES 0)
+ ELSE (HDF5_PRINTF_LL_TEST_COMPILE)
+ FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+ "Test H5_PRINTF_LL_WIDTH for ${HDF5_PRINTF_LL} failed with the following output:\n ${OUTPUT}\n"
+ )
+ ENDIF (HDF5_PRINTF_LL_TEST_COMPILE)
+ ENDFOREACH (HDF5_PRINTF_LL)
+
+ IF (PRINT_LL_FOUND)
+ MESSAGE (STATUS "Checking for apropriate format for 64 bit long: found ${H5_PRINTF_LL_WIDTH}")
+ ELSE (PRINT_LL_FOUND)
+ MESSAGE (STATUS "Checking for apropriate format for 64 bit long: not found")
+ SET (H5_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL
+ "Width for printf for type `long long' or `__int64', us. `ll"
+ )
+ ENDIF (PRINT_LL_FOUND)
+ ENDIF (H5_PRINTF_LL_WIDTH MATCHES "^H5_PRINTF_LL_WIDTH$")
+ENDIF (NOT H5_PRINTF_LL_WIDTH OR H5_PRINTF_LL_WIDTH MATCHES "unknown")
# ----------------------------------------------------------------------
# Set the flag to indicate that the machine can handle converting
diff --git a/config/cmake/FindMPI.cmake b/config/cmake/FindMPI.cmake
new file mode 100644
index 0000000..555d2d5
--- /dev/null
+++ b/config/cmake/FindMPI.cmake
@@ -0,0 +1,364 @@
+# - Message Passing Interface (MPI) module.
+#
+# The Message Passing Interface (MPI) is a library used to write
+# high-performance parallel applications that use message passing, and
+# is typically deployed on a cluster. MPI is a standard interface
+# (defined by the MPI forum) for which many implementations are
+# available. All of these implementations have somewhat different
+# compilation approaches (different include paths, libraries to link
+# against, etc.), and this module tries to smooth out those differences.
+#
+# This module will set the following variables:
+# MPI_FOUND TRUE if we have found MPI
+# MPI_COMPILE_FLAGS Compilation flags for MPI programs
+# MPI_INCLUDE_PATH Include path(s) for MPI header
+# MPI_LINK_FLAGS Linking flags for MPI programs
+# MPI_LIBRARY First MPI library to link against (cached)
+# MPI_EXTRA_LIBRARY Extra MPI libraries to link against (cached)
+# MPI_LIBRARIES All libraries to link MPI programs against
+# MPIEXEC Executable for running MPI programs
+# MPIEXEC_NUMPROC_FLAG Flag to pass to MPIEXEC before giving it the
+# number of processors to run on
+# MPIEXEC_PREFLAGS Flags to pass to MPIEXEC directly before the
+# executable to run.
+# MPIEXEC_POSTFLAGS Flags to pass to MPIEXEC after all other flags.
+#
+# This module will attempt to auto-detect these settings, first by
+# looking for a MPI compiler, which many MPI implementations provide
+# as a pass-through to the native compiler to simplify the compilation
+# of MPI programs. The MPI compiler is stored in the cache variable
+# MPI_COMPILER, and will attempt to look for commonly-named drivers
+# mpic++, mpicxx, mpiCC, or mpicc. If the compiler driver is found and
+# recognized, it will be used to set all of the module variables. To
+# skip this auto-detection, set MPI_LIBRARY and MPI_INCLUDE_PATH in
+# the CMake cache.
+#
+# If no compiler driver is found or the compiler driver is not
+# recognized, this module will then search for common include paths
+# and library names to try to detect MPI.
+#
+# If CMake initially finds a different MPI than was intended, and you
+# want to use the MPI compiler auto-detection for a different MPI
+# implementation, set MPI_COMPILER to the MPI compiler driver you want
+# to use (e.g., mpicxx) and then set MPI_LIBRARY to the string
+# MPI_LIBRARY-NOTFOUND. When you re-configure, auto-detection of MPI
+# will run again with the newly-specified MPI_COMPILER.
+#
+# When using MPIEXEC to execute MPI applications, you should typically
+# use all of the MPIEXEC flags as follows:
+# ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} PROCS ${MPIEXEC_PREFLAGS} EXECUTABLE
+# ${MPIEXEC_POSTFLAGS} ARGS
+# where PROCS is the number of processors on which to execute the program,
+# EXECUTABLE is the MPI program, and ARGS are the arguments to pass to the
+# MPI program.
+
+#=============================================================================
+# Copyright 2001-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distributed this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# This module is maintained by David Partyka <dave.partyka@kitware.com>.
+
+# A set of directories to search through in addition to the standard system paths
+# that find_program will search through.
+# Microsoft HPC SDK is automatically added to the system path
+# Argonne National Labs MPICH2 sets a registry key that we can use.
+
+set(_MPI_PACKAGE_DIR
+ mpi
+ mpich
+ openmpi
+ lib/mpi
+ lib/mpich
+ lib/openmpi
+ "MPICH/SDK"
+ "Microsoft Compute Cluster Pack"
+ )
+
+set(_MPI_PREFIX_PATH)
+if(WIN32)
+ list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]/..")
+ list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH2;Path]")
+endif()
+
+foreach(SystemPrefixDir ${CMAKE_SYSTEM_PREFIX_PATH})
+ foreach(MpiPackageDir ${_MPI_PREFIX_PATH})
+ if(EXISTS ${SystemPrefixDir}/${MpiPackageDir})
+ list(APPEND _MPI_PREFIX_PATH "${SystemPrefixDir}/${MpiPackageDir}")
+ endif()
+ endforeach(MpiPackageDir)
+endforeach(SystemPrefixDir)
+
+# Most mpi distros have some form of mpiexec which gives us something we can reliably look for.
+find_program(MPIEXEC
+ NAMES mpiexec mpirun lamexec
+ PATHS ${_MPI_PREFIX_PATH}
+ PATH_SUFFIXES bin
+ 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}" PATH)
+get_filename_component(_MPI_BASE_DIR "${_MPI_BASE_DIR}" PATH)
+
+# If there is an mpi compiler find it and interogate (farther below) it for the include
+# and lib dirs otherwise we will continue to search from ${_MPI_BASE_DIR}.
+find_program(MPI_COMPILER
+ NAMES mpiCC mpicc mpic++ mpicxx
+ HINTS "${_MPI_BASE_DIR}"
+ PATH_SUFFIXES bin
+ DOC "MPI compiler. Used only to detect MPI compilation flags.")
+mark_as_advanced(MPI_COMPILER)
+
+set(MPIEXEC_NUMPROC_FLAG "-np" 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 come after all flags given to MPIEXEC.")
+set(MPIEXEC_MAX_NUMPROCS "2" CACHE STRING "Maximum number of processors available to run MPI applications.")
+mark_as_advanced(MPIEXEC MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS
+ MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS)
+
+if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+ # Do nothing: we already have MPI_INCLUDE_PATH and MPI_LIBRARY in
+ # the cache, and we don't want to override those settings.
+elseif (MPI_COMPILER)
+ # 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.
+ # Note that Windows distros do not have an mpi compiler to interogate.
+ exec_program(${MPI_COMPILER}
+ ARGS -showme:compile
+ OUTPUT_VARIABLE MPI_COMPILE_CMDLINE
+ RETURN_VALUE MPI_COMPILER_RETURN)
+
+ if (MPI_COMPILER_RETURN EQUAL 0)
+ # If we appear to have -showme:compile, then we should also have
+ # -showme:link. Try it.
+ exec_program(${MPI_COMPILER}
+ ARGS -showme:link
+ OUTPUT_VARIABLE MPI_LINK_CMDLINE
+ RETURN_VALUE MPI_COMPILER_RETURN)
+
+ # Note that we probably have -showme:incdirs and -showme:libdirs
+ # as well.
+ set(MPI_COMPILER_MAY_HAVE_INCLIBDIRS TRUE)
+ endif (MPI_COMPILER_RETURN EQUAL 0)
+
+ if (MPI_COMPILER_RETURN EQUAL 0)
+ # Do nothing: we have our command lines now
+ else (MPI_COMPILER_RETURN EQUAL 0)
+ # Older versions of LAM-MPI have "-showme". Try it.
+ exec_program(${MPI_COMPILER}
+ ARGS -showme
+ OUTPUT_VARIABLE MPI_COMPILE_CMDLINE
+ RETURN_VALUE MPI_COMPILER_RETURN)
+ endif (MPI_COMPILER_RETURN EQUAL 0)
+
+ if (MPI_COMPILER_RETURN EQUAL 0)
+ # Do nothing: we have our command lines now
+ else (MPI_COMPILER_RETURN EQUAL 0)
+ # MPICH uses "-show". Try it.
+ exec_program(${MPI_COMPILER}
+ ARGS -show
+ OUTPUT_VARIABLE MPI_COMPILE_CMDLINE
+ RETURN_VALUE MPI_COMPILER_RETURN)
+ endif (MPI_COMPILER_RETURN EQUAL 0)
+
+ if (MPI_COMPILER_RETURN EQUAL 0)
+ # We have our command lines, but we might need to copy
+ # MPI_COMPILE_CMDLINE into MPI_LINK_CMDLINE, if the underlying
+ if (NOT MPI_LINK_CMDLINE)
+ SET(MPI_LINK_CMDLINE ${MPI_COMPILE_CMDLINE})
+ endif (NOT MPI_LINK_CMDLINE)
+ else (MPI_COMPILER_RETURN EQUAL 0)
+ message(STATUS "Unable to determine MPI from MPI driver ${MPI_COMPILER}")
+ endif (MPI_COMPILER_RETURN EQUAL 0)
+endif (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+
+if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+ # Do nothing: we already have MPI_INCLUDE_PATH and MPI_LIBRARY in
+ # the cache, and we don't want to override those settings.
+elseif (MPI_COMPILE_CMDLINE)
+ # Extract compile flags from the compile command line.
+ string(REGEX MATCHALL "-D([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_FLAGS "${MPI_COMPILE_CMDLINE}")
+ set(MPI_COMPILE_FLAGS_WORK)
+ foreach(FLAG ${MPI_ALL_COMPILE_FLAGS})
+ if (MPI_COMPILE_FLAGS_WORK)
+ set(MPI_COMPILE_FLAGS_WORK "${MPI_COMPILE_FLAGS_WORK} ${FLAG}")
+ else(MPI_COMPILE_FLAGS_WORK)
+ set(MPI_COMPILE_FLAGS_WORK ${FLAG})
+ endif(MPI_COMPILE_FLAGS_WORK)
+ endforeach(FLAG)
+
+ # Extract include paths from compile command line
+ string(REGEX MATCHALL "-I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}")
+ set(MPI_INCLUDE_PATH_WORK)
+ foreach(IPATH ${MPI_ALL_INCLUDE_PATHS})
+ string(REGEX REPLACE "^-I" "" IPATH ${IPATH})
+ string(REGEX REPLACE "//" "/" IPATH ${IPATH})
+ list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH})
+ endforeach(IPATH)
+
+ if (NOT MPI_INCLUDE_PATH_WORK)
+ if (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
+ # The compile command line didn't have any include paths on it,
+ # but we may have -showme:incdirs. Use it.
+ exec_program(${MPI_COMPILER}
+ ARGS -showme:incdirs
+ OUTPUT_VARIABLE MPI_INCLUDE_PATH_WORK
+ RETURN_VALUE MPI_COMPILER_RETURN)
+ separate_arguments(MPI_INCLUDE_PATH_WORK)
+ endif (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
+ endif (NOT MPI_INCLUDE_PATH_WORK)
+
+ if (NOT MPI_INCLUDE_PATH_WORK)
+ # If all else fails, just search for mpi.h in the normal include
+ # paths.
+ find_path(MPI_INCLUDE_PATH mpi.h
+ HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+ PATH_SUFFIXES include
+ )
+ set(MPI_INCLUDE_PATH_WORK ${MPI_INCLUDE_PATH})
+ endif (NOT MPI_INCLUDE_PATH_WORK)
+
+ # Extract linker paths from the link command line
+ string(REGEX MATCHALL "-L([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}")
+ set(MPI_LINK_PATH)
+ foreach(LPATH ${MPI_ALL_LINK_PATHS})
+ string(REGEX REPLACE "^-L" "" LPATH ${LPATH})
+ string(REGEX REPLACE "//" "/" LPATH ${LPATH})
+ list(APPEND MPI_LINK_PATH ${LPATH})
+ endforeach(LPATH)
+
+ if (NOT MPI_LINK_PATH)
+ if (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
+ # The compile command line didn't have any linking paths on it,
+ # but we may have -showme:libdirs. Use it.
+ exec_program(${MPI_COMPILER}
+ ARGS -showme:libdirs
+ OUTPUT_VARIABLE MPI_LINK_PATH
+ RETURN_VALUE MPI_COMPILER_RETURN)
+ separate_arguments(MPI_LINK_PATH)
+ endif (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
+ endif (NOT MPI_LINK_PATH)
+
+ # Extract linker flags from the link command line
+ string(REGEX MATCHALL "-Wl,([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")
+ set(MPI_LINK_FLAGS_WORK)
+ foreach(FLAG ${MPI_ALL_LINK_FLAGS})
+ if (MPI_LINK_FLAGS_WORK)
+ set(MPI_LINK_FLAGS_WORK "${MPI_LINK_FLAGS_WORK} ${FLAG}")
+ else(MPI_LINK_FLAGS_WORK)
+ set(MPI_LINK_FLAGS_WORK ${FLAG})
+ endif(MPI_LINK_FLAGS_WORK)
+ endforeach(FLAG)
+
+ # Extract the set of libraries to link against from the link command
+ # line
+ string(REGEX MATCHALL "-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
+
+ # Determine full path names for all of the libraries that one needs
+ # to link against in an MPI program
+ set(MPI_LIBRARIES)
+ foreach(LIB ${MPI_LIBNAMES})
+ string(REGEX REPLACE "^-l" "" LIB ${LIB})
+ set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+ find_library(MPI_LIB ${LIB} HINTS ${MPI_LINK_PATH})
+ if (MPI_LIB)
+ list(APPEND MPI_LIBRARIES ${MPI_LIB})
+ else (MPI_LIB)
+ message(SEND_ERROR "Unable to find MPI library ${LIB}")
+ endif (MPI_LIB)
+ endforeach(LIB)
+ set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE INTERNAL "Scratch variable for MPI detection" FORCE)
+
+ # Chop MPI_LIBRARIES into the old-style MPI_LIBRARY and
+ # MPI_EXTRA_LIBRARY.
+ list(LENGTH MPI_LIBRARIES MPI_NUMLIBS)
+ list(LENGTH MPI_LIBNAMES MPI_NUMLIBS_EXPECTED)
+ if (MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED)
+ list(GET MPI_LIBRARIES 0 MPI_LIBRARY_WORK)
+ set(MPI_LIBRARY ${MPI_LIBRARY_WORK} CACHE FILEPATH "MPI library to link against" FORCE)
+ else (MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED)
+ set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND" CACHE FILEPATH "MPI library to link against" FORCE)
+ endif (MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED)
+ 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} CACHE STRING "Extra MPI libraries to link against" FORCE)
+ else (MPI_NUMLIBS GREATER 1)
+ set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND" CACHE STRING "Extra MPI libraries to link against" FORCE)
+ endif (MPI_NUMLIBS GREATER 1)
+
+ # Set up all of the appropriate cache entries
+ set(MPI_COMPILE_FLAGS ${MPI_COMPILE_FLAGS_WORK} CACHE STRING "MPI compilation flags" FORCE)
+ set(MPI_INCLUDE_PATH ${MPI_INCLUDE_PATH_WORK} CACHE STRING "MPI include path" FORCE)
+ set(MPI_LINK_FLAGS ${MPI_LINK_FLAGS_WORK} CACHE STRING "MPI linking flags" FORCE)
+else (MPI_COMPILE_CMDLINE)
+# No MPI compiler to interogate so attempt to find everything with find functions.
+ find_path(MPI_INCLUDE_PATH mpi.h
+ HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+ PATH_SUFFIXES include
+ )
+
+ # Decide between 32-bit and 64-bit libraries for Microsoft's MPI
+ if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
+ set(MS_MPI_ARCH_DIR amd64)
+ else()
+ set(MS_MPI_ARCH_DIR i386)
+ endif()
+
+ find_library(MPI_LIBRARY
+ NAMES mpi mpich msmpi
+ HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+ PATH_SUFFIXES lib lib/${MS_MPI_ARCH_DIR} Lib Lib/${MS_MPI_ARCH_DIR}
+ )
+
+ find_library(MPI_EXTRA_LIBRARY
+ NAMES mpi++
+ HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+ PATH_SUFFIXES lib
+ DOC "Extra MPI libraries to link against.")
+
+ set(MPI_COMPILE_FLAGS "" CACHE STRING "MPI compilation flags")
+ set(MPI_LINK_FLAGS "" CACHE STRING "MPI linking flags")
+endif (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+
+# on BlueGene/L the MPI lib is named libmpich.rts.a, there also these additional libs are required
+if("${MPI_LIBRARY}" MATCHES "mpich.rts")
+ set(MPI_EXTRA_LIBRARY ${MPI_EXTRA_LIBRARY} msglayer.rts devices.rts rts.rts devices.rts)
+ set(MPI_LIBRARY ${MPI_LIBRARY} msglayer.rts devices.rts rts.rts devices.rts)
+endif("${MPI_LIBRARY}" MATCHES "mpich.rts")
+
+# Set up extra variables to conform to
+if (MPI_EXTRA_LIBRARY)
+ set(MPI_LIBRARIES ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
+else (MPI_EXTRA_LIBRARY)
+ set(MPI_LIBRARIES ${MPI_LIBRARY})
+endif (MPI_EXTRA_LIBRARY)
+
+if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+ set(MPI_FOUND TRUE)
+else (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+ set(MPI_FOUND FALSE)
+endif (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments
+find_package_handle_standard_args(MPI DEFAULT_MSG MPI_LIBRARY MPI_INCLUDE_PATH)
+
+mark_as_advanced(MPI_INCLUDE_PATH MPI_COMPILE_FLAGS MPI_LINK_FLAGS MPI_LIBRARY
+ MPI_EXTRA_LIBRARY)
+
+# unset to cleanup namespace
+unset(_MPI_PACKAGE_DIR)
+unset(_MPI_PREFIX_PATH)
+unset(_MPI_BASE_DIR)
diff --git a/config/cmake/FindSZIP.cmake b/config/cmake/FindSZIP.cmake
index 190b0b5..6118f7a 100644
--- a/config/cmake/FindSZIP.cmake
+++ b/config/cmake/FindSZIP.cmake
@@ -8,10 +8,10 @@
# SZIP_FOUND, If false, do not try to use SZIP.
# also defined, but not for general use are
# SZIP_LIBRARY, where to find the SZIP library.
-# SZIP_LIBRARY_DEBUG - Debug version of tiff library
-# SZIP_LIBRARY_RELEASE - Release Version of tiff library
+# SZIP_LIBRARY_DEBUG - Debug version of SZIP library
+# SZIP_LIBRARY_RELEASE - Release Version of SZIP library
-# MESSAGE (STATUS "Finding Szip library and headers..." )
+# MESSAGE (STATUS "Finding SZIP library and headers..." )
############################################
#
diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in
index 3f4bdc5..fdcf6b2 100644
--- a/config/cmake/H5pubconf.h.in
+++ b/config/cmake/H5pubconf.h.in
@@ -142,18 +142,21 @@
/* Define to 1 if you have the `frexpl' function. */
#cmakedefine H5_HAVE_FREXPL @H5_HAVE_FREXPL@
-/* Define to 1 if you have the `fseek64' function. */
-#cmakedefine H5_HAVE_FSEEK64 @H5_HAVE_FSEEK64@
-
/* Define to 1 if you have the `fseeko' function. */
#cmakedefine H5_HAVE_FSEEKO @H5_HAVE_FSEEKO@
+/* Define to 1 if you have the `fseeko64' function. */
+#cmakedefine H5_HAVE_FSEEKO64 @H5_HAVE_FSEEKO64@
+
/* Define to 1 if you have the `fstat64' function. */
#cmakedefine H5_HAVE_FSTAT64 @H5_HAVE_FSTAT64@
/* Define to 1 if you have the `ftello' function. */
#cmakedefine H5_HAVE_FTELLO @H5_HAVE_FTELLO@
+/* Define to 1 if you have the `ftello64' function. */
+#cmakedefine H5_HAVE_FTELLO64 @H5_HAVE_FTELLO64@
+
/* Define to 1 if you have the `ftruncate64' function. */
#cmakedefine H5_HAVE_FTRUNCATE64 @H5_HAVE_FTRUNCATE64@
@@ -317,6 +320,9 @@
/* Define to 1 if you have the <stdint.h> header file. */
#cmakedefine H5_HAVE_STDINT_H @H5_HAVE_STDINT_H@
+/* Define to 1 if you have the <stdint.h> header file for Cplusplus. */
+#cmakedefine H5_HAVE_STDINT_H_CXX @H5_HAVE_STDINT_H_CXX@
+
/* Define to 1 if you have the <stdlib.h> header file. */
#cmakedefine H5_HAVE_STDLIB_H @H5_HAVE_STDLIB_H@
diff --git a/config/cmake/HDF5-config.cmake.build.in b/config/cmake/HDF5-config.cmake.build.in
deleted file mode 100644
index 132e8be..0000000
--- a/config/cmake/HDF5-config.cmake.build.in
+++ /dev/null
@@ -1,42 +0,0 @@
-#-----------------------------------------------------------------------------
-# HDF5 Config file for compiling against hdf5 build directory
-#-----------------------------------------------------------------------------
-
-SET (HDF5_INCLUDE_DIRS "@HDF5_INCLUDES_BUILD_TIME@")
-
-#-----------------------------------------------------------------------------
-# Don't include targets if this file is being picked up by another
-# project which has already build hdf5 as a subproject
-#-----------------------------------------------------------------------------
-IF (NOT TARGET "hdf5" AND NOT HDF5_INSTALL_SKIP_TARGETS)
- GET_FILENAME_COMPONENT (SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
- INCLUDE (${SELF_DIR}/HDF5-targets.cmake)
-ENDIF (NOT TARGET "hdf5" AND NOT HDF5_INSTALL_SKIP_TARGETS)
-
-SET (HDF5_VERSION_STRING @HDF5_VERSION_STRING@)
-SET (HDF5_VERSION_MAJOR @HDF5_VERSION_MAJOR@)
-SET (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@)
-
-SET (HDF5_ENABLE_PARALLEL @HDF5_ENABLE_PARALLEL@)
-SET (HDF5_BUILD_FORTRAN @HDF5_BUILD_FORTRAN@)
-SET (HDF5_BUILD_CPP_LIB @HDF5_BUILD_CPP_LIB@)
-SET (HDF5_BUILD_TOOLS @HDF5_BUILD_TOOLS@)
-SET (HDF5_BUILD_HL_LIB @HDF5_BUILD_HL_LIB@)
-
-#
-# To be continued ...
-#
-# XXX_INCLUDE_DIRS The final set of include directories listed in one variable for use by client code. This should not be a cache entry.
-# XXX_LIBRARIES The libraries to link against to use XXX. These should include full paths. This should not be a cache entry.
-# XXX_DEFINITIONS Definitions to use when compiling code that uses XXX. This really shouldn't include options such as (-DHAS_JPEG)that a client source-code file uses to decide whether to #include <jpeg.h>
-# XXX_EXECUTABLE Where to find the XXX tool.
-# XXX_YYY_EXECUTABLE Where to find the YYY tool that comes with XXX.
-# XXX_LIBRARY_DIRS Optionally, the final set of library directories listed in one variable for use by client code. This should not be a cache entry.
-# XXX_ROOT_DIR Where to find the base directory of XXX.
-# XXX_VERSION_YY Expect Version YY if true. Make sure at most one of these is ever true.
-# XXX_WRAP_YY If False, do not try to use the relevent CMake wrapping command.
-# XXX_YY_FOUND If False, optional YY part of XXX sytem is not available.
-# XXX_FOUND Set to false, or undefined, if we haven't found, or don't want to use XXX.
-# XXX_RUNTIME_LIBRARY_DIRS Optionally, the runtime library search path for use when running an executable linked to shared libraries.
-# The list should be used by user code to create the PATH on windows or LD_LIBRARY_PATH on unix.
-# This should not be a cache entry.
diff --git a/config/cmake/HDF5Tests.c b/config/cmake/HDF5Tests.c
index 35e7258..f909ed9 100644
--- a/config/cmake/HDF5Tests.c
+++ b/config/cmake/HDF5Tests.c
@@ -364,3 +364,11 @@ int main(void)
}
#endif
+#ifdef LONE_COLON
+int main(int argc, char * argv)
+{
+ return 0;
+}
+#endif
+
+
diff --git a/config/cmake/hdf5-config-version.cmake.in b/config/cmake/hdf5-config-version.cmake.in
new file mode 100644
index 0000000..c1201cc
--- /dev/null
+++ b/config/cmake/hdf5-config-version.cmake.in
@@ -0,0 +1,27 @@
+#-----------------------------------------------------------------------------
+# HDF5 Version file for install directory
+#-----------------------------------------------------------------------------
+
+SET (PACKAGE_VERSION @HDF5_VERSION_STRING@)
+
+IF ("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL @H5_VERS_MAJOR@)
+
+ # exact match for version @H5_VERS_MAJOR@.@H5_VERS_MINOR@
+ IF ("${PACKAGE_FIND_VERSION_MINOR}" EQUAL @H5_VERS_MINOR@)
+
+ # compatible with any version @H5_VERS_MAJOR@.@H5_VERS_MINOR@.x
+ SET (PACKAGE_VERSION_COMPATIBLE 1)
+
+ IF ("${PACKAGE_FIND_VERSION_PATCH}" EQUAL @H5_VERS_RELEASE@)
+ SET (PACKAGE_VERSION_EXACT 1)
+
+ IF ("${PACKAGE_FIND_VERSION_TWEAK}" EQUAL @H5_VERS_SUBRELEASE@)
+ # not using this yet
+ ENDIF ("${PACKAGE_FIND_VERSION_TWEAK}" EQUAL @H5_VERS_SUBRELEASE@)
+
+ ENDIF ("${PACKAGE_FIND_VERSION_PATCH}" EQUAL @H5_VERS_RELEASE@)
+
+ ENDIF ("${PACKAGE_FIND_VERSION_MINOR}" EQUAL @H5_VERS_MINOR@)
+ENDIF ("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL @H5_VERS_MAJOR@)
+
+
diff --git a/config/cmake/hdf5-config.cmake.build.in b/config/cmake/hdf5-config.cmake.build.in
new file mode 100644
index 0000000..32bab7c
--- /dev/null
+++ b/config/cmake/hdf5-config.cmake.build.in
@@ -0,0 +1,49 @@
+#-----------------------------------------------------------------------------
+# HDF5 Config file for compiling against hdf5 build directory
+#-----------------------------------------------------------------------------
+GET_FILENAME_COMPONENT (SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+#-----------------------------------------------------------------------------
+# User Options
+#-----------------------------------------------------------------------------
+SET (HDF5_ENABLE_PARALLEL @HDF5_ENABLE_PARALLEL@)
+SET (HDF5_BUILD_FORTRAN @HDF5_BUILD_FORTRAN@)
+SET (HDF5_BUILD_CPP_LIB @HDF5_BUILD_CPP_LIB@)
+SET (HDF5_BUILD_TOOLS @HDF5_BUILD_TOOLS@)
+SET (HDF5_BUILD_HL_LIB @HDF5_BUILD_HL_LIB@)
+
+#-----------------------------------------------------------------------------
+# Directories
+#-----------------------------------------------------------------------------
+SET (HDF5_INCLUDE_DIR "@HDF5_INCLUDES_BUILD_TIME@")
+
+IF (HDF5_BUILD_FORTRAN)
+ SET (HDF5_INCLUDE_DIR_FORTRAN "@CMAKE_Fortran_MODULE_DIRECTORY@" )
+ENDIF (HDF5_BUILD_FORTRAN)
+
+IF (HDF5_BUILD_CPP_LIB)
+ SET (HDF5_INCLUDE_DIR_CPP ${HDF5_INCLUDE_DIR} )
+ENDIF (HDF5_BUILD_CPP_LIB)
+
+IF (HDF5_BUILD_HL_LIB)
+ SET (HDF5_INCLUDE_DIR_HL ${HDF5_INCLUDE_DIR} )
+ENDIF (HDF5_BUILD_HL_LIB)
+
+IF (HDF5_BUILD_TOOLS)
+ SET (HDF5_INCLUDE_DIR_TOOLS ${HDF5_INCLUDE_DIR} )
+ENDIF (HDF5_BUILD_TOOLS)
+
+#-----------------------------------------------------------------------------
+# Version Strings
+#-----------------------------------------------------------------------------
+SET (HDF5_VERSION_STRING @HDF5_VERSION_STRING@)
+SET (HDF5_VERSION_MAJOR @HDF5_VERSION_MAJOR@)
+SET (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@)
+
+#-----------------------------------------------------------------------------
+# Don't include targets if this file is being picked up by another
+# project which has already build hdf5 as a subproject
+#-----------------------------------------------------------------------------
+IF (NOT TARGET "hdf5")
+ INCLUDE (${SELF_DIR}/hdf5-targets.cmake)
+ENDIF (NOT TARGET "hdf5")
diff --git a/config/cmake/HDF5-config.cmake.install.in b/config/cmake/hdf5-config.cmake.install.in
index 2c33edf..ba5ba9a 100644
--- a/config/cmake/HDF5-config.cmake.install.in
+++ b/config/cmake/hdf5-config.cmake.install.in
@@ -1,35 +1,62 @@
#-----------------------------------------------------------------------------
# HDF5 Config file for compiling against hdf5 install directory
#-----------------------------------------------------------------------------
-
GET_FILENAME_COMPONENT (SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
-GET_FILENAME_COMPONENT (HDF5_INCLUDE_DIRS "${SELF_DIR}/../include" ABSOLUTE)
-SET (HDF5_FORTRAN_DIR ${HDF5_INCLUDE_DIRS}/fortran)
#-----------------------------------------------------------------------------
-# Don't include targets if this file is being picked up by another
-# project which has already build hdf5 as a subproject
+# User Options
#-----------------------------------------------------------------------------
-IF (NOT TARGET "hdf5")
- INCLUDE (${SELF_DIR}/HDF5-targets.cmake)
-ENDIF (NOT TARGET "hdf5")
-
-SET (HDF5_VERSION_STRING @HDF5_VERSION_STRING@)
-SET (HDF5_VERSION_MAJOR @HDF5_VERSION_MAJOR@)
-SET (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@)
-
SET (HDF5_ENABLE_PARALLEL @HDF5_ENABLE_PARALLEL@)
SET (HDF5_BUILD_FORTRAN @HDF5_BUILD_FORTRAN@)
SET (HDF5_BUILD_CPP_LIB @HDF5_BUILD_CPP_LIB@)
SET (HDF5_BUILD_TOOLS @HDF5_BUILD_TOOLS@)
SET (HDF5_BUILD_HL_LIB @HDF5_BUILD_HL_LIB@)
+#-----------------------------------------------------------------------------
+# Directories
+#-----------------------------------------------------------------------------
+SET (HDF5_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include" )
+
+IF (HDF5_BUILD_FORTRAN)
+ SET (HDF5_INCLUDE_DIR_FORTRAN "@CMAKE_INSTALL_PREFIX@/include/fortran" )
+ENDIF (HDF5_BUILD_FORTRAN)
+
+IF (HDF5_BUILD_CPP_LIB)
+ SET (HDF5_INCLUDE_DIR_CPP "@CMAKE_INSTALL_PREFIX@/include/cpp" )
+ENDIF (HDF5_BUILD_CPP_LIB)
+
+IF (HDF5_BUILD_HL_LIB)
+ SET (HDF5_INCLUDE_DIR_HL "@CMAKE_INSTALL_PREFIX@/include/hl" )
+ENDIF (HDF5_BUILD_HL_LIB)
+
+IF (HDF5_BUILD_TOOLS)
+ SET (HDF5_INCLUDE_DIR_TOOLS "@CMAKE_INSTALL_PREFIX@/include/tools" )
+ENDIF (HDF5_BUILD_TOOLS)
+
+#-----------------------------------------------------------------------------
+# Version Strings
+#-----------------------------------------------------------------------------
+SET (HDF5_VERSION_STRING @HDF5_VERSION_STRING@)
+SET (HDF5_VERSION_MAJOR @HDF5_VERSION_MAJOR@)
+SET (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@)
+
+#-----------------------------------------------------------------------------
+# Don't include targets if this file is being picked up by another
+# project which has already built hdf5 as a subproject
+#-----------------------------------------------------------------------------
+IF (NOT TARGET "hdf5")
+ INCLUDE (${SELF_DIR}/hdf5-targets.cmake)
+ENDIF (NOT TARGET "hdf5")
+
+#-----------------------------------------------------------------------------
+# Unfinished
+#-----------------------------------------------------------------------------
#
-# To be continued ...
+# To be continued (maybe) ...
#
-# XXX_INCLUDE_DIRS The final set of include directories listed in one variable for use by client code. This should not be a cache entry.
-# XXX_LIBRARIES The libraries to link against to use XXX. These should include full paths. This should not be a cache entry.
-# XXX_DEFINITIONS Definitions to use when compiling code that uses XXX. This really shouldn't include options such as (-DHAS_JPEG)that a client source-code file uses to decide whether to #include <jpeg.h>
+# XXX_INCLUDE_DIRS no, use one per library as in HDF5_FORTRAN_INCLUDE_DIR
+# XXX_LIBRARIES not needed - see hdf5-targets.cmake
+# XXX_DEFINITIONS Definitions to use when compiling code that uses XXX. This really shouldn't include options such as (-DHAS_JPEG) that a client source-code file uses to decide whether to #include <jpeg.h>
# XXX_EXECUTABLE Where to find the XXX tool.
# XXX_YYY_EXECUTABLE Where to find the YYY tool that comes with XXX.
# XXX_LIBRARY_DIRS Optionally, the final set of library directories listed in one variable for use by client code. This should not be a cache entry.
diff --git a/config/cmake/hdf5_zlib.h.in b/config/cmake/hdf5_zlib.h.in
deleted file mode 100644
index 104db27..0000000
--- a/config/cmake/hdf5_zlib.h.in
+++ /dev/null
@@ -1 +0,0 @@
-#include <@H5_ZLIB_HEADER@>
diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake
index 4218671..227ef9b 100644
--- a/config/cmake/runTest.cmake
+++ b/config/cmake/runTest.cmake
@@ -17,6 +17,9 @@ ENDIF (NOT TEST_OUTPUT)
#IF (NOT TEST_EXPECT)
# MESSAGE (STATUS "Require TEST_EXPECT to be defined")
#ENDIF (NOT TEST_EXPECT)
+#IF (NOT TEST_FILTER)
+# MESSAGE (STATUS "Require TEST_FILTER to be defined")
+#ENDIF (NOT TEST_FILTER)
IF (NOT TEST_REFERENCE)
MESSAGE (FATAL_ERROR "Require TEST_REFERENCE to be defined")
ENDIF (NOT TEST_REFERENCE)
@@ -61,6 +64,12 @@ IF (TEST_MASK)
FILE (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
ENDIF (TEST_MASK)
+IF (TEST_FILTER)
+ FILE (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
+ STRING(REGEX REPLACE "${TEST_FILTER}" "" TEST_STREAM "${TEST_STREAM}")
+ FILE (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
+ENDIF (TEST_FILTER)
+
IF (WIN32 AND NOT MINGW)
FILE (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
FILE (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}")
diff --git a/config/ibm-aix b/config/ibm-aix
index 8b6a5a3..134ad8e 100644
--- a/config/ibm-aix
+++ b/config/ibm-aix
@@ -35,6 +35,11 @@ if test "X-$enable_parallel" = "X-yes" -o X-$CC_BASENAME = X-mpcc_r; then
RUNPARALLEL=${RUNPARALLEL="env MP_PROCS=\$\${NPROCS:=3} MP_TASKS_PER_NODE=\$\${NPROCS:=3} poe"}
fi
+# Temporary patch for Bug 1678. -q32 binary default to run with smaller memory.
+# Ask for more memory so that "make check" will pass. Not necessary for -q64
+# mode but it does no harm.
+RUNSERIAL=${RUNSERIAL="env LDR_CNTRL=MAXDATA=0x20000000@DSA"}
+
#----------------------------------------------------------------------------
# Compiler flags. The CPPFLAGS values should not include package debug
diff --git a/config/intel-flags b/config/intel-flags
index 30e8f4d..5bf06d4 100644
--- a/config/intel-flags
+++ b/config/intel-flags
@@ -98,7 +98,7 @@ fi
# Please follow the pattern below by adding new versions at the top, copying
# the information from the previous version and adding modifications to that.
case "$cc_vendor-$cc_version" in
- icc-10.0*)
+ icc-10*)
PROD_CFLAGS="-O1 -Wl,-s"
;;
icc-8.0*)
diff --git a/config/pgi-flags b/config/pgi-flags
index 664b37b..3d481bd 100644
--- a/config/pgi-flags
+++ b/config/pgi-flags
@@ -72,6 +72,10 @@ if test "X-pgcc" = "X-$cc_vendor"; then
# Production
case "$cc_vendor-$cc_version" in
+ # Tweak down compiler optimizations for v10.6, it has a bug
+ pgcc-10.6*)
+ PROD_CFLAGS="-O1 -s"
+ ;;
# Tweak down compiler optimizations for v9.x
pgcc-9.*)
PROD_CFLAGS="-O1 -s"
diff --git a/config/powerpc-ibm-aix5.x b/config/powerpc-ibm-aix5.x
index aecbf33..b39fb47 100644
--- a/config/powerpc-ibm-aix5.x
+++ b/config/powerpc-ibm-aix5.x
@@ -35,6 +35,11 @@ if test "X-$enable_parallel" = "X-yes" -o X-$CC_BASENAME = X-mpcc_r; then
RUNPARALLEL=${RUNPARALLEL="env MP_PROCS=\$\${NPROCS:=3} MP_TASKS_PER_NODE=\$\${NPROCS:=3} poe"}
fi
+# Temporary patch for Bug 1678. -q32 binary default to run with smaller memory.
+# Ask for more memory so that "make check" will pass. Not necessary for -q64
+# mode but it does no harm.
+RUNSERIAL=${RUNSERIAL="env LDR_CNTRL=MAXDATA=0x20000000@DSA"}
+
#----------------------------------------------------------------------------
# Compiler flags. The CPPFLAGS values should not include package debug
diff --git a/configure b/configure
index eaac678..d4906df 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in Id: configure.in 19110 2010-07-20 16:51:49Z koziol .
+# From configure.in Id: configure.in 19111 2010-07-20 17:36:47Z koziol .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.65 for HDF5 1.9.75-FA_a5.
#
@@ -21467,7 +21467,7 @@ off64_t n = 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
- for ac_func in lseek64 fseek64 ftruncate64
+ for ac_func in lseek64 fseeko64 ftello64 ftruncate64
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -21481,8 +21481,8 @@ fi
done
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: skipping test for lseek64(), fseek64(), ftruncate64()" >&5
-$as_echo "skipping test for lseek64(), fseek64(), ftruncate64()" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: skipping test for lseek64(), fseeko64 , ftello64, ftruncate64() because off64_t is not defined" >&5
+$as_echo "skipping test for lseek64(), fseeko64 , ftello64, ftruncate64() because off64_t is not defined" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
for ac_func in fseeko ftello
diff --git a/configure.in b/configure.in
index d574f35..ae0002d 100644
--- a/configure.in
+++ b/configure.in
@@ -1339,8 +1339,8 @@ CPPFLAGS="$AM_CPPFLAGS $CPPFLAGS"
AC_TRY_COMPILE([#include <sys/types.h>],
[off64_t n = 0;],
- [AC_CHECK_FUNCS([lseek64 fseek64 ftruncate64])],
- [AC_MSG_RESULT([skipping test for lseek64(), fseek64(), ftruncate64()])])
+ [AC_CHECK_FUNCS([lseek64 fseeko64 ftello64 ftruncate64])],
+ [AC_MSG_RESULT([skipping test for lseek64(), fseeko64 , ftello64, ftruncate64() because off64_t is not defined])])
AC_CHECK_FUNCS(fseeko ftello)
AC_TRY_COMPILE([
#include <sys/types.h>
diff --git a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt
index 9fc9ba0..a4bfb17 100644
--- a/fortran/CMakeLists.txt
+++ b/fortran/CMakeLists.txt
@@ -110,19 +110,19 @@ CHECK_FORTRAN_FEATURE(RealIsNotDouble
#-----------------------------------------------------------------------------
# Make sure generated files and modules are picked up correctly
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES(
- ${CMAKE_Fortran_MODULE_DIRECTORY}
- ${HDF5_F90_BINARY_DIR}
- )
+INCLUDE_DIRECTORIES (
+ ${CMAKE_Fortran_MODULE_DIRECTORY}
+ ${HDF5_F90_BINARY_DIR}
+)
#-----------------------------------------------------------------------------
# Add debug information (intel Fortran : JB)
#-----------------------------------------------------------------------------
IF (CMAKE_Fortran_COMPILER MATCHES ifort)
- IF (WIN32)
- SET (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE "flags" STRING FORCE)
- SET (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE "flags" STRING FORCE)
- ENDIF (WIN32)
+ IF (WIN32)
+ SET (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE "flags" STRING FORCE)
+ SET (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE "flags" STRING FORCE)
+ ENDIF (WIN32)
ENDIF (CMAKE_Fortran_COMPILER MATCHES ifort)
#-----------------------------------------------------------------------------
@@ -149,4 +149,7 @@ ENDIF (HDF5_BUILD_EXAMPLES)
#-----------------------------------------------------------------------------
IF (BUILD_TESTING)
ADD_SUBDIRECTORY (${HDF5_F90_SOURCE_DIR}/test ${HDF5_F90_BINARY_DIR}/test)
+ IF (H5_HAVE_PARALLEL)
+ ADD_SUBDIRECTORY (${HDF5_F90_SOURCE_DIR}/testpar ${HDF5_F90_BINARY_DIR}/testpar)
+ ENDIF (H5_HAVE_PARALLEL)
ENDIF (BUILD_TESTING)
diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt
index f8a453e..f1ed52f 100644
--- a/fortran/examples/CMakeLists.txt
+++ b/fortran/examples/CMakeLists.txt
@@ -1,14 +1,14 @@
cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_F90_EXAMPLES C CXX Fortran)
# --------------------------------------------------------------------
# Notes: When creating examples they should be prefixed
# with "f90_ex_". This allows for easier filtering of the examples.
# --------------------------------------------------------------------
-PROJECT (HDF5_F90_EXAMPLES C CXX Fortran)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SOURCE_DIR}/src)
+INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src)
LINK_DIRECTORIES (
${CMAKE_Fortran_MODULE_DIRECTORY}
${HDF5_F90_BINARY_DIR}
@@ -66,3 +66,35 @@ FOREACH (example ${examples})
${HDF5_LIB_TARGET}
)
ENDFOREACH (example ${examples})
+
+IF (H5_HAVE_PARALLEL)
+ ADD_EXECUTABLE (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90)
+ H5_NAMING (f90_ex_ph5example)
+ IF (WIN32)
+ IF (BUILD_SHARED_LIBS)
+ IF (MSVC)
+ SET_TARGET_PROPERTIES (f90_ex_ph5example
+ PROPERTIES
+ COMPILE_FLAGS "/dll"
+ LINK_FLAGS "/SUBSYSTEM:CONSOLE"
+ )
+ ENDIF (MSVC)
+ ELSE (BUILD_SHARED_LIBS)
+ IF (MSVC)
+ SET_TARGET_PROPERTIES (f90_ex_ph5example
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (MSVC)
+ ENDIF (BUILD_SHARED_LIBS)
+ SET_PROPERTY (TARGET f90_ex_ph5example
+ APPEND PROPERTY COMPILE_DEFINITIONS
+ HDF5F90_WINDOWS
+ )
+ SET_TARGET_PROPERTIES (f90_ex_ph5example PROPERTIES LINKER_LANGUAGE Fortran)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (f90_ex_ph5example
+ ${HDF5_F90_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+ )
+ENDIF (H5_HAVE_PARALLEL)
diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt
index 7875f97..26475e6 100644
--- a/fortran/test/CMakeLists.txt
+++ b/fortran/test/CMakeLists.txt
@@ -4,7 +4,7 @@ PROJECT (HDF5_FORTRAN_TESTS C CXX Fortran)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SOURCE_DIR}/src)
+INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src)
LINK_DIRECTORIES (
${CMAKE_Fortran_MODULE_DIRECTORY}
${HDF5_F90_BINARY_DIR}
diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt
new file mode 100644
index 0000000..4b9d4f1
--- /dev/null
+++ b/fortran/testpar/CMakeLists.txt
@@ -0,0 +1,49 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_FORTRAN_TESTPAR C CXX Fortran)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src)
+LINK_DIRECTORIES (
+ ${CMAKE_Fortran_MODULE_DIRECTORY}
+ ${HDF5_F90_BINARY_DIR}
+ ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+)
+
+#-----------------------------------------------------------------------------
+# Add Tests
+#-----------------------------------------------------------------------------
+
+#-- Adding test for parallel_test
+ADD_EXECUTABLE (parallel_test
+ ptest.f90
+ hyper.f90
+ mdset.f90
+)
+H5_NAMING (parallel_test)
+TARGET_LINK_LIBRARIES (parallel_test
+ ${HDF5_F90_TEST_LIB_TARGET}
+ ${HDF5_F90_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+)
+IF (WIN32)
+ IF (MSVC)
+ TARGET_LINK_LIBRARIES (parallel_test "ws2_32.lib")
+ IF (BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (parallel_test
+ PROPERTIES
+ COMPILE_FLAGS "/dll"
+ LINK_FLAGS "/SUBSYSTEM:CONSOLE"
+ )
+ ELSE (BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (parallel_test
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+SET_TARGET_PROPERTIES (parallel_test PROPERTIES LINKER_LANGUAGE Fortran)
+
+ADD_TEST (NAME parallel_test COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:parallel_test>)
diff --git a/hl/CMakeLists.txt b/hl/CMakeLists.txt
index bc7c652..2871734 100644
--- a/hl/CMakeLists.txt
+++ b/hl/CMakeLists.txt
@@ -32,11 +32,6 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED)
ENDIF (BUILD_TESTING)
ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED)
-#-- Build the High Level Fortran source codes
-IF (HDF5_BUILD_FORTRAN)
- ADD_SUBDIRECTORY (fortran)
-ENDIF (HDF5_BUILD_FORTRAN)
-
IF (HDF5_BUILD_CPP_LIB)
ADD_SUBDIRECTORY (${HDF5_HL_SOURCE_DIR}/c++ ${HDF5_HL_BINARY_DIR}/c++)
ENDIF (HDF5_BUILD_CPP_LIB)
diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt
index 8fcb9bd..2a06b9c 100644
--- a/hl/c++/examples/CMakeLists.txt
+++ b/hl/c++/examples/CMakeLists.txt
@@ -4,8 +4,8 @@ PROJECT (HDF5_HL_CPP_EXAMPLES)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src)
-INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SOURCE_DIR}/src)
+INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/src)
+INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SRC_DIR}/src)
# --------------------------------------------------------------------
# Add in the examples for the Packet Table codes
diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt
index 459520e..afd4cf4 100644
--- a/hl/c++/src/CMakeLists.txt
+++ b/hl/c++/src/CMakeLists.txt
@@ -4,10 +4,11 @@ PROJECT (HDF5_HL_CPP_SRC)
#-----------------------------------------------------------------------------
# Define Sources
#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/src)
+INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SRC_SOURCE_DIR})
+
SET (HDF5_HL_CPP_SRCS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.cpp)
SET (HDF5_HL_CPP_HDRS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.h)
-INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src)
-INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SRC_SOURCE_DIR})
ADD_LIBRARY ( ${HDF5_HL_CPP_LIB_TARGET} ${LIB_TYPE} ${HDF5_HL_CPP_SRCS})
TARGET_LINK_LIBRARIES (
diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt
index e9b09da..afcb8fe 100644
--- a/hl/c++/test/CMakeLists.txt
+++ b/hl/c++/test/CMakeLists.txt
@@ -4,17 +4,17 @@ PROJECT (HDF5_HL_CPP_TEST)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src)
-INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SOURCE_DIR}/src)
+INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/src)
+INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/c++/src)
# --------------------------------------------------------------------
# Add in the unit tests for the packet table c++ wrapper
# --------------------------------------------------------------------
IF (BUILD_TESTING)
- INCLUDE_DIRECTORIES (${HDF5_TEST_SOURCE_DIR})
- INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/test)
- INCLUDE_DIRECTORIES (${HDF5_CPP_SOURCE_DIR}/src)
+ INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR})
+ INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/test)
+ INCLUDE_DIRECTORIES (${HDF5_CPP_SRC_DIR}/src)
ADD_EXECUTABLE (hl_ptableTest ${HDF5_HL_CPP_TEST_SOURCE_DIR}/ptableTest.cpp)
H5_NAMING (hl_ptableTest)
diff --git a/hl/fortran/CMakeLists.txt b/hl/fortran/CMakeLists.txt
index 1aca0d7..4c2256c 100644
--- a/hl/fortran/CMakeLists.txt
+++ b/hl/fortran/CMakeLists.txt
@@ -4,12 +4,12 @@ PROJECT(HDF5_HL_F90 C CXX Fortran)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_F90_SOURCE_DIR}/src)
+INCLUDE_DIRECTORIES (${HDF5_F90_SRC_DIR}/src)
INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR})
INCLUDE_DIRECTORIES (${HDF5_F90_SRC_BINARY_DIR})
INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY})
-LINK_DIRECTORIES (${HDF5_SRC_DIR} ${HDF5_FORTRAN_SOURCE_DIR} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
+LINK_DIRECTORIES (${HDF5_SRC_DIR} ${HDF5_F90_SRC_DIR}/src ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
#-----------------------------------------------------------------------------
# Add debug information (intel Fortran : JB)
diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt
index bd9a695..3ba6969 100644
--- a/hl/fortran/examples/CMakeLists.txt
+++ b/hl/fortran/examples/CMakeLists.txt
@@ -4,7 +4,7 @@ PROJECT (HDF5_HL_F90_EXAMPLES C CXX Fortran)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SOURCE_DIR}/src)
+INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src)
LINK_DIRECTORIES (
${CMAKE_Fortran_MODULE_DIRECTORY}
${HDF5_HL_F90_BINARY_DIR}
@@ -17,7 +17,7 @@ SET (examples
)
FOREACH (example ${examples})
- ADD_EXECUTABLE (hl_f90_ex_${example} ${HDF5_HL_EXAMPLES_SOURCE_DIR}/${example}.f90)
+ ADD_EXECUTABLE (hl_f90_ex_${example} ${HDF5_HL_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
H5_NAMING (hl_f90_ex_${example})
IF (WIN32)
IF (MSVC)
diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt
index 71302f3..f003c49 100644
--- a/hl/fortran/src/CMakeLists.txt
+++ b/hl/fortran/src/CMakeLists.txt
@@ -7,10 +7,10 @@ PROJECT(HDF5_HL_F90_SRC C CXX Fortran)
INCLUDE_DIRECTORIES (
${CMAKE_Fortran_MODULE_DIRECTORY}
${HDF5_F90_BINARY_DIR}
- ${HDF5_F90_SOURCE_DIR}/src
+ ${HDF5_F90_SRC_DIR}/src
${HDF5_F90_SRC_BINARY_DIR}
${HDF5_HL_F90_SRC_SOURCE_DIR}
- ${HDF5_HL_SOURCE_DIR}/src
+ ${HDF5_HL_SRC_DIR}/src
)
LINK_DIRECTORIES (
${CMAKE_Fortran_MODULE_DIRECTORY}
@@ -71,15 +71,13 @@ IF (WIN32)
APPEND PROPERTY COMPILE_DEFINITIONS
HDF5F90_WINDOWS
)
- SET_TARGET_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran)
ENDIF (WIN32)
-SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT
- "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}"
-)
+SET_TARGET_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran)
TARGET_LINK_LIBRARIES (${HDF5_HL_F90_LIB_TARGET}
${HDF5_HL_F90_C_LIB_TARGET}
${HDF5_F90_LIB_TARGET}
)
+SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} ${LIB_TYPE})
ADD_DEPENDENCIES (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_C_LIB_TARGET})
diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt
index 14bd622..f505dbd 100644
--- a/hl/fortran/test/CMakeLists.txt
+++ b/hl/fortran/test/CMakeLists.txt
@@ -4,7 +4,7 @@ PROJECT (HDF5_HL_FORTRAN_TESTS C CXX Fortran)
#-----------------------------------------------------------------------------
# Add Tests
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SOURCE_DIR}/src)
+INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src)
LINK_DIRECTORIES (
${CMAKE_Fortran_MODULE_DIRECTORY}
${HDF5_HL_F90_BINARY_DIR}
diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt
index 6042853..e34936d 100644
--- a/hl/src/CMakeLists.txt
+++ b/hl/src/CMakeLists.txt
@@ -11,7 +11,7 @@ ENDIF (BUILD_SHARED_LIBS)
#-----------------------------------------------------------------------------
# List Source files
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src)
+INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/src)
SET (HL_SRCS
${HDF5_HL_SRC_SOURCE_DIR}/H5DS.c
diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt
index 91d7c80..d016aed 100644
--- a/hl/test/CMakeLists.txt
+++ b/hl/test/CMakeLists.txt
@@ -1,4 +1,5 @@
cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_HL_TEST)
# --------------------------------------------------------------------
# Notes: When creating unit test executables they should be prefixed
# with "hl_". This allows for easier filtering of the test suite when
@@ -7,8 +8,6 @@ cmake_minimum_required (VERSION 2.8)
# which would only run the High Level based unit tests.
# --------------------------------------------------------------------
-PROJECT (HDF5_HL_TEST)
-
#-----------------------------------------------------------------------------
# Generate the H5srcdir_str.h file containing user settings needed by compilation
#-----------------------------------------------------------------------------
@@ -16,7 +15,7 @@ SET (srcdir ${CMAKE_CURRENT_SOURCE_DIR})
CONFIGURE_FILE (${HDF5_HL_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY)
INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR})
-INCLUDE_DIRECTORIES (${HDF5_TEST_SOURCE_DIR})
+INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR})
# --------------------------------------------------------------------
# Macro used to add a unit test
@@ -42,7 +41,9 @@ MACRO (HL_ADD_TEST hl_name files)
ADD_TEST (NAME hl_${hl_name} COMMAND $<TARGET_FILE:hl_${hl_name}>)
+ # --------------------------------------------------------------------
#-- Copy the necessary files.
+ # --------------------------------------------------------------------
FOREACH (h5_file ${files})
SET (dest "${HDF5_HL_TEST_BINARY_DIR}/${h5_file}")
#MESSAGE (STATUS " Copying HL Test File ${h5_file} to ${dest}")
@@ -66,7 +67,7 @@ HL_ADD_TEST (test_table "test_table_be.hdf5;test_table_cray.hdf5;test_table_le.h
# This executable is used to generate test files for the test_ds test.
# It should only be run during development when new test files are needed
# --------------------------------------------------------------------
-IF (NOT BUILD_SHARED_LIBS)
+IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
ADD_EXECUTABLE (hl_gen_test_ds gen_test_ds.c)
H5_NAMING (hl_gen_test_ds)
IF (WIN32)
@@ -84,4 +85,4 @@ IF (NOT BUILD_SHARED_LIBS)
${HDF5_LIB_TARGET}
${HDF5_TEST_LIB_TARGET}
)
-ENDIF (NOT BUILD_SHARED_LIBS)
+ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
diff --git a/hl/tools/CMakeLists.txt b/hl/tools/CMakeLists.txt
index e8c729d..62a0ea5 100644
--- a/hl/tools/CMakeLists.txt
+++ b/hl/tools/CMakeLists.txt
@@ -14,7 +14,7 @@ SET (GIF2H5_SRCS
)
#-- Add gif2hdf5 program
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
INCLUDE_DIRECTORIES (${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5)
ADD_EXECUTABLE (gif2h5 ${GIF2H5_SRCS})
@@ -55,7 +55,7 @@ TARGET_LINK_LIBRARIES (hdf2gif ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_T
# used in the CMake Build system as we rely on the test files that are
# shipped with HDF5 source archives
# --------------------------------------------------------------------
-IF (NOT BUILD_SHARED_LIBS)
+IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
ADD_EXECUTABLE (hl_h52gifgentest ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/h52gifgentst.c)
H5_NAMING (hl_h52gifgentest)
IF (WIN32)
@@ -69,7 +69,7 @@ IF (NOT BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (hl_h52gifgentest ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
# ADD_TEST (NAME hl_h52gifgentest COMMAND $<TARGET_FILE:hl_h52gifgentest>)
-ENDIF (NOT BUILD_SHARED_LIBS)
+ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
#-----------------------------------------------------------------------------
# Add file(s) to CMake Install
diff --git a/hl/tools/gif2h5/gif.h b/hl/tools/gif2h5/gif.h
index 737b7de..5334919 100644
--- a/hl/tools/gif2h5/gif.h
+++ b/hl/tools/gif2h5/gif.h
@@ -159,7 +159,7 @@ int hdfWriteGIF(FILE *fp, BYTE *pic, int ptype, int w, int h, BYTE *rmap,
int colorstyle, int BitsPerPixel);
/* WRITEHDF.C */
-int WriteHDF(GIFTOMEM , CHAR * , CHAR *);
+int WriteHDF(GIFTOMEM , CHAR * );
/* Function: ReadHDF
** Return: 0 on completion without error, -1 on error
diff --git a/hl/tools/gif2h5/gif2hdf.c b/hl/tools/gif2h5/gif2hdf.c
index 39c71cf..1225613 100644
--- a/hl/tools/gif2h5/gif2hdf.c
+++ b/hl/tools/gif2h5/gif2hdf.c
@@ -108,7 +108,7 @@ main(int argv , char *argc[])
* Call WriteHDF from here. Go ahead and change WriteHDF to write whatever
* format you want
*/
- if (WriteHDF(GifMemoryStruct , HDFFileName , GIFFileName))
+ if (WriteHDF(GifMemoryStruct , HDFFileName))
printf("HDF Write Error\n\n");
/* Free all buffers */
diff --git a/hl/tools/gif2h5/writehdf.c b/hl/tools/gif2h5/writehdf.c
index a150b3c..b4cca67 100644
--- a/hl/tools/gif2h5/writehdf.c
+++ b/hl/tools/gif2h5/writehdf.c
@@ -37,7 +37,7 @@
*/
int
-WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName)
+WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName)
{
GIFHEAD gifHead; /* GIF Header structure */
GIFIMAGEDESC *gifImageDesc; /* Logical Image Descriptor struct */
diff --git a/perform/CMakeLists.txt b/perform/CMakeLists.txt
index a0b7fae..6168bb3 100644
--- a/perform/CMakeLists.txt
+++ b/perform/CMakeLists.txt
@@ -4,8 +4,8 @@ PROJECT (HDF5_PERFORM )
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_TEST_SOURCE_DIR})
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib )
+INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR})
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib )
#-----------------------------------------------------------------------------
# Add Tests
@@ -132,3 +132,67 @@ ENDIF (WIN32)
TARGET_LINK_LIBRARIES (zip_perf ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
ADD_TEST (NAME zip_perf COMMAND $<TARGET_FILE:zip_perf> "-h")
+
+IF (H5_HAVE_PARALLEL)
+ #-- Adding test for h5perf
+ SET (h5perf_SRCS
+ ${HDF5_PERFORM_SOURCE_DIR}/pio_timer.c
+ ${HDF5_PERFORM_SOURCE_DIR}/pio_perf.c
+ ${HDF5_PERFORM_SOURCE_DIR}/pio_engine.c
+ )
+ ADD_EXECUTABLE (h5perf ${h5perf_SRCS})
+ H5_NAMING (h5perf)
+ IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (h5perf
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (h5perf ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+
+ ADD_TEST (NAME h5perf COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:h5perf>)
+
+ #-- Adding test for benchpar
+ SET (benchpar_SRCS
+ ${HDF5_PERFORM_SOURCE_DIR}/benchpar.c
+ )
+ ADD_EXECUTABLE (benchpar ${benchpar_SRCS})
+ H5_NAMING (benchpar)
+ IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (benchpar
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (benchpar ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+
+ ADD_TEST (NAME benchpar COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:benchpar>)
+
+ #-- Adding test for mpi-perf
+ SET (mpi-perf_SRCS
+ ${HDF5_PERFORM_SOURCE_DIR}/mpi-perf.c
+ )
+ ADD_EXECUTABLE (mpi-perf ${mpi-perf_SRCS})
+ H5_NAMING (mpi-perf)
+ IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (mpi-perf
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (mpi-perf ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+
+ ADD_TEST (NAME mpi-perf COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:mpi-perf>)
+ENDIF (H5_HAVE_PARALLEL)
diff --git a/perform/sio_standalone.h b/perform/sio_standalone.h
index b31d4846..7c4810b 100644
--- a/perform/sio_standalone.h
+++ b/perform/sio_standalone.h
@@ -255,7 +255,7 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
#define HDlseek(F,O,W) _lseeki64(F,O,W)
#endif
#else
- #ifdef H5_HAVE_FSEEK64
+ #ifdef H5_HAVE_LSEEK64
#define HDlseek(F,O,W) lseek64(F,O,W)
#else
#define HDlseek(F,O,W) lseek(F,O,W)
@@ -386,6 +386,7 @@ H5_DLL void HDsrand(unsigned int seed);
#endif
/* sscanf() variable arguments */
+#define HDstrcasecmp(X,Y) strcasecmp(X,Y)
#define HDstrcat(X,Y) strcat(X,Y)
#define HDstrchr(S,C) strchr(S,C)
#define HDstrcmp(X,Y) strcmp(X,Y)
diff --git a/release_docs/INSTALL b/release_docs/INSTALL
index 3b84354..7b350e0 100644
--- a/release_docs/INSTALL
+++ b/release_docs/INSTALL
@@ -370,14 +370,12 @@ CONTENTS
LDFLAGS=-L/home/robb/lib \
./configure
- HDF5 uses the zlib library for two purposes: it provides support
- for the HDF5 deflate data compression filter, and it is used by
- the h5toh4 converter and the h4toh5 converter in support of
- HDF4. Configure searches the standard places (plus those specified
- above with the CPPFLAGS and LDFLAGS variables) for the zlib
- headers and library. The search can be disabled by specifying
- `--without-zlib' or alternate directories can be specified with
- `--with-zlib=INCDIR,LIBDIR' or through the CPPFLAGS and LDFLAGS
+ HDF5 uses the zlib library to support the HDF5 deflate
+ data compression filter. Configure searches the standard places
+ (plus those specified above with the CPPFLAGS and LDFLAGS variables)
+ for the zlib headers and library. The search can be disabled by
+ specifying `--without-zlib' or alternate directories can be specified
+ with `--with-zlib=INCDIR,LIBDIR' or through the CPPFLAGS and LDFLAGS
variables:
$ ./configure --with-zlib=/usr/unsup/include,/usr/unsup/lib
@@ -386,14 +384,6 @@ CONTENTS
LDFLAGS=-L/usr/unsup/lib \
./configure
- The HDF5-to-HDF4 and HDF4-to-HDF5 conversion tool requires the
- HDF4 library and header files, which are detected the same way as
- zlib. The switch to give to configure is `--with-hdf4'. Note
- that HDF5 requires a newer version of zlib than the one shipped
- with some versions of HDF4. Also, unless you have the "correct"
- version of HDF4, the confidence testing will fail in the tools
- directory.
-
HDF5 includes Szip as a predefined compression method (see 3.2).
To enable Szip compression, the HDF5 Library must be configured
and built using the Szip Library:
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 42e7b37..b3a1b6d 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -76,6 +76,9 @@ New Features
Library:
--------
+ - H5Tset_order and H5Tget_order now support all data types. A new byte
+ order H5T_ORDER_MIXED has been added specifically for compound datatype
+ and its derived type. Please see bug #1934. (SLU - 2010/8/23)
- Improved performance of the chunk cache by avoiding unnecessary b-tree
lookups of chunks already in cache. (NAF - 2010/06/15)
- Greatly improved performance of extending a dataset with early
@@ -234,6 +237,14 @@ Bug Fixes since HDF5-1.8.0 release
Library
-------
+ - Fixed the bug in the filter's public CAN_APPLY function. The return
+ value should be htri_t not herr_t (Bug #1239). (SLU - 2010/8/5)
+ - Fixed a bug in the direct I/O driver that could render files with
+ certain kinds of unaligned data unreadable or corrupt them.
+ (NAF - 2010/07/28)
+ - valgrind reported an error of copying data to itself when a new attribute
+ is written (Bug #1956). I fixed it by taking out the memcpy step in
+ the attribute code. (SLU - 2010/07/28)
- Fixed a bug that could cause file corruption when using non-default
sizes of addresses and/or lengths. This bug could also cause
uncorrupted files with this property to be unreadable. This bug
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1e05424..3f40dda 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -465,6 +465,10 @@ SET (H5Z_SRCS
${HDF5_SRC_DIR}/H5Zszip.c
${HDF5_SRC_DIR}/H5Ztrans.c
)
+IF (H5_ZLIB_HEADER)
+ SET_PROPERTY(SOURCE ${HDF5_SRC_DIR}/H5Zdeflate.c PROPERTY
+ COMPILE_DEFINITIONS H5_ZLIB_HEADER="${H5_ZLIB_HEADER}")
+ENDIF (H5_ZLIB_HEADER)
SET (H5Z_HDRS
${HDF5_SRC_DIR}/H5Zpkg.h
@@ -501,6 +505,7 @@ SET (common_SRCS
${HDF5_SRC_DIR}/H5FO.c
${HDF5_SRC_DIR}/H5HP.c
${HDF5_SRC_DIR}/H5I.c
+ ${HDF5_SRC_DIR}/H5Itest.c
${HDF5_SRC_DIR}/H5L.c
${HDF5_SRC_DIR}/H5Lexternal.c
${HDF5_SRC_DIR}/H5MM.c
@@ -694,15 +699,17 @@ H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} ${LIB_TYPE})
#-----------------------------------------------------------------------------
# Add file(s) to CMake Install
#-----------------------------------------------------------------------------
-INSTALL (
- FILES
- ${H5_PUBLIC_HEADERS}
- ${H5_PRIVATE_HEADERS}
- DESTINATION
- include
- COMPONENT
- headers
-)
+IF (NOT HDF5_INSTALL_NO_DEVELOPMENT)
+ INSTALL (
+ FILES
+ ${H5_PUBLIC_HEADERS}
+ ${H5_PRIVATE_HEADERS}
+ DESTINATION
+ ${HDF5_INSTALL_INCLUDE_DIR}
+ COMPONENT
+ headers
+ )
+ENDIF (NOT HDF5_INSTALL_NO_DEVELOPMENT)
#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install for import into other projects
@@ -713,8 +720,8 @@ IF (HDF5_EXPORTED_TARGETS)
${HDF5_LIB_TARGET}
EXPORT
${HDF5_EXPORTED_TARGETS}
- LIBRARY DESTINATION lib COMPONENT libraries
- ARCHIVE DESTINATION lib COMPONENT libraries
- RUNTIME DESTINATION bin COMPONENT libraries
+ LIBRARY DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries
+ ARCHIVE DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries
+ RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT libraries
)
ENDIF (HDF5_EXPORTED_TARGETS)
diff --git a/src/H5A.c b/src/H5A.c
index 852e058..722af25 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -2424,18 +2424,19 @@ H5A_close(H5A_t *attr)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release object header info")
/* Reference count can be 0. It only happens when H5A_create fails. */
- if(1 >= attr->shared->nrefs) {
+ if(attr->shared->nrefs <= 1) {
/* Free dynamicly allocated items */
if(H5A_free(attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info")
/* Destroy shared attribute struct */
attr->shared = H5FL_FREE(H5A_shared_t, attr->shared);
- } else if(attr->shared->nrefs > 1) {
+ } /* end if */
+ else {
/* There are other references to the shared part of the attribute.
* Only decrement the reference count. */
--attr->shared->nrefs;
- }
+ } /* end else */
/* Free group hierarchy path */
if(H5G_name_free(&(attr->path)) < 0)
diff --git a/src/H5AC.c b/src/H5AC.c
index 7d6a49b..ea130b3 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -929,7 +929,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5AC_set
+ * Function: H5AC_insert_entry
*
* Purpose: Adds the specified thing to the cache. The thing need not
* exist on disk yet, but it must have an address and disk
@@ -944,7 +944,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
+H5AC_insert_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
void *thing, unsigned int flags)
{
#if H5AC__TRACE_FILE_ENABLED
@@ -954,7 +954,7 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
#endif /* H5AC__TRACE_FILE_ENABLED */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5AC_set, FAIL)
+ FUNC_ENTER_NOAPI(H5AC_insert_entry, FAIL)
HDassert(f);
HDassert(f->shared);
@@ -983,7 +983,7 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0) &&
( trace_file_ptr != NULL ) ) {
- sprintf(trace, "H5AC_set 0x%lx %d 0x%x",
+ sprintf(trace, "H5AC_insert_entry 0x%lx %d 0x%x",
(unsigned long)addr,
type->id,
flags);
@@ -1028,7 +1028,7 @@ done:
#endif /* H5AC__TRACE_FILE_ENABLED */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC_set() */
+} /* H5AC_insert_entry() */
/*-------------------------------------------------------------------------
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index b55572d..6780b72 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -342,7 +342,7 @@ H5_DLL herr_t H5AC_init(void);
H5_DLL herr_t H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr);
H5_DLL herr_t H5AC_get_entry_status(const H5F_t *f, haddr_t addr,
unsigned * status_ptr);
-H5_DLL herr_t H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type,
+H5_DLL herr_t H5AC_insert_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type,
haddr_t addr, void *thing, unsigned int flags);
H5_DLL herr_t H5AC_pin_protected_entry(void *thing);
H5_DLL herr_t H5AC_create_flush_dependency(void *parent_thing, void *child_thing);
diff --git a/src/H5Aint.c b/src/H5Aint.c
index ba30506..101d604 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -1149,8 +1149,8 @@ H5A_dense_copy_file_cb(const H5A_t *attr_src, void *_udata)
HDassert(udata->file);
HDassert(udata->cpy_info);
- if ( NULL == (attr_dst=H5A_attr_copy_file(attr_src, udata->file,
- udata->recompute_size, udata->cpy_info, udata->dxpl_id)))
+ if(NULL == (attr_dst = H5A_attr_copy_file(attr_src, udata->file,
+ udata->recompute_size, udata->cpy_info, udata->dxpl_id)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy attribute")
/* Reset shared location information */
@@ -1168,10 +1168,8 @@ H5A_dense_copy_file_cb(const H5A_t *attr_src, void *_udata)
H5_END_TAG(H5_ITER_ERROR);
done:
- if(attr_dst) {
- (void)H5A_free(attr_dst);
- attr_dst = H5FL_FREE(H5A_t, attr_dst);
- } /* end if */
+ if(attr_dst && H5A_close(attr_dst) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close destination attribute")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A_dense_copy_file_cb() */
diff --git a/src/H5B.c b/src/H5B.c
index 37d40bf..f15eedb 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -245,7 +245,7 @@ H5B_create(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata,
/*
* Cache the new B-tree node.
*/
- if(H5AC_set(f, dxpl_id, H5AC_BT, *addr_p, bt, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_BT, *addr_p, bt, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree root node to cache")
#ifdef H5B_DEBUG
H5B_assert(f, dxpl_id, *addr_p, shared->type, udata);
@@ -687,7 +687,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
HDmemcpy(H5B_NKEY(new_bt, shared, 2), rt_key, shared->type->sizeof_nkey);
/* Insert the modified copy of the old root into the file again */
- if(H5AC_set(f, dxpl_id, H5AC_BT, addr, new_bt, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_BT, addr, new_bt, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to flush old B-tree root node")
#ifdef H5B_DEBUG
diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c
index 94e2c54..e8d8b96 100644
--- a/src/H5B2hdr.c
+++ b/src/H5B2hdr.c
@@ -309,7 +309,7 @@ H5B2_hdr_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam,
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "file allocation failed for B-tree header")
/* Cache the new B-tree node */
- if(H5AC_set(f, dxpl_id, H5AC_BT2_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_BT2_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, HADDR_UNDEF, "can't add B-tree header to cache")
/* Set address of v2 B-tree header to return */
diff --git a/src/H5B2int.c b/src/H5B2int.c
index db137f8..f6602737f 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -80,10 +80,10 @@ static herr_t H5B2_swap_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
H5B2_internal_t *internal, unsigned *internal_flags_ptr,
unsigned idx, void *swap_loc);
#ifdef H5B2_DEBUG
-static herr_t H5B2_assert_leaf(H5B2_hdr_t *hdr, H5B2_leaf_t *leaf);
-static herr_t H5B2_assert_leaf2(H5B2_hdr_t *hdr, H5B2_leaf_t *leaf, H5B2_leaf_t *leaf2);
-static herr_t H5B2_assert_internal(hsize_t parent_all_nrec, H5B2_hdr_t *hdr, H5B2_internal_t *internal);
-static herr_t H5B2_assert_internal2(hsize_t parent_all_nrec, H5B2_hdr_t *hdr, H5B2_internal_t *internal, H5B2_internal_t *internal2);
+static herr_t H5B2_assert_leaf(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf);
+static herr_t H5B2_assert_leaf2(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf, const H5B2_leaf_t *leaf2);
+static herr_t H5B2_assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal);
+static herr_t H5B2_assert_internal2(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal, const H5B2_internal_t *internal2);
#endif /* H5B2_DEBUG */
/*********************/
@@ -178,7 +178,7 @@ H5B2_split1(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *cur
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
- void *left_child, *right_child; /* Pointers to child nodes */
+ void *left_child = NULL, *right_child = NULL; /* Pointers to child nodes */
uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */
uint8_t *left_native, *right_native;/* Pointers to childs' native records */
H5B2_node_ptr_t *left_node_ptrs = NULL, *right_node_ptrs = NULL;/* Pointers to childs' node pointer info */
@@ -324,12 +324,12 @@ H5B2_split1(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *cur
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0, hdr, internal);
if(depth > 1) {
- H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, left_child, right_child);
- H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, right_child, left_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)right_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child, (H5B2_internal_t *)left_child);
} /* end if */
else {
- H5B2_assert_leaf2(hdr, left_child, right_child);
- H5B2_assert_leaf(hdr, right_child);
+ H5B2_assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)right_child);
+ H5B2_assert_leaf(hdr, (H5B2_leaf_t *)right_child);
} /* end else */
#endif /* H5B2_DEBUG */
@@ -509,12 +509,12 @@ H5B2_redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0, hdr, internal);
if(depth > 1) {
- H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, left_child, right_child);
- H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, right_child, left_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)right_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child, (H5B2_internal_t *)left_child);
} /* end if */
else {
- H5B2_assert_leaf2(hdr, left_child, right_child);
- H5B2_assert_leaf(hdr, right_child);
+ H5B2_assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)right_child);
+ H5B2_assert_leaf(hdr, (H5B2_leaf_t *)right_child);
} /* end else */
#endif /* H5B2_DEBUG */
@@ -629,12 +629,12 @@ H5B2_redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0, hdr, internal);
if(depth > 1) {
- H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, left_child, right_child);
- H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, right_child, left_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)right_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child, (H5B2_internal_t *)left_child);
} /* end if */
else {
- H5B2_assert_leaf2(hdr, left_child, right_child);
- H5B2_assert_leaf(hdr, right_child);
+ H5B2_assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)right_child);
+ H5B2_assert_leaf(hdr, (H5B2_leaf_t *)right_child);
} /* end else */
#endif /* H5B2_DEBUG */
@@ -672,8 +672,8 @@ H5B2_redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
haddr_t middle_addr; /* Address of middle child node */
- void *left_child, *right_child; /* Pointers to child nodes */
- void *middle_child; /* Pointers to middle child node */
+ void *left_child = NULL, *right_child = NULL; /* Pointers to child nodes */
+ void *middle_child = NULL; /* Pointers to middle child node */
uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */
uint16_t *middle_nrec; /* Pointers to middle child # of records */
uint8_t *left_native, *right_native; /* Pointers to childs' native records */
@@ -1011,15 +1011,15 @@ H5B2_redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0, hdr, internal);
if(depth > 1) {
- H5B2_assert_internal2(internal->node_ptrs[idx - 1].all_nrec, hdr, left_child, middle_child);
- H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, middle_child, left_child);
- H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, middle_child, right_child);
- H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, right_child, middle_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx - 1].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)middle_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)middle_child, (H5B2_internal_t *)left_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)middle_child, (H5B2_internal_t *)right_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child, (H5B2_internal_t *)middle_child);
} /* end if */
else {
- H5B2_assert_leaf2(hdr, left_child, middle_child);
- H5B2_assert_leaf2(hdr, middle_child, right_child);
- H5B2_assert_leaf(hdr, right_child);
+ H5B2_assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)middle_child);
+ H5B2_assert_leaf2(hdr, (H5B2_leaf_t *)middle_child, (H5B2_leaf_t *)right_child);
+ H5B2_assert_leaf(hdr, (H5B2_leaf_t *)right_child);
} /* end else */
#endif /* H5B2_DEBUG */
@@ -1058,7 +1058,7 @@ H5B2_merge2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
- void *left_child, *right_child; /* Pointers to left & right child nodes */
+ void *left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */
uint16_t *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
uint8_t *left_native, *right_native; /* Pointers to left & right children's native records */
H5B2_node_ptr_t *left_node_ptrs = NULL, *right_node_ptrs = NULL;/* Pointers to childs' node pointer info */
@@ -1171,9 +1171,9 @@ H5B2_merge2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0, hdr, internal);
if(depth > 1)
- H5B2_assert_internal(internal->node_ptrs[idx].all_nrec, hdr, left_child);
+ H5B2_assert_internal(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child);
else
- H5B2_assert_leaf(hdr, left_child);
+ H5B2_assert_leaf(hdr, (H5B2_leaf_t *)left_child);
#endif /* H5B2_DEBUG */
done:
@@ -1212,8 +1212,8 @@ H5B2_merge3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
haddr_t middle_addr; /* Address of middle child node */
- void *left_child, *right_child; /* Pointers to left & right child nodes */
- void *middle_child; /* Pointer to middle child node */
+ void *left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */
+ void *middle_child = NULL; /* Pointer to middle child node */
uint16_t *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
uint16_t *middle_nrec; /* Pointer to middle child # of records */
uint8_t *left_native, *right_native; /* Pointers to left & right children's native records */
@@ -1393,12 +1393,12 @@ H5B2_merge3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0, hdr, internal);
if(depth > 1) {
- H5B2_assert_internal2(internal->node_ptrs[idx - 1].all_nrec, hdr, left_child, middle_child);
- H5B2_assert_internal(internal->node_ptrs[idx].all_nrec, hdr, middle_child);
+ H5B2_assert_internal2(internal->node_ptrs[idx - 1].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)middle_child);
+ H5B2_assert_internal(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)middle_child);
} /* end if */
else {
- H5B2_assert_leaf2(hdr, left_child, middle_child);
- H5B2_assert_leaf(hdr, middle_child);
+ H5B2_assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)middle_child);
+ H5B2_assert_leaf(hdr, (H5B2_leaf_t *)middle_child);
} /* end else */
#endif /* H5B2_DEBUG */
@@ -1439,7 +1439,7 @@ H5B2_swap_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t child_addr; /* Address of child node */
- void *child; /* Pointer to child node */
+ void *child = NULL; /* Pointer to child node */
uint8_t *child_native; /* Pointer to child's native records */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1494,9 +1494,9 @@ H5B2_swap_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0, hdr, internal);
if(depth > 1)
- H5B2_assert_internal(internal->node_ptrs[idx].all_nrec, hdr, child);
+ H5B2_assert_internal(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)child);
else
- H5B2_assert_leaf(hdr, child);
+ H5B2_assert_leaf(hdr, (H5B2_leaf_t *)child);
#endif /* H5B2_DEBUG */
done:
@@ -1771,7 +1771,7 @@ HDmemset(leaf->leaf_native, 0, hdr->cls->nrec_size * hdr->node_info[0].max_nrec)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree leaf node")
/* Cache the new B-tree node */
- if(H5AC_set(hdr->f, dxpl_id, H5AC_BT2_LEAF, node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_BT2_LEAF, node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree leaf to cache")
done:
@@ -1890,7 +1890,7 @@ HDmemset(internal->node_ptrs, 0, sizeof(H5B2_node_ptr_t) * (hdr->node_info[depth
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree internal node")
/* Cache the new B-tree node */
- if(H5AC_set(hdr->f, dxpl_id, H5AC_BT2_INT, node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_BT2_INT, node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree internal node to cache")
done:
@@ -3082,7 +3082,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_assert_leaf(H5B2_hdr_t *hdr, H5B2_leaf_t *leaf)
+H5B2_assert_leaf(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf)
{
/* General sanity checking on node */
HDassert(leaf->nrec <= hdr->node_info->split_nrec);
@@ -3105,13 +3105,13 @@ H5B2_assert_leaf(H5B2_hdr_t *hdr, H5B2_leaf_t *leaf)
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_assert_leaf2(H5B2_hdr_t *hdr, H5B2_leaf_t *leaf, H5B2_leaf_t *leaf2)
+H5B2_assert_leaf2(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf, const H5B2_leaf_t UNUSED *leaf2)
{
/* General sanity checking on node */
HDassert(leaf->nrec <= hdr->node_info->split_nrec);
return(0);
-} /* end H5B2_assert_leaf() */
+} /* end H5B2_assert_leaf2() */
/*-------------------------------------------------------------------------
@@ -3128,10 +3128,10 @@ H5B2_assert_leaf2(H5B2_hdr_t *hdr, H5B2_leaf_t *leaf, H5B2_leaf_t *leaf2)
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_assert_internal(hsize_t parent_all_nrec, H5B2_hdr_t *hdr, H5B2_internal_t *internal)
+H5B2_assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal)
{
hsize_t tot_all_nrec; /* Total number of records at or below this node */
- unsigned u, v; /* Local index variables */
+ uint16_t u, v; /* Local index variables */
/* General sanity checking on node */
HDassert(internal->nrec <= hdr->node_info->split_nrec);
@@ -3169,10 +3169,10 @@ H5B2_assert_internal(hsize_t parent_all_nrec, H5B2_hdr_t *hdr, H5B2_internal_t *
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_assert_internal2(hsize_t parent_all_nrec, H5B2_hdr_t *hdr, H5B2_internal_t *internal, H5B2_internal_t *internal2)
+H5B2_assert_internal2(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal, const H5B2_internal_t *internal2)
{
hsize_t tot_all_nrec; /* Total number of records at or below this node */
- unsigned u, v; /* Local index variables */
+ uint16_t u, v; /* Local index variables */
/* General sanity checking on node */
HDassert(internal->nrec <= hdr->node_info->split_nrec);
diff --git a/src/H5C.c b/src/H5C.c
index 11ad8bb..de45d20 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -150,8 +150,7 @@ static void * H5C_load_entry(H5F_t * f,
hid_t dxpl_id,
const H5C_class_t * type,
haddr_t addr,
- void * udata,
- hbool_t skip_file_checks);
+ void * udata);
static herr_t H5C_make_space_in_cache(H5F_t * f,
hid_t primary_dxpl_id,
@@ -1158,8 +1157,6 @@ H5C_create(size_t max_cache_size,
H5C_stats__reset(cache_ptr);
- cache_ptr->skip_file_checks = FALSE;
- cache_ptr->skip_dxpl_id_checks = FALSE;
cache_ptr->prefix[0] = '\0'; /* empty string */
/* Set return value */
@@ -1409,7 +1406,6 @@ H5C_dest(H5F_t * f,
/* Sanity check */
HDassert(cache_ptr);
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HDassert(cache_ptr->skip_file_checks || f);
/* Flush and invalidate all cache entries */
if(H5C_flush_invalidate_cache(f, primary_dxpl_id, secondary_dxpl_id,
@@ -1595,7 +1591,6 @@ H5C_flush_cache(H5F_t *f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, unsign
HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( cache_ptr->skip_file_checks || f);
HDassert( cache_ptr->slist_ptr );
ignore_protected = ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 );
@@ -1977,7 +1972,6 @@ H5C_flush_to_min_clean(H5F_t * f,
HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( cache_ptr->skip_file_checks || f );
if ( cache_ptr->check_write_permitted != NULL ) {
@@ -2547,7 +2541,6 @@ H5C_insert_entry(H5F_t * f,
HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( cache_ptr->skip_file_checks || f );
HDassert( type );
HDassert( type->flush );
HDassert( type->size );
@@ -2870,7 +2863,6 @@ H5C_mark_entries_as_clean(H5F_t * f,
cache_ptr = f->shared->cache;
HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( cache_ptr->skip_file_checks || f );
HDassert( ce_array_len > 0 );
HDassert( ce_array_ptr != NULL );
@@ -3635,7 +3627,6 @@ H5C_protect(H5F_t * f,
HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( cache_ptr->skip_file_checks || f );
HDassert( type );
HDassert( type->flush );
HDassert( type->load );
@@ -3698,7 +3689,7 @@ H5C_protect(H5F_t * f,
hit = FALSE;
- thing = H5C_load_entry(f, primary_dxpl_id, type, addr, udata, cache_ptr->skip_file_checks);
+ thing = H5C_load_entry(f, primary_dxpl_id, type, addr, udata);
if ( thing == NULL ) {
@@ -4414,48 +4405,6 @@ H5C_set_prefix(H5C_t * cache_ptr, char * prefix)
/*-------------------------------------------------------------------------
- * Function: H5C_set_skip_flags
- *
- * Purpose: Set the values of the skip sanity check flags.
- *
- * This function and the skip sanity check flags were created
- * for the convenience of the test bed. However it is
- * possible that there may be other uses for the flags.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: John Mainzer
- * 6/11/04
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5C_set_skip_flags(H5C_t * cache_ptr,
- hbool_t skip_file_checks,
- hbool_t skip_dxpl_id_checks)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5C_set_skip_flags, FAIL)
-
- /* This would normally be an assert, but we need to use an HGOTO_ERROR
- * call to shut up the compiler.
- */
- if ( ( ! cache_ptr ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr")
- }
-
- cache_ptr->skip_file_checks = skip_file_checks;
- cache_ptr->skip_dxpl_id_checks = skip_dxpl_id_checks;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-
-} /* H5C_set_skip_flags() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5C_set_trace_file_ptr
*
* Purpose: Set the trace_file_ptr field for the cache.
@@ -5236,7 +5185,6 @@ H5C_unprotect(H5F_t * f,
HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( cache_ptr->skip_file_checks || f );
HDassert( type );
HDassert( type->clear );
HDassert( type->flush );
@@ -7421,7 +7369,6 @@ H5C_flush_invalidate_cache(H5F_t * f,
HDassert( f );
HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( cache_ptr->skip_file_checks || f );
HDassert( cache_ptr->slist_ptr );
/* Filter out the flags that are not relevant to the flush/invalidate.
@@ -7972,7 +7919,6 @@ H5C_flush_single_entry(H5F_t * f,
HDassert( f );
HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( cache_ptr->skip_file_checks || f );
HDassert( H5F_addr_defined(addr) );
HDassert( first_flush_ptr );
@@ -8042,14 +7988,8 @@ H5C_flush_single_entry(H5F_t * f,
* Note that we only do these sanity checks when the clear_only flag
* is not set, and the entry to be flushed is dirty. Don't bother
* otherwise as no file I/O can result.
- *
- * There are also cases (testing for instance) where it is convenient
- * to pass in dummy dxpl_ids. Since we don't use the dxpl_ids directly,
- * this isn't a problem -- but we do have to turn off sanity checks
- * involving them. We use cache_ptr->skip_dxpl_id_checks to do this.
*/
- if ( ( ! cache_ptr->skip_dxpl_id_checks ) &&
- ( ! clear_only ) &&
+ if ( ( ! clear_only ) &&
( entry_ptr->is_dirty ) &&
( IS_H5FD_MPI(f) ) ) {
@@ -8390,12 +8330,7 @@ H5C_load_entry(H5F_t * f,
hid_t dxpl_id,
const H5C_class_t * type,
haddr_t addr,
- void * udata,
-#ifndef NDEBUG
- hbool_t skip_file_checks)
-#else /* NDEBUG */
- hbool_t UNUSED skip_file_checks)
-#endif /* NDEBUG */
+ void * udata)
{
void * thing = NULL; /* Pointer to thing loaded */
H5C_cache_entry_t * entry; /* Alias for thing loaded, as cache entry */
@@ -8407,7 +8342,6 @@ H5C_load_entry(H5F_t * f,
HDassert(f);
HDassert(f->shared);
HDassert(f->shared->cache);
- HDassert(skip_file_checks || f);
HDassert(type);
HDassert(type->load);
HDassert(type->size);
@@ -9048,31 +8982,21 @@ done:
* Programmer: Mike McGreevy
* December 1, 2009
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5C_ignore_tags(H5C_t * cache_ptr)
{
- /* Variable Declarations */
- herr_t ret_value = SUCCEED; /* Return value */
-
- /* Function Enter Macro */
- FUNC_ENTER_NOAPI(H5C_ignore_tags, FAIL)
+ FUNC_ENTER_NOAPI_NOFUNC(H5C_ignore_tags)
/* Assertions */
- HDassert( cache_ptr != NULL );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
+ HDassert(cache_ptr != NULL);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
/* Set variable to ignore tag values upon assignment */
cache_ptr->ignore_tags = TRUE;
-done:
-
- /* Function Leave Macro */
- FUNC_LEAVE_NOAPI(ret_value)
-
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5C_ignore_tags */
@@ -9097,38 +9021,32 @@ done:
static herr_t
H5C_tag_entry(H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr, hid_t dxpl_id)
{
- /* Variable Declarations */
- hid_t ret_value = SUCCEED;
- haddr_t tag;
- H5P_genplist_t *dxpl; /* dataset transfer property list */
+ H5P_genplist_t *dxpl; /* dataset transfer property list */
+ haddr_t tag; /* Tag address */
+ hid_t ret_value = SUCCEED; /* Return value */
- /* Function Enter Macro */
FUNC_ENTER_NOAPI(H5C_tag_entry, FAIL)
/* Assertions */
- HDassert( cache_ptr != NULL );
- HDassert( entry_ptr != NULL );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
+ HDassert(cache_ptr != NULL);
+ HDassert(entry_ptr != NULL);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
/* Get the dataset transfer property list */
if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
/* Get the tag from the DXPL */
- if( (H5P_get(dxpl, "H5AC_metadata_tag", &tag)) < 0 )
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to query property value");
-
- if (cache_ptr->ignore_tags != TRUE) {
-
- /* Perform some sanity checks to ensure that
- a correct tag is being applied */
- #if H5C_DO_TAGGING_SANITY_CHECKS
- if ( (H5C_verify_tag(entry_ptr->type->id, tag)) < 0 )
- HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "tag verification failed");
- #endif
+ if((H5P_get(dxpl, "H5AC_metadata_tag", &tag)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to query property value")
+ if(cache_ptr->ignore_tags != TRUE) {
+#if H5C_DO_TAGGING_SANITY_CHECKS
+ /* Perform some sanity checks to ensure that a correct tag is being applied */
+ if(H5C_verify_tag(entry_ptr->type->id, tag) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "tag verification failed")
+#endif
} else {
-
/* if we're ignoring tags, it's because we're running
tests on internal functions and may not have inserted a tag
value into a given dxpl_id before creating some metadata. Thus,
@@ -9136,19 +9054,15 @@ H5C_tag_entry(H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr, hid_t dxpl_id)
arbitrarily set it to something for the sake of passing the tests.
If the tag value is set, then we'll just let it get assigned without
additional checking for correctness. */
-
- if (!tag) tag = H5AC__IGNORE_TAG;
-
+ if(!tag)
+ tag = H5AC__IGNORE_TAG;
} /* end if */
/* Apply the tag to the entry */
entry_ptr->tag = tag;
done:
-
- /* Function Leave Macro */
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5C_tag_entry */
@@ -9172,34 +9086,25 @@ done:
static herr_t
H5C_flush_tagged_entries(H5F_t * f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, H5C_t * cache_ptr, haddr_t tag)
{
- /* Variable Declarations */
- herr_t result;
herr_t ret_value = SUCCEED;
- /* Function Enter Macro */
FUNC_ENTER_NOAPI(H5C_flush_tagged_entries, FAIL)
/* Assertions */
HDassert(0); /* This function is not yet used. We shouldn't be in here yet. */
- HDassert( cache_ptr != NULL );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
+ HDassert(cache_ptr != NULL);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
/* Mark all entries with specified tag */
- if ( (result = H5C_mark_tagged_entries(cache_ptr, tag)) < 0 )
+ if(H5C_mark_tagged_entries(cache_ptr, tag) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't mark tagged entries")
/* Flush all marked entries */
- if ( (result = H5C_flush_marked_entries(f,
- primary_dxpl_id,
- secondary_dxpl_id,
- cache_ptr)) < 0 )
+ if(H5C_flush_marked_entries(f, primary_dxpl_id, secondary_dxpl_id, cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush marked entries")
done:
-
- /* Function Leave Macro */
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5C_flush_tagged_entries */
@@ -9224,44 +9129,29 @@ done:
static herr_t
H5C_mark_tagged_entries(H5C_t * cache_ptr, haddr_t tag)
{
- /* Variable Declarations */
- int i; /* Iterator */
- herr_t result; /* Result */
- H5C_cache_entry_t *next_entry_ptr = NULL; /* entry pointer */
- herr_t ret_value = SUCCEED; /* Return Value */
+ H5C_cache_entry_t *next_entry_ptr; /* entry pointer */
+ unsigned u; /* Local index variable */
- /* Function Enter Macro */
- FUNC_ENTER_NOAPI(H5C_mark_tagged_entries, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5C_mark_tagged_entries)
/* Assertions */
HDassert(0); /* This function is not yet used. We shouldn't be in here yet. */
- HDassert( cache_ptr != NULL );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
+ HDassert(cache_ptr != NULL);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
/* Iterate through entries, marking those with specified tag. */
- for (i = 0; i < H5C__HASH_TABLE_LEN; i++) {
-
- next_entry_ptr = cache_ptr->index[i];
-
- while ( next_entry_ptr != NULL ) {
-
- if ( next_entry_ptr->tag == tag ) {
+ for(u = 0; u < H5C__HASH_TABLE_LEN; u++) {
+ next_entry_ptr = cache_ptr->index[u];
+ while(next_entry_ptr != NULL) {
+ if(next_entry_ptr->tag == tag)
next_entry_ptr->flush_marker = TRUE;
- } /* end if */
-
next_entry_ptr = next_entry_ptr->ht_next;
-
} /* end while */
-
} /* for */
-done:
-
- /* Function Leave Macro */
- FUNC_LEAVE_NOAPI(ret_value);
-
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5C_mark_tagged_entries */
@@ -9285,26 +9175,19 @@ done:
static herr_t
H5C_flush_marked_entries(H5F_t * f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, H5C_t * cache_ptr)
{
- /* Variable Declarations */
herr_t ret_value = SUCCEED;
- /* Function Enter Macro */
FUNC_ENTER_NOAPI(H5C_flush_marked_entries, FAIL)
/* Assertions */
HDassert(0); /* This function is not yet used. We shouldn't be in here yet. */
- HDassert( cache_ptr != NULL );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
+ HDassert(cache_ptr != NULL);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
/* Flush all marked entries */
- if(H5C_flush_cache(f,
- primary_dxpl_id,
- secondary_dxpl_id,
- H5C__FLUSH_MARKED_ENTRIES_FLAG |
- H5C__FLUSH_IGNORE_PROTECTED_FLAG) < 0) {
-
+ if(H5C_flush_cache(f, primary_dxpl_id, secondary_dxpl_id,
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_IGNORE_PROTECTED_FLAG) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache")
- } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -9328,65 +9211,59 @@ done:
static herr_t
H5C_verify_tag(int id, haddr_t tag)
{
- /* Variable Declarations */
herr_t ret_value = SUCCEED;
- /* Function Enter Macro */
FUNC_ENTER_NOAPI(H5C_verify_tag, FAIL)
/* Perform some sanity checks on tag value. Certain entry
* types require certain tag values, so check that these
* constraints are met. */
- if (tag == H5AC__IGNORE_TAG) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "cannot ignore a tag while doing verification.");
-
- } else if (tag == H5AC__INVALID_TAG) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "no metadata tag provided");
-
- } else {
+ if(tag == H5AC__IGNORE_TAG)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "cannot ignore a tag while doing verification.")
+ else if(tag == H5AC__INVALID_TAG)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "no metadata tag provided")
+ else {
/* Perform some sanity checks on tag value. Certain entry
* types require certain tag values, so check that these
* constraints are met. */
/* Superblock */
- if (id == H5AC_SUPERBLOCK_ID) {
- if (tag != H5AC__SUPERBLOCK_TAG)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "superblock not tagged with H5AC__SUPERBLOCK_TAG");
+ if(id == H5AC_SUPERBLOCK_ID) {
+ if(tag != H5AC__SUPERBLOCK_TAG)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "superblock not tagged with H5AC__SUPERBLOCK_TAG")
}
else {
- if (tag == H5AC__SUPERBLOCK_TAG)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "H5AC__SUPERBLOCK_TAG applied to non-superblock entry");
+ if(tag == H5AC__SUPERBLOCK_TAG)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "H5AC__SUPERBLOCK_TAG applied to non-superblock entry")
}
/* Free Space Manager */
- if ((id == H5AC_FSPACE_HDR_ID) || (id == H5AC_FSPACE_SINFO_ID)) {
- if (tag != H5AC__FREESPACE_TAG)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "freespace entry not tagged with H5AC__FREESPACE_TAG");
+ if((id == H5AC_FSPACE_HDR_ID) || (id == H5AC_FSPACE_SINFO_ID)) {
+ if(tag != H5AC__FREESPACE_TAG)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "freespace entry not tagged with H5AC__FREESPACE_TAG")
}
else {
- if (tag == H5AC__FREESPACE_TAG)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "H5AC__FREESPACE_TAG applied to non-freespace entry");
+ if(tag == H5AC__FREESPACE_TAG)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "H5AC__FREESPACE_TAG applied to non-freespace entry")
}
/* SOHM */
- if ((id == H5AC_SOHM_TABLE_ID) || (id == H5AC_SOHM_LIST_ID)) {
- if (tag != H5AC__SOHM_TAG)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "sohm entry not tagged with H5AC__SOHM_TAG");
+ if((id == H5AC_SOHM_TABLE_ID) || (id == H5AC_SOHM_LIST_ID)) {
+ if(tag != H5AC__SOHM_TAG)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "sohm entry not tagged with H5AC__SOHM_TAG")
}
/* Global Heap */
- if (id == H5AC_GHEAP_ID) {
- if (tag != H5AC__GLOBALHEAP_TAG)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "global heap not tagged with H5AC__GLOBALHEAP_TAG");
+ if(id == H5AC_GHEAP_ID) {
+ if(tag != H5AC__GLOBALHEAP_TAG)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "global heap not tagged with H5AC__GLOBALHEAP_TAG")
}
else {
- if (tag == H5AC__GLOBALHEAP_TAG)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "H5AC__GLOBALHEAP_TAG applied to non-globalheap entry");
+ if(tag == H5AC__GLOBALHEAP_TAG)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "H5AC__GLOBALHEAP_TAG applied to non-globalheap entry")
}
- }
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -9412,24 +9289,21 @@ done:
void
H5C_retag_copied_metadata(H5C_t * cache_ptr, haddr_t metadata_tag)
{
- /* Variable Declarations */
- int i = 0; /* Iterator */
-
- /* Assertions */
- HDassert(cache_ptr);
+ unsigned u; /* Local index variable */
- /* Function Enter Macro */
FUNC_ENTER_NOAPI_NOFUNC(H5C_retag_copied_metadata)
+ HDassert(cache_ptr);
+
/* Iterate through entries, retagging those with the H5AC__COPIED_TAG tag */
- for(i = 0; i < H5C__HASH_TABLE_LEN; i++) {
+ for(u = 0; u < H5C__HASH_TABLE_LEN; u++) {
H5C_cache_entry_t *next_entry_ptr; /* entry pointer */
- next_entry_ptr = cache_ptr->index[i];
+ next_entry_ptr = cache_ptr->index[u];
while(next_entry_ptr != NULL) {
- if(cache_ptr->index[i] != NULL) {
- if((cache_ptr->index[i])->tag == H5AC__COPIED_TAG)
- (cache_ptr->index[i])->tag = metadata_tag;
+ if(cache_ptr->index[u] != NULL) {
+ if((cache_ptr->index[u])->tag == H5AC__COPIED_TAG)
+ (cache_ptr->index[u])->tag = metadata_tag;
} /* end if */
next_entry_ptr = next_entry_ptr->ht_next;
diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h
index b4a8944..06eeb48 100644
--- a/src/H5Cpkg.h
+++ b/src/H5Cpkg.h
@@ -832,25 +832,6 @@
*
* Fields supporting testing:
*
- * For test purposes, it is useful to turn off some asserts and sanity
- * checks. The following flags support this.
- *
- * skip_file_checks: Boolean flag used to skip sanity checks on file
- * parameters passed to the cache. In the test bed, there
- * is no reason to have a file open, as the cache proper
- * just passes these parameters through without using them.
- *
- * When this flag is set, all sanity checks on the file
- * parameters are skipped. The field defaults to FALSE.
- *
- * skip_dxpl_id_checks: Boolean flag used to skip sanity checks on the
- * dxpl_id parameters passed to the cache. These are not
- * used directly by the cache, so skipping the checks
- * simplifies the test bed.
- *
- * When this flag is set, all sanity checks on the dxpl_id
- * parameters are skipped. The field defaults to FALSE.
- *
* prefix Array of char used to prefix debugging output. The
* field is intended to allow marking of output of with
* the processes mpi rank.
@@ -1014,8 +995,6 @@ struct H5C_t
#endif /* H5C_COLLECT_CACHE_STATS */
- hbool_t skip_file_checks;
- hbool_t skip_dxpl_id_checks;
char prefix[H5C__PREFIX_LEN];
};
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 7e14872..9f10409 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -1171,10 +1171,6 @@ H5_DLL herr_t H5C_set_evictions_enabled(H5C_t *cache_ptr,
H5_DLL herr_t H5C_set_prefix(H5C_t * cache_ptr, char * prefix);
-H5_DLL herr_t H5C_set_skip_flags(H5C_t * cache_ptr,
- hbool_t skip_file_checks,
- hbool_t skip_dxpl_id_checks);
-
H5_DLL herr_t H5C_set_trace_file_ptr(H5C_t * cache_ptr,
FILE * trace_file_ptr);
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index fa4b62c..cde291f 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -402,6 +402,10 @@ H5D_chunk_construct(H5F_t UNUSED *f, H5D_t *dset)
HDassert(f);
HDassert(dset);
+ /* Check for invalid chunk dimension rank */
+ if(0 == dset->shared->layout.u.chunk.ndims)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "no chunk information set?")
+
/* Set up layout information */
if((ndims = H5S_GET_EXTENT_NDIMS(dset->shared->space)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get rank")
@@ -424,13 +428,18 @@ H5D_chunk_construct(H5F_t UNUSED *f, H5D_t *dset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to query maximum dimensions")
/* Sanity check dimensions */
- for(u = 0; u < dset->shared->layout.u.chunk.ndims - 1; u++)
+ for(u = 0; u < dset->shared->layout.u.chunk.ndims - 1; u++) {
+ /* Don't allow zero-sized chunk dimensions */
+ if(0 == dset->shared->layout.u.chunk.dim[u])
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "chunk size must be > 0, dim = %u ", u)
+
/*
* The chunk size of a dimension with a fixed size cannot exceed
* the maximum dimension size
*/
if(max_dim[u] != H5S_UNLIMITED && max_dim[u] < dset->shared->layout.u.chunk.dim[u])
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "chunk size must be <= maximum dimension size for fixed-sized dimensions")
+ } /* end for */
/* Compute the total size of a chunk */
/* (Use 64-bit value to ensure that we can detect >4GB chunks) */
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index f0929d9..a9c0dd5 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -168,13 +168,16 @@ done:
*
*-------------------------------------------------------------------------
*/
-/* ARGSUSED */
static herr_t
H5D_compact_construct(H5F_t *f, H5D_t *dset)
{
hssize_t stmp_size; /* Temporary holder for raw data size */
hsize_t tmp_size; /* Temporary holder for raw data size */
hsize_t max_comp_data_size; /* Max. allowed size of compact data */
+ hsize_t dim[H5O_LAYOUT_NDIMS]; /* Current size of data in elements */
+ hsize_t max_dim[H5O_LAYOUT_NDIMS]; /* Maximum size of data in elements */
+ int ndims; /* Rank of dataspace */
+ int i; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5D_compact_construct)
@@ -183,6 +186,13 @@ H5D_compact_construct(H5F_t *f, H5D_t *dset)
HDassert(f);
HDassert(dset);
+ /* Check for invalid dataset dimensions */
+ if((ndims = H5S_get_simple_extent_dims(dset->shared->space, dim, max_dim)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace dimensions")
+ for(i = 0; i < ndims; i++)
+ if(max_dim[i] > dim[i])
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "extendible compact dataset")
+
/*
* Compact dataset is stored in dataset object header message of
* layout.
diff --git a/src/H5Dfill.c b/src/H5Dfill.c
index 1929a5a..1999dda 100644
--- a/src/H5Dfill.c
+++ b/src/H5Dfill.c
@@ -585,7 +585,8 @@ H5D_fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts, hid_t dxpl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "data type conversion failed")
/* Replicate the fill value into the cached buffer */
- H5V_array_fill(fb_info->fill_buf, fb_info->fill_buf, fb_info->mem_elmt_size, nelmts);
+ if(nelmts > 1)
+ H5V_array_fill((void *)((unsigned char *)fb_info->fill_buf + fb_info->mem_elmt_size), fb_info->fill_buf, fb_info->mem_elmt_size, (nelmts - 1));
/* Reset the entire background buffer, if necessary */
if(H5T_path_bkg(fb_info->mem_to_dset_tpath))
@@ -596,6 +597,9 @@ H5D_fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts, hid_t dxpl_id)
buf = fb_info->fill_alloc_func(fb_info->fill_buf_size, fb_info->fill_alloc_info);
else
buf = H5FL_BLK_MALLOC(non_zero_fill, fb_info->fill_buf_size);
+ if(!buf)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary fill buffer")
+
HDmemcpy(buf, fb_info->fill_buf, fb_info->fill_buf_size);
/* Type convert the dataset buffer, to copy any VL components */
@@ -603,12 +607,16 @@ H5D_fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts, hid_t dxpl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "data type conversion failed")
done:
- if (buf) {
+ if(buf) {
/* Free dynamically allocated VL elements in fill buffer */
- if (fb_info->fill->type)
- H5T_vlen_reclaim_elmt(buf, fb_info->fill->type, dxpl_id);
- else
- H5T_vlen_reclaim_elmt(buf, fb_info->mem_type, dxpl_id);
+ if(fb_info->fill->type) {
+ if(H5T_vlen_reclaim_elmt(buf, fb_info->fill->type, dxpl_id) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't reclaim vlen element")
+ } /* end if */
+ else {
+ if(H5T_vlen_reclaim_elmt(buf, fb_info->mem_type, dxpl_id) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't reclaim vlen element")
+ } /* end else */
/* Free temporary fill buffer */
if(fb_info->fill_free_func)
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c
index bbcdcdd..1505f0e 100644
--- a/src/H5Dlayout.c
+++ b/src/H5Dlayout.c
@@ -274,7 +274,7 @@ H5D_layout_set_latest_version(H5O_layout_t *layout, const H5S_t *space)
/* Query the dimensionality of the dataspace */
if((sndims = H5S_GET_EXTENT_NDIMS(space)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "invalid dataspace rank")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "invalid dataspace rank")
ndims = (unsigned)sndims;
/* Avoid scalar/null dataspace */
@@ -285,7 +285,7 @@ H5D_layout_set_latest_version(H5O_layout_t *layout, const H5S_t *space)
/* Query the dataspace's dimensions */
if(H5S_get_simple_extent_dims(space, NULL, max_dims) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get dataspace max. dimensions")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace max. dimensions")
/* Spin through the max. dimensions, looking for unlimited dimensions */
for(u = 0; u < ndims; u++)
@@ -294,7 +294,10 @@ H5D_layout_set_latest_version(H5O_layout_t *layout, const H5S_t *space)
/* Chunked datasets with unlimited dimension(s) */
if(unlim_count) { /* dataset with unlimited dimension(s) must be chunked */
- HDassert(layout->type == H5D_CHUNKED);
+ /* Check for invalid layout type */
+ if(layout->type != H5D_CHUNKED)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "dataset with unlimited dimensions is not chunked")
+
if(1 == unlim_count) { /* Chunked dataset with only 1 unlimited dimension */
layout->u.chunk.idx_type = H5D_CHUNK_IDX_EARRAY;
layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_EARRAY;
diff --git a/src/H5Dproxy.c b/src/H5Dproxy.c
index 8a94402..fb52517 100644
--- a/src/H5Dproxy.c
+++ b/src/H5Dproxy.c
@@ -350,7 +350,7 @@ HDfprintf(stderr, "%s: ent->proxy_addr = %a\n", FUNC, ent->proxy_addr);
proxy->ent = ent;
/* Insert chunk proxy into metadata cache, pinned */
- if(H5AC_set(dset->oloc.file, dxpl_id, H5AC_CHUNK_PROXY, ent->proxy_addr, proxy, H5AC__PIN_ENTRY_FLAG) < 0)
+ if(H5AC_insert_entry(dset->oloc.file, dxpl_id, H5AC_CHUNK_PROXY, ent->proxy_addr, proxy, H5AC__PIN_ENTRY_FLAG) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't add chunk proxy to cache")
/* Compose chunked index info struct */
diff --git a/src/H5Dtest.c b/src/H5Dtest.c
index 49b0986..68208b3 100644
--- a/src/H5Dtest.c
+++ b/src/H5Dtest.c
@@ -14,7 +14,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
- * Thusdayr, May 27, 2004
+ * Thursday, May 27, 2004
*
* Purpose: Dataset testing functions.
*/
diff --git a/src/H5EAdblkpage.c b/src/H5EAdblkpage.c
index 1876262..eba7470 100644
--- a/src/H5EAdblkpage.c
+++ b/src/H5EAdblkpage.c
@@ -179,7 +179,7 @@ HDfprintf(stderr, "%s: dblk_page->size = %Zu\n", FUNC, dblk_page->size);
H5E_THROW(H5E_CANTSET, "can't set extensible array data block page elements to class's fill value")
/* Cache the new extensible array data block page */
- if(H5AC_set(hdr->f, dxpl_id, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0)
H5E_THROW(H5E_CANTINSERT, "can't add extensible array data block page to cache")
CATCH
diff --git a/src/H5EAdblock.c b/src/H5EAdblock.c
index 1378c6b..640f353 100644
--- a/src/H5EAdblock.c
+++ b/src/H5EAdblock.c
@@ -206,7 +206,7 @@ HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off);
H5E_THROW(H5E_CANTSET, "can't set extensible array data block elements to class's fill value")
/* Cache the new extensible array data block */
- if(H5AC_set(hdr->f, dxpl_id, H5AC_EARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_EARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0)
H5E_THROW(H5E_CANTINSERT, "can't add extensible array data block to cache")
/* Update extensible array data block statistics */
diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c
index a7f12a5..0d283ea 100644
--- a/src/H5EAhdr.c
+++ b/src/H5EAhdr.c
@@ -436,7 +436,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array header")
/* Cache the new extensible array header */
- if(H5AC_set(f, dxpl_id, H5AC_EARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_EARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0)
H5E_THROW(H5E_CANTINSERT, "can't add extensible array header to cache")
/* Set address of array header to return */
diff --git a/src/H5EAiblock.c b/src/H5EAiblock.c
index 2fde249..e18947a 100644
--- a/src/H5EAiblock.c
+++ b/src/H5EAiblock.c
@@ -231,7 +231,7 @@ HDfprintf(stderr, "%s: iblock->size = %Zu\n", FUNC, iblock->size);
} /* end if */
/* Cache the new extensible array index block */
- if(H5AC_set(hdr->f, dxpl_id, H5AC_EARRAY_IBLOCK, iblock_addr, iblock, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_EARRAY_IBLOCK, iblock_addr, iblock, H5AC__NO_FLAGS_SET) < 0)
H5E_THROW(H5E_CANTINSERT, "can't add extensible array index block to cache")
/* Update extensible array index block statistics */
diff --git a/src/H5EAsblock.c b/src/H5EAsblock.c
index 938cd03..ba1c40f 100644
--- a/src/H5EAsblock.c
+++ b/src/H5EAsblock.c
@@ -232,7 +232,7 @@ HDfprintf(stderr, "%s: sblock->block_off = %Hu\n", FUNC, sblock->block_off);
H5V_array_fill(sblock->dblk_addrs, &tmp_addr, sizeof(haddr_t), sblock->ndblks);
/* Cache the new extensible array super block */
- if(H5AC_set(hdr->f, dxpl_id, H5AC_EARRAY_SBLOCK, sblock_addr, sblock, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_EARRAY_SBLOCK, sblock_addr, sblock, H5AC__NO_FLAGS_SET) < 0)
H5E_THROW(H5E_CANTINSERT, "can't add extensible array super block to cache")
/* Update extensible array super block statistics */
diff --git a/src/H5F.c b/src/H5F.c
index a7f6aa8..d5013bd 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -1197,12 +1197,26 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
tent_flags = flags;
if(NULL == (lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF))) {
- if(tent_flags == flags)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file")
+ if(tent_flags == flags) {
+#ifndef H5_USING_MEMCHECKER
+ time_t mytime = HDtime(NULL);
+
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: time = %s, name = '%s', tent_flags = %x", HDctime(&mytime), name, tent_flags)
+#else /* H5_USING_MEMCHECKER */
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', tent_flags = %x", name, tent_flags)
+#endif /* H5_USING_MEMCHECKER */
+ } /* end if */
H5E_clear_stack(NULL);
tent_flags = flags;
- if(NULL == (lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file")
+ if(NULL == (lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF))) {
+#ifndef H5_USING_MEMCHECKER
+ time_t mytime = HDtime(NULL);
+
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: time = %s, name = '%s', tent_flags = %x", HDctime(&mytime), name, tent_flags)
+#else /* H5_USING_MEMCHECKER */
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', tent_flags = %x", name, tent_flags)
+#endif /* H5_USING_MEMCHECKER */
+ } /* end if */
} /* end if */
/* Is the file already open? */
diff --git a/src/H5FAdblkpage.c b/src/H5FAdblkpage.c
index 2df31f2..b5ef82c 100644
--- a/src/H5FAdblkpage.c
+++ b/src/H5FAdblkpage.c
@@ -177,7 +177,7 @@ HDfprintf(stderr, "%s: dblk_page->size = %Zu\n", FUNC, dblk_page->size);
H5E_THROW(H5E_CANTSET, "can't set fixed array data block page elements to class's fill value")
/* Cache the new fixed array data block page */
- if(H5AC_set(hdr->f, dxpl_id, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0)
H5E_THROW(H5E_CANTINSERT, "can't add fixed array data block page to cache")
CATCH
diff --git a/src/H5FAdblock.c b/src/H5FAdblock.c
index fd1dd89..80e2159 100644
--- a/src/H5FAdblock.c
+++ b/src/H5FAdblock.c
@@ -225,7 +225,7 @@ HDfprintf(stderr, "%s: dblock->size = %Zu\n", FUNC, dblock->size);
H5E_THROW(H5E_CANTSET, "can't set fixed array data block elements to class's fill value")
/* Cache the new fixed array data block */
- if(H5AC_set(hdr->f, dxpl_id, H5AC_FARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_FARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0)
H5E_THROW(H5E_CANTINSERT, "can't add fixed array data block to cache")
/* Mark the header dirty (for updating statistics) */
diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c
index 5cfba0d..23a554a 100644
--- a/src/H5FAhdr.c
+++ b/src/H5FAhdr.c
@@ -222,7 +222,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
H5E_THROW(H5E_CANTALLOC, "file allocation failed for Fixed Array header")
/* Cache the new Fixed Array header */
- if(H5AC_set(f, dxpl_id, H5AC_FARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_FARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0)
H5E_THROW(H5E_CANTINSERT, "can't add fixed array header to cache")
/* Set address of array header to return */
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c
index 4d87dde..c6868e0 100644
--- a/src/H5FDdirect.c
+++ b/src/H5FDdirect.c
@@ -574,7 +574,7 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd
if (HDposix_memalign(&buf2, file->fa.mboundary, file->fa.fbsize) != 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "HDposix_memalign failed")
- if(o_flags &= O_CREAT) {
+ if(o_flags & O_CREAT) {
if(write(file->fd, (void*)buf1, sizeof(int))<0) {
if(write(file->fd, (void*)buf2, file->fa.fbsize)<0)
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, NULL, "file system may not support Direct I/O")
@@ -590,8 +590,17 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd
HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "file system may not support Direct I/O")
else
file->fa.must_align = TRUE;
- } else
- file->fa.must_align = FALSE;
+ } else {
+ if(o_flags & O_RDWR) {
+ if(file_seek(file->fd, (file_offset_t)0, SEEK_SET) < 0)
+ HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, NULL, "unable to seek to proper position")
+ if(write(file->fd, (void *)buf1, sizeof(int))<0)
+ file->fa.must_align = TRUE;
+ else
+ file->fa.must_align = FALSE;
+ } else
+ file->fa.must_align = FALSE;
+ }
}
if(buf1)
@@ -918,12 +927,13 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, ha
hbool_t _must_align = TRUE;
herr_t ret_value=SUCCEED; /* Return value */
size_t alloc_size;
- void *copy_buf, *p2, *p3;
+ void *copy_buf = NULL, *p2;
size_t _boundary;
size_t _fbsize;
size_t _cbsize;
- haddr_t copy_addr = addr;
- size_t copy_size = size;
+ haddr_t read_size; /* Size to read into copy buffer */
+ size_t copy_size = size; /* Size remaining to read when using copy buffer */
+ size_t copy_offset; /* Offset into copy buffer of the requested data */
FUNC_ENTER_NOAPI(H5FD_direct_read, FAIL)
@@ -987,19 +997,24 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, ha
buf = (char*)buf + nbytes;
}
} else {
+ /* Calculate where we will begin copying from the copy buffer */
+ copy_offset = (size_t)(addr % _fbsize);
+
/* allocate memory needed for the Direct IO option up to the maximal
* copy buffer size. Make a bigger buffer for aligned I/O if size is
* smaller than maximal copy buffer. */
- if(size < _cbsize)
- alloc_size = ((size / _fbsize) * _fbsize) + _fbsize;
- else
+ alloc_size = ((copy_offset + size - 1) / _fbsize + 1) * _fbsize;
+ if(alloc_size > _cbsize)
alloc_size = _cbsize;
+ HDassert(!(alloc_size % _fbsize));
if (HDposix_memalign(&copy_buf, _boundary, alloc_size) != 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "HDposix_memalign failed")
- /* look for the aligned position for reading the data */
- if(file_seek(file->fd, (file_offset_t)(copy_addr - copy_addr % _fbsize), SEEK_SET) < 0)
- HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
+ /* look for the aligned position for reading the data */
+ HDassert(!(((addr / _fbsize) * _fbsize) % _fbsize));
+ if(file_seek(file->fd, (file_offset_t)((addr / _fbsize) * _fbsize),
+ SEEK_SET) < 0)
+ HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
/*
* Read the aligned data in file into aligned buffer first, then copy the data
@@ -1007,7 +1022,6 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, ha
* size, do the reading by segment (the outer while loop). If not, do one step
* reading.
*/
- p3 = buf;
do {
/* Read the aligned data in file first. Not able to handle interrupted
* system calls and partial results like sec2 driver does because the
@@ -1015,41 +1029,48 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, ha
* file is smaller than ALLOC_SIZE. */
HDmemset(copy_buf, 0, alloc_size);
+ /* Calculate how much data we have to read in this iteration
+ * (including unused parts of blocks) */
+ if((copy_size + copy_offset) < alloc_size)
+ read_size = ((copy_size + copy_offset - 1) / _fbsize + 1)
+ * _fbsize;
+ else
+ read_size = alloc_size;
+
+ HDassert(!(read_size % _fbsize));
do {
- nbytes = HDread(file->fd, copy_buf, alloc_size);
+ nbytes = HDread(file->fd, copy_buf, read_size);
} while(-1==nbytes && EINTR==errno);
if (-1==nbytes) /* error */
HSYS_GOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed")
- /* look for the right position and copy the data to the original buffer.
- * Consider all possible situations here: file address is not aligned on
- * file block size; the end of data address is not aligned; the end of data
- * address is aligned; data size is smaller or bigger than maximal copy size.*/
- p2 = (unsigned char*)copy_buf + (size_t)(copy_addr % _fbsize);
- if(size < _cbsize)
- HDmemcpy(p3, p2, size);
- else if(size >= _cbsize && copy_size <= (alloc_size-(size_t)(copy_addr%_fbsize)))
- HDmemcpy(p3, p2, copy_size);
- else if(size >= _cbsize && copy_size > (alloc_size-(size_t)(copy_addr%_fbsize))) {
- HDmemcpy(p3, p2, (alloc_size - (size_t)(copy_addr % _fbsize)));
- p3 = (unsigned char*)p3 + (alloc_size - (size_t)(copy_addr % _fbsize));
- }
-
- /* update the size and address of data being read. */
- if(copy_size > (alloc_size - (size_t)(copy_addr % _fbsize)))
- copy_size -= (alloc_size - (size_t)(copy_addr % _fbsize));
- else
- copy_size = 0;
- copy_addr += (alloc_size - (size_t)(copy_addr % _fbsize));
+ /* Copy the needed data from the copy buffer to the output
+ * buffer, and update copy_size. If the copy buffer does not
+ * contain the rest of the data, just copy what's in the copy
+ * buffer and also update read_addr and copy_offset to read the
+ * next section of data. */
+ p2 = (unsigned char*)copy_buf + copy_offset;
+ if((copy_size + copy_offset) <= alloc_size) {
+ HDmemcpy(buf, p2, copy_size);
+ buf = (unsigned char *)buf + copy_size;
+ copy_size = 0;
+ } /* end if */
+ else {
+ HDmemcpy(buf, p2, alloc_size - copy_offset);
+ buf = (unsigned char*)buf + alloc_size - copy_offset;
+ copy_size -= alloc_size - copy_offset;
+ copy_offset = 0;
+ } /* end else */
} while (copy_size > 0);
- /*Final step: update address and buffer*/
- addr += (haddr_t)size;
- buf = (unsigned char*)buf + size;
+ /*Final step: update address*/
+ addr = (haddr_t)(((addr + size - 1) / _fbsize + 1) * _fbsize);
- if(copy_buf)
- HDfree(copy_buf);
+ if(copy_buf) {
+ HDfree(copy_buf);
+ copy_buf = NULL;
+ } /* end if */
}
/* Update current position */
@@ -1058,6 +1079,9 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, ha
done:
if(ret_value<0) {
+ if(copy_buf)
+ HDfree(copy_buf);
+
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
@@ -1094,13 +1118,16 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h
hbool_t _must_align = TRUE;
herr_t ret_value=SUCCEED; /* Return value */
size_t alloc_size;
- void *copy_buf, *p1;
+ void *copy_buf = NULL, *p1;
const void *p3;
size_t _boundary;
size_t _fbsize;
size_t _cbsize;
- haddr_t copy_addr = addr;
- size_t copy_size = size;
+ haddr_t write_addr; /* Address to write copy buffer */
+ haddr_t write_size; /* Size to write from copy buffer */
+ haddr_t read_size; /* Size to read into copy buffer */
+ size_t copy_size = size; /* Size remaining to write when using copy buffer */
+ size_t copy_offset; /* Offset into copy buffer of the data to write */
FUNC_ENTER_NOAPI(H5FD_direct_write, FAIL)
@@ -1152,41 +1179,83 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h
buf = (const char*)buf + nbytes;
}
} else {
+ /* Calculate where we will begin reading from (on disk) and where we
+ * will begin copying from the copy buffer */
+ write_addr = (addr / _fbsize) * _fbsize;
+ copy_offset = (size_t)(addr % _fbsize);
+
/* allocate memory needed for the Direct IO option up to the maximal
* copy buffer size. Make a bigger buffer for aligned I/O if size is
* smaller than maximal copy buffer.
*/
- if(size < _cbsize)
- alloc_size = ((size / _fbsize) * _fbsize) + _fbsize;
- else
- alloc_size = _cbsize;
+ alloc_size = ((copy_offset + size - 1) / _fbsize + 1) * _fbsize;
+ if(alloc_size > _cbsize)
+ alloc_size = _cbsize;
+ HDassert(!(alloc_size % _fbsize));
if (HDposix_memalign(&copy_buf, _boundary, alloc_size) != 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "HDposix_memalign failed")
- /* look for the right position for reading the data */
- if(file_seek(file->fd, (file_offset_t)(copy_addr - copy_addr % _fbsize), SEEK_SET) < 0)
- HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
+ /* look for the right position for reading or writing the data */
+ if(file_seek(file->fd, (file_offset_t)write_addr, SEEK_SET) < 0)
+ HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
p3 = buf;
do {
+ /* Calculate how much data we have to write in this iteration
+ * (including unused parts of blocks) */
+ if((copy_size + copy_offset) < alloc_size)
+ write_size = ((copy_size + copy_offset - 1) / _fbsize + 1)
+ * _fbsize;
+ else
+ write_size = alloc_size;
+
/*
* Read the aligned data first if the aligned region doesn't fall
* entirely in the range to be writen. Not able to handle interrupted
* system calls and partial results like sec2 driver does because the
* data may no longer be aligned. It's expecially true when the data in
- * file is smaller than ALLOC_SIZE.
+ * file is smaller than ALLOC_SIZE. Only read the entire section if
+ * both ends are misaligned, otherwise only read the block on the
+ * misaligned end.
*/
- HDmemset(copy_buf, 0, alloc_size);
-
- if(copy_addr <= addr || (copy_addr + alloc_size) >= (addr + size)) {
- do {
- nbytes = read(file->fd, copy_buf, alloc_size);
- } while (-1==nbytes && EINTR==errno);
-
- if (-1==nbytes) /* error */
- HSYS_GOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed")
- }
+ HDmemset(copy_buf, 0, _fbsize);
+
+ if(copy_offset > 0) {
+ if((write_addr + write_size) > (addr + size)) {
+ HDassert((write_addr + write_size) - (addr + size) < _fbsize);
+ read_size = write_size;
+ p1 = copy_buf;
+ } /* end if */
+ else {
+ read_size = _fbsize;
+ p1 = copy_buf;
+ } /* end else */
+ } /* end if */
+ else if((write_addr + write_size) > (addr + size)) {
+ HDassert((write_addr + write_size) - (addr + size) < _fbsize);
+ read_size = _fbsize;
+ p1 = (unsigned char *)copy_buf + write_size - _fbsize;
+
+ /* Seek to the last block, for reading */
+ HDassert(!((write_addr + write_size - _fbsize) % _fbsize));
+ if(file_seek(file->fd,
+ (file_offset_t)(write_addr + write_size - _fbsize),
+ SEEK_SET) < 0)
+ HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
+ } /* end if */
+ else
+ p1 = NULL;
+
+ if(p1) {
+ HDassert(!(read_size % _fbsize));
+ do {
+ nbytes = read(file->fd, p1, read_size);
+ } while (-1==nbytes && EINTR==errno);
+
+ if (-1==nbytes) /* error */
+ HSYS_GOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed")
+ } /* end if */
/* look for the right position and append or copy the data to be written to
* the aligned buffer.
@@ -1194,46 +1263,47 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h
* file block size; the end of data address is not aligned; the end of data
* address is aligned; data size is smaller or bigger than maximal copy size.
*/
- p1 = (unsigned char*)copy_buf + (size_t)(copy_addr % _fbsize);
- if(size < _cbsize)
- HDmemcpy(p1, p3, size);
- else if(size >= _cbsize && copy_size <= (alloc_size-(size_t)(copy_addr%_fbsize))) {
- HDmemcpy(p1, p3, copy_size);
- }else if(size >= _cbsize && copy_size > (alloc_size-(size_t)(copy_addr%_fbsize))) {
- HDmemcpy(p1, p3, (alloc_size - (size_t)(copy_addr % _fbsize)));
- p3 = (const unsigned char *)p3 + (alloc_size - (size_t)(copy_addr % _fbsize));
- }
+ p1 = (unsigned char *)copy_buf + copy_offset;
+ if((copy_size + copy_offset) <= alloc_size) {
+ HDmemcpy(p1, p3, copy_size);
+ copy_size = 0;
+ } /* end if */
+ else {
+ HDmemcpy(p1, p3, alloc_size - copy_offset);
+ p3 = (const unsigned char *)p3 + (alloc_size - copy_offset);
+ copy_size -= alloc_size - copy_offset;
+ copy_offset = 0;
+ } /* end else */
/*look for the aligned position for writing the data*/
- if(file_seek(file->fd, (file_offset_t)(copy_addr - copy_addr % _fbsize), SEEK_SET) < 0)
+ HDassert(!(write_addr % _fbsize));
+ if(file_seek(file->fd, (file_offset_t)write_addr, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
/*
* Write the data. It doesn't truncate the extra data introduced by
* alignment because that step is done in H5FD_direct_flush.
*/
+ HDassert(!(write_size % _fbsize));
do {
- nbytes = HDwrite(file->fd, copy_buf, alloc_size);
+ nbytes = HDwrite(file->fd, copy_buf, write_size);
} while (-1==nbytes && EINTR==errno);
if (-1==nbytes) /* error */
HSYS_GOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
- /* update the size and address of data being read. */
- if(copy_size > (alloc_size - (size_t)(copy_addr % _fbsize)))
- copy_size -= (alloc_size - (size_t)(copy_addr % _fbsize));
- else
- copy_size = 0;
-
- copy_addr += (alloc_size - (size_t)(copy_addr % _fbsize));
+ /* update the write address */
+ write_addr += write_size;
} while (copy_size > 0);
/*Update the address and size*/
- addr += (haddr_t)size;
+ addr = write_addr;
buf = (const char*)buf + size;
- if(copy_buf)
+ if(copy_buf) {
HDfree(copy_buf);
+ copy_buf = NULL;
+ } /* end if */
}
/* Update current position and eof */
@@ -1244,6 +1314,9 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h
done:
if(ret_value<0) {
+ if(copy_buf)
+ HDfree(copy_buf);
+
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index ab2bc72..4c7b4ba 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -110,24 +110,14 @@ typedef struct H5FD_sec2_t {
* some macros here so we don't have to have conditional compilations later
* throughout the code.
*
- * file_offset_t: The datatype for file offsets, the second argument of
- * the lseek() or lseek64() call.
+ * HDoff_t: The datatype for file offsets, the second argument of
+ * the lseek() or lseek64() call.
*
*/
-/* adding for windows NT file system support. */
-
-#ifdef H5_HAVE_LSEEK64
-# define file_offset_t off64_t
-#elif defined (_WIN32) && !defined(__MWERKS__)
-# /*MSVC*/
-# define file_offset_t __int64
-#else
-# define file_offset_t off_t
-#endif
/*
* These macros check for overflow of various quantities. These macros
- * assume that file_offset_t is signed and haddr_t and size_t are unsigned.
+ * assume that HDoff_t is signed and haddr_t and size_t are unsigned.
*
* ADDR_OVERFLOW: Checks whether a file address of type `haddr_t'
* is too large to be represented by the second argument
@@ -140,13 +130,13 @@ typedef struct H5FD_sec2_t {
* which can be addressed entirely by the second
* argument of the file seek function.
*/
-#define MAXADDR (((haddr_t)1<<(8*sizeof(file_offset_t)-1))-1)
+#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1)
#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \
((A) & ~(haddr_t)MAXADDR))
#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR)
#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \
HADDR_UNDEF==(A)+(Z) || \
- (file_offset_t)((A)+(Z))<(file_offset_t)(A))
+ (HDoff_t)((A)+(Z))<(HDoff_t)(A))
/* Prototypes */
static H5FD_t *H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id,
@@ -347,7 +337,7 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
FUNC_ENTER_NOAPI(H5FD_sec2_open, NULL)
/* Sanity check on file offsets */
- HDassert(sizeof(file_offset_t) >= sizeof(size_t));
+ HDassert(sizeof(HDoff_t) >= sizeof(size_t));
/* Check arguments */
if(!name || !*name)
@@ -369,9 +359,8 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
/* Open the file */
if((fd = HDopen(name, o_flags, 0666)) < 0) {
int myerrno = errno;
- time_t mytime = HDtime(NULL);
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: time = %s, name = '%s', errno = %d, error message = '%s', flags = %x, o_flags = %x", HDctime(&mytime), name, myerrno, HDstrerror(myerrno), flags, (unsigned)o_flags);
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', errno = %d, error message = '%s', flags = %x, o_flags = %x", name, myerrno, HDstrerror(myerrno), flags, (unsigned)o_flags);
} /* end if */
if(HDfstat(fd, &sb) < 0)
HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file")
@@ -759,7 +748,7 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id,
/* Seek to the correct location */
if((addr != file->pos || OP_READ != file->op) &&
- HDlseek(file->fd, (file_offset_t)addr, SEEK_SET) < 0)
+ HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
/*
@@ -773,7 +762,7 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id,
if(-1 == nbytes) { /* error */
int myerrno = errno;
time_t mytime = HDtime(NULL);
- file_offset_t myoffset = HDlseek(file->fd, (file_offset_t)0, SEEK_CUR);
+ HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, size = %lu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long)size, (unsigned long long)myoffset);
} /* end if */
@@ -839,7 +828,7 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had
if(!H5F_addr_defined(addr))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr)
if(REGION_OVERFLOW(addr, size))
- HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr)
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size = %llu", (unsigned long long)addr, (unsigned long long)size)
/* If the file is open for SWMR read access, allow access to data past
* the end of the allocated space (the 'eoa'). This is done because the
* eoa stored in the file's superblock might be out of sync with the
@@ -847,11 +836,11 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had
* SWMR write operations.
*/
if(!file->swmr_read && (addr + size) > file->eoa)
- HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr)
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size = %llu, eoa = %llu", (unsigned long long)addr, (unsigned long long)size, (unsigned long long)file->eoa)
/* Seek to the correct location */
if((addr != file->pos || OP_WRITE != file->op) &&
- HDlseek(file->fd, (file_offset_t)addr, SEEK_SET) < 0)
+ HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
/*
@@ -865,7 +854,7 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had
if(-1 == nbytes) { /* error */
int myerrno = errno;
time_t mytime = HDtime(NULL);
- file_offset_t myoffset = HDlseek(file->fd, (file_offset_t)0, SEEK_CUR);
+ HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, size = %lu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long)size, (unsigned long long)myoffset);
} /* end if */
@@ -940,11 +929,11 @@ H5FD_sec2_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing)
#ifdef H5_VMS
/* Reset seek offset to the beginning of the file, so that the file isn't
* re-extended later. This may happen on Open VMS. */
- if(-1 == HDlseek(file->fd, (file_offset_t)0, SEEK_SET))
+ if(-1 == HDlseek(file->fd, (HDoff_t)0, SEEK_SET))
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
#endif
- if(-1 == HDftruncate(file->fd, (file_offset_t)file->eoa))
+ if(-1 == HDftruncate(file->fd, (HDoff_t)file->eoa))
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
#endif /* _WIN32 */
@@ -959,3 +948,4 @@ H5FD_sec2_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_sec2_truncate() */
+
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c
index 40befaf..3cba6a1 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -116,16 +116,44 @@ typedef struct H5FD_stdio_t {
hbool_t swmr_read; /* Whether the file is open for SWMR read access */
} H5FD_stdio_t;
-#ifdef H5_HAVE_LSEEK64
-# define file_offset_t off64_t
-# define file_truncate ftruncate64
-#elif defined (_WIN32) && !defined(__MWERKS__)
-# /*MSVC*/
-# define file_offset_t __int64
-# define file_truncate _chsize
-#else
-# define file_offset_t off_t
-# define file_truncate ftruncate
+/* Use similar structure as in H5private.h by defining Windows stuff first. */
+#ifdef _WIN32
+ #if _MSC_VER > 1310 /* Newer than VS.NET 2003 */
+ # define file_fseek _fseeki64
+ # define file_offset_t __int64
+ # define file_ftruncate _chsize_s /* Supported in VS 2005 or newer */
+ # define file_ftell _ftelli64
+ #else
+ # define file_fseek fseek
+ # define file_offset_t long
+ # define file_ftruncate _chsize
+ # define file_ftell ftell
+ #endif
+#endif
+
+/* Use file_xxx to indicate these are local macros, avoiding confusing
+ * with the global HD_xxx macros.
+ * Need fseeko, off_t, ftell and ftruncate are all of the same 32 or 64
+ * versions.
+ * Assume fseeko, which is POSIX standard, is always supported;
+ * but prefer to use fseeko64 if supported.
+ * [Note: the ifndef H5_HAVE_FSEEKO condition to determine BIG FILE not
+ * supported was old code. This condition is not supposed to be true in Unix
+ * like systems but may happen in non-Unix systems like Windows. They are left
+ * in for now and will be cleaned later. -AKC-]
+ */
+#ifndef file_fseek
+ #ifdef H5_HAVE_FSEEKO64
+ # define file_fseek fseeko64
+ # define file_offset_t off64_t
+ # define file_ftruncate ftruncate64
+ # define file_ftell ftello64
+ #else
+ # define file_fseek fseeko
+ # define file_offset_t off_t
+ # define file_ftruncate ftruncate
+ # define file_ftell ftello
+ #endif
#endif
/*
@@ -386,18 +414,10 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id,
file->op = H5FD_STDIO_OP_SEEK;
file->pos = HADDR_UNDEF;
file->write_access=write_access; /* Note the write_access for later */
-#ifdef H5_HAVE_FSEEKO
- if(fseeko(file->fp, (off_t)0, SEEK_END) < 0) {
-#else
- if(fseek(file->fp, (long)0L, SEEK_END) < 0) {
-#endif
+ if(file_fseek(file->fp, (file_offset_t)0, SEEK_END) < 0) {
file->op = H5FD_STDIO_OP_UNKNOWN;
} else {
-#ifdef H5_HAVE_FTELLO
- off_t x = ftello (file->fp);
-#else
- long x = ftell (file->fp);
-#endif
+ file_offset_t x = file_ftell (file->fp);
assert (x>=0);
file->eof = (haddr_t)x;
}
@@ -821,11 +841,7 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz
*/
if (!(file->op == H5FD_STDIO_OP_READ || file->op==H5FD_STDIO_OP_SEEK) ||
file->pos != addr) {
-#ifdef H5_HAVE_FSEEKO
- if (fseeko(file->fp, (off_t)addr, SEEK_SET) < 0) {
-#else
- if (fseek(file->fp, (long)addr, SEEK_SET) < 0) {
-#endif
+ if (file_fseek(file->fp, (file_offset_t)addr, SEEK_SET) < 0) {
file->op = H5FD_STDIO_OP_UNKNOWN;
file->pos = HADDR_UNDEF;
H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "fseek failed", -1)
@@ -915,11 +931,7 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
*/
if ((file->op != H5FD_STDIO_OP_WRITE && file->op != H5FD_STDIO_OP_SEEK) ||
file->pos != addr) {
-#ifdef H5_HAVE_FSEEKO
- if (fseeko(file->fp, (off_t)addr, SEEK_SET) < 0) {
-#else
- if (fseek(file->fp, (long)addr, SEEK_SET) < 0) {
-#endif
+ if (file_fseek(file->fp, (file_offset_t)addr, SEEK_SET) < 0) {
file->op = H5FD_STDIO_OP_UNKNOWN;
file->pos = HADDR_UNDEF;
H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "fseek failed", -1)
@@ -1012,6 +1024,9 @@ H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing)
* Programmer: Quincey Koziol
* Thursday, January 31, 2008
*
+ * Modifications:
+ * Vailin Choi; June 2010
+ * Fix for window failures manifested from tests in mf.c.
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1037,7 +1052,7 @@ H5FD_stdio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing)
HFILE filehandle; /* Windows file handle */
LARGE_INTEGER li; /* 64-bit integer for SetFilePointer() call */
- /* Reset seek offset to beginning of file, so that file isn't re-extended later */
+ /* Reset seek offset to beginning of file, so that file isn't re-extended later */
rewind(file->fp);
/* Map the posix file handle to a Windows file handle */
@@ -1054,7 +1069,7 @@ H5FD_stdio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing)
rewind(file->fp);
/* Truncate file to proper length */
- if(-1 == file_truncate(fd, (file_offset_t)file->eoa))
+ if(-1 == file_ftruncate(fd, (file_offset_t)file->eoa))
H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "unable to truncate/extend file properly", -1)
#endif /* _WIN32 */
diff --git a/src/H5FS.c b/src/H5FS.c
index 27111a2..aa7da4d 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -143,7 +143,7 @@ HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", FUNC, ncl
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "file allocation failed for free space header")
/* Cache the new free space header (pinned) */
- if(H5AC_set(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG) < 0)
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, NULL, "can't add free space header to cache")
/* Return free space header address to caller, if desired */
@@ -401,7 +401,7 @@ HDfprintf(stderr, "%s: Real sections to store in file\n", FUNC);
HDassert(H5F_addr_defined(fspace->sect_addr));
/* Cache the free space section info */
- if(H5AC_set(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sections to cache")
} /* end if */
else {
@@ -767,7 +767,7 @@ H5FS_alloc_hdr(H5F_t *f, H5FS_t *fspace, haddr_t *fs_addr, hid_t dxpl_id)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for free space header")
/* Cache the new free space header (pinned) */
- if(H5AC_set(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG) < 0)
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space header to cache")
} /* end if */
@@ -814,7 +814,7 @@ H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
/* Cache the free-space section info */
- if(H5AC_set(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sections to cache")
fspace->sinfo = NULL;
diff --git a/src/H5Faccum.c b/src/H5Faccum.c
index 426a639..2fc53ea 100644
--- a/src/H5Faccum.c
+++ b/src/H5Faccum.c
@@ -143,13 +143,18 @@ H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
- new_addr);
/* Check if we need more buffer space */
- if(new_size > f->shared->accum.size) {
- /* Adjust the buffer size, by doubling it */
- f->shared->accum.alloc_size = MAX(f->shared->accum.alloc_size * 2, new_size);
+ if(new_size > f->shared->accum.alloc_size) {
+ size_t new_alloc_size; /* New size of accumulator */
+
+ /* Adjust the buffer size to be a power of 2 that is large enough to hold data */
+ new_alloc_size = (size_t)1 << (1 + H5V_log2_gen((uint64_t)(new_size - 1)));
/* Reallocate the metadata accumulator buffer */
- if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, f->shared->accum.alloc_size)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate metadata accumulator buffer")
+ if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_alloc_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
+
+ /* Note the new buffer size */
+ f->shared->accum.alloc_size = new_alloc_size;
#ifdef H5_CLEAR_MEMORY
HDmemset(f->shared->accum.buf + f->shared->accum.size, 0, (f->shared->accum.alloc_size - f->shared->accum.size));
#endif /* H5_CLEAR_MEMORY */
@@ -163,6 +168,10 @@ HDmemset(f->shared->accum.buf + f->shared->accum.size, 0, (f->shared->accum.allo
/* Make room for the metadata to read in */
HDmemmove(f->shared->accum.buf + amount_before, f->shared->accum.buf, f->shared->accum.size);
+ /* Adjust dirty region tracking info, if present */
+ if(f->shared->accum.dirty)
+ f->shared->accum.dirty_off += amount_before;
+
/* Dispatch to driver */
if(H5FD_read(f->shared->lf, dxpl_id, type, addr, amount_before, f->shared->accum.buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed")
@@ -228,6 +237,7 @@ H5F_accum_adjust(H5F_meta_accum_t *accum, H5FD_t *lf, hid_t dxpl_id,
HDassert(accum);
HDassert(lf);
+ HDassert(H5F_ACCUM_APPEND == adjust || H5F_ACCUM_PREPEND == adjust);
HDassert(size > 0);
HDassert(size <= H5F_ACCUM_MAX_SIZE);
@@ -252,36 +262,65 @@ H5F_accum_adjust(H5F_meta_accum_t *accum, H5FD_t *lf, hid_t dxpl_id,
remnant_size = 0;
} /* end if */
else {
- new_size = (H5F_ACCUM_MAX_SIZE / 2);
- shrink_size = (H5F_ACCUM_MAX_SIZE / 2);
- remnant_size = accum->size - shrink_size;
+ if(H5F_ACCUM_PREPEND == adjust) {
+ new_size = (H5F_ACCUM_MAX_SIZE / 2);
+ shrink_size = (H5F_ACCUM_MAX_SIZE / 2);
+ remnant_size = accum->size - shrink_size;
+ } /* end if */
+ else {
+ size_t adjust_size = size + accum->dirty_len;
+
+ /* Check if we can slide the dirty region down, to accommodate the request */
+ if(accum->dirty && (adjust_size <= H5F_ACCUM_MAX_SIZE)) {
+ if((ssize_t)(H5F_ACCUM_MAX_SIZE - (accum->dirty_off + adjust_size)) >= (ssize_t)(2 * size))
+ shrink_size = accum->dirty_off / 2;
+ else
+ shrink_size = accum->dirty_off;
+ remnant_size = accum->size - shrink_size;
+ new_size = remnant_size + size;
+ } /* end if */
+ else {
+ new_size = (H5F_ACCUM_MAX_SIZE / 2);
+ shrink_size = (H5F_ACCUM_MAX_SIZE / 2);
+ remnant_size = accum->size - shrink_size;
+ } /* end else */
+ } /* end else */
} /* end else */
/* Check if we need to flush accumulator data to file */
if(accum->dirty) {
/* Check whether to accumulator will be prepended or appended */
if(H5F_ACCUM_PREPEND == adjust) {
- /* Write out upper part of the existing metadata accumulator, with dispatch to driver */
- if(H5FD_write(lf, dxpl_id, H5FD_MEM_DEFAULT, (accum->loc + remnant_size), shrink_size, (accum->buf + remnant_size)) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
+ /* Check if the dirty region overlaps the region to eliminate from the accumulator */
+ if((accum->size - shrink_size) < (accum->dirty_off + accum->dirty_len)) {
+ /* Write out the dirty region from the metadata accumulator, with dispatch to driver */
+ if(H5FD_write(lf, dxpl_id, H5FD_MEM_DEFAULT, (accum->loc + accum->dirty_off), accum->dirty_len, (accum->buf + accum->dirty_off)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "file write failed")
+
+ /* Reset accumulator dirty flag */
+ accum->dirty = FALSE;
+ } /* end if */
} /* end if */
else {
- /* Sanity check */
- HDassert(H5F_ACCUM_APPEND == adjust);
-
- /* Write out lower part of the existing metadata accumulator, with dispatch to driver */
- if(H5FD_write(lf, dxpl_id, H5FD_MEM_DEFAULT, accum->loc, shrink_size, accum->buf) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
+ /* Check if the dirty region overlaps the region to eliminate from the accumulator */
+ if(shrink_size > accum->dirty_off) {
+ /* Write out the dirty region from the metadata accumulator, with dispatch to driver */
+ if(H5FD_write(lf, dxpl_id, H5FD_MEM_DEFAULT, (accum->loc + accum->dirty_off), accum->dirty_len, (accum->buf + accum->dirty_off)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "file write failed")
+
+ /* Reset accumulator dirty flag */
+ accum->dirty = FALSE;
+ } /* end if */
/* Move remnant of accumulator down */
HDmemmove(accum->buf, (accum->buf + shrink_size), remnant_size);
/* Adjust accumulator's location */
accum->loc += shrink_size;
- } /* end else */
- /* Reset accumulator dirty flag (in case of error) */
- accum->dirty = FALSE;
+ /* Adjust dirty region tracking info */
+ accum->dirty_off -= shrink_size;
+ } /* end else */
} /* end if */
/* Trim the accumulator's use of its buffer */
@@ -294,7 +333,7 @@ H5F_accum_adjust(H5F_meta_accum_t *accum, H5FD_t *lf, hid_t dxpl_id,
/* Reallocate the metadata accumulator buffer */
if(NULL == (new_buf = H5FL_BLK_REALLOC(meta_accum, accum->buf, new_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate metadata accumulator buffer")
/* Update accumulator info */
accum->buf = new_buf;
@@ -361,8 +400,15 @@ H5F_accum_write(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
f->shared->accum.loc = addr;
f->shared->accum.size += size;
- /* Mark it as written to */
- f->shared->accum.dirty = TRUE;
+ /* Adjust the dirty region and mark accumulator dirty */
+ if(f->shared->accum.dirty)
+ f->shared->accum.dirty_len = size + f->shared->accum.dirty_off
+ + f->shared->accum.dirty_len;
+ else {
+ f->shared->accum.dirty_len = size;
+ f->shared->accum.dirty = TRUE;
+ } /* end else */
+ f->shared->accum.dirty_off = 0;
} /* end if */
/* Check if the new metadata adjoins the end of the current accumulator */
else if(addr == (f->shared->accum.loc + f->shared->accum.size)) {
@@ -373,11 +419,18 @@ H5F_accum_write(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
/* Copy the new metadata to the end */
HDmemcpy(f->shared->accum.buf + f->shared->accum.size, buf, size);
+ /* Adjust the dirty region and mark accumulator dirty */
+ if(f->shared->accum.dirty)
+ f->shared->accum.dirty_len = size + (f->shared->accum.size -
+ f->shared->accum.dirty_off);
+ else {
+ f->shared->accum.dirty_off = f->shared->accum.size;
+ f->shared->accum.dirty_len = size;
+ f->shared->accum.dirty = TRUE;
+ } /* end else */
+
/* Set the new size of the metadata accumulator */
f->shared->accum.size += size;
-
- /* Mark it as written to */
- f->shared->accum.dirty = TRUE;
} /* end if */
/* Check if the piece of metadata being written overlaps the metadata accumulator */
else if(H5F_addr_overlap(addr, size, f->shared->accum.loc, f->shared->accum.size)) {
@@ -385,11 +438,33 @@ H5F_accum_write(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
/* Check if the new metadata is entirely within the current accumulator */
if(addr >= f->shared->accum.loc && (addr + size) <= (f->shared->accum.loc + f->shared->accum.size)) {
- /* Copy the new metadata to the proper location within the accumulator */
- HDmemcpy(f->shared->accum.buf + (addr - f->shared->accum.loc), buf, size);
+ size_t dirty_off = (size_t)(addr - f->shared->accum.loc);
- /* Mark it as written to */
- f->shared->accum.dirty = TRUE;
+ /* Copy the new metadata to the proper location within the accumulator */
+ HDmemcpy(f->shared->accum.buf + dirty_off, buf, size);
+
+ /* Adjust the dirty region and mark accumulator dirty */
+ if(f->shared->accum.dirty) {
+ /* Check for new metadata starting before current dirty region */
+ if(dirty_off <= f->shared->accum.dirty_off) {
+ if((dirty_off + size) <= (f->shared->accum.dirty_off + f->shared->accum.dirty_len))
+ f->shared->accum.dirty_len = (f->shared->accum.dirty_off + f->shared->accum.dirty_len) - dirty_off;
+ else
+ f->shared->accum.dirty_len = size;
+ f->shared->accum.dirty_off = dirty_off;
+ } /* end if */
+ else {
+ if((dirty_off + size) <= (f->shared->accum.dirty_off + f->shared->accum.dirty_len))
+ ; /* f->shared->accum.dirty_len doesn't change */
+ else
+ f->shared->accum.dirty_len = (dirty_off + size) - f->shared->accum.dirty_off;
+ } /* end else */
+ } /* end if */
+ else {
+ f->shared->accum.dirty_off = dirty_off;
+ f->shared->accum.dirty_len = size;
+ f->shared->accum.dirty = TRUE;
+ } /* end else */
} /* end if */
/* Check if the new metadata overlaps the beginning of the current accumulator */
else if(addr < f->shared->accum.loc && (addr + size) <= (f->shared->accum.loc + f->shared->accum.size)) {
@@ -415,11 +490,26 @@ H5F_accum_write(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
f->shared->accum.loc = addr;
f->shared->accum.size += add_size;
- /* Mark it as written to */
- f->shared->accum.dirty = TRUE;
+ /* Adjust the dirty region and mark accumulator dirty */
+ if(f->shared->accum.dirty) {
+ size_t curr_dirty_end = add_size + f->shared->accum.dirty_off + f->shared->accum.dirty_len;
+
+ f->shared->accum.dirty_off = 0;
+ if(size <= curr_dirty_end)
+ f->shared->accum.dirty_len = curr_dirty_end;
+ else
+ f->shared->accum.dirty_len = size;
+ } /* end if */
+ else {
+ f->shared->accum.dirty_off = 0;
+ f->shared->accum.dirty_len = size;
+ f->shared->accum.dirty = TRUE;
+ } /* end else */
} /* end if */
/* Check if the new metadata overlaps the end of the current accumulator */
else if(addr >= f->shared->accum.loc && (addr + size) > (f->shared->accum.loc + f->shared->accum.size)) {
+ size_t dirty_off = (size_t)(addr - f->shared->accum.loc);
+
/* Calculate the amount we will need to add to the accumulator size, based on the amount of overlap */
H5_ASSIGN_OVERFLOW(add_size, (addr + size) - (f->shared->accum.loc + f->shared->accum.size), hsize_t, size_t);
@@ -428,24 +518,43 @@ H5F_accum_write(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator")
/* Copy the new metadata to the end */
- HDmemcpy(f->shared->accum.buf + (addr - f->shared->accum.loc), buf, size);
+ HDmemcpy(f->shared->accum.buf + dirty_off, buf, size);
/* Set the new size of the metadata accumulator */
f->shared->accum.size += add_size;
- /* Mark it as written to */
- f->shared->accum.dirty = TRUE;
+ /* Adjust the dirty region and mark accumulator dirty */
+ if(f->shared->accum.dirty) {
+ /* Check for new metadata starting before current dirty region */
+ if(dirty_off <= f->shared->accum.dirty_off) {
+ f->shared->accum.dirty_off = dirty_off;
+ f->shared->accum.dirty_len = size;
+ } /* end if */
+ else {
+ f->shared->accum.dirty_len = (dirty_off + size) - f->shared->accum.dirty_off;
+ } /* end else */
+ } /* end if */
+ else {
+ f->shared->accum.dirty_off = dirty_off;
+ f->shared->accum.dirty_len = size;
+ f->shared->accum.dirty = TRUE;
+ } /* end else */
} /* end if */
/* New metadata overlaps both ends of the current accumulator */
else {
/* Check if we need more buffer space */
- if(size > f->shared->accum.size) {
- /* Adjust the buffer size, by doubling it */
- f->shared->accum.alloc_size = MAX(f->shared->accum.alloc_size * 2, size);
+ if(size > f->shared->accum.alloc_size) {
+ size_t new_alloc_size; /* New size of accumulator */
+
+ /* Adjust the buffer size to be a power of 2 that is large enough to hold data */
+ new_alloc_size = (size_t)1 << (1 + H5V_log2_gen((uint64_t)(size - 1)));
/* Reallocate the metadata accumulator buffer */
- if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, f->shared->accum.alloc_size)))
+ if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_alloc_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
+
+ /* Note the new buffer size */
+ f->shared->accum.alloc_size = new_alloc_size;
#ifdef H5_CLEAR_MEMORY
HDmemset(f->shared->accum.buf + size, 0, (f->shared->accum.alloc_size - size));
#endif /* H5_CLEAR_MEMORY */
@@ -458,7 +567,9 @@ HDmemset(f->shared->accum.buf + size, 0, (f->shared->accum.alloc_size - size));
f->shared->accum.loc = addr;
f->shared->accum.size = size;
- /* Mark it as written to */
+ /* Adjust the dirty region and mark accumulator dirty */
+ f->shared->accum.dirty_off = 0;
+ f->shared->accum.dirty_len = size;
f->shared->accum.dirty = TRUE;
} /* end else */
} /* end if */
@@ -466,7 +577,7 @@ HDmemset(f->shared->accum.buf + size, 0, (f->shared->accum.alloc_size - size));
else {
/* Write out the existing metadata accumulator, with dispatch to driver */
if(f->shared->accum.dirty) {
- if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_DEFAULT, f->shared->accum.loc, f->shared->accum.size, f->shared->accum.buf) < 0)
+ if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_DEFAULT, f->shared->accum.loc + f->shared->accum.dirty_off, f->shared->accum.dirty_len, f->shared->accum.buf + f->shared->accum.dirty_off) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
/* Reset accumulator dirty flag */
@@ -512,10 +623,14 @@ HDmemset(f->shared->accum.buf + clear_size, 0, (f->shared->accum.alloc_size - cl
/* Update the metadata accumulator information */
f->shared->accum.loc = addr;
f->shared->accum.size = size;
- f->shared->accum.dirty = TRUE;
/* Store the piece of metadata in the accumulator */
HDmemcpy(f->shared->accum.buf, buf, size);
+
+ /* Adjust the dirty region and mark accumulator dirty */
+ f->shared->accum.dirty_off = 0;
+ f->shared->accum.dirty_len = size;
+ f->shared->accum.dirty = TRUE;
} /* end else */
} /* end if */
/* No metadata in the accumulator, grab this piece and keep it */
@@ -533,15 +648,22 @@ HDmemset(f->shared->accum.buf + clear_size, 0, (f->shared->accum.alloc_size - cl
/* Note the new buffer size */
f->shared->accum.alloc_size = new_size;
+#ifdef H5_CLEAR_MEMORY
+HDmemset(f->shared->accum.buf + size, 0, (f->shared->accum.alloc_size - size));
+#endif /* H5_CLEAR_MEMORY */
} /* end if */
/* Update the metadata accumulator information */
f->shared->accum.loc = addr;
f->shared->accum.size = size;
- f->shared->accum.dirty = TRUE;
/* Store the piece of metadata in the accumulator */
HDmemcpy(f->shared->accum.buf, buf, size);
+
+ /* Adjust the dirty region and mark accumulator dirty */
+ f->shared->accum.dirty_off = 0;
+ f->shared->accum.dirty_len = size;
+ f->shared->accum.dirty = TRUE;
} /* end else */
/* Indicate success */
@@ -610,25 +732,100 @@ H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t UNUSED type, haddr_t addr,
/* Adjust the accumulator information */
f->shared->accum.loc += overlap_size;
f->shared->accum.size = new_accum_size;
+
+ /* Adjust the dirty region and possibly mark accumulator clean */
+ if(f->shared->accum.dirty) {
+ /* Check if block freed is entirely before dirty region */
+ if(overlap_size < f->shared->accum.dirty_off)
+ f->shared->accum.dirty_off -= overlap_size;
+ else {
+ /* Check if block freed ends within dirty region */
+ if(overlap_size < (f->shared->accum.dirty_off + f->shared->accum.dirty_len)) {
+ f->shared->accum.dirty_len = (f->shared->accum.dirty_off + f->shared->accum.dirty_len) - overlap_size;
+ f->shared->accum.dirty_off = 0;
+ } /* end if */
+ /* Block freed encompasses dirty region */
+ else
+ f->shared->accum.dirty = FALSE;
+ } /* end else */
+ } /* end if */
} /* end else */
} /* end if */
/* Block to free must start within the accumulator */
else {
+ haddr_t dirty_end = f->shared->accum.loc + f->shared->accum.dirty_off + f->shared->accum.dirty_len;
+ haddr_t dirty_start = f->shared->accum.loc + f->shared->accum.dirty_off;
+
/* Calculate the size of the overlap with the accumulator */
H5_ASSIGN_OVERFLOW(overlap_size, (f->shared->accum.loc + f->shared->accum.size) - addr, haddr_t, size_t);
- /* Block to free is in the middle of the accumulator */
- if(H5F_addr_lt((addr + size), f->shared->accum.loc + f->shared->accum.size)) {
+ /* Check if block to free begins before end of dirty region */
+ if(f->shared->accum.dirty && H5F_addr_lt(addr, dirty_end)) {
haddr_t tail_addr;
- size_t tail_size;
- /* Calculate the address & size of the tail to write */
+ /* Calculate the address of the tail to write */
tail_addr = addr + size;
- H5_ASSIGN_OVERFLOW(tail_size, (f->shared->accum.loc + f->shared->accum.size) - tail_addr, haddr_t, size_t);
- /* Write out the part of the accumulator after the block to free */
- if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_DEFAULT, tail_addr, tail_size, f->shared->accum.buf + (tail_addr - f->shared->accum.loc)) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
+ /* Check if the block to free begins before dirty region */
+ if(H5F_addr_lt(addr, dirty_start)) {
+ /* Check if block to free is entirely before dirty region */
+ if(H5F_addr_le(tail_addr, dirty_start)) {
+ /* Write out the entire dirty region of the accumulator */
+ if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_DEFAULT, dirty_start, f->shared->accum.dirty_len, f->shared->accum.buf + f->shared->accum.dirty_off) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
+ } /* end if */
+ /* Block to free overlaps with some/all of dirty region */
+ else {
+ size_t write_size;
+
+ write_size = (size_t)(dirty_end - tail_addr);
+
+ /* Check for unfreed dirty region to write */
+ if(write_size > 0) {
+ size_t dirty_delta;
+
+ dirty_delta = f->shared->accum.dirty_len - write_size;
+
+ /* Write out the unfreed dirty region of the accumulator */
+ if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_DEFAULT, dirty_start + dirty_delta, write_size, f->shared->accum.buf + f->shared->accum.dirty_off + dirty_delta) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
+ } /* end if */
+ } /* end else */
+
+ /* Reset dirty flag */
+ f->shared->accum.dirty = FALSE;
+ } /* end if */
+ /* Block to free begins at beginning of or in middle of dirty region */
+ else {
+ /* Check if block to free ends before end of dirty region */
+ if(H5F_addr_lt(tail_addr, dirty_end)) {
+ size_t write_size;
+
+ write_size = (size_t)(dirty_end - tail_addr);
+
+ /* Check for unfreed dirty region to write */
+ if(write_size > 0) {
+ size_t dirty_delta;
+
+ dirty_delta = f->shared->accum.dirty_len - write_size;
+
+ /* Write out the unfreed end of the dirty region of the accumulator */
+ if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_DEFAULT, dirty_start + dirty_delta, write_size, f->shared->accum.buf + f->shared->accum.dirty_off + dirty_delta) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
+ } /* end if */
+ } /* end if */
+
+ /* Check for block to free beginning at same location as dirty region */
+ if(H5F_addr_eq(addr, dirty_start)) {
+ /* Reset dirty flag */
+ f->shared->accum.dirty = FALSE;
+ } /* end if */
+ /* Block to free eliminates end of dirty region */
+ else {
+ f->shared->accum.dirty_len = (addr - dirty_start);
+ } /* end else */
+ } /* end else */
+
} /* end if */
/* Adjust the accumulator information */
@@ -665,9 +862,9 @@ H5F_accum_flush(H5F_t *f, hid_t dxpl_id)
HDassert(f->shared);
/* Check if we need to flush out the metadata accumulator */
- if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && f->shared->accum.dirty && f->shared->accum.size > 0) {
+ if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && f->shared->accum.dirty) {
/* Flush the metadata contents */
- if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_DEFAULT, f->shared->accum.loc, f->shared->accum.size, f->shared->accum.buf) < 0)
+ if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_DEFAULT, f->shared->accum.loc + f->shared->accum.dirty_off, f->shared->accum.dirty_len, f->shared->accum.buf + f->shared->accum.dirty_off) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
/* Reset the dirty flag */
@@ -719,6 +916,7 @@ H5F_accum_reset(H5F_t *f, hid_t dxpl_id)
f->shared->accum.alloc_size = f->shared->accum.size = 0;
f->shared->accum.loc = HADDR_UNDEF;
f->shared->accum.dirty = FALSE;
+ f->shared->accum.dirty_len = 0;
} /* end if */
done:
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 3fff3de..0d30e53 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -142,6 +142,8 @@ typedef struct H5F_meta_accum_t {
haddr_t loc; /* File location (offset) of the accumulated metadata */
size_t size; /* Size of the accumulated metadata buffer used (in bytes) */
size_t alloc_size; /* Size of the accumulated metadata buffer allocated (in bytes) */
+ size_t dirty_off; /* Offset of the dirty region in the accumulator buffer */
+ size_t dirty_len; /* Length of the dirty region in the accumulator buffer */
hbool_t dirty; /* Flag to indicate that the accumulated metadata is dirty */
} H5F_meta_accum_t;
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index fd8c692..a259dde 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -189,12 +189,27 @@ H5F_super_ext_create(H5F_t *f, hid_t dxpl_id, H5O_loc_t *ext_ptr)
HDassert(!H5F_addr_defined(f->shared->sblock->ext_addr));
HDassert(ext_ptr);
- H5O_loc_reset(ext_ptr);
- if(H5O_create(f, dxpl_id, 0, H5P_GROUP_CREATE_DEFAULT, ext_ptr) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create superblock extension")
+ /* Check for older version of superblock format that can't support superblock extensions */
+ if(f->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "superblock extension not permitted with version %u of superblock", f->shared->sblock->super_vers)
+ else if(H5F_addr_defined(f->shared->sblock->ext_addr))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "superblock extension already exists?!?!")
+ else {
+ /* The superblock extension isn't actually a group, but the
+ * default group creation list should work fine.
+ * If we don't supply a size for the object header, HDF5 will
+ * allocate H5O_MIN_SIZE by default. This is currently
+ * big enough to hold the biggest possible extension, but should
+ * be tuned if more information is added to the superblock
+ * extension.
+ */
+ H5O_loc_reset(ext_ptr);
+ if(H5O_create(f, dxpl_id, 0, H5P_GROUP_CREATE_DEFAULT, ext_ptr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create superblock extension")
- /* Record the address of the superblock extension */
- f->shared->sblock->ext_addr = ext_ptr->addr;
+ /* Record the address of the superblock extension */
+ f->shared->sblock->ext_addr = ext_ptr->addr;
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -487,7 +502,7 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to set EOA value for superblock")
/* Insert superblock into cache, pinned */
- if(H5AC_set(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, sblock, H5AC__PIN_ENTRY_FLAG) < 0)
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, sblock, H5AC__PIN_ENTRY_FLAG) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "can't add superblock to cache")
sblock_in_cache = TRUE;
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index e9e124f..6629934 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -1142,7 +1142,7 @@ H5G_obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id)
htri_t linfo_exists; /* Whether the link info message exists */
H5G_obj_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5G_obj_get_type_by_idx, H5G_UNKNOWN)
+ FUNC_ENTER_NOAPI_TAG(H5G_obj_get_type_by_idx, dxpl_id, oloc->addr, H5G_UNKNOWN)
/* Sanity check */
HDassert(oloc);
@@ -1169,7 +1169,7 @@ H5G_obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id)
} /* end else */
done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value, H5G_UNKNOWN)
} /* end H5G_obj_get_type_by_idx() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Gent.c b/src/H5Gent.c
index 69037d4..a2e6159 100644
--- a/src/H5Gent.c
+++ b/src/H5Gent.c
@@ -248,8 +248,8 @@ H5G_ent_encode(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent)
} /* end else */
/* fill with zero */
- while(*pp < p_ret)
- *(*pp)++ = 0;
+ if(*pp < p_ret)
+ HDmemset(*pp, 0, (p_ret - *pp));
*pp = p_ret;
done:
diff --git a/src/H5Gname.c b/src/H5Gname.c
index b298ccf..96b2e3a 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -426,49 +426,57 @@ H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_depth_t depth)
*-------------------------------------------------------------------------
*/
ssize_t
-H5G_get_name(hid_t id, char *name/*out*/, size_t size, hid_t lapl_id,
- hid_t dxpl_id)
+H5G_get_name(const H5G_loc_t *loc, char *name/*out*/, size_t size,
+ hbool_t *cached, hid_t lapl_id, hid_t dxpl_id)
{
- H5G_loc_t loc; /* Object location */
- ssize_t ret_value = FAIL;
+ ssize_t len = 0; /* Length of object's name */
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5G_get_name, FAIL)
- /* get object location */
- if(H5G_loc(id, &loc) >= 0) {
- ssize_t len = 0;
+ /* Sanity check */
+ HDassert(loc);
- /* If the user path is available and it's not "hidden", use it */
- if(loc.path->user_path_r != NULL && loc.path->obj_hidden == 0) {
- len = H5RS_len(loc.path->user_path_r);
+ /* If the user path is available and it's not "hidden", use it */
+ if(loc->path->user_path_r != NULL && loc->path->obj_hidden == 0) {
+ len = H5RS_len(loc->path->user_path_r);
- if(name) {
- HDstrncpy(name, H5RS_get_str(loc.path->user_path_r), MIN((size_t)(len + 1), size));
- if((size_t)len >= size)
- name[size - 1] = '\0';
- } /* end if */
+ if(name) {
+ HDstrncpy(name, H5RS_get_str(loc->path->user_path_r), MIN((size_t)(len + 1), size));
+ if((size_t)len >= size)
+ name[size - 1] = '\0';
} /* end if */
- else if(!loc.path->obj_hidden) {
- hid_t file;
- /* Retrieve file ID for name search */
- if((file = H5I_get_file_id(id, FALSE)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve file ID")
+ /* Indicate that the name is cached, if requested */
+ /* (Currently only used for testing - QAK, 2010/07/26) */
+ if(cached)
+ *cached = TRUE;
+ } /* end if */
+ else if(!loc->path->obj_hidden) {
+ hid_t file;
- /* Search for name of object */
- if((len = H5G_get_name_by_addr(file, lapl_id, dxpl_id, loc.oloc, name, size)) < 0) {
- H5I_dec_ref(file, FALSE);
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't determine name")
- } /* end if */
+ /* Retrieve file ID for name search */
+ if((file = H5F_get_id(loc->oloc->file, FALSE)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get file ID")
- /* Close file ID used for search */
- if(H5I_dec_ref(file, FALSE) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCLOSEFILE, FAIL, "can't determine name")
- } /* end else */
+ /* Search for name of object */
+ if((len = H5G_get_name_by_addr(file, lapl_id, dxpl_id, loc->oloc, name, size)) < 0) {
+ H5I_dec_ref(file, FALSE);
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't determine name")
+ } /* end if */
- /* Set return value */
- ret_value = len;
- } /* end if */
+ /* Close file ID used for search */
+ if(H5I_dec_ref(file, FALSE) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCLOSEFILE, FAIL, "can't determine name")
+
+ /* Indicate that the name is _not_ cached, if requested */
+ /* (Currently only used for testing - QAK, 2010/07/26) */
+ if(cached)
+ *cached = FALSE;
+ } /* end else */
+
+ /* Set return value */
+ ret_value = len;
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index ef38380..2b793a9 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -313,7 +313,7 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key,
if(NULL == (sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f)))))
HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, FAIL, "memory allocation failed")
- if(H5AC_set(f, dxpl_id, H5AC_SNODE, *addr_p, sym, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_SNODE, *addr_p, sym, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to cache symbol table leaf node")
/*
* The left and right symbols in an empty tree are both the
@@ -778,7 +778,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
/* "Normal" removal of a single entry from the symbol table node */
if(udata->common.name != NULL) {
H5O_link_t lnk; /* Constructed link for replacement */
- size_t len; /* Length of string in local heap */
+ size_t link_name_len; /* Length of string in local heap */
const char *base; /* Base of heap */
/* Get base address of heap */
@@ -804,6 +804,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
/* Get a pointer to the name of the link */
if(NULL == (lnk.name = (char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)))
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get link name")
+ link_name_len = HDstrlen(lnk.name) + 1;
/* Set up rest of link structure */
lnk.corder_valid = FALSE;
@@ -837,15 +838,16 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
else {
/* Remove the soft link's value from the local heap */
if(lnk.u.soft.name) {
- len = HDstrlen(lnk.u.soft.name) + 1;
- if(H5HL_remove(f, dxpl_id, udata->common.heap, sn->entry[idx].cache.slink.lval_offset, len) < 0)
+ size_t soft_link_len; /* Length of string in local heap */
+
+ soft_link_len = HDstrlen(lnk.u.soft.name) + 1;
+ if(H5HL_remove(f, dxpl_id, udata->common.heap, sn->entry[idx].cache.slink.lval_offset, soft_link_len) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, H5B_INS_ERROR, "unable to remove soft link from local heap")
} /* end if */
} /* end else */
/* Remove the link's name from the local heap */
- len = HDstrlen(lnk.name) + 1;
- if(H5HL_remove(f, dxpl_id, udata->common.heap, sn->entry[idx].name_off, len) < 0)
+ if(H5HL_remove(f, dxpl_id, udata->common.heap, sn->entry[idx].name_off, link_name_len) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, H5B_INS_ERROR, "unable to remove link name from local heap")
/* Remove the entry from the symbol table node */
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index 3e66777..7b09423 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -196,8 +196,8 @@ H5_DLL herr_t H5G_name_replace(const struct H5O_link_t *lnk, H5G_names_op_t op,
H5_DLL herr_t H5G_name_reset(H5G_name_t *name);
H5_DLL herr_t H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_depth_t depth);
H5_DLL herr_t H5G_name_free(H5G_name_t *name);
-H5_DLL ssize_t H5G_get_name(hid_t id, char *name/*out*/, size_t size,
- hid_t lapl_id, hid_t dxpl_id);
+H5_DLL ssize_t H5G_get_name(const H5G_loc_t *loc, char *name/*out*/, size_t size,
+ hbool_t *cached, hid_t lapl_id, hid_t dxpl_id);
H5_DLL ssize_t H5G_get_name_by_addr(hid_t fid, hid_t lapl_id, hid_t dxpl_id,
const struct H5O_loc_t *loc, char* name, size_t size);
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c
index 5b1f71c..742e2bc 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -171,8 +171,7 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk,
H5G_loc_t grp_loc_copy;
H5G_name_t grp_path_copy;
H5O_loc_t grp_oloc_copy;
- H5O_loc_t *new_oloc = NULL;
- H5F_t *temp_file = NULL;
+ H5G_loc_t new_loc; /* Group location for newly opened external object */
H5G_t *grp;
hid_t lapl_id = (-1); /* LAPL local to this routine */
H5P_genplist_t *lapl; /* LAPL with nlinks set */
@@ -189,13 +188,9 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk,
HDassert(nlinks);
HDassert(_lapl_id >= 0);
- /* Reset the object's path information, because we can't detect any changes
- * in the "path" the user-defined callback takes */
- H5G_name_free(obj_loc->path);
-
/* Get the link class for this type of link. */
if(NULL == (link_class = H5L_find_class(lnk->type)))
- HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to get UD link class")
+ HGOTO_ERROR(H5E_SYM, H5E_NOTREGISTERED, FAIL, "unable to get UD link class")
/* Set up location for user-defined callback. Use a copy of our current
* grp_loc. */
@@ -203,37 +198,37 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk,
grp_loc_copy.oloc = &grp_oloc_copy;
H5G_loc_reset(&grp_loc_copy);
if(H5G_loc_copy(&grp_loc_copy, grp_loc, H5_COPY_DEEP) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "unable to copy object location")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "unable to copy object location")
- /* Create a group to pass to the user-defined callback */
- if((grp = H5G_open(&grp_loc_copy, dxpl_id)) == NULL)
+ /* Create a group ID to pass to the user-defined callback */
+ if(NULL == (grp = H5G_open(&grp_loc_copy, dxpl_id)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
if((cur_grp = H5I_register(H5I_GROUP, grp, FALSE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group")
/* Check for generic default property list and use link access default if so */
if(_lapl_id == H5P_DEFAULT) {
HDassert(H5P_LINK_ACCESS_DEFAULT != -1);
if(NULL == (lapl = (H5P_genplist_t *)H5I_object(H5P_LINK_ACCESS_DEFAULT)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "unable to get default property list")
+ HGOTO_ERROR(H5E_SYM, H5E_BADATOM, FAIL, "unable to get default property list")
} /* end if */
else {
/* Get the underlying property list passed in */
if(NULL == (lapl = (H5P_genplist_t *)H5I_object(_lapl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "unable to get property list from ID")
+ HGOTO_ERROR(H5E_SYM, H5E_BADATOM, FAIL, "unable to get property list from ID")
} /* end else */
/* Copy the property list passed in */
if((lapl_id = H5P_copy_plist(lapl, FALSE)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unable to copy property list")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "unable to copy property list")
/* Get the underlying property list copy */
if(NULL == (lapl = (H5P_genplist_t *)H5I_object(lapl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "unable to get property list from ID")
+ HGOTO_ERROR(H5E_SYM, H5E_BADATOM, FAIL, "unable to get property list from ID")
/* Record number of soft links left to traverse in the property list. */
if(H5P_set(lapl, H5L_ACS_NLINKS_NAME, nlinks) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set nlink info")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set nlink info")
/* User-defined callback function */
cb_return = (link_class->trav_func)(lnk->name, cur_grp, lnk->u.ud.udata, lnk->u.ud.size, lapl_id);
@@ -253,79 +248,45 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk,
} /* end if */
/* else, we really needed to open the object */
else
- HGOTO_ERROR(H5E_ARGS, H5E_BADATOM, FAIL, "traversal callback returned invalid ID")
+ HGOTO_ERROR(H5E_SYM, H5E_BADATOM, FAIL, "traversal callback returned invalid ID")
} /* end if */
- /* Get the oloc from the ID the user callback returned */
- switch(H5I_get_type(cb_return)) {
- case H5I_GROUP:
- if((new_oloc = H5G_oloc((H5G_t *)H5I_object(cb_return))) == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location from group ID")
- break;
-
- case H5I_DATASET:
- if((new_oloc = H5D_oloc((H5D_t *)H5I_object(cb_return))) ==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location from dataset ID")
- break;
-
- case H5I_DATATYPE:
- if((new_oloc = H5T_oloc((H5T_t *)H5I_object(cb_return))) ==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location from datatype ID")
- break;
-
- case H5I_FILE:
- if((temp_file = (H5F_t *)H5I_object(cb_return)) == NULL)
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "couldn't get file from ID")
- if((new_oloc = H5G_oloc(temp_file->shared->root_grp)) ==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get root group location from file ID")
- break;
-
- case H5I_UNINIT:
- case H5I_BADID:
- case H5I_DATASPACE:
- case H5I_ATTR:
- case H5I_REFERENCE:
- case H5I_VFL:
- case H5I_GENPROP_CLS:
- case H5I_GENPROP_LST:
- case H5I_ERROR_CLASS:
- case H5I_ERROR_MSG:
- case H5I_ERROR_STACK:
- case H5I_NTYPES:
- default:
- HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, FAIL, "not a valid location or object ID")
- } /* end switch */
-
- /* Copy the location the user returned to us */
- if(H5O_loc_copy(obj_loc->oloc, new_oloc, H5_COPY_DEEP) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "unable to copy object location")
+ /* Get the object location information from the ID the user callback returned */
+ if(H5G_loc(cb_return, &new_loc) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unable to get object location from ID")
+
+ /* Release any previous location information for the object */
+ H5G_loc_free(obj_loc);
+
+ /* Copy new object's location information */
+ H5G_loc_copy(obj_loc, &new_loc, H5_COPY_DEEP);
/* Hold the file open until we free this object header (otherwise the
* object location will be invalidated when the file closes).
*/
if(H5O_loc_hold_file(obj_loc->oloc) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to hold file open")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to hold file open")
/* We have a copy of the location and we're holding the file open.
* Close the open ID the user passed back.
*/
if(H5I_dec_ref(cb_return, FALSE) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom from UD callback")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close atom from UD callback")
cb_return = (-1);
done:
/* Close location given to callback. */
if(cur_grp > 0)
if(H5I_dec_ref(cur_grp, FALSE) < 0)
- HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom for current location")
+ HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close atom for current location")
if(ret_value < 0 && cb_return > 0)
if(H5I_dec_ref(cb_return, FALSE) < 0)
- HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom from UD callback")
+ HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close atom from UD callback")
/* Close the LAPL, if we copied one */
if(lapl_id > 0 && H5I_dec_ref(lapl_id, FALSE) < 0)
- HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close copied link access property list")
+ HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close copied link access property list")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_traverse_ud() */
@@ -573,7 +534,7 @@ H5G_traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
*/
if(grp_loc->oloc->holding_file && grp_loc->oloc->file == obj_loc->oloc->file)
if(H5O_loc_hold_file(obj_loc->oloc) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to hold file open")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to hold file open")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -845,7 +806,18 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
*/
if(grp_loc.oloc->holding_file)
if(H5O_loc_hold_file(obj_loc.oloc) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to hold file open")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to hold file open")
+
+ /* Reset any non-default object header messages */
+ if(ginfo != &def_ginfo)
+ if(H5O_msg_reset(H5O_GINFO_ID, ginfo) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset group info message")
+ if(linfo != &def_linfo)
+ if(H5O_msg_reset(H5O_LINFO_ID, linfo) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset link info message")
+ if(pline != &def_pline)
+ if(H5O_msg_reset(H5O_PLINE_ID, pline) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset I/O pipeline message")
} /* end if */
else
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "component not found")
@@ -896,7 +868,8 @@ done:
/* If there's valid information in the link, reset it */
if(link_valid)
- H5O_msg_reset(H5O_LINK_ID, &lnk);
+ if(H5O_msg_reset(H5O_LINK_ID, &lnk) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset link message")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_traverse_real() */
diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c
index b2b3077..5cd035a 100644
--- a/src/H5HFdblock.c
+++ b/src/H5HFdblock.c
@@ -182,7 +182,7 @@ HDmemset(dblock->blk, 0, dblock->size);
} /* end else */
/* Cache the new fractal heap direct block */
- if(H5AC_set(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add fractal heap direct block to cache")
/* Increase the allocated heap size */
diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c
index 67bb7b0..e678d74 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -500,7 +500,7 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for fractal heap header")
/* Cache the new fractal heap header */
- if(H5AC_set(f, dxpl_id, H5AC_FHEAP_HDR, hdr->heap_addr, hdr, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_FHEAP_HDR, hdr->heap_addr, hdr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, HADDR_UNDEF, "can't add fractal heap header to cache")
/* Set address of heap header to return */
diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c
index 7958075..6fbb0c2 100644
--- a/src/H5HFiblock.c
+++ b/src/H5HFiblock.c
@@ -1056,7 +1056,7 @@ H5HF_man_iblock_create(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_indirect_t *par_iblo
iblock->max_child = 0;
/* Cache the new indirect block */
- if(H5AC_set(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, *addr_p, iblock, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, *addr_p, iblock, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add fractal heap indirect block to cache")
done:
diff --git a/src/H5HFman.c b/src/H5HFman.c
index 0ec6f5f..b1fb322 100644
--- a/src/H5HFman.c
+++ b/src/H5HFman.c
@@ -107,7 +107,7 @@ herr_t
H5HF_man_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, const void *obj,
void *_id)
{
- H5HF_free_section_t *sec_node; /* Pointer to free space section */
+ H5HF_free_section_t *sec_node = NULL; /* Pointer to free space section */
H5HF_direct_t *dblock = NULL; /* Pointer to direct block to modify */
haddr_t dblock_addr = HADDR_UNDEF; /* Direct block address */
size_t dblock_size; /* Direct block size */
@@ -176,6 +176,7 @@ H5HF_man_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, const void *obj
/* Reduce (& possibly re-add) single section */
if(H5HF_sect_single_reduce(hdr, dxpl_id, sec_node, obj_size) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce single section node")
+ sec_node = NULL;
/* Encode the object in the block */
{
@@ -203,6 +204,11 @@ H5HF_man_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, const void *obj
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't adjust free space for heap")
done:
+ /* Release section node on error */
+ if(ret_value < 0)
+ if(sec_node && H5HF_sect_single_free((H5FS_section_info_t *)sec_node) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release section node")
+
/* Release the direct block (marked as dirty) */
if(dblock && H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__DIRTIED_FLAG) < 0)
HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block")
@@ -332,7 +338,7 @@ H5HF_man_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
blk_off = (size_t)(obj_off - dblock->block_off);
/* Check for object's offset in the direct block prefix information */
- if(blk_off < H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr))
+ if(blk_off < (size_t)H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr))
HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object located in prefix of direct block")
/* Check for object's length overrunning the end of the direct block */
@@ -553,7 +559,7 @@ H5HF_man_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id)
blk_off = (size_t)(obj_off - dblock_block_off);
/* Check for object's offset in the direct block prefix information */
- if(blk_off < H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr))
+ if(blk_off < (size_t)H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr))
HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object located in prefix of direct block")
/* Check for object's length overrunning the end of the direct block */
diff --git a/src/H5HFsection.c b/src/H5HFsection.c
index d763897..e41f46d 100644
--- a/src/H5HFsection.c
+++ b/src/H5HFsection.c
@@ -2335,7 +2335,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5HF_sect_indirect_row
+ * Function: H5HF_sect_indirect_for_row
*
* Purpose: Create the underlying indirect section for a new row section
*
@@ -2924,6 +2924,7 @@ H5HF_sect_indirect_reduce_row(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_
unsigned start_col; /* Start column in indirect block */
unsigned end_entry; /* Entry for last block covered */
unsigned end_row; /* End row in indirect block */
+ H5HF_free_section_t *peer_sect = NULL; /* Peer indirect section */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_indirect_reduce_row)
@@ -3053,7 +3054,6 @@ H5HF_sect_indirect_reduce_row(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_
} /* end if */
} /* end if */
else {
- H5HF_free_section_t *peer_sect; /* Peer indirect section */
H5HF_indirect_t *iblock; /* Pointer to indirect block for this section */
hsize_t iblock_off; /* Section's indirect block's offset in "heap space" */
unsigned peer_nentries; /* Number of entries in new peer indirect section */
@@ -3090,11 +3090,11 @@ H5HF_sect_indirect_reduce_row(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create indirect section")
/* Set up direct row & indirect entry information for peer section */
- peer_sect->u.indirect.dir_nrows = peer_dir_nrows;
- if(NULL == (peer_sect->u.indirect.dir_rows = (H5HF_free_section_t **)H5MM_malloc(sizeof(H5HF_free_section_t *) * peer_dir_nrows)))
- HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "allocation failed for row section pointer array")
peer_sect->u.indirect.indir_nents = 0;
peer_sect->u.indirect.indir_ents = NULL;
+ peer_sect->u.indirect.dir_nrows = peer_dir_nrows;
+ if(NULL == (peer_sect->u.indirect.dir_rows = (H5HF_free_section_t **)H5MM_malloc(sizeof(H5HF_free_section_t *) * peer_dir_nrows)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "allocation failed for row section pointer array")
/* Transfer row sections between current & peer sections */
HDmemcpy(&peer_sect->u.indirect.dir_rows[0],
@@ -3137,6 +3137,9 @@ H5HF_sect_indirect_reduce_row(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_
(sect->u.indirect.indir_nents + sect->u.indirect.dir_nrows));
HDassert(peer_sect->u.indirect.rc ==
(peer_sect->u.indirect.indir_nents + peer_sect->u.indirect.dir_nrows));
+
+ /* Reset the peer_sect variable, to indicate that it has been hooked into the data structures correctly and shouldn't be freed */
+ peer_sect = NULL;
} /* end else */
} /* end if */
else {
@@ -3150,6 +3153,16 @@ H5HF_sect_indirect_reduce_row(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_
} /* end else */
done:
+ /* Free allocated peer_sect. Note that this is necessary for all failures until peer_sect is linked
+ * into the main free space structures (via the direct blocks), and the reference count is updated. */
+ if(peer_sect) {
+ /* Sanity check - we should only be here if an error occurred */
+ HDassert(ret_value < 0);
+
+ if(H5HF_sect_indirect_free(peer_sect) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node")
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_sect_indirect_reduce_row() */
@@ -3178,6 +3191,7 @@ H5HF_sect_indirect_reduce(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *s
unsigned start_col; /* Start column in indirect block */
unsigned end_entry; /* Entry for last block covered */
unsigned end_row; /* End row in indirect block */
+ H5HF_free_section_t *peer_sect = NULL; /* Peer indirect section */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_indirect_reduce)
@@ -3264,7 +3278,6 @@ H5HF_sect_indirect_reduce(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *s
sect->u.indirect.indir_ents = (H5HF_free_section_t **)H5MM_xfree(sect->u.indirect.indir_ents);
} /* end if */
else {
- H5HF_free_section_t *peer_sect; /* Peer indirect section */
H5HF_indirect_t *iblock; /* Pointer to indirect block for this section */
hsize_t iblock_off; /* Section's indirect block's offset in "heap space" */
haddr_t peer_sect_addr; /* Address of new peer section in "heap space" */
@@ -3320,7 +3333,7 @@ H5HF_sect_indirect_reduce(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *s
peer_sect->u.indirect.dir_rows = NULL;
peer_sect->u.indirect.indir_nents = peer_nentries;
if(NULL == (peer_sect->u.indirect.indir_ents = (H5HF_free_section_t **)H5MM_malloc(sizeof(H5HF_free_section_t *) * peer_nentries)))
- HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "allocation failed for indirect section pointer array")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "allocation failed for indirect section pointer array")
/* Transfer child indirect sections between current & peer sections */
HDmemcpy(&peer_sect->u.indirect.indir_ents[0],
@@ -3336,10 +3349,6 @@ H5HF_sect_indirect_reduce(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *s
for(u = 0; u < peer_nentries; u++)
peer_sect->u.indirect.indir_ents[u]->u.indirect.parent = peer_sect;
- /* Make new "first row" in peer section */
- if(H5HF_sect_indirect_first(hdr, dxpl_id, peer_sect->u.indirect.indir_ents[0]) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't make new 'first row' for peer indirect section")
-
/* Adjust reference counts for current & peer sections */
peer_sect->u.indirect.rc = peer_nentries;
sect->u.indirect.rc -= peer_nentries;
@@ -3355,6 +3364,13 @@ H5HF_sect_indirect_reduce(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *s
(sect->u.indirect.indir_nents + sect->u.indirect.dir_nrows));
HDassert(peer_sect->u.indirect.rc ==
(peer_sect->u.indirect.indir_nents + peer_sect->u.indirect.dir_nrows));
+
+ /* Make new "first row" in peer section */
+ if(H5HF_sect_indirect_first(hdr, dxpl_id, peer_sect->u.indirect.indir_ents[0]) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't make new 'first row' for peer indirect section")
+
+ /* Reset the peer_sect variable, to indicate that it has been hooked into the data structures correctly and shouldn't be freed */
+ peer_sect = NULL;
} /* end else */
} /* end if */
else {
@@ -3373,6 +3389,16 @@ H5HF_sect_indirect_reduce(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *s
HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't decrement section's ref. count ")
done:
+ /* Free allocated peer_sect. Note that this is necessary for all failures until peer_sect is linked
+ * into the main free space structures (via the direct blocks), and the reference count is updated. */
+ if(peer_sect) {
+ /* Sanity check - we should only be here if an error occurred */
+ HDassert(ret_value < 0);
+
+ if(H5HF_sect_indirect_free(peer_sect) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node")
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_sect_indirect_reduce() */
diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c
index ce91bd1..f11b6c0 100644
--- a/src/H5HFtiny.c
+++ b/src/H5HFtiny.c
@@ -178,6 +178,9 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size);
*id++ = enc_obj_size & H5HF_TINY_MASK_EXT_2;
} /* end else */
HDmemcpy(id, obj, obj_size);
+#ifdef H5_CLEAR_MEMORY
+HDmemset(id + obj_size, 0, (hdr->id_len - (1 + hdr->tiny_len_extended + obj_size)));
+#endif /* H5_CLEAR_MEMORY */
/* Update statistics about heap */
hdr->tiny_size += obj_size;
diff --git a/src/H5HG.c b/src/H5HG.c
index 3082618..67dc58e 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -227,7 +227,7 @@ HDmemset(heap->chunk, 0, size);
} /* end else */
/* Add the heap to the cache */
- if(H5AC_set(f, dxpl_id, H5AC_GHEAP, addr, heap, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_GHEAP, addr, heap, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to cache global heap collection")
ret_value = addr;
diff --git a/src/H5HL.c b/src/H5HL.c
index 61c97e1..4665474 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -163,7 +163,7 @@ H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/)
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed")
/* Add to cache */
- if(H5AC_set(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to cache local heap prefix")
/* Set address to return */
@@ -270,7 +270,7 @@ H5HL_dblk_realloc(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t new_heap_size)
HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap prefix in cache")
/* Insert data block into cache (pinned) */
- if(H5AC_set(f, dxpl_id, H5AC_LHEAP_DBLK, new_addr, dblk, H5AC__PIN_ENTRY_FLAG) < 0)
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_LHEAP_DBLK, new_addr, dblk, H5AC__PIN_ENTRY_FLAG) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to cache local heap data block")
dblk = NULL;
diff --git a/src/H5HLcache.c b/src/H5HLcache.c
index 51d60f9..56d9919 100644
--- a/src/H5HLcache.c
+++ b/src/H5HLcache.c
@@ -440,10 +440,16 @@ H5HL_prefix_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
/* Check if the local heap is a single object in cache */
if(heap->single_cache_obj) {
- /* Set p to the start of the data block. This is necessary because
- * there may be a gap between the used portion of the prefix and the
- * data block due to alignment constraints. */
- p = buf + heap->prfx_size;
+ if((p - buf) < heap->prfx_size) {
+ size_t gap; /* Size of gap between prefix and data block */
+
+ /* Set p to the start of the data block. This is necessary because
+ * there may be a gap between the used portion of the prefix and the
+ * data block due to alignment constraints. */
+ gap = heap->prfx_size - (p - buf);
+ HDmemset(p, 0, gap);
+ p += gap;
+ } /* end if */
/* Serialize the free list into the heap data's image */
H5HL_fl_serialize(heap);
diff --git a/src/H5I.c b/src/H5I.c
index d6655e0..be3c9d6 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -896,7 +896,7 @@ H5I_register(H5I_type_t type, const void *object, hbool_t app_ref)
/* new ID to check for */
next_id = H5I_MAKE(type, type_ptr->nextid);
- hash_loc = H5I_LOC(type_ptr->nextid, type_ptr->hash_size);
+ hash_loc = (unsigned)H5I_LOC(type_ptr->nextid, type_ptr->hash_size);
curr_id = type_ptr->id_list[hash_loc];
if(curr_id == NULL)
break; /* Ha! this is not likely... */
@@ -1421,15 +1421,16 @@ H5I_dec_ref(hid_t id, hbool_t app_ref)
if(!type_ptr->free_func || (type_ptr->free_func)((void *)id_ptr->obj_ptr) >= 0) {
H5I_remove(id);
ret_value = 0;
- } else {
+ } /* end if */
+ else
ret_value = FAIL;
- }
- } else {
+ } /* end if */
+ else {
--(id_ptr->count);
- if (app_ref)
+ if(app_ref)
--(id_ptr->app_count);
HDassert(id_ptr->count >= id_ptr->app_count);
- ret_value = app_ref ? id_ptr->app_count : id_ptr->count;
+ ret_value = (int)(app_ref ? id_ptr->app_count : id_ptr->count);
}
done:
@@ -1525,7 +1526,7 @@ H5I_inc_ref(hid_t id, hbool_t app_ref)
++(id_ptr->app_count);
/* Set return value */
- ret_value = app_ref ? id_ptr->app_count : id_ptr->count;
+ ret_value = (int)(app_ref ? id_ptr->app_count : id_ptr->count);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1615,7 +1616,7 @@ H5I_get_ref(hid_t id, hbool_t app_ref)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID")
/* Set return value */
- ret_value = app_ref ? id_ptr->app_count : id_ptr->count;
+ ret_value = (int)(app_ref ? id_ptr->app_count : id_ptr->count);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1696,7 +1697,7 @@ H5I_inc_type_ref(H5I_type_t type)
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type")
/* Set return value */
- ret_value = ++(type_ptr->count);
+ ret_value = (int)(++(type_ptr->count));
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1797,7 +1798,7 @@ H5I_dec_type_ref(H5I_type_t type)
} /* end if */
else {
--(type_ptr->count);
- ret_value = type_ptr->count;
+ ret_value = (herr_t)type_ptr->count;
} /* end else */
done:
@@ -1879,7 +1880,7 @@ H5I_get_type_ref(H5I_type_t type)
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type")
/* Set return value */
- ret_value = type_ptr->count;
+ ret_value = (int)type_ptr->count;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2133,13 +2134,18 @@ done:
ssize_t
H5Iget_name(hid_t id, char *name/*out*/, size_t size)
{
+ H5G_loc_t loc; /* Object location */
ssize_t ret_value; /* Return value */
FUNC_ENTER_API(H5Iget_name, FAIL)
H5TRACE3("Zs", "ixz", id, name, size);
+ /* Get object location */
+ if(H5G_loc(id, &loc) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location")
+
/* Call internal group routine to retrieve object's name */
- if((ret_value = H5G_get_name(id, name, size, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0)
+ if((ret_value = H5G_get_name(&loc, name, size, NULL, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name")
done:
@@ -2187,7 +2193,6 @@ done:
* ID given an object ID.
*
* Return: Success: file ID
- *
* Failure: a negative value
*
* Programmer: Raymond Lu
@@ -2198,7 +2203,6 @@ done:
hid_t
H5I_get_file_id(hid_t obj_id, hbool_t app_ref)
{
- H5G_loc_t loc; /* Location of object */
H5I_type_t type; /* ID type */
hid_t ret_value; /* Return value */
@@ -2207,18 +2211,24 @@ H5I_get_file_id(hid_t obj_id, hbool_t app_ref)
/* Get object type */
type = H5I_TYPE(obj_id);
if(type == H5I_FILE) {
- ret_value = obj_id;
-
- /* Increment reference count on atom. */
- if(H5I_inc_ref(ret_value, app_ref) < 0)
+ /* Increment reference count on file ID */
+ if(H5I_inc_ref(obj_id, app_ref) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed")
- }
+
+ /* Set return value */
+ ret_value = obj_id;
+ } /* end if */
else if(type == H5I_DATATYPE || type == H5I_GROUP || type == H5I_DATASET || type == H5I_ATTR) {
+ H5G_loc_t loc; /* Location of object */
+
+ /* Get the object location information */
if(H5G_loc(obj_id, &loc) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get object location")
+
+ /* Get the file ID for the object */
if((ret_value = H5F_get_id(loc.oloc->file, app_ref)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get file ID")
- }
+ } /* end if */
else
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid object ID")
diff --git a/src/H5Ipkg.h b/src/H5Ipkg.h
index e86f134..f17a4b0 100644
--- a/src/H5Ipkg.h
+++ b/src/H5Ipkg.h
@@ -67,4 +67,10 @@
/* Package Private Prototypes */
/******************************/
+/* Testing functions */
+#ifdef H5I_TESTING
+H5_DLL ssize_t H5I_get_name_test(hid_t id, char *name/*out*/, size_t size,
+ hbool_t *cached);
+#endif /* H5I_TESTING */
+
#endif /*_H5Ipkg_H*/
diff --git a/src/H5Itest.c b/src/H5Itest.c
new file mode 100644
index 0000000..1c6892d
--- /dev/null
+++ b/src/H5Itest.c
@@ -0,0 +1,98 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* Programmer: Quincey Koziol <koziol@hdfgoup.org>
+ * Tuesday, July 27, 2010
+ *
+ * Purpose: ID testing functions.
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#define H5I_PACKAGE /*suppress error about including H5Ipkg */
+#define H5I_TESTING /*suppress warning about H5I testing funcs*/
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Ipkg.h" /* IDs */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_get_name_test
+ *
+ * Purpose: Testing version of H5Iget_name()
+ *
+ * Return: Success: The length of name.
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, July 27, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+ssize_t
+H5I_get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached)
+{
+ H5G_loc_t loc; /* Object location */
+ ssize_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5I_get_name_test, FAIL)
+
+ /* Get object location */
+ if(H5G_loc(id, &loc) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location")
+
+ /* Call internal group routine to retrieve object's name */
+ if((ret_value = H5G_get_name(&loc, name, size, cached, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_get_name_test() */
+
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index c5ae92f..d98a843 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -53,6 +53,9 @@ const H5L_class_t H5L_EXTERN_LINK_CLASS[1] = {{
/* Valid flags for external links */
#define H5L_EXT_FLAGS_ALL 0
+/* Size of local link name buffer for traversing external links */
+#define H5L_EXT_TRAVERSE_BUF_SIZE 256
+
/*--------------------------------------------------------------------------
NAME
@@ -205,7 +208,8 @@ H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group,
H5L_elink_cb_t cb_info; /* Callback info struct */
hid_t fapl_id = -1; /* File access property list for external link's file */
hid_t ext_obj = -1; /* ID for external link's object */
- char *temp_group_name = NULL;/* Temporary pointer to group name */
+ char *parent_group_name = NULL;/* Temporary pointer to group name */
+ char local_group_name[H5L_EXT_TRAVERSE_BUF_SIZE]; /* Local buffer to hold group name */
char *temp_file_name = NULL; /* Temporary pointer to file name */
char *actual_file_name = NULL; /* Parent file's actual name */
H5P_genplist_t *fa_plist; /* File access property list pointer */
@@ -264,41 +268,34 @@ H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group,
/* Make callback if it exists */
if(cb_info.func) {
const char *parent_file_name; /* Parent file name */
- const char *parent_group_name; /* Parent group name */
+ ssize_t group_name_len; /* Length of parent group name */
/* Get parent file name */
parent_file_name = H5F_OPEN_NAME(loc.oloc->file);
+ /* Query length of parent group name */
+ if((group_name_len = H5G_get_name(&loc, NULL, (size_t) 0, NULL, lapl_id, H5AC_ind_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve length of group name")
+
+ /* Account for null terminator */
+ group_name_len++;
+
+ /* Check if we need to allocate larger buffer */
+ if((size_t)group_name_len > sizeof(local_group_name)) {
+ if(NULL == (parent_group_name = (char *)H5MM_malloc((size_t)group_name_len)))
+ HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, FAIL, "can't allocate buffer to hold group name, group_name_len = %Zu", group_name_len)
+ } /* end if */
+ else
+ parent_group_name = local_group_name;
+
/* Get parent group name */
- if(loc.path->user_path_r != NULL && loc.path->obj_hidden == 0)
- /* Use user_path_r if possible */
- parent_group_name = H5RS_get_str(loc.path->user_path_r);
- else {
- /* Otherwise use H5G_get_name */
- ssize_t group_name_len; /* Length of parent group name */
-
- /* Get length of parent group name */
- if((group_name_len = H5G_get_name(cur_group, NULL, (size_t) 0, lapl_id, H5AC_ind_dxpl_id)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve length of group name")
-
- /* account for null terminator */
- group_name_len++;
-
- /* Copy parent group name */
- if(NULL == (temp_group_name = (char *)H5MM_malloc((size_t)group_name_len)))
- HGOTO_ERROR(H5E_LINK, H5E_NOSPACE, FAIL, "memory allocation failed")
- if(H5G_get_name(cur_group, temp_group_name, (size_t) group_name_len, lapl_id, H5AC_ind_dxpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve group name")
- parent_group_name = temp_group_name;
- } /* end else */
+ if(H5G_get_name(&loc, parent_group_name, (size_t) group_name_len, NULL, lapl_id, H5AC_ind_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve group name")
/* Make callback */
if((cb_info.func)(parent_file_name, parent_group_name, file_name, obj_name, &intent, fapl_id, cb_info.user_data) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "traversal operator failed")
- /* Free temp_group_name */
- temp_group_name = (char *)H5MM_xfree(temp_group_name);
-
/* Check access flags */
if((intent & H5F_ACC_TRUNC) || (intent & H5F_ACC_EXCL))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags")
@@ -460,8 +457,9 @@ done:
HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list")
if(ext_file && H5F_try_close(ext_file) < 0)
HDONE_ERROR(H5E_LINK, H5E_CANTCLOSEFILE, FAIL, "problem closing external file")
+ if(parent_group_name && parent_group_name != local_group_name)
+ parent_group_name = (char *)H5MM_xfree(parent_group_name);
full_name = (char *)H5MM_xfree(full_name);
- temp_group_name = (char *)H5MM_xfree(temp_group_name);
temp_file_name = (char *)H5MM_xfree(temp_file_name);
actual_file_name = (char *)H5MM_xfree(actual_file_name);
diff --git a/src/H5O.c b/src/H5O.c
index 876174a..1a0205d 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -1053,17 +1053,29 @@ H5Oclose(hid_t object_id)
H5TRACE1("e", "i", object_id);
/* Get the type of the object and close it in the correct way */
- switch(H5I_get_type(object_id))
- {
- case(H5I_GROUP):
- case(H5I_DATATYPE):
- case(H5I_DATASET):
+ switch(H5I_get_type(object_id)) {
+ case H5I_GROUP:
+ case H5I_DATATYPE:
+ case H5I_DATASET:
if(H5I_object(object_id) == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object")
if(H5I_dec_ref(object_id, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object")
break;
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_FILE:
+ case H5I_DATASPACE:
+ case H5I_ATTR:
+ case H5I_REFERENCE:
+ case H5I_VFL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_NTYPES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_CANTRELEASE, FAIL, "not a valid file object ID (dataset, group, or datatype)")
break;
@@ -1229,14 +1241,14 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, hid_t ocpl_id,
oh->mesg[0].dirty = TRUE;
oh->mesg[0].native = NULL;
oh->mesg[0].raw = oh->chunk[0].image + (H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh)) + H5O_SIZEOF_MSGHDR_OH(oh);
- oh->mesg[0].raw_size = size_hint - H5O_SIZEOF_MSGHDR_OH(oh);
+ oh->mesg[0].raw_size = size_hint - (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
oh->mesg[0].chunkno = 0;
/* Set metadata tag in dxpl_id */
H5_BEGIN_TAG(dxpl_id, oh_addr, FAIL);
/* Cache object header */
- if(H5AC_set(f, dxpl_id, H5AC_OHDR, oh_addr, oh, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_OHDR, oh_addr, oh, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header")
oh = NULL;
@@ -1486,7 +1498,7 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, hbool_t *deleted)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "link count would be negative")
/* Adjust the link count for the object header */
- oh->nlink += adjust;
+ oh->nlink = (unsigned)((int)oh->nlink + adjust);
/* Mark object header as dirty in cache */
if(H5AC_mark_entry_dirty(oh) < 0)
@@ -1518,7 +1530,7 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, hbool_t *deleted)
} /* end if */
/* Adjust the link count for the object header */
- oh->nlink += adjust;
+ oh->nlink = (unsigned)((int)oh->nlink + adjust);
/* Mark object header as dirty in cache */
if(H5AC_mark_entry_dirty(oh) < 0)
@@ -1675,6 +1687,7 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot)
* when the object header is actually loaded from the file.
*/
HDassert(udata.made_attempt == TRUE);
+ HDassert(cont_msg_info.msgs);
/* Construct the user data for protecting chunks */
chk_udata.decoding = TRUE;
@@ -1716,8 +1729,7 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot)
} /* end while */
/* Release any continuation messages built up */
- if(cont_msg_info.msgs)
- cont_msg_info.msgs = (H5O_cont_t *)H5FL_SEQ_FREE(H5O_cont_t, cont_msg_info.msgs);
+ cont_msg_info.msgs = (H5O_cont_t *)H5FL_SEQ_FREE(H5O_cont_t, cont_msg_info.msgs);
/* Pass back out some of the chunk's user data */
udata.common.merged_null_msgs = chk_udata.common.merged_null_msgs;
@@ -1991,7 +2003,7 @@ H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force)
break;
/* Create a new message, if necessary */
- if(idx == oh->nmesgs) {
+ if(idx == (int)oh->nmesgs) {
unsigned mesg_flags = 0; /* Flags for message in object header */
/* If we would have to create a new message, but we aren't 'forcing' it, get out now */
@@ -2427,23 +2439,35 @@ H5O_get_loc(hid_t object_id)
FUNC_ENTER_NOAPI_NOINIT(H5O_get_loc)
- switch(H5I_get_type(object_id))
- {
- case(H5I_GROUP):
+ switch(H5I_get_type(object_id)) {
+ case H5I_GROUP:
if(NULL == (ret_value = H5O_OBJ_GROUP->get_oloc(object_id)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from group ID")
break;
- case(H5I_DATASET):
+ case H5I_DATASET:
if(NULL == (ret_value = H5O_OBJ_DATASET->get_oloc(object_id)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from dataset ID")
break;
- case(H5I_DATATYPE):
+ case H5I_DATATYPE:
if(NULL == (ret_value = H5O_OBJ_DATATYPE->get_oloc(object_id)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from datatype ID")
break;
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_FILE:
+ case H5I_DATASPACE:
+ case H5I_ATTR:
+ case H5I_REFERENCE:
+ case H5I_VFL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_NTYPES:
default:
HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, NULL, "invalid object type")
} /* end switch */
@@ -2505,7 +2529,7 @@ H5O_loc_reset(H5O_loc_t *loc)
*-------------------------------------------------------------------------
*/
herr_t
-H5O_loc_copy(H5O_loc_t *dst, const H5O_loc_t *src, H5_copy_depth_t depth)
+H5O_loc_copy(H5O_loc_t *dst, H5O_loc_t *src, H5_copy_depth_t depth)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_loc_copy)
@@ -2525,8 +2549,7 @@ H5O_loc_copy(H5O_loc_t *dst, const H5O_loc_t *src, H5_copy_depth_t depth)
if(src->holding_file)
dst->file->nopen_objs++;
} else if(depth == H5_COPY_SHALLOW) {
- /* Discarding 'const' qualifier OK - QAK */
- H5O_loc_reset((H5O_loc_t *)src);
+ H5O_loc_reset(src);
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -2687,7 +2710,7 @@ H5O_get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr)
hdr->flags = oh->flags;
/* Iterate over all the messages, accumulating message size & type information */
- hdr->space.meta = H5O_SIZEOF_HDR(oh) + (H5O_SIZEOF_CHKHDR_OH(oh) * (oh->nchunks - 1));
+ hdr->space.meta = (hsize_t)H5O_SIZEOF_HDR(oh) + (hsize_t)(H5O_SIZEOF_CHKHDR_OH(oh) * (oh->nchunks - 1));
hdr->space.mesg = 0;
hdr->space.free = 0;
hdr->mesg.present = 0;
@@ -2697,11 +2720,11 @@ H5O_get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr)
/* Accumulate space usage information, based on the type of message */
if(H5O_NULL_ID == curr_msg->type->id)
- hdr->space.free += H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
+ hdr->space.free += (hsize_t)((size_t)H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size);
else if(H5O_CONT_ID == curr_msg->type->id)
- hdr->space.meta += H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
+ hdr->space.meta += (hsize_t)((size_t)H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size);
else {
- hdr->space.meta += H5O_SIZEOF_MSGHDR_OH(oh);
+ hdr->space.meta += (hsize_t)H5O_SIZEOF_MSGHDR_OH(oh);
hdr->space.mesg += curr_msg->raw_size;
} /* end else */
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index a06740c..aba88b4 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -186,7 +186,7 @@ if(chunkno > 0) {
null_msg = &(oh->mesg[oh->nmesgs++]);
null_msg->type = H5O_MSG_NULL;
null_msg->native = NULL;
- null_msg->raw_size = new_gap_size - H5O_SIZEOF_MSGHDR_OH(oh);
+ null_msg->raw_size = new_gap_size - (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
null_msg->raw = (oh->chunk[chunkno].image + oh->chunk[chunkno].size)
- (H5O_SIZEOF_CHKSUM_OH(oh) + null_msg->raw_size);
null_msg->chunkno = chunkno;
@@ -297,7 +297,7 @@ H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg,
}
else if(move_end == move_start && !null_before_gap) {
/* Slide null message up */
- HDmemmove(move_start - gap_size, move_start, mesg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh));
+ HDmemmove(move_start - gap_size, move_start, mesg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
/* Adjust start of null message */
mesg->raw -= gap_size;
@@ -371,7 +371,7 @@ H5O_alloc_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned null_idx,
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk")
} /* end if */
else {
- size_t new_mesg_size = new_size + H5O_SIZEOF_MSGHDR_OH(oh); /* Total size of newly allocated message */
+ size_t new_mesg_size = new_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh); /* Total size of newly allocated message */
H5O_mesg_t *null_msg; /* Pointer to new null message */
/* Check if we need to extend message table to hold the new null message */
@@ -553,7 +553,7 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno,
delta = aligned_size - oh->mesg[extend_msg].raw_size;
} /* end if */
else
- delta = (aligned_size + H5O_SIZEOF_MSGHDR_OH(oh)) - oh->chunk[chunkno].gap;
+ delta = (aligned_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh)) - oh->chunk[chunkno].gap;
delta = H5O_ALIGN_OH(oh, delta);
/* Check for changing the chunk #0 data size enough to need adjusting the flags */
@@ -626,7 +626,7 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno,
oh->mesg[extend_msg].raw = ((oh->chunk[chunkno].image + oh->chunk[chunkno].size)
- (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[chunkno].gap))
+ H5O_SIZEOF_MSGHDR_OH(oh);
- oh->mesg[extend_msg].raw_size = (delta + oh->chunk[chunkno].gap) - H5O_SIZEOF_MSGHDR_OH(oh);
+ oh->mesg[extend_msg].raw_size = (delta + oh->chunk[chunkno].gap) - (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
oh->mesg[extend_msg].chunkno = chunkno;
} /* end else */
@@ -817,7 +817,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size)
for(v = 0, tmp_msg = &oh->mesg[0]; v < oh->nmesgs; v++, tmp_msg++) {
if(tmp_msg->type->id == H5O_NULL_ID && (tmp_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh)) == end_msg) {
null_msgno = v;
- null_size = H5O_SIZEOF_MSGHDR_OH(oh) + tmp_msg->raw_size;
+ null_size = (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + tmp_msg->raw_size;
break;
} /* end if */
@@ -854,7 +854,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size)
/* Keep track of the total size of smaller messages in the last
* chunk, in case we need to move more than 1 message.
*/
- multi_size += curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh);
+ multi_size += curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
} /* end else */
} /* end for */
if(found_null >= 0 || found_attr.msgno >= 0 || found_other.msgno >= 0)
@@ -876,7 +876,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size)
found_other = found_attr;
HDassert(found_other.msgno >= 0);
- size += H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[found_other.msgno].raw_size;
+ size += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[found_other.msgno].raw_size;
} /* end if */
} /* end if */
else
@@ -887,7 +887,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size)
* for the message header. This must be at least some minimum and
* aligned propertly.
*/
- size = MAX(H5O_MIN_SIZE, size + H5O_SIZEOF_MSGHDR_OH(oh));
+ size = MAX(H5O_MIN_SIZE, size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
HDassert(size == H5O_ALIGN_OH(oh, size));
/*
@@ -961,16 +961,16 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size)
} /* end if */
else {
/* Copy the raw data */
- HDmemcpy(p, curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh),
- curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh));
+ HDmemcpy(p, curr_msg->raw - (size_t)H5O_SIZEOF_MSGHDR_OH(oh),
+ curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
/* Update the message info */
curr_msg->chunkno = chunkno;
curr_msg->raw = p + H5O_SIZEOF_MSGHDR_OH(oh);
/* Account for copied message in new chunk */
- p += H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
- size -= H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
+ p += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
+ size -= (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
} /* end else */
} /* end if */
@@ -984,8 +984,8 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size)
+ ((chunkno == 1) ? H5O_SIZEOF_HDR(oh) : H5O_SIZEOF_CHKHDR_OH(oh))
- H5O_SIZEOF_CHKSUM_OH(oh) + H5O_SIZEOF_MSGHDR_OH(oh);
null_msg->raw_size = oh->chunk[chunkno - 1].size
- - ((chunkno == 1) ? (size_t)H5O_SIZEOF_HDR(oh) : H5O_SIZEOF_CHKHDR_OH(oh))
- - H5O_SIZEOF_MSGHDR_OH(oh);
+ - ((chunkno == 1) ? (size_t)H5O_SIZEOF_HDR(oh) : (size_t)H5O_SIZEOF_CHKHDR_OH(oh))
+ - (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
null_msg->chunkno = chunkno - 1;
HDassert(null_msg->raw_size >= cont_size);
@@ -1017,15 +1017,15 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size)
/* Copy the message to move (& its prefix) to its new location */
HDmemcpy(p, oh->mesg[found_other.msgno].raw - H5O_SIZEOF_MSGHDR_OH(oh),
- oh->mesg[found_other.msgno].raw_size + H5O_SIZEOF_MSGHDR_OH(oh));
+ oh->mesg[found_other.msgno].raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
/* Switch moved message to point to new location */
oh->mesg[found_other.msgno].raw = p + H5O_SIZEOF_MSGHDR_OH(oh);
oh->mesg[found_other.msgno].chunkno = chunkno;
/* Account for copied message in new chunk */
- p += H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[found_other.msgno].raw_size;
- size -= H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[found_other.msgno].raw_size;
+ p += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[found_other.msgno].raw_size;
+ size -= (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[found_other.msgno].raw_size;
/* Add any available space after the message to move to the new null message */
if(found_other.gap_size > 0) {
@@ -1309,7 +1309,7 @@ H5O_move_cont(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned cont_u)
/* Find size of all non-null messages in the chunk pointed to by the continuation message */
if(curr_msg->type->id != H5O_NULL_ID) {
HDassert(curr_msg->type->id != H5O_CONT_ID);
- nonnull_size += curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh);
+ nonnull_size += curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
} /* end if */
} /* end if */
} /* end for */
@@ -1321,7 +1321,7 @@ H5O_move_cont(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned cont_u)
/* (Could count any null messages in the chunk w/the continuation
* message also, but that is pretty complex. -QAK)
*/
- if(nonnull_size && nonnull_size <= (gap_size + cont_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh))) {
+ if(nonnull_size && nonnull_size <= (gap_size + cont_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh))) {
uint8_t *move_start, *move_end; /* Pointers to area of messages to move */
unsigned cont_chunkno; /* Chunk number for continuation message */
@@ -1347,7 +1347,7 @@ H5O_move_cont(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned cont_u)
size_t move_size; /* Size of the message to be moved */
/* Compute size of message to move */
- move_size = curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh);
+ move_size = curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
/* Move message out of deleted chunk */
HDmemcpy(move_start, curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), move_size);
@@ -1368,7 +1368,7 @@ H5O_move_cont(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned cont_u)
gap_size += (size_t)(move_end - move_start);
if(gap_size >= (size_t)H5O_SIZEOF_MSGHDR_OH(oh)) {
/* Adjust size of null (was continuation) message */
- cont_msg->raw_size = gap_size - H5O_SIZEOF_MSGHDR_OH(oh);
+ cont_msg->raw_size = gap_size - (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
cont_msg->raw = move_start + H5O_SIZEOF_MSGHDR_OH(oh);
cont_msg->dirty = TRUE;
chk_dirtied = TRUE;
@@ -1442,6 +1442,10 @@ done:
static htri_t
H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
{
+ H5O_chunk_proxy_t *null_chk_proxy = NULL; /* Chunk that null message is in */
+ H5O_chunk_proxy_t *curr_chk_proxy = NULL; /* Chunk that message is in */
+ hbool_t null_chk_dirtied = FALSE; /* Flags for unprotecting null chunk */
+ hbool_t curr_chk_dirtied = FALSE; /* Flags for unprotecting curr chunk */
hbool_t packed_msg; /* Flag to indicate that messages were packed */
hbool_t did_packing = FALSE; /* Whether any messages were packed */
htri_t ret_value; /* Return value */
@@ -1482,15 +1486,13 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
/* Don't swap messages if the second message is also a null message */
/* (We'll merge them together later, in another routine) */
if(H5O_NULL_ID != nonnull_msg->type->id) {
- H5O_chunk_proxy_t *null_chk_proxy; /* Chunk that message is in */
-
/* Protect chunk */
if(NULL == (null_chk_proxy = H5O_chunk_protect(f, dxpl_id, oh, curr_msg->chunkno)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk")
/* Copy raw data for non-null message to new location */
HDmemmove(curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh),
- nonnull_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), nonnull_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh));
+ nonnull_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), nonnull_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
/* Adjust non-null message's offset in chunk */
nonnull_msg->raw = curr_msg->raw;
@@ -1506,6 +1508,7 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
/* Release chunk, marking it dirty */
if(H5O_chunk_unprotect(f, dxpl_id, null_chk_proxy, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk")
+ null_chk_proxy = NULL;
/* Set the flag to indicate that the null message
* was packed - if its not at the end its chunk,
@@ -1544,10 +1547,6 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
for(v = 0, null_msg = &oh->mesg[0]; v < oh->nmesgs; v++, null_msg++) {
if(H5O_NULL_ID == null_msg->type->id && curr_msg->chunkno > null_msg->chunkno
&& curr_msg->raw_size <= null_msg->raw_size) {
- H5O_chunk_proxy_t *null_chk_proxy; /* Chunk that null message is in */
- H5O_chunk_proxy_t *curr_chk_proxy; /* Chunk that message is in */
- unsigned null_chk_dirtied = FALSE; /* Flags for unprotecting null chunk */
- unsigned curr_chk_dirtied = FALSE; /* Flags for unprotecting curr chunk */
unsigned old_chunkno; /* Old message information */
uint8_t *old_raw;
@@ -1562,7 +1561,7 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk")
/* Copy raw data for non-null message to new chunk */
- HDmemcpy(null_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh));
+ HDmemcpy(null_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
/* Point non-null message at null message's space */
curr_msg->chunkno = null_msg->chunkno;
@@ -1583,6 +1582,8 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
/* Release current chunk, marking it dirty */
if(H5O_chunk_unprotect(f, dxpl_id, curr_chk_proxy, curr_chk_dirtied) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk")
+ curr_chk_proxy = NULL;
+ curr_chk_dirtied = FALSE;
/* Check for gap in null message's chunk */
if(oh->chunk[old_chunkno].gap > 0) {
@@ -1596,6 +1597,8 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
/* Release null chunk, marking it dirty */
if(H5O_chunk_unprotect(f, dxpl_id, null_chk_proxy, null_chk_dirtied) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk")
+ null_chk_proxy = NULL;
+ null_chk_dirtied = FALSE;
} /* end if */
else {
unsigned new_null_msg; /* Message index for new null message */
@@ -1620,8 +1623,8 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
} /* end if */
else {
/* Adjust null message's size & offset */
- null_msg->raw += curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh);
- null_msg->raw_size -= curr_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh);
+ null_msg->raw += curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
+ null_msg->raw_size -= curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
/* Mark null message dirty */
null_msg->dirty = TRUE;
@@ -1643,6 +1646,8 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
/* Release null message's chunk, marking it dirty */
if(H5O_chunk_unprotect(f, dxpl_id, null_chk_proxy, null_chk_dirtied) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk")
+ null_chk_proxy = NULL;
+ null_chk_dirtied = FALSE;
/* Initialize new null message to take over non-null message's location */
oh->mesg[new_null_msg].type = H5O_MSG_NULL;
@@ -1667,6 +1672,8 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
/* Release new null message's chunk, marking it dirty */
if(H5O_chunk_unprotect(f, dxpl_id, curr_chk_proxy, curr_chk_dirtied) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk")
+ curr_chk_proxy = NULL;
+ curr_chk_dirtied = FALSE;
} /* end else */
/* Indicate that we packed messages */
@@ -1697,6 +1704,11 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
ret_value = (htri_t)did_packing;
done:
+ if(null_chk_proxy && H5O_chunk_unprotect(f, dxpl_id, null_chk_proxy, null_chk_dirtied) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect null object header chunk")
+ if(curr_chk_proxy && H5O_chunk_unprotect(f, dxpl_id, curr_chk_proxy, curr_chk_dirtied) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect current object header chunk")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_move_msgs_forward() */
@@ -1757,7 +1769,7 @@ H5O_merge_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
if((curr_msg->raw + curr_msg->raw_size) == (curr_msg2->raw - H5O_SIZEOF_MSGHDR_OH(oh))) {
/* Extend first null message length to cover second null message */
adj_raw = 0;
- adj_raw_size = H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg2->raw_size;
+ adj_raw_size = (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg2->raw_size;
/* Message has been merged */
merged_msg = TRUE;
@@ -1765,8 +1777,8 @@ H5O_merge_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
/* Check for second message before first message */
else if((curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh)) == (curr_msg2->raw + curr_msg2->raw_size)) {
/* Adjust first message address and extend length to cover second message */
- adj_raw = -((ssize_t)(H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg2->raw_size));
- adj_raw_size = H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg2->raw_size;
+ adj_raw = -((ssize_t)((size_t)H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg2->raw_size));
+ adj_raw_size = (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg2->raw_size;
/* Message has been merged */
merged_msg = TRUE;
@@ -1877,7 +1889,7 @@ H5O_remove_empty_chunks(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
* its not the "base" chunk), delete that chunk from object header
*/
if(H5O_NULL_ID == null_msg->type->id && null_msg->chunkno > 0 &&
- (H5O_SIZEOF_MSGHDR_OH(oh) + null_msg->raw_size)
+ ((size_t)H5O_SIZEOF_MSGHDR_OH(oh) + null_msg->raw_size)
== (oh->chunk[null_msg->chunkno].size - H5O_SIZEOF_CHKHDR_OH(oh))) {
H5O_mesg_t *curr_msg; /* Pointer to current message to operate on */
unsigned null_msg_no; /* Message # for null message */
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index 9f0f189..f155c94 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -849,16 +849,19 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
if(NULL == (chk_proxy = H5O_chunk_protect(udata->f, udata->dxpl_id, oh, mesg->chunkno)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to load object header chunk")
- /* Allocate storage for the message's data, if necessary */
- if(NULL == ((H5A_t *)mesg->native)->shared->data)
- if(NULL == (((H5A_t *)mesg->native)->shared->data = H5FL_BLK_MALLOC(attr_buf, udata->attr->shared->data_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed")
-
- /* Copy the data into the header message */
- /* (Needs to occur before updating the shared message, or the hash
- * value on the old & new messages will be the same)
- */
- HDmemcpy(((H5A_t *)mesg->native)->shared->data, udata->attr->shared->data, udata->attr->shared->data_size);
+ /* Because the attribute structure is shared now. The only situation that requires
+ * copying the data is when the metadata cache evicts and reloads this attribute.
+ * The shared attribute structure will be different in that situation. SLU-2010/7/29 */
+ if(((H5A_t *)mesg->native)->shared != udata->attr->shared) {
+ /* Sanity check */
+ HDassert(((H5A_t *)mesg->native)->shared->data);
+ HDassert(udata->attr->shared->data);
+ HDassert(((H5A_t *)mesg->native)->shared->data != udata->attr->shared->data);
+
+ /* (Needs to occur before updating the shared message, or the hash
+ * value on the old & new messages will be the same) */
+ HDmemcpy(((H5A_t *)mesg->native)->shared->data, udata->attr->shared->data, udata->attr->shared->data_size);
+ } /* end if */
/* Mark the message as modified */
mesg->dirty = TRUE;
diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c
index 79c4442..42b391d 100644
--- a/src/H5Ochunk.c
+++ b/src/H5Ochunk.c
@@ -118,7 +118,7 @@ H5O_chunk_add(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "can't increment reference count on object header")
/* Insert the chunk proxy into the cache */
- if(H5AC_set(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header chunk")
chk_proxy = NULL;
@@ -148,8 +148,8 @@ done:
H5O_chunk_proxy_t *
H5O_chunk_protect(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
{
- H5O_chunk_proxy_t *chk_proxy; /* Proxy for protected chunk */
- H5O_chunk_proxy_t *ret_value; /* Return value */
+ H5O_chunk_proxy_t *chk_proxy = NULL; /* Proxy for protected chunk */
+ H5O_chunk_proxy_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_TAG(H5O_chunk_protect, dxpl_id, oh->cache_info.addr, NULL)
@@ -196,6 +196,11 @@ H5O_chunk_protect(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
ret_value = chk_proxy;
done:
+ /* Cleanup on error */
+ if(!ret_value)
+ if(0 == idx && chk_proxy)
+ chk_proxy = H5FL_FREE(H5O_chunk_proxy_t, chk_proxy);
+
FUNC_LEAVE_NOAPI_TAG(ret_value, NULL)
} /* end H5O_chunk_protect() */
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index 94f7d9a..7a10765 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -575,7 +575,15 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
addr_new = oh_dst->chunk[0].addr;
/* Create memory image for the new chunk */
- if(NULL == (oh_dst->chunk[0].image = H5FL_BLK_MALLOC(chunk_image, (size_t)dst_oh_size)))
+ /* Note: we use calloc() instead of malloc() here because older versions of
+ * some messages don't initialize "unused" bytes and because we want to
+ * write out the same version of the object header and older versions of
+ * object headers aligned messages. In both those situations, it's
+ * complex and error-prone to determine all the proper ways/places to
+ * clear to zero bytes, so we just set the buffer to zero's here.
+ * (QAK - 2010/08/17)
+ */
+ if(NULL == (oh_dst->chunk[0].image = H5FL_BLK_CALLOC(chunk_image, (size_t)dst_oh_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Set dest. chunk information */
@@ -731,7 +739,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
H5_BEGIN_TAG(dxpl_id, oloc_dst->addr, FAIL);
/* Insert destination object header in cache */
- if(H5AC_set(oloc_dst->file, dxpl_id, H5AC_OHDR, oloc_dst->addr, oh_dst, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(oloc_dst->file, dxpl_id, H5AC_OHDR, oloc_dst->addr, oh_dst, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header")
oh_dst = NULL;
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index fec695e..51694a3 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -1272,7 +1272,7 @@ H5O_dtype_size(const H5F_t *f, const void *_mesg)
/* (starting with version 3 of the datatype message, use the minimum # of bytes required) */
if(dt->shared->version >= H5O_DTYPE_VERSION_3)
ret_value += offset_nbytes; /*member offset*/
- if(dt->shared->version >= H5O_DTYPE_VERSION_2)
+ else if(dt->shared->version == H5O_DTYPE_VERSION_2)
ret_value += 4; /*member offset*/
else
ret_value += 4 + /*member offset*/
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 82227e6..debc169 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -797,6 +797,7 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */
H5O_layout_t *layout_src = (H5O_layout_t *) mesg_src;
H5O_layout_t *layout_dst = NULL;
+ hbool_t copied = FALSE; /* Whether the data was copied */
void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_layout_copy_file)
@@ -819,6 +820,7 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
/* copy compact raw data */
if(H5D_compact_copy(file_src, &layout_src->storage.u.compact, file_dst, &layout_dst->storage.u.compact, udata->src_dtype, cpy_info, dxpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage")
+ copied = TRUE;
} /* end if */
break;
@@ -827,7 +829,7 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
* layout message less than version 3 because versions 1 & 2 would
* truncate the dimension sizes to 32-bits of information. - QAK 5/26/04
*/
- if(layout_src->version < 3)
+ if(layout_src->version < H5O_LAYOUT_VERSION_3)
layout_dst->storage.u.contig.size = H5S_extent_nelem(udata->src_space_extent) *
H5T_get_size(udata->src_dtype);
@@ -835,6 +837,7 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
/* copy contiguous raw data */
if(H5D_contig_copy(file_src, &layout_src->storage.u.contig, file_dst, &layout_dst->storage.u.contig, udata->src_dtype, cpy_info, dxpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy contiguous storage")
+ copied = TRUE;
} /* end if */
break;
@@ -843,15 +846,13 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
/* Create chunked layout */
if(H5D_chunk_copy(file_src, &layout_src->storage.u.chunk, &layout_src->u.chunk, file_dst, &layout_dst->storage.u.chunk, udata->src_space_extent, udata->src_dtype, udata->common.src_pline, cpy_info, dxpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage")
+ copied = TRUE;
} /* end if */
break;
default:
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid layout class")
} /* end switch */
-
- /* Freed by copy routine */
- udata->src_dtype = NULL;
} /* end if */
else {
/* Dataset's raw data will be copied using the 'storage' message, reset storage her */
@@ -859,6 +860,10 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, NULL, "unable to free message resources")
} /* end else */
+ /* Check if copy routine was invoked (which frees the source datatype) */
+ if(copied)
+ udata->src_dtype = NULL;
+
/* Set return value */
ret_value = layout_dst;
diff --git a/src/H5Omtime.c b/src/H5Omtime.c
index e71fb50..731d833 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -96,7 +96,7 @@ const H5O_msg_class_t H5O_MSG_MTIME_NEW[1] = {{
#define H5O_MTIME_VERSION 1
/* Track whether tzset routine was called */
-static int ntzset=0;
+static hbool_t ntzset = FALSE;
/* Declare a free list to manage the time_t struct */
H5FL_DEFINE(time_t);
@@ -180,23 +180,22 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
struct tm tm;
void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5O_mtime_decode);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_mtime_decode)
/* check args */
- assert(f);
- assert(p);
+ HDassert(f);
+ HDassert(p);
/* Initialize time zone information */
- if (!ntzset) {
+ if(!ntzset) {
HDtzset();
- ntzset=1;
+ ntzset = TRUE;
} /* end if */
/* decode */
- for (i=0; i<14; i++) {
- if (!HDisdigit(p[i]))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message");
- }
+ for(i = 0; i < 14; i++)
+ if(!HDisdigit(p[i]))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message")
/*
* Convert YYYYMMDDhhmmss UTC to a time_t. This is a little problematic
@@ -213,8 +212,8 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
tm.tm_min = (p[10]-'0')*10 + (p[11]-'0');
tm.tm_sec = (p[12]-'0')*10 + (p[13]-'0');
tm.tm_isdst = -1; /*figure it out*/
- if ((time_t)-1==(the_time=HDmktime(&tm)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message");
+ if((time_t)-1 == (the_time = HDmktime(&tm)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message")
#if defined(H5_HAVE_TM_GMTOFF)
/* FreeBSD, OSF 4.0 */
@@ -230,8 +229,8 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
{
struct timezone tz;
- if (HDBSDgettimeofday(NULL, &tz)<0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information");
+ if(HDBSDgettimeofday(NULL, &tz) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information")
the_time -= tz.tz_minuteswest * 60 - (tm.tm_isdst ? 3600 : 0);
}
#elif defined(H5_HAVE_GETTIMEOFDAY) && defined(H5_HAVE_STRUCT_TIMEZONE) && defined(H5_GETTIMEOFDAY_GIVES_TZ)
@@ -239,8 +238,8 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
struct timezone tz;
struct timeval tv; /* Used as a placebo; some systems don't like NULL */
- if (HDgettimeofday(&tv, &tz) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information");
+ if(HDgettimeofday(&tv, &tz) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information")
the_time -= tz.tz_minuteswest * 60 - (tm.tm_isdst ? 3600 : 0);
}
@@ -254,20 +253,20 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
*/
/* Irix64 */
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information");
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information")
#endif
/* The return value */
- if (NULL==(mesg = H5FL_MALLOC(time_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ if(NULL == (mesg = H5FL_MALLOC(time_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
*mesg = the_time;
/* Set return value */
- ret_value=mesg;
+ ret_value = mesg;
done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_mtime_decode() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 4bef827..b062b95 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -787,7 +787,7 @@ H5_DLL herr_t H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, in
/* These functions operate on object locations */
H5_DLL herr_t H5O_loc_reset(H5O_loc_t *loc);
-H5_DLL herr_t H5O_loc_copy(H5O_loc_t *dst, const H5O_loc_t *src, H5_copy_depth_t depth);
+H5_DLL herr_t H5O_loc_copy(H5O_loc_t *dst, H5O_loc_t *src, H5_copy_depth_t depth);
H5_DLL herr_t H5O_loc_hold_file(H5O_loc_t *loc);
H5_DLL herr_t H5O_loc_free(H5O_loc_t *loc);
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index f4cac40..323bec9 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -246,15 +246,15 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg)
/* Version */
HDassert(sdim->version > 0);
HDassert(sdim->type != H5S_NULL || sdim->version >= H5O_SDSPACE_VERSION_2);
- *p++ = sdim->version;
+ *p++ = (uint8_t)sdim->version;
/* Rank */
- *p++ = sdim->rank;
+ *p++ = (uint8_t)sdim->rank;
/* Flags */
if(sdim->max)
flags |= H5S_VALID_MAX;
- *p++ = flags;
+ *p++ = (uint8_t)flags;
/* Dataspace type */
if(sdim->version > H5O_SDSPACE_VERSION_1)
@@ -319,7 +319,7 @@ H5O_sdspace_copy(const void *_mesg, void *_dest)
done:
if(NULL == ret_value)
- if(dest && NULL != _dest)
+ if(dest && NULL == _dest)
dest = H5FL_FREE(H5S_extent_t, dest);
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index 5bc2783..4055664 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -54,7 +54,7 @@
#define H5D_DEF_STORAGE_COMPACT_INIT {(hbool_t)FALSE, (size_t)0, NULL}
#define H5D_DEF_STORAGE_CONTIG_INIT {HADDR_UNDEF, (hsize_t)0}
#define H5D_DEF_STORAGE_CHUNK_INIT {H5D_CHUNK_IDX_BTREE, HADDR_UNDEF, H5D_COPS_BTREE, {{NULL}}}
-#define H5D_DEF_LAYOUT_CHUNK_INIT {H5D_CHUNK_IDX_BTREE, (uint8_t)0, (unsigned)1, {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, (unsigned)0, (uint32_t)0, (hsize_t)0, (hsize_t)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {{{(uint8_t)0}}}}
+#define H5D_DEF_LAYOUT_CHUNK_INIT {H5D_CHUNK_IDX_BTREE, (uint8_t)0, (unsigned)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, (unsigned)0, (uint32_t)0, (hsize_t)0, (hsize_t)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {{{(uint8_t)0}}}}
#ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER
#define H5D_DEF_STORAGE_COMPACT {H5D_COMPACT, { .compact = H5D_DEF_STORAGE_COMPACT_INIT }}
#define H5D_DEF_STORAGE_CONTIG {H5D_CONTIGUOUS, { .contig = H5D_DEF_STORAGE_CONTIG_INIT }}
@@ -976,6 +976,7 @@ H5Pset_chunk_opts(hid_t plist_id, unsigned options)
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5Pset_chunk_opts, FAIL)
+ H5TRACE2("e", "iIu", plist_id, options);
/* Check arguments */
if(options & ~(H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS))
@@ -1042,6 +1043,7 @@ H5Pget_chunk_opts(hid_t plist_id, unsigned *options)
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5Pget_chunk_opts, FAIL)
+ H5TRACE2("e", "i*Iu", plist_id, options);
#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER
/* If the compiler doesn't support C99 designated initializers, check if
diff --git a/src/H5SM.c b/src/H5SM.c
index 53d8b9f..a971fb0 100755
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -209,7 +209,7 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d
HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "file allocation failed for SOHM table")
/* Cache the new table */
- if(H5AC_set(f, dxpl_id, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, FAIL, "can't add SOHM table to cache")
/* Record the address of the master table in the file */
@@ -655,7 +655,7 @@ H5SM_create_list(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id)
HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list")
/* Put the list into the cache */
- if(H5AC_set(f, dxpl_id, H5AC_SOHM_LIST, addr, list, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_SOHM_LIST, addr, list, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, HADDR_UNDEF, "can't add SOHM list to cache")
/* Set return value */
@@ -1742,7 +1742,7 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
/* If this returns failure, it means that the message wasn't found.
* If it succeeds, a copy of the modified message will be returned.
*/
- if(H5B2_modify(bt2, dxpl_id, &key, H5SM_decr_ref, &message) <0)
+ if(H5B2_modify(bt2, dxpl_id, &key, H5SM_decr_ref, &message) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
/* Point to the message */
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index 4a9338b..1511fd0 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -605,7 +605,7 @@ H5SM_list_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_lis
if(H5SM_message_encode(p, &(list->messages[x]), &ctx) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTFLUSH, FAIL, "unable to write shared message to disk")
- p+=H5SM_SOHM_ENTRY_SIZE(f);
+ p += H5SM_SOHM_ENTRY_SIZE(f);
++mesgs_written;
} /* end if */
} /* end for */
@@ -614,6 +614,9 @@ H5SM_list_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_lis
/* Compute checksum on buffer */
computed_chksum = H5_checksum_metadata(buf, (size_t)(p - buf), 0);
UINT32ENCODE(p, computed_chksum);
+#ifdef H5_CLEAR_MEMORY
+HDmemset(p, 0, (list->header->list_size - (p - buf)));
+#endif /* H5_CLEAR_MEMORY */
/* Write the list to disk */
HDassert((size_t)(p - buf) <= list->header->list_size);
diff --git a/src/H5SMmessage.c b/src/H5SMmessage.c
index 32ded03..0d41a09 100644
--- a/src/H5SMmessage.c
+++ b/src/H5SMmessage.c
@@ -309,7 +309,7 @@ H5SM_message_encode(uint8_t *raw, const void *_nrecord, void *_ctx)
*raw++ = 0; /* reserved (possible flags byte) */
*raw++ = (uint8_t)message->msg_type_id;
UINT16ENCODE(raw, message->u.mesg_loc.index);
- H5F_addr_encode_len(ctx->sizeof_addr, &raw, message->u.mesg_loc.oh_addr);
+ H5F_addr_encode_len((size_t)ctx->sizeof_addr, &raw, message->u.mesg_loc.oh_addr);
} /* end else */
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -350,7 +350,7 @@ H5SM_message_decode(const uint8_t *raw, void *_nrecord, void *_ctx)
raw++; /* reserved */
message->msg_type_id = *raw++;
UINT16DECODE(raw, message->u.mesg_loc.index);
- H5F_addr_decode_len(ctx->sizeof_addr, &raw, &message->u.mesg_loc.oh_addr);
+ H5F_addr_decode_len((size_t)ctx->sizeof_addr, &raw, &message->u.mesg_loc.oh_addr);
} /* end else */
FUNC_LEAVE_NOAPI(SUCCEED)
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index df81275..628512f 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -327,7 +327,7 @@ H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
iter->u.hyp.diminfo[curr_dim].count = tdiminfo[i].count;
iter->u.hyp.diminfo[curr_dim].block = tdiminfo[i].block * acc;
iter->u.hyp.size[curr_dim] = mem_size[i] * acc;
- iter->u.hyp.sel_off[curr_dim] = space->select.offset[i] * acc;
+ iter->u.hyp.sel_off[curr_dim] = space->select.offset[i] * (hssize_t)acc;
/* Reset the "last dim flattened" flag to avoid flattened any further dimensions */
last_dim_flattened = 0;
@@ -1385,7 +1385,7 @@ H5S_hyper_copy_span(H5S_hyper_span_info_t *spans)
/* Copy the hyperslab span tree */
if(NULL == (ret_value = H5S_hyper_copy_span_helper(spans)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy hyperslab span tree")
/* Reset the scratch pointers for the next routine which needs them */
H5S_hyper_span_scratch(spans, NULL);
@@ -2662,10 +2662,10 @@ H5S_hyper_bounds_helper(const H5S_hyper_span_info_t *spans, const hssize_t *offs
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
/* Check if the current span extends the bounding box */
- if((curr->low + offset[rank]) < start[rank])
- start[rank] = curr->low + offset[rank];
- if((curr->high + offset[rank]) > end[rank])
- end[rank] = curr->high + offset[rank];
+ if((curr->low + (hsize_t)offset[rank]) < start[rank])
+ start[rank] = curr->low + (hsize_t)offset[rank];
+ if((curr->high + (hsize_t)offset[rank]) > end[rank])
+ end[rank] = curr->high + (hsize_t)offset[rank];
/* Recurse if this node has down spans */
if(curr->down != NULL) {
@@ -2711,43 +2711,43 @@ done:
herr_t
H5S_hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
{
- int rank; /* Dataspace rank */
- int i; /* index variable */
- herr_t ret_value=SUCCEED; /* Return value */
+ unsigned rank; /* Dataspace rank */
+ unsigned i; /* index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5S_hyper_bounds,FAIL)
+ FUNC_ENTER_NOAPI(H5S_hyper_bounds, FAIL)
- assert(space);
- assert(start);
- assert(end);
+ HDassert(space);
+ HDassert(start);
+ HDassert(end);
/* Set the start and end arrays up */
- rank=space->extent.rank;
- for(i=0; i<rank; i++) {
- start[i]=HSIZET_MAX;
- end[i]=0;
+ rank = space->extent.rank;
+ for(i = 0; i < rank; i++) {
+ start[i] = HSIZET_MAX;
+ end[i] = 0;
} /* end for */
/* Check for a "regular" hyperslab selection */
if(space->select.sel_info.hslab->diminfo_valid) {
- const H5S_hyper_dim_t *diminfo=space->select.sel_info.hslab->opt_diminfo; /* local alias for diminfo */
+ const H5S_hyper_dim_t *diminfo = space->select.sel_info.hslab->opt_diminfo; /* local alias for diminfo */
/* Check each dimension */
- for(i=0; i<rank; i++) {
+ for(i = 0; i < rank; i++) {
/* Check for offset moving selection negative */
- if((space->select.offset[i]+(hssize_t)diminfo[i].start)<0)
+ if((space->select.offset[i] + (hssize_t)diminfo[i].start) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
/* Compute the smallest location in this dimension */
- start[i]=diminfo[i].start+space->select.offset[i];
+ start[i] = diminfo[i].start + (hsize_t)space->select.offset[i];
/* Compute the largest location in this dimension */
- end[i]=diminfo[i].start+diminfo[i].stride*(diminfo[i].count-1)+(diminfo[i].block-1)+space->select.offset[i];
+ end[i] = diminfo[i].start + diminfo[i].stride * (diminfo[i].count - 1) + (diminfo[i].block - 1) + (hsize_t)space->select.offset[i];
} /* end for */
} /* end if */
else {
/* Call the recursive routine to get the bounds for the span tree */
- ret_value=H5S_hyper_bounds_helper(space->select.sel_info.hslab->span_lst,space->select.offset,(hsize_t)0,start,end);
+ ret_value = H5S_hyper_bounds_helper(space->select.sel_info.hslab->span_lst, space->select.offset, (hsize_t)0, start, end);
} /* end if */
done:
@@ -2781,7 +2781,7 @@ H5S_hyper_offset(const H5S_t *space, hsize_t *offset)
const hssize_t *sel_offset; /* Pointer to the selection's offset */
const hsize_t *dim_size; /* Pointer to a dataspace's extent */
hsize_t accum; /* Accumulator for dimension sizes */
- int rank; /* Dataspace rank */
+ unsigned rank; /* Dataspace rank */
int i; /* index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2804,7 +2804,7 @@ H5S_hyper_offset(const H5S_t *space, hsize_t *offset)
/* Loop through starting coordinates, calculating the linear offset */
accum = 1;
- for(i = (rank - 1); i >= 0; i--) {
+ for(i = (int)(rank - 1); i >= 0; i--) {
hssize_t hyp_offset = (hssize_t)diminfo[i].start + sel_offset[i]; /* Hyperslab's offset in this dimension */
/* Check for offset moving selection out of the dataspace */
@@ -2812,7 +2812,7 @@ H5S_hyper_offset(const H5S_t *space, hsize_t *offset)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
/* Add the hyperslab's offset in this dimension to the total linear offset */
- *offset += hyp_offset * accum;
+ *offset += (hsize_t)(hyp_offset * (hssize_t)accum);
/* Increase the accumulator */
accum *= dim_size[i];
@@ -2824,7 +2824,7 @@ H5S_hyper_offset(const H5S_t *space, hsize_t *offset)
/* Calculate the accumulator for each dimension */
accum = 1;
- for(i = (rank - 1); i >= 0; i--) {
+ for(i = (int)(rank - 1); i >= 0; i--) {
/* Set the accumulator for this dimension */
dim_accum[i] = accum;
@@ -2845,7 +2845,7 @@ H5S_hyper_offset(const H5S_t *space, hsize_t *offset)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
/* Add the hyperslab's offset in this dimension to the total linear offset */
- *offset += hyp_offset * dim_accum[i];
+ *offset += (hsize_t)(hyp_offset * (hssize_t)dim_accum[i]);
/* Advance to first span in "down" dimension */
if(span->down) {
@@ -4436,8 +4436,8 @@ H5S_hyper_adjust_helper_s(H5S_hyper_span_info_t *spans, const hssize_t *offset)
while(span != NULL) {
/* Adjust span offset */
HDassert((hssize_t)span->low >= *offset);
- span->low -= *offset;
- span->high -= *offset;
+ span->low = (hsize_t)((hssize_t)span->low - *offset);
+ span->high = (hsize_t)((hssize_t)span->high - *offset);
/* Recursively adjust spans in next dimension down */
if(span->down != NULL)
@@ -4474,146 +4474,37 @@ herr_t
H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset)
{
unsigned u; /* Local index variable */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_adjust_s);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_adjust_s)
- assert(space);
- assert(offset);
+ HDassert(space);
+ HDassert(offset);
/* Subtract the offset from the "regular" coordinates, if they exist */
if(space->select.sel_info.hslab->diminfo_valid) {
- for(u=0; u<space->extent.rank; u++) {
- assert((hssize_t)space->select.sel_info.hslab->opt_diminfo[u].start>=offset[u]);
- space->select.sel_info.hslab->opt_diminfo[u].start-=offset[u];
+ for(u = 0; u < space->extent.rank; u++) {
+ HDassert((hssize_t)space->select.sel_info.hslab->opt_diminfo[u].start >= offset[u]);
+ space->select.sel_info.hslab->opt_diminfo[u].start = (hsize_t)((hssize_t)space->select.sel_info.hslab->opt_diminfo[u].start - offset[u]);
} /* end for */
} /* end if */
/* Subtract the offset from the span tree coordinates, if they exist */
if(space->select.sel_info.hslab->span_lst) {
- if(H5S_hyper_adjust_helper_s(space->select.sel_info.hslab->span_lst,offset)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab offset adjustment");
+ if(H5S_hyper_adjust_helper_s(space->select.sel_info.hslab->span_lst, offset) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab offset adjustment")
/* Reset the scratch pointers for the next routine which needs them */
H5S_hyper_span_scratch(space->select.sel_info.hslab->span_lst, NULL);
} /* end if */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_adjust_s() */
/*--------------------------------------------------------------------------
NAME
- H5S_hyper_move_helper
- PURPOSE
- Helper routine to move offset in span trees
- USAGE
- herr_t H5S_hyper_move_helper(spans, offset)
- H5S_hyper_span_info_t *spans; IN: Span tree to operate with
- const hssize_t *offset; IN: Offset to move to
- RETURNS
- Non-negative on success, negative on failure
- DESCRIPTION
- Adjust the location of the spans in a span tree by moving selection to an
- offset.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5S_hyper_move_helper (H5S_hyper_span_info_t *spans, const hssize_t *offset)
-{
- H5S_hyper_span_t *span; /* Pointer to current span in span tree */
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_move_helper);
-
- /* Sanity check */
- assert(spans);
- assert(offset);
-
- /* Check if we've already set this down span tree */
- if(spans->scratch!=(H5S_hyper_span_info_t *)~((size_t)NULL)) {
- /* Set the tree's scratch pointer */
- spans->scratch=(H5S_hyper_span_info_t *)~((size_t)NULL);
-
- /* Get the span lists for each span in this tree */
- span=spans->head;
-
- /* Iterate over the spans in tree */
- while(span!=NULL) {
- /* Adjust span location */
- assert(*offset>=0);
- span->high=*offset+(span->high-span->low);
- span->low=*offset;
-
- /* Recursively move spans in next dimension down */
- if(span->down!=NULL)
- H5S_hyper_move_helper(span->down,offset+1);
-
- /* Advance to next span in this dimension */
- span=span->next;
- } /* end while */
- } /* end if */
-
- FUNC_LEAVE_NOAPI(SUCCEED);
-} /* H5S_hyper_move_helper() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5S_hyper_move
- PURPOSE
- Move a hyperslab selection by to an offset
- USAGE
- herr_t H5S_hyper_move(space,offset)
- H5S_t *space; IN/OUT: Pointer to dataspace to move
- const hssize_t *offset; IN: Offset to move to
- RETURNS
- Non-negative on success, negative on failure
- DESCRIPTION
- Moves a hyperslab selection to a new offset.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5S_hyper_move(H5S_t *space, const hssize_t *offset)
-{
- unsigned u; /* Local index variable */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_move);
-
- assert(space);
- assert(offset);
-
- /* Move to the offset with the "regular" coordinates, if they exist */
- if(space->select.sel_info.hslab->diminfo_valid) {
- for(u=0; u<space->extent.rank; u++) {
- assert(offset[u]>=0);
- space->select.sel_info.hslab->opt_diminfo[u].start=offset[u];
- } /* end for */
- } /* end if */
-
- /* Subtract the offset from the span tree coordinates, if they exist */
- if(space->select.sel_info.hslab->span_lst) {
- if(H5S_hyper_move_helper(space->select.sel_info.hslab->span_lst,offset)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab offset movement");
-
- /* Reset the scratch pointers for the next routine which needs them */
- H5S_hyper_span_scratch(space->select.sel_info.hslab->span_lst, NULL);
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
-} /* H5S_hyper_move() */
-
-
-/*--------------------------------------------------------------------------
- NAME
H5S_hyper_normalize_offset
PURPOSE
"Normalize" a hyperslab selection by adjusting it's coordinates by the
@@ -5774,10 +5665,9 @@ static H5S_hyper_span_info_t *
H5S_hyper_make_spans(unsigned rank, const hsize_t *start, const hsize_t *stride,
const hsize_t *count, const hsize_t *block)
{
- H5S_hyper_span_info_t *down; /* Pointer to spans in next dimension down */
- H5S_hyper_span_t *span; /* New hyperslab span */
+ H5S_hyper_span_info_t *down = NULL; /* Pointer to spans in next dimension down */
H5S_hyper_span_t *last_span; /* Current position in hyperslab span list */
- H5S_hyper_span_t *head; /* Head of new hyperslab span list */
+ H5S_hyper_span_t *head = NULL; /* Head of new hyperslab span list */
hsize_t stride_iter; /* Iterator over the stride values */
int i; /* Counters */
unsigned u; /* Counters */
@@ -5793,8 +5683,7 @@ H5S_hyper_make_spans(unsigned rank, const hsize_t *start, const hsize_t *stride,
HDassert(block);
/* Start creating spans in fastest changing dimension */
- down = NULL;
- for(i = (rank - 1); i >= 0; i--) {
+ for(i = (int)(rank - 1); i >= 0; i--) {
/* Sanity check */
if(0 == count[i])
@@ -5806,6 +5695,8 @@ H5S_hyper_make_spans(unsigned rank, const hsize_t *start, const hsize_t *stride,
/* Generate all the span segments for this dimension */
for(u = 0, stride_iter = 0; u < count[i]; u++, stride_iter += stride[i]) {
+ H5S_hyper_span_t *span; /* New hyperslab span */
+
/* Allocate a span node */
if(NULL == (span = H5FL_MALLOC(H5S_hyper_span_t)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span")
@@ -5918,7 +5809,7 @@ H5S_hyper_rebuild_helper(const H5S_hyper_span_t *span, H5S_hyper_dim_t span_slab
hsize_t curr_block, next_block;
hsize_t curr_start;
hsize_t curr_low;
- int outcount;
+ size_t outcount;
unsigned u;
H5S_hyper_dim_t canon_down_span_slab_info[H5S_MAX_RANK];
hbool_t ret_value = TRUE;
@@ -6318,6 +6209,11 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
} /* end if */
break;
+ case H5S_SELECT_NOOP:
+ case H5S_SELECT_SET:
+ case H5S_SELECT_APPEND:
+ case H5S_SELECT_PREPEND:
+ case H5S_SELECT_INVALID:
default:
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
} /* end switch */
@@ -6444,6 +6340,10 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
case H5S_SELECT_NOTB: /* Binary "A not B" operation for hyperslabs */
HGOTO_DONE(SUCCEED); /* Selection stays same */
+ case H5S_SELECT_NOOP:
+ case H5S_SELECT_APPEND:
+ case H5S_SELECT_PREPEND:
+ case H5S_SELECT_INVALID:
default:
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
} /* end switch */
@@ -6503,6 +6403,10 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
case H5S_SELECT_NOTB: /* Binary "A not B" operation for hyperslabs */
HGOTO_DONE(SUCCEED); /* Selection stays "none" */
+ case H5S_SELECT_NOOP:
+ case H5S_SELECT_APPEND:
+ case H5S_SELECT_PREPEND:
+ case H5S_SELECT_INVALID:
default:
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
} /* end switch */
@@ -6551,6 +6455,10 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection");
HGOTO_DONE(SUCCEED);
+ case H5S_SELECT_NOOP:
+ case H5S_SELECT_APPEND:
+ case H5S_SELECT_PREPEND:
+ case H5S_SELECT_INVALID:
default:
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
} /* end switch */
@@ -6565,6 +6473,8 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
break;
/* Else fall through to error */
+ case H5S_SEL_ERROR:
+ case H5S_SEL_N:
default:
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
} /* end switch */
@@ -7642,63 +7552,64 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
H5S_hyper_span_t *curr_span; /* Current hyperslab span node */
H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */
hsize_t slab[H5O_LAYOUT_NDIMS]; /* Cumulative size of each dimension in bytes */
- hsize_t acc; /* Accumulator for computing cumulative sizes */
- hsize_t loc_off; /* Element offset in the dataspace */
- hsize_t last_span_end=0; /* The offset of the end of the last span */
+ hsize_t acc; /* Accumulator for computing cumulative sizes */
+ hsize_t loc_off; /* Element offset in the dataspace */
+ hsize_t last_span_end = 0; /* The offset of the end of the last span */
hsize_t *abs_arr; /* Absolute hyperslab span position */
const hssize_t *off_arr; /* Offset within the dataspace extent */
- size_t span_size=0; /* Number of bytes in current span to actually process */
- size_t io_left; /* Number of elements left to process */
+ size_t span_size = 0; /* Number of bytes in current span to actually process */
+ size_t io_left; /* Number of elements left to process */
size_t io_bytes_left; /* Number of bytes left to process */
- size_t io_used; /* Number of elements processed */
- size_t curr_seq=0; /* Number of sequence/offsets stored in the arrays */
- size_t elem_size; /* Size of each element iterating over */
- int ndims; /* Number of dimensions of dataset */
- int fast_dim; /* Rank of the fastest changing dimension for the dataspace */
+ size_t io_used; /* Number of elements processed */
+ size_t curr_seq = 0; /* Number of sequence/offsets stored in the arrays */
+ size_t elem_size; /* Size of each element iterating over */
+ unsigned ndims; /* Number of dimensions of dataset */
+ unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
int curr_dim; /* Current dimension being operated on */
+ unsigned u; /* Index variable */
int i; /* Index variable */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_get_seq_list_gen);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_get_seq_list_gen)
/* Check args */
- assert(space);
- assert(iter);
- assert(maxseq>0);
- assert(maxelem>0);
- assert(nseq);
- assert(nelem);
- assert(off);
- assert(len);
+ HDassert(space);
+ HDassert(iter);
+ HDassert(maxseq > 0);
+ HDassert(maxelem > 0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
/* Set the rank of the fastest changing dimension */
- ndims=space->extent.rank;
- fast_dim=(ndims-1);
+ ndims = space->extent.rank;
+ fast_dim = (ndims - 1);
/* Get the pointers to the current span info and span nodes */
- curr_span=iter->u.hyp.span[fast_dim];
- abs_arr=iter->u.hyp.off;
- off_arr=space->select.offset;
- ispan=iter->u.hyp.span;
- elem_size=iter->elmt_size;
+ curr_span = iter->u.hyp.span[fast_dim];
+ abs_arr = iter->u.hyp.off;
+ off_arr = space->select.offset;
+ ispan = iter->u.hyp.span;
+ elem_size = iter->elmt_size;
/* Set the amount of elements to perform I/O on, etc. */
- H5_CHECK_OVERFLOW(iter->elmt_left,hsize_t,size_t);
- io_left=MIN(maxelem,(size_t)iter->elmt_left);
- io_bytes_left=io_left*elem_size;
+ H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
+ io_left = MIN(maxelem, (size_t)iter->elmt_left);
+ io_bytes_left = io_left * elem_size;
/* Compute the cumulative size of dataspace dimensions */
- for(i=fast_dim, acc=elem_size; i>=0; i--) {
- slab[i]=acc;
- acc*=space->extent.size[i];
+ for(i = (int)fast_dim, acc = elem_size; i >= 0; i--) {
+ slab[i] = acc;
+ acc *= space->extent.size[i];
} /* end for */
/* Set the offset of the first element iterated on */
- for(i=0, loc_off=0; i<ndims; i++)
+ for(u = 0, loc_off = 0; u < ndims; u++)
/* Compute the sequential element offset */
- loc_off+=(abs_arr[i]+off_arr[i])*slab[i];
+ loc_off += ((hsize_t)((hssize_t)abs_arr[u] + off_arr[u])) * slab[u];
/* Range check against number of elements left in selection */
- assert(io_bytes_left<=(iter->elmt_left*elem_size));
+ HDassert(io_bytes_left <= (iter->elmt_left * elem_size));
/* Take care of any partial spans leftover from previous I/Os */
if(abs_arr[fast_dim]!=curr_span->low) {
@@ -7765,7 +7676,7 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
if(NULL == curr_span) {
/* Same as code in main loop */
/* Start at the next fastest dim */
- curr_dim = fast_dim - 1;
+ curr_dim = (int)(fast_dim - 1);
/* Work back up through the dimensions */
while(curr_dim >= 0) {
@@ -7804,7 +7715,7 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
/* Check if we have more spans in the tree */
if(curr_dim >= 0) {
/* Walk back down the iterator positions, reseting them */
- while(curr_dim < fast_dim) {
+ while((unsigned)curr_dim < fast_dim) {
HDassert(curr_span);
HDassert(curr_span->down);
HDassert(curr_span->down->head);
@@ -7826,8 +7737,8 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
HDassert(curr_span == iter->u.hyp.span[fast_dim]);
/* Reset the buffer offset */
- for(i = 0, loc_off = 0; i < ndims; i++)
- loc_off += (abs_arr[i] + off_arr[i]) * slab[i];
+ for(u = 0, loc_off = 0; u < ndims; u++)
+ loc_off += ((hsize_t)((hssize_t)abs_arr[u] + off_arr[u])) * slab[u];
} /* end else */
else
/* We had better be done with I/O or bad things are going to happen... */
@@ -7861,25 +7772,18 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
/* Store the I/O information for the span */
/* Check if this is appending onto previous sequence */
- if(curr_seq>0 && last_span_end==loc_off)
- len[curr_seq-1]+=span_size;
+ if(curr_seq > 0 && last_span_end == loc_off)
+ len[curr_seq - 1] += span_size;
else {
- off[curr_seq]=loc_off;
- len[curr_seq]=span_size;
+ off[curr_seq] = loc_off;
+ len[curr_seq] = span_size;
/* Increment the number of sequences in arrays */
curr_seq++;
} /* end else */
/* Set the location of the last span's end */
- last_span_end=loc_off+span_size;
-
- /* If the sequence & offset arrays are full, do what? */
- if(curr_seq>=maxseq) {
- /* Break out now, we are finished with sequences */
- break;
-
- } /* end else */
+ last_span_end = loc_off + span_size;
/* end COMMON */
/* Break out now, we are finished with I/O */
@@ -7887,31 +7791,31 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
} /* end if */
else {
/* Decrement I/O left to perform */
- io_bytes_left-=span_size;
+ io_bytes_left -= span_size;
/* COMMON */
/* Store the I/O information for the span */
/* Check if this is appending onto previous sequence */
- if(curr_seq>0 && last_span_end==loc_off)
+ if(curr_seq > 0 && last_span_end == loc_off)
len[curr_seq-1]+=span_size;
else {
- off[curr_seq]=loc_off;
- len[curr_seq]=span_size;
+ off[curr_seq] = loc_off;
+ len[curr_seq] = span_size;
/* Increment the number of sequences in arrays */
curr_seq++;
} /* end else */
/* Set the location of the last span's end */
- last_span_end=loc_off+span_size;
+ last_span_end = loc_off + span_size;
+/* end COMMON */
/* If the sequence & offset arrays are full, do what? */
- if(curr_seq>=maxseq) {
+ if(curr_seq >= maxseq) {
/* Break out now, we are finished with sequences */
break;
} /* end else */
-/* end COMMON */
} /* end else */
/* Move to next span in fastest changing dimension */
@@ -7946,10 +7850,10 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
/* Adjust iterator pointers */
/* Start at the next fastest dim */
- curr_dim=fast_dim-1;
+ curr_dim = (int)(fast_dim - 1);
/* Work back up through the dimensions */
- while(curr_dim>=0) {
+ while(curr_dim >= 0) {
/* Reset the current span */
curr_span=iter->u.hyp.span[curr_dim];
@@ -7983,51 +7887,51 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
} /* end while */
/* Check if we are finished with the spans in the tree */
- if(curr_dim<0) {
+ if(curr_dim < 0) {
/* We had better be done with I/O or bad things are going to happen... */
- assert(io_bytes_left==0);
+ HDassert(io_bytes_left == 0);
break;
} /* end if */
else {
/* Walk back down the iterator positions, reseting them */
- while(curr_dim<fast_dim) {
- assert(curr_span);
- assert(curr_span->down);
- assert(curr_span->down->head);
+ while((unsigned)curr_dim < fast_dim) {
+ HDassert(curr_span);
+ HDassert(curr_span->down);
+ HDassert(curr_span->down->head);
/* Increment current dimension to the next dimension down */
curr_dim++;
/* Set the new span for the next dimension down */
- iter->u.hyp.span[curr_dim]=curr_span->down->head;
+ iter->u.hyp.span[curr_dim] = curr_span->down->head;
/* Advance span down the tree */
- curr_span=curr_span->down->head;
+ curr_span = curr_span->down->head;
/* Reset the absolute offset for the dim */
- abs_arr[curr_dim]=curr_span->low;
+ abs_arr[curr_dim] = curr_span->low;
} /* end while */
/* Verify that the curr_span points to the fastest dim */
- assert(curr_span==iter->u.hyp.span[fast_dim]);
+ HDassert(curr_span == iter->u.hyp.span[fast_dim]);
} /* end else */
/* Reset the buffer offset */
- for(i=0, loc_off=0; i<ndims; i++)
- loc_off+=(abs_arr[i]+off_arr[i])*slab[i];
+ for(u = 0, loc_off = 0; u < ndims; u++)
+ loc_off += ((hsize_t)((hssize_t)abs_arr[u] + off_arr[u])) * slab[u];
} /* end while */
/* Decrement number of elements left in iterator */
- io_used=(io_left-(io_bytes_left/elem_size));
- iter->elmt_left-=io_used;
+ io_used = (io_left - (io_bytes_left / elem_size));
+ iter->elmt_left -= io_used;
/* Set the number of sequences generated */
- *nseq=curr_seq;
+ *nseq = curr_seq;
/* Set the number of elements used */
- *nelem=io_used;
+ *nelem = io_used;
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5S_hyper_get_seq_list_gen() */
@@ -8062,7 +7966,7 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
+H5S_hyper_get_seq_list_opt(const H5S_t *space, H5S_sel_iter_t *iter,
size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
hsize_t *off, size_t *len)
{
@@ -8085,11 +7989,12 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
size_t act_blk_count; /* Actual number of blocks to output */
size_t total_rows; /* Total number of entire rows to output */
size_t curr_rows; /* Current number of entire rows to output */
- int fast_dim; /* Rank of the fastest changing dimension for the dataspace */
+ unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
+ unsigned ndims; /* Number of dimensions of dataset */
int temp_dim; /* Temporary rank holder */
- int ndims; /* Number of dimensions of dataset */
hsize_t acc; /* Accumulator */
hsize_t loc; /* Coordinate offset */
+ unsigned u; /* Local index variable */
int i; /* Local index variable */
size_t curr_seq=0; /* Current sequence being operated on */
size_t actual_elem; /* The actual number of elements to count */
@@ -8099,50 +8004,50 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
size_t start_io_left; /* The initial number of elements left in I/O operation */
size_t elem_size; /* Size of each element iterating over */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_get_seq_list_opt);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_get_seq_list_opt)
/* Check args */
- assert(space);
- assert(iter);
- assert(maxseq>0);
- assert(maxelem>0);
- assert(nseq);
- assert(nelem);
- assert(off);
- assert(len);
+ HDassert(space);
+ HDassert(iter);
+ HDassert(maxseq > 0);
+ HDassert(maxelem > 0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
/* Set the local copy of the diminfo pointer */
- tdiminfo=iter->u.hyp.diminfo;
+ tdiminfo = iter->u.hyp.diminfo;
/* Check if this is a "flattened" regular hyperslab selection */
- if(iter->u.hyp.iter_rank!=0 && iter->u.hyp.iter_rank<space->extent.rank) {
+ if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < space->extent.rank) {
/* Set the aliases for a few important dimension ranks */
- ndims=iter->u.hyp.iter_rank;
- fast_dim=ndims-1;
+ ndims = iter->u.hyp.iter_rank;
+ fast_dim = ndims - 1;
/* Set the local copy of the selection offset */
- sel_off=iter->u.hyp.sel_off;
+ sel_off = iter->u.hyp.sel_off;
/* Set up the pointer to the size of the memory space */
- mem_size=iter->u.hyp.size;
+ mem_size = iter->u.hyp.size;
} /* end if */
else {
/* Set the aliases for a few important dimension ranks */
- ndims=space->extent.rank;
- fast_dim=ndims-1;
+ ndims = space->extent.rank;
+ fast_dim = ndims - 1;
/* Set the local copy of the selection offset */
- sel_off=space->select.offset;
+ sel_off = space->select.offset;
/* Set up the pointer to the size of the memory space */
- mem_size=space->extent.size;
+ mem_size = space->extent.size;
} /* end else */
/* initialize row sizes for each dimension */
- elem_size=iter->elmt_size;
- for(i=(ndims-1),acc=elem_size; i>=0; i--) {
- slab[i]=acc;
- acc*=mem_size[i];
+ elem_size = iter->elmt_size;
+ for(i = (int)fast_dim, acc = elem_size; i >= 0; i--) {
+ slab[i] = acc;
+ acc *= mem_size[i];
} /* end for */
/* Calculate the number of elements to sequence through */
@@ -8166,12 +8071,12 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
actual_elem=MIN(leftover,io_left);
/* Compute the initial buffer offset */
- for(i=0,loc=0; i<ndims; i++)
- loc+=(iter->u.hyp.off[i]+sel_off[i])*slab[i];
+ for(u = 0, loc = 0; u < ndims; u++)
+ loc += ((hsize_t)((hssize_t)iter->u.hyp.off[u] + sel_off[u])) * slab[u];
/* Add a new sequence */
- off[curr_seq]=loc;
- H5_ASSIGN_OVERFLOW(len[curr_seq],actual_elem*elem_size,hsize_t,size_t);
+ off[curr_seq] = loc;
+ H5_ASSIGN_OVERFLOW(len[curr_seq], actual_elem * elem_size, hsize_t, size_t);
/* Increment sequence count */
curr_seq++;
@@ -8180,10 +8085,10 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
io_left -= actual_elem;
/* Advance the hyperslab iterator */
- H5S_hyper_iter_next(iter,actual_elem);
+ H5S_hyper_iter_next(iter, actual_elem);
/* Decrement the number of elements left in selection */
- iter->elmt_left-=actual_elem;
+ iter->elmt_left -= actual_elem;
} /* end if */
/* Now that we've cleared the "remainder" of the previous fastest dimension
@@ -8191,32 +8096,32 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
* algorithm to compute the offsets and run through as many as possible,
* until the buffer fills up.
*/
- if(io_left>0 && curr_seq<maxseq) { /* Just in case the "remainder" above filled the buffer */
+ if(io_left > 0 && curr_seq < maxseq) { /* Just in case the "remainder" above filled the buffer */
/* Keep the number of elements we started with */
- nelmts=io_left;
+ nelmts = io_left;
/* Compute the arrays to perform I/O on */
/* Copy the location of the point to get */
/* (Add in the selection offset) */
- for(i=0; i<ndims; i++)
- offset[i] = iter->u.hyp.off[i] + sel_off[i];
+ for(u = 0; u < ndims; u++)
+ offset[u] = (hsize_t)((hssize_t)iter->u.hyp.off[u] + sel_off[u]);
/* Compute the current "counts" for this location */
- for(i=0; i<ndims; i++) {
- if(tdiminfo[i].count==1) {
- tmp_count[i] = 0;
- tmp_block[i] = iter->u.hyp.off[i]-tdiminfo[i].start;
+ for(u = 0; u < ndims; u++) {
+ if(tdiminfo[u].count == 1) {
+ tmp_count[u] = 0;
+ tmp_block[u] = iter->u.hyp.off[u] - tdiminfo[u].start;
} /* end if */
else {
- tmp_count[i] = (iter->u.hyp.off[i]-tdiminfo[i].start)/tdiminfo[i].stride;
- tmp_block[i] = (iter->u.hyp.off[i]-tdiminfo[i].start)%tdiminfo[i].stride;
+ tmp_count[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) / tdiminfo[u].stride;
+ tmp_block[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) % tdiminfo[u].stride;
} /* end else */
} /* end for */
/* Compute the initial buffer offset */
- for(i=0,loc=0; i<ndims; i++)
- loc+=offset[i]*slab[i];
+ for(u = 0, loc = 0; u < ndims; u++)
+ loc += offset[u] * slab[u];
/* Set the number of elements to write each time */
H5_ASSIGN_OVERFLOW(actual_elem,tdiminfo[fast_dim].block,hsize_t,size_t);
@@ -8225,31 +8130,31 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
actual_bytes=actual_elem*elem_size;
/* Set local copies of information for the fastest changing dimension */
- fast_dim_start=tdiminfo[fast_dim].start;
- fast_dim_stride=tdiminfo[fast_dim].stride;
- fast_dim_block=tdiminfo[fast_dim].block;
- H5_ASSIGN_OVERFLOW(fast_dim_buf_off,slab[fast_dim]*fast_dim_stride,hsize_t,size_t);
- fast_dim_offset=fast_dim_start+sel_off[fast_dim];
+ fast_dim_start = tdiminfo[fast_dim].start;
+ fast_dim_stride = tdiminfo[fast_dim].stride;
+ fast_dim_block = tdiminfo[fast_dim].block;
+ H5_ASSIGN_OVERFLOW(fast_dim_buf_off, slab[fast_dim] * fast_dim_stride, hsize_t, size_t);
+ fast_dim_offset = (hsize_t)((hssize_t)fast_dim_start + sel_off[fast_dim]);
/* Compute the number of blocks which would fit into the buffer */
- H5_CHECK_OVERFLOW(io_left/fast_dim_block,hsize_t,size_t);
- tot_blk_count=(size_t)(io_left/fast_dim_block);
+ H5_CHECK_OVERFLOW(io_left / fast_dim_block, hsize_t, size_t);
+ tot_blk_count = (size_t)(io_left / fast_dim_block);
/* Don't go over the maximum number of sequences allowed */
- tot_blk_count=MIN(tot_blk_count,(maxseq-curr_seq));
+ tot_blk_count = MIN(tot_blk_count, (maxseq - curr_seq));
/* Compute the amount to wrap at the end of each row */
- for(i=0; i<ndims; i++)
- wrap[i]=(mem_size[i]-(tdiminfo[i].stride*tdiminfo[i].count))*slab[i];
+ for(u = 0; u < ndims; u++)
+ wrap[u] = (mem_size[u] - (tdiminfo[u].stride * tdiminfo[u].count)) * slab[u];
/* Compute the amount to skip between blocks */
- for(i=0; i<ndims; i++)
- skip[i]=(tdiminfo[i].stride-tdiminfo[i].block)*slab[i];
+ for(u = 0; u < ndims; u++)
+ skip[u] = (tdiminfo[u].stride - tdiminfo[u].block) * slab[u];
/* Check if there is a partial row left (with full blocks) */
- if(tmp_count[fast_dim]>0) {
+ if(tmp_count[fast_dim] > 0) {
/* Get number of blocks in fastest dimension */
- H5_ASSIGN_OVERFLOW(fast_dim_count,tdiminfo[fast_dim].count-tmp_count[fast_dim],hsize_t,size_t);
+ H5_ASSIGN_OVERFLOW(fast_dim_count, tdiminfo[fast_dim].count - tmp_count[fast_dim], hsize_t, size_t);
/* Make certain this entire row will fit into buffer */
fast_dim_count=MIN(fast_dim_count,tot_blk_count);
@@ -8292,30 +8197,30 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
tmp_count[fast_dim]=0;
/* Increment the offset and count for the other dimensions */
- temp_dim=fast_dim-1;
- while(temp_dim>=0) {
+ temp_dim = (int)fast_dim - 1;
+ while(temp_dim >= 0) {
/* Move to the next row in the curent dimension */
offset[temp_dim]++;
tmp_block[temp_dim]++;
/* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_block[temp_dim]<tdiminfo[temp_dim].block)
+ if(tmp_block[temp_dim] < tdiminfo[temp_dim].block)
break;
else {
/* Move to the next block in the current dimension */
- offset[temp_dim]+=(tdiminfo[temp_dim].stride-tdiminfo[temp_dim].block);
+ offset[temp_dim] += (tdiminfo[temp_dim].stride - tdiminfo[temp_dim].block);
loc += skip[temp_dim];
- tmp_block[temp_dim]=0;
+ tmp_block[temp_dim] = 0;
tmp_count[temp_dim]++;
/* If this block is still in the range of blocks to output for the dimension, break out of loop */
if(tmp_count[temp_dim]<tdiminfo[temp_dim].count)
break;
else {
- offset[temp_dim]=tdiminfo[temp_dim].start+sel_off[temp_dim];
+ offset[temp_dim] = (hsize_t)((hssize_t)tdiminfo[temp_dim].start + sel_off[temp_dim]);
loc += wrap[temp_dim];
- tmp_count[temp_dim]=0; /* reset back to the beginning of the line */
- tmp_block[temp_dim]=0;
+ tmp_count[temp_dim] = 0; /* reset back to the beginning of the line */
+ tmp_block[temp_dim] = 0;
} /* end else */
} /* end else */
@@ -8325,13 +8230,13 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
} /* end if */
else {
/* Update the offset in the fastest dimension */
- offset[fast_dim]+=(fast_dim_stride*act_blk_count);
+ offset[fast_dim] += (fast_dim_stride * act_blk_count);
} /* end else */
} /* end if */
/* Compute the number of entire rows to read in */
- H5_CHECK_OVERFLOW( tot_blk_count/tdiminfo[fast_dim].count ,hsize_t,size_t);
- curr_rows=total_rows=(size_t)(tot_blk_count/tdiminfo[fast_dim].count);
+ H5_CHECK_OVERFLOW(tot_blk_count / tdiminfo[fast_dim].count, hsize_t, size_t);
+ curr_rows = total_rows = (size_t)(tot_blk_count / tdiminfo[fast_dim].count);
/* Reset copy of number of blocks in fastest dimension */
H5_ASSIGN_OVERFLOW(fast_dim_count,tdiminfo[fast_dim].count,hsize_t,size_t);
@@ -8341,14 +8246,14 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
#define DUFF_GUTS \
/* Store the sequence information */ \
- off[curr_seq]=loc; \
- len[curr_seq]=actual_bytes; \
+ off[curr_seq] = loc; \
+ len[curr_seq] = actual_bytes; \
\
/* Increment sequence count */ \
curr_seq++; \
\
/* Increment information to reflect block just processed */ \
- loc+=fast_dim_buf_off;
+ loc += fast_dim_buf_off;
#ifdef NO_DUFFS_DEVICE
/* Loop over all the blocks in the fastest changing dimension */
@@ -8392,30 +8297,30 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
loc += wrap[fast_dim];
/* Increment the offset and count for the other dimensions */
- temp_dim=fast_dim-1;
- while(temp_dim>=0) {
+ temp_dim = (int)fast_dim - 1;
+ while(temp_dim >= 0) {
/* Move to the next row in the curent dimension */
offset[temp_dim]++;
tmp_block[temp_dim]++;
/* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_block[temp_dim]<tdiminfo[temp_dim].block)
+ if(tmp_block[temp_dim] < tdiminfo[temp_dim].block)
break;
else {
/* Move to the next block in the current dimension */
- offset[temp_dim]+=(tdiminfo[temp_dim].stride-tdiminfo[temp_dim].block);
+ offset[temp_dim] += (tdiminfo[temp_dim].stride - tdiminfo[temp_dim].block);
loc += skip[temp_dim];
- tmp_block[temp_dim]=0;
+ tmp_block[temp_dim] = 0;
tmp_count[temp_dim]++;
/* If this block is still in the range of blocks to output for the dimension, break out of loop */
if(tmp_count[temp_dim]<tdiminfo[temp_dim].count)
break;
else {
- offset[temp_dim]=tdiminfo[temp_dim].start+sel_off[temp_dim];
+ offset[temp_dim] = (hsize_t)((hssize_t)tdiminfo[temp_dim].start + sel_off[temp_dim]);
loc += wrap[temp_dim];
- tmp_count[temp_dim]=0; /* reset back to the beginning of the line */
- tmp_block[temp_dim]=0;
+ tmp_count[temp_dim] = 0; /* reset back to the beginning of the line */
+ tmp_block[temp_dim] = 0;
} /* end else */
} /* end else */
@@ -8430,8 +8335,8 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
/* Adjust the number of blocks & elements left to transfer */
/* Decrement number of elements left */
- H5_CHECK_OVERFLOW( actual_elem*(total_rows*tdiminfo[fast_dim].count) ,hsize_t,size_t);
- io_left -= (size_t)(actual_elem*(total_rows*tdiminfo[fast_dim].count));
+ H5_CHECK_OVERFLOW(actual_elem * (total_rows * tdiminfo[fast_dim].count), hsize_t, size_t);
+ io_left -= (size_t)(actual_elem * (total_rows * tdiminfo[fast_dim].count));
/* Decrement number of blocks left */
H5_CHECK_OVERFLOW( (total_rows*tdiminfo[fast_dim].count) ,hsize_t,size_t);
@@ -8491,20 +8396,20 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
/* Update the iterator with the location we stopped */
/* (Subtract out the selection offset) */
- for(i=0; i<ndims; i++)
- iter->u.hyp.off[i] = offset[i] - sel_off[i];
+ for(u = 0; u < ndims; u++)
+ iter->u.hyp.off[u] = (hsize_t)((hssize_t)offset[u] - sel_off[u]);
/* Decrement the number of elements left in selection */
- iter->elmt_left-=(nelmts-io_left);
+ iter->elmt_left -= (nelmts - io_left);
} /* end if */
/* Set the number of sequences generated */
- *nseq=curr_seq;
+ *nseq = curr_seq;
/* Set the number of bytes used */
- *nelem=start_io_left-io_left;
+ *nelem = start_io_left - io_left;
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5S_hyper_get_seq_list_opt() */
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index d7faa89..0e67af1 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -257,7 +257,6 @@ H5_DLL htri_t H5S_hyper_intersect (H5S_t *space1, H5S_t *space2);
#endif /* LATER */
H5_DLL htri_t H5S_hyper_intersect_block (H5S_t *space, hsize_t *start, hsize_t *end);
H5_DLL herr_t H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset);
-H5_DLL herr_t H5S_hyper_move(H5S_t *space, const hssize_t *offset);
H5_DLL htri_t H5S_hyper_normalize_offset(H5S_t *space, hssize_t *old_offset);
H5_DLL herr_t H5S_hyper_denormalize_offset(H5S_t *space, const hssize_t *old_offset);
diff --git a/src/H5Torder.c b/src/H5Torder.c
index 6c0667b..590a6c7 100644
--- a/src/H5Torder.c
+++ b/src/H5Torder.c
@@ -18,24 +18,72 @@
* the datatype byte order for the H5T interface.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#define H5T_PACKAGE /*suppress error about including H5Tpkg */
/* Interface initialization */
#define H5_INTERFACE_INIT_FUNC H5T_init_order_interface
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
#include "H5Tpkg.h" /* Datatypes */
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+static herr_t H5T_set_order(H5T_t *dtype, H5T_order_t order);
+
+
+/*********************/
+/* Public Variables */
+/*********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
/*--------------------------------------------------------------------------
NAME
H5T_init_order_interface -- Initialize interface-specific information
USAGE
herr_t H5T_init_order_interface()
-
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -57,30 +105,31 @@ H5T_init_order_interface(void)
*
* Purpose: Returns the byte order of a datatype.
*
- * Return: Success: A byte order constant
- *
+ * Return: Success: A byte order constant. If the type is compound
+ * and its members have mixed orders, this function
+ * returns H5T_ORDER_MIXED.
* Failure: H5T_ORDER_ERROR (Negative)
*
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
- *
+ *
*-------------------------------------------------------------------------
*/
H5T_order_t
H5Tget_order(hid_t type_id)
{
- H5T_t *dt;
- H5T_order_t ret_value;
+ H5T_t *dt; /* Datatype to query */
+ H5T_order_t ret_value; /* Return value */
FUNC_ENTER_API(H5Tget_order, H5T_ORDER_ERROR)
H5TRACE1("To", "i", type_id);
/* Check args */
- if(NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_ORDER_ERROR, "not a datatype")
+ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5T_ORDER_ERROR, "not a datatype")
/* Get order */
- if((ret_value = H5T_get_order(dt)) == H5T_ORDER_ERROR)
+ if(H5T_ORDER_ERROR == (ret_value = H5T_get_order(dt)))
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_ORDER_ERROR, "cant't get order for specified datatype")
done:
@@ -102,20 +151,51 @@ done:
*-------------------------------------------------------------------------
*/
H5T_order_t
-H5T_get_order(const H5T_t *dt)
+H5T_get_order(const H5T_t *dtype)
{
- H5T_order_t ret_value; /* Return value */
+ H5T_order_t ret_value = H5T_ORDER_NONE; /* Return value */
FUNC_ENTER_NOAPI(H5T_get_order, H5T_ORDER_ERROR)
- /*defer to parent*/
- while(dt->shared->parent)
- dt = dt->shared->parent;
- if(!H5T_IS_ATOMIC(dt->shared))
- HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_ORDER_ERROR, "operation not defined for specified datatype")
+ /* Defer to parent */
+ while(dtype->shared->parent)
+ dtype = dtype->shared->parent;
+
+ /* Set order for atomic type. */
+ if(H5T_IS_ATOMIC(dtype->shared))
+ ret_value = dtype->shared->u.atomic.order;
+ else {
+ /* Check for compound datatype */
+ if(H5T_COMPOUND == dtype->shared->type) {
+ H5T_order_t memb_order = H5T_ORDER_NONE;
+ int nmemb; /* Number of members in compound & enum types */
+ int i; /* Local index variable */
+
+ /* Retrieve the number of members */
+ if((nmemb = H5T_get_nmembers(dtype)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_ORDER_ERROR, "can't get number of members from compound data type")
+
+ /* Get order for each compound member type. */
+ for(i = 0; i < nmemb; i++) {
+ /* Get order for member */
+ if((memb_order = H5T_get_order(dtype->shared->u.compnd.memb[i].type)) == H5T_ORDER_ERROR)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5T_ORDER_ERROR, "can't get order for compound member")
- /* Order */
- ret_value = dt->shared->u.atomic.order;
+ /* Ignore the H5T_ORDER_NONE, write down the first non H5T_ORDER_NONE order. */
+ if(memb_order != H5T_ORDER_NONE && ret_value == H5T_ORDER_NONE)
+ ret_value = memb_order;
+
+ /* If the orders are mixed, stop the loop and report it.
+ * (H5T_ORDER_NONE is ignored)
+ */
+ if(memb_order != H5T_ORDER_NONE && ret_value != H5T_ORDER_NONE
+ && memb_order != ret_value) {
+ ret_value = H5T_ORDER_MIXED;
+ break;
+ } /* end if */
+ } /* end for */
+ } /* end if */
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -127,46 +207,103 @@ done:
*
* Purpose: Sets the byte order for a datatype.
*
+ * Notes: There are some restrictions on this operation:
+ * 1. For enum type, members shouldn't be defined yet.
+ * 2. H5T_ORDER_NONE only works for reference and fixed-length
+ * string.
+ * 3. For opaque type, the order will be ignored.
+ * 4. For compound type, all restrictions above apply to the
+ * members.
+ *
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
- * Modifications:
- * Robb Matzke, 22 Dec 1998
- * Also works for derived datatypes.
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Tset_order(hid_t type_id, H5T_order_t order)
{
- H5T_t *dt = NULL;
- herr_t ret_value=SUCCEED; /* Return value */
+ H5T_t *dt; /* Datatype to modify */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5Tset_order, FAIL)
H5TRACE2("e", "iTo", type_id, order);
/* Check args */
- if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
- if (H5T_STATE_TRANSIENT!=dt->shared->state)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only")
- if (order < H5T_ORDER_LE || order > H5T_ORDER_NONE)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal byte order")
- if (H5T_ENUM==dt->shared->type && dt->shared->u.enumer.nmembs>0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined")
- while (dt->shared->parent)
- dt = dt->shared->parent; /*defer to parent*/
- if (order == H5T_ORDER_NONE && !(H5T_REFERENCE == dt->shared->type || H5T_IS_FIXED_STRING(dt->shared)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal byte order")
- if (!H5T_IS_ATOMIC(dt->shared))
- HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified datatype")
-
- /* Commit */
- dt->shared->u.atomic.order = order;
+ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype")
+ if(order < H5T_ORDER_LE || order > H5T_ORDER_NONE || order == H5T_ORDER_MIXED)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "illegal byte order")
+ if(H5T_STATE_TRANSIENT != dt->shared->state)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype is read-only")
+
+ /* Call internal routine to set the order */
+ if(H5T_set_order(dt, order) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "can't set order")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Tset_order() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_set_order
+ *
+ * Purpose: Private function to set the byte order for a datatype.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Raymond Lu
+ * 13 August 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5T_set_order(H5T_t *dtype, H5T_order_t order)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5T_set_order, FAIL)
+
+ if(H5T_ENUM == dtype->shared->type && dtype->shared->u.enumer.nmembs > 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "operation not allowed after enum members are defined")
+
+ /* For derived data type, defer to parent */
+ while(dtype->shared->parent)
+ dtype = dtype->shared->parent;
+
+ /* Check for setting order on inappropriate datatype */
+ if(order == H5T_ORDER_NONE && !(H5T_REFERENCE == dtype->shared->type ||
+ H5T_OPAQUE == dtype->shared->type || H5T_IS_FIXED_STRING(dtype->shared)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "illegal byte order for type")
+
+ /* For atomic data type */
+ if(H5T_IS_ATOMIC(dtype->shared))
+ dtype->shared->u.atomic.order = order;
+ else {
+ /* Check for compound datatype */
+ if(H5T_COMPOUND == dtype->shared->type) {
+ int nmemb; /* Number of members in type */
+ int i; /* Local index variable */
+
+ /* Retrieve the number of fields in the compound datatype */
+ if((nmemb = H5T_get_nmembers(dtype)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get number of members from compound data type")
+
+ /* Check for uninitialized compound datatype */
+ if(nmemb == 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNINITIALIZED, FAIL, "no member is in the compound data type")
+
+ /* Loop through all fields of compound type, setting the order */
+ for(i = 0; i < nmemb; i++)
+ if(H5T_set_order(dtype->shared->u.compnd.memb[i].type, order) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set order for compound member")
+ } /* end if */
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_set_order() */
diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h
index 330a731..d646ef1 100644
--- a/src/H5Tpublic.h
+++ b/src/H5Tpublic.h
@@ -50,7 +50,8 @@ typedef enum H5T_order_t {
H5T_ORDER_LE = 0, /*little endian */
H5T_ORDER_BE = 1, /*bit endian */
H5T_ORDER_VAX = 2, /*VAX mixed endian */
- H5T_ORDER_NONE = 3 /*no particular order (strings, bits,..) */
+ H5T_ORDER_MIXED = 3, /*Compound type with mixed member orders */
+ H5T_ORDER_NONE = 4 /*no particular order (strings, bits,..) */
/*H5T_ORDER_NONE must be last */
} H5T_order_t;
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index 95f4086..f1b1f00 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -100,8 +100,6 @@ H5T_init_vlen_interface(void)
* Programmer: Quincey Koziol
* Thursday, May 20, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
@@ -144,8 +142,6 @@ done:
* Programmer: Quincey Koziol
* Tuesday, November 20, 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5T_t *
@@ -315,11 +311,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, June 2, 1999
*
- * Modifications: Neil Fortner
- * Friday, August 22, 2008
- * Changed function to be tolerant of an hvl_t that is not aligned
- * properly in _vl.
- *
*-------------------------------------------------------------------------
*/
static ssize_t
@@ -357,11 +348,6 @@ H5T_vlen_seq_mem_getlen(const void *_vl)
* Programmer: Quincey Koziol
* Saturday, June 12, 2004
*
- * Modifications: Neil Fortner
- * Friday, August 22, 2008
- * Changed function to be tolerant of an hvl_t that is not aligned
- * properly in _vl.
- *
*-------------------------------------------------------------------------
*/
static void *
@@ -399,11 +385,6 @@ H5T_vlen_seq_mem_getptr(void *_vl)
* Programmer: Quincey Koziol
* Saturday, November 8, 2003
*
- * Modifications: Neil Fortner
- * Friday, August 22, 2008
- * Changed function to be tolerant of an hvl_t that is not aligned
- * properly in _vl.
- *
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
@@ -442,11 +423,6 @@ H5T_vlen_seq_mem_isnull(const H5F_t UNUSED *f, void *_vl)
* Programmer: Quincey Koziol
* Wednesday, June 2, 1999
*
- * Modifications: Neil Fortner
- * Friday, August 22, 2008
- * Changed function to be tolerant of an hvl_t that is not aligned
- * properly in _vl.
- *
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
@@ -489,8 +465,6 @@ H5T_vlen_seq_mem_read(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_vl, void *bu
* Programmer: Quincey Koziol
* Wednesday, June 2, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
@@ -548,8 +522,6 @@ done:
* Programmer: Quincey Koziol
* Saturday, November 8, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
@@ -584,11 +556,6 @@ H5T_vlen_seq_mem_setnull(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_vl, void
* Programmer: Quincey Koziol
* Wednesday, June 2, 1999
*
- * Modifications: Neil Fortner
- * Friday, August 22, 2008
- * Changed function to be tolerant of a char * that is not aligned
- * properly in _vl.
- *
*-------------------------------------------------------------------------
*/
static ssize_t
@@ -624,12 +591,6 @@ H5T_vlen_str_mem_getlen(const void *_vl)
* Programmer: Quincey Koziol
* Saturday, June 12, 2004
*
- * Modifications: Neil Fortner
- * Friday, August 22, 2008
- * Changed function to be tolerant of a char * that is not aligned
- * properly in _vl.
- * Added assertion on _vl.
- *
*-------------------------------------------------------------------------
*/
static void *
@@ -665,11 +626,6 @@ H5T_vlen_str_mem_getptr(void *_vl)
* Programmer: Quincey Koziol
* Saturday, November 8, 2003
*
- * Modifications: Neil Fortner
- * Friday, August 22, 2008
- * Changed function to be tolerant of a char * that is not aligned
- * properly in _vl.
- *
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
@@ -702,11 +658,6 @@ H5T_vlen_str_mem_isnull(const H5F_t UNUSED *f, void *_vl)
* Programmer: Quincey Koziol
* Wednesday, June 2, 1999
*
- * Modifications: Neil Fortner
- * Friday, August 22, 2008
- * Changed function to be tolerant of a char * that is not aligned
- * properly in _vl.
- *
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
@@ -748,8 +699,6 @@ H5T_vlen_str_mem_read(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_vl, void *bu
* Programmer: Quincey Koziol
* Wednesday, June 2, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
@@ -797,8 +746,6 @@ done:
* Programmer: Quincey Koziol
* Saturday, November 8, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
@@ -826,8 +773,6 @@ H5T_vlen_str_mem_setnull(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_vl, void
* Programmer: Quincey Koziol
* Wednesday, June 2, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static ssize_t
@@ -857,8 +802,6 @@ H5T_vlen_disk_getlen(const void *_vl)
* Programmer: Quincey Koziol
* Saturday, June 12, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
@@ -884,8 +827,6 @@ H5T_vlen_disk_getptr(void UNUSED *vl)
* Programmer: Quincey Koziol
* Saturday, November 8, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static htri_t
@@ -919,8 +860,6 @@ H5T_vlen_disk_isnull(const H5F_t *f, void *_vl)
* Programmer: Quincey Koziol
* Wednesday, June 2, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
@@ -967,29 +906,24 @@ done:
* Programmer: Quincey Koziol
* Wednesday, June 2, 1999
*
- * Modifications:
- *
- * Raymond Lu
- * Thursday, June 26, 2002
- * Free heap objects storing old data.
- *
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
static herr_t
-H5T_vlen_disk_write(H5F_t *f, hid_t dxpl_id, const H5T_vlen_alloc_info_t UNUSED *vl_alloc_info, void *_vl, void *buf, void *_bg, size_t seq_len, size_t base_size)
+H5T_vlen_disk_write(H5F_t *f, hid_t dxpl_id, const H5T_vlen_alloc_info_t UNUSED *vl_alloc_info,
+ void *_vl, void *buf, void *_bg, size_t seq_len, size_t base_size)
{
- uint8_t *vl=(uint8_t *)_vl; /*Pointer to the user's hvl_t information*/
- uint8_t *bg=(uint8_t *)_bg; /*Pointer to the old data hvl_t */
+ uint8_t *vl = (uint8_t *)_vl; /*Pointer to the user's hvl_t information*/
+ uint8_t *bg = (uint8_t *)_bg; /*Pointer to the old data hvl_t */
H5HG_t hobjid; /* New VL sequence's heap ID */
size_t len; /* Size of new sequence on disk (in bytes) */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5T_vlen_disk_write)
/* check parameters */
HDassert(vl);
- HDassert(seq_len==0 || buf);
+ HDassert(seq_len == 0 || buf);
HDassert(f);
/* Free heap object for old data. */
@@ -1004,9 +938,9 @@ H5T_vlen_disk_write(H5F_t *f, hid_t dxpl_id, const H5T_vlen_alloc_info_t UNUSED
INT32DECODE(bg, bg_hobjid.idx);
/* Free heap object for old data */
- if(bg_hobjid.addr>0) {
+ if(bg_hobjid.addr > 0) {
/* Free heap object */
- if(H5HG_remove(f, dxpl_id, &bg_hobjid)<0)
+ if(H5HG_remove(f, dxpl_id, &bg_hobjid) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object")
} /* end if */
} /* end if */
@@ -1015,13 +949,13 @@ H5T_vlen_disk_write(H5F_t *f, hid_t dxpl_id, const H5T_vlen_alloc_info_t UNUSED
UINT32ENCODE(vl, seq_len);
/* Write the VL information to disk (allocates space also) */
- len=(seq_len*base_size);
- if(H5HG_insert(f,dxpl_id,len,buf,&hobjid)<0)
+ len = (seq_len*base_size);
+ if(H5HG_insert(f, dxpl_id, len, buf, &hobjid) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to write VL information")
/* Encode the heap information */
- H5F_addr_encode(f,&vl,hobjid.addr);
- INT32ENCODE(vl,hobjid.idx);
+ H5F_addr_encode(f, &vl, hobjid.addr);
+ INT32ENCODE(vl, hobjid.idx);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1038,17 +972,15 @@ done:
* Programmer: Quincey Koziol
* Saturday, November 8, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5T_vlen_disk_setnull(H5F_t *f, hid_t dxpl_id, void *_vl, void *_bg)
{
- uint8_t *vl=(uint8_t *)_vl; /*Pointer to the user's hvl_t information*/
- uint8_t *bg=(uint8_t *)_bg; /*Pointer to the old data hvl_t */
- uint32_t seq_len=0; /* Sequence length */
- herr_t ret_value=SUCCEED; /* Return value */
+ uint8_t *vl = (uint8_t *)_vl; /*Pointer to the user's hvl_t information*/
+ uint8_t *bg = (uint8_t *)_bg; /*Pointer to the old data hvl_t */
+ uint32_t seq_len = 0; /* Sequence length */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5T_vlen_disk_setnull)
@@ -1057,7 +989,7 @@ H5T_vlen_disk_setnull(H5F_t *f, hid_t dxpl_id, void *_vl, void *_bg)
HDassert(vl);
/* Free heap object for old data. */
- if(bg!=NULL) {
+ if(bg != NULL) {
H5HG_t bg_hobjid; /* "Background" VL info sequence's ID info */
/* Skip the length of the sequence and heap object ID from background data. */
@@ -1068,9 +1000,9 @@ H5T_vlen_disk_setnull(H5F_t *f, hid_t dxpl_id, void *_vl, void *_bg)
INT32DECODE(bg, bg_hobjid.idx);
/* Free heap object for old data */
- if(bg_hobjid.addr>0) {
+ if(bg_hobjid.addr > 0) {
/* Free heap object */
- if(H5HG_remove(f, dxpl_id, &bg_hobjid)<0)
+ if(H5HG_remove(f, dxpl_id, &bg_hobjid) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object")
} /* end if */
} /* end if */
@@ -1079,8 +1011,8 @@ H5T_vlen_disk_setnull(H5F_t *f, hid_t dxpl_id, void *_vl, void *_bg)
UINT32ENCODE(vl, seq_len);
/* Encode the "nil" heap pointer information */
- H5F_addr_encode(f,&vl,(haddr_t)0);
- INT32ENCODE(vl,0);
+ H5F_addr_encode(f, &vl, (haddr_t)0);
+ INT32ENCODE(vl, 0);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1111,8 +1043,8 @@ done:
static herr_t
H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, void *free_info)
{
- unsigned i; /* local index variable */
- herr_t ret_value = SUCCEED;
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5T_vlen_reclaim_recurse)
@@ -1127,9 +1059,9 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi
void *off; /* offset of field */
/* Calculate the offset member and recurse on it */
- for(i=0; i<dt->shared->u.array.nelem; i++) {
- off=((uint8_t *)elem)+i*(dt->shared->parent->shared->size);
- if(H5T_vlen_reclaim_recurse(off,dt->shared->parent,free_func,free_info)<0)
+ for(u = 0; u < dt->shared->u.array.nelem; u++) {
+ off = ((uint8_t *)elem) + u * (dt->shared->parent->shared->size);
+ if(H5T_vlen_reclaim_recurse(off, dt->shared->parent, free_func, free_info) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "Unable to free array element")
} /* end for */
} /* end if */
@@ -1137,14 +1069,14 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi
case H5T_COMPOUND:
/* Check each field and recurse on VL, compound, enum or array ones */
- for (i=0; i<dt->shared->u.compnd.nmembs; i++) {
+ for(u = 0; u < dt->shared->u.compnd.nmembs; u++) {
/* Recurse if it's VL, compound, enum or array */
- if(H5T_IS_COMPLEX(dt->shared->u.compnd.memb[i].type->shared->type)) {
+ if(H5T_IS_COMPLEX(dt->shared->u.compnd.memb[u].type->shared->type)) {
void *off; /* offset of field */
/* Calculate the offset member and recurse on it */
- off=((uint8_t *)elem)+dt->shared->u.compnd.memb[i].offset;
- if(H5T_vlen_reclaim_recurse(off,dt->shared->u.compnd.memb[i].type,free_func,free_info)<0)
+ off = ((uint8_t *)elem) + dt->shared->u.compnd.memb[u].offset;
+ if(H5T_vlen_reclaim_recurse(off, dt->shared->u.compnd.memb[u].type, free_func, free_info) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "Unable to free compound field")
} /* end if */
} /* end for */
@@ -1152,8 +1084,8 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi
case H5T_VLEN:
/* Recurse on the VL information if it's VL, compound, enum or array, then free VL sequence */
- if(dt->shared->u.vlen.type==H5T_VLEN_SEQUENCE) {
- hvl_t *vl=(hvl_t *)elem; /* Temp. ptr to the vl info */
+ if(dt->shared->u.vlen.type == H5T_VLEN_SEQUENCE) {
+ hvl_t *vl = (hvl_t *)elem; /* Temp. ptr to the vl info */
/* Check if there is anything actually in this sequence */
if(vl->len!=0) {
@@ -1162,24 +1094,24 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi
void *off; /* offset of field */
/* Calculate the offset of each array element and recurse on it */
- while(vl->len>0) {
- off=((uint8_t *)vl->p)+(vl->len-1)*dt->shared->parent->shared->size;
- if(H5T_vlen_reclaim_recurse(off,dt->shared->parent,free_func,free_info)<0)
+ while(vl->len > 0) {
+ off = ((uint8_t *)vl->p) + (vl->len - 1) * dt->shared->parent->shared->size;
+ if(H5T_vlen_reclaim_recurse(off, dt->shared->parent, free_func, free_info) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "Unable to free VL element")
vl->len--;
} /* end while */
} /* end if */
/* Free the VL sequence */
- if(free_func!=NULL)
- (*free_func)(vl->p,free_info);
+ if(free_func != NULL)
+ (*free_func)(vl->p, free_info);
else
H5MM_xfree(vl->p);
} /* end if */
- } else if(dt->shared->u.vlen.type==H5T_VLEN_STRING) {
+ } else if(dt->shared->u.vlen.type == H5T_VLEN_STRING) {
/* Free the VL string */
- if(free_func!=NULL)
- (*free_func)(*(char **)elem,free_info);
+ if(free_func != NULL)
+ (*free_func)(*(char **)elem, free_info);
else
H5MM_xfree(*(char **)elem);
} else {
@@ -1226,7 +1158,7 @@ H5T_vlen_reclaim(void *elem, hid_t type_id, unsigned UNUSED ndim, const hsize_t
{
H5T_vlen_alloc_info_t *vl_alloc_info = (H5T_vlen_alloc_info_t *)op_data; /* VL allocation info from iterator */
H5T_t *dt;
- herr_t ret_value;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5T_vlen_reclaim, FAIL)
@@ -1235,11 +1167,12 @@ H5T_vlen_reclaim(void *elem, hid_t type_id, unsigned UNUSED ndim, const hsize_t
HDassert(H5I_DATATYPE == H5I_get_type(type_id));
/* Check args */
- if (NULL==(dt=H5I_object_verify(type_id,H5I_DATATYPE)))
+ if(NULL == (dt = H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
/* Pull the free function and free info pointer out of the op_data and call the recurse datatype free function */
- ret_value=H5T_vlen_reclaim_recurse(elem,dt,vl_alloc_info->free_func,vl_alloc_info->free_info);
+ if(H5T_vlen_reclaim_recurse(elem, dt, vl_alloc_info->free_func, vl_alloc_info->free_info) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "can't reclaim vlen elements")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1289,13 +1222,13 @@ H5T_vlen_get_alloc_info(hid_t dxpl_id, H5T_vlen_alloc_info_t **vl_alloc_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
/* Get the allocation functions & information */
- if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_NAME,&(*vl_alloc_info)->alloc_func)<0)
+ if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_NAME,&(*vl_alloc_info)->alloc_func) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
- if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_INFO_NAME,&(*vl_alloc_info)->alloc_info)<0)
+ if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_INFO_NAME,&(*vl_alloc_info)->alloc_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
- if (H5P_get(plist,H5D_XFER_VLEN_FREE_NAME,&(*vl_alloc_info)->free_func)<0)
+ if (H5P_get(plist,H5D_XFER_VLEN_FREE_NAME,&(*vl_alloc_info)->free_func) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
- if (H5P_get(plist,H5D_XFER_VLEN_FREE_INFO_NAME,&(*vl_alloc_info)->free_info)<0)
+ if (H5P_get(plist,H5D_XFER_VLEN_FREE_INFO_NAME,&(*vl_alloc_info)->free_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
} /* end else */
@@ -1318,8 +1251,6 @@ done:
* Programmer: Mike McGreevy
* May 11, 2010
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1335,12 +1266,14 @@ H5T_vlen_reclaim_elmt(void *elem, H5T_t *dt, hid_t dxpl_id)
FUNC_ENTER_NOAPI(H5T_vlen_reclaim_elmt, FAIL)
/* Get VL allocation info */
- if (H5T_vlen_get_alloc_info(dxpl_id, &vl_alloc_info) < 0)
+ if(H5T_vlen_get_alloc_info(dxpl_id, &vl_alloc_info) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info")
/* Recurse on buffer to free dynamic fields */
- ret_value = H5T_vlen_reclaim_recurse(elem,dt,vl_alloc_info->free_func,vl_alloc_info->free_info);
+ if(H5T_vlen_reclaim_recurse(elem, dt, vl_alloc_info->free_func, vl_alloc_info->free_info) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "can't reclaim vlen elements")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5T_vlen_reclaim_elmt */
+
diff --git a/src/H5Z.c b/src/H5Z.c
index c295df3..ee46941 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -498,7 +498,7 @@ H5Z_prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id,
{
H5Z_class2_t *fclass; /* Individual filter information */
size_t u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5Z_prelude_callback)
@@ -526,17 +526,16 @@ H5Z_prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id,
/* Check if there is a "can apply" callback */
if(fclass->can_apply) {
/* Make callback to filter's "can apply" function */
- herr_t status = (fclass->can_apply)(dcpl_id, type_id, space_id);
+ htri_t status = (fclass->can_apply)(dcpl_id, type_id, space_id);
- /* Check return value */
- if(status <= 0) {
- /* Indicate filter can't apply to this combination of parameters */
- if(status == 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "filter parameters not appropriate")
- /* Indicate error during filter callback */
- else
- HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "error during user callback")
- } /* end if */
+ /* Indicate error during filter callback */
+ if(status < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "error during user callback")
+
+ /* Indicate filter can't apply to this combination of parameters.
+ * If the filter is NOT optional, returns failure. */
+ if(status == FALSE && !(pline->filter[u].flags & H5Z_FLAG_OPTIONAL))
+ HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "filter parameters not appropriate")
} /* end if */
break;
diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c
index c490720..598aa97 100644
--- a/src/H5Zdeflate.c
+++ b/src/H5Zdeflate.c
@@ -28,8 +28,11 @@
#ifdef H5_HAVE_FILTER_DEFLATE
-#ifdef H5_HAVE_ZLIB_H
-# include "zlib.h"
+#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER)
+# define H5_ZLIB_HEADER "zlib.h"
+#endif
+#if defined(H5_ZLIB_HEADER)
+# include H5_ZLIB_HEADER /* "zlib.h" */
#endif
/* Local function prototypes */
@@ -98,9 +101,9 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts,
/* Set the uncompression parameters */
HDmemset(&z_strm, 0, sizeof(z_strm));
- z_strm.next_in = *buf;
+ z_strm.next_in = (Bytef *)*buf;
H5_ASSIGN_OVERFLOW(z_strm.avail_in,nbytes,size_t,unsigned);
- z_strm.next_out = outbuf;
+ z_strm.next_out = (Bytef *)outbuf;
H5_ASSIGN_OVERFLOW(z_strm.avail_out,nalloc,size_t,unsigned);
/* Initialize the uncompression routines */
@@ -152,7 +155,7 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts,
/* Finish uncompressing the stream */
(void)inflateEnd(&z_strm);
- }
+ } /* end if */
else {
/*
* Output; compress but fail if the result would be larger than the
@@ -169,19 +172,20 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts,
H5_ASSIGN_OVERFLOW(aggression,cd_values[0],unsigned,int);
/* Allocate output (compressed) buffer */
- if (NULL==(z_dst=outbuf=H5MM_malloc(z_dst_nbytes)))
+ if(NULL == (outbuf = H5MM_malloc(z_dst_nbytes)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate deflate destination buffer")
+ z_dst = (Bytef *)outbuf;
/* Perform compression from the source to the destination buffer */
- status = compress2 (z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression);
+ status = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression);
/* Check for various zlib errors */
- if (Z_BUF_ERROR==status)
+ if(Z_BUF_ERROR == status)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "overflow")
- else if (Z_MEM_ERROR==status)
- HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, 0, "deflate memory error")
- else if (Z_OK!=status)
- HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, 0, "other deflate error")
+ else if(Z_MEM_ERROR == status)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "deflate memory error")
+ else if(Z_OK != status)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "other deflate error")
/* Successfully uncompressed the buffer */
else {
/* Free the input buffer */
@@ -192,8 +196,8 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts,
outbuf = NULL;
*buf_size = nbytes;
ret_value = z_dst_nbytes;
- }
- }
+ } /* end else */
+ } /* end else */
done:
if(outbuf)
diff --git a/src/H5Znbit.c b/src/H5Znbit.c
index 8f785a2..bcdd549 100644
--- a/src/H5Znbit.c
+++ b/src/H5Znbit.c
@@ -38,7 +38,7 @@ typedef struct {
} parms_atomic;
/* Local function prototypes */
-static herr_t H5Z_can_apply_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id);
+static htri_t H5Z_can_apply_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id);
static herr_t H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id);
static size_t H5Z_filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
size_t nbytes, size_t *buf_size, void **buf);
@@ -129,11 +129,11 @@ static unsigned parms_index = 0;
*
*-------------------------------------------------------------------------
*/
-static herr_t
+static htri_t
H5Z_can_apply_nbit(hid_t UNUSED dcpl_id, hid_t type_id, hid_t UNUSED space_id)
{
const H5T_t *type; /* Datatype */
- herr_t ret_value = TRUE; /* Return value */
+ htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI(H5Z_can_apply_nbit, FAIL)
diff --git a/src/H5Zpublic.h b/src/H5Zpublic.h
index 44d2bbb..5d9b5ed 100644
--- a/src/H5Zpublic.h
+++ b/src/H5Zpublic.h
@@ -158,7 +158,7 @@ extern "C" {
* The "can_apply" callback returns positive a valid combination, zero for an
* invalid combination and negative for an error.
*/
-typedef herr_t (*H5Z_can_apply_func_t)(hid_t dcpl_id, hid_t type_id, hid_t space_id);
+typedef htri_t (*H5Z_can_apply_func_t)(hid_t dcpl_id, hid_t type_id, hid_t space_id);
/*
* After the "can_apply" callbacks are checked for new datasets, the "set_local"
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
index 5737702..eb3c6e6 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -41,7 +41,7 @@ enum H5Z_scaleoffset_t {t_bad=0, t_uchar=1, t_ushort, t_uint, t_ulong, t_ulong_l
/* Local function prototypes */
static double H5Z_scaleoffset_rnd(double val);
-static herr_t H5Z_can_apply_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id);
+static htri_t H5Z_can_apply_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id);
static enum H5Z_scaleoffset_t H5Z_scaleoffset_get_type(unsigned dtype_class,
unsigned dtype_size, unsigned dtype_sign);
static herr_t H5Z_scaleoffset_set_parms_fillval(H5P_genplist_t *dcpl_plist,
@@ -611,13 +611,13 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
*
*-------------------------------------------------------------------------
*/
-static herr_t
+static htri_t
H5Z_can_apply_scaleoffset(hid_t UNUSED dcpl_id, hid_t type_id, hid_t UNUSED space_id)
{
const H5T_t *type; /* Datatype */
H5T_class_t dtype_class; /* Datatype's class */
H5T_order_t dtype_order; /* Datatype's endianness order */
- herr_t ret_value = TRUE; /* Return value */
+ htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI(H5Z_can_apply_scaleoffset, FAIL)
@@ -640,9 +640,9 @@ H5Z_can_apply_scaleoffset(hid_t UNUSED dcpl_id, hid_t type_id, hid_t UNUSED spac
/* Range check datatype's endianness order */
if(dtype_order != H5T_ORDER_LE && dtype_order != H5T_ORDER_BE)
- HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order")
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FALSE, "bad datatype endianness order")
} else
- HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "datatype class not supported by scaleoffset")
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FALSE, "datatype class not supported by scaleoffset")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -806,6 +806,11 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id)
if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+#ifdef H5_CLEAR_MEMORY
+ /* Initialize the parameters to a known state */
+ HDmemset(cd_values, 0, sizeof(cd_values));
+#endif /* H5_CLEAR_MEMORY */
+
/* Get the filter's current parameters */
if(H5P_get_filter_by_id(dcpl_plist, H5Z_FILTER_SCALEOFFSET, &flags, &cd_nelmts, cd_values, (size_t)0, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get scaleoffset parameters")
@@ -1182,6 +1187,14 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value
for(i = 0; i < sizeof(unsigned long long); i++)
((unsigned char *)outbuf)[5+i] = (unsigned char)((minval & ((unsigned long long)0xff << i*8)) >> i*8);
+#ifdef H5_CLEAR_MEMORY
+ /* Zero out remaining, unused bytes */
+ /* (Looks like an error in the original determination of how many
+ * bytes would be needed for parameters. - QAK, 2010/08/19)
+ */
+ HDmemset(outbuf + 13, 0, (size_t)8);
+#endif /* H5_CLEAR_MEMORY */
+
/* special case: minbits equal to full precision */
if(minbits == p.size * 8) {
HDmemcpy(outbuf + buf_offset, *buf, nbytes);
diff --git a/src/H5Zszip.c b/src/H5Zszip.c
index 5da92ac..52f5e11 100644
--- a/src/H5Zszip.c
+++ b/src/H5Zszip.c
@@ -34,7 +34,7 @@
#endif
/* Local function prototypes */
-static herr_t H5Z_can_apply_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id);
+static htri_t H5Z_can_apply_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id);
static herr_t H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id);
static size_t H5Z_filter_szip (unsigned flags, size_t cd_nelmts,
const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf);
@@ -76,13 +76,13 @@ H5Z_class2_t H5Z_SZIP[1] = {{
*
*-------------------------------------------------------------------------
*/
-static herr_t
+static htri_t
H5Z_can_apply_szip(hid_t UNUSED dcpl_id, hid_t type_id, hid_t UNUSED space_id)
{
const H5T_t *type; /* Datatype */
unsigned dtype_size; /* Datatype's size (in bits) */
H5T_order_t dtype_order; /* Datatype's endianness order */
- herr_t ret_value = TRUE; /* Return value */
+ htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI(H5Z_can_apply_szip, FAIL)
diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c
index 762b316..8028123 100644
--- a/src/H5Ztrans.c
+++ b/src/H5Ztrans.c
@@ -555,7 +555,7 @@ static H5Z_node *
H5Z_parse_expression(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
{
H5Z_node *expr;
- void* ret_value;
+ H5Z_node *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5Z_parse_expression)
@@ -566,7 +566,7 @@ H5Z_parse_expression(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
current = H5Z_get_token(current);
- switch (current->tok_type) {
+ switch(current->tok_type) {
case H5Z_XFORM_PLUS:
new_node = H5Z_new_node(H5Z_XFORM_PLUS);
@@ -612,6 +612,13 @@ H5Z_parse_expression(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
case H5Z_XFORM_END:
HGOTO_DONE(expr)
+ case H5Z_XFORM_ERROR:
+ case H5Z_XFORM_INTEGER:
+ case H5Z_XFORM_FLOAT:
+ case H5Z_XFORM_SYMBOL:
+ case H5Z_XFORM_MULT:
+ case H5Z_XFORM_DIVIDE:
+ case H5Z_XFORM_LPAREN:
default:
H5Z_xform_destroy_parse_tree(expr);
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression")
@@ -1101,54 +1108,69 @@ done:
static hid_t
H5Z_xform_find_type(const H5T_t* type)
{
- hid_t ret_value = SUCCEED;
+ H5T_t *tmp; /* Temporary datatype */
+ hid_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5Z_xform_find_type)
HDassert(type);
/* Check for SHORT type */
- if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_SHORT, H5I_DATATYPE), FALSE)) == 0)
+ if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_SHORT, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_SHORT)
/* Check for INT type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_INT, H5I_DATATYPE), FALSE)) == 0)
- HGOTO_DONE(H5T_NATIVE_INT)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_INT, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
+ HGOTO_DONE(H5T_NATIVE_INT)
/* Check for LONG type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_LONG, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_LONG, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_LONG)
/* Check for LONGLONG type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_LLONG, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_LLONG, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_LLONG)
/* Check for UCHAR type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_UCHAR, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_UCHAR, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_UCHAR)
/* Check for CHAR type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_CHAR, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_CHAR, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_CHAR)
/* Check for SCHAR type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_SCHAR, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_SCHAR, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_SCHAR)
/* Check for USHORT type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_USHORT, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_USHORT, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_USHORT)
/* Check for UINT type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_UINT, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_UINT, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_UINT)
/* Check for ULONG type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_ULONG, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_ULONG, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_ULONG)
/* Check for ULONGLONG type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_ULLONG, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_ULLONG, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_ULLONG)
/* Check for FLOAT type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_FLOAT, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_FLOAT, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_FLOAT)
/* Check for DOUBLE type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_DOUBLE, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_DOUBLE, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_DOUBLE)
#if H5_SIZEOF_LONG_DOUBLE !=0
/* Check for LONGDOUBLE type */
- else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_LDOUBLE, H5I_DATATYPE), FALSE)) == 0)
+ else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_LDOUBLE, H5I_DATATYPE))
+ && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_LDOUBLE)
#endif
else
diff --git a/src/H5config.h.in b/src/H5config.h.in
index 5c9e1f2..3283893 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -120,18 +120,21 @@
/* Define to 1 if you have the `frexpl' function. */
#undef HAVE_FREXPL
-/* Define to 1 if you have the `fseek64' function. */
-#undef HAVE_FSEEK64
-
/* Define to 1 if you have the `fseeko' function. */
#undef HAVE_FSEEKO
+/* Define to 1 if you have the `fseeko64' function. */
+#undef HAVE_FSEEKO64
+
/* Define to 1 if you have the `fstat64' function. */
#undef HAVE_FSTAT64
/* Define to 1 if you have the `ftello' function. */
#undef HAVE_FTELLO
+/* Define to 1 if you have the `ftello64' function. */
+#undef HAVE_FTELLO64
+
/* Define to 1 if you have the `ftruncate64' function. */
#undef HAVE_FTRUNCATE64
diff --git a/src/H5dbg.c b/src/H5dbg.c
index 196ed5b..632ac08 100644
--- a/src/H5dbg.c
+++ b/src/H5dbg.c
@@ -78,8 +78,8 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5_buffer_dump(FILE *stream, int indent, uint8_t *buf,
- uint8_t *marker, size_t buf_offset, size_t buf_size)
+H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf,
+ const uint8_t *marker, size_t buf_offset, size_t buf_size)
{
size_t u, v; /* Local index variable */
@@ -102,7 +102,7 @@ H5_buffer_dump(FILE *stream, int indent, uint8_t *buf,
for(u = 0; u < buf_size; u += 16) {
uint8_t c;
- HDfprintf(stream, "%*s %8d: ", indent, "", u);
+ HDfprintf(stream, "%*s %8d: ", indent, "", u + buf_offset);
/* Print the hex values */
for(v = 0; v < 16; v++) {
@@ -119,6 +119,7 @@ H5_buffer_dump(FILE *stream, int indent, uint8_t *buf,
if(7 == v)
HDfputc(' ', stream);
} /* end for */
+ HDfputc(' ', stream);
/* Print the character values */
for(v = 0; v < 16; v++) {
@@ -133,6 +134,8 @@ H5_buffer_dump(FILE *stream, int indent, uint8_t *buf,
HDfputc('.', stream);
} /* end else */
} /* end if */
+ if(7 == v)
+ HDfputc(' ', stream);
} /* end for */
HDfputc('\n', stream);
diff --git a/src/H5private.h b/src/H5private.h
index 5b8d123..3875fb3 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -480,8 +480,9 @@ typedef struct {
* function (or any other non-HDF5 function) in the source!
*/
- /* Use platform-specific versions if necessary */
-#include "H5win32defs.h"
+/* Put all platform-specific definitions in the following file */
+/* so that the following definitions are platform free. */
+#include "H5win32defs.h" /* For Windows-specific definitions */
#ifndef HDabort
#define HDabort() abort()
@@ -912,11 +913,14 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
#ifndef HDlongjmp
#define HDlongjmp(J,N) longjmp(J,N)
#endif /* HDlongjmp */
+/* HDlseek and HDoff_t must be defined together for consistency. */
#ifndef HDlseek
#ifdef H5_HAVE_LSEEK64
- #define HDlseek(F,O,W) lseek64(F,O,W)
+ #define HDlseek(F,O,W) lseek64(F,O,W)
+ #define HDoff_t off64_t
#else
- #define HDlseek(F,O,W) lseek(F,O,W)
+ #define HDlseek(F,O,W) lseek(F,O,W)
+ #define HDoff_t off_t
#endif
#endif /* HDlseek */
#ifndef HDmalloc
@@ -2338,8 +2342,8 @@ H5_DLL uint32_t H5_hash_string(const char *str);
H5_DLL herr_t H5_build_extpath(const char *, char ** /*out*/ );
/* Functions for debugging */
-H5_DLL herr_t H5_buffer_dump(FILE *stream, int indent, uint8_t *buf,
- uint8_t *marker, size_t buf_offset, size_t buf_size);
+H5_DLL herr_t H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf,
+ const uint8_t *marker, size_t buf_offset, size_t buf_size);
#endif /* _H5private_H */
diff --git a/src/H5win32defs.h b/src/H5win32defs.h
index 141ec82..d478e4c 100644
--- a/src/H5win32defs.h
+++ b/src/H5win32defs.h
@@ -56,6 +56,12 @@ typedef __int64 h5_stat_size_t;
#endif /* H5_HAVE_GETTIMEOFDAY */
#define HDgetdrive() _getdrive()
#define HDlseek(F,O,W) _lseeki64(F,O,W)
+#if !defined(__MWERKS__)
+# /*MSVC*/
+# define HDoff_t __int64
+#else
+# define HDoff_t off_t
+#endif
#define HDmemset(X,C,Z) memset((void*)(X),C,Z)
#define HDmkdir(S,M) _mkdir(S)
#define HDopen(S,F,M) _open(S,F|_O_BINARY,M)
diff --git a/src/Makefile.am b/src/Makefile.am
index e3f3cdc..5dd6b36 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -72,7 +72,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \
H5HG.c H5HGcache.c H5HGdbg.c \
H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c \
- H5HP.c H5I.c H5L.c H5Lexternal.c H5lib_settings.c \
+ H5HP.c H5I.c H5Itest.c H5L.c H5Lexternal.c H5lib_settings.c \
H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \
H5MM.c H5MP.c H5MPtest.c \
H5O.c H5Oainfo.c H5Oalloc.c H5Oattr.c \
diff --git a/src/Makefile.in b/src/Makefile.in
index 14a17bf..1fa47ad 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -123,8 +123,8 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \
H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo H5HFiblock.lo H5HFiter.lo \
H5HFman.lo H5HFsection.lo H5HFspace.lo H5HFstat.lo H5HFtest.lo \
H5HFtiny.lo H5HG.lo H5HGcache.lo H5HGdbg.lo H5HL.lo \
- H5HLcache.lo H5HLdbg.lo H5HLint.lo H5HP.lo H5I.lo H5L.lo \
- H5Lexternal.lo H5lib_settings.lo H5MF.lo H5MFaggr.lo \
+ H5HLcache.lo H5HLdbg.lo H5HLint.lo H5HP.lo H5I.lo H5Itest.lo \
+ H5L.lo H5Lexternal.lo H5lib_settings.lo H5MF.lo H5MFaggr.lo \
H5MFdbg.lo H5MFsection.lo H5MM.lo H5MP.lo H5MPtest.lo H5O.lo \
H5Oainfo.lo H5Oalloc.lo H5Oattr.lo H5Oattribute.lo H5Obogus.lo \
H5Obtreek.lo H5Ocache.lo H5Ochunk.lo H5Ocont.lo H5Ocopy.lo \
@@ -494,7 +494,7 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \
H5HG.c H5HGcache.c H5HGdbg.c \
H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c \
- H5HP.c H5I.c H5L.c H5Lexternal.c H5lib_settings.c \
+ H5HP.c H5I.c H5Itest.c H5L.c H5Lexternal.c H5lib_settings.c \
H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \
H5MM.c H5MP.c H5MPtest.c \
H5O.c H5Oainfo.c H5Oalloc.c H5Oattr.c \
@@ -811,6 +811,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HLint.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HP.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5I.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Itest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5L.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Lexternal.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5MF.Plo@am__quote@
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 772466a..6d9dee7 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required (VERSION 2.8)
-PROJECT (H5_TEST)
+PROJECT (HDF5_TEST)
#-----------------------------------------------------------------------------
# Define Sources
@@ -31,6 +31,90 @@ TARGET_LINK_LIBRARIES (${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TEST_LIB_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} ${LIB_TYPE})
+# --------------------------------------------------------------------
+# Copy all the HDF5 files from the test directory into the source directory
+# --------------------------------------------------------------------
+SET (HDF5_TEST_FILES
+ tnullspace.h5
+)
+
+FOREACH (h5_tfile ${HDF5_TEST_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/${h5_tfile}")
+ #MESSAGE (STATUS " Copying ${h5_tfile}")
+ ADD_CUSTOM_COMMAND (
+ TARGET ${HDF5_TEST_LIB_TARGET}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_tfile} ${dest}
+ )
+ENDFOREACH (h5_tfile ${HDF5_TEST_FILES})
+
+# --------------------------------------------------------------------
+# Copy all the HDF5 files from the test directory into the source directory
+# --------------------------------------------------------------------
+SET (HDF5_REFERENCE_FILES
+ err_compat_1
+ err_compat_2
+ error_test_1
+ error_test_2
+)
+
+FOREACH (ref_file ${HDF5_REFERENCE_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/testfiles/${ref_file}")
+ #MESSAGE (STATUS " Copying ${h5_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET ${HDF5_TEST_LIB_TARGET}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest}
+ )
+ENDFOREACH (ref_file ${HDF5_REFERENCE_FILES})
+
+# --------------------------------------------------------------------
+#-- Copy all the HDF5 files from the test directory into the source directory
+# --------------------------------------------------------------------
+SET (HDF5_REFERENCE_TEST_FILES
+ be_data.h5
+ be_extlink1.h5
+ be_extlink2.h5
+ corrupt_stab_msg.h5
+ deflate.h5
+ family_v16_00000.h5
+ family_v16_00001.h5
+ family_v16_00002.h5
+ family_v16_00003.h5
+ fill_old.h5
+ fixed_idx.h5
+ group_old.h5
+ le_data.h5
+ le_extlink1.h5
+ le_extlink2.h5
+ mergemsg.h5
+ noencoder.h5
+ specmetaread.h5
+ tarrold.h5
+ tbad_msg_count.h5
+ tbogus.h5
+ test_filters_be.hdf5
+ test_filters_le.hdf5
+ th5s.h5
+ tlayouto.h5
+ tmtimen.h5
+ tmtimeo.h5
+ vms_data.h5
+)
+
+FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ SET (dest "${HDF5_TEST_BINARY_DIR}/${h5_file}")
+ #MESSAGE (STATUS " Copying ${h5_file} to ${dest}")
+ ADD_CUSTOM_COMMAND (
+ TARGET ${HDF5_TEST_LIB_TARGET}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/${h5_file} ${dest}
+ )
+ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
SET (testhdf5_SRCS
${HDF5_TEST_SOURCE_DIR}/testhdf5.c
${HDF5_TEST_SOURCE_DIR}/tarray.c
@@ -75,6 +159,12 @@ ENDIF (WIN32)
TARGET_LINK_LIBRARIES (testhdf5 ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
ADD_TEST (NAME testhdf5 COMMAND $<TARGET_FILE:testhdf5>)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
MACRO (ADD_H5_TEST file)
ADD_EXECUTABLE (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c)
@@ -137,24 +227,28 @@ SET (H5_TESTS
earray
btree2
fheap
+ error_test
+ err_compat
+ tcheck_version
+ testmeta
)
FOREACH (test ${H5_TESTS})
ADD_H5_TEST(${test})
ENDFOREACH (test ${H5_TESTS})
-SET (H5_CHECK_TESTS
-)
-
-FOREACH (chktest ${H5_CHECK_TESTS})
- ADD_H5_TEST(${chktest})
-ENDFOREACH (chktest ${H5_CHECK_TESTS})
-
#-- Allow extra time for fheap to complete 30min
IF (WIN32)
SET_TESTS_PROPERTIES (fheap PROPERTIES TIMEOUT 2500)
ENDIF (WIN32)
+
+##############################################################################
+##############################################################################
+### A D D I T I O N A L T E S T S ###
+##############################################################################
+##############################################################################
+
#-- Adding test for cache
ADD_EXECUTABLE (cache ${HDF5_TEST_SOURCE_DIR}/cache.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c)
H5_NAMING (cache)
@@ -205,85 +299,53 @@ ENDIF (WIN32)
TARGET_LINK_LIBRARIES (cache_tagging ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
ADD_TEST (NAME cache_tagging COMMAND $<TARGET_FILE:cache_tagging>)
-
#-- Adding test for ttsafe
-SET (ttsafe_SRCS
- ttsafe.c
- ttsafe_dcreate.c
- ttsafe_error.c
- ttsafe_cancel.c
- ttsafe_acreate.c
+ADD_EXECUTABLE (ttsafe
+ ${HDF5_TEST_SOURCE_DIR}/ttsafe.c
+ ${HDF5_TEST_SOURCE_DIR}/ttsafe_dcreate.c
+ ${HDF5_TEST_SOURCE_DIR}/ttsafe_error.c
+ ${HDF5_TEST_SOURCE_DIR}/ttsafe_cancel.c
+ ${HDF5_TEST_SOURCE_DIR}/ttsafe_acreate.c
)
-
-ADD_EXECUTABLE (ttsafe ${ttsafe_SRCS})
H5_NAMING (ttsafe)
+IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (ttsafe
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
TARGET_LINK_LIBRARIES (ttsafe ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
ADD_TEST (NAME ttsafe COMMAND $<TARGET_FILE:ttsafe>)
-#-- Copy all the HDF5 files from the test directory into the source directory
-SET (HDF5_REFERENCE_TEST_FILES
- tnullspace.h5
-)
-
-FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
- SET (dest "${PROJECT_BINARY_DIR}/${h5_file}")
- #MESSAGE (STATUS " Copying ${h5_file}")
- ADD_CUSTOM_COMMAND (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5_file} ${dest}
- )
-ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
-
-
-#-- Copy all the HDF5 files from the test directory into the source directory
-SET (HDF5_REFERENCE_TEST_FILES
- be_data.h5
- be_extlink1.h5
- be_extlink2.h5
- corrupt_stab_msg.h5
- deflate.h5
- family_v16_00000.h5
- family_v16_00001.h5
- family_v16_00002.h5
- family_v16_00003.h5
- filespace_1_6.h5
- filespace_1_8.h5
- fill_old.h5
- group_old.h5
- le_data.h5
- le_extlink1.h5
- le_extlink2.h5
- mergemsg.h5
- noencoder.h5
- specmetaread.h5
- tarrold.h5
- tbad_msg_count.h5
- tbogus.h5
- test_filters_be.hdf5
- test_filters_le.hdf5
- th5s.h5
- tlayouto.h5
- tmtimen.h5
- tmtimeo.h5
- vms_data.h5
-)
+##############################################################################
+##############################################################################
+### T H E G E N E R A T O R S ###
+##############################################################################
+##############################################################################
-FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
- SET (dest "${H5_TEST_BINARY_DIR}/${h5_file}")
- #MESSAGE (STATUS " Copying ${h5_file} to ${dest}")
- ADD_CUSTOM_COMMAND (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${H5_TEST_SOURCE_DIR}/${h5_file} ${dest}
- )
-ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
+ MACRO (ADD_H5_GENERATOR genfile)
+ ADD_EXECUTABLE (${genfile} ${HDF5_TEST_SOURCE_DIR}/${genfile}.c)
+ H5_NAMING (${genfile})
+ IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (${genfile}
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (${genfile} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
+ ENDMACRO (ADD_H5_GENERATOR genfile)
-# generator executables
-IF (CREATE_GENERATORS)
+ # generator executables
SET (H5_GENERATORS
gen_bad_ohdr
gen_bogus
@@ -310,4 +372,5 @@ IF (CREATE_GENERATORS)
TARGET_LINK_LIBRARIES (${gen} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
ENDFOREACH (gen ${H5_GENERATORS})
-ENDIF (CREATE_GENERATORS)
+ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
+
diff --git a/test/big.c b/test/big.c
index dde9d7a..8d65559 100644
--- a/test/big.c
+++ b/test/big.c
@@ -32,8 +32,7 @@ const char *FILENAME[] = {
#define WRT_SIZE 4*1024
#define FAMILY_SIZE 1024*1024*1024
-/* Define big file as 2GB */
-#define BIG_FILE (off_t)0x80000000UL
+#define GB (HDoff_t)0x40000000L
#define MAX_TRIES 100
@@ -165,15 +164,15 @@ supports_big(void)
if ((fd=HDopen("y.h5", O_RDWR|O_TRUNC|O_CREAT, 0666)) < 0) return 0;
/* Write a few bytes at 2GB */
- if (HDlseek(fd, BIG_FILE, SEEK_SET)!=BIG_FILE) return 0;
+ if (HDlseek(fd, 2*GB, SEEK_SET)!=2*GB) return 0;
if (5!=HDwrite(fd, "hello", (size_t)5)) return 0;
/* Write a few bytes at 4GB */
- if (HDlseek(fd, 2*BIG_FILE, SEEK_SET) != 2*BIG_FILE) return 0;
+ if (HDlseek(fd, 4*GB, SEEK_SET) != 4*GB) return 0;
if (5!=HDwrite(fd, "hello", (size_t)5)) return 0;
if (HDclose(fd) < 0) return 0;
- if (HDunlink("y.h5") < 0) return 0;
+ if (HDremove("y.h5") < 0) return 0;
return (1);
}
diff --git a/test/cache_common.c b/test/cache_common.c
index 312de3d..e6dd020 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -2694,8 +2694,6 @@ setup_cache(size_t max_cache_size,
H5C_stats__reset(cache_ptr);
- H5C_set_skip_flags(cache_ptr, TRUE, TRUE);
-
ret_val = file_ptr;
}
diff --git a/test/cache_tagging.c b/test/cache_tagging.c
index cc1b37c..9aef651 100644
--- a/test/cache_tagging.c
+++ b/test/cache_tagging.c
@@ -3836,7 +3836,7 @@ check_invalid_tag_application(void)
/* Create dxpl */
if ( (dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR;
- /* Call H5HL_create, an internal function that calls H5AC_set without setting up a tag */
+ /* Call H5HL_create, an internal function that calls H5AC_insert_entry without setting up a tag */
/* Ensure this returns FAILURE, as a tag has not been set up. */
if ( H5HL_create(f, H5AC_ind_dxpl_id, (size_t)1024, &addr) >= 0) TEST_ERROR;
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index d565e82..08890a8 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -1811,18 +1811,18 @@ test_pack_ooo(void)
TESTING("random member insertion with empty compound subtype");
/* Create inner compound type. It will be empty for the first run */
- if((sub_cmpd = H5Tcreate(H5T_COMPOUND, 4)) < 0) PACK_OOO_ERROR
+ if((sub_cmpd = H5Tcreate(H5T_COMPOUND, (size_t)4)) < 0) PACK_OOO_ERROR
/* Create main compound type, with extra space at the end */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
/* Insert the compound members in the random order previously generated */
for(i=0; i<PACK_NMEMBS; i++) {
sprintf(name, "%05d", i);
if(i == sub_cmpd_order) {
- if(H5Tinsert(cmpd, name, 4 * order[i], sub_cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * order[i]), sub_cmpd) < 0) PACK_OOO_ERROR
} else
- if(H5Tinsert(cmpd, name, 4 * order[i], H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * order[i]), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is not packed */
@@ -1837,18 +1837,18 @@ test_pack_ooo(void)
TESTING("random member insertion with full compound subtype");
/* Complete the inner compound type */
- if(H5Tinsert(sub_cmpd, "int", 0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(sub_cmpd, "int", (size_t)0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
/* Recreate main compound type */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
/* Insert the compound members in the random order previously generated */
for(i=0; i<PACK_NMEMBS; i++) {
sprintf(name, "%05d", i);
if(i == sub_cmpd_order) {
- if(H5Tinsert(cmpd, name, 4 * order[i], sub_cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * order[i]), sub_cmpd) < 0) PACK_OOO_ERROR
} else
- if(H5Tinsert(cmpd, name, 4 * order[i], H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * order[i]), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is not packed */
@@ -1864,18 +1864,18 @@ test_pack_ooo(void)
TESTING("reverse member insertion with empty compound subtype");
/* Create inner compound type. It will be empty for the first run */
- if((sub_cmpd = H5Tcreate(H5T_COMPOUND, 4)) < 0) PACK_OOO_ERROR
+ if((sub_cmpd = H5Tcreate(H5T_COMPOUND, (size_t)4)) < 0) PACK_OOO_ERROR
/* Create main compound type, with extra space at the end */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
/* Insert the compound members in reverse order, with compound last */
for(i=0; i<PACK_NMEMBS; i++) {
sprintf(name, "%05d", i);
if(i == PACK_NMEMBS - 1) {
- if(H5Tinsert(cmpd, name, 4 * (PACK_NMEMBS - i - 1), sub_cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), sub_cmpd) < 0) PACK_OOO_ERROR
} else
- if(H5Tinsert(cmpd, name, 4 * (PACK_NMEMBS - i - 1), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is not packed */
@@ -1890,18 +1890,18 @@ test_pack_ooo(void)
TESTING("reverse member insertion with full compound subtype");
/* Complete the inner compound type */
- if(H5Tinsert(sub_cmpd, "int", 0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(sub_cmpd, "int", (size_t)0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
/* Recreate main compound type */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
/* Insert the compound members in reverse order, with compound last */
for(i=0; i<PACK_NMEMBS; i++) {
sprintf(name, "%05d", i);
if(i == PACK_NMEMBS - 1) {
- if(H5Tinsert(cmpd, name, 4 * (PACK_NMEMBS - i - 1), sub_cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), sub_cmpd) < 0) PACK_OOO_ERROR
} else
- if(H5Tinsert(cmpd, name, 4 * (PACK_NMEMBS - i - 1), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is packed */
@@ -1917,18 +1917,18 @@ test_pack_ooo(void)
TESTING("forward member insertion with empty compound subtype");
/* Create inner compound type. It will be empty for the first run */
- if((sub_cmpd = H5Tcreate(H5T_COMPOUND, 4)) < 0) PACK_OOO_ERROR
+ if((sub_cmpd = H5Tcreate(H5T_COMPOUND, (size_t)4)) < 0) PACK_OOO_ERROR
/* Create main compound type, with extra space at the end */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
/* Insert the compound members in forward order, with compound first */
for(i=0; i<PACK_NMEMBS; i++) {
sprintf(name, "%05d", i);
if(i == 0) {
- if(H5Tinsert(cmpd, name, 4 * i, sub_cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * i), sub_cmpd) < 0) PACK_OOO_ERROR
} else
- if(H5Tinsert(cmpd, name, 4 * i, H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * i), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is not packed */
@@ -1943,18 +1943,18 @@ test_pack_ooo(void)
TESTING("forward member insertion with full compound subtype");
/* Complete the inner compound type */
- if(H5Tinsert(sub_cmpd, "int", 0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(sub_cmpd, "int", (size_t)0, H5T_STD_I32LE) < 0) PACK_OOO_ERROR
/* Recreate main compound type */
- if((cmpd = H5Tcreate(H5T_COMPOUND, (4 * PACK_NMEMBS) + extra_space)) < 0) PACK_OOO_ERROR
+ if((cmpd = H5Tcreate(H5T_COMPOUND, (size_t)((4 * PACK_NMEMBS) + extra_space))) < 0) PACK_OOO_ERROR
/* Insert the compound members in forward order */
for(i=0; i<PACK_NMEMBS; i++) {
sprintf(name, "%05d", i);
if(i == 0) {
- if(H5Tinsert(cmpd, name, 4 * i, sub_cmpd) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * i), sub_cmpd) < 0) PACK_OOO_ERROR
} else
- if(H5Tinsert(cmpd, name, 4 * i, H5T_STD_I32BE) < 0) PACK_OOO_ERROR
+ if(H5Tinsert(cmpd, name, (size_t)(4 * i), H5T_STD_I32BE) < 0) PACK_OOO_ERROR
} /* end for */
/* Verify that the compound is packed */
@@ -2010,11 +2010,11 @@ test_ooo_order(char *filename)
TEST_ERROR
/* Create the compound */
- if((dtype = H5Tcreate(H5T_COMPOUND, 20)) < 0) TEST_ERROR
- if(H5Tinsert(dtype, "A", 8, H5T_STD_I32LE) < 0) TEST_ERROR
- if(H5Tinsert(dtype, "B", 12, H5T_STD_I32LE) < 0) TEST_ERROR
- if(H5Tinsert(dtype, "C", 0, H5T_STD_I32LE) < 0) TEST_ERROR
- if(H5Tinsert(dtype, "D", 16, H5T_STD_I32LE) < 0) TEST_ERROR
+ if((dtype = H5Tcreate(H5T_COMPOUND, (size_t)20)) < 0) TEST_ERROR
+ if(H5Tinsert(dtype, "A", (size_t)8, H5T_STD_I32LE) < 0) TEST_ERROR
+ if(H5Tinsert(dtype, "B", (size_t)12, H5T_STD_I32LE) < 0) TEST_ERROR
+ if(H5Tinsert(dtype, "C", (size_t)0, H5T_STD_I32LE) < 0) TEST_ERROR
+ if(H5Tinsert(dtype, "D", (size_t)16, H5T_STD_I32LE) < 0) TEST_ERROR
/* Verify that the compound is not packed */
if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
@@ -2065,7 +2065,7 @@ test_ooo_order(char *filename)
if(H5Tget_member_offset(dtype, 3) != 16) TEST_ERROR
/* Insert the last member */
- if(H5Tinsert(dtype, "E", 4, H5T_STD_I32LE) < 0) TEST_ERROR
+ if(H5Tinsert(dtype, "E", (size_t)4, H5T_STD_I32LE) < 0) TEST_ERROR
/* Verify that the compound is packed */
if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
@@ -2112,7 +2112,7 @@ test_ooo_order(char *filename)
if(H5Tget_member_offset(dtype, 4) != 4) TEST_ERROR
/* Expand the type, and verify that it became unpacked */
- if(H5Tset_size(dtype, 21) < 0) TEST_ERROR
+ if(H5Tset_size(dtype, (size_t)21) < 0) TEST_ERROR
if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
TEST_ERROR
if(dt->shared->u.compnd.packed) TEST_ERROR
@@ -2123,7 +2123,7 @@ test_ooo_order(char *filename)
if(H5Tget_member_offset(dtype, 4) != 4) TEST_ERROR
/* Shrink the type, and verify that it became packed */
- if(H5Tset_size(dtype, 20) < 0) TEST_ERROR
+ if(H5Tset_size(dtype, (size_t)20) < 0) TEST_ERROR
if(NULL == (dt = (H5T_t *) H5I_object_verify(dtype, H5I_DATATYPE)))
TEST_ERROR
if(!dt->shared->u.compnd.packed) TEST_ERROR
diff --git a/test/dsets.c b/test/dsets.c
index a0a1f39..3d42efc 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -60,6 +60,7 @@ const char *FILENAME[] = {
"chunk_fixed", /* 12 */
"copy_dcpl_newfile",/* 13 */
"partial_chunks", /* 14 */
+ "layout_extend",
NULL
};
#define FILENAME_BUF_SIZE 1024
@@ -78,20 +79,27 @@ const char *FILENAME[] = {
#define DSET_CONV_BUF_NAME "conv_buf"
#define DSET_TCONV_NAME "tconv"
#define DSET_DEFLATE_NAME "deflate"
+#ifdef H5_HAVE_FILTER_SZIP
#define DSET_SZIP_NAME "szip"
+#endif /* H5_HAVE_FILTER_SZIP */
#define DSET_SHUFFLE_NAME "shuffle"
#define DSET_FLETCHER32_NAME "fletcher32"
#define DSET_FLETCHER32_NAME_2 "fletcher32_2"
#define DSET_FLETCHER32_NAME_3 "fletcher32_3"
#define DSET_SHUF_DEF_FLET_NAME "shuffle+deflate+fletcher32"
#define DSET_SHUF_DEF_FLET_NAME_2 "shuffle+deflate+fletcher32_2"
+#if defined H5_HAVE_FILTER_SZIP && defined H5_HAVE_FILTER_SHUFFLE && defined H5_HAVE_FILTER_FLETCHER32
#define DSET_SHUF_SZIP_FLET_NAME "shuffle+szip+fletcher32"
#define DSET_SHUF_SZIP_FLET_NAME_2 "shuffle+szip+fletcher32_2"
+#endif /* defined H5_HAVE_FILTER_SZIP && defined H5_HAVE_FILTER_SHUFFLE && defined H5_HAVE_FILTER_FLETCHER32 */
#define DSET_BOGUS_NAME "bogus"
#define DSET_MISSING_NAME "missing"
#define DSET_CAN_APPLY_NAME "can_apply"
+#define DSET_CAN_APPLY_NAME2 "can_apply2"
+#ifdef H5_HAVE_FILTER_SZIP
#define DSET_CAN_APPLY_SZIP_NAME "can_apply_szip"
+#endif /* H5_HAVE_FILTER_SZIP */
#define DSET_SET_LOCAL_NAME "set_local"
#define DSET_SET_LOCAL_NAME_2 "set_local_2"
#define DSET_ONEBYTE_SHUF_NAME "onebyte_shuffle"
@@ -136,7 +144,8 @@ const char *FILENAME[] = {
#define H5Z_FILTER_SET_LOCAL_TEST 308
#define H5Z_FILTER_DEPREC 309
#define H5Z_FILTER_EXPAND 310
-#define H5Z_FILTER_COUNT 311
+#define H5Z_FILTER_CAN_APPLY_TEST2 311
+#define H5Z_FILTER_COUNT 312
/* Flags for testing filters */
#define DISABLE_FLETCHER32 0
@@ -232,10 +241,12 @@ const char *OLD_FILENAME[] = { /* Files created under 1.6 branch and 1.8 branch
/* Local prototypes for filter functions */
static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
-static herr_t can_apply_bogus(hid_t dcpl_id, hid_t type_id, hid_t space_id);
+static htri_t can_apply_bogus(hid_t dcpl_id, hid_t type_id, hid_t space_id);
static herr_t set_local_bogus2(hid_t dcpl_id, hid_t type_id, hid_t space_id);
static size_t filter_bogus2(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t filter_bogus3(unsigned int flags, size_t cd_nelmts,
+ const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
static size_t filter_corrupt(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
static size_t filter_expand(unsigned int flags, size_t cd_nelmts,
@@ -921,6 +932,132 @@ error:
/*-------------------------------------------------------------------------
+ * Function: test_layout_extend
+ *
+ * Purpose: Verify that the creation of extendible dataset with dataspace:
+ * cur_dims < max_dims (max_dims can be fixed size or H5S_UNLIMITED)
+ * will behave as follows:
+ * H5D_COMPACT layout: fail
+ * H5D_CONTIGUOUS layout: fail
+ * H5D_CHUNKED layout: succeed
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Vailin Choi; August 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_layout_extend(hid_t fapl)
+{
+ char filename[FILENAME_BUF_SIZE]; /* File name */
+ hid_t fid; /* File id */
+ hid_t sid_fix, sid_unlim; /* Dataspace id */
+ hid_t dcpl_compact, dcpl_contig, dcpl_chunked; /* Dataset creation property list id */
+ hid_t did_fixed, did_unlim; /* Dataset id */
+ hsize_t cur_size[1] = {10}; /* Current size of dataspace */
+ hsize_t max_unlim[1] = {H5S_UNLIMITED}; /* Maximum size of dataspace (unlimited) */
+ hsize_t max_fix[1] = {100}; /* Maximum size of dataspace (fixed) */
+ hsize_t chunk_dim[1] = {10}; /* Chunk size */
+
+ TESTING("extendible dataset with various layout");
+
+ /* Create a file */
+ h5_fixname(FILENAME[12], fapl, filename, sizeof filename);
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create dataspace */
+ if((sid_fix = H5Screate_simple(1, cur_size, max_fix)) < 0)
+ FAIL_STACK_ERROR
+ if((sid_unlim = H5Screate_simple(1, cur_size, max_unlim)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create property list for compact dataset creation */
+ if((dcpl_compact = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_layout(dcpl_compact, H5D_COMPACT) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create dataset with extendible dataspace (fixed max_dims) should fail */
+ H5E_BEGIN_TRY {
+ if(H5Dcreate2(fid, "compact", H5T_NATIVE_INT, sid_fix, H5P_DEFAULT, dcpl_compact, H5P_DEFAULT) != FAIL)
+ TEST_ERROR
+ } H5E_END_TRY;
+
+ /* Create dataset with extendible dataspace (unlimited max_dims) should fail */
+ H5E_BEGIN_TRY {
+ if(H5Dcreate2(fid, "compact", H5T_NATIVE_INT, sid_unlim, H5P_DEFAULT, dcpl_compact, H5P_DEFAULT) != FAIL)
+ TEST_ERROR
+ } H5E_END_TRY;
+
+ /* Create property list for contiguous dataset creation */
+ if((dcpl_contig = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if((H5Pset_layout(dcpl_contig, H5D_CONTIGUOUS)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create dataset with extendible dataspace (fixed max_dims) should fail */
+ H5E_BEGIN_TRY {
+ if(H5Dcreate2(fid, "contig", H5T_NATIVE_INT, sid_fix, H5P_DEFAULT, dcpl_contig, H5P_DEFAULT) != FAIL)
+ TEST_ERROR
+ } H5E_END_TRY;
+
+ /* Create dataset with extendible dataspace (unlimited max_dims) should fail*/
+ H5E_BEGIN_TRY {
+ if(H5Dcreate2(fid, "contig", H5T_NATIVE_INT, sid_unlim, H5P_DEFAULT, dcpl_contig, H5P_DEFAULT) != FAIL)
+ TEST_ERROR
+ } H5E_END_TRY;
+
+ /* Create property list for chunked dataset creation */
+ if((dcpl_chunked = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_layout(dcpl_chunked, H5D_CHUNKED) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dcpl_chunked, 1, chunk_dim) < 0) FAIL_STACK_ERROR
+
+ /* Create dataset with extendible dataspace (fixed max_dims) should succeed */
+ if((did_fixed = H5Dcreate2(fid, "chunked_fixed", H5T_NATIVE_INT, sid_fix, H5P_DEFAULT, dcpl_chunked, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create dataset with extendible dataspace (unlimited max_dims) should succeed */
+ if((did_unlim = H5Dcreate2(fid, "chunked_unlim", H5T_NATIVE_INT, sid_unlim, H5P_DEFAULT, dcpl_chunked, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Closing */
+ if(H5Sclose(sid_fix) < 0) FAIL_STACK_ERROR
+ if(H5Sclose(sid_unlim) < 0) FAIL_STACK_ERROR
+
+ if(H5Pclose(dcpl_compact) < 0) FAIL_STACK_ERROR
+ if(H5Pclose(dcpl_contig) < 0) FAIL_STACK_ERROR
+ if(H5Pclose(dcpl_chunked) < 0) FAIL_STACK_ERROR
+
+ if(H5Dclose(did_fixed) < 0) FAIL_STACK_ERROR
+ if(H5Dclose(did_unlim) < 0) FAIL_STACK_ERROR
+
+ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Sclose(sid_fix);
+ H5Sclose(sid_unlim);
+ H5Pclose(dcpl_compact);
+ H5Pclose(dcpl_contig);
+ H5Pclose(dcpl_chunked);
+ H5Dclose(did_fixed);
+ H5Dclose(did_unlim);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ return -1;
+} /* end test_layout_extend() */
+
+
+/*-------------------------------------------------------------------------
* Function: test_conv_buffer
*
* Purpose: Test size of data type conversion buffer.
@@ -1003,8 +1140,8 @@ test_conv_buffer(hid_t fid)
if((arr_type3 = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, dimsc)) < 0) goto error;
if(H5Tinsert(ctype1, "A", HOFFSET(CmpField, a), arr_type1) < 0) goto error;
- if(H5Tinsert (ctype1, "B", HOFFSET(CmpField, b), arr_type2) < 0) goto error;
- if(H5Tinsert (ctype1, "C", HOFFSET(CmpField, c), arr_type3) < 0) goto error;
+ if(H5Tinsert(ctype1, "B", HOFFSET(CmpField, b), arr_type2) < 0) goto error;
+ if(H5Tinsert(ctype1, "C", HOFFSET(CmpField, c), arr_type3) < 0) goto error;
/* Create the dataset */
if((dataset = H5Dcreate2(fid, DSET_CONV_BUF_NAME, ctype1, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
@@ -1015,18 +1152,18 @@ test_conv_buffer(hid_t fid)
if((arr_type4 = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, dimsb)) < 0) goto error;
if((arr_type5 = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, dimsc)) < 0) goto error;
- if(H5Tinsert (ctype2, "B", HOFFSET(CmpFieldR, b), arr_type4) < 0) goto error;
- if(H5Tinsert (ctype2, "C", HOFFSET(CmpFieldR, c), arr_type5) < 0) goto error;
+ if(H5Tinsert(ctype2, "B", HOFFSET(CmpFieldR, b), arr_type4) < 0) goto error;
+ if(H5Tinsert(ctype2, "C", HOFFSET(CmpFieldR, c), arr_type5) < 0) goto error;
/* Read should succeed since library will set conversion buffer big enough */
cfrR = (CmpFieldR *)HDcalloc((size_t)1, sizeof(CmpFieldR));
if(H5Dread(dataset, ctype2, H5S_ALL, H5S_ALL, H5P_DEFAULT, cfrR) < 0) goto error;
/* Read should fail since conversion buffer isn't big enough */
- xfer_list = H5Pcreate (H5P_DATASET_XFER);
- size = (DIM2*DIM3*(sizeof(int))+ DIM2*(sizeof(float))+
- DIM3*(sizeof(double)));
- if(H5Pset_buffer (xfer_list, size, NULL, NULL) < 0) goto error;
+ xfer_list = H5Pcreate(H5P_DATASET_XFER);
+ size = (DIM2 * DIM3 * (sizeof(int))+ DIM2 * (sizeof(float))+
+ DIM3 * (sizeof(double)));
+ if(H5Pset_buffer(xfer_list, size, NULL, NULL) < 0) goto error;
H5E_BEGIN_TRY {
status = H5Dread(dataset, ctype2, H5S_ALL, H5S_ALL, xfer_list, cfrR);
@@ -1038,9 +1175,9 @@ test_conv_buffer(hid_t fid)
}
/* Read will succeed since conversion buffer is big enough */
- size = (DIM1*DIM2*DIM3*(sizeof(int))+ DIM2*(sizeof(float))+
- DIM3*(sizeof(double)));
- if(H5Pset_buffer (xfer_list, size, NULL, NULL) < 0) goto error;
+ size = (DIM1 * DIM2 * DIM3 * (sizeof(int))+ DIM2 * (sizeof(float))+
+ DIM3 * (sizeof(double)));
+ if(H5Pset_buffer(xfer_list, size, NULL, NULL) < 0) goto error;
if(H5Dread(dataset, ctype2, H5S_ALL, H5S_ALL, xfer_list, cfrR) < 0) goto error;
@@ -1186,13 +1323,15 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{
*
*-------------------------------------------------------------------------
*/
-static herr_t
+static htri_t
can_apply_bogus(hid_t UNUSED dcpl_id, hid_t type_id, hid_t UNUSED space_id)
{
if(H5Tequal(type_id,H5T_NATIVE_DOUBLE))
return 0;
- else
+ else if(H5Tequal(type_id,H5T_NATIVE_INT))
return 1;
+ else
+ return -1;
}
@@ -1332,6 +1471,31 @@ filter_bogus2(unsigned int flags, size_t cd_nelmts,
return(nbytes);
}
+
+/*-------------------------------------------------------------------------
+ * Function: filter_bogus3
+ *
+ * Purpose: A bogus compression method that returns a failure.
+ *
+ * Return: Success: Data chunk size
+ *
+ * Failure: 0
+ *
+ * Programmer: Raymond Lu
+ * 4 August 2010
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static size_t
+filter_bogus3(unsigned int UNUSED flags, size_t UNUSED cd_nelmts,
+ const unsigned int UNUSED *cd_values, size_t UNUSED nbytes,
+ size_t UNUSED *buf_size, void UNUSED **buf)
+{
+ return 0;
+}
+
/* This message derives from H5Z */
const H5Z_class2_t H5Z_CORRUPT[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
@@ -2426,7 +2590,7 @@ test_missing_filter(hid_t file)
} /* end if */
/* Query the dataset's size on disk */
- if((dset_size=H5Dget_storage_size(dsid))==0) {
+ if(0 == (dset_size = H5Dget_storage_size(dsid))) {
H5_FAILED();
printf(" Line %d: Error querying dataset size, dset_size=%lu\n",__LINE__,(unsigned long)dset_size);
goto error;
@@ -2434,7 +2598,7 @@ test_missing_filter(hid_t file)
/* Verify that the size indicates data is uncompressed */
/* (i.e. the deflation filter we asked for was silently ignored) */
- if((H5Tget_size(H5T_NATIVE_INT)*DSET_DIM1*DSET_DIM2)!=dset_size) {
+ if((H5Tget_size(H5T_NATIVE_INT) * DSET_DIM1 * DSET_DIM2) != dset_size) {
H5_FAILED();
printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size);
goto error;
@@ -3305,11 +3469,6 @@ test_nbit_compound(hid_t file)
if(H5Tinsert(mem_cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
if(H5Tinsert(mem_cmpd_tid, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0) goto error;
- /* Set order of dataset compound member datatype */
- if(H5Tset_order(i_tid, H5T_ORDER_BE) < 0) goto error;
- if(H5Tset_order(c_tid, H5T_ORDER_BE) < 0) goto error;
- if(H5Tset_order(s_tid, H5T_ORDER_BE) < 0) goto error;
-
/* Create a dataset compound datatype and insert some atomic types */
cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic));
if(H5Tinsert(cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0) goto error;
@@ -3317,6 +3476,9 @@ test_nbit_compound(hid_t file)
if(H5Tinsert(cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
if(H5Tinsert(cmpd_tid, "f", HOFFSET(atomic, f), f_tid) < 0) goto error;
+ /* Set order of dataset compound datatype */
+ if(H5Tset_order(cmpd_tid, H5T_ORDER_BE) < 0) goto error;
+
/* Create the data space */
if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
@@ -3521,11 +3683,6 @@ test_nbit_compound_2(hid_t file)
if(H5Tinsert(mem_cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
if(H5Tinsert(mem_cmpd_tid1, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0) goto error;
- /* Set order of dataset atomic compound member datatype */
- if(H5Tset_order(i_tid, H5T_ORDER_BE) < 0) goto error;
- if(H5Tset_order(c_tid, H5T_ORDER_BE) < 0) goto error;
- if(H5Tset_order(s_tid, H5T_ORDER_BE) < 0) goto error;
-
/* Create a dataset atomic compound datatype and insert some atomic types */
cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic));
if(H5Tinsert(cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0) goto error;
@@ -3533,6 +3690,9 @@ test_nbit_compound_2(hid_t file)
if(H5Tinsert(cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
if(H5Tinsert(cmpd_tid1, "f", HOFFSET(atomic, f), f_tid) < 0) goto error;
+ /* Set order of dataset compound datatype */
+ if(H5Tset_order(cmpd_tid1, H5T_ORDER_BE) < 0) goto error;
+
/* Set precision and offset of the other data member */
if(H5Tset_precision(v_tid,precision[3]) < 0) goto error;
if(H5Tset_offset(v_tid,offset[3]) < 0) goto error;
@@ -3806,6 +3966,7 @@ test_nbit_compound_3(hid_t file)
/* Initialize data */
for(i = 0; i < (size_t)size[0]; i++) {
+ HDmemset(&orig_data[i], 0, sizeof(orig_data[i]));
orig_data[i].i = HDrandom() % (long)HDpow(2.0, 17.0 - 1.0);
HDstrcpy(orig_data[i].str, "fixed-length C string");
orig_data[i].vl_str = HDstrdup("variable-length C string");
@@ -4938,7 +5099,9 @@ const H5Z_class2_t H5Z_CAN_APPLY_TEST[1] = {{
* Function: test_can_apply
*
* Purpose: Tests library behavior when filter indicates it can't
- * apply to certain combinations of creation parameters
+ * apply to certain combinations of creation parameters.
+ * The filter is mandate. If the CAN_APPLY callback function
+ * indicates wrong datatype, the dataset creation should fail.
*
* Return: Success: 0
* Failure: -1
@@ -4977,6 +5140,7 @@ test_can_apply(hid_t file)
printf(" Line %d: Can't register 'can apply' filter\n",__LINE__);
goto error;
}
+ /* The filter is mandate. */
if(H5Pset_filter(dcpl, H5Z_FILTER_CAN_APPLY_TEST, 0, (size_t)0, NULL) < 0) {
H5_FAILED();
printf(" Line %d: Can't set bogus filter\n",__LINE__);
@@ -4991,7 +5155,8 @@ test_can_apply(hid_t file)
} /* end if */
/* Create new dataset */
- /* (Should fail because the 'can apply' filter should indicate inappropriate combination) */
+ /* (Should fail because the 'can apply' function should indicate inappropriate
+ * combination. And the filter is mandate.) */
H5E_BEGIN_TRY {
dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
} H5E_END_TRY;
@@ -5002,6 +5167,17 @@ test_can_apply(hid_t file)
goto error;
} /* end if */
+ /* (Should fail because the 'can apply' function should fail) */
+ H5E_BEGIN_TRY {
+ dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(dsid >=0) {
+ H5_FAILED();
+ printf(" Line %d: Shouldn't have created dataset!\n",__LINE__);
+ H5Dclose(dsid);
+ goto error;
+ } /* end if */
+
/* Create new dataset */
if((dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
H5_FAILED();
@@ -5088,6 +5264,166 @@ error:
return -1;
} /* end test_can_apply() */
+/* This message derives from H5Z */
+const H5Z_class2_t H5Z_CAN_APPLY_TEST2[1] = {{
+ H5Z_CLASS_T_VERS,
+ H5Z_FILTER_CAN_APPLY_TEST2, /* Filter id number */
+ 1, 1,
+ "can_apply_test", /* Filter name for debugging */
+ can_apply_bogus, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ filter_bogus3, /* The actual filter function */
+}};
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_can_apply2
+ *
+ * Purpose: Tests library behavior when an optional filter indicates
+ * it can't apply to certain combinations of creation
+ * parameters. The filter function FILTER_BOGUS3 does nothing
+ * than returning a failure. Because the filter is optional,
+ * the library skips the filter even though the CAN_APPLY_BOGUS
+ * indicates the datatype DOUBLE can't apply to the dataset.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Raymond Lu
+ * 4 August 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_can_apply2(hid_t file)
+{
+ hid_t dsid; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t dcpl; /* Dataspace creation property list ID */
+ const hsize_t dims[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
+ const hsize_t chunk_dims[2] = {2, 25}; /* Chunk dimensions */
+ hsize_t dset_size; /* Dataset size */
+ size_t i,j; /* Local index variables */
+
+ TESTING("dataset filter 'can apply' callback second");
+
+ /* Create dcpl with special filter */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Can't create dcpl\n",__LINE__);
+ goto error;
+ } /* end if */
+ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Can't set chunk sizes\n",__LINE__);
+ goto error;
+ } /* end if */
+ if(H5Zregister (H5Z_CAN_APPLY_TEST2) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Can't register 'can apply' filter\n",__LINE__);
+ goto error;
+ }
+ /* The filter is optional. */
+ if(H5Pset_filter(dcpl, H5Z_FILTER_CAN_APPLY_TEST2, H5Z_FLAG_OPTIONAL, (size_t)0, NULL) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Can't set bogus filter\n",__LINE__);
+ goto error;
+ }
+
+ /* Create the data space */
+ if((sid = H5Screate_simple(2, dims, NULL)) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Can't open dataspace\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Create new dataset */
+ if((dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME2, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Can't create dataset\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Write data */
+ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Error writing dataset data\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Flush the file (to clear the cache) */
+ if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Error flushing file\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Query the dataset's size on disk */
+ if((dset_size=H5Dget_storage_size(dsid))==0) {
+ H5_FAILED();
+ printf(" Line %d: Error querying dataset size\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Verify that the size indicates data is uncompressed */
+ if((H5Tget_size(H5T_NATIVE_DOUBLE)*dims[0]*dims[1])!=dset_size) {
+ H5_FAILED();
+ printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size);
+ goto error;
+ } /* end if */
+
+ /* Read data */
+ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Error reading dataset data\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Compare data */
+ /* Check that the values read are the same as the values written */
+ for(i=0; i<(size_t)dims[0]; i++) {
+ for(j=0; j<(size_t)dims[1]; j++) {
+ if(points[i][j] != check[i][j]) {
+ H5_FAILED();
+ printf(" Line %d: Read different values than written.\n",__LINE__);
+ printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
+ printf(" At original: %d\n",points[i][j]);
+ printf(" At returned: %d\n",check[i][j]);
+ goto error;
+ } /* end if */
+ } /* end for */
+ } /* end for */
+
+ /* Close dataset */
+ if(H5Dclose(dsid) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Can't close dataset\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Close dataspace */
+ if(H5Sclose(sid) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Can't close dataspace\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Close dataset creation property list */
+ if(H5Pclose(dcpl) < 0) {
+ H5_FAILED();
+ printf(" Line %d: Can't close dcpl\n",__LINE__);
+ goto error;
+ } /* end if */
+
+
+ PASSED();
+ return 0;
+
+error:
+ return -1;
+} /* end test_can_apply2() */
+
+
/*-------------------------------------------------------------------------
* Function: test_can_apply_szip
@@ -5707,7 +6043,7 @@ test_copy_dcpl(hid_t file, hid_t fapl)
* until the data is written to it. */
if(H5Pset_layout(dcpl, H5D_CONTIGUOUS) < 0) TEST_ERROR
if(H5Premove_filter(dcpl, H5Z_FILTER_FLETCHER32) < 0) TEST_ERROR
- if(H5Pset_external(dcpl, COPY_DCPL_EXTFILE_NAME, 0, 500*4096*sizeof(int)) < 0) TEST_ERROR
+ if(H5Pset_external(dcpl, COPY_DCPL_EXTFILE_NAME, (off_t)0, (hsize_t)(500 * 4096 * sizeof(int))) < 0) TEST_ERROR
/* Create second dataset of contiguous layout with external storage */
if((dsid2 = H5Dcreate2(file, DSET_COPY_DCPL_NAME_2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl,
@@ -5845,7 +6181,7 @@ test_filter_delete(hid_t file)
/* try to get the info for the deflate filter */
H5E_BEGIN_TRY {
- ret=H5Pget_filter_by_id2(dcpl1,H5Z_FILTER_DEFLATE,&flags,NULL,NULL,0,NULL,NULL);
+ ret = H5Pget_filter_by_id2(dcpl1, H5Z_FILTER_DEFLATE, &flags, NULL, NULL, (size_t)0, NULL, NULL);
} H5E_END_TRY;
if(ret >=0) {
H5_FAILED();
@@ -6075,8 +6411,6 @@ error:
* Programmer: Quincey Koziol
* Tuesday, July 27, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -6084,19 +6418,41 @@ test_zero_dims(hid_t file)
{
hid_t s=-1, d=-1, dcpl=-1;
hsize_t dsize=0, dmax=H5S_UNLIMITED, csize=5;
+ herr_t ret;
TESTING("I/O on datasets with zero-sized dims");
- if((s = H5Screate_simple(1, &dsize, &dmax)) < 0) TEST_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if(H5Pset_chunk(dcpl, 1, &csize) < 0) TEST_ERROR;
- if((d = H5Dcreate2(file, ZERODIM_DATASET, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if((s = H5Screate_simple(1, &dsize, &dmax)) < 0) FAIL_STACK_ERROR
+
+ /* Try creating chunked dataset with zero-sized chunk dimensions */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
+ if(H5Pset_layout(dcpl, H5D_CHUNKED) < 0) FAIL_STACK_ERROR
+ H5E_BEGIN_TRY {
+ d = H5Dcreate2(file, ZERODIM_DATASET, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(d > 0) {
+ H5Dclose(d);
+ FAIL_PUTS_ERROR("created dataset with undefined chunk dimensions")
+ } /* end if */
- if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, (void*)911) < 0) TEST_ERROR;
+ H5E_BEGIN_TRY {
+ ret = H5Pset_chunk(dcpl, 1, &dsize);
+ } H5E_END_TRY;
+ if(ret > 0)
+ FAIL_PUTS_ERROR("set zero-sized chunk dimensions")
- if(H5Pclose(dcpl) < 0) TEST_ERROR;
- if(H5Sclose(s) < 0) TEST_ERROR;
- if(H5Dclose(d) < 0) TEST_ERROR;
+ if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
+
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
+ if(H5Pset_chunk(dcpl, 1, &csize) < 0) FAIL_STACK_ERROR
+ if((d = H5Dcreate2(file, ZERODIM_DATASET, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR
+
+ if(H5Dclose(d) < 0) FAIL_STACK_ERROR
+ if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
+
+ if(H5Sclose(s) < 0) FAIL_STACK_ERROR
PASSED();
return 0;
@@ -6209,7 +6565,7 @@ error:
H5Sclose(s);
} H5E_END_TRY;
return -1;
-} /* end test_zero_dims() */
+} /* end test_missing_chunk() */
/*-------------------------------------------------------------------------
@@ -6291,7 +6647,7 @@ test_random_chunks(hid_t fapl)
if((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
/* Select the random points for writing */
- if(H5Sselect_elements(s, H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if(H5Sselect_elements(s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
/* Write into dataset */
if(H5Dwrite(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, wbuf) < 0) TEST_ERROR;
@@ -6316,7 +6672,7 @@ test_random_chunks(hid_t fapl)
if((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
/* Select the random points for reading */
- if(H5Sselect_elements (s, H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if(H5Sselect_elements (s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
/* Read from dataset */
if(H5Dread(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, rbuf) < 0) TEST_ERROR;
@@ -6381,7 +6737,7 @@ test_random_chunks(hid_t fapl)
if((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
/* Select the random points for writing */
- if(H5Sselect_elements(s, H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if(H5Sselect_elements(s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
/* Write into dataset */
if(H5Dwrite(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, wbuf) < 0) TEST_ERROR;
@@ -6406,7 +6762,7 @@ test_random_chunks(hid_t fapl)
if((m = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
/* Select the random points for reading */
- if(H5Sselect_elements (s, H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if(H5Sselect_elements (s, H5S_SELECT_SET, (size_t)NPOINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
/* Read from dataset */
if(H5Dread(d, H5T_NATIVE_INT, m, s, H5P_DEFAULT, rbuf) < 0) TEST_ERROR;
@@ -6440,7 +6796,7 @@ error:
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Empty can_apply and set_local callbacks */
-static herr_t
+static htri_t
can_apply_deprec(hid_t UNUSED dcpl_id, hid_t UNUSED type_id, hid_t UNUSED space_id)
{
return 1;
@@ -6812,7 +7168,7 @@ test_chunk_cache(hid_t fapl)
FAIL_PUTS_ERROR(" Cache values from default dapl do not match those from fapl.")
/* Set a lapl property on dapl1 (to verify inheritance) */
- if (H5Pset_nlinks(dapl1, 134) < 0) FAIL_STACK_ERROR
+ if (H5Pset_nlinks(dapl1, (size_t)134) < 0) FAIL_STACK_ERROR
if (H5Pget_nlinks(dapl1, &nlinks) < 0) FAIL_STACK_ERROR
if (nlinks != 134)
FAIL_PUTS_ERROR(" nlinks parameter not set properly on dapl.")
@@ -8677,6 +9033,7 @@ main(void)
nerrors += (test_userblock_offset(envval, my_fapl) < 0 ? 1 : 0);
nerrors += (test_missing_filter(file) < 0 ? 1 : 0);
nerrors += (test_can_apply(file) < 0 ? 1 : 0);
+ nerrors += (test_can_apply2(file) < 0 ? 1 : 0);
nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0);
nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0);
nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0);
@@ -8695,6 +9052,7 @@ main(void)
nerrors += (test_chunk_fast(my_fapl) < 0 ? 1 : 0);
nerrors += (test_reopen_chunk_fast(my_fapl) < 0 ? 1 : 0);
nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0);
nerrors += (test_fixed_array(my_fapl) < 0 ? 1 : 0);
nerrors += (test_idx_compatible() < 0 ? 1 : 0);
nerrors += (test_unfiltered_edge_chunks(my_fapl) < 0 ? 1 : 0);
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 78a05be..8d4b65b 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -290,8 +290,8 @@ static int without_hardware_g = 0;
HDmemset(BUF, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
HDmemset(SAVED, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
\
- tmp1 = (unsigned char*)calloc(1, SRC_SIZE); \
- tmp2 = (unsigned char*)calloc(1, SRC_SIZE); \
+ tmp1 = (unsigned char*)calloc((size_t)1, (size_t)SRC_SIZE); \
+ tmp2 = (unsigned char*)calloc((size_t)1, (size_t)SRC_SIZE); \
\
buf_p = BUF; \
saved_p = SAVED; \
@@ -300,9 +300,9 @@ static int without_hardware_g = 0;
*00000111,..., until 11111111.*/ \
memset(tmp1, 0, SRC_SIZE); \
memset(tmp2, 0, SRC_SIZE); \
- H5T_bit_set (tmp2, SRC_PREC-1, 1, TRUE); /*the negative value*/ \
+ H5T_bit_set (tmp2, SRC_PREC-1, (size_t)1, TRUE); /*the negative value*/ \
for(n=0; n<SRC_MANT_DIG-1; n++) { \
- H5T_bit_set (tmp1, n, 1, TRUE); /*turn on 1 bit each time*/ \
+ H5T_bit_set (tmp1, n, (size_t)1, TRUE); /*turn on 1 bit each time*/ \
CHANGE_ORDER(tmp1, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
memcpy(buf_p, tmp1, SRC_SIZE); \
memcpy(saved_p, tmp1, SRC_SIZE); \
@@ -311,7 +311,7 @@ static int without_hardware_g = 0;
saved_p += SRC_SIZE; \
\
/*negative values*/ \
- H5T_bit_set (tmp2, n, 1, TRUE); \
+ H5T_bit_set (tmp2, n, (size_t)1, TRUE); \
CHANGE_ORDER(tmp2, SRC_ORDR, SRC_SIZE); \
memcpy(buf_p, tmp2, SRC_SIZE); \
memcpy(saved_p, tmp2, SRC_SIZE); \
@@ -347,7 +347,7 @@ static int without_hardware_g = 0;
buf_p = BUF; \
\
/* +0 */ \
- H5T_bit_set(value, 0, SRC_PREC, FALSE); \
+ H5T_bit_set(value, (size_t)0, SRC_PREC, FALSE); \
memcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
buf_p += SRC_SIZE; \
\
@@ -355,36 +355,36 @@ static int without_hardware_g = 0;
if(n==1) { \
memset(value, 0, SRC_SIZE*sizeof(unsigned char)); \
/* -0 */ \
- H5T_bit_set(value, SRC_PREC-1, 1, TRUE); \
+ H5T_bit_set(value, (size_t)(SRC_PREC - 1), (size_t)1, TRUE); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE);/*change order for big endian*/ \
- memcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
+ HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE);/*change back the order for bit operation*/ \
buf_p += SRC_SIZE; \
} \
\
/* +/-infinity */ \
- H5T_bit_set(value, SRC_MANT_DIG-1, SRC_PREC-SRC_MANT_DIG, TRUE); \
+ H5T_bit_set(value, (size_t)(SRC_MANT_DIG - 1), SRC_PREC-SRC_MANT_DIG, TRUE); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
- memcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
+ HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
buf_p += SRC_SIZE; \
\
/* +/-SNaN */ \
- H5T_bit_set(value, 0, 1, TRUE); \
+ H5T_bit_set(value, (size_t)0, (size_t)1, TRUE); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
- memcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
+ HDmemcpy(buf_p, value, SRC_SIZE * sizeof(unsigned char)); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
buf_p += SRC_SIZE; \
\
/* +/-QNaN */ \
- H5T_bit_set(value, SRC_MANT_DIG-2, 1, TRUE); \
+ H5T_bit_set(value, (size_t)(SRC_MANT_DIG - 2), (size_t)1, TRUE); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
- memcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
+ HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
buf_p += SRC_SIZE; \
} \
\
- memcpy(SAVED, BUF, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
+ HDmemcpy(SAVED, BUF, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
free(value); \
}
@@ -565,7 +565,7 @@ generates_sigfpe(void)
HDfflush(stdout);
HDfflush(stderr);
- if ((pid=fork())<0) {
+ if ((pid=fork()) < 0) {
HDperror("fork");
HDexit(1);
} else if (0==pid) {
@@ -735,7 +735,7 @@ static int test_particular_fp_integer(void)
TESTING("hard particular floating number -> integer conversions");
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
H5_FAILED();
printf("Can't create data transfer property list\n");
goto error;
@@ -745,22 +745,22 @@ static int test_particular_fp_integer(void)
endian = H5Tget_order(H5T_NATIVE_DOUBLE);
src_size1 = H5Tget_size(H5T_NATIVE_DOUBLE);
dst_size1 = H5Tget_size(H5T_NATIVE_SCHAR);
- buf1 = (unsigned char*)calloc(1, MAX(src_size1, dst_size1));
- saved_buf1 = (unsigned char*)calloc(1, MAX(src_size1, dst_size1));
+ buf1 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size1, dst_size1));
+ saved_buf1 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size1, dst_size1));
memcpy(buf1, &src_d, src_size1);
memcpy(saved_buf1, &src_d, src_size1);
/* Register exception handling function and signal the destination is "signed char". */
flag = 1;
- if(H5Pset_type_conv_cb(dxpl_id, expt_handle, &flag)<0) {
+ if(H5Pset_type_conv_cb(dxpl_id, expt_handle, &flag) < 0) {
H5_FAILED();
printf("Can't register conversion callback\n");
goto error;
}
/* Do conversion */
- if(H5Tconvert(H5T_NATIVE_DOUBLE, H5T_NATIVE_SCHAR, 1, buf1, NULL, dxpl_id)<0) {
+ if(H5Tconvert(H5T_NATIVE_DOUBLE, H5T_NATIVE_SCHAR, (size_t)1, buf1, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
@@ -795,16 +795,16 @@ static int test_particular_fp_integer(void)
/* Test conversion from float (the value is INT_MAX) to int. */
src_size2 = H5Tget_size(H5T_NATIVE_FLOAT);
dst_size2 = H5Tget_size(H5T_NATIVE_INT);
- buf2 = (unsigned char*)calloc(1, MAX(src_size2, dst_size2));
- saved_buf2 = (unsigned char*)calloc(1, MAX(src_size2, dst_size2));
- memcpy(buf2, &src_f, src_size2);
- memcpy(saved_buf2, &src_f, src_size2);
+ buf2 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size2, dst_size2));
+ saved_buf2 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size2, dst_size2));
+ HDmemcpy(buf2, &src_f, src_size2);
+ HDmemcpy(saved_buf2, &src_f, src_size2);
/* signal exception handling function that the destination is "int". */
flag = 0;
/* Do conversion */
- if(H5Tconvert(H5T_NATIVE_FLOAT, H5T_NATIVE_INT, 1, buf2, NULL, dxpl_id)<0) {
+ if(H5Tconvert(H5T_NATIVE_FLOAT, H5T_NATIVE_INT, (size_t)1, buf2, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
@@ -839,7 +839,7 @@ static int test_particular_fp_integer(void)
if(fails_this_test)
goto error;
- if(H5Pclose(dxpl_id)<0) {
+ if(H5Pclose(dxpl_id) < 0) {
H5_FAILED();
printf("Can't close property list\n");
goto error;
@@ -913,25 +913,25 @@ test_derived_flt(void)
/* Create File */
h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) {
+ if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
H5_FAILED();
printf("Can't create file\n");
goto error;
}
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
H5_FAILED();
printf("Can't create data transfer property list\n");
goto error;
}
- if((tid1 = H5Tcopy(H5T_IEEE_F64LE))<0) {
+ if((tid1 = H5Tcopy(H5T_IEEE_F64LE)) < 0) {
H5_FAILED();
printf("Can't copy data type\n");
goto error;
}
- if((tid2 = H5Tcopy(H5T_IEEE_F32LE))<0) {
+ if((tid2 = H5Tcopy(H5T_IEEE_F32LE)) < 0) {
H5_FAILED();
printf("Can't copy data type\n");
goto error;
@@ -955,28 +955,28 @@ test_derived_flt(void)
* holes among the significant bits. Exponent bias usually is set
* 2^(n-1)-1, where n is the exponent size.
*-----------------------------------------------------------------------*/
- if(H5Tset_fields(tid1, 44, 34, 10, 3, 31)<0) {
+ if(H5Tset_fields(tid1, (size_t)44, (size_t)34, (size_t)10, (size_t)3, (size_t)31) < 0) {
H5_FAILED();
printf("Can't set fields\n");
goto error;
}
- if(H5Tset_offset(tid1, 3)<0) {
+ if(H5Tset_offset(tid1, (size_t)3) < 0) {
H5_FAILED();
printf("Can't set offset\n");
goto error;
}
- if(H5Tset_precision(tid1, 42)<0) {
+ if(H5Tset_precision(tid1, (size_t)42) < 0) {
H5_FAILED();
printf("Can't set precision 1\n");
goto error;
}
- if(H5Tset_size(tid1, 7)<0) {
+ if(H5Tset_size(tid1, (size_t)7) < 0) {
H5_FAILED();
printf("Can't set size\n");
goto error;
}
- if(H5Tset_ebias(tid1, 511) < 0) {
+ if(H5Tset_ebias(tid1, (size_t)511) < 0) {
H5_FAILED();
printf("Can't set exponent bias\n");
goto error;
@@ -1038,24 +1038,24 @@ test_derived_flt(void)
*/
src_size = H5Tget_size(H5T_NATIVE_INT);
endian = H5Tget_order(H5T_NATIVE_INT);
- buf = (unsigned char*)malloc(nelmts*(MAX(src_size, size)));
- saved_buf = (unsigned char*)malloc(nelmts*src_size);
- HDmemset(buf, 0, nelmts*MAX(src_size, size));
- HDmemset(saved_buf, 0, nelmts*src_size);
- aligned = (int*)calloc(1, src_size);
+ buf = (unsigned char*)malloc(nelmts * (MAX(src_size, size)));
+ saved_buf = (unsigned char*)malloc(nelmts * src_size);
+ HDmemset(buf, 0, nelmts * MAX(src_size, size));
+ HDmemset(saved_buf, 0, nelmts * src_size);
+ aligned = (int*)calloc((size_t)1, src_size);
- for(i=0; i<nelmts*src_size; i++)
+ for(i = 0; i < nelmts * src_size; i++)
buf[i] = saved_buf[i] = HDrand();
/* Convert data from native integer to derived floating-point type.
* The mantissa is big enough to retain the integer's precision. */
- if(H5Tconvert(H5T_NATIVE_INT, tid1, nelmts, buf, NULL, dxpl_id)<0) {
+ if(H5Tconvert(H5T_NATIVE_INT, tid1, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
}
/* Convert data from the derived floating-point type back to native integer. */
- if(H5Tconvert(tid1, H5T_NATIVE_INT, nelmts, buf, NULL, dxpl_id)<0) {
+ if(H5Tconvert(tid1, H5T_NATIVE_INT, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
@@ -1115,27 +1115,27 @@ test_derived_flt(void)
* 2 1 0
* SEEEEEEE MMMMMMMM MMMMMMMM
*--------------------------------------------------------------------------*/
- if(H5Tset_fields(tid2, 23, 16, 7, 0, 16)<0) {
+ if(H5Tset_fields(tid2, (size_t)23, (size_t)16, (size_t)7, (size_t)0, (size_t)16) < 0) {
H5_FAILED();
printf("Can't set fields\n");
goto error;
}
- if(H5Tset_offset(tid2, 0)<0) {
+ if(H5Tset_offset(tid2, (size_t)0) < 0) {
H5_FAILED();
printf("Can't set offset\n");
goto error;
}
- if(H5Tset_precision(tid2, 24)<0) {
+ if(H5Tset_precision(tid2, (size_t)24) < 0) {
H5_FAILED();
printf("Can't set precision 2\n");
goto error;
}
- if(H5Tset_size(tid2, 3)<0) {
+ if(H5Tset_size(tid2, (size_t)3) < 0) {
H5_FAILED();
printf("Can't set size\n");
goto error;
}
- if(H5Tset_ebias(tid2, 63) < 0) {
+ if(H5Tset_ebias(tid2, (size_t)63) < 0) {
H5_FAILED();
printf("Can't set size\n");
goto error;
@@ -1209,13 +1209,13 @@ test_derived_flt(void)
/* Convert data from the 2nd to the 1st derived floating-point type.
* The mantissa and exponent of the 2nd type are big enough to retain
* the precision and exponent power. */
- if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id)<0) {
+ if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
}
/* Convert data from the 1st back to the 2nd derived floating-point type. */
- if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id)<0) {
+ if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
@@ -1265,25 +1265,25 @@ test_derived_flt(void)
if (buf) free(buf);
if (saved_buf) free(saved_buf);
- if(H5Tclose(tid1)<0) {
+ if(H5Tclose(tid1) < 0) {
H5_FAILED();
printf("Can't close datatype\n");
goto error;
}
- if(H5Tclose(tid2)<0) {
+ if(H5Tclose(tid2) < 0) {
H5_FAILED();
printf("Can't close datatype\n");
goto error;
}
- if(H5Pclose(dxpl_id)<0) {
+ if(H5Pclose(dxpl_id) < 0) {
H5_FAILED();
printf("Can't close property list\n");
goto error;
}
- if(H5Fclose(file)<0) {
+ if(H5Fclose(file) < 0) {
H5_FAILED();
printf("Can't close file\n");
goto error;
@@ -1345,25 +1345,25 @@ test_derived_integer(void)
/* Create File */
h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) {
+ if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
H5_FAILED();
printf("Can't create file\n");
goto error;
}
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
H5_FAILED();
printf("Can't create data transfer property list\n");
goto error;
}
- if((tid1 = H5Tcopy(H5T_STD_I32LE))<0) {
+ if((tid1 = H5Tcopy(H5T_STD_I32LE)) < 0) {
H5_FAILED();
printf("Can't copy data type\n");
goto error;
}
- if((tid2 = H5Tcopy(H5T_STD_U64LE))<0) {
+ if((tid2 = H5Tcopy(H5T_STD_U64LE)) < 0) {
H5_FAILED();
printf("Can't copy data type\n");
goto error;
@@ -1381,19 +1381,19 @@ test_derived_integer(void)
* of a new integer type, H5Tset_precision, H5Tset_offset, H5Tset_size,
* H5Tset_order, H5Tset_pad, H5Tset_sign.
*--------------------------------------------------------------------------*/
- if(H5Tset_offset(tid1,0)<0) {
+ if(H5Tset_offset(tid1, (size_t)0) < 0) {
H5_FAILED();
printf("Can't set offset\n");
goto error;
}
- if(H5Tset_size(tid1, 3)<0) {
+ if(H5Tset_size(tid1, (size_t)3) < 0) {
H5_FAILED();
printf("Can't set size\n");
goto error;
}
- if(H5Tset_precision(tid1, 24) < 0) {
+ if(H5Tset_precision(tid1, (size_t)24) < 0) {
H5_FAILED();
printf("Can't set precision\n");
goto error;
@@ -1448,13 +1448,13 @@ test_derived_integer(void)
* 7 6 5 4 3 2 1 0
* ??????SI IIIIIIII IIIIIIII IIIIIIII IIIIIIII IIIIIIII IIIIII?? ????????
*--------------------------------------------------------------------------*/
- if(H5Tset_precision(tid2,48)<0) {
+ if(H5Tset_precision(tid2, (size_t)48) < 0) {
H5_FAILED();
printf("Can't set precision\n");
goto error;
}
- if(H5Tset_offset(tid2, 10) < 0) {
+ if(H5Tset_offset(tid2, (size_t)10) < 0) {
H5_FAILED();
printf("Can't set offset\n");
goto error;
@@ -1519,13 +1519,13 @@ test_derived_integer(void)
/* Convert data from the 1st to the 2nd derived integer type.
* The precision of the 2nd type are big enough to retain
* the 1st type's precision. */
- if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id)<0) {
+ if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
}
/* Convert data from the 2nd back to the 1st derived integer type. */
- if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id)<0) {
+ if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
printf("Can't convert data\n");
goto error;
@@ -1564,30 +1564,33 @@ test_derived_integer(void)
}
}
- if(H5Tclose(tid1)<0) {
+ if(H5Tclose(tid1) < 0) {
H5_FAILED();
printf("Can't close datatype\n");
goto error;
}
- if(H5Tclose(tid2)<0) {
+ if(H5Tclose(tid2) < 0) {
H5_FAILED();
printf("Can't close datatype\n");
goto error;
}
- if(H5Pclose(dxpl_id)<0) {
+ if(H5Pclose(dxpl_id) < 0) {
H5_FAILED();
printf("Can't close property list\n");
goto error;
}
- if(H5Fclose(file)<0) {
+ if(H5Fclose(file) < 0) {
H5_FAILED();
printf("Can't close file\n");
goto error;
} /* end if */
+ free(buf);
+ free(saved_buf);
+
PASSED();
reset_hdf5(); /*print statistics*/
@@ -1761,7 +1764,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
dst_nbits = H5Tget_precision(dst); /* not 8*dst_size, esp on J90 - QAK */
src_sign = H5Tget_sign(src);
dst_sign = H5Tget_sign(dst);
- aligned = HDcalloc(1, sizeof(long long));
+ aligned = HDcalloc((size_t)1, sizeof(long long));
/* Allocate and initialize the source buffer through macro INIT_INTEGER. The BUF
* will be used for the conversion while the SAVED buffer will be
@@ -1791,7 +1794,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
goto error;
/* Perform the conversion */
- if (H5Tconvert(src, dst, nelmts, buf, NULL, H5P_DEFAULT)<0)
+ if (H5Tconvert(src, dst, nelmts, buf, NULL, H5P_DEFAULT) < 0)
goto error;
/* Check the results from the library against hardware */
@@ -1839,6 +1842,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_char = (signed char)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -1885,6 +1892,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_uchar = (unsigned char)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -1932,6 +1943,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
hw_short = (short)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -1978,6 +1993,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_ushort = (unsigned short)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2024,6 +2043,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_int = (int)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2070,6 +2093,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_uint = (unsigned int)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2116,6 +2143,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_long = (long int)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2162,6 +2193,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_ulong = (unsigned long)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2208,6 +2243,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_llong = (long long)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2254,6 +2293,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
hw_ullong = (unsigned long long)(*((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2288,7 +2331,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
*/
if (H5T_SGN_2==src_sign && H5T_SGN_2==dst_sign) {
if (src_nbits>dst_nbits) {
- if(0==H5T_bit_get_d(src_bits, src_nbits-1, 1) &&
+ if(0==H5T_bit_get_d(src_bits, src_nbits-1, (size_t)1) &&
H5T_bit_find(src_bits, dst_nbits-1, (src_nbits-dst_nbits),
H5T_BIT_MSB, 1)>=0) {
/*
@@ -2296,49 +2339,49 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
* the destination. The destination should be set to the
* maximum possible value: 0x7f...f
*/
- if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
- H5T_bit_find(dst_bits, 0, dst_nbits-1, H5T_BIT_LSB, 0)<0)
+ if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, (size_t)1) &&
+ H5T_bit_find(dst_bits, (size_t)0, dst_nbits-1, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
- } else if (1==H5T_bit_get_d(src_bits, src_nbits-1, 1) &&
- H5T_bit_find(src_bits, 0, src_nbits-1, H5T_BIT_MSB,
+ } else if (1==H5T_bit_get_d(src_bits, src_nbits-1, (size_t)1) &&
+ H5T_bit_find(src_bits, (size_t)0, src_nbits-1, H5T_BIT_MSB,
0)+1>=(ssize_t)dst_nbits) {
/*
* Source is negative but the magnitude is too large for
* the destination. The destination should be set to the
* smallest possible value: 0x80...0
*/
- if (1==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
- H5T_bit_find(dst_bits, 0, dst_nbits-1, H5T_BIT_LSB, 1)<0)
+ if (1==H5T_bit_get_d(dst_bits, dst_nbits-1, (size_t)1) &&
+ H5T_bit_find(dst_bits, (size_t)0, dst_nbits-1, H5T_BIT_LSB, 1) < 0)
continue; /*no error*/
}
} else if(src_nbits<dst_nbits) {
/* Source is smaller than the destination */
- if(0==H5T_bit_get_d(src_bits, src_nbits-1, 1)) {
+ if(0==H5T_bit_get_d(src_bits, src_nbits-1, (size_t)1)) {
/*
* Source is positive, so the excess bits in the
* destination should be set to 0's.
*/
- if (0==H5T_bit_get_d(dst_bits, src_nbits-1, 1) &&
- H5T_bit_find(dst_bits, src_nbits, dst_nbits-src_nbits, H5T_BIT_LSB, 1)<0)
+ if (0==H5T_bit_get_d(dst_bits, src_nbits-1, (size_t)1) &&
+ H5T_bit_find(dst_bits, src_nbits, dst_nbits-src_nbits, H5T_BIT_LSB, 1) < 0)
continue; /*no error*/
} else {
/*
* Source is negative, so the excess bits in the
* destination should be set to 1's.
*/
- if (1==H5T_bit_get_d(dst_bits, src_nbits-1, 1) &&
- H5T_bit_find(dst_bits, src_nbits, dst_nbits-src_nbits, H5T_BIT_LSB, 0)<0)
+ if (1==H5T_bit_get_d(dst_bits, src_nbits-1, (size_t)1) &&
+ H5T_bit_find(dst_bits, src_nbits, dst_nbits-src_nbits, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
}
}
} else if (H5T_SGN_2==src_sign && H5T_SGN_NONE==dst_sign) {
- if (H5T_bit_get_d(src_bits, src_nbits-1, 1)) {
+ if (H5T_bit_get_d(src_bits, src_nbits-1, (size_t)1)) {
/*
* The source is negative so the result should be zero.
* The source is negative if the most significant bit is
* set. The destination is zero if all bits are zero.
*/
- if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB, 1)<0)
+ if (H5T_bit_find(dst_bits, (size_t)0, dst_nbits, H5T_BIT_LSB, 1) < 0)
continue; /*no error*/
} else if (src_nbits>dst_nbits &&
H5T_bit_find(src_bits, dst_nbits-1,
@@ -2348,7 +2391,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
* the destination. The destination should be the
* largest possible value: 0xff...f
*/
- if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB, 0)<0)
+ if (H5T_bit_find(dst_bits, (size_t)0, dst_nbits, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
}
} else if (H5T_SGN_NONE==src_sign && H5T_SGN_2==dst_sign) {
@@ -2360,8 +2403,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
* the destination can handle. The destination should be
* set to the largest possible positive value: 0x7f...f
*/
- if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
- H5T_bit_find(dst_bits, 0, dst_nbits-1, H5T_BIT_LSB, 0)<0)
+ if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, (size_t)1) &&
+ H5T_bit_find(dst_bits, (size_t)0, dst_nbits-1, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
}
} else {
@@ -2373,7 +2416,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
* the unsigned destination. The destination should be
* set to the largest possible value: 0xff...f
*/
- if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB, 0)<0)
+ if (H5T_bit_find(dst_bits, (size_t)0, dst_nbits, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
}
}
@@ -2428,6 +2471,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2477,6 +2524,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
HDmemcpy(aligned, buf+j*sizeof(long long), sizeof(unsigned long long));
HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)aligned));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2516,6 +2567,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
case INT_ULLONG:
HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)hw));
break;
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -2589,7 +2644,7 @@ test_conv_int_2(void)
* Conversion. If overlap calculations aren't right then an
* assertion will fail in H5T_conv_i_i()
*/
- H5Tconvert(src_type, dst_type, 100, buf, NULL, H5P_DEFAULT);
+ H5Tconvert(src_type, dst_type, (size_t)100, buf, NULL, H5P_DEFAULT);
H5Tclose(src_type);
H5Tclose(dst_type);
}
@@ -2707,7 +2762,7 @@ my_isinf(int endian, unsigned char *val, size_t size,
int retval = 0;
size_t i;
- bits = (unsigned char*)calloc(1, size);
+ bits = (unsigned char*)calloc((size_t)1, size);
#ifdef H5_VMS
if(H5T_ORDER_VAX==endian) {
@@ -2812,7 +2867,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
*/
HDfflush(stdout);
HDfflush(stderr);
- if ((child_pid=fork())<0) {
+ if ((child_pid=fork()) < 0) {
HDperror("fork");
return 1;
} else if (child_pid>0) {
@@ -2925,7 +2980,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
dendian = H5Tget_order(dst);
/* Allocate buffers */
- aligned = HDcalloc(1, MAX(sizeof(long double), sizeof(double)));
+ aligned = HDcalloc((size_t)1, MAX(sizeof(long double), sizeof(double)));
/* Allocate and initialize the source buffer through macro INIT_FP_NORM or INIT_FP_SPECIAL.
* The BUF will be used for the conversion while the SAVED buffer will be used for
@@ -3017,7 +3072,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
}
/* Perform the conversion in software */
- if (H5Tconvert(src, dst, nelmts, buf, NULL, H5P_DEFAULT)<0)
+ if (H5Tconvert(src, dst, nelmts, buf, NULL, H5P_DEFAULT) < 0)
goto error;
/* Check the software results against the hardware */
@@ -3647,7 +3702,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
dst_size = H5Tget_size(dst);
src_nbits = H5Tget_precision(src); /* not 8*src_size, esp on J90 - QAK */
dst_nbits = H5Tget_precision(dst); /* not 8*dst_size, esp on J90 - QAK */
- aligned = HDcalloc(1, MAX(sizeof(long double), sizeof(long long)));
+ aligned = HDcalloc((size_t)1, MAX(sizeof(long double), sizeof(long long)));
#ifdef SHOW_OVERFLOWS
noverflows_g = 0;
#endif
@@ -3664,19 +3719,19 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
* conversion exception happens. We only test (unsigned) int - float
* and float - (unsigned) int conversions, which should cover more cases.
*/
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0)
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto error;
if((src_type == INT_INT && dst_type == FLT_FLOAT) ||
(src_type == INT_UINT && dst_type == FLT_FLOAT) ||
(src_type == FLT_FLOAT && dst_type == INT_UINT) ||
(src_type == FLT_FLOAT && dst_type == INT_INT)) {
- if(H5Pset_type_conv_cb(dxpl_id, except_func, &fill_value)<0)
+ if(H5Pset_type_conv_cb(dxpl_id, except_func, &fill_value) < 0)
goto error;
else
except_set = TRUE;
- if(H5Pget_type_conv_cb(dxpl_id, &op, &user_data)<0)
+ if(H5Pget_type_conv_cb(dxpl_id, &op, &user_data) < 0)
goto error;
if(op != except_func || *(int*)user_data != fill_value)
@@ -3743,7 +3798,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
goto error;
/* Perform the conversion */
- if (H5Tconvert(src, dst, nelmts, buf, NULL, dxpl_id)<0)
+ if(H5Tconvert(src, dst, nelmts, buf, NULL, dxpl_id) < 0)
goto error;
/* Check the results from the library against hardware */
@@ -3801,6 +3856,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_float = (float)(*((unsigned long long*)aligned));
break;
#endif /* H5_ULLONG_TO_FP_CAST_WORKS */
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -3849,6 +3908,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_double = (double)(*((unsigned long long*)aligned));
break;
#endif /* H5_ULLONG_TO_FP_CAST_WORKS */
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -3898,6 +3961,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_ldouble = (long double)(*((unsigned long long*)aligned));
break;
#endif /* H5_ULLONG_TO_FP_CAST_WORKS */
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
default:
break;
}
@@ -3919,6 +3986,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_schar = (signed char)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -3939,6 +4017,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_uchar = (unsigned char)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -3959,6 +4048,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_short = (short)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -3979,6 +4079,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_ushort = (unsigned short)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -3999,6 +4110,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_int = (int)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -4019,6 +4141,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_uint = (unsigned int)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -4039,6 +4172,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_long = (long)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -4059,6 +4203,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_ulong = (unsigned long)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -4079,6 +4234,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_llong = (long long)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -4099,6 +4265,17 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
hw_ullong = (unsigned long long)(*((long double*)aligned));
break;
#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
default:
break;
}
@@ -4165,7 +4342,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
)
&& (INT_SCHAR==dst_type || INT_SHORT==dst_type || INT_INT==dst_type
|| INT_LONG==dst_type || INT_LLONG==dst_type)) {
- if(0==H5T_bit_get_d(src_bits, src_nbits-1, 1) &&
+ if(0==H5T_bit_get_d(src_bits, src_nbits-1, (size_t)1) &&
overflows(src_bits, src, dst_nbits-1)) {
/*
* Source is positive and the magnitude is too large for
@@ -4173,15 +4350,15 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
* maximum possible value: 0x7f...f
*/
if(!except_set) {
- if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
- H5T_bit_find(dst_bits, 0, dst_nbits-1, H5T_BIT_LSB, 0)<0)
+ if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, (size_t)1) &&
+ H5T_bit_find(dst_bits, (size_t)0, dst_nbits-1, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
} else {
/* fill_value is small so we know only the 1st byte is set */
if (dst_bits[0] == fill_value)
continue; /*no error*/
}
- } else if (1==H5T_bit_get_d(src_bits, src_nbits-1, 1) &&
+ } else if (1==H5T_bit_get_d(src_bits, src_nbits-1, (size_t)1) &&
overflows(src_bits, src, dst_nbits-1)) {
/*
* Source is negative but the magnitude is too large for
@@ -4189,8 +4366,8 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
* smallest possible value: 0x80...0
*/
if(!except_set) {
- if (1==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
- H5T_bit_find(dst_bits, 0, dst_nbits-1, H5T_BIT_LSB, 1)<0)
+ if (1==H5T_bit_get_d(dst_bits, dst_nbits-1, (size_t)1) &&
+ H5T_bit_find(dst_bits, (size_t)0, dst_nbits-1, H5T_BIT_LSB, 1) < 0)
continue; /*no error*/
} else {
if (dst_bits[0] == fill_value)
@@ -4206,14 +4383,14 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
)
&& (INT_UCHAR==dst_type || INT_USHORT==dst_type || INT_UINT==dst_type
|| INT_ULONG==dst_type || INT_ULLONG==dst_type)) {
- if (H5T_bit_get_d(src_bits, src_nbits-1, 1)) {
+ if (H5T_bit_get_d(src_bits, src_nbits-1, (size_t)1)) {
/*
* The source is negative so the result should be zero.
* The source is negative if the most significant bit is
* set. The destination is zero if all bits are zero.
*/
if(!except_set) {
- if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB, 1)<0)
+ if (H5T_bit_find(dst_bits, (size_t)0, dst_nbits, H5T_BIT_LSB, 1) < 0)
continue; /*no error*/
} else {
if (dst_bits[0] == fill_value)
@@ -4226,7 +4403,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
* largest possible value: 0xff...f
*/
if(!except_set) {
- if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB, 0)<0)
+ if (H5T_bit_find(dst_bits, (size_t)0, dst_nbits, H5T_BIT_LSB, 0) < 0)
continue; /*no error*/
} else {
if (dst_bits[0] == fill_value)
@@ -4558,8 +4735,8 @@ overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits)
ssize_t indx;
unsigned char bits[32], mant_bits[32];
- HDmemset(bits, 0, 32);
- HDmemset(mant_bits, 0, 32);
+ HDmemset(bits, 0, (size_t)32);
+ HDmemset(mant_bits, 0, (size_t)32);
/*
* Sometimes, type size isn't equal to the precision like Linux's "long
@@ -4574,14 +4751,14 @@ overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits)
HDmemcpy(bits, origin_bits, src_prec/8+1);
/*Check for special cases: +Inf, -Inf*/
- if (H5T_bit_find (bits, mpos, mant_digits, H5T_BIT_LSB, TRUE)<0) {
- if (H5T_bit_find (bits, epos, expt_digits, H5T_BIT_LSB, FALSE)<0) {
+ if (H5T_bit_find (bits, mpos, mant_digits, H5T_BIT_LSB, TRUE) < 0) {
+ if (H5T_bit_find (bits, epos, expt_digits, H5T_BIT_LSB, FALSE) < 0) {
ret_value=TRUE;
goto done;
}
} else if (H5T_NORM_NONE==norm && H5T_bit_find (bits, mpos, mant_digits-1,
- H5T_BIT_LSB, TRUE)<0 && H5T_bit_find (bits, epos, expt_digits,
- H5T_BIT_LSB, FALSE)<0) {
+ H5T_BIT_LSB, TRUE) < 0 && H5T_bit_find (bits, epos, expt_digits,
+ H5T_BIT_LSB, FALSE) < 0) {
/*This is a special case for the source of no implied mantissa bit.
*If the exponent bits are all 1s and only the 1st bit of mantissa
*is set to 1. It's infinity. The Intel-Linux "long double" is this case.*/
@@ -4598,19 +4775,19 @@ overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits)
}
/* get significand */
- H5T_bit_copy (mant_bits, 0, bits, 0, mant_digits);
+ H5T_bit_copy (mant_bits, (size_t)0, bits, (size_t)0, mant_digits);
/* restore implicit bit if normalization is implied*/
if(norm == H5T_NORM_IMPLIED) {
- H5T_bit_inc(mant_bits, mant_digits, 1);
+ H5T_bit_inc(mant_bits, mant_digits, (size_t)1);
mant_digits++;
}
/* shift significand */
- H5T_bit_shift (mant_bits, (ssize_t)(expt-expt_digits), 0, 32*8);
+ H5T_bit_shift (mant_bits, (ssize_t)(expt-expt_digits), (size_t)0, (size_t)(32 * 8));
- indx = H5T_bit_find(mant_bits, 0, 32*8, H5T_BIT_MSB, 1);
+ indx = H5T_bit_find(mant_bits, (size_t)0, (size_t)(32 * 8), H5T_BIT_MSB, 1);
if((size_t)indx>=dst_num_bits)
ret_value=TRUE;
diff --git a/test/dtransform.c b/test/dtransform.c
index 9af1dfb..5d5cefe 100644
--- a/test/dtransform.c
+++ b/test/dtransform.c
@@ -616,7 +616,7 @@ test_getset(const hid_t dxpl_id_c_to_f)
TESTING("H5Pget_data_transform, after resetting transform property")
- if(NULL == (ptrgetTest = (char *)HDcalloc(1, HDstrlen(simple) + 1)))
+ if(NULL == (ptrgetTest = (char *)HDcalloc((size_t)1, HDstrlen(simple) + 1)))
TEST_ERROR
if(H5Pget_data_transform(dxpl_id_c_to_f, ptrgetTest, HDstrlen(simple) + 1) < 0)
TEST_ERROR
diff --git a/test/dtypes.c b/test/dtypes.c
index 3af2b8a..0a3b6e4 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -25,9 +25,6 @@
#include "h5test.h"
#include "H5Iprivate.h" /* For checking that datatype id's don't leak */
-/* Number of times to run each test */
-#define NTESTS 1
-
/* Number of elements in each test */
#define NTESTELEM 100000
@@ -184,64 +181,64 @@ test_classes(void)
hid_t memb_id; /* Compound member datatype */
H5T_class_t memb_cls;
H5T_class_t tcls;
- unsigned int nmembs, i;
+ int nmembs;
+ unsigned u;
TESTING("H5Tget_class()");
/*-------------------------------------------------------------
* Check class of some atomic types.
*-----------------------------------------------------------*/
- if ((tcls=H5Tget_class(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if (H5T_INTEGER!=tcls) TEST_ERROR
+ if((tcls = H5Tget_class(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if(H5T_INTEGER != tcls) TEST_ERROR
- if ((tcls=H5Tget_class(H5T_NATIVE_DOUBLE)) < 0) TEST_ERROR
- if (H5T_FLOAT!=tcls) TEST_ERROR
+ if((tcls = H5Tget_class(H5T_NATIVE_DOUBLE)) < 0) TEST_ERROR
+ if(H5T_FLOAT != tcls) TEST_ERROR
/* Create a VL datatype of char. It should be a VL, not a string class. */
- if((vlc_id=H5Tvlen_create(H5T_NATIVE_CHAR)) < 0) TEST_ERROR
+ if((vlc_id = H5Tvlen_create(H5T_NATIVE_CHAR)) < 0) TEST_ERROR
/* Make certain that the correct classes can be detected */
- if ((tcls=H5Tget_class(vlc_id)) < 0) TEST_ERROR
- if (H5T_VLEN!=tcls) TEST_ERROR
+ if((tcls = H5Tget_class(vlc_id)) < 0) TEST_ERROR
+ if(H5T_VLEN != tcls) TEST_ERROR
/* Make certain that an incorrect class is not detected */
- if (H5T_STRING==tcls) TEST_ERROR
+ if(H5T_STRING == tcls) TEST_ERROR
/* Create a VL string. It should be a string, not a VL class. */
- if((vls_id=H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR
+ if((vls_id = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR
if(H5Tset_size(vls_id, H5T_VARIABLE) < 0) TEST_ERROR;
/* Make certain that the correct classes can be detected */
- if ((tcls=H5Tget_class(vls_id)) < 0) TEST_ERROR
- if (H5T_STRING!=tcls) TEST_ERROR
+ if((tcls = H5Tget_class(vls_id)) < 0) TEST_ERROR
+ if(H5T_STRING != tcls) TEST_ERROR
/* Make certain that an incorrect class is not detected */
- if (H5T_VLEN==tcls) TEST_ERROR
+ if(H5T_VLEN == tcls) TEST_ERROR
/*-------------------------------------------------------------
* Check class for member types of compound type.
*-----------------------------------------------------------*/
/* Create a compound datatype and insert some complex types */
- if ((cmpd_id = H5Tcreate(H5T_COMPOUND, sizeof(struct complex))) < 0) TEST_ERROR
- if (H5Tinsert(cmpd_id, "vl_c", HOFFSET(struct complex, vl_c), vlc_id) < 0) TEST_ERROR
- if (H5Tinsert(cmpd_id, "vl_s", HOFFSET(struct complex, vl_s), vls_id) < 0) TEST_ERROR
+ if((cmpd_id = H5Tcreate(H5T_COMPOUND, sizeof(struct complex))) < 0) TEST_ERROR
+ if(H5Tinsert(cmpd_id, "vl_c", HOFFSET(struct complex, vl_c), vlc_id) < 0) TEST_ERROR
+ if(H5Tinsert(cmpd_id, "vl_s", HOFFSET(struct complex, vl_s), vls_id) < 0) TEST_ERROR
- nmembs = H5Tget_nmembers(cmpd_id);
+ if((nmembs = H5Tget_nmembers(cmpd_id)) < 0) TEST_ERROR
- for (i=0;i<nmembs;i++)
- {
+ for(u = 0; u < (unsigned)nmembs; u++) {
/* Get member type ID */
- if((memb_id = H5Tget_member_type(cmpd_id, i)) < 0) TEST_ERROR
+ if((memb_id = H5Tget_member_type(cmpd_id, u)) < 0) TEST_ERROR
/* Get member type class */
- if((memb_cls = H5Tget_member_class (cmpd_id, i)) < 0) TEST_ERROR
+ if((memb_cls = H5Tget_member_class (cmpd_id, u)) < 0) TEST_ERROR
/* Verify member class */
- if(H5Tdetect_class (memb_id, memb_cls) < 0) TEST_ERROR
+ if(H5Tdetect_class(memb_id, memb_cls) < 0) TEST_ERROR
/* Close member type ID */
if(H5Tclose(memb_id) < 0) TEST_ERROR
- }
+ } /* end for */
/* Close datatypes */
if(H5Tclose(cmpd_id) < 0) TEST_ERROR
@@ -588,12 +585,11 @@ test_compound_1(void)
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- H5E_BEGIN_TRY {
- order = H5Tget_order(complex_id);
- } H5E_END_TRY;
- if (order>-1) {
- FAIL_PUTS_ERROR("Operation not allowed for this type.");
- } /* end if */
+ /* We started to support this function for compound type in 1.8.6 release. */
+ if((order = H5Tget_order(complex_id)) == H5T_ORDER_ERROR)
+ FAIL_PUTS_ERROR("Can't get order for compound type.");
+ if(order != H5T_ORDER_LE && order != H5T_ORDER_BE)
+ FAIL_PUTS_ERROR("Wrong order for this type.");
H5E_BEGIN_TRY {
sign = H5Tget_sign(complex_id);
@@ -2315,7 +2311,7 @@ test_compound_13(void)
float y;
};
struct s1 data_out, data_in;
- hid_t fileid, grpid, typeid, array1_tid, spaceid, attid;
+ hid_t fileid, grpid, dtypeid, array1_tid, spaceid, attid;
hid_t fapl_id;
hsize_t dims[1] = {COMPOUND13_ARRAY_SIZE + 1};
char filename[1024];
@@ -2324,6 +2320,7 @@ test_compound_13(void)
TESTING("compound datatypes of boundary size with latest format");
/* Create some phony data. */
+ HDmemset(&data_out, 0, sizeof(data_out));
for(u = 0; u < COMPOUND13_ARRAY_SIZE + 1; u++)
data_out.x[u] = u;
data_out.y = 99.99;
@@ -2340,24 +2337,24 @@ test_compound_13(void)
if((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Create a compound type. */
- if((typeid = H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) FAIL_STACK_ERROR
+ if((dtypeid = H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) FAIL_STACK_ERROR
if((array1_tid = H5Tarray_create2(H5T_NATIVE_UCHAR, 1, dims)) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(typeid, "x", HOFFSET(struct s1, x), array1_tid) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(typeid, "y", HOFFSET(struct s1, y), H5T_NATIVE_FLOAT) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(dtypeid, "x", HOFFSET(struct s1, x), array1_tid) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(dtypeid, "y", HOFFSET(struct s1, y), H5T_NATIVE_FLOAT) < 0) FAIL_STACK_ERROR
/* Create a space. */
if((spaceid = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR
/* Create an attribute of this compound type. */
- if((attid = H5Acreate2(grpid, COMPOUND13_ATTR_NAME, typeid, spaceid, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((attid = H5Acreate2(grpid, COMPOUND13_ATTR_NAME, dtypeid, spaceid, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Write some data. */
- if(H5Awrite(attid, typeid, &data_out) < 0) FAIL_STACK_ERROR
+ if(H5Awrite(attid, dtypeid, &data_out) < 0) FAIL_STACK_ERROR
/* Release all resources. */
if(H5Aclose(attid) < 0) FAIL_STACK_ERROR
if(H5Tclose(array1_tid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(typeid) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(dtypeid) < 0) FAIL_STACK_ERROR
if(H5Sclose(spaceid) < 0) FAIL_STACK_ERROR
if(H5Gclose(grpid) < 0) FAIL_STACK_ERROR
if(H5Fclose(fileid) < 0) FAIL_STACK_ERROR
@@ -2367,11 +2364,11 @@ test_compound_13(void)
if((fileid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
if((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
if((attid = H5Aopen(grpid, COMPOUND13_ATTR_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((typeid = H5Aget_type(attid)) < 0) FAIL_STACK_ERROR
- if(H5Tget_class(typeid) != H5T_COMPOUND) FAIL_STACK_ERROR
- if(HOFFSET(struct s1, x) != H5Tget_member_offset(typeid, 0)) TEST_ERROR
- if(HOFFSET(struct s1, y) != H5Tget_member_offset(typeid, 1)) TEST_ERROR
- if(H5Aread(attid, typeid, &data_in) < 0) FAIL_STACK_ERROR
+ if((dtypeid = H5Aget_type(attid)) < 0) FAIL_STACK_ERROR
+ if(H5Tget_class(dtypeid) != H5T_COMPOUND) FAIL_STACK_ERROR
+ if(HOFFSET(struct s1, x) != H5Tget_member_offset(dtypeid, 0)) TEST_ERROR
+ if(HOFFSET(struct s1, y) != H5Tget_member_offset(dtypeid, 1)) TEST_ERROR
+ if(H5Aread(attid, dtypeid, &data_in) < 0) FAIL_STACK_ERROR
/* Check the data. */
for (u = 0; u < COMPOUND13_ARRAY_SIZE + 1; u++)
@@ -2380,7 +2377,7 @@ test_compound_13(void)
/* Release all resources. */
if(H5Aclose(attid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(typeid) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(dtypeid) < 0) FAIL_STACK_ERROR
if(H5Gclose(grpid) < 0) FAIL_STACK_ERROR
if(H5Fclose(fileid) < 0) FAIL_STACK_ERROR
@@ -4049,7 +4046,7 @@ test_conv_str_2(void)
char *buf = NULL, s[80];
hid_t c_type = -1;
hid_t f_type = -1;
- const size_t nelmts = NTESTELEM, ntests=NTESTS;
+ const size_t nelmts = NTESTELEM;
size_t i, j, nchars;
int ret_value = 1;
@@ -4068,19 +4065,14 @@ test_conv_str_2(void)
} /* end for */
/* Do the conversions */
- for(i = 0; i < ntests; i++) {
- if(ntests > 1)
- sprintf(s, "Testing random string conversion speed (test %d/%d)", (int)(i + 1), (int)ntests);
- else
- sprintf(s, "Testing random string conversion speed");
- printf("%-70s", s);
- HDfflush(stdout);
- if(H5Tconvert(c_type, f_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
- goto error;
- if(H5Tconvert(f_type, c_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
- goto error;
- PASSED();
- } /* end for */
+ sprintf(s, "Testing random string conversion speed");
+ printf("%-70s", s);
+ HDfflush(stdout);
+ if(H5Tconvert(c_type, f_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
+ if(H5Tconvert(f_type, c_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
+ goto error;
+ PASSED();
ret_value = 0;
@@ -4232,7 +4224,6 @@ static int
test_conv_enum_1(void)
{
const size_t nelmts=NTESTELEM;
- const int ntests=NTESTS;
int i, val, *buf=NULL;
hid_t t1 = -1;
hid_t t2 = -1;
@@ -4257,27 +4248,17 @@ test_conv_enum_1(void)
buf[u] = HDrand() % 26;
/* Conversions */
- for(i = 0; i < ntests; i++) {
- if(ntests > 1)
- sprintf(s, "Testing random enum conversion O(N) (test %d/%d)", i + 1, ntests);
- else
- sprintf(s, "Testing random enum conversion O(N)");
- printf("%-70s", s);
- HDfflush(stdout);
- if(H5Tconvert(t1, t2, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
- PASSED();
- } /* end for */
+ sprintf(s, "Testing random enum conversion O(N)");
+ printf("%-70s", s);
+ HDfflush(stdout);
+ if(H5Tconvert(t1, t2, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ PASSED();
- for(i = 0; i < ntests; i++) {
- if(ntests > 1)
- sprintf(s, "Testing random enum conversion O(N log N) (test %d/%d)", i + 1, ntests);
- else
- sprintf(s, "Testing random enum conversion O(N log N)");
- printf("%-70s", s);
- HDfflush(stdout);
- if(H5Tconvert(t2, t1, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
- PASSED();
- }
+ sprintf(s, "Testing random enum conversion O(N log N)");
+ printf("%-70s", s);
+ HDfflush(stdout);
+ if(H5Tconvert(t2, t1, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ PASSED();
ret_value = 0;
@@ -4879,14 +4860,6 @@ opaque_funcs(void)
} /* end if */
H5E_BEGIN_TRY {
- ret=H5Tset_order(type, H5T_ORDER_BE);
- } H5E_END_TRY;
- if (ret>=0) {
- printf("Operation not allowed for this type.\n");
- TEST_ERROR
- } /* end if */
-
- H5E_BEGIN_TRY {
sign = H5Tget_sign(type);
} H5E_END_TRY;
if (sign>-1) {
@@ -5325,7 +5298,7 @@ test_encode(void)
goto error;
} /* end if */
- if(vlstr_buf_size>0)
+ if(vlstr_buf_size > 0)
vlstr_buf = (unsigned char*)HDcalloc((size_t)1, vlstr_buf_size);
if(H5Tencode(tid3, vlstr_buf, &vlstr_buf_size) < 0) {
@@ -5340,6 +5313,7 @@ test_encode(void)
printf("Can't decode VL string type\n");
goto error;
} /* end if */
+ free(vlstr_buf);
/* Verify that the datatype was copied exactly */
if(H5Tequal(decoded_tid3, tid3)<=0) {
@@ -5784,14 +5758,11 @@ error:
* H5T_ORDER_NONE cannot be set.
*
* Return: Success: 0
- *
* Failure: number of errors
*
* Programmer: Neil Fortner
* January 23, 2009
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -5865,24 +5836,22 @@ test_set_order(void)
if (H5T_ORDER_BE != H5Tget_order(dtype)) TEST_ERROR;
if (H5Tclose(dtype) < 0) TEST_ERROR
- /* Opaque - functions should fail */
+ /* Opaque - No effect on the order */
if ((dtype = H5Tcreate(H5T_OPAQUE, (size_t)96)) < 0) TEST_ERROR
- H5E_BEGIN_TRY
- ret = H5Tset_order(dtype, H5T_ORDER_LE);
- order = H5Tget_order(dtype);
- H5E_END_TRY
- if (ret >= 0) TEST_ERROR
- if (order >= 0) TEST_ERROR
+ if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR;
+ if (H5Tset_order(dtype, H5T_ORDER_NONE) < 0) TEST_ERROR
+ if (H5Tset_order(dtype, H5T_ORDER_BE) < 0) TEST_ERROR
+ if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR;
if (H5Tclose(dtype) < 0) TEST_ERROR
- /* Compound - functions should fail */
+ /* Compound */
if ((dtype = H5Tcreate(H5T_COMPOUND, (size_t)48)) < 0) TEST_ERROR
H5E_BEGIN_TRY
- ret = H5Tset_order(dtype, H5T_ORDER_LE);
- order = H5Tget_order(dtype);
+ ret = H5Tset_order(dtype, H5T_ORDER_BE);
H5E_END_TRY
if (ret >= 0) TEST_ERROR
- if (order >= 0) TEST_ERROR
+ if ((order = H5Tget_order(dtype)) == H5T_ORDER_ERROR) TEST_ERROR
+ if (order != H5T_ORDER_NONE) TEST_ERROR
if (H5Tclose(dtype) < 0) TEST_ERROR
/* Object reference */
@@ -5944,6 +5913,144 @@ error:
/*-------------------------------------------------------------------------
+ * Function: test_set_order_compound
+ *
+ * Purpose: Tests H5Tset_order/H5Tget_order for complicated compound
+ * type.
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ * Programmer: Raymond Lu
+ * 18 August 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_set_order_compound(hid_t fapl)
+{
+ typedef struct { /* Struct with atomic fields */
+ int i;
+ char c;
+ short s;
+ float f;
+ } atomic_cmpd;
+
+ typedef struct { /* Struct with complex fields */
+ atomic_cmpd a;
+ hvl_t vl;
+ double b[3][4];
+ atomic_cmpd d[3][4];
+ } complex_cmpd;
+
+ hid_t file = -1;
+ hid_t cmpd = -1, memb_cmpd = -1, memb_array1 = -1, memb_array2 = -1, cmpd_array = -1;
+ hid_t vl_id = -1;
+ hsize_t dims[2] = {3, 4}; /* Array dimenstions */
+ char filename[1024];
+ herr_t ret; /* Generic return value */
+
+ TESTING("H5Tset/get_order for compound type");
+
+ if((memb_cmpd = H5Tcreate(H5T_COMPOUND, sizeof(atomic_cmpd))) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(memb_cmpd, "i", HOFFSET(atomic_cmpd, i), H5T_NATIVE_INT) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(memb_cmpd, "c", HOFFSET(atomic_cmpd, c), H5T_NATIVE_CHAR) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(memb_cmpd, "s", HOFFSET(atomic_cmpd, s), H5T_NATIVE_SHORT) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(memb_cmpd, "f", HOFFSET(atomic_cmpd, f), H5T_NATIVE_FLOAT) < 0) FAIL_STACK_ERROR
+
+ /* Set the order to little-endian. */
+ if(H5Tset_order(memb_cmpd, H5T_ORDER_BE) < 0) FAIL_STACK_ERROR
+
+ /* Create the array datatypes */
+ memb_array1 = H5Tarray_create2(H5T_NATIVE_DOUBLE, 2, dims);
+ memb_array2 = H5Tarray_create2(memb_cmpd, 2, dims);
+
+ /* Set the order to big-endian. */
+ if(H5Tset_order(memb_array1, H5T_ORDER_LE) < 0) FAIL_STACK_ERROR
+
+ /* Create a variable-length datatype */
+ if((vl_id = H5Tvlen_create(H5T_NATIVE_UINT)) < 0) FAIL_STACK_ERROR
+
+ /* Create a compound type using the types above. */
+ if((cmpd = H5Tcreate(H5T_COMPOUND, sizeof(complex_cmpd))) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd, "a", HOFFSET(complex_cmpd, a), memb_cmpd) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd, "vl_type", HOFFSET(complex_cmpd, vl), vl_id) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd, "b", HOFFSET(complex_cmpd, b), memb_array1) < 0) FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd, "d", HOFFSET(complex_cmpd, d), memb_array2) < 0) FAIL_STACK_ERROR
+
+ /* The order should be mixed now. */
+ if(H5Tget_order(cmpd) != H5T_ORDER_MIXED) FAIL_STACK_ERROR
+
+ /* Create an array of the compound type above */
+ cmpd_array = H5Tarray_create2(cmpd, 2, dims);
+
+ /* The order of the array type should be the same as the compound type */
+ if(H5Tget_order(cmpd_array) != H5T_ORDER_MIXED) FAIL_STACK_ERROR
+
+ /* Verify that the order can't be 'none'. */
+ H5E_BEGIN_TRY
+ ret = H5Tset_order(cmpd, H5T_ORDER_NONE);
+ H5E_END_TRY
+ if(ret >= 0) TEST_ERROR
+
+ /* Verify that the order can't be 'mixed'. */
+ H5E_BEGIN_TRY
+ ret = H5Tset_order(cmpd, H5T_ORDER_MIXED);
+ H5E_END_TRY
+ if(ret >= 0) TEST_ERROR
+
+ /* Change the order of the compound type to big-endian*/
+ if(H5Tset_order(cmpd, H5T_ORDER_BE) < 0) FAIL_STACK_ERROR
+
+ /* Verify that the order of the compound type is big-endian */
+ if(H5Tget_order(cmpd) != H5T_ORDER_BE) FAIL_STACK_ERROR
+
+ /* Change the order of the array type to little-endian*/
+ if(H5Tset_order(cmpd_array, H5T_ORDER_LE) < 0) FAIL_STACK_ERROR
+
+ /* Verify that the order of the array type is little-endian */
+ if(H5Tget_order(cmpd_array) != H5T_ORDER_LE) FAIL_STACK_ERROR
+
+ /* Create file */
+ h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
+
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ /* Commit the data type */
+ if(H5Tcommit2(file, "compound", cmpd, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Verify that committed type can't change order */
+ H5E_BEGIN_TRY
+ ret = H5Tset_order(cmpd, H5T_ORDER_LE);
+ H5E_END_TRY
+ if(ret >= 0) TEST_ERROR
+
+ if(H5Tclose(memb_cmpd) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(memb_array1) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(memb_array2) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(vl_id) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(cmpd) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(cmpd_array) < 0) FAIL_STACK_ERROR
+ if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY
+ H5Tclose(memb_cmpd);
+ H5Tclose(memb_array1);
+ H5Tclose(memb_array2);
+ H5Tclose(vl_id);
+ H5Tclose(cmpd);
+ H5Tclose(cmpd_array);
+ H5Fclose(file);
+ H5E_END_TRY;
+ return 1;
+} /* end test_set_order_compound() */
+
+
+/*-------------------------------------------------------------------------
* Function: test_named_indirect_reopen
*
* Purpose: Tests that open named datatypes can be reopened indirectly
@@ -6339,6 +6446,7 @@ main(void)
nerrors += test_latest();
nerrors += test_int_float_except();
nerrors += test_named_indirect_reopen(fapl);
+ nerrors += test_set_order_compound(fapl);
#ifndef H5_NO_DEPRECATED_SYMBOLS
nerrors += test_deprec(fapl);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/test/earray.c b/test/earray.c
index 3a29948..d3b51a4 100644
--- a/test/earray.c
+++ b/test/earray.c
@@ -1443,7 +1443,7 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED
/* Insert test entry into cache */
base_addr = HADDR_MAX;
- if(H5AC_set(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, base_addr, base_entry, H5AC__PIN_ENTRY_FLAG) < 0)
+ if(H5AC_insert_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, base_addr, base_entry, H5AC__PIN_ENTRY_FLAG) < 0)
TEST_ERROR
/* Set the base entry as a flush dependency for the array */
@@ -1458,7 +1458,7 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED
/* Insert test entry into cache */
addr1 = HADDR_MAX - 1;
- if(H5AC_set(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr1, entry1, H5AC__PIN_ENTRY_FLAG) < 0)
+ if(H5AC_insert_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr1, entry1, H5AC__PIN_ENTRY_FLAG) < 0)
TEST_ERROR
/* Set the test entry as a flush dependency for 0th index in the array */
@@ -1480,7 +1480,7 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED
/* Insert test entry into cache */
addr2 = HADDR_MAX - 2;
- if(H5AC_set(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr2, entry2, H5AC__PIN_ENTRY_FLAG) < 0)
+ if(H5AC_insert_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr2, entry2, H5AC__PIN_ENTRY_FLAG) < 0)
TEST_ERROR
/* Set the test entry as a flush dependency for 1st index in the array */
@@ -1502,7 +1502,7 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED
/* Insert test entry into cache */
addr3 = HADDR_MAX - 3;
- if(H5AC_set(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr3, entry3, H5AC__PIN_ENTRY_FLAG) < 0)
+ if(H5AC_insert_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr3, entry3, H5AC__PIN_ENTRY_FLAG) < 0)
TEST_ERROR
/* Set the test entry as a flush dependency for 10,000th index in the array */
diff --git a/test/enum.c b/test/enum.c
index 4599a7c..c627af1 100644
--- a/test/enum.c
+++ b/test/enum.c
@@ -71,7 +71,7 @@ test_named(hid_t file)
if(H5Tclose(type) < 0) FAIL_STACK_ERROR
/* A smaller type */
- if((type = H5Tcreate(H5T_ENUM, 1)) < 0) FAIL_STACK_ERROR
+ if((type = H5Tcreate(H5T_ENUM, (size_t)1)) < 0) FAIL_STACK_ERROR
if(H5Tenum_insert(type, "RED", CPTR(val8, E1_RED )) < 0) FAIL_STACK_ERROR
if(H5Tenum_insert(type, "GREEN", CPTR(val8, E1_GREEN)) < 0) FAIL_STACK_ERROR
if(H5Tenum_insert(type, "BLUE", CPTR(val8, E1_BLUE )) < 0) FAIL_STACK_ERROR
diff --git a/test/fillval.c b/test/fillval.c
index 81856de..cd12b98 100644
--- a/test/fillval.c
+++ b/test/fillval.c
@@ -1142,6 +1142,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout)
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined
* as compound type */
if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error;
+ HDmemset(&fill_ctype, 0, sizeof(fill_ctype));
fill_ctype.y = 4444.4444;
if(H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0) goto error;
nerrors += test_rdwr_cases(file, dcpl, "dset11", &fill_ctype, H5D_FILL_TIME_ALLOC,
@@ -1194,6 +1195,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout)
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined
* as compound type */
if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error;
+ HDmemset(&fill_ctype, 0, sizeof(fill_ctype));
fill_ctype.y = 4444.4444;
if(H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0) goto error;
nerrors += test_rdwr_cases(file, dcpl, "dset12", &fill_ctype, H5D_FILL_TIME_ALLOC,
diff --git a/test/freespace.c b/test/freespace.c
index 0f6514c..b4a774f 100644
--- a/test/freespace.c
+++ b/test/freespace.c
@@ -593,7 +593,7 @@ test_fs_sect_add(hid_t fapl)
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
- TEST_free_section_t *sect_node;
+ TEST_free_section_t *sect_node = NULL;
unsigned init_flags=0;
h5_stat_size_t file_size=0, tmp_file_size=0, fr_meta_size=0;
unsigned can_shrink=FALSE;
@@ -858,6 +858,11 @@ test_fs_sect_add(hid_t fapl)
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node) < 0)
FAIL_STACK_ERROR
+ /* Free the section node(s) */
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node) < 0)
+ TEST_ERROR
+ sect_node = NULL;
+
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
FAIL_STACK_ERROR
@@ -878,6 +883,8 @@ test_fs_sect_add(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(sect_node)
+ TEST_sect_free((H5FS_section_info_t *)sect_node);
if(frsp)
H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
H5Fclose(file);
@@ -918,7 +925,7 @@ test_fs_sect_find(hid_t fapl)
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
- TEST_free_section_t *sect_node1, *sect_node2, *sect_node3, *sect_node4;
+ TEST_free_section_t *sect_node1 = NULL, *sect_node2, *sect_node3 = NULL, *sect_node4 = NULL;
TEST_free_section_t *node;
htri_t node_found = FALSE;
unsigned init_flags=0;
@@ -1077,6 +1084,17 @@ test_fs_sect_find(hid_t fapl)
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node4) < 0)
FAIL_STACK_ERROR
+ /* Free the section node(s) */
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
+ TEST_ERROR
+ sect_node1 = NULL;
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node3) < 0)
+ TEST_ERROR
+ sect_node3 = NULL;
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node4) < 0)
+ TEST_ERROR
+ sect_node4 = NULL;
+
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
FAIL_STACK_ERROR
@@ -1145,11 +1163,17 @@ test_fs_sect_find(hid_t fapl)
if(TEST_sect_free((H5FS_section_info_t *)node) < 0)
TEST_ERROR
+ node = NULL;
/* remove sections A */
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1) < 0)
FAIL_STACK_ERROR
+ /* Free the section node(s) */
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
+ TEST_ERROR
+ sect_node1 = NULL;
+
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
FAIL_STACK_ERROR
@@ -1199,6 +1223,11 @@ test_fs_sect_find(hid_t fapl)
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1) < 0)
FAIL_STACK_ERROR
+ /* Free the section node(s) */
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
+ TEST_ERROR
+ sect_node1 = NULL;
+
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
FAIL_STACK_ERROR
@@ -1219,6 +1248,12 @@ test_fs_sect_find(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(sect_node1)
+ TEST_sect_free((H5FS_section_info_t *)sect_node1);
+ if(sect_node3)
+ TEST_sect_free((H5FS_section_info_t *)sect_node3);
+ if(sect_node4)
+ TEST_sect_free((H5FS_section_info_t *)sect_node4);
if(frsp)
H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
H5Fclose(file);
@@ -1484,6 +1519,12 @@ test_fs_sect_merge(hid_t fapl)
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2) < 0)
FAIL_STACK_ERROR
+ /* Free the section node(s) */
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
+ TEST_ERROR
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node2) < 0)
+ TEST_ERROR
+
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
FAIL_STACK_ERROR
@@ -1672,6 +1713,10 @@ test_fs_sect_merge(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(sect_node1)
+ TEST_sect_free((H5FS_section_info_t *)sect_node1);
+ if(sect_node2)
+ TEST_sect_free((H5FS_section_info_t *)sect_node2);
if(frsp)
H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
H5Fclose(file);
@@ -2152,6 +2197,11 @@ test_fs_sect_change_class(hid_t fapl)
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2) < 0)
FAIL_STACK_ERROR
+ /* Free the section node(s) */
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node2) < 0)
+ TEST_ERROR
+ sect_node2 = NULL;
+
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
FAIL_STACK_ERROR
@@ -2269,6 +2319,11 @@ test_fs_sect_change_class(hid_t fapl)
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1) < 0)
FAIL_STACK_ERROR
+ /* Free the section node(s) */
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
+ TEST_ERROR
+ sect_node1 = NULL;
+
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
FAIL_STACK_ERROR
@@ -2289,6 +2344,10 @@ test_fs_sect_change_class(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(sect_node1)
+ TEST_sect_free((H5FS_section_info_t *)sect_node1);
+ if(sect_node2)
+ TEST_sect_free((H5FS_section_info_t *)sect_node2);
if(frsp)
H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
H5Fclose(file);
diff --git a/test/getname.c b/test/getname.c
index 0dc623e..bef4756 100644
--- a/test/getname.c
+++ b/test/getname.c
@@ -21,12 +21,15 @@
*/
#define H5G_PACKAGE /*suppress error about including H5Gpkg */
+#define H5I_PACKAGE /*suppress error about including H5Ipkg */
-/* Define this macro to indicate that the testing APIs should be available */
+/* Define these macros to indicate that the testing APIs should be available */
#define H5G_TESTING
+#define H5I_TESTING
#include "h5test.h"
#include "H5Gpkg.h" /* Groups */
+#include "H5Ipkg.h" /* IDs */
/* Compound datatype */
@@ -1145,7 +1148,7 @@ test_main(hid_t file_id, hid_t fapl)
/* Get name */
*name2 = '\0';
- name_len=H5Iget_name(group_id, name2, SMALL_NAME_BUF_SIZE);
+ name_len=(size_t)H5Iget_name(group_id, name2, SMALL_NAME_BUF_SIZE);
/* Check that name is longer */
if(name_len <= SMALL_NAME_BUF_SIZE) TEST_ERROR
@@ -1172,14 +1175,14 @@ test_main(hid_t file_id, hid_t fapl)
if((group_id = H5Gopen2(file_id, "/g17", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Get name */
- name_len = H5Iget_name(group_id, NULL, NAME_BUF_SIZE);
+ name_len = (size_t)H5Iget_name(group_id, NULL, NAME_BUF_SIZE);
{
/* dynamic buffer to hold name */
char *name3;
/* Include the extra null character */
- name3 = HDmalloc(name_len + 1);
+ name3 = (char *)HDmalloc(name_len + 1);
if(!name3) TEST_ERROR
/* Get name with dynamic buffer */
@@ -2679,7 +2682,7 @@ test_reg_ref(hid_t fapl)
hsize_t count[2];
hsize_t coord[2][3] = {{0, 0, 1}, {6, 0, 8}};
unsigned num_points = 3;
- size_t name_size1, name_size2;
+ ssize_t name_size1, name_size2;
char buf1[NAME_BUF_SIZE], buf2[NAME_BUF_SIZE];
/* Initialize the file name */
@@ -2808,6 +2811,100 @@ error:
return 1;
}
+
+/*-------------------------------------------------------------------------
+ * Function: test_elinks
+ *
+ * Purpose: Verify that querying names of objects reached via external
+ * links uses cached path/name information for object and doesn't
+ * search the file.
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, July 27, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_elinks(hid_t fapl)
+{
+ char filename1[1024], filename2[1024]; /* Filenames */
+ hid_t fid1, fid2; /* HDF5 File IDs */
+ hid_t group, group2; /* Group IDs */
+ char name[NAME_BUF_SIZE]; /* Buffer for storing object's name */
+ ssize_t namelen; /* Length of object's name */
+ hbool_t name_cached; /* Indicate if name is cached */
+
+ /* Initialize the file names */
+ h5_fixname(FILENAME[1], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[2], fapl, filename2, sizeof filename2);
+
+ /* Create files */
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create a group in the second file */
+ if((group2 = H5Gcreate2(fid2, "Group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close Group */
+ if(H5Gclose(group2) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create an external link in first file to the group in the second file */
+ if(H5Lcreate_external(filename2, "Group2", fid1, "Link_to_Group2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create an external link in second file to the external link in the first file */
+ if(H5Lcreate_external(filename1, "Link_to_Group2", fid2, "Link_to_Link_to_Group2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+
+ /* Open the group in thesecond file through the external link */
+ if((group = H5Gopen2(fid1, "Link_to_Group2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Query the external link object's name */
+ *name = '\0';
+ name_cached = FALSE;
+ namelen = H5I_get_name_test(group, (char*)name, sizeof(name), &name_cached);
+ if(!((HDstrcmp(name, "/Group2") == 0) && (namelen == 7) && name_cached))
+ TEST_ERROR
+
+ /* Close Group */
+ if(H5Gclose(group) < 0)
+ FAIL_STACK_ERROR
+
+ /* Open the group in the second file through the external link to the external link */
+ if((group = H5Gopen2(fid2, "Link_to_Link_to_Group2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Query the external link to external link object's name */
+ *name = '\0';
+ name_cached = FALSE;
+ namelen = H5I_get_name_test(group, (char*)name, sizeof(name), &name_cached);
+ if(!((HDstrcmp(name, "/Group2") == 0) && (namelen == 7) && name_cached))
+ TEST_ERROR
+
+ /* Close Group */
+ if(H5Gclose(group) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close files */
+ if(H5Fclose(fid1) < 0)
+ FAIL_STACK_ERROR
+ if(H5Fclose(fid2) < 0)
+ FAIL_STACK_ERROR
+
+ return 0;
+
+error:
+ return 1;
+}
+
int
main(void)
{
@@ -2830,6 +2927,7 @@ main(void)
nerrors += test_main(file_id, fapl);
nerrors += test_obj_ref(fapl);
nerrors += test_reg_ref(fapl);
+ nerrors += test_elinks(fapl);
/* Close file */
H5Fclose(file_id);
diff --git a/test/gheap.c b/test/gheap.c
index b2c9090..2829e34 100644
--- a/test/gheap.c
+++ b/test/gheap.c
@@ -75,24 +75,24 @@ const char *FILENAME[] = {
static int
test_1 (hid_t fapl)
{
- hid_t file=-1;
- H5F_t *f=NULL;
+ hid_t file = -1;
+ H5F_t *f = NULL;
H5HG_t obj[1024];
uint8_t out[1024];
uint8_t in[1024];
int i;
size_t size;
herr_t status;
- int nerrors=0;
+ int nerrors = 0;
char filename[1024];
TESTING("monotonically increasing lengths");
/* Open a clean file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if (NULL==(f=H5I_object(file))) {
+ if(NULL == (f = (H5F_t *)H5I_object(file))) {
H5_FAILED();
puts(" Unable to create file");
goto error;
@@ -103,16 +103,16 @@ test_1 (hid_t fapl)
* a clean file, the addresses allocated for the collections should also
* be monotonically increasing.
*/
- for (i=0; i<1024; i++) {
- size = i+1;
- memset (out, 'A'+i%26, size);
+ for(i = 0; i < 1024; i++) {
+ size = i + 1;
+ HDmemset(out, 'A' + i % 26, size);
H5Eclear2(H5E_DEFAULT);
- status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i);
- if (status<0) {
+ status = H5HG_insert(f, H5P_DATASET_XFER_DEFAULT, size, out, obj + i);
+ if(status < 0) {
H5_FAILED();
puts(" Unable to insert object into global heap");
nerrors++;
- } else if (i && H5F_addr_gt (obj[i-1].addr, obj[i].addr)) {
+ } else if(i && H5F_addr_gt(obj[i - 1].addr, obj[i].addr)) {
H5_FAILED();
puts(" Collection addresses are not monotonically increasing");
nerrors++;
@@ -122,27 +122,28 @@ test_1 (hid_t fapl)
/*
* Now try to read each object back.
*/
- for (i=0; i<1024; i++) {
- size = i+1;
- memset (out, 'A'+i%26, size);
+ for(i = 0; i < 1024; i++) {
+ size = i + 1;
+ HDmemset(out, 'A' + i % 26, size);
H5Eclear2(H5E_DEFAULT);
- if (NULL==H5HG_read (f, H5P_DATASET_XFER_DEFAULT, obj+i, in, NULL)) {
+ if(NULL == H5HG_read(f, H5P_DATASET_XFER_DEFAULT, obj + i, in, NULL)) {
H5_FAILED();
puts(" Unable to read object");
nerrors++;
- } else if (memcmp (in, out, size)) {
+ } else if(HDmemcmp(in, out, size)) {
H5_FAILED();
puts(" Value read doesn't match value written");
nerrors++;
}
}
- if (H5Fclose(file)<0) goto error;
- if (nerrors) goto error;
+ if(H5Fclose(file) < 0) goto error;
+ if(nerrors) goto error;
+
PASSED();
return 0;
- error:
+error:
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
@@ -170,23 +171,23 @@ test_1 (hid_t fapl)
static int
test_2 (hid_t fapl)
{
- hid_t file=-1;
- H5F_t *f=NULL;
+ hid_t file = -1;
+ H5F_t *f = NULL;
H5HG_t obj[1024];
uint8_t out[1024];
uint8_t in[1024];
int i;
size_t size;
- int nerrors=0;
+ int nerrors = 0;
char filename[1024];
TESTING("monotonically decreasing lengths");
/* Open a clean file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if (NULL==(f=H5I_object(file))) {
+ if(NULL == (f = (H5F_t *)H5I_object(file))) {
H5_FAILED();
puts(" Unable to create file");
goto error;
@@ -257,23 +258,23 @@ test_2 (hid_t fapl)
static int
test_3 (hid_t fapl)
{
- hid_t file=-1;
- H5F_t *f=NULL;
+ hid_t file = -1;
+ H5F_t *f = NULL;
H5HG_t obj[1024];
uint8_t out[1024];
int i;
size_t size;
herr_t status;
- int nerrors=0;
+ int nerrors = 0;
char filename[1024];
TESTING("complete object removal");
/* Open a clean file */
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if (NULL==(f=H5I_object(file))) {
+ if(NULL == (f = (H5F_t *)H5I_object(file))) {
H5_FAILED();
puts(" Unable to create file");
goto error;
@@ -336,23 +337,23 @@ test_3 (hid_t fapl)
static int
test_4 (hid_t fapl)
{
- hid_t file=-1;
- H5F_t *f=NULL;
+ hid_t file = -1;
+ H5F_t *f = NULL;
H5HG_t obj[1024];
uint8_t out[1024];
int i;
size_t size;
herr_t status;
- int nerrors=0;
+ int nerrors = 0;
char filename[1024];
TESTING("partial object removal");
/* Open a clean file */
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if (NULL==(f=H5I_object(file))) {
+ if(NULL == (f = (H5F_t *)H5I_object(file))) {
H5_FAILED();
puts(" Unable to create file");
goto error;
diff --git a/test/h5test.h b/test/h5test.h
index 722d850..70408d9 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -118,11 +118,9 @@ extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
/*
* Alarm definitions to wait up (terminate) a test that runs too long.
*/
-#define alarm_seconds 1800 /* default is 30 minutes */
-#define ALARM_ON HDalarm(alarm_seconds)
+#define H5_ALARM_SEC 1200 /* default is 20 minutes */
+#define ALARM_ON TestAlarmOn()
#define ALARM_OFF HDalarm(0)
-/* set alarms to N seconds if N > 0, else use default alarm_seconds. */
-#define ALARM_SET(N) HDalarm((N)>0 ? N : alarm_seconds)
/*
* The methods to compare the equality of floating-point values:
@@ -183,6 +181,8 @@ H5TEST_DLL void IncTestNumErrs(void);
H5TEST_DLL const void *GetTestParameters(void);
H5TEST_DLL int TestErrPrintf(const char *format, ...);
H5TEST_DLL void SetTest(const char *testname, int action);
+H5TEST_DLL void TestAlarmOn(void);
+H5TEST_DLL void TestAlarmOff(void);
#ifdef H5_HAVE_FILTER_SZIP
H5TEST_DLL int h5_szip_can_encode(void);
diff --git a/test/hyperslab.c b/test/hyperslab.c
index e216b95..fdeaffd 100644
--- a/test/hyperslab.c
+++ b/test/hyperslab.c
@@ -125,7 +125,7 @@ print_ref(size_t nx, size_t ny, size_t nz)
{
uint8_t *array;
- if(NULL != (array = HDmalloc(nx * ny * nz))) {
+ if(NULL != (array = (uint8_t *)HDmalloc(nx * ny * nz))) {
printf("Reference array:\n");
init_full(array, nx, ny, nz);
print_array(array, nx, ny, nz);
@@ -190,7 +190,7 @@ test_fill(size_t nx, size_t ny, size_t nz,
fflush(stdout);
/* Allocate array */
- if(NULL == (dst = HDcalloc((size_t)1, nx * ny * nz)))
+ if(NULL == (dst = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz)))
TEST_ERROR
init_full(dst, nx, ny, nz);
@@ -387,9 +387,9 @@ test_copy(int mode,
/*
* Allocate arrays
*/
- if(NULL == (src = HDcalloc((size_t)1, nx * ny * nz)))
+ if(NULL == (src = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz)))
TEST_ERROR
- if(NULL == (dst = HDcalloc((size_t)1, nx * ny * nz)))
+ if(NULL == (dst = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz)))
TEST_ERROR
init_full(src, nx, ny, nz);
@@ -602,9 +602,9 @@ test_multifill(size_t nx)
fflush(stdout);
/* Initialize the source and destination */
- if(NULL == (src = HDmalloc(nx * sizeof(*src))))
+ if(NULL == (src = (struct a_struct *)HDmalloc(nx * sizeof(*src))))
TEST_ERROR
- if(NULL == (dst = HDmalloc(nx * sizeof(*dst))))
+ if(NULL == (dst = (struct a_struct *)HDmalloc(nx * sizeof(*dst))))
TEST_ERROR
for(i = 0; i < nx; i++) {
@@ -717,9 +717,9 @@ test_endian(size_t nx)
fflush(stdout);
/* Initialize arrays */
- if(NULL == (src = HDmalloc(nx * 4)))
+ if(NULL == (src = (uint8_t *)HDmalloc(nx * 4)))
TEST_ERROR
- if(NULL == (dst = HDcalloc(nx , (size_t)4)))
+ if(NULL == (dst = (uint8_t *)HDcalloc(nx , (size_t)4)))
TEST_ERROR
init_full(src, nx, (size_t)4,(size_t)1);
@@ -805,9 +805,9 @@ test_transpose(size_t nx, size_t ny)
fflush(stdout);
/* Initialize */
- if(NULL == (src = HDmalloc(nx * ny * sizeof(*src))))
+ if(NULL == (src = (int *)HDmalloc(nx * ny * sizeof(*src))))
TEST_ERROR
- if(NULL == (dst = HDcalloc(nx * ny, sizeof(*dst))))
+ if(NULL == (dst = (int *)HDcalloc(nx * ny, sizeof(*dst))))
TEST_ERROR
for(i = 0; i < nx; i++)
@@ -911,11 +911,11 @@ test_sub_super(size_t nx, size_t ny)
fflush(stdout);
/* Initialize */
- if(NULL == (full = HDmalloc(4 * nx * ny)))
+ if(NULL == (full = (uint8_t *)HDmalloc(4 * nx * ny)))
TEST_ERROR
- if(NULL == (half = HDcalloc((size_t)1, nx * ny)))
+ if(NULL == (half = (uint8_t *)HDcalloc((size_t)1, nx * ny)))
TEST_ERROR
- if(NULL == (twice = HDcalloc((size_t)4, nx * ny)))
+ if(NULL == (twice = (uint8_t *)HDcalloc((size_t)4, nx * ny)))
TEST_ERROR
init_full(full, 2 * nx, 2 * ny, (size_t)1);
@@ -1063,7 +1063,7 @@ test_array_fill(size_t lo, size_t hi)
TESTING(s);
/* Initialize */
- if(NULL == (dst = HDcalloc(sizeof(int),ARRAY_FILL_SIZE * hi)))
+ if(NULL == (dst = (int *)HDcalloc(sizeof(int),ARRAY_FILL_SIZE * hi)))
TEST_ERROR
/* Setup */
@@ -1128,7 +1128,7 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
TESTING(s);
/* Initialize */
- if(NULL == (a = HDmalloc(sizeof(hsize_t) * x * y *z)))
+ if(NULL == (a = (hsize_t *)HDmalloc(sizeof(hsize_t) * x * y *z)))
TEST_ERROR
dims[0] = z;
diff --git a/test/links.c b/test/links.c
index f23a566..12b8ba4 100644
--- a/test/links.c
+++ b/test/links.c
@@ -2944,7 +2944,7 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[19], fapl, filename3, sizeof filename3);
/* create tmp directory and get current working directory path */
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
+ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -2957,8 +2957,8 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -2966,7 +2966,7 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -2977,7 +2977,7 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file from absolute path set for main file */
- if (gid < 0) {
+ if(gid < 0) {
H5_FAILED();
puts(" Should have found the file in tmp directory.");
goto error;
@@ -3123,7 +3123,7 @@ external_link_cwd(hid_t fapl, hbool_t new_format)
/* set up name for target file: "extlinks5" */
h5_fixname(FILENAME[22], fapl, filename2, sizeof filename2);
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
+ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -3135,8 +3135,8 @@ external_link_cwd(hid_t fapl, hbool_t new_format)
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
/* Create the target file */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -3144,7 +3144,7 @@ external_link_cwd(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -3155,7 +3155,7 @@ external_link_cwd(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file from the current working directory */
- if (gid < 0) {
+ if(gid < 0) {
H5_FAILED();
puts(" Should have found the file in current working directory");
goto error;
@@ -3216,7 +3216,7 @@ external_link_abstar(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
/* create tmp directory and get current working directory path */
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
+ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -3231,8 +3231,8 @@ external_link_abstar(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[23], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -3240,7 +3240,7 @@ external_link_abstar(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -3251,7 +3251,7 @@ external_link_abstar(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file with abolute path */
- if (gid < 0) {
+ if(gid < 0) {
H5_FAILED();
puts(" Should have found the file in tmp directory.");
goto error;
@@ -3313,7 +3313,7 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[24], fapl, filename3, sizeof filename3);
/* create tmp directory and get current working directory path */
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
+ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -3325,8 +3325,8 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format)
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -3334,7 +3334,7 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -3595,8 +3595,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
else
TESTING("H5Pset/get_elink_fapl() with different physical layouts")
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) ||
- (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
+ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -3623,10 +3622,10 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
HDmemset(memb_addr, 0, sizeof memb_addr);
HDmemset(sv, 0, sizeof sv);
- for (mt = 0; mt < H5FD_MEM_NTYPES; mt++) {
+ for(mt = 0; mt < H5FD_MEM_NTYPES; mt++) {
memb_map[mt] = H5FD_MEM_SUPER;
memb_fapl[mt] = H5P_DEFAULT;
- }
+ } /* end for */
memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
memb_map[H5FD_MEM_BTREE] = H5FD_MEM_BTREE;
@@ -3637,7 +3636,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER];
memb_addr[H5FD_MEM_SUPER] = 0;
- sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b');
+ sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b');
memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE];
memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/6;
@@ -3795,8 +3794,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
else
TESTING("H5Pset/get_elink_fapl() with same physical layout")
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) ||
- (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
+ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
@@ -4393,7 +4391,7 @@ external_link_win1(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- if (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL)
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
/* set up name for target link: "/CWD/tmp/extlinks10" */
@@ -4406,8 +4404,8 @@ external_link_win1(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[29], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -4415,7 +4413,7 @@ external_link_win1(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -4426,7 +4424,7 @@ external_link_win1(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file via main file's CWD*/
- if (gid < 0) {
+ if(gid < 0) {
H5_FAILED();
puts(" Should have found the file in CWD.");
goto error;
@@ -4487,7 +4485,7 @@ external_link_win2(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
/* create tmp directory and get current working directory path */
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
+ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/* set up name for target link: "/CWD/tmp/extlinks11" */
@@ -4500,8 +4498,8 @@ external_link_win2(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[31], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -4509,7 +4507,7 @@ external_link_win2(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -4520,7 +4518,7 @@ external_link_win2(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file directly */
- if (gid < 0) {
+ if(gid < 0) {
H5_FAILED();
puts(" Should have found the file in tmp.");
goto error;
@@ -4760,7 +4758,7 @@ external_link_win5(hid_t fapl, hbool_t new_format)
else
TESTING("external links via main file's rel drive/abs path (windows)")
- if (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL)
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
drive = HDgetdrive();
@@ -4778,8 +4776,8 @@ external_link_win5(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[35], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -4787,7 +4785,7 @@ external_link_win5(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -4798,7 +4796,7 @@ external_link_win5(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file via main file's rel drive/abs path */
- if (gid < 0) {
+ if(gid < 0) {
H5_FAILED();
puts(" Should have found the file in CWD.");
goto error;
@@ -4945,7 +4943,7 @@ external_link_win7(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- if (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL)
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
/* set up name for target link: "\\127.0.0.1\c$/tmp/extlinks10" */
@@ -4958,8 +4956,8 @@ external_link_win7(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[29], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -4967,7 +4965,7 @@ external_link_win7(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -4978,10 +4976,10 @@ external_link_win7(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file via main file's local host/main drive*/
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in local host/main drive.");
- goto error;
+ if(gid < 0) {
+ H5_FAILED();
+ puts(" Should have found the file in local host/main drive.");
+ goto error;
}
/* closing for main file */
@@ -5034,11 +5032,11 @@ external_link_win8(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- if (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL)
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
/* create tmp directory */
- if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
+ if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR
/* set up name for target link: "<drive-letter>:\CWD\extlinks10" */
@@ -5050,8 +5048,8 @@ external_link_win8(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[30], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -5059,7 +5057,7 @@ external_link_win8(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -5070,10 +5068,10 @@ external_link_win8(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file directly */
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in tmp.");
- goto error;
+ if(gid < 0) {
+ H5_FAILED();
+ puts(" Should have found the file in tmp.");
+ goto error;
}
/* closing for main file */
@@ -5124,7 +5122,7 @@ external_link_win9(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- if (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL)
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
/* set up name for target link: "\\?\UNC\127.0.0.1\c$/tmp/extlinks10" */
@@ -5137,8 +5135,8 @@ external_link_win9(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[29], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -5146,7 +5144,7 @@ external_link_win9(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -5157,10 +5155,10 @@ external_link_win9(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
/* should be able to find the target file via main file's local host/main drive*/
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in local host/main drive.");
- goto error;
+ if(gid < 0) {
+ H5_FAILED();
+ puts(" Should have found the file in local host/main drive.");
+ goto error;
}
/* closing for main file */
@@ -6434,7 +6432,7 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
TEST_ERROR
if(HDmkdir(TMPDIR2, (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR
- if(NULL == HDgetcwd(cwdpath, NAME_BUF_SIZE))
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
/* Set up names for files in the subdirectories */
@@ -6784,14 +6782,30 @@ done:
if(H5Gclose(target_obj) < 0)
ret_value = -1;
break;
+
case H5I_DATASET:
if(H5Dclose(target_obj) < 0)
ret_value = -1;
break;
+
case H5I_DATATYPE:
if(H5Tclose(target_obj) < 0)
ret_value = -1;
break;
+
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_FILE:
+ case H5I_DATASPACE:
+ case H5I_ATTR:
+ case H5I_REFERENCE:
+ case H5I_VFL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_NTYPES:
default:
return -1;
} /* end switch */
@@ -6855,14 +6869,30 @@ done:
if(H5Gclose(target_obj) < 0)
ret_value = -1;
break;
+
case H5I_DATASET:
if(H5Dclose(target_obj) < 0)
ret_value = -1;
break;
+
case H5I_DATATYPE:
if(H5Tclose(target_obj) < 0)
ret_value = -1;
break;
+
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_FILE:
+ case H5I_DATASPACE:
+ case H5I_ATTR:
+ case H5I_REFERENCE:
+ case H5I_VFL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_NTYPES:
default:
return -1;
} /* end switch */
@@ -6928,7 +6958,7 @@ ud_hard_links(hid_t fapl)
/* Create a user-defined "hard link" to the group using the address we got
* from H5Lget_info */
- if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), (size_t)sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close and re-open file to ensure that data is written to disk */
if(H5Fclose(fid) < 0) TEST_ERROR
@@ -7829,9 +7859,9 @@ ud_link_errors(hid_t fapl, hbool_t new_format)
/* Try to create internally defined links with H5Lcreate_ud */
H5E_BEGIN_TRY {
- if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_HARD, NULL, 0, H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_HARD, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) >= 0)
TEST_ERROR
- if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_SOFT, "str", 4, H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_SOFT, "str", (size_t)4, H5P_DEFAULT, H5P_DEFAULT) >= 0)
TEST_ERROR
} H5E_END_TRY
@@ -8853,7 +8883,7 @@ static enum {
LFS_DECODED
} link_filter_state;
-static herr_t link_filter_can_apply(hid_t dcpl_id, hid_t type_id, hid_t space_id)
+static htri_t link_filter_can_apply(hid_t dcpl_id, hid_t type_id, hid_t space_id)
{
if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0)
return -1;
@@ -9064,7 +9094,7 @@ link_filters(hid_t fapl, hbool_t new_format)
|| filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED
| H5Z_FILTER_CONFIG_DECODE_ENABLED))
TEST_ERROR
- if(H5Pget_filter2(gcpl2, nfilters - 1, &flags_out, &cd_nelmts,
+ if(H5Pget_filter2(gcpl2, (unsigned)(nfilters - 1), &flags_out, &cd_nelmts,
&cd_value_out, (size_t)24, name_out, &filter_config_out) < 0)
TEST_ERROR
if(flags_out != 0 || cd_value_out != cd_value
@@ -12163,15 +12193,10 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id,
/* Work through main & soft link groups */
for(v = 0; v < 2; v++) {
/* Choose appropriate group to open links within */
- switch(v) {
- case 0:
- group_id = main_group_id;
- break;
-
- case 1:
- group_id = soft_group_id;
- break;
- } /* end switch */
+ if(0 == v)
+ group_id = main_group_id;
+ else
+ group_id = soft_group_id;
/* Open each object in main group by index and check that it's the correct one */
for(u = 0; u < max_links; u++) {
@@ -12628,15 +12653,10 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type,
/* Work through main & soft link groups */
for(v = 0; v < 2; v++) {
/* Choose appropriate group to open links within */
- switch(v) {
- case 0:
- group_id = main_group_id;
- break;
-
- case 1:
- group_id = soft_group_id;
- break;
- } /* end switch */
+ if(0 == v)
+ group_id = main_group_id;
+ else
+ group_id = soft_group_id;
/* Open each object in group by name and check that it's the correct one */
for(u = 0; u < max_links; u++) {
diff --git a/test/mtime.c b/test/mtime.c
index cc04e42..83e8354 100644
--- a/test/mtime.c
+++ b/test/mtime.c
@@ -99,7 +99,7 @@ main(void)
if(H5Fclose(file) < 0) TEST_ERROR;
/* Compare addresses & times from the two ways of calling H5Oget_info() */
- if(oi1.addr != oi2.addr || oi1.mtime != oi2.mtime) {
+ if(oi1.addr != oi2.addr || oi1.ctime != oi2.ctime) {
H5_FAILED();
puts(" Calling H5Oget_info() with the dataset ID returned");
puts(" different values than calling it with a file and dataset");
@@ -108,15 +108,15 @@ main(void)
}
/* Compare times -- they must be within 60 seconds of one another */
- if(0 == oi1.mtime) {
+ if(0 == oi1.ctime) {
SKIPPED();
puts(" The modification time could not be decoded on this OS.");
puts(" Modification times will be mantained in the file but");
puts(" cannot be queried on this system. See H5O_mtime_decode().");
return 0;
- } else if(HDfabs(HDdifftime(now, oi1.mtime)) > 60.0) {
+ } else if(HDfabs(HDdifftime(now, oi1.ctime)) > 60.0) {
H5_FAILED();
- tm = HDlocaltime(&(oi1.mtime));
+ tm = HDlocaltime(&(oi1.ctime));
HDstrftime((char*)buf1, sizeof buf1, "%Y-%m-%d %H:%M:%S", tm);
tm = HDlocaltime(&now);
HDstrftime((char*)buf2, sizeof buf2, "%Y-%m-%d %H:%M:%S", tm);
@@ -138,7 +138,7 @@ main(void)
if(file >= 0){
if(H5Oget_info_by_name(file, "/Dataset1", &oi1, H5P_DEFAULT) < 0)
TEST_ERROR;
- if(oi1.mtime != MTIME1) {
+ if(oi1.ctime != MTIME1) {
H5_FAILED();
/* If this fails, examine H5Omtime.c. Modification time is very
* system dependant (e.g., on Windows DST must be hardcoded). */
@@ -168,7 +168,7 @@ main(void)
if(file >= 0){
if(H5Oget_info_by_name(file, "/Dataset1", &oi2, H5P_DEFAULT) < 0)
TEST_ERROR;
- if(oi2.mtime != MTIME2) {
+ if(oi2.ctime != MTIME2) {
H5_FAILED();
puts(" Modification time incorrect.");
goto error;
diff --git a/test/objcopy.c b/test/objcopy.c
index 4736af1..edeca09 100755
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -811,7 +811,7 @@ compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid)
/* Check the attributes are equal */
for(i = 0; i < (unsigned)oinfo1.num_attrs; i++) {
if((aid = H5Aopen_by_idx(oid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)i, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Aget_name(aid, ATTR_NAME_LEN, attr_name) < 0) TEST_ERROR
+ if(H5Aget_name(aid, (size_t)ATTR_NAME_LEN, attr_name) < 0) TEST_ERROR
if((aid2 = H5Aopen(oid2, attr_name, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -996,8 +996,7 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
}
/* Check for types of objects handled */
- switch(obj1_type)
- {
+ switch(obj1_type) {
case H5O_TYPE_DATASET:
if(compare_datasets(obj1_id, obj2_id, pid, NULL) != TRUE) TEST_ERROR
break;
@@ -1010,6 +1009,8 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
if(H5Tequal(obj1_id, obj2_id) != TRUE) TEST_ERROR
break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
default:
TEST_ERROR
} /* end switch */
@@ -1053,8 +1054,7 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
}
/* Check for types of objects handled */
- switch(obj1_type)
- {
+ switch(obj1_type) {
case H5O_TYPE_DATASET:
if(compare_datasets(obj1_id, obj2_id, pid, NULL) != TRUE) TEST_ERROR
break;
@@ -1067,6 +1067,8 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
if(H5Tequal(obj1_id, obj2_id) != TRUE) TEST_ERROR
break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
default:
TEST_ERROR
} /* end switch */
@@ -1196,8 +1198,8 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf)
/* Ensure that all external file information is the same */
for(x=0; x < (unsigned) ext_count; ++x)
{
- if(H5Pget_external(dcpl, x, NAME_BUF_SIZE, name1, &offset1, &size1) < 0) TEST_ERROR
- if(H5Pget_external(dcpl2, x, NAME_BUF_SIZE, name2, &offset2, &size2) < 0) TEST_ERROR
+ if(H5Pget_external(dcpl, x, (size_t)NAME_BUF_SIZE, name1, &offset1, &size1) < 0) TEST_ERROR
+ if(H5Pget_external(dcpl2, x, (size_t)NAME_BUF_SIZE, name2, &offset2, &size2) < 0) TEST_ERROR
if(offset1 != offset2) TEST_ERROR
if(size1 != size2) TEST_ERROR
@@ -1421,6 +1423,8 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags)
if(H5Tequal(oid, oid2) != TRUE) TEST_ERROR
break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
default:
HDassert(0 && "Unknown type of object");
break;
@@ -2161,10 +2165,13 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl)
TESTING("H5Ocopy(): compound dataset");
- for (i=0; i<DIM_SIZE_1; i++) {
+#ifdef H5_CLEAR_MEMORY
+ HDmemset(buf, 0, sizeof(buf));
+#endif /* H5_CLEAR_MEMORY */
+ for(i = 0; i < DIM_SIZE_1; i++) {
buf[i].a = i;
- buf[i].d = 1./(i+1);
- }
+ buf[i].d = 1. / (i + 1);
+ } /* end for */
/* Initialize the filenames */
h5_fixname(FILENAME[0], fapl, src_filename, sizeof src_filename);
@@ -2183,7 +2190,7 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl)
if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
/* create datatype */
- if((tid = H5Tcreate (H5T_COMPOUND, sizeof(comp_t))) < 0) TEST_ERROR
+ if((tid = H5Tcreate(H5T_COMPOUND, sizeof(comp_t))) < 0) TEST_ERROR
if(H5Tinsert(tid, "int_name", HOFFSET(comp_t, a), H5T_NATIVE_INT) < 0) TEST_ERROR
if(H5Tinsert(tid, "double_name", HOFFSET(comp_t, d), H5T_NATIVE_DOUBLE) < 0) TEST_ERROR
@@ -8489,7 +8496,7 @@ main(void)
/* Create an FCPL with sharing enabled */
if((fcpl_shared = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR
if(H5Pset_shared_mesg_nindexes(fcpl_shared, 1) < 0) TEST_ERROR
- if(H5Pset_shared_mesg_index(fcpl_shared, 0, H5O_SHMESG_ALL_FLAG, (size_t) 10) < 0) TEST_ERROR
+ if(H5Pset_shared_mesg_index(fcpl_shared, 0, H5O_SHMESG_ALL_FLAG, 10) < 0) TEST_ERROR
/* Obtain the default attribute storage phase change values */
if((ocpl = H5Pcreate(H5P_OBJECT_CREATE)) < 0) TEST_ERROR
@@ -8625,7 +8632,7 @@ main(void)
nerrors += test_copy_same_file_named_datatype(fcpl_src, my_fapl);
nerrors += test_copy_old_layout(fcpl_dst, my_fapl);
nerrors += test_copy_null_ref(fcpl_src, fcpl_dst, my_fapl);
- }
+ }
/* TODO: not implemented
nerrors += test_copy_mount(my_fapl);
diff --git a/test/pool.c b/test/pool.c
index 9b2e8b9..916d45e 100644
--- a/test/pool.c
+++ b/test/pool.c
@@ -649,11 +649,11 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
TEST_ERROR
/* Allocate space for the block sizes */
- if(NULL == (blk_size = HDmalloc(sizeof(size_t) * MPOOL_NUM_RANDOM)))
+ if(NULL == (blk_size = (size_t *)HDmalloc(sizeof(size_t) * MPOOL_NUM_RANDOM)))
TEST_ERROR
/* Allocate space for the block pointers */
- if(NULL == (spc = HDmalloc(sizeof(void *) * MPOOL_NUM_RANDOM)))
+ if(NULL == (spc = (void **)HDmalloc(sizeof(void *) * MPOOL_NUM_RANDOM)))
TEST_ERROR
/* Initialize the block sizes with random values */
diff --git a/test/set_extent.c b/test/set_extent.c
index 39cc446..4351635 100644
--- a/test/set_extent.c
+++ b/test/set_extent.c
@@ -153,10 +153,10 @@ int main( void )
if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
/* Set chunk cache so only part of the chunks can be cached on fapl */
- if(H5Pset_cache(fapl, 0, 8, 256 * sizeof(int), 0.75) < 0) TEST_ERROR
+ if(H5Pset_cache(fapl, 0, (size_t)8, 256 * sizeof(int), 0.75) < 0) TEST_ERROR
/* Disable chunk caching on fapl2 */
- if(H5Pset_cache(fapl2, 0, 0, 0, 0.) < 0) TEST_ERROR
+ if(H5Pset_cache(fapl2, 0, (size_t)0, (size_t)0, 0.) < 0) TEST_ERROR
/* Set the "use the latest version of the format" bounds for creating objects in the file */
if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR
diff --git a/test/stab.c b/test/stab.c
index cab0b1b..e8ffec3 100644
--- a/test/stab.c
+++ b/test/stab.c
@@ -53,7 +53,6 @@ const char *FILENAME[] = {
/* Definitions for 'read_old' test */
#define READ_OLD_NGROUPS 100
-#define READ_OLD_BUFSIZE 1024
/* The group_old.h5 is generated from gen_old_fill.c in HDF5 'test' directory
* for version 1.6. To get this data file, simply compile gen_old_group.c with
@@ -79,7 +78,6 @@ const char *FILENAME[] = {
/* Definitions for 'corrupt_stab_msg' test */
#define CORRUPT_STAB_FILE "corrupt_stab_msg.h5"
#define CORRUPT_STAB_TMP_FILE "corrupt_stab_msg_tmp.h5"
-#define CORRUPT_STAB_COPY_BUF_SIZE 4096
#define CORRUPT_STAB_DSET "DS1"
diff --git a/test/tattr.c b/test/tattr.c
index 828b8a8..60d4ddb 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -9802,6 +9802,7 @@ test_attr_bug3(hid_t fcpl, hid_t fapl)
dims2[2] = {3, 3}; /* Dimensions */
int wdata1[2][2];
unsigned wdata2[3][3]; /* Write buffers */
+ unsigned u, v; /* Local index variables */
herr_t ret; /* Generic return status */
/* Output message about test being performed */
@@ -9849,11 +9850,18 @@ test_attr_bug3(hid_t fcpl, hid_t fapl)
aid2 = H5Aopen(did, "attr", H5P_DEFAULT);
CHECK(aid2, FAIL, "H5Aopen");
- /* Write data to the attributes (the data is uninitialized, we only care
- * that H5Awrite succeeds for now) */
- ret = H5Awrite(aid1, H5T_NATIVE_INT, wdata1[0]);
+ /* Initialize the write buffers */
+ for(u = 0; u < dims1[0]; u++)
+ for(v = 0; v < dims1[1]; v++)
+ wdata1[u][v] = (int)((u * dims1[1]) + v);
+ for(u = 0; u < dims2[0]; u++)
+ for(v = 0; v < dims2[1]; v++)
+ wdata2[u][v] = (int)((u * dims2[1]) + v);
+
+ /* Write data to the attributes */
+ ret = H5Awrite(aid1, H5T_NATIVE_INT, wdata1);
CHECK(ret, FAIL, "H5Awrite");
- ret = H5Awrite(aid2, H5T_NATIVE_UINT, wdata2[0]);
+ ret = H5Awrite(aid2, H5T_NATIVE_UINT, wdata2);
CHECK(ret, FAIL, "H5Awrite");
/* Close attributes */
diff --git a/test/testframe.c b/test/testframe.c
index 201f569..082a27f 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -588,3 +588,21 @@ void SetTest(const char *testname, int action)
break;
}
}
+
+
+/*
+ * Enable alarm on test execution, configurable by environment variable
+ */
+void TestAlarmOn(void)
+{
+ char * env_val = HDgetenv("HDF5_ALARM_SECONDS"); /* Alarm environment */
+ unsigned long alarm_sec = H5_ALARM_SEC; /* Number of seconds before alarm goes off */
+
+ /* Get the alarm value from the environment variable, if set */
+ if(env_val != NULL)
+ alarm_sec = (unsigned)HDstrtoul(env_val, (char **)NULL, 10);
+
+ /* Set the number of seconds before alarm goes off */
+ HDalarm((unsigned)alarm_sec);
+}
+
diff --git a/test/th5s.c b/test/th5s.c
index 2de867b..ddd61e3 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -889,6 +889,10 @@ test_h5s_compound_scalar_write(void)
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
+ /* Close compound datatype */
+ ret = H5Tclose(tid1);
+ CHECK(ret, FAIL, "H5Tclose");
+
/* Close scalar dataspace */
ret = H5Sclose(sid1);
CHECK(ret, FAIL, "H5Sclose");
diff --git a/test/trefer.c b/test/trefer.c
index 6ee298f..4ab3fba 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -79,23 +79,19 @@ test_reference_params(void)
hobj_ref_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
*tbuf; /* temp. buffer read from disk */
- hobj_ref_t nvrbuf[3]={0,101,1000000000}; /* buffer with non-valid refs */
unsigned *tu32; /* Temporary pointer to uint32 data */
- int i, j; /* counting variables */
- const char *write_comment="Foo!"; /* Comments for group */
- char read_comment[10];
- H5O_type_t obj_type; /* Object type */
+ int i; /* counting variables */
+ const char *write_comment = "Foo!"; /* Comments for group */
herr_t ret; /* Generic return value */
- char *ref_name; /* Buffer for ref name */
size_t name_size; /* Size of reference name */
/* Output message about test being performed */
MESSAGE(5, ("Testing Reference Parameters\n"));
/* Allocate write & read buffers */
- wbuf = malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
- rbuf = malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
- tbuf = malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ wbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ rbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ tbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
/* Create file */
fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -263,9 +259,9 @@ test_reference_obj(void)
MESSAGE(5, ("Testing Object Reference Functions\n"));
/* Allocate write & read buffers */
- wbuf = malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
- rbuf = malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
- tbuf = malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ wbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ rbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ tbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
/* Create file */
fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -509,10 +505,10 @@ test_reference_region(void)
MESSAGE(5, ("Testing Dataset Region Reference Functions\n"));
/* Allocate write & read buffers */
- wbuf = HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
- rbuf = HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
- dwbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- drbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
+ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
+ rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
+ dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
/* Create file */
fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -781,10 +777,10 @@ test_reference_region_1D(void)
MESSAGE(5, ("Testing 1-D Dataset Region Reference Functions\n"));
/* Allocate write & read buffers */
- wbuf = HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
- rbuf = HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
- dwbuf = HDmalloc(sizeof(uint8_t) * SPACE3_DIM1);
- drbuf = HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
+ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
+ rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
+ dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1);
+ drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
/* Create file */
fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -922,7 +918,7 @@ test_reference_region_1D(void)
VERIFY(ret, 30, "H5Sget_select_npoints");
ret = (int)H5Sget_select_hyper_nblocks(sid3);
VERIFY(ret, 15, "H5Sget_select_hyper_nblocks");
- coords = HDmalloc(ret * SPACE3_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
+ coords = (hsize_t *)HDmalloc(ret * SPACE3_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
ret = H5Sget_select_hyper_blocklist(sid3, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
VERIFY(coords[0], 2, "Hyperslab Coordinates");
@@ -974,7 +970,7 @@ test_reference_region_1D(void)
VERIFY(ret, 10, "H5Sget_select_npoints");
ret = (int)H5Sget_select_elem_npoints(sid3);
VERIFY(ret, 10, "H5Sget_select_elem_npoints");
- coords = HDmalloc(ret * SPACE3_RANK * sizeof(hsize_t)); /* allocate space for the element points */
+ coords = (hsize_t *)HDmalloc(ret * SPACE3_RANK * sizeof(hsize_t)); /* allocate space for the element points */
ret = H5Sget_select_elem_pointlist(sid3, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
VERIFY(coords[0], coord1[0][0], "Element Coordinates");
@@ -1313,10 +1309,10 @@ test_reference_compat(void)
MESSAGE(5, ("Testing Deprecated Object Reference Functions\n"));
/* Allocate write & read buffers */
- wbuf_obj = HDcalloc(sizeof(hobj_ref_t), SPACE1_DIM1);
- rbuf_obj = HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
- wbuf_reg = HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
- rbuf_reg = HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
+ wbuf_obj = (hobj_ref_t *)HDcalloc(sizeof(hobj_ref_t), SPACE1_DIM1);
+ rbuf_obj = (hobj_ref_t *)HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
+ wbuf_reg = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
+ rbuf_reg = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
/* Create file */
fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
diff --git a/test/tselect.c b/test/tselect.c
index 89cd9e5..1fa98bf 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -2795,7 +2795,7 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
* hence the following assertion. Delete it if we convert
* to 32 bit values.
*/
- HDassert(large_cube_size < (size_t)(UINT16_MAX));
+ HDassert(large_cube_size < (size_t)(64 * 1024));
/* Allocate & initialize buffers */
diff --git a/test/tsohm.c b/test/tsohm.c
index 8782a6d..62154b1 100644
--- a/test/tsohm.c
+++ b/test/tsohm.c
@@ -74,6 +74,7 @@ typedef struct dtype1_struct {
int i8;
float f1;
} dtype1_struct;
+
#define DTYPE2_SIZE 1024
const char *DSETNAME[] = {
"dataset0", "dataset1",
@@ -167,7 +168,9 @@ static hid_t make_dtype_1(void);
static hid_t make_dtype_2(void);
static hid_t close_reopen_file(hid_t file, const char* filename, hid_t fapl_id);
static void test_sohm_attrs(void);
+#ifdef NOT_NOW
static void size2_dump_struct(const char *name, size2_helper_struct *sizes);
+#endif /* NOT_NOW */
static void size2_verify(void);
static void test_sohm_delete(void);
static void test_sohm_delete_revert(void);
@@ -280,11 +283,10 @@ static void test_sohm_fcpl(void)
/* Set up index values */
ret = H5Pset_shared_mesg_nindexes(fcpl_id, TEST_NUM_INDEXES);
CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
- for(x=0; x<TEST_NUM_INDEXES; ++x)
- {
+ for(x = 0; x < TEST_NUM_INDEXES; ++x) {
ret = H5Pset_shared_mesg_index(fcpl_id, x, test_type_flags[x], test_minsizes[x]);
CHECK_I(ret, "H5Pset_shared_mesg_index");
- }
+ } /* end for */
ret = H5Pset_shared_mesg_phase_change(fcpl_id, TEST_L2B, TEST_B2L);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
@@ -419,8 +421,6 @@ static void test_sohm_fcpl(void)
* Programmer: James Laird
* Saturday, August 26, 2006
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static hid_t
@@ -429,23 +429,23 @@ make_dtype_1(void)
hid_t dtype1_id = -1;
hid_t str_id = -1;
- /* Create compound datatype. */
- if((dtype1_id = H5Tcreate( H5T_COMPOUND, sizeof(struct dtype1_struct))) < 0) TEST_ERROR
+ /* Create compound datatype. */
+ if((dtype1_id = H5Tcreate(H5T_COMPOUND, sizeof(struct dtype1_struct))) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i1",HOFFSET(struct dtype1_struct,i1),H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i1", HOFFSET(dtype1_struct, i1), H5T_NATIVE_INT) < 0) TEST_ERROR
str_id = H5Tcopy(H5T_C_S1);
- if(H5Tset_size(str_id,(size_t) 10) < 0) TEST_ERROR
-
- if(H5Tinsert(dtype1_id,"vl_string",HOFFSET(dtype1_struct,str),str_id) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i2",HOFFSET(struct dtype1_struct,i2),H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i3",HOFFSET(struct dtype1_struct,i3),H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i4",HOFFSET(struct dtype1_struct,i4),H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i5",HOFFSET(struct dtype1_struct,i5),H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i6",HOFFSET(struct dtype1_struct,i6),H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i7",HOFFSET(struct dtype1_struct,i7),H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"i8",HOFFSET(struct dtype1_struct,i8),H5T_NATIVE_INT) < 0) TEST_ERROR
- if(H5Tinsert(dtype1_id,"f1",HOFFSET(struct dtype1_struct,f1),H5T_NATIVE_FLOAT) < 0) TEST_ERROR
+ if(H5Tset_size(str_id, (size_t)10) < 0) TEST_ERROR
+
+ if(H5Tinsert(dtype1_id, "string", HOFFSET(dtype1_struct, str), str_id) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i2", HOFFSET(dtype1_struct, i2), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i3", HOFFSET(dtype1_struct, i3), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i4", HOFFSET(dtype1_struct, i4), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i5", HOFFSET(dtype1_struct, i5), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i6", HOFFSET(dtype1_struct, i6), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i7", HOFFSET(dtype1_struct, i7), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "i8", HOFFSET(dtype1_struct, i8), H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(H5Tinsert(dtype1_id, "f1", HOFFSET(dtype1_struct, f1), H5T_NATIVE_FLOAT) < 0) TEST_ERROR
if(H5Tclose(str_id) < 0) TEST_ERROR
@@ -488,15 +488,13 @@ make_dtype_2(void)
/* Create an int with a strange precision */
if((int_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if(H5Tset_precision(int_id, 24) < 0) TEST_ERROR
+ if(H5Tset_precision(int_id, (size_t)24) < 0) TEST_ERROR
/* Create an enumeration using that int */
if((enum_id = H5Tenum_create(int_id)) < 0) TEST_ERROR
- for(x=0; x<ENUM_NUM_MEMBS; x++)
- {
+ for(x = 0; x < ENUM_NUM_MEMBS; x++)
if(H5Tenum_insert(enum_id, ENUM_NAME[x], &ENUM_VAL[x]) < 0) TEST_ERROR
- }
/* Create arrays of arrays of arrays of enums */
if((dtype2_id = H5Tarray_create2(enum_id, 3, dims)) < 0) TEST_ERROR
@@ -572,14 +570,12 @@ error:
* Programmer: James Laird
* Monday, April 10, 2006
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static hid_t
size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_closing)
{
- dtype1_struct wdata = {11, "string", 22, 33, 44, 55, 66, 77, 88, 0.0};
+ dtype1_struct wdata;
dtype1_struct rdata;
hid_t dtype1_id = -1;
hid_t space_id = -1;
@@ -593,23 +589,36 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos
if(GetTestExpress() > 1)
test_file_closing = 0;
+ /* Intialize wdata */
+ HDmemset(&wdata, 0, sizeof(wdata));
+ wdata.i1 = 11;
+ HDstrcpy(wdata.str, "string");
+ wdata.i2 = 22;
+ wdata.i3 = 33;
+ wdata.i4 = 44;
+ wdata.i5 = 55;
+ wdata.i6 = 66;
+ wdata.i7 = 77;
+ wdata.i8 = 88;
+ wdata.f1 = 0.0;
+
/* Intialize rdata */
- strcpy(rdata.str, "\0");
+ HDmemset(&rdata, 0, sizeof(rdata));
if((dtype1_id = make_dtype_1()) < 0) TEST_ERROR
/* Create the dataspace and dataset */
dim1[0] = 1;
- if((space_id=H5Screate_simple(1,dim1,NULL)) < 0) TEST_ERROR
+ if((space_id = H5Screate_simple(1, dim1, NULL)) < 0) TEST_ERROR
- if((dset_id = H5Dcreate2(file,DSETNAME[0],dtype1_id,space_id,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((dset_id = H5Dcreate2(file, DSETNAME[0], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Test writing and reading */
- if(H5Dwrite(dset_id,dtype1_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,&wdata) < 0) FAIL_STACK_ERROR
+ if(H5Dwrite(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) FAIL_STACK_ERROR
- if(H5Dread(dset_id,dtype1_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,&rdata) < 0) FAIL_STACK_ERROR
+ if(H5Dread(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) FAIL_STACK_ERROR
- if(rdata.i1!=wdata.i1 || rdata.i2!=wdata.i2 || HDstrcmp(rdata.str, wdata.str)) {
+ if(rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) {
H5_FAILED(); AT();
printf("incorrect read data\n");
goto error;
@@ -617,26 +626,23 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos
if(H5Dclose(dset_id) < 0) FAIL_STACK_ERROR
/* Close and re-open the file if requested*/
- if(test_file_closing) {
+ if(test_file_closing)
if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR
- }
/* Create more datasets with the same datatype */
- if((dset_id = H5Dcreate2(file,DSETNAME[1],dtype1_id,space_id,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((dset_id = H5Dcreate2(file, DSETNAME[1], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
if(H5Dclose(dset_id) < 0) FAIL_STACK_ERROR
/* Close and re-open the file if requested*/
- if(test_file_closing) {
+ if(test_file_closing)
if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR
- }
- if((dset_id = H5Dcreate2(file,DSETNAME[2],dtype1_id,space_id,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((dset_id = H5Dcreate2(file, DSETNAME[2], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Dclose(dset_id) < 0) TEST_ERROR
/* Close and re-open the file if requested*/
- if(test_file_closing) {
+ if(test_file_closing)
if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR
- }
if((dset_id = H5Dcreate2(file,DSETNAME[3],dtype1_id,space_id,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -654,10 +660,8 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos
if((dset_id = H5Dopen2(file, DSETNAME[0], H5P_DEFAULT)) < 0) TEST_ERROR
if((dtype1_id = H5Dget_type(dset_id)) < 0) TEST_ERROR
- rdata.i1 = rdata.i2 = 0;
- HDstrcpy(rdata.str, "\0");
-
/* Read data back again */
+ HDmemset(&rdata, 0, sizeof(rdata));
if(H5Dread(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) {
H5_FAILED(); AT();
printf("Can't read data\n");
@@ -689,9 +693,8 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos
if((dset_id = H5Dopen2(file, DSETNAME[3], H5P_DEFAULT)) < 0) TEST_ERROR
if((dtype1_id = H5Dget_type(dset_id)) < 0) TEST_ERROR
- rdata.i1 = rdata.i2 = 0;
-
/* Read data back again */
+ HDmemset(&rdata, 0, sizeof(rdata));
if(H5Dread(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) {
H5_FAILED(); AT();
printf("Can't read data\n");
@@ -1016,12 +1019,11 @@ static void sohm_attr_helper(hid_t fcpl_id)
CHECK_I(ret, "H5Fflush");
/* Verify */
- memset(rdata, 0, sizeof(rdata));
+ HDmemset(rdata, 0, sizeof(rdata));
ret = H5Aread(attr_id, H5T_NATIVE_INT, rdata);
CHECK_I(ret, "H5Aread");
- for(x=0; x<(size_t)dims; ++x) {
+ for(x = 0; x < (size_t)dims; ++x)
VERIFY(rdata[x], wdata[x], "H5Aread");
- }
/* Cleanup */
ret = H5Aclose(attr_id);
@@ -1055,12 +1057,11 @@ static void sohm_attr_helper(hid_t fcpl_id)
CHECK_I(ret, "H5Fflush");
/* Verify */
- memset(rdata, 0, sizeof(rdata));
+ HDmemset(rdata, 0, sizeof(rdata));
ret = H5Aread(attr_id, H5T_NATIVE_INT, rdata);
CHECK_I(ret, "H5Aread");
- for(x=0; x<(size_t)dims; ++x) {
+ for(x = 0; x < (size_t)dims; ++x)
VERIFY(rdata[x], wdata[x], "H5Aread");
- }
/* Cleanup */
ret = H5Aclose(attr_id);
@@ -1092,13 +1093,12 @@ static void sohm_attr_helper(hid_t fcpl_id)
CHECK_I(ret, "H5Fflush");
/* Verify the data with another ID handle */
- memset(rdata, 0, sizeof(rdata));
+ HDmemset(rdata, 0, sizeof(rdata));
ret = H5Aread(attr_id2, H5T_NATIVE_INT, rdata);
CHECK_I(ret, "H5Aread");
- for(x=0; x<(size_t)dims; ++x) {
+ for(x = 0; x < (size_t)dims; ++x)
VERIFY(rdata[x], wdata[x], "H5Aread");
- }
/* Cleanup */
ret = H5Aclose(attr_id);
@@ -1249,23 +1249,23 @@ static void size2_verify_plist1(hid_t plist)
/* Hardcoded to correspond to dcpl1_id created in size2_helper */
/* Check filters */
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 0, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 0, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_SHUFFLE, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 1, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 1, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 1, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 2, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 2, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_SHUFFLE, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 3, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 3, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_FLETCHER32, "H5Pget_filter2");
@@ -1273,7 +1273,7 @@ static void size2_verify_plist1(hid_t plist)
/* Check fill value */
dtype1_id=make_dtype_1();
CHECK_I(dtype1_id, "make_dtype_1");
- memset(&fill1_correct, '1', sizeof(fill1_correct));
+ HDmemset(&fill1_correct, '1', sizeof(fill1_correct));
ret = H5Pget_fill_value(plist, dtype1_id, &fill1);
CHECK_I(ret, "H5Pget_fill_value");
@@ -1308,48 +1308,49 @@ static void size2_verify_plist2(hid_t plist)
/* Hardcoded to correspond to dcpl1_id created in size2_helper */
/* Check filters */
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 0, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 0, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 1, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 1, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 1, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 2, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 2, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 2, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 2, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 3, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 3, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 1, "H5Pget_filter2");
cd_nelmts = 1;
- filter = H5Pget_filter2(plist, 4, NULL, &cd_nelmts, &cd_value, NAME_BUF_SIZE, name, NULL);
+ filter = H5Pget_filter2(plist, 4, NULL, &cd_nelmts, &cd_value, (size_t)NAME_BUF_SIZE, name, NULL);
CHECK_I(filter, "H5Pget_filter2");
VERIFY(filter, H5Z_FILTER_DEFLATE, "H5Pget_filter2");
VERIFY(cd_value, 5, "H5Pget_filter2");
/* Check fill value */
- dtype2_id=make_dtype_2();
+ dtype2_id = make_dtype_2();
CHECK_I(dtype2_id, "make_dtype_2");
- memset(&fill2_correct, '2', DTYPE2_SIZE);
+ HDmemset(&fill2_correct, '2', (size_t)DTYPE2_SIZE);
ret = H5Pget_fill_value(plist, dtype2_id, &fill2);
CHECK_I(ret, "H5Pget_fill_value");
- ret = memcmp(&fill2, &fill2_correct, DTYPE2_SIZE);
+ ret = HDmemcmp(&fill2, &fill2_correct, (size_t)DTYPE2_SIZE);
VERIFY(ret, 0, memcmp);
}
+#ifdef NOT_NOW
/*-------------------------------------------------------------------------
* Function: size2_dump_struct
@@ -1378,6 +1379,7 @@ size2_dump_struct(const char *name, size2_helper_struct *sizes)
printf(" attributes: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs1, (unsigned long long)(sizes->attrs1 - sizes->interleaved));
printf(" attributes 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs2, (unsigned long long)(sizes->attrs2 - sizes->attrs1));
}
+#endif /* NOT_NOW */
/*-------------------------------------------------------------------------
@@ -1466,7 +1468,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
* We'll set them in the DCPL.
*/
HDmemset(&fill1, '1', sizeof(dtype1_struct));
- HDmemset(&fill2, '2', DTYPE2_SIZE);
+ HDmemset(&fill2, '2', (size_t)DTYPE2_SIZE);
dcpl1_id = H5Pcreate(H5P_DATASET_CREATE);
CHECK_I(dcpl1_id, "H5Pcreate");
@@ -1509,8 +1511,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
size2_verify_plist2(dcpl2_id);
/* Set up attribute data */
- HDmemset(attr_string1, 0, NAME_BUF_SIZE);
- HDmemset(attr_string2, 0, NAME_BUF_SIZE);
+ HDmemset(attr_string1, 0, (size_t)NAME_BUF_SIZE);
+ HDmemset(attr_string2, 0, (size_t)NAME_BUF_SIZE);
HDstrcpy(attr_string1, LONG_STRING);
HDstrcpy(attr_string2, LONG_STRING);
attr_string2[1] = '1'; /* The second string starts "01 index..." */
@@ -1518,7 +1520,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
/* Set up attribute metadata */
attr_type_id = H5Tcopy(H5T_C_S1);
CHECK_I(attr_type_id, "H5Tcopy");
- ret = H5Tset_size(attr_type_id ,NAME_BUF_SIZE);
+ ret = H5Tset_size(attr_type_id, (size_t)NAME_BUF_SIZE);
CHECK_I(ret, "H5Tset_size");
attr_space_id = H5Screate_simple(1, dims, dims);
CHECK_I(attr_space_id, "H5Screate_simple");
@@ -1669,10 +1671,9 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
group_id = H5Gopen2(file_id, "group", H5P_DEFAULT);
CHECK_I(group_id, "H5Gopen2");
- strcpy(attr_name, "00 index");
+ HDstrcpy(attr_name, "00 index");
- for(x=0; x<NUM_ATTRIBUTES; ++x)
- {
+ for(x = 0; x < NUM_ATTRIBUTES; ++x) {
/* Create a unique name and value for each attribute */
attr_string1[0] = attr_name[0] = (x / 10) + '0';
attr_string1[1] = attr_name[1] = (x % 10) + '0';
@@ -1917,7 +1918,7 @@ static void size2_verify(void)
/* Create attribute data type */
attr_type_id = H5Tcopy(H5T_C_S1);
CHECK_I(attr_type_id, "H5Tcopy");
- ret = H5Tset_size(attr_type_id ,NAME_BUF_SIZE);
+ ret = H5Tset_size(attr_type_id, (size_t)NAME_BUF_SIZE);
CHECK_I(ret, "H5Tset_size");
/* Read attributes on both groups and verify that they are correct */
@@ -1926,8 +1927,8 @@ static void size2_verify(void)
group2_id = H5Gopen2(file_id, "interleaved group", H5P_DEFAULT);
CHECK_I(group2_id, "H5Gopen2");
- HDmemset(attr_string, 0, NAME_BUF_SIZE);
- HDmemset(attr_correct_string, 0, NAME_BUF_SIZE);
+ HDmemset(attr_string, 0, (size_t)NAME_BUF_SIZE);
+ HDmemset(attr_correct_string, 0, (size_t)NAME_BUF_SIZE);
HDstrcpy(attr_correct_string, LONG_STRING);
HDstrcpy(attr_name, "00 index");
@@ -2785,11 +2786,12 @@ static void
test_sohm_delete(void)
{
hid_t fcpl_id;
- /* We'll use dataspaces, filter pipelines, and attributes for this
- * test. Create a number of distinct messages of each type.
+ /* We'll use dataspaces and filter pipelines for this test.
+ * Create a number of distinct messages of each type.
*/
hid_t dspace_id[DELETE_NUM_MESGS] = {0};
hid_t dcpl_id[DELETE_NUM_MESGS] = {0};
+ unsigned u;
int x;
hsize_t dims[] = DELETE_DIMS;
herr_t ret;
@@ -2797,10 +2799,10 @@ test_sohm_delete(void)
/* Create a number of different dataspaces.
* For simplicity, each dataspace has only one element.
*/
- for(x=0; x<DELETE_NUM_MESGS; ++x) {
- dspace_id[x] = H5Screate_simple(x + 1, dims, dims);
- CHECK_I(dspace_id[x], "H5Screate_simple");
- }
+ for(u = 0; u < DELETE_NUM_MESGS; ++u) {
+ dspace_id[u] = H5Screate_simple((int)(u + 1), dims, dims);
+ CHECK_I(dspace_id[u], "H5Screate_simple");
+ } /* end for */
/* Create a number of different filter pipelines. */
dcpl_id[0] = H5Pcreate(H5P_DATASET_CREATE);
@@ -2811,21 +2813,21 @@ test_sohm_delete(void)
ret = H5Pset_shuffle(dcpl_id[0]);
CHECK_I(ret, "H5Pset_shuffle");
- for(x=1; x<DELETE_NUM_MESGS; x+=2) {
- dcpl_id[x] = H5Pcopy(dcpl_id[x-1]);
- CHECK_I(dcpl_id[x], "H5Pcopy");
- ret = H5Pset_chunk(dcpl_id[x], x+1, dims);
+ for(u = 1; u < DELETE_NUM_MESGS; u += 2) {
+ dcpl_id[u] = H5Pcopy(dcpl_id[u - 1]);
+ CHECK_I(dcpl_id[u], "H5Pcopy");
+ ret = H5Pset_chunk(dcpl_id[u], (int)(u + 1), dims);
CHECK_I(ret, "H5Pset_chunk");
- ret = H5Pset_deflate(dcpl_id[x], 1);
+ ret = H5Pset_deflate(dcpl_id[u], 1);
CHECK_I(ret, "H5Pset_deflate");
- dcpl_id[x+1] = H5Pcopy(dcpl_id[x]);
- CHECK_I(dcpl_id[x+1], "H5Pcopy");
- ret = H5Pset_chunk(dcpl_id[x+1], x+2, dims);
+ dcpl_id[u + 1] = H5Pcopy(dcpl_id[u]);
+ CHECK_I(dcpl_id[u + 1], "H5Pcopy");
+ ret = H5Pset_chunk(dcpl_id[u + 1], (int)(u + 2), dims);
CHECK_I(ret, "H5Pset_chunk");
- ret = H5Pset_shuffle(dcpl_id[x+1]);
+ ret = H5Pset_shuffle(dcpl_id[u + 1]);
CHECK_I(ret, "H5Pset_shuffle");
- }
+ } /* end for */
/* Create an fcpl where all messages are shared in the same index */
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
@@ -2889,22 +2891,22 @@ test_sohm_delete(void)
*/
ret = H5Pset_shared_mesg_nindexes(fcpl_id, 1);
CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
- for(x=DELETE_MIN_MESG_SIZE; x<=DELETE_MAX_MESG_SIZE; x += 10) {
- ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ALL_FLAG, (size_t) x);
+ for(u = DELETE_MIN_MESG_SIZE; u <= DELETE_MAX_MESG_SIZE; u += 10) {
+ ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ALL_FLAG, u);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
delete_helper(fcpl_id, dspace_id, dcpl_id);
- }
+ } /* end for */
/* Cleanup */
ret = H5Pclose(fcpl_id);
CHECK_I(ret, "H5Pclose");
- for(x=DELETE_NUM_MESGS - 1; x>=0; --x) {
+ for(x = DELETE_NUM_MESGS - 1; x >= 0; --x) {
ret = H5Sclose(dspace_id[x]);
CHECK_I(ret, "H5Sclose");
ret = H5Pclose(dcpl_id[x]);
CHECK_I(ret, "H5Pclose");
- }
+ } /* end for */
} /* end test_sohm_delete() */
diff --git a/test/tvlstr.c b/test/tvlstr.c
index fbced5f..87008aa 100644
--- a/test/tvlstr.c
+++ b/test/tvlstr.c
@@ -29,16 +29,9 @@
#define DATAFILE2 "tvlstr2.h5"
/* 1-D dataset with fixed dimensions */
-#define SPACE1_NAME "Space1"
#define SPACE1_RANK 1
#define SPACE1_DIM1 4
-/* 2-D dataset with fixed dimensions */
-#define SPACE2_NAME "Space2"
-#define SPACE2_RANK 2
-#define SPACE2_DIM1 10
-#define SPACE2_DIM2 10
-
#define VLSTR_TYPE "vl_string_type"
/* Definitions for the VL re-writing test */
@@ -599,21 +592,14 @@ static void test_write_vl_string_attribute(void)
ret = H5Awrite(att, type, &string_att);
CHECK(ret, FAIL, "H5Awrite");
- /* Allocate memory for read buffer */
- if(string_att)
- string_att_check = (char*)HDmalloc((strlen(string_att) + 1) * sizeof(char));
- CHECK(string_att_check, NULL, "HDmalloc");
-
- if(string_att_check) {
- ret = H5Aread(att, type, &string_att_check);
- CHECK(ret, FAIL, "H5Aread");
+ ret = H5Aread(att, type, &string_att_check);
+ CHECK(ret, FAIL, "H5Aread");
- if(HDstrcmp(string_att_check,string_att)!=0)
- TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
+ if(HDstrcmp(string_att_check,string_att) != 0)
+ TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
- HDfree(string_att_check);
- string_att_check = NULL;
- }
+ HDfree(string_att_check);
+ string_att_check = NULL;
ret = H5Aclose(att);
CHECK(ret, FAIL, "HAclose");
@@ -628,22 +614,14 @@ static void test_write_vl_string_attribute(void)
ret = H5Awrite(att, type, &string_att_write);
CHECK(ret, FAIL, "H5Awrite");
- /* Allocate memory for read buffer */
- if(string_att_write)
- string_att_check = (char*)HDmalloc((strlen(string_att_write) + 1) * sizeof(char));
- CHECK(string_att_check, NULL, "HDmalloc");
+ ret = H5Aread(att, type, &string_att_check);
+ CHECK(ret, FAIL, "H5Aread");
- if(string_att_check) {
- ret = H5Aread(att, type, &string_att_check);
- CHECK(ret, FAIL, "H5Aread");
+ if(HDstrcmp(string_att_check,string_att_write) != 0)
+ TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
- if(HDstrcmp(string_att_check,string_att_write)!=0)
- TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
-
- /* The attribute string written is freed below, in the
- *test_read_vl_string_attribute() test */
- HDfree(string_att_check);
- }
+ HDfree(string_att_check);
+ string_att_check = NULL;
/* The attribute string written is freed below, in the test_read_vl_string_attribute() test */
/* HDfree(string_att_write); */
@@ -697,21 +675,14 @@ static void test_read_vl_string_attribute(void)
att = H5Aopen(root, "test_scalar", H5P_DEFAULT);
CHECK(att, FAIL, "H5Aopen");
- /* Allocate memory for read buffer */
- if(string_att)
- string_att_check = (char*)HDmalloc((strlen(string_att) + 1) * sizeof(char));
- CHECK(string_att_check, NULL, "HDmalloc");
+ ret = H5Aread(att, type, &string_att_check);
+ CHECK(ret, FAIL, "H5Aread");
- if(string_att_check) {
- ret = H5Aread(att, type, &string_att_check);
- CHECK(ret, FAIL, "H5Aread");
+ if(HDstrcmp(string_att_check,string_att) != 0)
+ TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
- if(HDstrcmp(string_att_check,string_att)!=0)
- TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
-
- HDfree(string_att_check);
- string_att_check = NULL;
- }
+ HDfree(string_att_check);
+ string_att_check = NULL;
ret = H5Aclose(att);
CHECK(ret, FAIL, "HAclose");
@@ -720,19 +691,15 @@ static void test_read_vl_string_attribute(void)
att = H5Aopen(root, "test_scalar_large", H5P_DEFAULT);
CHECK(att, FAIL, "H5Aopen");
- /* Allocate memory for read buffer */
- if(string_att_write)
- string_att_check = (char*)HDmalloc((strlen(string_att_write) + 1) * sizeof(char));
- CHECK(string_att_check, NULL, "HDmalloc");
-
- if(string_att_check) {
+ if(string_att_write) {
ret = H5Aread(att, type, &string_att_check);
CHECK(ret, FAIL, "H5Aread");
- if(HDstrcmp(string_att_check,string_att_write)!=0)
+ if(HDstrcmp(string_att_check,string_att_write) != 0)
TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
HDfree(string_att_check);
+ string_att_check = NULL;
}
/* Free string allocated in test_write_vl_string_attribute */
diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt
index 0eac602..05e0ced 100644
--- a/testpar/CMakeLists.txt
+++ b/testpar/CMakeLists.txt
@@ -1,6 +1,8 @@
cmake_minimum_required (VERSION 2.8)
-PROJECT (H5_TEST_PAR)
+PROJECT (HDF5_TEST_PAR)
+INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR})
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib )
#-----------------------------------------------------------------------------
# Define Tests
#-----------------------------------------------------------------------------
@@ -15,6 +17,7 @@ SET (testphdf5_SRCS
${HDF5_TEST_PAR_SOURCE_DIR}/t_span_tree.c
${HDF5_TEST_PAR_SOURCE_DIR}/t_chunk_alloc.c
${HDF5_TEST_PAR_SOURCE_DIR}/t_filter_read.c
+ ${HDF5_TEST_PAR_SOURCE_DIR}/t_rank_projection.c
)
#-- Adding test for testhdf5
@@ -32,7 +35,7 @@ IF (WIN32)
ENDIF (WIN32)
TARGET_LINK_LIBRARIES (testphdf5 ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
-ADD_TEST (NAME testphdf5 COMMAND $<TARGET_FILE:testphdf5>)
+ADD_TEST (NAME testphdf5 COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:testphdf5>)
MACRO (ADD_H5P_TEST file)
ADD_EXECUTABLE (${file} ${HDF5_TEST_PAR_SOURCE_DIR}/${file}.c)
@@ -49,7 +52,7 @@ MACRO (ADD_H5P_TEST file)
ENDIF (WIN32)
TARGET_LINK_LIBRARIES (${file} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
- ADD_TEST (NAME ${file} COMMAND $<TARGET_FILE:${file}>)
+ ADD_TEST (NAME ${file} COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:${file}>)
ENDMACRO (ADD_H5P_TEST file)
SET (H5P_TESTS
diff --git a/testpar/t_cache.c b/testpar/t_cache.c
index a417bb4..b302663 100644
--- a/testpar/t_cache.c
+++ b/testpar/t_cache.c
@@ -406,59 +406,61 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
/* test utility functions */
-void expunge_entry(H5F_t * file_ptr, int32_t idx);
-void insert_entry(H5C_t * cache_ptr, H5F_t * file_ptr,
+static void expunge_entry(H5F_t * file_ptr, int32_t idx);
+static void insert_entry(H5C_t * cache_ptr, H5F_t * file_ptr,
int32_t idx, unsigned int flags);
-void local_pin_and_unpin_random_entries(H5F_t * file_ptr, int min_idx,
+static void local_pin_and_unpin_random_entries(H5F_t * file_ptr, int min_idx,
int max_idx, int min_count,
int max_count);
-void local_pin_random_entry(H5F_t * file_ptr, int min_idx, int max_idx);
-void local_unpin_all_entries(H5F_t * file_ptr, hbool_t via_unprotect);
-int local_unpin_next_pinned_entry(H5F_t * file_ptr, int start_idx,
+static void local_pin_random_entry(H5F_t * file_ptr, int min_idx, int max_idx);
+static void local_unpin_all_entries(H5F_t * file_ptr, hbool_t via_unprotect);
+static int local_unpin_next_pinned_entry(H5F_t * file_ptr, int start_idx,
hbool_t via_unprotect);
-void lock_and_unlock_random_entries(H5F_t * file_ptr, int min_idx, int max_idx,
+static void lock_and_unlock_random_entries(H5F_t * file_ptr, int min_idx, int max_idx,
int min_count, int max_count);
-void lock_and_unlock_random_entry(H5F_t * file_ptr,
+static void lock_and_unlock_random_entry(H5F_t * file_ptr,
int min_idx, int max_idx);
-void lock_entry(H5F_t * file_ptr, int32_t idx);
-void mark_entry_dirty(int32_t idx);
-void pin_entry(H5F_t * file_ptr, int32_t idx, hbool_t global, hbool_t dirty);
-void pin_protected_entry(int32_t idx, hbool_t global);
-void move_entry(H5F_t * file_ptr, int32_t old_idx, int32_t new_idx);
+static void lock_entry(H5F_t * file_ptr, int32_t idx);
+static void mark_entry_dirty(int32_t idx);
+static void pin_entry(H5F_t * file_ptr, int32_t idx, hbool_t global, hbool_t dirty);
+#ifdef H5_METADATA_TRACE_FILE
+static void pin_protected_entry(int32_t idx, hbool_t global);
+#endif /* H5_METADATA_TRACE_FILE */
+static void move_entry(H5F_t * file_ptr, int32_t old_idx, int32_t new_idx);
static hbool_t reset_server_counts(void);
-void resize_entry(int32_t idx, size_t new_size);
-hbool_t setup_cache_for_test(hid_t * fid_ptr,
+static void resize_entry(int32_t idx, size_t new_size);
+static hbool_t setup_cache_for_test(hid_t * fid_ptr,
H5F_t ** file_ptr_ptr,
H5C_t ** cache_ptr_ptr,
int metadata_write_strategy);
-void setup_rand(void);
-hbool_t take_down_cache(hid_t fid);
+static void setup_rand(void);
+static hbool_t take_down_cache(hid_t fid);
static hbool_t verify_entry_reads(haddr_t addr, int expected_entry_reads);
static hbool_t verify_entry_writes(haddr_t addr, int expected_entry_writes);
static hbool_t verify_total_reads(int expected_total_reads);
static hbool_t verify_total_writes(int expected_total_writes);
-void verify_writes(int num_writes, haddr_t * written_entries_tbl);
-void unlock_entry(H5F_t * file_ptr, int32_t type, unsigned int flags);
-void unpin_entry(H5F_t * file_ptr, int32_t idx, hbool_t global,
+static void verify_writes(int num_writes, haddr_t * written_entries_tbl);
+static void unlock_entry(H5F_t * file_ptr, int32_t type, unsigned int flags);
+static void unpin_entry(H5F_t * file_ptr, int32_t idx, hbool_t global,
hbool_t dirty, hbool_t via_unprotect);
/* test functions */
-hbool_t server_smoke_check(void);
-hbool_t smoke_check_1(int metadata_write_strategy);
-hbool_t smoke_check_2(int metadata_write_strategy);
-hbool_t smoke_check_3(int metadata_write_strategy);
-hbool_t smoke_check_4(int metadata_write_strategy);
-hbool_t smoke_check_5(int metadata_write_strategy);
-hbool_t trace_file_check(int metadata_write_strategy);
+static hbool_t server_smoke_check(void);
+static hbool_t smoke_check_1(int metadata_write_strategy);
+static hbool_t smoke_check_2(int metadata_write_strategy);
+static hbool_t smoke_check_3(int metadata_write_strategy);
+static hbool_t smoke_check_4(int metadata_write_strategy);
+static hbool_t smoke_check_5(int metadata_write_strategy);
+static hbool_t trace_file_check(int metadata_write_strategy);
/*****************************************************************************/
/****************************** stats functions ******************************/
/*****************************************************************************/
-#ifdef UNUSED
+#ifdef NOT_USED
/*****************************************************************************
*
* Function: print_stats()
@@ -497,7 +499,7 @@ print_stats(void)
return;
} /* print_stats() */
-#endif /* UNUSED */
+#endif /* NOT_USED */
/*****************************************************************************
*
@@ -2822,7 +2824,7 @@ size_datum(H5F_t UNUSED * f,
*
*****************************************************************************/
-void
+static void
expunge_entry(H5F_t * file_ptr,
int32_t idx)
{
@@ -2905,7 +2907,7 @@ expunge_entry(H5F_t * file_ptr,
*
*****************************************************************************/
-void
+static void
insert_entry(H5C_t * cache_ptr,
H5F_t * file_ptr,
int32_t idx,
@@ -2932,7 +2934,7 @@ insert_entry(H5C_t * cache_ptr,
(entry_ptr->ver)++;
entry_ptr->dirty = TRUE;
- result = H5AC_set(file_ptr, H5P_DATASET_XFER_DEFAULT, &(types[0]),
+ result = H5AC_insert_entry(file_ptr, H5P_DATASET_XFER_DEFAULT, &(types[0]),
entry_ptr->base_addr, (void *)(&(entry_ptr->header)), flags);
if ( ( result < 0 ) ||
@@ -2942,7 +2944,7 @@ insert_entry(H5C_t * cache_ptr,
nerrors++;
if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Error in H5AC_set().\n",
+ HDfprintf(stdout, "%d:%s: Error in H5AC_insert_entry().\n",
world_mpi_rank, fcn_name);
}
}
@@ -3011,7 +3013,7 @@ insert_entry(H5C_t * cache_ptr,
*
*****************************************************************************/
-void
+static void
local_pin_and_unpin_random_entries(H5F_t * file_ptr,
int min_idx,
int max_idx,
@@ -3082,7 +3084,7 @@ local_pin_and_unpin_random_entries(H5F_t * file_ptr,
* 4/12/06
*
*****************************************************************************/
-void
+static void
local_pin_random_entry(H5F_t * file_ptr,
int min_idx,
int max_idx)
@@ -3130,7 +3132,7 @@ local_pin_random_entry(H5F_t * file_ptr,
*
*****************************************************************************/
-void
+static void
local_unpin_all_entries(H5F_t * file_ptr,
hbool_t via_unprotect)
{
@@ -3175,7 +3177,7 @@ local_unpin_all_entries(H5F_t * file_ptr,
*
*****************************************************************************/
-int
+static int
local_unpin_next_pinned_entry(H5F_t * file_ptr,
int start_idx,
hbool_t via_unprotect)
@@ -3236,7 +3238,7 @@ local_unpin_next_pinned_entry(H5F_t * file_ptr,
*
*****************************************************************************/
-void
+static void
lock_and_unlock_random_entries(H5F_t * file_ptr,
int min_idx,
int max_idx,
@@ -3286,7 +3288,7 @@ lock_and_unlock_random_entries(H5F_t * file_ptr,
*
*****************************************************************************/
-void
+static void
lock_and_unlock_random_entry(H5F_t * file_ptr,
int min_idx,
int max_idx)
@@ -3336,7 +3338,7 @@ lock_and_unlock_random_entry(H5F_t * file_ptr,
*
*****************************************************************************/
-void
+static void
lock_entry(H5F_t * file_ptr,
int32_t idx)
{
@@ -3396,7 +3398,7 @@ lock_entry(H5F_t * file_ptr,
*
*****************************************************************************/
-void
+static void
mark_entry_dirty(int32_t idx)
{
const char * fcn_name = "mark_entry_dirty()";
@@ -3454,7 +3456,7 @@ mark_entry_dirty(int32_t idx)
*
*****************************************************************************/
-void
+static void
pin_entry(H5F_t * file_ptr,
int32_t idx,
hbool_t global,
@@ -3508,6 +3510,7 @@ pin_entry(H5F_t * file_ptr,
} /* pin_entry() */
+#ifdef H5_METADATA_TRACE_FILE
/*****************************************************************************
* Function: pin_protected_entry()
*
@@ -3527,7 +3530,7 @@ pin_entry(H5F_t * file_ptr,
*
*****************************************************************************/
-void
+static void
pin_protected_entry(int32_t idx,
hbool_t global)
{
@@ -3581,6 +3584,7 @@ pin_protected_entry(int32_t idx,
return;
} /* pin_protected_entry() */
+#endif /* H5_METADATA_TRACE_FILE */
/*****************************************************************************
@@ -3599,7 +3603,7 @@ pin_protected_entry(int32_t idx,
* 1/10/06
*
*****************************************************************************/
-void
+static void
move_entry(H5F_t * file_ptr,
int32_t old_idx,
int32_t new_idx)
@@ -3807,7 +3811,7 @@ reset_server_counts(void)
*
*****************************************************************************/
-void
+static void
resize_entry(int32_t idx,
size_t new_size)
{
@@ -3880,7 +3884,7 @@ resize_entry(int32_t idx,
* Programmer: JRM -- 1/4/06
*
*****************************************************************************/
-hbool_t
+static hbool_t
setup_cache_for_test(hid_t * fid_ptr,
H5F_t ** file_ptr_ptr,
H5C_t ** cache_ptr_ptr,
@@ -3944,7 +3948,6 @@ setup_cache_for_test(hid_t * fid_ptr,
*fid_ptr = fid;
*file_ptr_ptr = file_ptr;
*cache_ptr_ptr = cache_ptr;
- H5C_set_skip_flags(cache_ptr, TRUE, TRUE);
H5C_stats__reset(cache_ptr);
success = TRUE;
}
@@ -4108,14 +4111,14 @@ setup_cache_for_test(hid_t * fid_ptr,
* Programmer: JRM -- 5/9/10
*
*****************************************************************************/
-void
+static void
verify_writes(int num_writes,
haddr_t * written_entries_tbl)
{
const char * fcn_name = "verify_writes()";
const hbool_t report = FALSE;
hbool_t proceed = TRUE;
- int i;
+ int i = 0;
HDassert( world_mpi_rank != world_server_mpi_rank );
HDassert( num_writes >= 0 );
@@ -4349,7 +4352,7 @@ setup_noblock_dxpl_id(void)
*
*****************************************************************************/
-void
+static void
setup_rand(void)
{
const char * fcn_name = "setup_rand()";
@@ -4418,7 +4421,7 @@ setup_rand(void)
*
*****************************************************************************/
-hbool_t
+static hbool_t
take_down_cache(hid_t fid)
{
const char * fcn_name = "take_down_cache()";
@@ -4981,7 +4984,7 @@ unlock_entry(H5F_t * file_ptr,
*
*****************************************************************************/
-void
+static void
unpin_entry(H5F_t * file_ptr,
int32_t idx,
hbool_t global,
@@ -5074,7 +5077,7 @@ unpin_entry(H5F_t * file_ptr,
* Programmer: JRM -- 12/21/05
*
*****************************************************************************/
-hbool_t
+static hbool_t
server_smoke_check(void)
{
const char * fcn_name = "server_smoke_check()";
@@ -5423,7 +5426,7 @@ server_smoke_check(void)
* Programmer: JRM -- 1/4/06
*
*****************************************************************************/
-hbool_t
+static hbool_t
smoke_check_1(int metadata_write_strategy)
{
const char * fcn_name = "smoke_check_1()";
@@ -5599,7 +5602,7 @@ smoke_check_1(int metadata_write_strategy)
* Programmer: JRM -- 1/12/06
*
*****************************************************************************/
-hbool_t
+static hbool_t
smoke_check_2(int metadata_write_strategy)
{
const char * fcn_name = "smoke_check_2()";
@@ -5825,7 +5828,7 @@ smoke_check_2(int metadata_write_strategy)
* Programmer: JRM -- 1/13/06
*
*****************************************************************************/
-hbool_t
+static hbool_t
smoke_check_3(int metadata_write_strategy)
{
const char * fcn_name = "smoke_check_3()";
@@ -6197,7 +6200,7 @@ smoke_check_3(int metadata_write_strategy)
* Programmer: JRM -- 1/13/06
*
*****************************************************************************/
-hbool_t
+static hbool_t
smoke_check_4(int metadata_write_strategy)
{
const char * fcn_name = "smoke_check_4()";
@@ -6510,7 +6513,7 @@ smoke_check_4(int metadata_write_strategy)
* Programmer: JRM -- 5/18/06
*
*****************************************************************************/
-hbool_t
+static hbool_t
smoke_check_5(int metadata_write_strategy)
{
const char * fcn_name = "smoke_check_5()";
@@ -6785,7 +6788,7 @@ smoke_check_5(int metadata_write_strategy)
* functions:
*
* - H5AC_flush()
- * - H5AC_set()
+ * - H5AC_insert_entry()
* - H5AC_mark_entry_dirty()
* - H5AC_move_entry()
* - H5AC_pin_protected_entry()
@@ -6805,7 +6808,7 @@ smoke_check_5(int metadata_write_strategy)
* Programmer: JRM -- 6/13/06
*
*****************************************************************************/
-hbool_t
+static hbool_t
trace_file_check(int metadata_write_strategy)
{
hbool_t success = TRUE;
@@ -6818,10 +6821,10 @@ trace_file_check(int metadata_write_strategy)
{
"### HDF5 metadata cache trace file version 1 ###\n",
"H5AC_set_cache_auto_resize_config 1 0 1 0 \"t_cache_trace.txt\" 1 0 2097152 0.300000 33554432 1048576 50000 1 0.900000 2.000000 1 1.000000 0.250000 1 4194304 3 0.999000 0.900000 1 1048576 3 1 0.100000 262144 0 0\n",
- "H5AC_set 0x200 25 0x0 2 0\n",
- "H5AC_set 0x202 25 0x0 2 0\n",
- "H5AC_set 0x204 25 0x0 4 0\n",
- "H5AC_set 0x208 25 0x0 6 0\n",
+ "H5AC_insert_entry 0x200 25 0x0 2 0\n",
+ "H5AC_insert_entry 0x202 25 0x0 2 0\n",
+ "H5AC_insert_entry 0x204 25 0x0 4 0\n",
+ "H5AC_insert_entry 0x208 25 0x0 6 0\n",
"H5AC_protect 0x200 25 H5AC_WRITE 2 1\n",
"H5AC_mark_entry_dirty 0x200 0\n",
"H5AC_unprotect 0x200 25 0 0 0\n",
@@ -6846,10 +6849,10 @@ trace_file_check(int metadata_write_strategy)
{
"### HDF5 metadata cache trace file version 1 ###\n",
"H5AC_set_cache_auto_resize_config 1 0 1 0 \"t_cache_trace.txt\" 1 0 2097152 0.300000 33554432 1048576 50000 1 0.900000 2.000000 1 1.000000 0.250000 1 4194304 3 0.999000 0.900000 1 1048576 3 1 0.100000 262144 1 0\n",
- "H5AC_set 0x200 25 0x0 2 0\n",
- "H5AC_set 0x202 25 0x0 2 0\n",
- "H5AC_set 0x204 25 0x0 4 0\n",
- "H5AC_set 0x208 25 0x0 6 0\n",
+ "H5AC_insert_entry 0x200 25 0x0 2 0\n",
+ "H5AC_insert_entry 0x202 25 0x0 2 0\n",
+ "H5AC_insert_entry 0x204 25 0x0 4 0\n",
+ "H5AC_insert_entry 0x208 25 0x0 6 0\n",
"H5AC_protect 0x200 25 H5AC_WRITE 2 1\n",
"H5AC_mark_entry_dirty 0x200 0\n",
"H5AC_unprotect 0x200 25 0 0 0\n",
@@ -7407,6 +7410,8 @@ finish:
printf("===================================\n");
}
+ takedown_derived_types();
+
/* close HDF5 library */
H5close();
diff --git a/testpar/t_rank_projection.c b/testpar/t_rank_projection.c
index bbc0a1f..c17f7b9 100644
--- a/testpar/t_rank_projection.c
+++ b/testpar/t_rank_projection.c
@@ -566,7 +566,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num,
/* write the initial value of the large data set to file */
ret = H5Dwrite(large_dataset, dset_type, mem_large_ds_sid, file_large_ds_sid,
xfer_plist, large_ds_buf_0);
- if ( ret < 0 ) H5Eprint(H5E_DEFAULT, stderr);
+ if ( ret < 0 ) H5Eprint2(H5E_DEFAULT, stderr);
VRFY((ret >= 0), "H5Dwrite() large_dataset initial write succeeded");
@@ -2238,7 +2238,7 @@ checker_board_hyperslab_dr_pio_test__verify_data(uint32_t * buf_ptr,
#define PAR_SS_DR_MAX_RANK 5
#define CHECKER_BOARD_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG 0
-void
+static void
checker_board_hyperslab_dr_pio_test__run_test(const int test_num,
const int edge_size,
const int checker_edge_size,
@@ -2785,7 +2785,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num,
/* write the initial value of the large data set to file */
ret = H5Dwrite(large_dataset, dset_type, mem_large_ds_sid, file_large_ds_sid_0,
xfer_plist, large_ds_buf_0);
- if ( ret < 0 ) H5Eprint(H5E_DEFAULT, stderr);
+ if ( ret < 0 ) H5Eprint2(H5E_DEFAULT, stderr);
VRFY((ret >= 0), "H5Dwrite() large_dataset initial write succeeded");
@@ -3254,7 +3254,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num,
/* zero out the value for the next pass */
*ptr_1 = 0;
- *ptr_1++;
+ ptr_1++;
}
VRFY((data_ok == TRUE),
diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c
index 5425377..e54d0a8 100644
--- a/testpar/t_span_tree.c
+++ b/testpar/t_span_tree.c
@@ -1570,7 +1570,7 @@ lower_dim_size_comp_test__verify_data(uint32_t * buf_ptr,
#define LDSCT_DS_RANK 5
#define LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG 0
-void
+static void
lower_dim_size_comp_test__run_test(const int chunk_edge_size,
const hbool_t use_collective_io,
const hid_t dset_type)
@@ -2235,7 +2235,7 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
xfer_plist,
large_ds_buf_0);
- if ( ret < 0 ) H5Eprint(H5E_DEFAULT, stderr);
+ if ( ret < 0 ) H5Eprint2(H5E_DEFAULT, stderr);
VRFY((ret >= 0), "H5Dwrite() large_dataset initial write succeeded");
diff --git a/tools/h5copy/CMakeLists.txt b/tools/h5copy/CMakeLists.txt
index 61f5ef3..b9dad2d 100644
--- a/tools/h5copy/CMakeLists.txt
+++ b/tools/h5copy/CMakeLists.txt
@@ -4,7 +4,7 @@ PROJECT (HDF5_TOOLS_H5COPY)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
# --------------------------------------------------------------------
@@ -26,8 +26,14 @@ TARGET_LINK_LIBRARIES (h5copy ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
SET (H5_DEP_EXECUTABLES h5copy)
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
IF (BUILD_TESTING)
- IF (NOT BUILD_SHARED_LIBS)
+ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
ADD_EXECUTABLE (h5copygentest ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/h5copygentest.c)
H5_NAMING (h5copygentest)
IF (WIN32)
@@ -41,13 +47,11 @@ IF (BUILD_TESTING)
TARGET_LINK_LIBRARIES (h5copygentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
#ADD_TEST (NAME h5copygentest COMMAND $<TARGET_FILE:h5copygentest>)
-
- SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
- #h5copygentest
- )
- ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
- #-- Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
+ # Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
SET (HDF5_REFERENCE_FILES
h5copy_extlinks_src.out.ls
h5copy_ref.out.ls
@@ -82,12 +86,12 @@ IF (BUILD_TESTING)
ARGS -E copy_if_different ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/testfiles/${h5_file} ${dest}
)
ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
-
- # Test files
- SET (HDF_FILE1 h5copytst)
- SET (HDF_FILE2 h5copy_ref)
- SET (HDF_EXT_SRC_FILE h5copy_extlinks_src)
- SET (HDF_EXT_TRG_FILE h5copy_extlinks_trg)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
MACRO (ADD_H5_TEST testname resultcode testfile vparam srcname dstname)
@@ -129,6 +133,20 @@ IF (BUILD_TESTING)
)
ENDMACRO (ADD_H5LS_TEST file)
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+ # --------------------------------------------------------------------
+ # test file names
+ # --------------------------------------------------------------------
+ SET (HDF_FILE1 h5copytst)
+ SET (HDF_FILE2 h5copy_ref)
+ SET (HDF_EXT_SRC_FILE h5copy_extlinks_src)
+ SET (HDF_EXT_TRG_FILE h5copy_extlinks_trg)
+
############# COPY OBJECTS ##############
# Remove any output file left over from previous test run
@@ -236,6 +254,12 @@ IF (BUILD_TESTING)
ENDIF (BUILD_TESTING)
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
#-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c
index 89cb5fb..d850f85 100644
--- a/tools/h5copy/h5copy.c
+++ b/tools/h5copy/h5copy.c
@@ -416,7 +416,7 @@ main (int argc, const char *argv[])
if(verbose)
linkinfo.opt.msg_mode = 1;
- li_ret = H5tools_get_link_info(fid_src, oname_src, &linkinfo);
+ li_ret = H5tools_get_link_info(fid_src, oname_src, &linkinfo, 1);
if (li_ret == 0) /* dangling link */
{
if(H5Lcopy(fid_src, oname_src,
diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt
index 9461875..1342cd2 100644
--- a/tools/h5diff/CMakeLists.txt
+++ b/tools/h5diff/CMakeLists.txt
@@ -4,11 +4,11 @@ PROJECT (HDF5_TOOLS_H5DIFF)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
# --------------------------------------------------------------------
-# Add the h5diff and test executables
+# Add the h5diff executables
# --------------------------------------------------------------------
ADD_EXECUTABLE (h5diff
${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/h5diff_common.c
@@ -29,8 +29,17 @@ TARGET_LINK_LIBRARIES (h5diff ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
SET (H5_DEP_EXECUTABLES h5diff)
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
IF (BUILD_TESTING)
- IF (NOT BUILD_SHARED_LIBS)
+ # --------------------------------------------------------------------
+ # Add the h5diff and test executables
+ # --------------------------------------------------------------------
+ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
ADD_EXECUTABLE (h5diffgentest ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/h5diffgentest.c)
H5_NAMING (h5diffgentest)
IF (WIN32)
@@ -44,13 +53,11 @@ IF (BUILD_TESTING)
TARGET_LINK_LIBRARIES (h5diffgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
#ADD_TEST (NAME h5diffgentest COMMAND $<TARGET_FILE:h5diffgentest>)
-
- SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
- # h5diffgentest
- )
- ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
- #-- Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
+ # Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
SET (HDF5_REFERENCE_FILES
h5diff_10.txt
h5diff_100.txt
@@ -236,6 +243,12 @@ IF (BUILD_TESTING)
ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_102.txt ${PROJECT_BINARY_DIR}/h5diff_102.txt
)
ENDIF (WIN32)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
MACRO (ADD_H5_TEST resultfile resultcode)
ADD_TEST (
@@ -252,11 +265,15 @@ IF (BUILD_TESTING)
)
ENDMACRO (ADD_H5_TEST file)
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
-###############################################################################
-## test file names
-###############################################################################
-
+ # --------------------------------------------------------------------
+ # test file names
+ # --------------------------------------------------------------------
SET (FILE1 h5diff_basic1.h5)
SET (FILE2 h5diff_basic2.h5)
SET (FILE3 h5diff_types.h5)
@@ -661,6 +678,12 @@ ADD_H5_TEST (h5diff_459 2 --follow-symlinks -v --no-dangling-links ${FILE15} $
ENDIF (BUILD_TESTING)
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
#-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
diff --git a/tools/h5diff/ph5diff_main.c b/tools/h5diff/ph5diff_main.c
index 7a43c73..531503d 100644
--- a/tools/h5diff/ph5diff_main.c
+++ b/tools/h5diff/ph5diff_main.c
@@ -19,6 +19,7 @@
#include <string.h>
#include <assert.h>
#include "h5diff_common.h"
+#include "h5tools_utils.h"
/* Name of tool */
#define PROGRAMNAME "h5diff"
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt
index eb54e00..5ef1cc2 100644
--- a/tools/h5dump/CMakeLists.txt
+++ b/tools/h5dump/CMakeLists.txt
@@ -4,11 +4,11 @@ PROJECT (HDF5_TOOLS_H5DUMP)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
# --------------------------------------------------------------------
-# Add the h5dump and test executables
+# Add the h5dump executables
# --------------------------------------------------------------------
ADD_EXECUTABLE (h5dump ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dump.c)
H5_NAMING (h5dump)
@@ -26,8 +26,17 @@ TARGET_LINK_LIBRARIES (h5dump ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
SET (H5_DEP_EXECUTABLES h5dump)
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
IF (BUILD_TESTING)
- IF (NOT BUILD_SHARED_LIBS)
+ # --------------------------------------------------------------------
+ # Add the h5dump test executable
+ # --------------------------------------------------------------------
+ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
ADD_EXECUTABLE (h5dumpgentest ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dumpgentest.c)
H5_NAMING (h5dumpgentest)
IF (WIN32)
@@ -41,13 +50,11 @@ IF (BUILD_TESTING)
TARGET_LINK_LIBRARIES (h5dumpgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
#ADD_TEST (NAME h5dumpgentest COMMAND $<TARGET_FILE:h5dumpgentest>)
-
- SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
- # h5dumpgentest
- )
- ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
- #-- Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
+ # Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
SET (HDF5_REFERENCE_FILES
tall-1.ddl
tall-2.ddl
@@ -70,6 +77,7 @@ IF (BUILD_TESTING)
tattr-3.ddl
tattrreg.ddl
tattrregR.ddl
+ tbinregR.ddl
tbigdims.ddl
tboot1.ddl
tboot2.ddl
@@ -155,6 +163,71 @@ IF (BUILD_TESTING)
tvlstr.ddl
tvms.ddl
)
+ SET (HDF5_XML_REFERENCE_FILES
+ tall.h5.xml
+ tall-2A.h5.xml
+ tarray1.h5.xml
+ tarray2.h5.xml
+ tarray3.h5.xml
+ tarray6.h5.xml
+ tarray7.h5.xml
+ tattr.h5.xml
+ tbitfields.h5.xml
+ tcompound_complex.h5.xml
+ tcompound.h5.xml
+ tcompound2.h5.xml
+ tdatareg.h5.xml
+ tdset.h5.xml
+ tdset2.h5.xml
+ tempty.h5.xml
+ tempty-dtd.h5.xml
+ tempty-dtd-2.h5.xml
+ tempty-dtd-uri.h5.xml
+ tempty-nons.h5.xml
+ tempty-nons-2.h5.xml
+ tempty-nons-uri.h5.xml
+ tempty-ns.h5.xml
+ tempty-ns-2.h5.xml
+ tenum.h5.xml
+ textlink.h5.xml
+ tfpformat.h5.xml
+ tgroup.h5.xml
+ thlink.h5.xml
+ tloop.h5.xml
+ tloop2.h5.xml
+ tmany.h5.xml
+ tname-amp.h5.xml
+ tname-apos.h5.xml
+ tnamed_dtype_attr.h5.xml
+ tname-gt.h5.xml
+ tname-lt.h5.xml
+ tname-quot.h5.xml
+ tname-sp.h5.xml
+ tnestedcomp.h5.xml
+ tnodata.h5.xml
+ tobjref.h5.xml
+ topaque.h5.xml
+ torderattr1.h5.xml
+ torderattr2.h5.xml
+ torderattr3.h5.xml
+ torderattr4.h5.xml
+ tref.h5.xml
+ tref-escapes.h5.xml
+ tref-escapes-at.h5.xml
+ tsaf.h5.xml
+ tslink.h5.xml
+ tstr.h5.xml
+ tstr2.h5.xml
+ tstring.h5.xml
+ tstring-at.h5.xml
+ tudlink.h5.xml
+ tvldtypes1.h5.xml
+ tvldtypes2.h5.xml
+ tvldtypes3.h5.xml
+ tvldtypes4.h5.xml
+ tvldtypes5.h5.xml
+ tvlstr.h5.xml
+ )
SET (HDF5_REFERENCE_TEST_FILES
tbin1.ddl
tbin1.ddl
@@ -237,6 +310,29 @@ IF (BUILD_TESTING)
tvlstr.h5
tvms.h5
)
+ SET (HDF5_XML_REFERENCE_TEST_FILES
+ tbitfields.h5
+ tcompound2.h5
+ tdset2.h5
+ tenum.h5
+ textlink.h5
+ tloop2.h5
+ tmany.h5
+ tname-amp.h5
+ tname-apos.h5
+ tname-gt.h5
+ tname-lt.h5
+ tname-quot.h5
+ tname-sp.h5
+ tnodata.h5
+ tobjref.h5
+ topaque.h5
+ tref.h5
+ tref-escapes.h5
+ tref-escapes-at.h5
+ tstring.h5
+ tstring-at.h5
+ )
FOREACH (ddl_file ${HDF5_REFERENCE_FILES})
SET (ddldest "${PROJECT_BINARY_DIR}/${ddl_file}")
@@ -245,10 +341,21 @@ IF (BUILD_TESTING)
TARGET h5dump
POST_BUILD
COMMAND ${XLATE_UTILITY}
- ARGS ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${ddl_file} ${ddldest} -l3
+ ARGS ${HDF5_TOOLS_SRC_DIR}/testfiles/${ddl_file} ${ddldest} -l3
)
ENDFOREACH (ddl_file ${HDF5_REFERENCE_FILES})
+ FOREACH (xml_file ${HDF5_XML_REFERENCE_FILES})
+ SET (xmldest "${PROJECT_BINARY_DIR}/${xml_file}")
+ #MESSAGE (STATUS " Translating ${xml_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5dump
+ POST_BUILD
+ COMMAND ${XLATE_UTILITY}
+ ARGS ${HDF5_TOOLS_SRC_DIR}/testfiles/${xml_file} ${xmldest} -l3
+ )
+ ENDFOREACH (xml_file ${HDF5_XML_REFERENCE_FILES})
+
FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
SET (dest "${PROJECT_BINARY_DIR}/${h5_file}")
#MESSAGE (STATUS " Copying ${h5_file}")
@@ -256,10 +363,24 @@ IF (BUILD_TESTING)
TARGET h5dump
POST_BUILD
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_file} ${dest}
)
ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ FOREACH (h5_xml_file ${HDF5_XML_REFERENCE_TEST_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/${h5_xml_file}")
+ #MESSAGE (STATUS " Copying ${h5_xml_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5dump
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_xml_file} ${dest}
+ )
+ ENDFOREACH (h5_xml_file ${HDF5_XML_REFERENCE_TEST_FILES})
+
+ # --------------------------------------------------------------------
+ # Special file handling
+ # --------------------------------------------------------------------
ADD_CUSTOM_COMMAND (
TARGET h5dump
POST_BUILD
@@ -267,9 +388,30 @@ IF (BUILD_TESTING)
ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/tbin1.ddl ${PROJECT_BINARY_DIR}/tbin1LE.ddl
)
+ IF (WIN32 AND NOT MINGW)
+ FILE (READ ${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.exp TEST_STREAM)
+ FILE (WRITE ${PROJECT_BINARY_DIR}/tbinregR.exp "${TEST_STREAM}")
+ ELSE (WIN32 AND NOT MINGW)
+ ADD_CUSTOM_COMMAND (
+ TARGET h5dump
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.exp ${PROJECT_BINARY_DIR}/tbinregR.exp
+ )
+ ENDIF (WIN32 AND NOT MINGW)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+
MACRO (ADD_SKIP_H5_TEST skipresultfile skipresultcode testtype)
IF (${testtype} STREQUAL "SKIP")
- MESSAGE (STATUS "SKIP ${skipresultfile} ${ARGN}")
+ ADD_TEST (
+ NAME H5DUMP-${skipresultfile}
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${skipresultfile} ${ARGN}"
+ )
ELSE (${testtype} STREQUAL "SKIP")
ADD_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN})
ENDIF (${testtype} STREQUAL "SKIP")
@@ -289,7 +431,46 @@ IF (BUILD_TESTING)
)
ENDMACRO (ADD_H5_TEST file)
+ MACRO (ADD_H5_EXPORT_TEST resultfile targetfile resultcode)
+ ADD_TEST (
+ NAME H5DUMP-output-${resultfile}
+ COMMAND $<TARGET_FILE:h5dump> -d /Dataset1 -s 0 -R -y -o ${PROJECT_BINARY_DIR}/${resultfile}.txt ${PROJECT_BINARY_DIR}/${targetfile}
+ )
+ ADD_TEST (
+ NAME H5DUMP-output-cmp-${resultfile}
+ COMMAND ${CMAKE_COMMAND}
+ -E compare_files ${PROJECT_BINARY_DIR}/${resultfile}.txt ${PROJECT_BINARY_DIR}/${resultfile}.exp
+ )
+ ENDMACRO (ADD_H5_EXPORT_TEST file)
+
+ MACRO (ADD_XML_SKIP_H5_TEST skipresultfile skipresultcode testtype)
+ IF (${testtype} STREQUAL "SKIP")
+ ADD_TEST (
+ NAME H5DUMP-XML-${skipresultfile}
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${skipresultfile}.xml --xml ${ARGN}"
+ )
+ ELSE (${testtype} STREQUAL "SKIP")
+ ADD_XML_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN})
+ ENDIF (${testtype} STREQUAL "SKIP")
+ ENDMACRO (ADD_XML_SKIP_H5_TEST)
+
+ MACRO (ADD_XML_H5_TEST resultfile resultcode)
+ ADD_TEST (
+ NAME H5DUMP-XML-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=--xml;${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.xml"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ENDMACRO (ADD_XML_H5_TEST file)
+
+ # --------------------------------------------------------------------
# Determine which filters are available
+ # --------------------------------------------------------------------
SET (USE_FILTER_SZIP H5_HAVE_FILTER_SZIP)
SET (USE_FILTER_DEFLATE H5_HAVE_FILTER_DEFLATE)
SET (USE_FILTER_SHUFFLE H5_HAVE_FILTER_SHUFFLE)
@@ -297,7 +478,9 @@ IF (BUILD_TESTING)
SET (USE_FILTER_NBIT H5_HAVE_FILTER_NBIT)
SET (USE_FILTER_SCALEOFFSET H5_HAVE_FILTER_SCALEOFFSET)
-# Determine if H5dump packed bits feature is included
+ # --------------------------------------------------------------------
+ # Determine if H5dump packed bits feature is included
+ # --------------------------------------------------------------------
SET (USE_PACKED_BITS HDF5_USE_H5DUMP_PACKED_BITS)
##############################################################################
@@ -305,6 +488,7 @@ IF (BUILD_TESTING)
### T H E T E S T S ###
##############################################################################
##############################################################################
+
# test for displaying groups
ADD_H5_TEST (tgroup-1 0 tgroup.h5)
# test for displaying the selected groups
@@ -583,6 +767,7 @@ IF (BUILD_TESTING)
ADD_H5_TEST (tdataregR 0 -R tdatareg.h5)
ADD_H5_TEST (tattrreg 0 tattrreg.h5)
ADD_H5_TEST (tattrregR 0 -R tattrreg.h5)
+ ADD_H5_EXPORT_TEST (tbinregR tdatareg.h5 0 -d /Dataset1 -s 0 -R -y -o)
# tests for group creation order
# "1" tracked, "2" name, root tracked
@@ -612,9 +797,103 @@ IF (BUILD_TESTING)
ENDIF (NOT ${USE_PACKED_BITS})
ADD_SKIP_H5_TEST (tpackedbits 0 ${TESTTYPE} -d /dset1 -M 0,2 tdset.h5)
ADD_SKIP_H5_TEST (tpackedbits2 0 ${TESTTYPE} -d /dset1 -M 0,2,2,1 tdset.h5)
+
+ ########## test XML
+ ADD_XML_H5_TEST (tall.h5 0 tall.h5)
+ ADD_XML_H5_TEST (tattr.h5 0 tattr.h5)
+ ADD_XML_H5_TEST (tbitfields.h5 0 tbitfields.h5)
+ ADD_XML_H5_TEST (tcompound.h5 0 tcompound.h5)
+ ADD_XML_H5_TEST (tcompound2.h5 0 tcompound2.h5)
+ ADD_XML_H5_TEST (tdatareg.h5 0 tdatareg.h5)
+ ADD_XML_H5_TEST (tdset.h5 0 tdset.h5)
+ ADD_XML_H5_TEST (tdset2.h5 0 tdset2.h5)
+ ADD_XML_H5_TEST (tenum.h5 0 tenum.h5)
+ ADD_XML_H5_TEST (tgroup.h5 0 tgroup.h5)
+ ADD_XML_H5_TEST (thlink.h5 0 thlink.h5)
+ ADD_XML_H5_TEST (tloop.h5 0 tloop.h5)
+ ADD_XML_H5_TEST (tloop2.h5 0 tloop2.h5)
+ ADD_XML_H5_TEST (tmany.h5 0 tmany.h5)
+ ADD_XML_H5_TEST (tnestedcomp.h5 0 tnestedcomp.h5)
+ ADD_XML_H5_TEST (tcompound_complex.h5 0 tcompound_complex.h5)
+ ADD_XML_H5_TEST (tobjref.h5 0 tobjref.h5)
+ ADD_XML_H5_TEST (topaque.h5 0 topaque.h5)
+ ADD_XML_H5_TEST (tslink.h5 0 tslink.h5)
+ ADD_XML_H5_TEST (tudlink.h5 0 tudlink.h5)
+ ADD_XML_H5_TEST (textlink.h5 0 textlink.h5)
+ ADD_XML_H5_TEST (tstr.h5 0 tstr.h5)
+ ADD_XML_H5_TEST (tstr2.h5 0 tstr2.h5)
+ ADD_XML_H5_TEST (tref.h5 0 tref.h5)
+ ADD_XML_H5_TEST (tname-amp.h5 0 tname-amp.h5)
+ ADD_XML_H5_TEST (tname-apos.h5 0 tname-apos.h5)
+ ADD_XML_H5_TEST (tname-gt.h5 0 tname-gt.h5)
+ ADD_XML_H5_TEST (tname-lt.h5 0 tname-lt.h5)
+ ADD_XML_H5_TEST (tname-quot.h5 0 tname-quot.h5)
+ ADD_XML_H5_TEST (tname-sp.h5 0 tname-sp.h5)
+ ADD_XML_H5_TEST (tstring.h5 0 tstring.h5)
+ ADD_XML_H5_TEST (tstring-at.h5 0 tstring-at.h5)
+ ADD_XML_H5_TEST (tref-escapes.h5 0 tref-escapes.h5)
+ ADD_XML_H5_TEST (tref-escapes-at.h5 0 tref-escapes-at.h5)
+ ADD_XML_H5_TEST (tnodata.h5 0 tnodata.h5)
+ ADD_XML_H5_TEST (tarray1.h5 0 tarray1.h5)
+ ADD_XML_H5_TEST (tarray2.h5 0 tarray2.h5)
+ ADD_XML_H5_TEST (tarray3.h5 0 tarray3.h5)
+ ADD_XML_H5_TEST (tarray6.h5 0 tarray6.h5)
+ ADD_XML_H5_TEST (tarray7.h5 0 tarray7.h5)
+ ADD_XML_H5_TEST (tvldtypes1.h5 0 tvldtypes1.h5)
+ ADD_XML_H5_TEST (tvldtypes2.h5 0 tvldtypes2.h5)
+ ADD_XML_H5_TEST (tvldtypes3.h5 0 tvldtypes3.h5)
+ ADD_XML_H5_TEST (tvldtypes4.h5 0 tvldtypes4.h5)
+ ADD_XML_H5_TEST (tvldtypes5.h5 0 tvldtypes5.h5)
+ ADD_XML_H5_TEST (tvlstr.h5 0 tvlstr.h5)
+ ADD_XML_H5_TEST (tsaf.h5 0 tsaf.h5)
+ ADD_XML_H5_TEST (tempty.h5 0 tempty.h5)
+ ADD_XML_H5_TEST (tnamed_dtype_attr.h5 0 tnamed_dtype_attr.h5)
+ ##Test dataset and attribute of null space. Commented out:
+ ## wait until the XML schema is updated for null space.
+ ## ADD_XML_H5_TEST (tnullspace.h5 0 tnulspace.h5)
+
+ # other options for xml
+
+ ADD_XML_H5_TEST (tempty-dtd.h5 0 --use-dtd tempty.h5)
+ ADD_XML_H5_TEST (tempty-dtd-2.h5 0 -u tempty.h5)
+
+ # The lone colon here confuses some systems (Cray X1). Skip
+ # it if configure detects that this is a problem.
+ SET (TESTTYPE "TEST")
+ IF (NOT "H5_LONE_COLON")
+ SET (TESTTYPE "SKIP")
+ ENDIF (NOT "H5_LONE_COLON")
+ ADD_XML_SKIP_H5_TEST (tempty-nons.h5 0 ${TESTTYPE} -X : tempty.h5)
+
+ ADD_XML_H5_TEST (tempty-nons-2.h5 0 --xml-ns=: tempty.h5)
+
+ ## Some of these combinations are syntactically correct but
+ ## the URLs are dummies
+ ADD_XML_H5_TEST (tempty-ns.h5 0 -X thing: tempty.h5)
+ ADD_XML_H5_TEST (tempty-ns-2.h5 0 --xml-ns=thing: tempty.h5)
+ ADD_XML_H5_TEST (tempty-nons-uri.h5 0 --xml-ns=: --xml-dtd=http://somewhere.net tempty.h5)
+ ADD_XML_H5_TEST (tempty-dtd-uri.h5 0 --use-dtd --xml-dtd=http://somewhere.net tempty.h5)
+
+ ADD_XML_H5_TEST (tall-2A.h5 0 -A tall.h5)
+
+
+ # tests for attribute order
+ ADD_XML_H5_TEST (torderattr1.h5 0 -H --sort_by=name --sort_order=ascending torderattr.h5)
+ ADD_XML_H5_TEST (torderattr2.h5 0 -H --sort_by=name --sort_order=descending torderattr.h5)
+ ADD_XML_H5_TEST (torderattr3.h5 0 -H --sort_by=creation_order --sort_order=ascending torderattr.h5)
+ ADD_XML_H5_TEST (torderattr4.h5 0 -H --sort_by=creation_order --sort_order=descending torderattr.h5)
+
+ # tests for floating point user defined printf format
+ ADD_XML_H5_TEST (tfpformat.h5 0 -u -m %.7f tfpformat.h5)
ENDIF (BUILD_TESTING)
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
#-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index e4c5231..261fe15 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -1607,8 +1607,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED
begin_obj(dump_header_format->datasetbegin, name,
dump_header_format->datasetblockbegin);
indentation(indent + COL);
- error_msg(h5tools_getprogname(),
- "internal error (file %s:line %d)\n",
+ error_msg("internal error (file %s:line %d)\n",
__FILE__, __LINE__);
indentation(indent);
end_obj(dump_header_format->datasetend,
@@ -2116,8 +2115,7 @@ dump_group(hid_t gid, const char *name)
if (found_obj == NULL) {
indentation(indent);
- error_msg("internal error (file %s:line %d)\n",
- __FILE__, __LINE__);
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
h5tools_setstatus(EXIT_FAILURE);
}
else if (found_obj->displayed) {
@@ -2354,14 +2352,14 @@ dump_subsetting_header(struct subset_t *sset, int dims)
indentation(indent);
printf("%s %s ", dump_header_format->startbegin,
dump_header_format->startblockbegin);
- dump_dims((hsize_t *)sset->start, dims);
+ dump_dims(sset->start.data, dims);
printf("%s %s\n", dump_header_format->startend,
dump_header_format->startblockend);
indentation(indent);
printf("%s %s ", dump_header_format->stridebegin,
dump_header_format->strideblockbegin);
- dump_dims(sset->stride, dims);
+ dump_dims(sset->stride.data, dims);
printf("%s %s\n", dump_header_format->strideend,
dump_header_format->strideblockend);
@@ -2369,8 +2367,8 @@ dump_subsetting_header(struct subset_t *sset, int dims)
printf("%s %s ", dump_header_format->countbegin,
dump_header_format->countblockbegin);
- if (sset->count)
- dump_dims(sset->count, dims);
+ if(sset->count.data)
+ dump_dims(sset->count.data, dims);
else
printf("DEFAULT");
@@ -2381,8 +2379,8 @@ dump_subsetting_header(struct subset_t *sset, int dims)
printf("%s %s ", dump_header_format->blockbegin,
dump_header_format->blockblockbegin);
- if (sset->block)
- dump_dims(sset->block, dims);
+ if(sset->block.data)
+ dump_dims(sset->block.data, dims);
else
printf("DEFAULT");
@@ -3418,25 +3416,22 @@ handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe
* semicolons (;). The lists themselves can be separated by
* either commas (,) or white spaces.
*
- * Return: Success: hsize_t array. NULL is a valid return type if
- * there aren't any elements in the array.
+ * Return: <none>
*
* Programmer: Bill Wendling
* Tuesday, 6. February 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-static hsize_t *
-parse_hsize_list(const char *h_list)
+static void
+parse_hsize_list(const char *h_list, subset_d *d)
{
hsize_t *p_list;
const char *ptr;
unsigned int size_count = 0, i = 0, last_digit = 0;
if (!h_list || !*h_list || *h_list == ';')
- return NULL;
+ return;
/* count how many integers do we have */
for (ptr = h_list; ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
@@ -3452,10 +3447,10 @@ parse_hsize_list(const char *h_list)
if (size_count == 0)
/* there aren't any integers to read */
- return NULL;
+ return;
/* allocate an array for the integers in the list */
- p_list = calloc(size_count, sizeof(hsize_t));
+ p_list = (hsize_t *)calloc(size_count, sizeof(hsize_t));
for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
if(isdigit(*ptr)) {
@@ -3466,8 +3461,10 @@ parse_hsize_list(const char *h_list)
/* scroll to end of integer */
ptr++;
}
-
- return p_list;
+ d->data = p_list;
+ d->len = size_count;
+
+ return;
}
/*-------------------------------------------------------------------------
@@ -3499,8 +3496,8 @@ parse_subset_params(char *dset)
if (brace > slash) {
*brace++ = '\0';
- s = calloc(1, sizeof(struct subset_t));
- s->start = parse_hsize_list(brace);
+ s = (struct subset_t *)calloc(1, sizeof(struct subset_t));
+ parse_hsize_list(brace, &s->start);
while (*brace && *brace != ';')
brace++;
@@ -3508,7 +3505,7 @@ parse_subset_params(char *dset)
if (*brace)
brace++;
- s->stride = parse_hsize_list(brace);
+ parse_hsize_list(brace, &s->stride);
while (*brace && *brace != ';')
brace++;
@@ -3516,7 +3513,7 @@ parse_subset_params(char *dset)
if (*brace)
brace++;
- s->count = parse_hsize_list(brace);
+ parse_hsize_list(brace, &s->count);
while (*brace && *brace != ';')
brace++;
@@ -3524,7 +3521,7 @@ parse_subset_params(char *dset)
if (*brace)
brace++;
- s->block = parse_hsize_list(brace);
+ parse_hsize_list(brace, &s->block);
}
}
@@ -3576,79 +3573,83 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
} /* end if */
if(sset) {
- if(!sset->start || !sset->stride || !sset->count || !sset->block) {
+ unsigned int i;
+ hid_t sid = H5Dget_space(dsetid);
+ unsigned int ndims = H5Sget_simple_extent_ndims(sid);
+
+ H5Sclose(sid);
+
+ if(!sset->start.data || !sset->stride.data || !sset->count.data || !sset->block.data) {
/* they didn't specify a ``stride'' or ``block''. default to 1 in all
* dimensions */
- hid_t sid = H5Dget_space(dsetid);
- unsigned int ndims = H5Sget_simple_extent_ndims(sid);
-
- if(!sset->start)
+ if(!sset->start.data) {
/* default to (0, 0, ...) for the start coord */
- sset->start = calloc(ndims, sizeof(hsize_t));
-
- if(!sset->stride) {
- unsigned int i;
-
- sset->stride = calloc(ndims, sizeof(hsize_t));
+ sset->start.data = (hsize_t *)calloc(ndims, sizeof(hsize_t));
+ sset->start.len = ndims;
+ }
+ if(!sset->stride.data) {
+ sset->stride.data = (hsize_t *)calloc(ndims, sizeof(hsize_t));
+ sset->stride.len = ndims;
for (i = 0; i < ndims; i++)
- sset->stride[i] = 1;
+ sset->stride.data[i] = 1;
}
- if (!sset->count) {
- unsigned int i;
-
-
- sset->count = calloc(ndims, sizeof(hsize_t));
-
+ if(!sset->count.data) {
+ sset->count.data = (hsize_t *)calloc(ndims, sizeof(hsize_t));
+ sset->count.len = ndims;
for (i = 0; i < ndims; i++)
- sset->count[i] = 1;
+ sset->count.data[i] = 1;
}
- if (!sset->block) {
- unsigned int i;
-
- sset->block = calloc(ndims, sizeof(hsize_t));
-
+ if(!sset->block.data) {
+ sset->block.data = (hsize_t *)calloc(ndims, sizeof(hsize_t));
+ sset->block.len = ndims;
for (i = 0; i < ndims; i++)
- sset->block[i] = 1;
+ sset->block.data[i] = 1;
}
-
- H5Sclose(sid);
}
- }
-
-
- /*-------------------------------------------------------------------------
- * check for block overlap
- *-------------------------------------------------------------------------
- */
-
- if(sset)
- {
- hid_t sid = H5Dget_space(dsetid);
- unsigned int ndims = H5Sget_simple_extent_ndims(sid);
- unsigned int i;
- for ( i = 0; i < ndims; i++)
- {
- if ( sset->count[i] > 1 )
- {
-
- if ( sset->stride[i] < sset->block[i] )
- {
+ /*-------------------------------------------------------------------------
+ * check for dimension overflow
+ *-------------------------------------------------------------------------
+ */
+ if(sset->start.len > ndims) {
+ error_msg("number of start dims (%u) exceed dataset dims (%u)\n", sset->start.len, ndims);
+ h5tools_setstatus(EXIT_FAILURE);
+ return;
+ }
+ if(sset->stride.len > ndims) {
+ error_msg("number of stride dims (%u) exceed dataset dims (%u)\n", sset->stride.len, ndims);
+ h5tools_setstatus(EXIT_FAILURE);
+ return;
+ }
+ if(sset->count.len > ndims) {
+ error_msg("number of count dims (%u) exceed dataset dims (%u)\n", sset->count.len, ndims);
+ h5tools_setstatus(EXIT_FAILURE);
+ return;
+ }
+ if(sset->block.len > ndims) {
+ error_msg("number of block dims (%u) exceed dataset dims (%u)\n", sset->block.len, ndims);
+ h5tools_setstatus(EXIT_FAILURE);
+ return;
+ }
+
+ /*-------------------------------------------------------------------------
+ * check for block overlap
+ *-------------------------------------------------------------------------
+ */
+ for(i = 0; i < ndims; i++) {
+ if(sset->count.data[i] > 1) {
+ if(sset->stride.data[i] < sset->block.data[i]) {
error_msg("wrong subset selection; blocks overlap\n");
h5tools_setstatus(EXIT_FAILURE);
return;
+ } /* end if */
+ } /* end if */
+ } /* end for */
+ } /* end if */
- }
-
- }
-
- }
- H5Sclose(sid);
-
- }
H5Oget_info(dsetid, &oinfo);
if(oinfo.rc > 1 || hit_elink) {
@@ -3726,7 +3727,7 @@ handle_groups(hid_t fid, const char *group, void UNUSED * data, int pe, const ch
if(prefix_len <= new_len)
{
prefix_len = new_len;
- prefix = HDrealloc(prefix, prefix_len);
+ prefix = (char *)HDrealloc(prefix, prefix_len);
} /* end if */
HDstrcpy(prefix, group);
@@ -3764,7 +3765,7 @@ handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, co
error_msg("\"%s\" is a hard link\n", links);
h5tools_setstatus(EXIT_FAILURE);
} else {
- char *buf = HDmalloc(linfo.u.val_size);
+ char *buf = (char *)HDmalloc(linfo.u.val_size);
switch(linfo.type) {
case H5L_TYPE_SOFT: /* Soft link */
@@ -3938,7 +3939,7 @@ parse_command_line(int argc, const char *argv[])
}
/* this will be plenty big enough to hold the info */
- hand = calloc((size_t)argc, sizeof(struct handler_t));
+ hand = (struct handler_t *)calloc((size_t)argc, sizeof(struct handler_t));
/* parse command line options */
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
@@ -4010,7 +4011,7 @@ parse_start:
hand[i].func = handle_datasets;
hand[i].obj = HDstrdup(opt_arg);
hand[i].subset_info = parse_subset_params(hand[i].obj);
- last_dset = hand;
+ last_dset = &hand[i];
break;
}
@@ -4163,8 +4164,7 @@ parse_start:
struct subset_t *s;
if (!last_was_dset) {
- error_msg(h5tools_getprogname(),
- "option `-%c' can only be used after --dataset option\n",
+ error_msg("option `-%c' can only be used after --dataset option\n",
opt);
leave(EXIT_FAILURE);
}
@@ -4176,7 +4176,7 @@ parse_start:
*/
s = last_dset->subset_info;
} else {
- last_dset->subset_info = s = calloc(1, sizeof(struct subset_t));
+ last_dset->subset_info = s = (struct subset_t *)calloc(1, sizeof(struct subset_t));
}
/*
@@ -4192,10 +4192,10 @@ parse_start:
*/
do {
switch ((char)opt) {
- case 's': free(s->start); s->start = parse_hsize_list(opt_arg); break;
- case 'S': free(s->stride); s->stride = parse_hsize_list(opt_arg); break;
- case 'c': free(s->count); s->count = parse_hsize_list(opt_arg); break;
- case 'k': free(s->block); s->block = parse_hsize_list(opt_arg); break;
+ case 's': free(s->start.data); parse_hsize_list(opt_arg, &s->start); break;
+ case 'S': free(s->stride.data); parse_hsize_list(opt_arg, &s->stride); break;
+ case 'c': free(s->count.data); parse_hsize_list(opt_arg, &s->count); break;
+ case 'k': free(s->block.data); parse_hsize_list(opt_arg, &s->block); break;
default: goto end_collect;
}
} while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF);
@@ -4256,10 +4256,10 @@ free_handler(struct handler_t *hand, int len)
free(hand[i].obj);
if (hand[i].subset_info) {
- free(hand[i].subset_info->start);
- free(hand[i].subset_info->stride);
- free(hand[i].subset_info->count);
- free(hand[i].subset_info->block);
+ free(hand[i].subset_info->start.data);
+ free(hand[i].subset_info->stride.data);
+ free(hand[i].subset_info->count.data);
+ free(hand[i].subset_info->block.data);
free(hand[i].subset_info);
}
}
@@ -4588,8 +4588,8 @@ print_enum(hid_t type)
dst_size = H5Tget_size(type);
/* Get the names and raw values of all members */
- name = calloc(nmembs, sizeof(char *));
- value = calloc(nmembs, MAX(H5Tget_size(type), dst_size));
+ name = (char **)calloc(nmembs, sizeof(char *));
+ value = (unsigned char *)calloc(nmembs, MAX(H5Tget_size(type), dst_size));
for (i = 0; i < nmembs; i++) {
name[i] = H5Tget_member_name(type, i);
@@ -4749,7 +4749,7 @@ xml_escape_the_name(const char *str)
return HDstrdup(str);
cp = str;
- rcp = ncp = HDmalloc(len + extra + 1);
+ rcp = ncp = (char *)HDmalloc(len + extra + 1);
if (!ncp)
return NULL; /* ?? */
@@ -4838,7 +4838,7 @@ xml_escape_the_string(const char *str, int slen)
}
cp = str;
- rcp = ncp = calloc((len + extra + 1), sizeof(char));
+ rcp = ncp = (char *)calloc((len + extra + 1), sizeof(char));
if (ncp == NULL)
return NULL; /* ?? */
@@ -4930,7 +4930,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* This should be defined somewhere else */
/* These 2 cases are handled the same right now, but
probably will have something different eventually */
- char * dtxid = malloc(100);
+ char * dtxid = (char *)malloc(100);
xml_name_to_XID(found_obj->objname, dtxid, 100, 1);
if (!found_obj->recorded) {
@@ -5290,7 +5290,7 @@ xml_dump_datatype(hid_t type)
if(found_obj) {
/* Shared datatype, must be entered as an object */
/* These 2 cases are the same now, but may change */
- char * dtxid = malloc(100);
+ char * dtxid = (char *)malloc(100);
xml_name_to_XID(found_obj->objname, dtxid, 100, 1);
if (!found_obj->recorded) {
@@ -5429,6 +5429,12 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU
int depth;
int stdindent = COL; /* should be 3 */
+ if (fp_format)
+ {
+ outputformat->fmt_double = fp_format;
+ outputformat->fmt_float = fp_format;
+ }
+
if (nCols==0) {
outputformat->line_ncols = 65535;
outputformat->line_per_line = 1;
@@ -5663,14 +5669,14 @@ xml_dump_named_datatype(hid_t type, const char *name)
char *t_prefix;
char *t_name;
- tmp = HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
HDstrcpy(tmp, prefix);
HDstrcat(tmp, "/");
HDstrcat(tmp, name);
indentation(indent);
- dtxid = HDmalloc(100);
- parentxid = HDmalloc(100);
+ dtxid = (char *)HDmalloc(100);
+ parentxid = (char *)HDmalloc(100);
t_tmp = xml_escape_the_name(tmp);
t_prefix = xml_escape_the_name(prefix);
t_name = xml_escape_the_name(name);
@@ -5818,7 +5824,7 @@ xml_dump_group(hid_t gid, const char *name)
isRoot = 1;
tmp = HDstrdup("/");
} else {
- tmp = HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
HDstrcpy(tmp, prefix);
par = HDstrdup(tmp);
cp = HDstrrchr(par, '/');
@@ -5848,11 +5854,11 @@ xml_dump_group(hid_t gid, const char *name)
h5tools_setstatus(EXIT_FAILURE);
} else {
char *t_name = xml_escape_the_name(name);
- char *grpxid = malloc(100);
- char *parentxid = malloc(100);
+ char *grpxid = (char *)malloc(100);
+ char *parentxid = (char *)malloc(100);
if(found_obj->displayed) {
- char *ptrstr = malloc(100);
+ char *ptrstr = (char *)malloc(100);
/* already seen: enter a groupptr */
if(isRoot) {
@@ -5954,8 +5960,8 @@ xml_dump_group(hid_t gid, const char *name)
/* only link -- must be first time! */
char *t_name = xml_escape_the_name(name);
- char *grpxid = malloc(100);
- char *parentxid = malloc(100);
+ char *grpxid = (char *)malloc(100);
+ char *parentxid = (char *)malloc(100);
if(isRoot) {
xml_name_to_XID("/", grpxid, 100, 1);
@@ -6072,7 +6078,7 @@ xml_print_refs(hid_t did, int source)
ssiz = H5Sget_simple_extent_npoints(space);
ssiz *= H5Tget_size(type);
- buf = calloc((size_t)ssiz, sizeof(char));
+ buf = (char *)calloc((size_t)ssiz, sizeof(char));
if(buf == NULL)
return FAIL;
e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
@@ -6086,7 +6092,7 @@ xml_print_refs(hid_t did, int source)
ssiz = H5Sget_simple_extent_npoints(space);
ssiz *= H5Tget_size(type);
- buf = calloc((size_t)ssiz, sizeof(char));
+ buf = (char *)calloc((size_t)ssiz, sizeof(char));
if (buf == NULL) {
free(buf);
return FAIL;
@@ -6207,7 +6213,7 @@ xml_print_strs(hid_t did, int source)
tsiz = H5Tget_size(type);
bp = (char*)buf;
if(!is_vlstr)
- onestring = (char *) calloc(tsiz, sizeof(char));
+ onestring = (char *)calloc(tsiz, sizeof(char));
for (i = 0; i < ssiz; i++) {
if(is_vlstr) {
@@ -6480,10 +6486,10 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset)
char *tmp;
char *t_name, *t_tmp, *t_prefix;
unsigned attr_crt_order_flags;
- char *rstr = HDmalloc(100);
- char *pstr = HDmalloc(100);
+ char *rstr = (char *)HDmalloc(100);
+ char *pstr = (char *)HDmalloc(100);
- tmp = HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
HDstrcpy(tmp, prefix);
HDstrcat(tmp, "/");
HDstrcat(tmp, name);
@@ -6515,7 +6521,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset)
/* Print information about storage layout */
if(H5D_CHUNKED == H5Pget_layout(dcpl)) {
maxdims = H5Sget_simple_extent_ndims(space);
- chsize = (hsize_t *) malloc(maxdims * sizeof(hsize_t));
+ chsize = (hsize_t *)malloc(maxdims * sizeof(hsize_t));
indent += COL;
indentation(indent);
printf("<%sStorageLayout>\n",xmlnsprefix);
@@ -6798,8 +6804,8 @@ xml_print_enum(hid_t type)
}
/* Get the names and raw values of all members */
- name = calloc(nmembs, sizeof(char *));
- value = calloc(nmembs, MAX(H5Tget_size(type), dst_size));
+ name = (char **)calloc(nmembs, sizeof(char *));
+ value = (unsigned char *)calloc(nmembs, MAX(H5Tget_size(type), dst_size));
for (i = 0; i < nmembs; i++) {
name[i] = H5Tget_member_name(type, i);
@@ -6983,7 +6989,7 @@ static void
init_prefix(char **prfx, size_t prfx_len)
{
HDassert(prfx_len > 0);
- *prfx = HDcalloc(prfx_len, 1);
+ *prfx = (char *)HDcalloc(prfx_len, 1);
}
@@ -7004,7 +7010,7 @@ add_prefix(char **prfx, size_t *prfx_len, const char *name)
/* Check if we need more space */
if(*prfx_len <= new_len) {
*prfx_len = new_len + 1;
- *prfx = HDrealloc(*prfx, *prfx_len);
+ *prfx = (char *)HDrealloc(*prfx, *prfx_len);
}
/* Append object name to prefix */
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index a466739..e8c888c 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -28,9 +28,6 @@
#include "H5private.h"
#include "h5tools.h"
-/* Name of tool */
-#define PROGRAMNAME "h5dumpgentest"
-
#define FILE1 "tgroup.h5"
#define FILE2 "tdset.h5"
#define FILE3 "tattr.h5"
@@ -493,15 +490,15 @@ static void gent_softlink(void)
#define NY 2
static int gent_softlink2(void)
{
- hid_t fileid1;
- hid_t gid1=0, gid2=0;
- hid_t tid;
- hid_t dset1, dset2;
- hid_t datatype, dataspace;
+ hid_t fileid1 = -1;
+ hid_t gid1 = -1, gid2 = -1;
+ hid_t datatype = -1;
+ hid_t dset1 = -1, dset2 = -1;
+ hid_t dataspace = -1;
hsize_t dimsf[2]; /* dataset dimensions */
- herr_t status=SUCCEED;
int data1[NX][NY] = {{0,0},{1,1},{2,2},{3,3}};
int data2[NX][NY] = {{0,0},{0,1},{0,2},{3,3}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
* FILE
@@ -537,8 +534,8 @@ static int gent_softlink2(void)
/*-----------------------------------------------------------------------
* Named datatype
*------------------------------------------------------------------------*/
- tid = H5Tcopy(H5T_NATIVE_INT);
- status = H5Tcommit2(fileid1, "dtype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ datatype = H5Tcopy(H5T_NATIVE_INT);
+ status = H5Tcommit2(fileid1, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (status < 0)
{
fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", FILE4_1);
@@ -558,16 +555,14 @@ static int gent_softlink2(void)
dataspace = H5Screate_simple(2, dimsf, NULL);
/*
- * Define datatype for the data in the file.
* We will store little endian INT numbers.
*/
- datatype = H5Tcopy(H5T_NATIVE_INT);
/*---------------
* dset1
*/
/* Create a new dataset as sample object */
- dset1 = H5Dcreate2(fileid1, "/dset1", datatype, dataspace,
+ dset1 = H5Dcreate2(fileid1, "/dset1", H5T_NATIVE_INT, dataspace,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (dset1 < 0)
{
@@ -588,7 +583,7 @@ static int gent_softlink2(void)
* dset2
*/
/* Create a new dataset as sample object */
- dset2 = H5Dcreate2(fileid1, "/dset2", datatype, dataspace,
+ dset2 = H5Dcreate2(fileid1, "/dset2", H5T_NATIVE_INT, dataspace,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (dset2 < 0)
{
@@ -708,13 +703,34 @@ out:
/*
* Close/release resources.
*/
- H5Sclose(dataspace);
- H5Gclose(gid1);
- H5Gclose(gid2);
- H5Tclose(datatype);
- H5Dclose(dset1);
- H5Dclose(dset2);
- H5Fclose(fileid1);
+ if(dataspace >= 0 && H5Sclose(dataspace) < 0) {
+ fprintf(stderr, "Error: %s> H5Sclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(gid1 >= 0 && H5Gclose(gid1) < 0) {
+ fprintf(stderr, "Error: %s> H5Gclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(gid2 >= 0 && H5Gclose(gid2) < 0) {
+ fprintf(stderr, "Error: %s> H5Gclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(datatype >= 0 && H5Tclose(datatype) < 0) {
+ fprintf(stderr, "Error: %s> H5Tclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(dset1 >= 0 && H5Dclose(dset1) < 0) {
+ fprintf(stderr, "Error: %s> H5Dclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(dset2 >= 0 && H5Dclose(dset2) < 0) {
+ fprintf(stderr, "Error: %s> H5Dclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(fileid1 >= 0 && H5Fclose(fileid1) < 0) {
+ fprintf(stderr, "Error: %s> H5Fclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
return status;
}
@@ -1368,7 +1384,8 @@ static void gent_loop2(void)
(dset1) (udlink)
*/
-static void gent_many(void)
+static void
+gent_many(void)
{
hid_t fid, group, attr, dataset, space, space2, type, create_plist, type2;
hid_t array_dt;
@@ -1391,79 +1408,79 @@ static void gent_many(void)
hsize_t dim[4];
herr_t ret;
- fid = H5Fcreate(FILE12, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE12, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
+ group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
- create_plist = H5Pcreate(H5P_DATASET_CREATE);
+ create_plist = H5Pcreate(H5P_DATASET_CREATE);
- sdim = 2;
- H5Pset_chunk(create_plist, 1, &sdim);
+ sdim = 2;
+ H5Pset_chunk(create_plist, 1, &sdim);
- group = H5Gcreate2(fid, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate2(fid, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+ type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
- dim[0] = dim[1] = dim[2] = dim[3] = 2;
- array_dt = H5Tarray_create2(H5T_STD_I32BE, 4, dim);
- H5Tinsert(type, "a_array", HOFFSET(dset1_t, a), array_dt);
- H5Tclose(array_dt);
+ dim[0] = dim[1] = dim[2] = dim[3] = 2;
+ array_dt = H5Tarray_create2(H5T_STD_I32BE, 4, dim);
+ H5Tinsert(type, "a_array", HOFFSET(dset1_t, a), array_dt);
+ H5Tclose(array_dt);
- array_dt = H5Tarray_create2(H5T_IEEE_F64BE, 4, dim);
- H5Tinsert(type, "b_array", HOFFSET(dset1_t, b), array_dt);
- H5Tclose(array_dt);
+ array_dt = H5Tarray_create2(H5T_IEEE_F64BE, 4, dim);
+ H5Tinsert(type, "b_array", HOFFSET(dset1_t, b), array_dt);
+ H5Tclose(array_dt);
- array_dt = H5Tarray_create2(H5T_IEEE_F64BE, 4, dim);
- H5Tinsert(type, "c_array", HOFFSET(dset1_t, c), array_dt);
- H5Tclose(array_dt);
+ array_dt = H5Tarray_create2(H5T_IEEE_F64BE, 4, dim);
+ H5Tinsert(type, "c_array", HOFFSET(dset1_t, c), array_dt);
+ H5Tclose(array_dt);
- type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+ type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
- array_dt = H5Tarray_create2(H5T_NATIVE_INT, 4, dim);
- H5Tinsert(type2, "a_array", HOFFSET(dset1_t, a), array_dt);
- H5Tclose(array_dt);
+ array_dt = H5Tarray_create2(H5T_NATIVE_INT, 4, dim);
+ H5Tinsert(type2, "a_array", HOFFSET(dset1_t, a), array_dt);
+ H5Tclose(array_dt);
- array_dt = H5Tarray_create2(H5T_NATIVE_DOUBLE, 4, dim);
- H5Tinsert(type2, "b_array", HOFFSET(dset1_t, b), array_dt);
- H5Tclose(array_dt);
+ array_dt = H5Tarray_create2(H5T_NATIVE_DOUBLE, 4, dim);
+ H5Tinsert(type2, "b_array", HOFFSET(dset1_t, b), array_dt);
+ H5Tclose(array_dt);
- array_dt = H5Tarray_create2(H5T_NATIVE_DOUBLE, 4, dim);
- H5Tinsert(type2, "c_array", HOFFSET(dset1_t, c), array_dt);
- H5Tclose(array_dt);
+ array_dt = H5Tarray_create2(H5T_NATIVE_DOUBLE, 4, dim);
+ H5Tinsert(type2, "c_array", HOFFSET(dset1_t, c), array_dt);
+ H5Tclose(array_dt);
- /* dset1 */
- sdim = 6;
- maxdim = H5S_UNLIMITED;
- space = H5Screate_simple(1, &sdim, &maxdim);
- dataset = H5Dcreate2(group, "dset1", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
+ /* dset1 */
+ sdim = 6;
+ maxdim = H5S_UNLIMITED;
+ space = H5Screate_simple(1, &sdim, &maxdim);
+ dataset = H5Dcreate2(group, "dset1", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
- /* add attributes to dset1 */
- dims[0] = 10;
- space2 = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space2, H5P_DEFAULT, H5P_DEFAULT);
- sprintf(buf, "abcdefghi");
- H5Awrite(attr, H5T_NATIVE_CHAR, buf);
- H5Sclose(space2);
- H5Aclose(attr);
+ /* add attributes to dset1 */
+ dims[0] = 10;
+ space2 = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space2, H5P_DEFAULT, H5P_DEFAULT);
+ sprintf(buf, "abcdefghi");
+ H5Awrite(attr, H5T_NATIVE_CHAR, buf);
+ H5Sclose(space2);
+ H5Aclose(attr);
- dims[0] = 2; dims[1] = 2;
- space2 = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(dataset, "attr2", H5T_STD_I32BE, space2, H5P_DEFAULT, H5P_DEFAULT);
- data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3;
- H5Awrite(attr, H5T_NATIVE_INT, data);
- H5Sclose(space2);
- H5Aclose(attr);
+ dims[0] = 2; dims[1] = 2;
+ space2 = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(dataset, "attr2", H5T_STD_I32BE, space2, H5P_DEFAULT, H5P_DEFAULT);
+ data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3;
+ H5Awrite(attr, H5T_NATIVE_INT, data);
+ H5Sclose(space2);
+ H5Aclose(attr);
- dims[0] = 10;
- space2 = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(dataset, "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- d[i] = 0.1 * i;
- H5Awrite(attr, H5T_NATIVE_DOUBLE, d);
- H5Sclose(space2);
- H5Aclose(attr);
+ dims[0] = 10;
+ space2 = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT, H5P_DEFAULT);
+ for(i = 0; i < 10; i++)
+ d[i] = 0.1 * i;
+ H5Awrite(attr, H5T_NATIVE_DOUBLE, d);
+ H5Sclose(space2);
+ H5Aclose(attr);
for(j=0; j<(int)sdim; j++) {
for(i3 = 0; i3 < 2; i3++) {
@@ -1479,89 +1496,88 @@ static void gent_many(void)
}
}
- H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
+ H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
- H5Dclose(dataset);
- H5Sclose(space);
+ H5Dclose(dataset);
+ H5Sclose(space);
- H5Tclose(type);
- H5Tclose(type2);
- H5Gclose(group);
+ H5Tclose(type);
+ H5Tclose(type2);
+ H5Gclose(group);
- group = H5Gcreate2(fid, "/g1/g1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Lcreate_hard(group, "/g1/g1.1/dset1", H5L_SAME_LOC, "link1", H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
+ group = H5Gcreate2(fid, "/g1/g1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_hard(group, "/g1/g1.1/dset1", H5L_SAME_LOC, "link1", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
- group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Lcreate_soft("/g1", group, "slink2", H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
+ group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_soft("/g1", group, "slink2", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
- group = H5Gcreate2(fid, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
+ group = H5Gcreate2(fid, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
- group = H5Gcreate2(fid, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate2(fid, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- /* dset2 */
- dims[0] = 10; dims[1] = 10;
- space = H5Screate_simple(2, dims, NULL);
+ /* dset2 */
+ dims[0] = 10; dims[1] = 10;
+ space = H5Screate_simple(2, dims, NULL);
- dataset = H5Dcreate2(group, "dset2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- for(j = 0; j < 10; j++)
+ dataset = H5Dcreate2(group, "dset2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 10; j++)
dset2[i][j] = j;
- H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
- H5Dclose(dataset);
+ H5Dclose(dataset);
- H5Sclose(space);
- H5Gclose(group);
+ H5Sclose(space);
+ H5Gclose(group);
- group = H5Gopen2(fid, "/g3", H5P_DEFAULT);
- H5Lcreate_hard(group, "/g4/dset2", H5L_SAME_LOC, "link3", H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
+ group = H5Gopen2(fid, "/g3", H5P_DEFAULT);
+ H5Lcreate_hard(group, "/g4/dset2", H5L_SAME_LOC, "link3", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
- group = H5Gcreate2(fid, "/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
+ group = H5Gcreate2(fid, "/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
- group = H5Gcreate2(fid, "/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- /* dset3 */
- dims[0] = 10; dims[1] = 10;
- space = H5Screate_simple(2, dims, NULL);
+ group = H5Gcreate2(fid, "/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ /* dset3 */
+ dims[0] = 10; dims[1] = 10;
+ space = H5Screate_simple(2, dims, NULL);
- dataset = H5Dcreate2(group, "dset3", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- for(j = 0; j < 10; j++)
+ dataset = H5Dcreate2(group, "dset3", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 10; j++)
dset3[i][j] = i;
- H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset3);
-
- H5Dclose(dataset);
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset3);
- H5Sclose(space);
- H5Gclose(group);
+ H5Dclose(dataset);
- group = H5Gopen2(fid, "/g5", H5P_DEFAULT);
- H5Lcreate_soft("/g6/dset3", group, "slink4", H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
- H5Pclose(create_plist);
+ H5Sclose(space);
+ H5Gclose(group);
- group = H5Gcreate2(fid, "/g7", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
- group = H5Gcreate2(fid, "/g8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
+ group = H5Gopen2(fid, "/g5", H5P_DEFAULT);
+ H5Lcreate_soft("/g6/dset3", group, "slink4", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+ H5Pclose(create_plist);
- /* Create dangling external and UD links */
- H5Lcreate_external("somefile", "somepath", fid, "/g8/elink", H5P_DEFAULT, H5P_DEFAULT);
- H5Lregister(UD_link_class);
- H5Lcreate_ud(fid, "/g8/udlink", (H5L_type_t)MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate2(fid, "/g7", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+ group = H5Gcreate2(fid, "/g8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
- /* Create links to external and UD links */
- ret= H5Lcreate_soft("/g8/elink", fid, "/g7/slink5", H5P_DEFAULT, H5P_DEFAULT);
- HDassert(ret >= 0);
- ret= H5Lcreate_soft("/g8/udlink", fid, "/g7/slink6", H5P_DEFAULT, H5P_DEFAULT);
- HDassert(ret >= 0);
+ /* Create dangling external and UD links */
+ H5Lcreate_external("somefile", "somepath", fid, "/g8/elink", H5P_DEFAULT, H5P_DEFAULT);
+ H5Lregister(UD_link_class);
+ H5Lcreate_ud(fid, "/g8/udlink", (H5L_type_t)MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT);
- H5Fclose(fid);
+ /* Create links to external and UD links */
+ ret = H5Lcreate_soft("/g8/elink", fid, "/g7/slink5", H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(ret >= 0);
+ ret = H5Lcreate_soft("/g8/udlink", fid, "/g7/slink6", H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(ret >= 0);
+ H5Fclose(fid);
}
static hid_t mkstr(int size, H5T_str_t pad) {
@@ -2523,7 +2539,8 @@ static void gent_vldatatypes(void)
assert(ret >= 0);
}
-static void gent_vldatatypes2(void)
+static void
+gent_vldatatypes2(void)
{
hvl_t wdata[SPACE1_DIM1]; /* Information to write */
hvl_t *t1; /* Temporary pointer to VL information */
@@ -2536,16 +2553,16 @@ static void gent_vldatatypes2(void)
herr_t ret; /* Generic return value */
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p=malloc((i+1)*sizeof(hvl_t));
- if(wdata[i].p==NULL) {
- printf("Cannot allocate memory for VL data! i=%u\n",i);
+ for(i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].p = (hvl_t *)malloc((i + 1) * sizeof(hvl_t));
+ if(wdata[i].p == NULL) {
+ printf("Cannot allocate memory for VL data! i=%u\n", i);
return;
} /* end if */
- wdata[i].len=i+1;
- for(t1=wdata[i].p,j=0; j<(i+1); j++, t1++) {
- t1->p=malloc((j+1)*sizeof(unsigned int));
- if(t1->p==NULL) {
+ wdata[i].len = i + 1;
+ for(t1 = (hvl_t *)wdata[i].p, j = 0; j < (i + 1); j++, t1++) {
+ t1->p = (unsigned *)malloc((j + 1) * sizeof(unsigned));
+ if(t1->p == NULL) {
printf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
return;
} /* end if */
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index 55434ab..1c152da 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -144,6 +144,58 @@ TOOLTEST1() {
}
+# same as TOOLTEST1 but compares generated file to expected output
+# and compares the generated data file to the expected data file
+# used for the binary tests that expect a full path in -o without -b
+TOOLTEST2() {
+
+ expectdata="$srcdir/../testfiles/$1"
+ expect="$srcdir/../testfiles/`basename $1 .exp`.ddl"
+ actualdata="../testfiles/`basename $1 .exp`.txt"
+ actual="../testfiles/`basename $1 .exp`.out"
+ actual_err="../testfiles/`basename $1 .exp`.err"
+ shift
+
+ # Run test.
+ TESTING $DUMPER $@
+ (
+
+ cd $srcdir/../testfiles
+ $RUNSERIAL $DUMPER_BIN $@
+ ) >$actual 2>$actual_err
+ cat $actual_err >> $actual
+
+ if [ ! -f $expect ]; then
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ elif $CMP $expect $actual; then
+ if [ ! -f $expectdata ]; then
+ # Create the expect data file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actualdata $expectdata
+ elif $CMP $expectdata $actualdata; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected datafile (*.exp) differs from actual datafile (*.txt)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /'
+ fi
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actual $actualdata $actual_err
+ fi
+
+}
+
# Print a "SKIP" message
SKIP() {
@@ -383,6 +435,12 @@ TOOLTEST tindicessub3.ddl -d 3d -s 0,1,2 -S 1,3,3 -c 2,2,2 -k 1,2,2 taindices.
# 4D case
TOOLTEST tindicessub4.ddl -d 4d -s 0,0,1,2 -c 2,2,3,2 -S 1,1,3,3 -k 1,1,2,2 taindices.h5
+#Exceed the dimensions for subsetting
+TOOLTEST1 texceedsubstart.ddl -d 1d -s 1,3 taindices.h5
+TOOLTEST1 texceedsubcount.ddl -d 1d -c 1,3 taindices.h5
+TOOLTEST1 texceedsubstride.ddl -d 1d -S 1,3 taindices.h5
+TOOLTEST1 texceedsubblock.ddl -d 1d -k 1,3 taindices.h5
+
# tests for filters
# SZIP
@@ -482,14 +540,19 @@ if test -z "$HDF5_NOCLEANUP"; then
rm -f $TESTDIR/out3.h5
fi
-
-
# test for dataset region references
TOOLTEST tdatareg.ddl tdatareg.h5
TOOLTEST tdataregR.ddl -R tdatareg.h5
TOOLTEST tattrreg.ddl tattrreg.h5
TOOLTEST tattrregR.ddl -R tattrreg.h5
+TOOLTEST2 tbinregR.exp -d /Dataset1 -s 0 -R -y -o $TESTDIR/tbinregR.txt tdatareg.h5
+
+# Clean up text output files
+if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $TESTDIR/tbinregR.txt
+fi
+
# tests for group creation order
# "1" tracked, "2" name, root tracked
TOOLTEST tordergr1.ddl --group=1 --sort_by=creation_order --sort_order=ascending tordergr.h5
@@ -504,7 +567,6 @@ TOOLTEST torderattr2.ddl -H --sort_by=name --sort_order=descending torderattr.h5
TOOLTEST torderattr3.ddl -H --sort_by=creation_order --sort_order=ascending torderattr.h5
TOOLTEST torderattr4.ddl -H --sort_by=creation_order --sort_order=descending torderattr.h5
-
# tests for floating point user defined printf format
TOOLTEST tfpformat.ddl -m %.7f tfpformat.h5
@@ -515,6 +577,7 @@ TOOLTEST textlinkfar.ddl textlinkfar.h5
# tests for Fixed Array chunk indices
TOOLTEST tdset_idx.ddl -p -H tdset_idx.h5
+# Report test results and exit
if test $nerrors -eq 0 ; then
echo "All $TESTNAME tests passed."
exit $EXIT_SUCCESS
diff --git a/tools/h5dump/testh5dumpxml.sh.in b/tools/h5dump/testh5dumpxml.sh.in
index c4c8657..c9f1ad2 100755
--- a/tools/h5dump/testh5dumpxml.sh.in
+++ b/tools/h5dump/testh5dumpxml.sh.in
@@ -188,6 +188,9 @@ TOOLTEST torderattr2.h5.xml --xml -H --sort_by=name --sort_order=descending tord
TOOLTEST torderattr3.h5.xml --xml -H --sort_by=creation_order --sort_order=ascending torderattr.h5
TOOLTEST torderattr4.h5.xml --xml -H --sort_by=creation_order --sort_order=descending torderattr.h5
+# tests for floating point user defined printf format
+TOOLTEST tfpformat.h5.xml -u -m %.7f tfpformat.h5
+
if test $nerrors -eq 0 ; then
echo "All $TESTNAME tests passed."
diff --git a/tools/h5import/CMakeLists.txt b/tools/h5import/CMakeLists.txt
index 8eea2c1..3c82492 100644
--- a/tools/h5import/CMakeLists.txt
+++ b/tools/h5import/CMakeLists.txt
@@ -4,11 +4,11 @@ PROJECT (HDF5_TOOLS_H5IMPORT)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
# --------------------------------------------------------------------
-# Add the h5import and test executables
+# Add the h5import executables
# --------------------------------------------------------------------
ADD_EXECUTABLE (h5import ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/h5import.c)
H5_NAMING (h5import)
@@ -26,7 +26,16 @@ TARGET_LINK_LIBRARIES (h5import ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
SET (H5_DEP_EXECUTABLES h5import)
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
IF (BUILD_TESTING)
+ # --------------------------------------------------------------------
+ # Add the h5import executables
+ # --------------------------------------------------------------------
ADD_EXECUTABLE (h5importtest ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/h5importtest.c)
H5_NAMING (h5importtest)
IF (WIN32)
@@ -40,14 +49,28 @@ IF (BUILD_TESTING)
ENDIF (MSVC)
ENDIF (WIN32)
TARGET_LINK_LIBRARIES (h5importtest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
- ADD_TEST (NAME h5importtest COMMAND $<TARGET_FILE:h5importtest>)
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
- SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
- h5importtest
- )
+ ADD_TEST (NAME h5importtest COMMAND $<TARGET_FILE:h5importtest>)
ENDIF (BUILD_TESTING)
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
#-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
diff --git a/tools/h5jam/CMakeLists.txt b/tools/h5jam/CMakeLists.txt
index 166d272..61b8c84 100644
--- a/tools/h5jam/CMakeLists.txt
+++ b/tools/h5jam/CMakeLists.txt
@@ -4,11 +4,11 @@ PROJECT (HDF5_TOOLS_H5JAM)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
# --------------------------------------------------------------------
-# Add the h5jam and test executables
+# Add the h5jam executables
# --------------------------------------------------------------------
ADD_EXECUTABLE (h5jam ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/h5jam.c)
H5_NAMING (h5jam)
@@ -73,8 +73,17 @@ SET (H5_DEP_EXECUTABLES
h5unjam
)
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
IF (BUILD_TESTING)
- IF (NOT BUILD_SHARED_LIBS)
+ # --------------------------------------------------------------------
+ # Add the h5jam test executables
+ # --------------------------------------------------------------------
+ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
ADD_EXECUTABLE (h5jamgentest ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/h5jamgentest.c)
H5_NAMING (h5jamgentest)
IF (WIN32)
@@ -88,13 +97,28 @@ IF (BUILD_TESTING)
TARGET_LINK_LIBRARIES (h5jamgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
#ADD_TEST (NAME h5jamgentest COMMAND $<TARGET_FILE:h5jamgentest>)
+ ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
- SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
- # h5jamgentest
- )
- ENDIF (NOT BUILD_SHARED_LIBS)
ENDIF (BUILD_TESTING)
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
#-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
diff --git a/tools/h5jam/tellub.c b/tools/h5jam/tellub.c
index 2cf30e2..f1b6756 100644
--- a/tools/h5jam/tellub.c
+++ b/tools/h5jam/tellub.c
@@ -104,7 +104,7 @@ parse_command_line (int argc, const char *argv[])
/* check for file name to be processed */
if (argc <= opt_ind)
{
- error_msg(h5tools_getprogname(), "missing file name\n");
+ error_msg("missing file name\n");
usage (h5tools_getprogname());
exit (EXIT_FAILURE);
}
diff --git a/tools/h5ls/CMakeLists.txt b/tools/h5ls/CMakeLists.txt
index b57423b..1d2589a 100644
--- a/tools/h5ls/CMakeLists.txt
+++ b/tools/h5ls/CMakeLists.txt
@@ -4,13 +4,12 @@ PROJECT (HDF5_TOOLS_H5LS)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
-# --------------------------------------------------------------------
-# If testing was NOT enabled, then we need to build the tools library
-# --------------------------------------------------------------------
-#-- Add the h5ls executable
+#-----------------------------------------------------------------------------
+# Add the h5ls executable
+#-----------------------------------------------------------------------------
ADD_EXECUTABLE (h5ls ${HDF5_TOOLS_H5LS_SOURCE_DIR}/h5ls.c)
H5_NAMING (h5ls)
IF (WIN32)
@@ -29,8 +28,16 @@ SET (H5_DEP_EXECUTABLES
h5ls
)
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
IF (BUILD_TESTING)
- #-- Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
+ # Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
SET (HDF5_REFERENCE_FILES
help-1.ls
help-2.ls
@@ -112,7 +119,7 @@ IF (BUILD_TESTING)
TARGET h5ls
POST_BUILD
COMMAND ${XLATE_UTILITY}
- ARGS ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${ls_file} ${lsdest} -l3
+ ARGS ${HDF5_TOOLS_SRC_DIR}/testfiles/${ls_file} ${lsdest} -l3
)
ENDFOREACH (ls_file ${HDF5_REFERENCE_FILES})
@@ -123,9 +130,15 @@ IF (BUILD_TESTING)
TARGET h5ls
POST_BUILD
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_file} ${dest}
)
ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
MACRO (ADD_H5_TEST resultfile resultcode)
ADD_TEST (
@@ -141,6 +154,12 @@ IF (BUILD_TESTING)
)
ENDMACRO (ADD_H5_TEST file)
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
# test the help syntax
ADD_H5_TEST (help-1 0 -w80 -h)
ADD_H5_TEST (help-2 0 -w80 --help)
@@ -247,6 +266,12 @@ IF (BUILD_TESTING)
ENDIF (BUILD_TESTING)
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
#-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index fb08ddb..5bda0b4 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -1992,7 +1992,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
switch(linfo->type) {
case H5L_TYPE_SOFT:
- ret = H5tools_get_link_info(iter->fid, name, &lnk_info);
+ ret = H5tools_get_link_info(iter->fid, name, &lnk_info, follow_symlink_g);
/* lnk_info.trg_path is malloced in H5tools_get_link_info()
* so it will be freed via buf later */
buf = lnk_info.trg_path;
@@ -2048,8 +2048,9 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
{
const char *filename;
const char *path;
+ hbool_t follow_link = follow_symlink_g || follow_elink_g;
- ret = H5tools_get_link_info(iter->fid, name, &lnk_info);
+ ret = H5tools_get_link_info(iter->fid, name, &lnk_info, follow_link);
/* lnk_info.trg_path is malloced in H5tools_get_link_info()
* so it will be freed via buf later */
buf = lnk_info.trg_path;
@@ -2073,7 +2074,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
/* Recurse through the external link */
/* keep the follow_elink_g for backward compatibility with -E */
- if(follow_symlink_g || follow_elink_g)
+ if(follow_link)
{
hbool_t orig_grp_literal = grp_literal_g;
HDfputc(' ', stdout);
diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt
index adec48a..d767de1 100644
--- a/tools/h5repack/CMakeLists.txt
+++ b/tools/h5repack/CMakeLists.txt
@@ -4,11 +4,11 @@ PROJECT (HDF5_TOOLS_H5REPACK)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
-INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR})
# --------------------------------------------------------------------
-# Add h5Repack executables and tests
+# Add h5Repack executables
# --------------------------------------------------------------------
SET (REPACK_COMMON_SRCS
${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_copy.c
@@ -19,7 +19,7 @@ SET (REPACK_COMMON_SRCS
${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_verify.c
${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack.c
)
-INCLUDE_DIRECTORIES (${HDF5_TEST_SOURCE_DIR})
+
ADD_EXECUTABLE (h5repack ${REPACK_COMMON_SRCS} ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_main.c)
H5_NAMING (h5repack)
IF (WIN32)
@@ -36,7 +36,16 @@ TARGET_LINK_LIBRARIES (h5repack ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
SET (H5_DEP_EXECUTABLES h5repack)
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
IF (BUILD_TESTING)
+ # --------------------------------------------------------------------
+ # Add h5Repack test executables
+ # --------------------------------------------------------------------
ADD_EXECUTABLE (testh5repack_detect_szip ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testh5repack_detect_szip.c)
H5_NAMING (testh5repack_detect_szip)
IF (WIN32)
@@ -80,39 +89,16 @@ IF (BUILD_TESTING)
TARGET_LINK_LIBRARIES (h5repacktest ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
ADD_TEST (NAME h5repacktest COMMAND $<TARGET_FILE:h5repacktest>)
-
- SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
- h5repacktest
- testh5repack_detect_szip
- )
-
-
- SET (INFO_FILE testfiles/h5repack.info)
-
- SET (FILE0 h5repack_fill.h5)
- SET (FILE1 h5repack_objs.h5)
- SET (FILE2 h5repack_attr.h5)
- SET (FILE3 h5repack_hlink.h5)
- SET (FILE4 h5repack_layout.h5)
- SET (FILE5 h5repack_early.h5)
- SET (FILE7 h5repack_szip.h5)
- SET (FILE8 h5repack_deflate.h5)
- SET (FILE9 h5repack_shuffle.h5)
- SET (FILE10 h5repack_fletcher.h5)
- SET (FILE11 h5repack_filters.h5)
- SET (FILE12 h5repack_nbit.h5)
- SET (FILE13 h5repack_soffset.h5)
- SET (FILE14 h5repack_layouto.h5 ) # A file with an older version of the layout message (copy of test/tlayouto.h5)
- SET (FILE15 h5repack_named_dtypes.h5)
- SET (FILE16 tfamily%05d.h5) # located in common testfiles folder
- SET (FILE_REF h5repack_refs.h5)
- #-- Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
+ # Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
SET (HDF5_REFERENCE_TEST_FILES
h5repack_ext.bin
ublock.bin
h5repack.info
h5repack_attr.h5
+ h5repack_attr_refs.h5
h5repack_deflate.h5
h5repack_early.h5
h5repack_ext.h5
@@ -142,6 +128,7 @@ IF (BUILD_TESTING)
tfamily00008.h5
tfamily00009.h5
tfamily00010.h5
+ h5repack_filters.h5.ddl
)
FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
@@ -162,14 +149,22 @@ IF (BUILD_TESTING)
TARGET h5repack
POST_BUILD
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5c_file} ${dest}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5c_file} ${dest}
)
ENDFOREACH (h5c_file ${HDF5_COMMON_TEST_FILES})
-
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
MACRO (ADD_H5_TEST testname testtype testfile)
IF (${testtype} STREQUAL "SKIP")
- MESSAGE (STATUS "SKIP ${testfile} ${ARGN}")
+ ADD_TEST (
+ NAME H5REPACK-${testname}
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out.${testfile}"
+ )
ELSE (${testtype} STREQUAL "SKIP")
ADD_TEST (
NAME H5REPACK-${testname}
@@ -182,6 +177,58 @@ IF (BUILD_TESTING)
ENDIF (${testtype} STREQUAL "SKIP")
ENDMACRO (ADD_H5_TEST testname testfile testtype)
+ MACRO (ADD_H5_CMP_TEST testname testfilter testtype resultcode resultfile)
+ IF (${testtype} STREQUAL "SKIP")
+ ADD_TEST (
+ NAME H5REPACK-${testname}
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out.${resultfile}"
+ )
+ ELSE (${testtype} STREQUAL "SKIP")
+ ADD_TEST (
+ NAME H5REPACK-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5repack>"
+ -D "TEST_ARGS:STRING=${ARGN};testfiles/${resultfile};testfiles/out.${resultfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_FILTER:STRING=${testfilter}"
+ -D "TEST_REFERENCE=testfiles/${resultfile}.ddl"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ENDIF (${testtype} STREQUAL "SKIP")
+ ENDMACRO (ADD_H5_CMP_TEST file)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+ # --------------------------------------------------------------------
+ # test file names
+ # --------------------------------------------------------------------
+ SET (INFO_FILE testfiles/h5repack.info)
+
+ SET (FILE0 h5repack_fill.h5)
+ SET (FILE1 h5repack_objs.h5)
+ SET (FILE2 h5repack_attr.h5)
+ SET (FILE3 h5repack_hlink.h5)
+ SET (FILE4 h5repack_layout.h5)
+ SET (FILE5 h5repack_early.h5)
+ SET (FILE7 h5repack_szip.h5)
+ SET (FILE8 h5repack_deflate.h5)
+ SET (FILE9 h5repack_shuffle.h5)
+ SET (FILE10 h5repack_fletcher.h5)
+ SET (FILE11 h5repack_filters.h5)
+ SET (FILE12 h5repack_nbit.h5)
+ SET (FILE13 h5repack_soffset.h5)
+ SET (FILE14 h5repack_layouto.h5 ) # A file with an older version of the layout message (copy of test/tlayouto.h5)
+ SET (FILE15 h5repack_named_dtypes.h5)
+ SET (FILE16 tfamily%05d.h5) # located in common testfiles folder
+ SET (FILE_REF h5repack_refs.h5)
+ SET (FILE_ATTR_REF h5repack_attr_refs.h5)
+
#
# The tests
# We use the files generated by h5repacktst
@@ -306,6 +353,14 @@ IF (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_SHUFFLE
SET (TESTTYPE "SKIP")
ENDIF (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_SHUFFLE OR NOT USE_FILTER_FLETCHER32 OR NOT USE_FILTER_DEFLATE)
ADD_H5_TEST (all_filters ${TESTTYPE} ${arg})
+
+# verbose gzip with individual object
+SET (arg ${FILE11} -v -f /dset_deflate:GZIP=9)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE)
+ADD_H5_CMP_TEST (gzip_verbose_filters "O?...ing file[^\n]+\n" ${TESTTYPE} 0 ${arg})
###########################################################
# the following tests assume the input files have filters
@@ -550,11 +605,22 @@ ADD_H5_TEST (committed_dt "TEST" ${FILE15})
# tests family driver (file is located in common testfiles folder, uses TOOLTEST1
#ADD_H5_TEST ( family "FAMILY" ${FILE16})
-# test various references (bug 1814)
+# test various references (bug 1814 and 1726)
ADD_H5_TEST (bug1814 "TEST" ${FILE_REF})
+
+# test attribute with various references (bug 1797)
+# the references in attribute of compund or vlen datatype
+# TODO: include this test when code portion is completed.
+ADD_H5_TEST (bug1797 "SKIP" ${FILE_ATTR_REF})
ENDIF (BUILD_TESTING)
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
#-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in
index 2b63fc0..d889b55 100755
--- a/tools/h5repack/h5repack.sh.in
+++ b/tools/h5repack/h5repack.sh.in
@@ -183,6 +183,48 @@ TOOLTEST1()
fi
rm -f $outfile
}
+
+# Call h5repack and compare output to a text file for -v option
+#
+TOOLTESTV()
+{
+ # Run test.
+ TESTING $H5REPACK $@
+ expect="$srcdir/../testfiles/$1.ddl"
+ actual="../testfiles/`basename $1 .ddl`.out"
+ actual_err="../testfiles/`basename $1 .ddl`.err"
+
+ infile=$srcdir/testfiles/$1
+ path=`pwd`
+ outfile=$path/out.$1
+ shift
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile >$actual 2>$actual_err
+ cp $actual $actual_sav
+ STDOUT_FILTER $actual
+ cat $actual_err >> $actual
+
+ if cmp -s $expect $actual; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && diff -c $expect $actual |sed 's/^/ /'
+ fi
+
+ rm -f $actual $actual_err $actual_sav
+}
+
+STDOUT_FILTER() {
+ result_file=$1
+ tmp_file=/tmp/h5test_tmp_$$
+ # Filter name of files.
+ cp $result_file $tmp_file
+ sed -e '/^Opening file/d' -e '/^Making file/d' \
+ < $tmp_file > $result_file
+ # cleanup
+ rm -f $tmp_file
+}
#
# The tests
@@ -286,6 +328,14 @@ if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" -o $USE_F
else
TOOLTEST $arg
fi
+
+# verbose gzip with individual object
+arg="$FILE11 -v -f /dset_deflate:GZIP=9"
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST $arg
+fi
###########################################################
# the following tests assume the input files have filters
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index c3475aa..b736c22 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -686,19 +686,15 @@ int do_copy_objects(hid_t fidin,
req_filter = 1;
/* check if filters were requested for individual objects */
- for( u = 0; u < options->op_tbl->nelems; u++)
- {
+ for (u = 0; u < options->op_tbl->nelems; u++) {
int k;
- for( k = 0; k < options->op_tbl->objs[u].nfilters; k++)
- {
- if ( options->op_tbl->objs[u].filter->filtn > 0 )
- {
-
- req_filter = 1;
-
+ if (strcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0) {
+ for (k = 0; k < options->op_tbl->objs[u].nfilters; k++) {
+ if (options->op_tbl->objs[u].filter->filtn > 0) {
+ req_filter = 1;
+ }
}
-
}
}
diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c
index fcdfbd5..aa2e823 100644
--- a/tools/h5repack/h5repack_refs.c
+++ b/tools/h5repack/h5repack_refs.c
@@ -707,34 +707,29 @@ error:
*
*-------------------------------------------------------------------------
*/
-
-static const char* MapIdToName(hid_t refobj_id,
- trav_table_t *travt)
+static const char*
+MapIdToName(hid_t refobj_id, trav_table_t *travt)
{
- unsigned int i;
+ unsigned int u;
const char* ret = NULL;
- H5O_info_t ref_oinfo; /* Stat for the refobj id */
/* linear search */
- for(i = 0; i < travt->nobjs; i++)
- {
- if(travt->objs[i].type == H5O_TYPE_DATASET ||
- travt->objs[i].type == H5O_TYPE_GROUP ||
- travt->objs[i].type == H5O_TYPE_NAMED_DATATYPE)
- {
+ for(u = 0; u < travt->nobjs; u++) {
+ if(travt->objs[u].type == H5O_TYPE_DATASET ||
+ travt->objs[u].type == H5O_TYPE_GROUP ||
+ travt->objs[u].type == H5O_TYPE_NAMED_DATATYPE) {
H5O_info_t ref_oinfo; /* Stat for the refobj id */
/* obtain information to identify the referenced object uniquely */
if(H5Oget_info(refobj_id, &ref_oinfo) < 0)
goto out;
- if(ref_oinfo.addr == travt->objs[i].objno)
- {
- ret = travt->objs[i].name;
+ if(ref_oinfo.addr == travt->objs[u].objno) {
+ ret = travt->objs[u].name;
goto out;
- }
+ } /* end if */
} /* end if */
- } /* i */
+ } /* u */
out:
return ret;
diff --git a/tools/h5stat/CMakeLists.txt b/tools/h5stat/CMakeLists.txt
index b19d288..b900afb 100644
--- a/tools/h5stat/CMakeLists.txt
+++ b/tools/h5stat/CMakeLists.txt
@@ -4,11 +4,11 @@ PROJECT (HDF5_TOOLS_H5STAT)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
# --------------------------------------------------------------------
-# Add the h5stat and test executables
+# Add the h5stat executables
# --------------------------------------------------------------------
ADD_EXECUTABLE (h5stat ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/h5stat.c)
H5_NAMING (h5stat)
@@ -26,8 +26,17 @@ TARGET_LINK_LIBRARIES (h5stat ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
SET (H5_DEP_EXECUTABLES h5stat)
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
IF (BUILD_TESTING)
- IF (NOT BUILD_SHARED_LIBS)
+ # --------------------------------------------------------------------
+ # Add the h5stat test executables
+ # --------------------------------------------------------------------
+ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
ADD_EXECUTABLE (h5stat_gentest ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/h5stat_gentest.c)
H5_NAMING (h5stat_gentest)
IF (WIN32)
@@ -41,13 +50,11 @@ IF (BUILD_TESTING)
TARGET_LINK_LIBRARIES (h5stat_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
#ADD_TEST (NAME h5stat_gentest COMMAND $<TARGET_FILE:h5stat_gentest>)
-
- SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
- # h5stat_gentest
- )
- ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
- #-- Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
+ # Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
SET (HDF5_REFERENCE_FILES
h5stat_help1.ddl
h5stat_help2.ddl
@@ -91,6 +98,12 @@ IF (BUILD_TESTING)
ARGS -E copy_if_different ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/testfiles/${h5_file} ${dest}
)
ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
MACRO (ADD_H5_TEST resultfile resultcode)
ADD_TEST (
@@ -106,6 +119,12 @@ IF (BUILD_TESTING)
)
ENDMACRO (ADD_H5_TEST file)
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
# Test for help flag
ADD_H5_TEST (h5stat_help1 0 -h)
ADD_H5_TEST (h5stat_help2 0 --help)
@@ -129,6 +148,12 @@ IF (BUILD_TESTING)
ADD_H5_TEST (h5stat_newgrat-UA 0 -A h5stat_newgrat.h5)
ENDIF (BUILD_TESTING)
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
#-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt
index e12a7a6..05fd607 100644
--- a/tools/lib/CMakeLists.txt
+++ b/tools/lib/CMakeLists.txt
@@ -4,31 +4,31 @@ PROJECT (HDF5_TOOLS_LIB)
#-----------------------------------------------------------------------------
# Define Sources
#-----------------------------------------------------------------------------
-#INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+#INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
#INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
SET (H5_TOOLS_LIB_SRCS
- ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff.c
- ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff_array.c
- ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff_attr.c
- ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff_dset.c
- ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff_util.c
- ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools.c
- ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_filters.c
- ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_ref.c
- ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_str.c
- ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_type.c
- ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_utils.c
- ${HDF5_TOOLS_SOURCE_DIR}/lib/h5trav.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff_array.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff_attr.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff_dset.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff_util.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_filters.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_ref.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_str.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_type.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_utils.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5trav.c
)
SET (H5_TOOLS_LIB_HDRS
- ${HDF5_TOOLS_SOURCE_DIR}/lib/h5trav.h
- ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools.h
- ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_utils.h
- ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_str.h
- ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_ref.h
- ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff.h
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5trav.h
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools.h
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_utils.h
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_str.h
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_ref.h
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff.h
)
#-- Always build a static library for linking the ${HDF5_LIB_NAME} tools together
@@ -42,6 +42,12 @@ H5_SET_LIB_OPTIONS (
HDF5_TOOLS_LIB_NAME_DEBUG
)
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
#-----------------------------------------------------------------------------
# Add file(s) to CMake Install
#-----------------------------------------------------------------------------
@@ -55,6 +61,21 @@ INSTALL (
)
#-----------------------------------------------------------------------------
+# Because tools are installed into bin/tools we need to make sure the hdf5tools
+# library will be installed into the proper location.
+#-----------------------------------------------------------------------------
+IF (APPLE)
+ OPTION (HDF5_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path" OFF)
+ IF (HDF5_BUILD_WITH_INSTALL_NAME)
+ SET_TARGET_PROPERTIES(${HDF5_TOOLS_LIB_TARGET} PROPERTIES
+ LINK_FLAGS "-current_version ${HDF5_PACKAGE_VERSION} -compatibility_version ${HDF5_PACKAGE_VERSION}"
+ INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib/tools"
+ BUILD_WITH_INSTALL_RPATH ${HDF5_BUILD_WITH_INSTALL_NAME}
+ )
+ ENDIF (HDF5_BUILD_WITH_INSTALL_NAME)
+ENDIF (APPLE)
+
+#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install for import into other projects
#-----------------------------------------------------------------------------
IF (HDF5_EXPORTED_TARGETS)
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index c3d74b5..5d2343a 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -951,7 +951,7 @@ hsize_t diff_compare(hid_t file1_id,
if (obj1type == H5TRAV_TYPE_LINK)
{
/* get type of target object */
- l_ret = H5tools_get_link_info(file1_id, obj1_name, &linkinfo1);
+ l_ret = H5tools_get_link_info(file1_id, obj1_name, &linkinfo1, TRUE);
/* dangling link */
if (l_ret == 0)
{
@@ -984,7 +984,7 @@ hsize_t diff_compare(hid_t file1_id,
if (obj2type == H5TRAV_TYPE_LINK)
{
/* get type target object */
- l_ret = H5tools_get_link_info(file2_id, obj2_name, &linkinfo2);
+ l_ret = H5tools_get_link_info(file2_id, obj2_name, &linkinfo2, TRUE);
/* dangling link */
if (l_ret == 0)
{
@@ -1021,7 +1021,7 @@ hsize_t diff_compare(hid_t file1_id,
if (obj1type == H5TRAV_TYPE_UDLINK)
{
/* get type and name of target object */
- l_ret = H5tools_get_link_info(file1_id, obj1_name, &linkinfo1);
+ l_ret = H5tools_get_link_info(file1_id, obj1_name, &linkinfo1, TRUE);
/* dangling link */
if (l_ret == 0)
{
@@ -1055,7 +1055,7 @@ hsize_t diff_compare(hid_t file1_id,
if (obj2type == H5TRAV_TYPE_UDLINK)
{
/* get type and name of target object */
- l_ret = H5tools_get_link_info(file2_id, obj2_name, &linkinfo2);
+ l_ret = H5tools_get_link_info(file2_id, obj2_name, &linkinfo2, TRUE);
/* dangling link */
if (l_ret == 0)
{
@@ -1310,7 +1310,7 @@ hsize_t diff(hid_t file1_id,
case H5TRAV_TYPE_LINK:
{
/* get type and name of target object */
- ret = H5tools_get_link_info(file1_id, path1, &linkinfo1);
+ ret = H5tools_get_link_info(file1_id, path1, &linkinfo1, TRUE);
/* dangling link */
if (ret == 0)
{
@@ -1328,7 +1328,7 @@ hsize_t diff(hid_t file1_id,
goto out;
/* get type and name of target object */
- ret = H5tools_get_link_info(file2_id, path2, &linkinfo2);
+ ret = H5tools_get_link_info(file2_id, path2, &linkinfo2, TRUE);
/* dangling link */
if (ret == 0)
{
@@ -1394,7 +1394,7 @@ hsize_t diff(hid_t file1_id,
case H5TRAV_TYPE_UDLINK:
{
/* get type and name of target object */
- ret = H5tools_get_link_info(file1_id, path1, &linkinfo1);
+ ret = H5tools_get_link_info(file1_id, path1, &linkinfo1, TRUE);
/* dangling link */
if (ret == 0)
{
@@ -1412,7 +1412,7 @@ hsize_t diff(hid_t file1_id,
goto out;
/* get type and name of target object */
- ret = H5tools_get_link_info(file2_id, path2, &linkinfo2);
+ ret = H5tools_get_link_info(file2_id, path2, &linkinfo2, TRUE);
/* dangling link */
if (ret == 0)
{
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index ede6ea0..71993b8 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -154,7 +154,6 @@ hsize_t diff_attr(hid_t loc1_id,
*/
void print_found(hsize_t nfound);
-void parallel_print(const char* format, ... );
void print_type(hid_t type);
const char* diff_basename(const char *name);
const char* get_type(h5trav_type_t type);
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 48e08a5..dc3c9fb 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -5825,8 +5825,6 @@ void print_header(int pp, /* print percentage */
const char *obj1,
const char *obj2 )
{
- int i;
-
/* print header */
parallel_print("%-16s","size:");
print_dimensions (rank,dims);
@@ -5834,8 +5832,7 @@ void print_header(int pp, /* print percentage */
print_dimensions (rank,dims);
parallel_print("\n");
- if (pp)
- {
+ if(pp) {
parallel_print("%-15s %-15s %-15s %-15s %-15s\n",
"position",
(obj1!=NULL) ? obj1 : " ",
@@ -5844,8 +5841,7 @@ void print_header(int pp, /* print percentage */
"relative");
parallel_print("------------------------------------------------------------------------\n");
}
- else
- {
+ else {
parallel_print("%-15s %-15s %-15s %-20s\n",
"position",
(obj1!=NULL) ? obj1 : " ",
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index 721c3d7..5df94fa 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -21,76 +21,6 @@
/* global variables */
int g_nTasks = 1;
-unsigned char g_Parallel = 0; /*0 for serial, 1 for parallel */
-char outBuff[OUTBUFF_SIZE];
-int outBuffOffset;
-FILE* overflow_file = NULL;
-
-/*-------------------------------------------------------------------------
- * Function: parallel_print
- *
- * Purpose: wrapper for printf for use in parallel mode.
- *
- * Programmer: Leon Arber
- *
- * Date: December 1, 2004
- *
- *-------------------------------------------------------------------------
- */
-void parallel_print(const char* format, ...)
-{
- int bytes_written;
- va_list ap;
-
- va_start(ap, format);
-
- if(!g_Parallel)
- vprintf(format, ap);
- else
- {
-
- if(overflow_file == NULL) /*no overflow has occurred yet */
- {
-#if 0
- printf("calling HDvsnprintf: OUTBUFF_SIZE=%ld, outBuffOffset=%ld, ", (long)OUTBUFF_SIZE, (long)outBuffOffset);
-#endif
- bytes_written = HDvsnprintf(outBuff+outBuffOffset, OUTBUFF_SIZE-outBuffOffset, format, ap);
-#if 0
- printf("bytes_written=%ld\n", (long)bytes_written);
-#endif
- va_end(ap);
- va_start(ap, format);
-
-#if 0
- printf("Result: bytes_written=%ld, OUTBUFF_SIZE-outBuffOffset=%ld\n", (long)bytes_written, (long)OUTBUFF_SIZE-outBuffOffset);
-#endif
-
- if ((bytes_written < 0) ||
-#ifdef H5_VSNPRINTF_WORKS
- (bytes_written >= (OUTBUFF_SIZE-outBuffOffset))
-#else
- ((bytes_written+1) == (OUTBUFF_SIZE-outBuffOffset))
-#endif
- )
- {
- /* Terminate the outbuff at the end of the previous output */
- outBuff[outBuffOffset] = '\0';
-
- overflow_file = HDtmpfile();
- if(overflow_file == NULL)
- fprintf(stderr, "warning: could not create overflow file. Output may be truncated.\n");
- else
- bytes_written = HDvfprintf(overflow_file, format, ap);
- }
- else
- outBuffOffset += bytes_written;
- }
- else
- bytes_written = HDvfprintf(overflow_file, format, ap);
-
- }
- va_end(ap);
-}
/*-------------------------------------------------------------------------
* Function: print_dimensions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index e997d03..3cfe56b 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -197,8 +197,14 @@ BLOCK, /*blockbegin */
static const h5tools_dump_header_t * h5tools_dump_header_format;
/* local prototypes */
-static int do_bin_output(FILE *stream, hsize_t nelmts, hid_t tid, void *_mem);
-static int render_bin_output(FILE *stream, hid_t tid, void *_mem);
+static int do_bin_output(FILE *stream, hid_t container, hsize_t nelmts, hid_t tid, void *_mem);
+static int render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem);
+static int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
+ hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata);
+static hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
+ FILE *stream, hid_t container);
+static hbool_t render_bin_output_region_points(hid_t region_space, hid_t region_id,
+ FILE *stream, hid_t container);
static hbool_t h5tools_is_zero(const void *_mem, size_t size);
hbool_t h5tools_render_element(FILE *stream, const h5tool_format_t *info,
@@ -216,7 +222,7 @@ hbool_t h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
hsize_t local_elmt_counter/*element counter*/,
hsize_t elmt_counter);
-int h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id,
+static int h5tools_print_region_data_blocks(hid_t region_id,
FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx,
h5tools_str_t *buffer/*string into which to render */, size_t ncols,
int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata);
@@ -660,8 +666,7 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info,
}
/* Calculate new prefix */
- h5tools_str_prefix(&prefix, info, elmtno, ctx->ndims, ctx->p_min_idx,
- ctx->p_max_idx, ctx);
+ h5tools_str_prefix(&prefix, info, elmtno, ctx->ndims, ctx);
/* Write new prefix to output */
if (ctx->indent_level >= 0) {
@@ -750,7 +755,7 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info,
}
/* Calculate new prefix */
- h5tools_str_region_prefix(&prefix, info, elmtno, ptdata, ctx->ndims, ctx->p_min_idx,
+ h5tools_str_region_prefix(&prefix, info, elmtno, ptdata, ctx->ndims,
ctx->p_max_idx, ctx);
/* Write new prefix to output */
@@ -866,7 +871,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai
/* binary dump */
if (bin_output) {
- do_bin_output(stream, nelmts, type, _mem);
+ do_bin_output(rawdatastream, container, nelmts, type, _mem);
} /* end if */
else {
/* setup */
@@ -947,7 +952,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai
if (i + 1 < nelmts || (flags & END_OF_DATA) == 0)
h5tools_str_append(&buffer, "%s", OPT(info->elmt_suf1, ","));
- dimension_break = h5tools_render_element(stream, info, ctx, &buffer,
+ dimension_break = h5tools_render_element(rawdatastream, info, ctx, &buffer,
&curr_pos, ncols, i, elmt_counter);
/* Render the data element end*/
@@ -1290,8 +1295,8 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
* hssize_t nblocks is the number of blocks in the region
*-------------------------------------------------------------------------
*/
-int
-h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id,
+static int
+h5tools_print_region_data_blocks(hid_t region_id,
FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx,
h5tools_str_t *buffer/*string into which to render */, size_t ncols,
int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata) {
@@ -1575,8 +1580,8 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
ctx->need_prefix = TRUE;
- h5tools_print_region_data_blocks(region_space, region_id,
- stream, info, *ctx, buffer, ncols, ndims, type_id, nblocks, ptdata);
+ h5tools_print_region_data_blocks(region_id, rawdatastream, info, *ctx,
+ buffer, ncols, ndims, type_id, nblocks, ptdata);
done:
free(ptdata);
@@ -1636,12 +1641,11 @@ int
h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx,
h5tools_str_t *buffer, size_t ncols,
- int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata) {
+ int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata)
+{
HERR_INIT(int, SUCCEED)
hbool_t dimension_break = TRUE;
- hsize_t alloc_size;
hsize_t *dims1 = NULL;
- h5tools_context_t region_ctx; /* print context */
hsize_t elmtno; /* elemnt index */
unsigned int region_flags; /* buffer extent flags */
hsize_t curr_pos;
@@ -1878,7 +1882,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
ctx->need_prefix = TRUE;
h5tools_print_region_data_points(region_space, region_id,
- stream, info, *ctx, buffer, ncols, ndims, type_id, npoints, ptdata);
+ rawdatastream, info, *ctx, buffer, ncols, ndims, type_id, npoints, ptdata);
done:
free(ptdata);
@@ -1981,7 +1985,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
if (ctx->ndims > 0)
init_acc_pos(ctx, total_size);
- size_row_block = sset->block[row_dim];
+ size_row_block = sset->block.data[row_dim];
/* display loop */
for (; hyperslab_count > 0; temp_start[row_dim] += temp_stride[row_dim], hyperslab_count--) {
@@ -1989,9 +1993,9 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
cases where block > 1 only and stride > block */
if (size_row_block > 1
&& row_counter == size_row_block
- && sset->stride[row_dim] > sset->block[row_dim]) {
+ && sset->stride.data[row_dim] > sset->block.data[row_dim]) {
- hsize_t increase_rows = sset->stride[row_dim] - sset->block[row_dim];
+ hsize_t increase_rows = sset->stride.data[row_dim] - sset->block.data[row_dim];
temp_start[row_dim] += increase_rows;
row_counter = 0;
}
@@ -2149,22 +2153,22 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools
if (ctx->ndims > 2)
for (i = 0; i < (size_t) ctx->ndims - 2; i++) {
/* consider block size */
- outer_count = outer_count * sset->count[i] * sset->block[i];
+ outer_count = outer_count * sset->count.data[i] * sset->block.data[i];
}
/* initialize temporary start, count and maximum start */
for (i = 0; i < (size_t) ctx->ndims; i++) {
- temp_start[i] = sset->start[i];
- temp_count[i] = sset->count[i];
- temp_block[i] = sset->block[i];
- temp_stride[i] = sset->stride[i];
+ temp_start[i] = sset->start.data[i];
+ temp_count[i] = sset->count.data[i];
+ temp_block[i] = sset->block.data[i];
+ temp_stride[i] = sset->stride.data[i];
max_start[i] = 0;
}
if (ctx->ndims > 2) {
for (i = 0; i < (size_t) ctx->ndims - 2; i++) {
- max_start[i] = temp_start[i] + sset->count[i];
+ max_start[i] = temp_start[i] + sset->count.data[i];
temp_count[i] = 1;
}
@@ -2177,14 +2181,14 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools
/* count is the number of iterations to display all the rows,
the block size count times */
- count = sset->count[row_dim] * sset->block[row_dim];
+ count = sset->count.data[row_dim] * sset->block.data[row_dim];
/* always 1 row_counter at a time, that is a block of size 1, 1 time */
temp_count[row_dim] = 1;
temp_block[row_dim] = 1;
/* advance 1 row_counter at a time */
- if (sset->block[row_dim] > 1)
+ if (sset->block.data[row_dim] > 1)
temp_stride[row_dim] = 1;
}
@@ -2203,7 +2207,7 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools
/* set start to original from current_outer_dim up */
for (i = current_outer_dim + 1; i < ctx->ndims; i++) {
- temp_start[i] = sset->start[i];
+ temp_start[i] = sset->start.data[i];
}
/* increment start dimension */
@@ -2211,10 +2215,10 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools
reset_dim = 0;
temp_start[current_outer_dim]++;
if (temp_start[current_outer_dim] >= max_start[current_outer_dim]) {
- temp_start[current_outer_dim] = sset->start[current_outer_dim];
+ temp_start[current_outer_dim] = sset->start.data[current_outer_dim];
/* consider block */
- if (sset->block[current_outer_dim] > 1)
+ if (sset->block.data[current_outer_dim] > 1)
temp_start[current_outer_dim]++;
current_outer_dim--;
@@ -2622,7 +2626,6 @@ h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset,
H5S_class_t space_type;
int status = FAIL;
h5tool_format_t info_dflt;
-
/* Use default values */
if (!stream)
stream = stdout;
@@ -2657,12 +2660,10 @@ h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset,
/* Print the data */
if (space_type == H5S_SIMPLE || space_type == H5S_SCALAR) {
- if (!sset) {
- status = h5tools_dump_simple_dset(rawdatastream, info, dset, p_type, indentlevel);
- }
- else {
- status = h5tools_dump_simple_subset(rawdatastream, info, dset, p_type, sset, indentlevel);
- }
+ if(!sset)
+ status = h5tools_dump_simple_dset(stream, info, dset, p_type, indentlevel);
+ else
+ status = h5tools_dump_simple_subset(stream, info, dset, p_type, sset, indentlevel);
}
else
/* space is H5S_NULL */
@@ -2711,6 +2712,7 @@ h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, hid_t obj_id, hid_t
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sis_simple failed")
H5_LEAVE(h5tools_dump_simple_mem(stream, info, obj_id, type, space, mem, indentlevel))
+
CATCH
return ret_value;
}
@@ -2731,7 +2733,7 @@ int
h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info,
h5tools_context_t *ctx, hid_t type)
{
- HERR_INIT(int, FAIL)
+ HERR_INIT(int, SUCCEED)
char *mname;
hid_t mtype, str_type;
unsigned nmembers;
@@ -3032,7 +3034,7 @@ h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info,
/* Type doesn't match any of above. */
h5tools_str_append(buffer, "unknown_one_character_type;\n ");
- done:
+ done:
if(H5Tclose(str_type) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
if(H5Tclose(tmp_type) < 0)
@@ -3495,7 +3497,7 @@ init_acc_pos(h5tools_context_t *ctx, hsize_t *dims)
*-------------------------------------------------------------------------
*/
static
-int do_bin_output(FILE *stream, hsize_t nelmts, hid_t tid, void *_mem)
+int do_bin_output(FILE *stream, hid_t container, hsize_t nelmts, hid_t tid, void *_mem)
{
HERR_INIT(int, SUCCEED)
unsigned char *mem = (unsigned char*)_mem;
@@ -3506,7 +3508,7 @@ int do_bin_output(FILE *stream, hsize_t nelmts, hid_t tid, void *_mem)
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
for (i = 0; i < nelmts; i++) {
- if (render_bin_output(stream, tid, mem + i * size) < 0) {
+ if (render_bin_output(stream, container, tid, mem + i * size) < 0) {
printf("\nError in writing binary stream\n");
return FAIL;
}
@@ -3526,7 +3528,7 @@ CATCH
*-------------------------------------------------------------------------
*/
static int
-render_bin_output(FILE *stream, hid_t tid, void *_mem)
+render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem)
{
HERR_INIT(int, SUCCEED)
unsigned char *mem = (unsigned char*)_mem;
@@ -3773,7 +3775,7 @@ render_bin_output(FILE *stream, hid_t tid, void *_mem)
offset = H5Tget_member_offset(tid, j);
memb = H5Tget_member_type(tid, j);
- if (render_bin_output(stream, memb, mem + offset) < 0)
+ if (render_bin_output(stream, container, memb, mem + offset) < 0)
return FAIL;
H5Tclose(memb);
@@ -3821,7 +3823,7 @@ render_bin_output(FILE *stream, hid_t tid, void *_mem)
/* dump the array element */
for (i = 0; i < nelmts; i++) {
- if (render_bin_output(stream, memb, mem + i * size) < 0)
+ if (render_bin_output(stream, container, memb, mem + i * size) < 0)
H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed");
}
@@ -3841,11 +3843,34 @@ render_bin_output(FILE *stream, hid_t tid, void *_mem)
for (i = 0; i < nelmts; i++) {
/* dump the array element */
- if (render_bin_output(stream, memb, ((char *) (((hvl_t *) mem)->p)) + i * size) < 0)
+ if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)) + i * size) < 0)
H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed");
}
H5Tclose(memb);
}
+ else if (H5Tequal(tid, H5T_STD_REF_DSETREG)) {
+ if (region_output) {
+ /* region data */
+ hid_t region_id, region_space;
+ H5S_sel_type region_type;
+
+ region_id = H5Rdereference(container, H5R_DATASET_REGION, mem);
+ if (region_id >= 0) {
+ region_space = H5Rget_region(container, H5R_DATASET_REGION, mem);
+ if (region_space >= 0) {
+ region_type = H5Sget_select_type(region_space);
+ if(region_type == H5S_SEL_POINTS)
+ render_bin_output_region_points(region_space, region_id, stream, container);
+ else
+ render_bin_output_region_blocks(region_space, region_id, stream, container);
+ H5Sclose(region_space);
+ } /* end if (region_space >= 0) */
+ H5Dclose(region_id);
+ } /* end if (region_id >= 0) */
+ } /* end if (region_output... */
+ }
+ else if (H5Tequal(tid, H5T_STD_REF_OBJ)) {
+ }
else {
size_t i;
if (1 == size) {
@@ -3873,6 +3898,299 @@ CATCH
}
/*-------------------------------------------------------------------------
+ * Audience: Public
+ * Chapter: H5Tools Library
+ * Purpose: Print the data values from a dataset referenced by region blocks.
+ *
+ * Description:
+ * This is a special case subfunction to print the data in a region reference of type blocks.
+ *
+ * Return:
+ * The function returns FAIL if there was an error, otherwise SUCEED
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
+ hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata)
+{
+ HERR_INIT(int, SUCCEED)
+ hsize_t *dims1 = NULL;
+ hsize_t *start = NULL;
+ hsize_t *count = NULL;
+ size_t numelem;
+ hsize_t total_size[H5S_MAX_RANK];
+ int jndx;
+ int type_size;
+ hid_t mem_space = -1;
+ void *region_buf = NULL;
+ int blkndx;
+ hid_t sid1 = -1;
+
+ /* Get the dataspace of the dataset */
+ if((sid1 = H5Dget_space(region_id)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+
+ /* Allocate space for the dimension array */
+ if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims");
+
+ /* find the dimensions of each data space from the block coordinates */
+ numelem = 1;
+ for (jndx = 0; jndx < ndims; jndx++) {
+ dims1[jndx] = ptdata[jndx + ndims] - ptdata[jndx] + 1;
+ numelem = dims1[jndx] * numelem;
+ }
+
+ /* Create dataspace for reading buffer */
+ if((mem_space = H5Screate_simple(ndims, dims1, NULL)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed");
+
+ if((type_size = H5Tget_size(type_id)) == 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
+
+ if((region_buf = HDmalloc(type_size * numelem)) == NULL)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate region buffer");
+
+ /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */
+ /* 1 2 n 1 2 n */
+ if((start = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for start");
+
+ if((count = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for count");
+
+ for (blkndx = 0; blkndx < nblocks; blkndx++) {
+ for (jndx = 0; jndx < ndims; jndx++) {
+ start[jndx] = ptdata[jndx + blkndx * ndims * 2];
+ count[jndx] = dims1[jndx];
+ }
+
+ if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
+
+ if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dread failed");
+
+ if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+
+ for (jndx = 0; jndx < numelem; jndx++) {
+
+ render_bin_output(stream, container, type_id,
+ ((char*)region_buf + jndx * type_size));
+ /* Render the region data element end */
+ } /* end for (jndx = 0; jndx < numelem; jndx++) */
+ } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */
+
+ done:
+ HDfree(start);
+ HDfree(count);
+ HDfree(region_buf);
+ HDfree(dims1);
+
+ if(H5Sclose(mem_space) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+ if(H5Sclose(sid1) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+
+CATCH
+ return ret_value;
+}
+
+/*-------------------------------------------------------------------------
+ * Audience: Public
+ * Chapter: H5Tools Library
+ * Purpose: Print some values from a dataset referenced by region blocks.
+ *
+ * Description:
+ * This is a special case subfunction to dump a region reference using blocks.
+ *
+ * Return:
+ * The function returns False if ERROR, otherwise True
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
+ FILE *stream, hid_t container)
+{
+ HERR_INIT(hbool_t, TRUE)
+ hssize_t nblocks;
+ hsize_t alloc_size;
+ hsize_t *ptdata = NULL;
+ int ndims;
+ hid_t dtype;
+ hid_t type_id;
+
+ if((nblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0)
+ H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed");
+
+ /* Print block information */
+ if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0)
+ H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+
+ alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
+ assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
+ if((ptdata = (hsize_t*) malloc((size_t) alloc_size)) == NULL)
+ HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "Could not allocate buffer for ptdata");
+
+ H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t);
+ if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, (hsize_t) nblocks, ptdata) < 0)
+ HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Rget_select_hyper_blocklist failed");
+
+ if((dtype = H5Dget_type(region_id)) < 0)
+ HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Dget_type failed");
+ if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Tget_native_type failed");
+
+ render_bin_output_region_data_blocks(region_id, stream, container, ndims,
+ type_id, nblocks, ptdata);
+
+ done:
+ free(ptdata);
+
+ if(H5Tclose(type_id) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+
+ if(H5Tclose(dtype) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+
+ H5_LEAVE(TRUE)
+
+ CATCH
+ return ret_value;
+}
+
+/*-------------------------------------------------------------------------
+ * Audience: Public
+ * Chapter: H5Tools Library
+ * Purpose: Print the data values from a dataset referenced by region points.
+ *
+ * Description:
+ * This is a special case subfunction to print the data in a region reference of type points.
+ *
+ * Return:
+ * The function returns FAIL on error, otherwise SUCCEED
+ *
+ * Parameters Description:
+ * h5tools_str_t *buffer is the string into which to render
+ * size_t ncols
+ * int ndims is the number of dimensions of the region element
+ * hssize_t npoints is the number of points in the region
+ *-------------------------------------------------------------------------
+ */
+int
+render_bin_output_region_data_points(hid_t region_space, hid_t region_id,
+ FILE *stream, hid_t container,
+ int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata)
+{
+ HERR_INIT(int, SUCCEED)
+ hsize_t *dims1 = NULL;
+ int jndx;
+ int type_size;
+ hid_t mem_space = -1;
+ void *region_buf = NULL;
+
+ if((type_size = H5Tget_size(type_id)) == 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
+
+ if((region_buf = HDmalloc(type_size * npoints)) == NULL)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for region");
+
+ /* Allocate space for the dimension array */
+ if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims");
+
+ dims1[0] = npoints;
+ if((mem_space = H5Screate_simple(1, dims1, NULL)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed");
+
+ if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
+ for (jndx = 0; jndx < npoints; jndx++) {
+ if(H5Sget_simple_extent_dims(region_space, dims1, NULL) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+
+ render_bin_output(stream, container, type_id,
+ ((char*)region_buf + jndx * type_size));
+ } /* end for (jndx = 0; jndx < npoints; jndx++) */
+
+ done:
+ HDfree(region_buf);
+ HDfree(dims1);
+
+ if(H5Sclose(mem_space) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+CATCH
+ return ret_value;
+}
+
+/*-------------------------------------------------------------------------
+ * Audience: Public
+ * Chapter: H5Tools Library
+ * Purpose: Print some values from a dataset referenced by region points.
+ *
+ * Description:
+ * This is a special case subfunction to dump a region reference using points.
+ *
+ * Return:
+ * The function returns False if the last dimension has been reached, otherwise True
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+render_bin_output_region_points(hid_t region_space, hid_t region_id,
+ FILE *stream, hid_t container)
+{
+ HERR_INIT(hbool_t, TRUE)
+ hssize_t npoints;
+ hsize_t alloc_size;
+ hsize_t *ptdata;
+ int ndims;
+ hid_t dtype;
+ hid_t type_id;
+
+ if((npoints = H5Sget_select_elem_npoints(region_space)) <= 0)
+ H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed");
+
+ /* Allocate space for the dimension array */
+ if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0)
+ H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+
+ alloc_size = npoints * ndims * sizeof(ptdata[0]);
+ assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
+ if((ptdata = malloc((size_t) alloc_size)) == NULL)
+ HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "Could not allocate buffer for ptdata");
+
+ H5_CHECK_OVERFLOW(npoints, hssize_t, hsize_t);
+ if(H5Sget_select_elem_pointlist(region_space, (hsize_t) 0, (hsize_t) npoints, ptdata) < 0)
+ HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_pointlist failed");
+
+ if((dtype = H5Dget_type(region_id)) < 0)
+ HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Dget_type failed");
+
+ if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Tget_native_type failed");
+
+ render_bin_output_region_data_points(region_space, region_id,
+ stream, container, ndims, type_id, npoints, ptdata);
+
+ done:
+ free(ptdata);
+
+ if(H5Tclose(type_id) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+
+ if(H5Tclose(dtype) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+
+ H5_LEAVE(ret_value)
+CATCH
+ return ret_value;
+}
+
+/*-------------------------------------------------------------------------
* Function: h5tools_is_zero
*
* Purpose: Determines if memory is initialized to all zero bytes.
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index ab72025..b3e3dd2 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -507,12 +507,17 @@ typedef struct h5tools_context_t {
hsize_t sm_pos; /* current stripmine element position */
} h5tools_context_t;
+typedef struct subset_d {
+ hsize_t *data;
+ unsigned int len;
+} subset_d;
+
/* a structure to hold the subsetting particulars for a dataset */
struct subset_t {
- hsize_t *start;
- hsize_t *stride;
- hsize_t *count;
- hsize_t *block;
+ subset_d start;
+ subset_d stride;
+ subset_d count;
+ subset_d block;
};
/* The following include, h5tools_str.h, must be after the
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 55596cd..c5f10b8 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -305,8 +305,7 @@ h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt)
*/
char *
h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info,
- hsize_t elmtno, unsigned ndims, hsize_t min_idx[],
- hsize_t max_idx[], h5tools_context_t *ctx)
+ hsize_t elmtno, unsigned ndims, h5tools_context_t *ctx)
{
size_t i = 0;
hsize_t curr_pos = elmtno;
@@ -358,7 +357,7 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info,
*/
char *
h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info,
- hsize_t elmtno, hsize_t *ptdata, unsigned ndims, hsize_t min_idx[], hsize_t max_idx[],
+ hsize_t elmtno, hsize_t *ptdata, unsigned ndims, hsize_t max_idx[],
h5tools_context_t *ctx)
{
hsize_t p_prod[H5S_MAX_RANK];
@@ -414,7 +413,7 @@ h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info,
*/
void
h5tools_str_dump_region_blocks(h5tools_str_t *str, hid_t region,
- const h5tool_format_t *info, h5tools_context_t *ctx)
+ const h5tool_format_t *info)
{
hssize_t nblocks;
hsize_t alloc_size;
@@ -434,7 +433,7 @@ h5tools_str_dump_region_blocks(h5tools_str_t *str, hid_t region,
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
- ptdata = malloc((size_t) alloc_size);
+ ptdata = (hsize_t *)malloc((size_t) alloc_size);
H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t);
H5Sget_select_hyper_blocklist(region, (hsize_t)0, (hsize_t)nblocks, ptdata);
@@ -475,7 +474,7 @@ h5tools_str_dump_region_blocks(h5tools_str_t *str, hid_t region,
*/
void
h5tools_str_dump_region_points(h5tools_str_t *str, hid_t region,
- const h5tool_format_t *info, h5tools_context_t *ctx)
+ const h5tool_format_t *info)
{
hssize_t npoints;
hsize_t alloc_size;
@@ -495,7 +494,7 @@ h5tools_str_dump_region_points(h5tools_str_t *str, hid_t region,
alloc_size = npoints * ndims * sizeof(ptdata[0]);
assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
- ptdata = malloc((size_t) alloc_size);
+ ptdata = (hsize_t *)malloc((size_t) alloc_size);
H5_CHECK_OVERFLOW(npoints, hssize_t, hsize_t);
H5Sget_select_elem_pointlist(region, (hsize_t)0, (hsize_t)npoints, ptdata);
@@ -639,7 +638,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
char *name;
unsigned char *ucp_vp = (unsigned char *)vp;
char *cp_vp = (char *)vp;
- hid_t memb, obj, region;
+ hid_t memb, obj;
unsigned nmembs;
static char fmt_llong[8], fmt_ullong[8];
H5T_str_t pad;
@@ -934,7 +933,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
h5tools_str_append(str, "NULL");
}
else {
- h5tools_str_sprint_region(str, info, container, vp, ctx);
+ h5tools_str_sprint_region(str, info, container, vp);
}
}
else if (H5Tequal(type, H5T_STD_REF_OBJ)) {
@@ -1112,7 +1111,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
*/
void
h5tools_str_sprint_region(h5tools_str_t *str, const h5tool_format_t *info,
- hid_t container, void *vp, h5tools_context_t *ctx)
+ hid_t container, void *vp)
{
hid_t obj, region;
char ref_name[1024];
@@ -1130,9 +1129,9 @@ h5tools_str_sprint_region(h5tools_str_t *str, const h5tool_format_t *info,
region_type = H5Sget_select_type(region);
if(region_type==H5S_SEL_POINTS)
- h5tools_str_dump_region_points(str, region, info, ctx);
+ h5tools_str_dump_region_points(str, region, info);
else
- h5tools_str_dump_region_blocks(str, region, info, ctx);
+ h5tools_str_dump_region_blocks(str, region, info);
h5tools_str_append(str, "}");
diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h
index 98dd065..599c7d1 100644
--- a/tools/lib/h5tools_str.h
+++ b/tools/lib/h5tools_str.h
@@ -33,20 +33,17 @@ extern char *h5tools_str_reset(h5tools_str_t *str);
extern char *h5tools_str_trunc(h5tools_str_t *str, size_t size);
extern char *h5tools_str_fmt(h5tools_str_t *str, size_t start, const char *fmt);
extern char *h5tools_str_prefix(h5tools_str_t *str, const h5tool_format_t *info,
- hsize_t elmtno, unsigned ndims, hsize_t min_idx[],
- hsize_t max_idx[], h5tools_context_t *ctx);
+ hsize_t elmtno, unsigned ndims, h5tools_context_t *ctx);
/*
* new functions needed to display region reference data
*/
extern char *h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info,
- hsize_t elmtno, hsize_t *ptdata, unsigned ndims, hsize_t min_idx[],
+ hsize_t elmtno, hsize_t *ptdata, unsigned ndims,
hsize_t max_idx[], h5tools_context_t *ctx);
-extern void h5tools_str_dump_region_blocks(h5tools_str_t *, hid_t, const h5tool_format_t *,
- h5tools_context_t *ctx);
-extern void h5tools_str_dump_region_points(h5tools_str_t *, hid_t, const h5tool_format_t *,
- h5tools_context_t *ctx);
+extern void h5tools_str_dump_region_blocks(h5tools_str_t *, hid_t, const h5tool_format_t *);
+extern void h5tools_str_dump_region_points(h5tools_str_t *, hid_t, const h5tool_format_t *);
extern void h5tools_str_sprint_region(h5tools_str_t *str, const h5tool_format_t *info, hid_t container,
- void *vp, h5tools_context_t *ctx);
+ void *vp);
extern char *h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info,
hid_t container, hid_t type, void *vp,
h5tools_context_t *ctx);
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 04d375d..a0fca8b 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -42,6 +42,12 @@ const char *opt_arg; /*flag argument (or value) */
static int h5tools_d_status = 0;
static const char *h5tools_progname = "h5tools";
+/* ``parallel_print'' variables */
+unsigned char g_Parallel = 0; /*0 for serial, 1 for parallel */
+char outBuff[OUTBUFF_SIZE];
+int outBuffOffset;
+FILE* overflow_file = NULL;
+
/* local functions */
static void init_table(table_t **tbl);
#ifdef H5DUMP_DEBUG
@@ -49,6 +55,72 @@ static void dump_table(char* tablename, table_t *table);
#endif /* H5DUMP_DEBUG */
static void add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t recorded);
+/*-------------------------------------------------------------------------
+ * Function: parallel_print
+ *
+ * Purpose: wrapper for printf for use in parallel mode.
+ *
+ * Programmer: Leon Arber
+ *
+ * Date: December 1, 2004
+ *
+ *-------------------------------------------------------------------------
+ */
+void parallel_print(const char* format, ...)
+{
+ int bytes_written;
+ va_list ap;
+
+ va_start(ap, format);
+
+ if(!g_Parallel)
+ vprintf(format, ap);
+ else
+ {
+
+ if(overflow_file == NULL) /*no overflow has occurred yet */
+ {
+#if 0
+ printf("calling HDvsnprintf: OUTBUFF_SIZE=%ld, outBuffOffset=%ld, ", (long)OUTBUFF_SIZE, (long)outBuffOffset);
+#endif
+ bytes_written = HDvsnprintf(outBuff+outBuffOffset, OUTBUFF_SIZE-outBuffOffset, format, ap);
+#if 0
+ printf("bytes_written=%ld\n", (long)bytes_written);
+#endif
+ va_end(ap);
+ va_start(ap, format);
+
+#if 0
+ printf("Result: bytes_written=%ld, OUTBUFF_SIZE-outBuffOffset=%ld\n", (long)bytes_written, (long)OUTBUFF_SIZE-outBuffOffset);
+#endif
+
+ if ((bytes_written < 0) ||
+#ifdef H5_VSNPRINTF_WORKS
+ (bytes_written >= (OUTBUFF_SIZE-outBuffOffset))
+#else
+ ((bytes_written+1) == (OUTBUFF_SIZE-outBuffOffset))
+#endif
+ )
+ {
+ /* Terminate the outbuff at the end of the previous output */
+ outBuff[outBuffOffset] = '\0';
+
+ overflow_file = HDtmpfile();
+ if(overflow_file == NULL)
+ fprintf(stderr, "warning: could not create overflow file. Output may be truncated.\n");
+ else
+ bytes_written = HDvfprintf(overflow_file, format, ap);
+ }
+ else
+ outBuffOffset += bytes_written;
+ }
+ else
+ bytes_written = HDvfprintf(overflow_file, format, ap);
+
+ }
+ va_end(ap);
+}
+
/*-------------------------------------------------------------------------
* Function: error_msg
@@ -338,11 +410,11 @@ print_version(const char *progname)
static void
init_table(table_t **tbl)
{
- table_t *table = HDmalloc(sizeof(table_t));
+ table_t *table = (table_t *)HDmalloc(sizeof(table_t));
table->size = 20;
table->nobjs = 0;
- table->objs = HDmalloc(table->size * sizeof(obj_t));
+ table->objs = (obj_t *)HDmalloc(table->size * sizeof(obj_t));
*tbl = table;
}
@@ -591,7 +663,7 @@ add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t record)
/* See if we need to make table larger */
if(table->nobjs == table->size) {
table->size *= 2;
- table->objs = HDrealloc(table->objs, table->size * sizeof(table->objs[0]));
+ table->objs = (struct obj_t *)HDrealloc(table->objs, table->size * sizeof(table->objs[0]));
} /* end if */
/* Increment number of objects in table */
@@ -653,112 +725,109 @@ tmpfile(void)
*
* Date: Feb 8, 2010
*-------------------------------------------------------------------------*/
-int H5tools_get_link_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info)
+int
+H5tools_get_link_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info,
+ hbool_t get_obj_type)
{
- int ret = -1; /* init to fail */
htri_t l_ret;
H5O_info_t trg_oinfo;
- hid_t fapl;
+ hid_t fapl = H5P_DEFAULT;
hid_t lapl = H5P_DEFAULT;
+ int ret = -1; /* init to fail */
/* init */
link_info->trg_type = H5O_TYPE_UNKNOWN;
/* check if link itself exist */
- if((H5Lexists(file_id, linkpath, H5P_DEFAULT) <= 0))
- {
- if(link_info->opt.msg_mode==1)
+ if(H5Lexists(file_id, linkpath, H5P_DEFAULT) <= 0) {
+ if(link_info->opt.msg_mode == 1)
parallel_print("Warning: link <%s> doesn't exist \n",linkpath);
goto out;
- }
+ } /* end if */
/* get info from link */
- if(H5Lget_info(file_id, linkpath, &(link_info->linfo), H5P_DEFAULT) < 0)
- {
- if(link_info->opt.msg_mode==1)
+ if(H5Lget_info(file_id, linkpath, &(link_info->linfo), H5P_DEFAULT) < 0) {
+ if(link_info->opt.msg_mode == 1)
parallel_print("Warning: unable to get link info from <%s>\n",linkpath);
goto out;
- }
+ } /* end if */
/* given path is hard link (object) */
- if (link_info->linfo.type == H5L_TYPE_HARD)
- {
+ if(link_info->linfo.type == H5L_TYPE_HARD) {
ret = 2;
goto out;
- }
+ } /* end if */
/* trg_path must be freed out of this function when finished using */
link_info->trg_path = (char*)HDcalloc(link_info->linfo.u.val_size, sizeof(char));
HDassert(link_info->trg_path);
/* get link value */
- if(H5Lget_val(file_id, linkpath, link_info->trg_path, link_info->linfo.u.val_size, H5P_DEFAULT) < 0)
- {
- if(link_info->opt.msg_mode==1)
+ if(H5Lget_val(file_id, linkpath, (void *)link_info->trg_path, link_info->linfo.u.val_size, H5P_DEFAULT) < 0) {
+ if(link_info->opt.msg_mode == 1)
parallel_print("Warning: unable to get link value from <%s>\n",linkpath);
goto out;
- }
+ } /* end if */
/*-----------------------------------------------------
* if link type is external link use different lapl to
* follow object in other file
*/
- if (link_info->linfo.type == H5L_TYPE_EXTERNAL)
- {
+ if(link_info->linfo.type == H5L_TYPE_EXTERNAL) {
fapl = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_sec2(fapl);
lapl = H5Pcreate(H5P_LINK_ACCESS);
H5Pset_elink_fapl(lapl, fapl);
- }
+ } /* end if */
- /*--------------------------------------------------------------
- * if link's target object exist, get type
- */
- /* check if target object exist */
- l_ret = H5Oexists_by_name(file_id, linkpath, lapl);
-
- /* detect dangling link */
- if(l_ret == FALSE)
- {
+ /* Check for retrieving object info */
+ if(get_obj_type) {
+ /*--------------------------------------------------------------
+ * if link's target object exist, get type
+ */
+ /* check if target object exist */
+ l_ret = H5Oexists_by_name(file_id, linkpath, lapl);
+
+ /* detect dangling link */
+ if(l_ret == FALSE) {
ret = 0;
goto out;
- }
- /* function failed */
- else if (l_ret < 0)
- {
- goto out;
- }
-
- /* get target object info */
- if(H5Oget_info_by_name(file_id, linkpath, &trg_oinfo, lapl) < 0)
- {
- if(link_info->opt.msg_mode==1)
- parallel_print("Warning: unable to get object information for <%s>\n", linkpath);
- goto out;
- }
+ } /* end if */
+ /* function failed */
+ else if(l_ret < 0)
+ goto out;
+
+ /* get target object info */
+ if(H5Oget_info_by_name(file_id, linkpath, &trg_oinfo, lapl) < 0) {
+ if(link_info->opt.msg_mode == 1)
+ parallel_print("Warning: unable to get object information for <%s>\n", linkpath);
+ goto out;
+ } /* end if */
- /* check unknown type */
- if (trg_oinfo.type < H5O_TYPE_GROUP || trg_oinfo.type >=H5O_TYPE_NTYPES)
- {
- if(link_info->opt.msg_mode==1)
- parallel_print("Warning: target object of <%s> is unknown type\n", linkpath);
- goto out;
- }
+ /* check unknown type */
+ if(trg_oinfo.type < H5O_TYPE_GROUP || trg_oinfo.type >=H5O_TYPE_NTYPES) {
+ if(link_info->opt.msg_mode == 1)
+ parallel_print("Warning: target object of <%s> is unknown type\n", linkpath);
+ goto out;
+ } /* end if */
- /* set target obj type to return */
- link_info->trg_type = trg_oinfo.type;
+ /* set target obj type to return */
+ link_info->trg_type = trg_oinfo.type;
+ } /* end if */
+ else
+ link_info->trg_type = H5O_TYPE_UNKNOWN;
/* succeed */
ret = 1;
+
out:
- if (link_info->linfo.type == H5L_TYPE_EXTERNAL)
- {
+ if(fapl != H5P_DEFAULT)
H5Pclose(fapl);
+ if(lapl != H5P_DEFAULT)
H5Pclose(lapl);
- }
return ret;
-}
+} /* end H5tools_get_link_info() */
/*-------------------------------------------------------------------------
* Audience: Public
@@ -778,12 +847,12 @@ void h5tools_setstatus(int D_status)
h5tools_d_status = D_status;
}
-const char*h5tools_getprogname()
+const char*h5tools_getprogname(void)
{
return h5tools_progname;
}
-int h5tools_getstatus()
+int h5tools_getstatus(void)
{
return h5tools_d_status;
}
diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h
index 14a7daa..08451e1 100644
--- a/tools/lib/h5tools_utils.h
+++ b/tools/lib/h5tools_utils.h
@@ -28,6 +28,10 @@
extern "C" {
#endif
+/* ``parallel_print'' information */
+#define PRINT_DATA_MAX_SIZE 512
+#define OUTBUFF_SIZE (PRINT_DATA_MAX_SIZE*4)
+
/*
* begin get_option section
*/
@@ -110,6 +114,7 @@ H5TOOLS_DLLVAR int nCols; /*max number of columns for outputti
/* Definitions of useful routines */
H5TOOLS_DLL void indentation(int);
H5TOOLS_DLL void print_version(const char *progname);
+H5TOOLS_DLL void parallel_print(const char* format, ... );
H5TOOLS_DLL void error_msg(const char *fmt, ...);
H5TOOLS_DLL void warn_msg(const char *fmt, ...);
H5TOOLS_DLL void free_table(table_t *table);
@@ -151,7 +156,8 @@ typedef struct {
/* Definitions of routines */
-H5TOOLS_DLL int H5tools_get_link_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info);
+H5TOOLS_DLL int H5tools_get_link_info(hid_t file_id, const char * linkpath,
+ h5tool_link_info_t *link_info, hbool_t get_obj_type);
H5TOOLS_DLL const char *h5tools_getprogname(void);
H5TOOLS_DLL void h5tools_setprogname(const char*progname);
H5TOOLS_DLL int h5tools_getstatus(void);
diff --git a/tools/lib/ph5diff.h b/tools/lib/ph5diff.h
index 3ad158f..e48a643 100644
--- a/tools/lib/ph5diff.h
+++ b/tools/lib/ph5diff.h
@@ -16,8 +16,6 @@
#ifndef _PH5DIFF_H__
#define _PH5DIFF_H__
-#define PRINT_DATA_MAX_SIZE 512
-#define OUTBUFF_SIZE (PRINT_DATA_MAX_SIZE*4)
/* Send from manager to workers */
#define MPI_TAG_ARGS 1
#define MPI_TAG_PRINT_TOK 2
diff --git a/tools/misc/CMakeLists.txt b/tools/misc/CMakeLists.txt
index 321d0f0..8e7e6bf 100644
--- a/tools/misc/CMakeLists.txt
+++ b/tools/misc/CMakeLists.txt
@@ -4,11 +4,11 @@ PROJECT (HDF5_TOOLS_MISC)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
# --------------------------------------------------------------------
-# Add the misc and test executables
+# Add the misc executables
# --------------------------------------------------------------------
#-- Misc Executables
ADD_EXECUTABLE (h5debug ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5debug.c)
@@ -59,7 +59,48 @@ SET (H5_DEP_EXECUTABLES
h5mkgrp
)
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
IF (BUILD_TESTING)
+ # --------------------------------------------------------------------
+ # Add the misc test executables
+ # --------------------------------------------------------------------
+ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
+ ADD_EXECUTABLE (h5repart_gentest ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5repart_gentest.c)
+ H5_NAMING (h5repart_gentest)
+ IF (WIN32)
+ IF (MSVC)
+ SET_TARGET_PROPERTIES (h5repart_gentest
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (h5repart_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ #ADD_TEST (NAME h5repart_gentest COMMAND $<TARGET_FILE:h5repart_gentest>)
+ ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
+
+ ADD_EXECUTABLE (h5repart_test ${HDF5_TOOLS_MISC_SOURCE_DIR}/repart_test.c)
+ H5_NAMING (h5repart_test)
+ IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (h5repart_test
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (h5repart_test ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ # --------------------------------------------------------------------
+ # Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
SET (HDF5_REFERENCE_TEST_FILES
family_file00000.h5
family_file00001.h5
@@ -88,38 +129,21 @@ IF (BUILD_TESTING)
TARGET h5repart
POST_BUILD
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_file} ${dest}
)
ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
- IF (NOT BUILD_SHARED_LIBS)
- ADD_EXECUTABLE (h5repart_gentest ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5repart_gentest.c)
- H5_NAMING (h5repart_gentest)
- IF (WIN32)
- IF (MSVC)
- SET_TARGET_PROPERTIES (h5repart_gentest
- PROPERTIES
- LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
- )
- ENDIF (MSVC)
- ENDIF (WIN32)
- TARGET_LINK_LIBRARIES (h5repart_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
- #ADD_TEST (NAME h5repart_gentest COMMAND $<TARGET_FILE:h5repart_gentest>)
- ENDIF (NOT BUILD_SHARED_LIBS)
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
- ADD_EXECUTABLE (h5repart_test ${HDF5_TOOLS_MISC_SOURCE_DIR}/repart_test.c)
- H5_NAMING (h5repart_test)
- IF (WIN32)
- IF (MSVC)
- IF (NOT BUILD_SHARED_LIBS)
- SET_TARGET_PROPERTIES (h5repart_test
- PROPERTIES
- LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
- )
- ENDIF (NOT BUILD_SHARED_LIBS)
- ENDIF (MSVC)
- ENDIF (WIN32)
- TARGET_LINK_LIBRARIES (h5repart_test ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
# repartition family member size to 20,000 bytes.
ADD_TEST (NAME h5repart_20K COMMAND $<TARGET_FILE:h5repart> -m 20000 family_file%05d.h5 fst_family%05d.h5)
@@ -132,11 +156,16 @@ IF (BUILD_TESTING)
ADD_TEST (NAME h5repart_test COMMAND $<TARGET_FILE:h5repart_test>)
SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
- # h5repart_gentest
h5repart_test
)
ENDIF (BUILD_TESTING)
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
#-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
diff --git a/tools/testfiles/h5repack_filters.h5.ddl b/tools/testfiles/h5repack_filters.h5.ddl
new file mode 100644
index 0000000..36e65b9
--- /dev/null
+++ b/tools/testfiles/h5repack_filters.h5.ddl
@@ -0,0 +1,13 @@
+Objects to modify layout are...
+Objects to apply filter are...
+ </dset_deflate> with GZIP filter
+ </dset_deflate>...Found
+-----------------------------------------
+ Type Filter (Compression) Name
+-----------------------------------------
+ group /
+ dset /dset_all
+ dset GZIP (0.995:1) /dset_deflate
+ dset /dset_fletcher32
+ dset /dset_nbit
+ dset /dset_shuffle
diff --git a/tools/testfiles/tbinregR.ddl b/tools/testfiles/tbinregR.ddl
new file mode 100644
index 0000000..9f2fb09
--- /dev/null
+++ b/tools/testfiles/tbinregR.ddl
@@ -0,0 +1,21 @@
+HDF5 "tdatareg.h5" {
+DATASET "/Dataset1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_DSETREG }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ SUBSET {
+ START ( 0 );
+ STRIDE ( 1 );
+ COUNT ( 1 );
+ BLOCK ( 1 );
+ DATA {
+ DATASET /Dataset2 {
+ REGION_TYPE BLOCK (2,2)-(7,7)
+ DATATYPE H5T_STD_U8BE
+ DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) }
+ DATA {
+ }
+ }
+ }
+ }
+}
+}
diff --git a/tools/testfiles/tbinregR.exp b/tools/testfiles/tbinregR.exp
new file mode 100644
index 0000000..857667f
--- /dev/null
+++ b/tools/testfiles/tbinregR.exp
@@ -0,0 +1,7 @@
+
+ 66, 69, 72, 75, 78, 81,
+ 96, 99, 102, 105, 108, 111,
+ 126, 129, 132, 135, 138, 141,
+ 156, 159, 162, 165, 168, 171,
+ 186, 189, 192, 195, 198, 201,
+ 216, 219, 222, 225, 228, 231 \ No newline at end of file
diff --git a/tools/testfiles/texceedsubblock.ddl b/tools/testfiles/texceedsubblock.ddl
new file mode 100644
index 0000000..499e0d2
--- /dev/null
+++ b/tools/testfiles/texceedsubblock.ddl
@@ -0,0 +1,3 @@
+HDF5 "taindices.h5" {
+}
+h5dump error: number of block dims (2) exceed dataset dims (1)
diff --git a/tools/testfiles/texceedsubcount.ddl b/tools/testfiles/texceedsubcount.ddl
new file mode 100644
index 0000000..81e8c4a
--- /dev/null
+++ b/tools/testfiles/texceedsubcount.ddl
@@ -0,0 +1,3 @@
+HDF5 "taindices.h5" {
+}
+h5dump error: number of count dims (2) exceed dataset dims (1)
diff --git a/tools/testfiles/texceedsubstart.ddl b/tools/testfiles/texceedsubstart.ddl
new file mode 100644
index 0000000..cb535a0
--- /dev/null
+++ b/tools/testfiles/texceedsubstart.ddl
@@ -0,0 +1,3 @@
+HDF5 "taindices.h5" {
+}
+h5dump error: number of start dims (2) exceed dataset dims (1)
diff --git a/tools/testfiles/texceedsubstride.ddl b/tools/testfiles/texceedsubstride.ddl
new file mode 100644
index 0000000..bf85997
--- /dev/null
+++ b/tools/testfiles/texceedsubstride.ddl
@@ -0,0 +1,3 @@
+HDF5 "taindices.h5" {
+}
+h5dump error: number of stride dims (2) exceed dataset dims (1)
diff --git a/tools/testfiles/tfpformat.h5.xml b/tools/testfiles/tfpformat.h5.xml
new file mode 100644
index 0000000..939d7b3
--- /dev/null
+++ b/tools/testfiles/tfpformat.h5.xml
@@ -0,0 +1,59 @@
+#############################
+Expected output for 'h5dump -u -m %.7f tfpformat.h5'
+#############################
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE HDF5-File PUBLIC "HDF5-File.dtd" "http://www.hdfgroup.org/DTDs/HDF5-File.dtd">
+<HDF5-File>
+<RootGroup OBJ-XID="xid_96" H5Path="/">
+ <Dataset Name="double" OBJ-XID="xid_800" H5Path= "/double" Parents="xid_96" H5ParentPaths="/">
+ <StorageLayout>
+ <ContiguousLayout/>
+ </StorageLayout>
+ <FillValueInfo FillTime="FillIfSet" AllocationTime="Late">
+ <FillValue>
+ <NoFill/>
+ </FillValue>
+ </FillValueInfo>
+ <Dataspace>
+ <SimpleDataspace Ndims="1">
+ <Dimension DimSize="6" MaxDimSize="6"/>
+ </SimpleDataspace>
+ </Dataspace>
+ <DataType>
+ <AtomicType>
+ <FloatType ByteOrder="LE" Size="8" SignBitLocation="63" ExponentBits="11" ExponentLocation="52" MantissaBits="52" MantissaLocation="0" />
+ </AtomicType>
+ </DataType>
+ <Data>
+ <DataFromFile>
+ -0.1234567 0.1234567 0.0000000 0.0000000 0.0000000 0.0000000
+ </DataFromFile>
+ </Data>
+ </Dataset>
+ <Dataset Name="float" OBJ-XID="xid_1400" H5Path= "/float" Parents="xid_96" H5ParentPaths="/">
+ <StorageLayout>
+ <ContiguousLayout/>
+ </StorageLayout>
+ <FillValueInfo FillTime="FillIfSet" AllocationTime="Late">
+ <FillValue>
+ <NoFill/>
+ </FillValue>
+ </FillValueInfo>
+ <Dataspace>
+ <SimpleDataspace Ndims="1">
+ <Dimension DimSize="6" MaxDimSize="6"/>
+ </SimpleDataspace>
+ </Dataspace>
+ <DataType>
+ <AtomicType>
+ <FloatType ByteOrder="LE" Size="4" SignBitLocation="31" ExponentBits="8" ExponentLocation="23" MantissaBits="23" MantissaLocation="0" />
+ </AtomicType>
+ </DataType>
+ <Data>
+ <DataFromFile>
+ -0.1234567 0.1234567 0.0000000 0.0000000 0.0000000 0.0000000
+ </DataFromFile>
+ </Data>
+ </Dataset>
+</RootGroup>
+</HDF5-File>
diff --git a/vms/src/make.com b/vms/src/make.com
index b096cd5..046ffad 100644
--- a/vms/src/make.com
+++ b/vms/src/make.com
@@ -44,7 +44,7 @@ $ cobj= "H5, H5checksum, H5dbg, H5system, H5timer, H5trace,"+-
"H5Gname, H5Gnode, H5Gobj, H5Goh, H5Groot, H5Gstab, H5Gtest, H5Gtraverse,"+-
"H5HFbtree2, H5HF, H5HFcache, H5HFdbg, H5HFdblock, H5HFdtable, H5HFhdr, H5HFhuge, H5HFiblock,"+-
"H5HFiter, H5HFman, H5HFsection, H5HFspace, H5HFstat, H5HFtest, H5HFtiny,"+-
- "H5HG, H5HGcache, H5HGdbg, H5HL, H5HLcache, H5HLdbg, H5HLint, H5HP, H5I, H5L, H5Lexternal"
+ "H5HG, H5HGcache, H5HGdbg, H5HL, H5HLcache, H5HLdbg, H5HLint, H5HP, H5I, H5Itest, H5L, H5Lexternal"
$ cobj1= "H5MFaggr, H5MF, H5MFdbg, H5MFsection, H5MM,"+-
"H5MP, H5MPtest, H5Oainfo, H5Oalloc, H5Oattr, H5Oattribute, H5Obogus, H5Obtreek,"+-
"H5O, H5Ocache, H5Ocont, H5Ocopy, H5Odbg, H5Odrvinfo, H5Odtype, H5Oefl, H5Ofill, H5Ofsinfo,"+-
diff --git a/windows/proj/hdf5/hdf5.vcproj b/windows/proj/hdf5/hdf5.vcproj
index 350c2fe..8a247ce 100644
--- a/windows/proj/hdf5/hdf5.vcproj
+++ b/windows/proj/hdf5/hdf5.vcproj
@@ -853,10 +853,14 @@
RelativePath="..\..\..\src\H5HP.c"
>
</File>
- <File
- RelativePath="..\..\..\src\H5I.c"
- >
- </File>
+ <File
+ RelativePath="..\..\..\src\H5I.c"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\src\H5Itest.c"
+ >
+ </File>
<File
RelativePath="..\..\..\src\H5L.c"
>
diff --git a/windows/proj/hdf5dll/hdf5dll.vcproj b/windows/proj/hdf5dll/hdf5dll.vcproj
index cfeacec..abf4c09 100644
--- a/windows/proj/hdf5dll/hdf5dll.vcproj
+++ b/windows/proj/hdf5dll/hdf5dll.vcproj
@@ -944,6 +944,10 @@
RelativePath="..\..\..\src\H5I.c"
>
</File>
+ <File
+ RelativePath="..\..\..\src\H5Itest.c"
+ >
+ </File>
<File
RelativePath="..\..\..\src\H5L.c"
>