From cd3f42096b9a957e37c9df48aa0d31d9ed4bc537 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 6 Aug 2012 14:42:49 -0500 Subject: [svn-r22636] Description: Bring r22599:22634 from trunk to revise_chunks branch Tested on: Mac OSX/64 10.7.4 (amazon) w/gcc 4.7.x, C++ & FORTRAN (No need for h5committest yet on this branch) --- CMakeLists.txt | 67 +- README.txt | 2 +- c++/src/Makefile.in | 2 +- config/cmake/FindHDF5.cmake | 85 --- config/cmake/FindHDF5.cmake.in | 15 +- config/cmake/H5pubconf.h.in | 18 - config/cmake/HDFLibMacros.cmake | 6 + config/cmake/cacheinit.cmake | 6 + config/cmake/hdf5-config.cmake.build.in | 12 +- config/cmake/hdf5-config.cmake.install.in | 34 +- config/lt_vers.am | 2 +- configure | 24 +- configure.in | 2 +- fortran/src/Makefile.in | 2 +- hl/c++/src/Makefile.in | 2 +- hl/fortran/src/Makefile.in | 2 +- hl/src/H5LT.c | 9 +- hl/src/H5TB.c | 10 +- hl/src/Makefile.in | 2 +- hl/test/test_table.c | 117 +++- release_docs/RELEASE.txt | 13 +- src/H5Aint.c | 2 +- src/H5B2int.c | 2 +- src/H5Dchunk.c | 2 +- src/H5Eprivate.h | 21 + src/H5FD.c | 6 +- src/H5FDmpi.c | 4 +- src/H5FDpublic.h | 2 +- src/H5Fprivate.h | 44 +- src/H5Gcache.c | 2 +- src/H5Gnode.c | 2 +- src/H5Gtest.c | 14 +- src/H5Gtraverse.c | 4 +- src/H5HFdbg.c | 4 +- src/H5HFsection.c | 7 +- src/H5O.c | 22 +- src/H5Oainfo.c | 8 +- src/H5Oalloc.c | 88 +-- src/H5Oattr.c | 6 +- src/H5Ocache.c | 10 +- src/H5Ocont.c | 4 +- src/H5Ocopy.c | 14 +- src/H5Odbg.c | 4 +- src/H5Odtype.c | 28 +- src/H5Oefl.c | 10 +- src/H5Ofill.c | 9 +- src/H5Ofsinfo.c | 6 +- src/H5Oginfo.c | 10 +- src/H5Olinfo.c | 12 +- src/H5Olink.c | 18 +- src/H5Omessage.c | 41 +- src/H5Opkg.h | 9 +- src/H5Opline.c | 4 +- src/H5Oshared.c | 2 +- src/H5Oshmesg.c | 8 +- src/H5Ostab.c | 4 +- src/H5Otest.c | 24 +- src/H5P.c | 63 +- src/H5Pacpl.c | 1 + src/H5Pdapl.c | 42 +- src/H5Pdcpl.c | 143 +++-- src/H5Pdxpl.c | 35 +- src/H5Pfapl.c | 1 + src/H5Pfcpl.c | 1 + src/H5Pfmpl.c | 1 + src/H5Pgcpl.c | 1 + src/H5Pint.c | 456 +++++++++----- src/H5Plapl.c | 43 +- src/H5Plcpl.c | 3 +- src/H5Pocpl.c | 15 +- src/H5Pocpypl.c | 7 +- src/H5Ppkg.h | 32 +- src/H5Pprivate.h | 21 + src/H5Pstrcpl.c | 3 +- src/H5R.c | 10 +- src/H5SL.c | 8 +- src/H5Sall.c | 24 +- src/H5Shyper.c | 24 +- src/H5Snone.c | 6 +- src/H5Spoint.c | 6 +- src/H5T.c | 13 +- src/H5Tarray.c | 10 +- src/H5Tfields.c | 50 +- src/H5Tprivate.h | 2 +- src/H5Ztrans.c | 12 +- src/H5private.h | 3 +- src/H5public.h | 4 +- src/Makefile.in | 2 +- test/objcopy.c | 99 +++ tools/h5copy/testh5copy.sh | 24 +- tools/h5diff/testh5diff.sh | 30 +- tools/h5dump/testh5dump.sh.in | 24 +- tools/h5dump/testh5dumppbits.sh.in | 24 +- tools/h5dump/testh5dumpxml.sh.in | 23 +- tools/h5import/CMakeLists.txt | 24 +- tools/h5import/h5importtestutil.sh | 44 +- tools/h5jam/testh5jam.sh.in | 23 +- tools/h5ls/testh5ls.sh.in | 23 +- tools/h5repack/h5repack.sh.in | 23 +- tools/h5stat/testh5stat.sh.in | 23 +- tools/lib/CMakeLists.txt | 1 + tools/lib/h5diff.c | 324 ++++------ tools/lib/h5diff.h | 26 +- tools/lib/h5diff_array.c | 45 ++ tools/lib/h5diff_dset.c | 13 + tools/lib/h5tools.c | 556 +++++------------ tools/lib/h5tools.h | 3 +- tools/lib/h5tools_dump.c | 4 +- tools/lib/h5tools_str.c | 991 +++++++++++++++--------------- tools/lib/h5tools_utils.c | 2 + tools/lib/h5tools_utils.h | 2 + tools/lib/h5trav.c | 25 + tools/lib/h5trav.h | 2 + vms/src/h5pubconf.h | 6 +- windows/src/H5pubconf.h | 6 +- 115 files changed, 2352 insertions(+), 1969 deletions(-) delete mode 100644 config/cmake/FindHDF5.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index b44f01d..0c51eb7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,7 +157,13 @@ IF (NOT HDF5_INSTALL_INCLUDE_DIR) SET (HDF5_INSTALL_INCLUDE_DIR include) ENDIF (NOT HDF5_INSTALL_INCLUDE_DIR) IF (NOT HDF5_INSTALL_DATA_DIR) - SET (HDF5_INSTALL_DATA_DIR share) + IF (NOT WIN32) + SET (HDF5_INSTALL_DATA_DIR share) + SET (HDF5_INSTALL_CMAKE_DIR share/cmake) + ELSE (NOT WIN32) + SET (HDF5_INSTALL_DATA_DIR ".") + SET (HDF5_INSTALL_CMAKE_DIR cmake) + ENDIF (NOT WIN32) ENDIF (NOT HDF5_INSTALL_DATA_DIR) #----------------------------------------------------------------------------- @@ -201,7 +207,7 @@ ELSE (NOT "${H5_VERS_SUBRELEASE}" STREQUAL "") ENDIF (NOT "${H5_VERS_SUBRELEASE}" STREQUAL "") SET (HDF5_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_MINOR}.${H5_SOVERS_RELEASE}") SET (HDF5_PACKAGE_STRING "${HDF5_PACKAGE_NAME} ${HDF5_PACKAGE_VERSION_STRING}") -SET (HDF5_PACKAGE_TARNAME "hdf5") +SET (HDF5_PACKAGE_TARNAME "${HDF5_PACKAGE}${HDF_PACKAGE_EXT}") SET (HDF5_PACKAGE_URL "http://www.hdfgroup.org") SET (HDF5_PACKAGE_BUGREPORT "help@hdfgroup.org") @@ -268,10 +274,10 @@ SET (H5_ENABLE_SHARED_LIB NO) SET (H5_ENABLE_STATIC_LIB NO) IF (BUILD_SHARED_LIBS) SET (LIB_TYPE SHARED) - SET (H5_BUILT_AS_DYNAMIC_LIB 1) + ADD_DEFINITIONS (-DH5_BUILT_AS_DYNAMIC_LIB) SET (H5_ENABLE_SHARED_LIB YES) ELSE (BUILD_SHARED_LIBS) - SET (H5_BUILT_AS_STATIC_LIB 1) + ADD_DEFINITIONS (-DH5_BUILT_AS_STATIC_LIB) SET (H5_ENABLE_STATIC_LIB YES) IF (NOT WIN32) # should this be a user setting : Everyone uses it anyway ? @@ -461,7 +467,7 @@ ENDIF (CMAKE_COMPILER_IS_GNUCXX) #----------------------------------------------------------------------------- # All libs/tests/examples need the main include directories #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${HDF5_BINARY_DIR} ${HDF5_SRC_DIR}) +INCLUDE_DIRECTORIES (${HDF5_BINARY_DIR} ${HDF5_SRC_DIR} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) #----------------------------------------------------------------------------- # Option to Enable MPI Parallel @@ -556,7 +562,7 @@ OPTION (HDF5_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" OFF) IF (HDF5_ENABLE_Z_LIB_SUPPORT) IF (NOT H5_ZLIB_HEADER) IF (NOT ZLIB_USE_EXTERNAL) - FIND_PACKAGE (ZLIB) + FIND_PACKAGE (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT}) ENDIF (NOT ZLIB_USE_EXTERNAL) IF (ZLIB_FOUND) SET (H5_HAVE_FILTER_DEFLATE 1) @@ -596,7 +602,7 @@ OPTION (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF) IF (HDF5_ENABLE_SZIP_SUPPORT) OPTION (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF) IF (NOT SZIP_USE_EXTERNAL) - FIND_PACKAGE (SZIP) + FIND_PACKAGE (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT}) ENDIF (NOT SZIP_USE_EXTERNAL) IF (SZIP_FOUND) SET (H5_HAVE_FILTER_SZIP 1) @@ -615,7 +621,7 @@ IF (HDF5_ENABLE_SZIP_SUPPORT) ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") ENDIF (SZIP_FOUND) SET (LINK_LIBS ${LINK_LIBS} ${SZIP_LIBRARIES}) - INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS}) + INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIR}) MESSAGE (STATUS "Filter SZIP is ON") IF (H5_HAVE_FILTER_SZIP) SET (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} DECODE") @@ -831,8 +837,8 @@ ENDIF (NOT HDF5_INSTALL_NO_DEVELOPMENT) IF (NOT HDF5_EXTERNALLY_CONFIGURED) INSTALL ( EXPORT ${HDF5_EXPORTED_TARGETS} - DESTINATION ${HDF5_INSTALL_DATA_DIR}/cmake/hdf5 - FILE hdf5-targets.cmake + DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/${HDF5_PACKAGE} + FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake COMPONENT configinstall ) ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) @@ -843,7 +849,7 @@ ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) IF (NOT HDF5_EXTERNALLY_CONFIGURED) EXPORT ( TARGETS ${HDF5_LIBRARIES_TO_EXPORT} ${HDF5_LIB_DEPENDENCIES} - FILE hdf5-targets.cmake + FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake ) ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) @@ -860,20 +866,35 @@ 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_BINARY_DIR}/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake @ONLY ) #----------------------------------------------------------------------------- +# Configure the FindHDF5.cmake file for the install directory +#----------------------------------------------------------------------------- +IF (NOT HDF5_EXTERNALLY_CONFIGURED) + CONFIGURE_FILE ( + ${HDF5_RESOURCES_DIR}/FindHDF5.cmake.in + ${HDF5_BINARY_DIR}/CMakeFiles/FindHDF5${HDF_PACKAGE_EXT}.cmake @ONLY + ) + INSTALL ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/FindHDF5${HDF_PACKAGE_EXT}.cmake + DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/${HDF5_PACKAGE} + COMPONENT configinstall + ) +ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) + +#----------------------------------------------------------------------------- # Configure the hdf5-config.cmake file for the install directory #----------------------------------------------------------------------------- IF (NOT HDF5_EXTERNALLY_CONFIGURED) CONFIGURE_FILE ( ${HDF5_RESOURCES_DIR}/hdf5-config.cmake.install.in - ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config.cmake @ONLY + ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake @ONLY ) INSTALL ( - FILES ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config.cmake - DESTINATION ${HDF5_INSTALL_DATA_DIR}/cmake/hdf5 + FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake + DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/${HDF5_PACKAGE} COMPONENT configinstall ) ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) @@ -884,11 +905,11 @@ ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) IF (NOT HDF5_EXTERNALLY_CONFIGURED) CONFIGURE_FILE ( ${HDF5_RESOURCES_DIR}/hdf5-config-version.cmake.in - ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config-version.cmake @ONLY + ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake @ONLY ) INSTALL ( - FILES ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config-version.cmake - DESTINATION ${HDF5_INSTALL_DATA_DIR}/cmake/hdf5 + FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF5_PACKAGE_EXT}-config-version.cmake + DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/${HDF5_PACKAGE} COMPONENT configinstall ) ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) @@ -907,7 +928,7 @@ CONFIGURE_FILE ( ) INSTALL ( FILES ${HDF5_BINARY_DIR}/libhdf5.settings - DESTINATION ${HDF5_INSTALL_LIB_DIR} + DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/${HDF5_PACKAGE} COMPONENT libraries ) @@ -984,13 +1005,7 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) SET (CPACK_NSIS_PACKAGE_NAME "HDF5 ${HDF5_PACKAGE_VERSION}") ELSE (WIN32) SET (CPACK_PACKAGING_INSTALL_PREFIX "/usr") - SET (CPACK_RPM_PACKAGE_RELOCATABLE ON) - SET (CPACK_RPM_PACKAGE_LICENSE "BSD-style") - SET (CPACK_RPM_PACKAGE_GROUP "Development/Libraries") - SET (CPACK_RPM_PACKAGE_URL "${HDF5_PACKAGE_URL}") - SET (CPACK_RPM_PACKAGE_SUMMARY "HDF5 is a unique technology suite that makes possible the management of extremely large and complex data collections.") - SET (CPACK_RPM_PACKAGE_DESCRIPTION - "The HDF5 technology suite includes: + SET (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON) * A versatile data model that can represent very complex data objects and a wide variety of metadata. diff --git a/README.txt b/README.txt index c80fea1..6eda55e 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.124-FA_a5 currently under development +HDF5 version 1.9.125-FA_a5 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index b83f4e1..c707e9c 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -431,7 +431,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 114 +LT_VERS_REVISION = 115 LT_VERS_AGE = 0 # Include src directory diff --git a/config/cmake/FindHDF5.cmake b/config/cmake/FindHDF5.cmake deleted file mode 100644 index 33532b0..0000000 --- a/config/cmake/FindHDF5.cmake +++ /dev/null @@ -1,85 +0,0 @@ -# -# To be used by projects that make use of Cmakeified hdf5-1.8 -# - -# -# Find the HDF5 includes and get all installed hdf5 library settings from -# HDF5-config.cmake file : Requires a CMake compatible hdf5-1.8.5 or later -# for this feature to work. The following vars are set if hdf5 is found. -# -# HDF5_FOUND - True if found, otherwise all other vars are undefined -# HDF5_INCLUDE_DIR - The include dir for main *.h files -# HDF5_FORTRAN_INCLUDE_DIR - The include dir for fortran modules and headers -# HDF5_VERSION_STRING - full version (e.g. 1.8.5) -# HDF5_VERSION_MAJOR - major part of version (e.g. 1.8) -# HDF5_VERSION_MINOR - minor part (e.g. 5) -# -# The following boolean vars will be defined -# HDF5_ENABLE_PARALLEL - 1 if HDF5 parallel supported -# HDF5_BUILD_FORTRAN - 1 if HDF5 was compiled with fortran on -# HDF5_BUILD_CPP_LIB - 1 if HDF5 was compiled with cpp on -# HDF5_BUILD_TOOLS - 1 if HDF5 was compiled with tools on -# HDF5_BUILD_HL_LIB - 1 if HDF5 was compiled with high level on -# HDF5_BUILD_HL_CPP_LIB - 1 if HDF5 was compiled with high level and cpp on -# -# Target names that are valid (depending on enabled options) -# will be the following -# -# hdf5 : HDF5 C library -# hdf5_tools : the tools library -# hdf5_f90cstub : used by Fortran to C interface -# hdf5_fortran : Fortran HDF5 library -# hdf5_cpp : HDF5 cpp interface library -# hdf5_hl : High Level library -# hdf5_hl_f90cstub : used by Fortran to C interface to High Level library -# hdf5_hl_fortran : Fortran High Level library -# hdf5_hl_cpp : High Level cpp interface library -# -# To aid in finding HDF5 as part of a subproject set -# HDF5_ROOT_DIR_HINT to the location where hdf5-config.cmake lies - -INCLUDE (SelectLibraryConfigurations) -INCLUDE (FindPackageHandleStandardArgs) - -# The HINTS option should only be used for values computed from the system. -SET (_HDF5_HINTS - $ENV{HOME}/.local - $ENV{HDF5_ROOT} - $ENV{HDF5_ROOT_DIR_HINT} -) -# Hard-coded guesses should still go in PATHS. This ensures that the user -# environment can always override hard guesses. -SET (_HDF5_PATHS - $ENV{HOME}/.local - $ENV{HDF5_ROOT} - $ENV{HDF5_ROOT_DIR_HINT} - /usr/lib/hdf5 - /usr/share/hdf5 - /usr/local/hdf5 - /usr/local/hdf5/share -) - -FIND_PATH (HDF5_ROOT_DIR "hdf5-config.cmake" - HINTS ${_HDF5_HINTS} - PATHS ${_HDF5_PATHS} - PATH_SUFFIXES - lib/cmake/hdf5 - share/cmake/hdf5 -) - -FIND_PATH (HDF5_INCLUDE_DIRS "H5public.h" - HINTS ${_HDF5_HINTS} - PATHS ${_HDF5_PATHS} - PATH_SUFFIXES - include - Include -) - -# For backwards compatibility we set HDF5_INCLUDE_DIR to the value of -# HDF5_INCLUDE_DIRS -SET ( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" ) - -IF (HDF5_INCLUDE_DIR) - SET (HDF5_FOUND "YES") - INCLUDE (${HDF5_ROOT_DIR}/hdf5-config.cmake) -ENDIF (HDF5_INCLUDE_DIR) diff --git a/config/cmake/FindHDF5.cmake.in b/config/cmake/FindHDF5.cmake.in index a866859..1b51ed4 100644 --- a/config/cmake/FindHDF5.cmake.in +++ b/config/cmake/FindHDF5.cmake.in @@ -1,5 +1,5 @@ # -# To be used by projects that make use of Cmakeified hdf5-1.8 +# To be used by projects that make use of Cmakeified hdf5-@HDF5_PACKAGE_VERSION@ # # @@ -10,9 +10,9 @@ # HDF5_FOUND - True if found, otherwise all other vars are undefined # HDF5_INCLUDE_DIR - The include dir for main *.h files # HDF5_FORTRAN_INCLUDE_DIR - The include dir for fortran modules and headers -# HDF5_VERSION_STRING - full version (e.g. 1.8.5) -# HDF5_VERSION_MAJOR - major part of version (e.g. 1.8) -# HDF5_VERSION_MINOR - minor part (e.g. 5) +# HDF5_VERSION_STRING - full version (e.g. @HDF5_PACKAGE_VERSION@) +# HDF5_VERSION_MAJOR - major part of version (e.g. @HDF5_PACKAGE_VERSION_MAJOR@) +# HDF5_VERSION_MINOR - minor part (e.g. @HDF5_PACKAGE_VERSION_MINOR@) # # The following boolean vars will be defined # HDF5_ENABLE_PARALLEL - 1 if HDF5 parallel supported @@ -36,7 +36,7 @@ # hdf5_hl_cpp : High Level cpp interface library # # To aid in finding HDF5 as part of a subproject set -# HDF5_ROOT_DIR_HINT to the location where hdf5-config.cmake lies +# HDF5_ROOT_DIR_HINT to the location where @HDF5_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake lies INCLUDE (SelectLibraryConfigurations) INCLUDE (FindPackageHandleStandardArgs) @@ -59,10 +59,11 @@ SET (_HDF5_PATHS /usr/local/@HDF5_PACKAGE@/share ) -FIND_PATH (HDF5_ROOT_DIR "@HDF5_PACKAGE@@HDF5_PACKAGE_EXT@-config.cmake" +FIND_PATH (HDF5_ROOT_DIR "@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake" HINTS ${_HDF5_HINTS} PATHS ${_HDF5_PATHS} PATH_SUFFIXES + cmake/@HDF5_PACKAGE@ lib/cmake/@HDF5_PACKAGE@ share/cmake/@HDF5_PACKAGE@ ) @@ -81,5 +82,5 @@ SET ( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" ) IF (HDF5_INCLUDE_DIR) SET (HDF5_FOUND "YES") - INCLUDE (${HDF5_ROOT_DIR}/@HDF5_PACKAGE@@HDF5_PACKAGE_EXT@-config.cmake) + INCLUDE (${HDF5_ROOT_DIR}/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake) ENDIF (HDF5_INCLUDE_DIR) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 6fca1ae..71e8c10 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -15,24 +15,6 @@ /* Define if using a Windows compiler (i.e. Visual Studio) */ #cmakedefine H5_HAVE_VISUAL_STUDIO @H5_HAVE_VISUAL_STUDIO@ -/* Defined if HDF5 was built with CMake AND build as a shared library */ -#cmakedefine H5_BUILT_AS_DYNAMIC_LIB @H5_BUILT_AS_DYNAMIC_LIB@ - -/* Defined if HDF5 was built with CMake AND build as a static library */ -#cmakedefine H5_BUILT_AS_STATIC_LIB @H5_BUILT_AS_STATIC_LIB@ - -/* Defined if HDF5 CPP was built with CMake AND build as a shared library */ -#cmakedefine H5_CPP_BUILT_AS_DYNAMIC_LIB @H5_CPP_BUILT_AS_DYNAMIC_LIB@ - -/* Defined if HDF5 CPP was built with CMake AND build as a static library */ -#cmakedefine H5_CPP_BUILT_AS_STATIC_LIB @H5_CPP_BUILT_AS_STATIC_LIB@ - -/* Defined if HDF5 HL was built with CMake AND build as a shared library */ -#cmakedefine H5_HL_BUILT_AS_DYNAMIC_LIB @H5_HL_BUILT_AS_DYNAMIC_LIB@ - -/* Defined if HDF5 HL was built with CMake AND build as a static library */ -#cmakedefine H5_HL_BUILT_AS_STATIC_LIB @H5_HL_BUILT_AS_STATIC_LIB@ - /* Define if building universal (internal helper macro) */ #cmakedefine H5_AC_APPLE_UNIVERSAL_BUILD @H5_AC_APPLE_UNIVERSAL_BUILD@ diff --git a/config/cmake/HDFLibMacros.cmake b/config/cmake/HDFLibMacros.cmake index 7b54c95..57e6be7 100644 --- a/config/cmake/HDFLibMacros.cmake +++ b/config/cmake/HDFLibMacros.cmake @@ -10,6 +10,7 @@ MACRO (EXTERNAL_JPEG_LIBRARY compress_type libtype jpeg_pic) INSTALL_COMMAND "" CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} + -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} -DJPEG_EXTERNALLY_CONFIGURED:BOOL=OFF -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} @@ -25,6 +26,7 @@ MACRO (EXTERNAL_JPEG_LIBRARY compress_type libtype jpeg_pic) INSTALL_COMMAND "" CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} + -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} -DJPEG_EXTERNALLY_CONFIGURED:BOOL=OFF -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} @@ -122,6 +124,7 @@ MACRO (EXTERNAL_SZIP_LIBRARY compress_type libtype encoding) INSTALL_COMMAND "" CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} + -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} -DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} @@ -138,6 +141,7 @@ MACRO (EXTERNAL_SZIP_LIBRARY compress_type libtype encoding) INSTALL_COMMAND "" CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} + -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} -DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} @@ -236,6 +240,7 @@ MACRO (EXTERNAL_ZLIB_LIBRARY compress_type libtype) INSTALL_COMMAND "" CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} + -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} -DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} @@ -251,6 +256,7 @@ MACRO (EXTERNAL_ZLIB_LIBRARY compress_type libtype) INSTALL_COMMAND "" CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} + -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} -DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index e7dd19f..d45ef9e 100755 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -8,6 +8,8 @@ SET (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries" FORCE) SET (BUILD_TESTING ON CACHE BOOL "Build HDF5 Unit Testing" FORCE) +SET (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE) + SET (HDF5_BUILD_CPP_LIB ON CACHE BOOL "Build HDF5 C++ Library" FORCE) SET (HDF5_BUILD_EXAMPLES ON CACHE BOOL "Build HDF5 Library Examples" FORCE) @@ -69,3 +71,7 @@ SET (SZIP_SVN_URL "http://svn.hdfgroup.uiuc.edu/szip/trunk" CACHE STRING "Use SZ SET (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE) SET (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE) + +SET (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE) + +SET (SZIP_PACKAGE_NAME "szip" CACHE STRING "Name of SZIP package" FORCE) diff --git a/config/cmake/hdf5-config.cmake.build.in b/config/cmake/hdf5-config.cmake.build.in index ccf5e67..881985e 100644 --- a/config/cmake/hdf5-config.cmake.build.in +++ b/config/cmake/hdf5-config.cmake.build.in @@ -42,6 +42,12 @@ IF (HDF5_BUILD_TOOLS) SET (HDF5_INCLUDE_DIR_TOOLS ${HDF5_INCLUDE_DIR} ) ENDIF (HDF5_BUILD_TOOLS) +IF (HDF5_BUILD_SHARED_LIBS) + SET (H5_BUILT_AS_DYNAMIC_LIB 1 ) +ELSE (HDF5_BUILD_SHARED_LIBS) + SET (H5_BUILT_AS_STATIC_LIB 1 ) +ENDIF (HDF5_BUILD_SHARED_LIBS) + #----------------------------------------------------------------------------- # Version Strings #----------------------------------------------------------------------------- @@ -53,7 +59,7 @@ 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) +IF (NOT TARGET "@HDF5_PACKAGE@") + INCLUDE (${SELF_DIR}/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake) SET (HDF5_LIBRARIES "@HDF5_LIBRARIES_TO_EXPORT@") -ENDIF (NOT TARGET "hdf5") +ENDIF (NOT TARGET "@HDF5_PACKAGE@") diff --git a/config/cmake/hdf5-config.cmake.install.in b/config/cmake/hdf5-config.cmake.install.in index a851915..6b90496 100644 --- a/config/cmake/hdf5-config.cmake.install.in +++ b/config/cmake/hdf5-config.cmake.install.in @@ -4,7 +4,9 @@ GET_FILENAME_COMPONENT (SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${SELF_DIR}" PATH) GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) -GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +IF (NOT WIN32) + GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +ENDIF (NOT WIN32) #----------------------------------------------------------------------------- # User Options @@ -58,34 +60,14 @@ 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") +IF (NOT TARGET "@HDF5_PACKAGE@") IF (HDF5_ENABLE_Z_LIB_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "zlib") - INCLUDE (${SELF_DIR}/../ZLIB/ZLIB-targets.cmake) + INCLUDE (${SELF_DIR}/../ZLIB/@ZLIB_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) ENDIF (HDF5_ENABLE_Z_LIB_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "zlib") IF (HDF5_ENABLE_SZIP_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "szip") - INCLUDE (${SELF_DIR}/../SZIP/SZIP-targets.cmake) + INCLUDE (${SELF_DIR}/../SZIP/@SZIP_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) ENDIF (HDF5_ENABLE_SZIP_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "szip") - INCLUDE (${SELF_DIR}/hdf5-targets.cmake) + INCLUDE (${SELF_DIR}/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake) SET (HDF5_LIBRARIES "@HDF5_LIBRARIES_TO_EXPORT@") -ENDIF (NOT TARGET "hdf5") +ENDIF (NOT TARGET "@HDF5_PACKAGE@") -#----------------------------------------------------------------------------- -# Unfinished -#----------------------------------------------------------------------------- -# -# To be continued (maybe) ... -# -# 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 -# 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/lt_vers.am b/config/lt_vers.am index 4ad3051..6540b48 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -17,7 +17,7 @@ # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 114 +LT_VERS_REVISION = 115 LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and diff --git a/configure b/configure index 73d7478..f0b3eb2 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh -# From configure.in Id: configure.in 22487 2012-06-24 14:29:36Z hdftest . +# From configure.in Id: configure.in 22525 2012-07-09 16:54:50Z lrknox . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for HDF5 1.9.124-FA_a5. +# Generated by GNU Autoconf 2.68 for HDF5 1.9.125-FA_a5. # # Report bugs to . # @@ -571,8 +571,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='HDF5' PACKAGE_TARNAME='hdf5' -PACKAGE_VERSION='1.9.124-FA_a5' -PACKAGE_STRING='HDF5 1.9.124-FA_a5' +PACKAGE_VERSION='1.9.125-FA_a5' +PACKAGE_STRING='HDF5 1.9.125-FA_a5' PACKAGE_BUGREPORT='help@hdfgroup.org' PACKAGE_URL='' @@ -1463,7 +1463,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures HDF5 1.9.124-FA_a5 to adapt to many kinds of systems. +\`configure' configures HDF5 1.9.125-FA_a5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1533,7 +1533,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of HDF5 1.9.124-FA_a5:";; + short | recursive ) echo "Configuration of HDF5 1.9.125-FA_a5:";; esac cat <<\_ACEOF @@ -1726,7 +1726,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -HDF5 configure 1.9.124-FA_a5 +HDF5 configure 1.9.125-FA_a5 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2815,7 +2815,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by HDF5 $as_me 1.9.124-FA_a5, which was +It was created by HDF5 $as_me 1.9.125-FA_a5, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -3636,7 +3636,7 @@ fi # Define the identity of the package. PACKAGE='hdf5' - VERSION='1.9.124-FA_a5' + VERSION='1.9.125-FA_a5' cat >>confdefs.h <<_ACEOF @@ -30668,7 +30668,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by HDF5 $as_me 1.9.124-FA_a5, which was +This file was extended by HDF5 $as_me 1.9.125-FA_a5, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -30734,7 +30734,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -HDF5 config.status 1.9.124-FA_a5 +HDF5 config.status 1.9.125-FA_a5 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" @@ -33533,7 +33533,7 @@ Usage: $0 [OPTIONS] Report bugs to ." lt_cl_version="\ -HDF5 config.lt 1.9.124-FA_a5 +HDF5 config.lt 1.9.125-FA_a5 configured by $0, generated by GNU Autoconf 2.68. Copyright (C) 2010 Free Software Foundation, Inc. diff --git a/configure.in b/configure.in index 8737e64..828561e 100644 --- a/configure.in +++ b/configure.in @@ -26,7 +26,7 @@ dnl dnl NOTE: Don't forget to change the version number here when we do a dnl release!!! dnl -AC_INIT([HDF5], [1.9.124-FA_a5], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.125-FA_a5], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AM_CONFIG_HEADER([src/H5config.h]) diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index e0fd502..13a07a4 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -478,7 +478,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 114 +LT_VERS_REVISION = 115 LT_VERS_AGE = 0 # Include src directory in both Fortran and C flags (C compiler is used diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in index f22d1c8..b0492bf 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -421,7 +421,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 114 +LT_VERS_REVISION = 115 LT_VERS_AGE = 0 # Include src directory diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index aeea150..30d2cac 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -436,7 +436,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 114 +LT_VERS_REVISION = 115 LT_VERS_AGE = 0 INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/hl/src -I$(top_builddir)/hl/src \ -I$(top_srcdir)/fortran/src -I$(top_builddir)/fortran/src diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 678642f..eed2721 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -3024,8 +3024,11 @@ herr_t H5LTget_attribute_string( hid_t loc_id, return -1; /* Get the attribute */ - if ( H5LT_get_attribute_disk( obj_id, attr_name, data ) < 0 ) - return -1; + if ( H5LT_get_attribute_disk( obj_id, attr_name, data ) < 0 ) + { + H5Oclose(obj_id); + return -1; + } /* Close the object */ if(H5Oclose(obj_id) < 0) @@ -3458,6 +3461,8 @@ static herr_t H5LT_get_attribute_mem(hid_t loc_id, return 0; out: + if(obj_id > 0) + H5Oclose(obj_id); if(attr_id > 0) H5Aclose(attr_id); return -1; diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index 6edc244..8a77f13 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -1298,6 +1298,7 @@ herr_t H5TBdelete_record( hid_t loc_id, hid_t tid=-1; hid_t sid=-1; hid_t m_sid=-1; + hid_t mem_type_id=-1; hsize_t count[1]; hsize_t offset[1]; hsize_t mem_size[1]; @@ -1364,6 +1365,10 @@ herr_t H5TBdelete_record( hid_t loc_id, if ((sid = H5Dget_space( did )) < 0) goto out; + /* create the memory data type. */ + if ((mem_type_id=H5TB_create_type( loc_id, dset_name, src_size, src_offset, src_sizes, tid)) < 0) + goto out; + /* define a hyperslab in the dataset of the size of the records */ offset[0] = start; count[0] = read_nrecords; @@ -1375,12 +1380,14 @@ herr_t H5TBdelete_record( hid_t loc_id, if ((m_sid = H5Screate_simple( 1, mem_size, NULL )) < 0) goto out; - if (H5Dwrite( did, tid, m_sid, sid, H5P_DEFAULT, tmp_buf ) < 0) + if (H5Dwrite( did, mem_type_id, m_sid, sid, H5P_DEFAULT, tmp_buf ) < 0) goto out; /* close */ if (H5Sclose( m_sid ) < 0) goto out; + if (H5Tclose( mem_type_id ) < 0) + goto out; if (H5Sclose( sid ) < 0) goto out; if (H5Tclose( tid ) < 0) @@ -1416,6 +1423,7 @@ out: free( tmp_buf ); H5E_BEGIN_TRY { + H5Tclose(mem_type_id); H5Dclose(did); H5Tclose(tid); H5Sclose(sid); diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in index 9b2bbdb..eaeac2e 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -420,7 +420,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 114 +LT_VERS_REVISION = 115 LT_VERS_AGE = 0 # This library is our main target. diff --git a/hl/test/test_table.c b/hl/test/test_table.c index e3e040e..cdae768 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -114,6 +114,27 @@ typedef struct particle3_t int lati; } particle3_t; +/*------------------------------------------------------------------------- + * a particle, used in the delete field test differing memory layout + *------------------------------------------------------------------------- + */ + +/* Push current alignment rule forcing 4-byte alignment boundary + * to the internal stack ... + */ +#pragma pack(push,4) + typedef struct particle4_t { + uint32_t state; + double posx; + double posy; + float atx[3]; + float aty[3]; + float rro[2]; + } particle4_t; +/* + * ... and restore original alignment rules from stack + */ +#pragma pack(pop) /*------------------------------------------------------------------------- @@ -350,6 +371,34 @@ static int test_table(hid_t fid, int do_write) sizeof( rbuf3[0].temperature), sizeof( rbuf3[0].lati)}; + /*------------------------------------------------------------------------- + * initialize table parameters + * size and the offsets of struct members in memory + * these are used for the delete field test with differing memory layout + *------------------------------------------------------------------------- + */ + + /* Calculate the size and the offsets of our struct members in memory */ + size_t tbl_size = sizeof(particle4_t); + size_t tbl_offset[NFIELDS+1] = { HOFFSET(particle4_t, state), + HOFFSET(particle4_t, posx), + HOFFSET(particle4_t, posy), + HOFFSET(particle4_t, atx), + HOFFSET(particle4_t, aty), + HOFFSET(particle4_t, rro) + }; + + /* Define an array of Particles */ + particle4_t p_data[NRECORDS] = { + {12112, 1.4, 2.5, {1,2,3},{4,5,6}, {99,100}}, + {12113, 1.4, 2.5, {1,2,3},{4,5,6}, {99,100}}, + {12114, 1.4, 2.5, {1,2,3},{4,5,6}, {99,100}}, + {12115, 1.4, 2.5, {1,2,3},{4,5,6}, {99,100}}, + {12116, 1.4, 2.5, {1,2,3},{4,5,6}, {99,100}}, + {12117, 1.4, 2.5, {1,2,3},{4,5,6}, {99,100}}, + {12118, 1.4, 2.5, {1,2,3},{4,5,6}, {99,100}}, + {12119, 1.4, 2.5, {1,2,3},{4,5,6}, {99,100}} + }; /*------------------------------------------------------------------------- * initialize table parameters @@ -376,10 +425,23 @@ static int test_table(hid_t fid, int do_write) sizeof( rbuf[0].temperature), sizeof( rbuf[0].lati) }; + + const char *field_names4[NFIELDS+1] = + { "F1", "F2", "F3", "F4", "F5", "F6"}; + hid_t field_type4[NFIELDS+1]; + particle4_t fill_data[1] = { {9999999, -9999999, 999999, {999,999,999},{999,999,999}, {999,999}} }; + + hsize_t nfields_out; + hsize_t nrecords_out; + hid_t arry3_32f; + hid_t arry2_32f; + hsize_t dims; + const char *field_names[NFIELDS] = - { "Name","Longitude","Pressure","Temperature","Latitude" }; + { "Name","Longitude","Pressure","Temperature","Latitude" }; hid_t field_type[NFIELDS]; hid_t string_type = H5Tcopy( H5T_C_S1 ); + H5Tset_size( string_type, 16 ); field_type[0] = string_type; field_type[1] = H5T_NATIVE_LONG; @@ -820,6 +882,59 @@ static int test_table(hid_t fid, int do_write) PASSED(); } + /*------------------------------------------------------------------------ + * Functions tested: + * + * H5TBdelete_record -- With differing memory layout from machine memory + * layout. HDFFV-8055 + * + *------------------------------------------------------------------------- + */ + if (do_write) + { + TESTING2("deleting records (differing memory layout)"); + + dims = 3; + arry3_32f = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &dims); + + dims = 2; + arry2_32f = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &dims); + + /* Initialize the field field_type */ + field_type4[0] = H5T_NATIVE_UINT32; + field_type4[1] = H5T_NATIVE_DOUBLE; + field_type4[2] = H5T_NATIVE_DOUBLE; + field_type4[3] = arry3_32f; + field_type4[4] = arry3_32f; + field_type4[5] = arry2_32f; + + /* Make the table */ + if (H5TBmake_table("Table Title",fid,"table",NFIELDS+1,(hsize_t)NRECORDS, + tbl_size, field_names4, tbl_offset, field_type4, + chunk_size, fill_data, compress, p_data)<0) + goto out; + /* Delete records */ + start = 3; + nrecords = 3; + if (H5TBdelete_record(fid, "table", start, nrecords)<0) + goto out;; + /* Get table info */ + if (H5TBget_table_info(fid,"table", &nfields_out, &nrecords_out)<0) + goto out; + /* check */ + if( (int)nfields_out != (int)NFIELDS+1) + goto out; + + if( (int)nrecords_out != (int)NRECORDS-3) + goto out; + + /* close type */ + H5Tclose(arry3_32f); + H5Tclose(arry2_32f); + + PASSED(); + } + /*------------------------------------------------------------------------- * * Functions tested: diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index cdda305..c448d1d 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.124-FA_a5 currently under development +HDF5 version 1.9.125-FA_a5 currently under development ================================================================================ @@ -378,6 +378,9 @@ Bug Fixes since HDF5-1.8.0 release Library ------- + - Fixed an error that could occur when calling H5Ocopy within an + H5Literate callback (and possibly other situations). + (NAF - 2012/7/25 - HDFFV-5853) - Fixed an error that would occur when copying an object with attribute creation order tracked and indexed. (NAF - 2012/3/28 - HDFFV-7762) - Fixed a bug in H5Ocopy(): When copying an opened object, call the @@ -702,6 +705,14 @@ Bug Fixes since HDF5-1.8.0 release Tools ----- + - ph5diff: Fixed intermittent hang issue on a certain operation in + parallel mode. It was detected by daily test for comparing + non-comparable objects, but it could have occurred in other + operations depend on machine condition. HDFFV-8003 (JKM 2012/08/01) + - h5diff: Fixed test failure for "make check" due to failure of + copying test files when performed in HDF5 source tree. Also applied + to other tools. + HDFFV-8107 (JKM 2012/08/01) - h5diff: Fixed the Function COPY_TESTFILES_TO_TESTDIR() of testh5diff.sh to better report when there is an error in the file copying. HDFFV-8105 (AKC -2012/07/22) diff --git a/src/H5Aint.c b/src/H5Aint.c index acae3da..e6e25c4 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -1199,7 +1199,7 @@ H5A_dense_post_copy_file_cb(const H5A_t *attr_src, void *_udata) /* Insert attribute into dense storage */ if(H5A_dense_insert(udata->file, udata->dxpl_id, udata->ainfo, attr_dst) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, H5_ITER_ERROR, "unable to add to dense storage") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINSERT, H5_ITER_ERROR, "unable to add to dense storage") /* Reset metadata tag */ H5_END_TAG(H5_ITER_ERROR); diff --git a/src/H5B2int.c b/src/H5B2int.c index e6d359a..29d12e8 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -148,7 +148,7 @@ H5B2_locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off, unsigned my_idx = 0; /* Final index value */ int cmp = -1; /* Key comparison value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI_NOINIT_NOERR hi = nrec; while(lo < hi && cmp) { diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 21f867c..9e79f82 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -5174,7 +5174,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) /* Insert chunk into the destination index */ if((udata->idx_info_dst->storage->ops->insert)(udata->idx_info_dst, &udata_dst) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, H5_ITER_ERROR, "unable to insert chunk into index") + HGOTO_ERROR_TAG(H5E_DATASET, H5E_CANTINSERT, H5_ITER_ERROR, "unable to insert chunk into index") /* Reset metadata tag in dxpl_id */ H5_END_TAG(H5_ITER_ERROR); diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index 2ca48d2..b2ca5eb 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -69,6 +69,17 @@ typedef struct H5E_t H5E_t; } /* + * HGOTO_ERROR_TAG macro, used like HGOTO_ERROR between H5_BEGIN_TAG and + * H5_END_TAG statements. Resets the metadata tag before leaving the function. + */ +#define HGOTO_ERROR_TAG(maj, min, ret_val, ...) { \ + if(H5AC_tag(my_dxpl_id, prv_tag, NULL) < 0) \ + HERROR(H5E_CACHE, H5E_CANTTAG, "unable to apply metadata tag"); \ + HCOMMON_ERROR(maj, min, __VA_ARGS__); \ + HGOTO_DONE(ret_val) \ +} + +/* * HGOTO_DONE macro, used to facilitate normal return between a FUNC_ENTER() * and a FUNC_LEAVE() within a function body. The argument is the return * value which is assigned to the `ret_value' variable. Control branches to @@ -77,6 +88,16 @@ typedef struct H5E_t H5E_t; #define HGOTO_DONE(ret_val) {ret_value = ret_val; goto done;} /* + * HGOTO_DONE_TAG macro, used like HGOTO_DONE between H5_BEGIN_TAG and + * H5_END_TAG statements. Resets the metadata tag before leaving the function. + */ +#define HGOTO_DONE_TAG(ret_val, err) { \ + if(H5AC_tag(my_dxpl_id, prv_tag, NULL) < 0) \ + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ + HGOTO_DONE(ret_val) \ +} + +/* * Macros handling system error messages as described in C standard. * These macros assume errnum is a valid system error code. */ diff --git a/src/H5FD.c b/src/H5FD.c index 8ff9d9a..7db584e 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -1350,7 +1350,7 @@ H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/) { int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI_NOINIT_NOERR HDassert(f); HDassert(flags); @@ -1361,7 +1361,6 @@ H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/) else *flags=0; -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_query() */ @@ -1387,7 +1386,7 @@ H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*out*/) { int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI_NOINIT_NOERR HDassert(driver); HDassert(flags); @@ -1398,7 +1397,6 @@ H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*out*/) else *flags = 0; -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_driver_query() */ diff --git a/src/H5FDmpi.c b/src/H5FDmpi.c index afc5536..01c28e6 100644 --- a/src/H5FDmpi.c +++ b/src/H5FDmpi.c @@ -479,11 +479,11 @@ H5FD_mpi_setup_collective(hid_t dxpl_id, MPI_Datatype *btype, MPI_Datatype *ftyp /* Set buffer MPI type */ if(H5P_set(plist, H5FD_MPI_XFER_MEM_MPI_TYPE_NAME, btype) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert MPI-I/O property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O property") /* Set File MPI type */ if(H5P_set(plist, H5FD_MPI_XFER_FILE_MPI_TYPE_NAME, ftype) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert MPI-I/O property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O property") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index 5f70f71..ed50bc7 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -313,7 +313,7 @@ typedef enum { H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE, H5FD_FILE_IMAGE_OP_FILE_OPEN, H5FD_FILE_IMAGE_OP_FILE_RESIZE, - H5FD_FILE_IMAGE_OP_FILE_CLOSE, + H5FD_FILE_IMAGE_OP_FILE_CLOSE } H5FD_file_image_op_t; /* Define structure to hold file image callbacks */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 7335198..ee89bde 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -70,10 +70,10 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t; *(p) = (uint8_t)(((i) >> 24) & 0xff); (p)++; \ } -/* Encode a 32-bit unsigned integer into a variable-sized buffer */ +/* Encode an unsigned integer into a variable-sized buffer */ /* (Assumes that the high bits of the integer are zero) */ -# define UINT32ENCODE_VAR(p, n, l) { \ - uint32_t _n = (n); \ +# define ENCODE_VAR(p, typ, n, l) { \ + typ _n = (n); \ size_t _i; \ uint8_t *_p = (uint8_t*)(p); \ \ @@ -82,6 +82,10 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t; (p) = (uint8_t*)(p) + l; \ } +/* Encode a 32-bit unsigned integer into a variable-sized buffer */ +/* (Assumes that the high bits of the integer are zero) */ +# define UINT32ENCODE_VAR(p, n, l) ENCODE_VAR(p, uint32_t, n, l) + # define INT64ENCODE(p, n) { \ int64_t _n = (n); \ size_t _i; \ @@ -108,15 +112,7 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t; /* Encode a 64-bit unsigned integer into a variable-sized buffer */ /* (Assumes that the high bits of the integer are zero) */ -# define UINT64ENCODE_VAR(p, n, l) { \ - uint64_t _n = (n); \ - size_t _i; \ - uint8_t *_p = (uint8_t*)(p); \ - \ - for(_i = 0; _i < l; _i++, _n >>= 8) \ - *_p++ = (uint8_t)(_n & 0xff); \ - (p) = (uint8_t*)(p) + l; \ -} +# define UINT64ENCODE_VAR(p, n, l) ENCODE_VAR(p, uint64_t, n, l) /* DECODE converts little endian bytes pointed by p to integer values and store * it in i. For signed values, need to do sign-extension when converting @@ -152,12 +148,9 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t; (i) |= ((uint32_t)(*(p) & 0xff) << 24); (p)++; \ } -/* Decode a variable-sized buffer into a 32-bit unsigned integer */ +/* Decode a variable-sized buffer */ /* (Assumes that the high bits of the integer will be zero) */ -/* (Note: this is exactly the same code as the 64-bit variable-length decoder - * and bugs/improvements should be make in both places - QAK) - */ -# define UINT32DECODE_VAR(p, n, l) { \ +# define DECODE_VAR(p, n, l) { \ size_t _i; \ \ n = 0; \ @@ -167,6 +160,10 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t; (p) += l; \ } +/* Decode a variable-sized buffer into a 32-bit unsigned integer */ +/* (Assumes that the high bits of the integer will be zero) */ +# define UINT32DECODE_VAR(p, n, l) DECODE_VAR(p, n, l) + # define INT64DECODE(p, n) { \ /* WE DON'T CHECK FOR OVERFLOW! */ \ size_t _i; \ @@ -191,18 +188,7 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t; /* Decode a variable-sized buffer into a 64-bit unsigned integer */ /* (Assumes that the high bits of the integer will be zero) */ -/* (Note: this is exactly the same code as the 32-bit variable-length decoder - * and bugs/improvements should be make in both places - QAK) - */ -# define UINT64DECODE_VAR(p, n, l) { \ - size_t _i; \ - \ - n = 0; \ - (p) += l; \ - for (_i = 0; _i < l; _i++) \ - n = (n << 8) | *(--p); \ - (p) += l; \ -} +# define UINT64DECODE_VAR(p, n, l) DECODE_VAR(p, n, l) /* Address-related macros */ #define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \ diff --git a/src/H5Gcache.c b/src/H5Gcache.c index 1d2ad8b..15dbf65 100644 --- a/src/H5Gcache.c +++ b/src/H5Gcache.c @@ -302,7 +302,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5G_node_dest(H5F_t *f, H5G_node_t *sym) { herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 904def4..d579da6 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -1369,7 +1369,7 @@ H5G__node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr if(H5G__stab_insert_real(udata->dst_file, udata->dst_stab, name, &lnk, obj_type, (obj_type == H5O_TYPE_GROUP ? &gcrt_info : NULL), dxpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "unable to insert the name") + HGOTO_ERROR_TAG(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "unable to insert the name") /* Reset metadata tag */ H5_END_TAG(H5_ITER_ERROR); diff --git a/src/H5Gtest.c b/src/H5Gtest.c index 4d41409..e83097e 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -399,31 +399,31 @@ H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) /* Get the link info */ if(H5G__obj_get_linfo(&(grp->oloc), &linfo, H5AC_dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info") + HGOTO_ERROR_TAG(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info") /* Check for 'dense' link storage file addresses being defined */ if(!H5F_addr_defined(linfo.fheap_addr)) - HGOTO_DONE(FAIL) + HGOTO_DONE_TAG(FAIL, FAIL) if(!H5F_addr_defined(linfo.name_bt2_addr)) - HGOTO_DONE(FAIL) + HGOTO_DONE_TAG(FAIL, FAIL) /* Open the name index v2 B-tree */ if(NULL == (bt2_name = H5B2_open(grp->oloc.file, H5AC_dxpl_id, linfo.name_bt2_addr, NULL, NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Retrieve # of records in name index */ if(H5B2_get_nrec(bt2_name, name_count) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index") + HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index") /* Check if there is a creation order index */ if(H5F_addr_defined(linfo.corder_bt2_addr)) { /* Open the creation order index v2 B-tree */ if(NULL == (bt2_corder = H5B2_open(grp->oloc.file, H5AC_dxpl_id, linfo.corder_bt2_addr, NULL, NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") + HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") /* Retrieve # of records in creation order index */ if(H5B2_get_nrec(bt2_corder, corder_count) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from creation order index") + HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from creation order index") } /* end if */ else *corder_count = 0; diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 291734e..e10065c 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -855,7 +855,7 @@ H5G_traverse(const H5G_loc_t *loc, const char *name, unsigned target, H5G_traver if(H5P_get(lapl, H5L_ACS_NLINKS_NAME, &nlinks) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of links") } /* end else */ - + /* Set up invalid tag. This is a precautionary step only. Setting an invalid tag here will ensure that no metadata accessed while doing the traversal is given an improper tag, unless another one is specifically set up @@ -866,7 +866,7 @@ H5G_traverse(const H5G_loc_t *loc, const char *name, unsigned target, H5G_traver /* Go perform "real" traversal */ if(H5G_traverse_real(loc, name, target, &nlinks, op, op_data, lapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "internal path traversal failed") + HGOTO_ERROR_TAG(H5E_SYM, H5E_NOTFOUND, FAIL, "internal path traversal failed") /* Reset tag after traversal */ H5_END_TAG(FAIL); diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index caaedc7..76c7b96 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -80,7 +80,7 @@ typedef struct { /* Local Prototypes */ /********************/ -static herr_t H5HF_dtable_debug(H5HF_dtable_t *dtable, FILE *stream, +static herr_t H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwidth); @@ -113,7 +113,7 @@ static herr_t H5HF_dtable_debug(H5HF_dtable_t *dtable, FILE *stream, *------------------------------------------------------------------------- */ static herr_t -H5HF_dtable_debug(H5HF_dtable_t *dtable, FILE *stream, int indent, int fwidth) +H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwidth) { FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5HFsection.c b/src/H5HFsection.c index 87fa069..e9ea7e0 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -651,9 +651,7 @@ herr_t H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *sect, haddr_t *dblock_addr, size_t *dblock_size) { - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI_NOERR /* * Check arguments. @@ -678,8 +676,7 @@ H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, hid_t dxpl_id, *dblock_size = hdr->man_dtable.row_block_size[sect->u.single.par_entry / hdr->man_dtable.cparam.width]; } /* end else */ -done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HF_sect_single_dblock_info() */ diff --git a/src/H5O.c b/src/H5O.c index c43236a..7451a1b 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1259,7 +1259,7 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, size_t initial_rc, /* Cache object header */ if(H5AC_insert_entry(f, dxpl_id, H5AC_OHDR, oh_addr, oh, insert_flags) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header") oh = NULL; /* Reset metadata tag in dxpl_id */ @@ -1718,7 +1718,7 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot) while(curr_msg < cont_msg_info.nmsgs) { H5O_chunk_proxy_t *chk_proxy; /* Proxy for chunk, to bring it into memory */ #ifndef NDEBUG - unsigned chkcnt = oh->nchunks; /* Count of chunks (for sanity checking) */ + size_t chkcnt = oh->nchunks; /* Count of chunks (for sanity checking) */ #endif /* NDEBUG */ /* Bring the chunk into the cache */ @@ -2008,15 +2008,15 @@ H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force) /* Check version, to determine how to store time information */ if(oh->version == H5O_VERSION_1) { - int idx; /* Index of modification time message to update */ + size_t idx; /* Index of modification time message to update */ /* Look for existing message */ - for(idx = 0; idx < (int)oh->nmesgs; idx++) + for(idx = 0; idx < oh->nmesgs; idx++) if(H5O_MSG_MTIME == oh->mesg[idx].type || H5O_MSG_MTIME_NEW == oh->mesg[idx].type) break; /* Create a new message, if necessary */ - if(idx == (int)oh->nmesgs) { + if(idx == 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 */ @@ -2024,7 +2024,7 @@ H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force) HGOTO_DONE(SUCCEED); /*nothing to do*/ /* Allocate space for the modification time message */ - if((idx = H5O_msg_alloc(f, dxpl_id, oh, H5O_MSG_MTIME_NEW, &mesg_flags, &now)) < 0) + if(H5O_msg_alloc(f, dxpl_id, oh, H5O_MSG_MTIME_NEW, &mesg_flags, &now, &idx) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for modification time message") /* Set the message's flags if appropriate */ @@ -2131,7 +2131,7 @@ done: herr_t H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags) { - int idx; /* Local index variable */ + size_t idx; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2140,7 +2140,7 @@ H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags) HDassert(oh); /* Look for existing message */ - for(idx = 0; idx < (int)oh->nmesgs; idx++) + for(idx = 0; idx < oh->nmesgs; idx++) if(H5O_MSG_BOGUS == oh->mesg[idx].type) break; @@ -2156,7 +2156,7 @@ H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags) bogus->u = H5O_BOGUS_VALUE; /* Allocate space in the object header for bogus message */ - if((idx = H5O_msg_alloc(f, dxpl_id, oh, H5O_MSG_BOGUS, &mesg_flags, bogus)) < 0) + if(H5O_msg_alloc(f, dxpl_id, oh, H5O_MSG_BOGUS, &mesg_flags, bogus, &idx) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message") /* Point to "bogus" information (take it over) */ @@ -2716,8 +2716,8 @@ H5O_get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr) hdr->version = oh->version; /* Set the number of messages & chunks */ - hdr->nmesgs = oh->nmesgs; - hdr->nchunks = oh->nchunks; + H5_ASSIGN_OVERFLOW(hdr->nmesgs, oh->nmesgs, size_t, unsigned); + H5_ASSIGN_OVERFLOW(hdr->nchunks, oh->nchunks, size_t, unsigned); /* Set the status flags */ hdr->flags = oh->flags; diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index b6aa4fc..bbdfe2e 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -196,7 +196,7 @@ H5O_ainfo_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const void /* The flags for the attribute indices */ flags = ainfo->track_corder ? H5O_AINFO_TRACK_CORDER : 0; - flags |= ainfo->index_corder ? H5O_AINFO_INDEX_CORDER : 0; + flags = (unsigned char)(flags | (ainfo->index_corder ? H5O_AINFO_INDEX_CORDER : 0)); *p++ = flags; /* Max. creation order value for the object */ @@ -284,12 +284,12 @@ H5O_ainfo_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void *_mesg) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Set return value */ - ret_value = 1 /* Version */ + ret_value = (size_t)(1 /* Version */ + 1 /* Index flags */ + (ainfo->track_corder ? 2 : 0) /* Curr. max. creation order value */ + H5F_SIZEOF_ADDR(f) /* Address of fractal heap to store "dense" attributes */ + H5F_SIZEOF_ADDR(f) /* Address of v2 B-tree for indexing names of attributes */ - + (ainfo->index_corder ? H5F_SIZEOF_ADDR(f) : 0); /* Address of v2 B-tree for indexing creation order values of attributes */ + + (ainfo->index_corder ? H5F_SIZEOF_ADDR(f) : 0)); /* Address of v2 B-tree for indexing creation order values of attributes */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_ainfo_size() */ @@ -436,7 +436,7 @@ H5O_ainfo_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, /*!FIXME Must pass something for the parent, once we have a way to * depend on an object being copied (ohdr proxy?) -NAF */ if(H5A_dense_create(file_dst, dxpl_id, ainfo_dst, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to create dense storage for attributes") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINIT, NULL, "unable to create dense storage for attributes") /* Reset metadata tag */ H5_END_TAG(NULL); diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index 05322af..5c00fb2 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -59,14 +59,15 @@ /********************/ static herr_t H5O_add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, - hbool_t *chk_dirtied, unsigned idx, uint8_t *new_gap_loc, size_t new_gap_size); + hbool_t *chk_dirtied, size_t idx, uint8_t *new_gap_loc, size_t new_gap_size); static herr_t H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg, uint8_t *new_gap_loc, size_t new_gap_size); -static herr_t H5O_alloc_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned null_idx, +static herr_t H5O_alloc_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t null_idx, const H5O_msg_class_t *new_type, void *new_native, size_t new_size); static htri_t H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, - unsigned chunkno, size_t size, int *msg_idx); -static int H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size); + unsigned chunkno, size_t size, size_t *msg_idx); +static herr_t H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size, + size_t *new_idx); static htri_t H5O_move_cont(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned cont_u); static htri_t H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh); static htri_t H5O_merge_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh); @@ -109,10 +110,10 @@ H5FL_EXTERN(H5O_cont_t); */ static herr_t H5O_add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, hbool_t *chk_dirtied, - unsigned idx, uint8_t *new_gap_loc, size_t new_gap_size) + size_t idx, uint8_t *new_gap_loc, size_t new_gap_size) { hbool_t merged_with_null; /* Whether the gap was merged with a null message */ - unsigned u; /* Local index variable */ + size_t u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -335,7 +336,7 @@ H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg, *------------------------------------------------------------------------- */ static herr_t -H5O_alloc_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned null_idx, +H5O_alloc_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t null_idx, const H5O_msg_class_t *new_type, void *new_native, size_t new_size) { H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */ @@ -505,7 +506,7 @@ done: */ static htri_t H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno, - size_t size, int *msg_idx) + size_t size, size_t *msg_idx) { H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */ hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */ @@ -514,11 +515,12 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno, uint8_t *old_image; /* Old address of chunk's image in memory */ size_t old_size; /* Old size of chunk */ htri_t extended; /* If chunk can be extended */ - int extend_msg = -1;/* Index of null message to extend */ + size_t extend_msg; /* Index of null message to extend */ + hbool_t extended_msg = FALSE; /* Whether an existing message was extended */ uint8_t new_size_flags = 0; /* New chunk #0 size flags */ hbool_t adjust_size_flags = FALSE; /* Whether to adjust the chunk #0 size flags */ size_t extra_prfx_size = 0; /* Extra bytes added to object header prefix */ - unsigned u; /* Local index variable */ + size_t u; /* Local index variable */ htri_t ret_value = TRUE; /* return value */ FUNC_ENTER_NOAPI_NOINIT @@ -542,13 +544,14 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno, == ((oh->chunk[chunkno].image + oh->chunk[chunkno].size) - (oh->chunk[chunkno].gap + H5O_SIZEOF_CHKSUM_OH(oh))))) { - extend_msg = (int)u; + extend_msg = u; + extended_msg = TRUE; break; } /* end if */ } /* end for */ /* If we can extend an existing null message, adjust the delta appropriately */ - if(extend_msg >= 0) { + if(extended_msg) { HDassert(oh->chunk[chunkno].gap == 0); delta = aligned_size - oh->mesg[extend_msg].raw_size; } /* end if */ @@ -598,7 +601,7 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno, /* Adjust object header prefix flags */ if(adjust_size_flags) { - oh->flags &= (uint8_t)~H5O_HDR_CHUNK0_SIZE; + oh->flags = (uint8_t)(oh->flags & ~H5O_HDR_CHUNK0_SIZE); oh->flags |= new_size_flags; /* Mark object header as dirty in cache */ @@ -607,7 +610,7 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno, } /* end if */ /* If we can extend an existing null message, take care of that */ - if(extend_msg >= 0) { + if(extended_msg) { /* Adjust message size of existing null message */ oh->mesg[extend_msg].raw_size += delta; } /* end if */ @@ -619,7 +622,7 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") /* Set extension message */ - extend_msg = (int)oh->nmesgs++; + extend_msg = oh->nmesgs++; /* Initialize new null message */ oh->mesg[extend_msg].type = H5O_MSG_NULL; @@ -690,7 +693,7 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno, if(H5O_chunk_resize(oh, chk_proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize object header chunk") - /* Set return value */ + /* Set new message index */ *msg_idx = extend_msg; done: @@ -737,8 +740,8 @@ done: * *------------------------------------------------------------------------- */ -static int -H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size) +static herr_t +H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size, size_t *new_idx) { /* Struct for storing information about "best" messages to allocate from */ typedef struct { @@ -756,13 +759,13 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size) int found_null = (-1); /* Best fit null message */ alloc_info found_attr = {-1, 0, 0, 0, 0}; /* Best fit attribute message */ alloc_info found_other = {-1, 0, 0, 0, 0}; /* Best fit other message */ - unsigned idx; /*message number */ + size_t idx; /* Message number */ uint8_t *p = NULL; /*ptr into new chunk */ H5O_cont_t *cont = NULL; /*native continuation message */ unsigned chunkno; /* Chunk allocated */ haddr_t new_chunk_addr; unsigned u; /* Local index variable */ - int ret_value; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1089,11 +1092,11 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size) cont->chunkno = chunkno; /* Split the null message and point at continuation message */ - if(H5O_alloc_null(f, dxpl_id, oh, (unsigned)found_null, H5O_MSG_CONT, cont, cont_size) < 0) + if(H5O_alloc_null(f, dxpl_id, oh, (size_t)found_null, H5O_MSG_CONT, cont, cont_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't split null message") - /* Set return value */ - ret_value = (int)idx; + /* Set new message index value */ + *new_idx = idx; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1114,14 +1117,14 @@ done: * *------------------------------------------------------------------------- */ -int +herr_t H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, - const void *mesg) + const void *mesg, size_t *mesg_idx) { - size_t raw_size; /* Raw size of message */ - size_t aligned_size; /* Size of message including alignment */ - int idx; /* Index of message which fits allocation */ - int ret_value; /* Return value */ + size_t raw_size; /* Raw size of message */ + size_t aligned_size; /* Size of message including alignment */ + size_t idx; /* Index of message which fits allocation */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1129,6 +1132,7 @@ H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, HDassert(oh); HDassert(type); HDassert(mesg); + HDassert(mesg_idx); /* Compute the size needed to store the message in the object header */ raw_size = (type->raw_size)(f, FALSE, mesg); @@ -1139,12 +1143,12 @@ H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, aligned_size = H5O_ALIGN_OH(oh, raw_size); /* look for a null message which is large enough */ - for(idx = 0; idx < (int)oh->nmesgs; idx++) + for(idx = 0; idx < oh->nmesgs; idx++) if(H5O_NULL_ID == oh->mesg[idx].type->id && oh->mesg[idx].raw_size >= aligned_size) break; /* if we didn't find one, then allocate more header space */ - if(idx >= (int)oh->nmesgs) { + if(idx >= oh->nmesgs) { unsigned chunkno; /* check to see if we can extend one of the chunks. If we can, @@ -1163,22 +1167,22 @@ H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, } /* end for */ /* If we were not able to extend a chunk, create a new one */ - if(idx >= (int)oh->nmesgs) - if((idx = H5O_alloc_new_chunk(f, dxpl_id, oh, raw_size)) < 0) + if(idx >= oh->nmesgs) + if(H5O_alloc_new_chunk(f, dxpl_id, oh, raw_size, &idx) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "unable to create a new object header data chunk") } /* end if */ - HDassert(idx >= 0 && idx < (int)oh->nmesgs); + HDassert(idx < oh->nmesgs); /* Split the null message and point at continuation message */ - if(H5O_alloc_null(f, dxpl_id, oh, (unsigned)idx, type, NULL, aligned_size) < 0) + if(H5O_alloc_null(f, dxpl_id, oh, idx, type, NULL, aligned_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't split null message") /* Mark object header as dirty in cache */ if(H5AC_mark_entry_dirty(oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") - /* Set return value */ - ret_value = (int)idx; + /* Set message index value */ + *mesg_idx = idx; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1296,7 +1300,7 @@ H5O_move_cont(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned cont_u) size_t nonnull_size; /* Total size of nonnull messages in the chunk pointed to by cont message */ H5O_mesg_t *curr_msg; /* Pointer to the current message to operate on */ size_t gap_size; /* Size of gap produced */ - unsigned v; /* Local index variable */ + size_t v; /* Local index variable */ /* Spin through messages */ nonnull_size = 0; @@ -1533,7 +1537,7 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh) } /* end if */ else { H5O_mesg_t *null_msg; /* Pointer to current message to operate on */ - unsigned v; /* Local index variable */ + size_t v; /* Local index variable */ /* Check if messages in chunk pointed to can replace continuation message */ if(H5O_CONT_ID == curr_msg->type->id) { @@ -1607,7 +1611,7 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh) null_chk_dirtied = FALSE; } /* end if */ else { - unsigned new_null_msg; /* Message index for new null message */ + size_t new_null_msg; /* Message index for new null message */ /* Check if null message is large enough to still exist */ if((null_msg->raw_size - curr_msg->raw_size) < (size_t)H5O_SIZEOF_MSGHDR_OH(oh)) { @@ -2135,8 +2139,8 @@ H5O_alloc_shrink_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno) uint8_t new_size_flags = 0; /* New chunk #0 size flags */ hbool_t adjust_size_flags = FALSE; /* Whether to adjust the chunk #0 size flags */ size_t less_prfx_size = 0; /* Bytes removed from object header prefix */ + size_t u; /* Index */ herr_t ret_value = SUCCEED; /* Return value */ - unsigned u; /* Index */ FUNC_ENTER_NOAPI_NOINIT @@ -2237,7 +2241,7 @@ H5O_alloc_shrink_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno) if(adjust_size_flags) { /* Adjust object header prefix flags */ - oh->flags &= (uint8_t)~H5O_HDR_CHUNK0_SIZE; + oh->flags = (uint8_t)(oh->flags & ~H5O_HDR_CHUNK0_SIZE); oh->flags |= new_size_flags; /* Slide chunk 0 data down */ diff --git a/src/H5Oattr.c b/src/H5Oattr.c index 510d64f..b8e6b32 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -300,7 +300,7 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg) if(attr->shared->version >= H5O_ATTR_VERSION_2) { flags = (is_type_shared ? H5O_ATTR_FLAG_TYPE_SHARED : 0 ); flags |= (is_space_shared ? H5O_ATTR_FLAG_SPACE_SHARED : 0); - *p++ = flags; /* Set flags for attribute */ + *p++ = (uint8_t)flags; /* Set flags for attribute */ } /* end if */ else *p++ = 0; /* Reserved, for version <2 */ @@ -723,7 +723,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5O_attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx /*out*/) { const H5A_t *attr = (const H5A_t *)_mesg; @@ -753,7 +753,7 @@ H5O_attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx /*out*/) * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5O_attr_set_crt_index(void *_mesg, H5O_msg_crt_idx_t crt_idx) { H5A_t *attr = (H5A_t *)_mesg; diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 2c33ebe..f09f693 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -658,7 +658,7 @@ H5O_size(const H5F_t UNUSED *f, const H5O_t *oh, size_t *size_ptr) /* Report the object header's prefix+first chunk length */ if(oh->chunk0_size) - *size_ptr = H5O_SIZEOF_HDR(oh) + oh->chunk0_size; + *size_ptr = (size_t)H5O_SIZEOF_HDR(oh) + oh->chunk0_size; else *size_ptr = oh->chunk[0].size; @@ -983,7 +983,7 @@ H5O_cache_chk_size(const H5F_t UNUSED *f, const H5O_chunk_proxy_t *chk_proxy, si static herr_t H5O_add_cont_msg(H5O_cont_msgs_t *cont_msg_info, const H5O_cont_t *cont) { - unsigned contno; /* Continuation message index */ + size_t contno; /* Continuation message index */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1034,7 +1034,7 @@ H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image, { const uint8_t *p; /* Pointer into buffer to decode */ uint8_t *eom_ptr; /* Pointer to end of messages for a chunk */ - unsigned curmesg; /* Current message being decoded in object header */ + size_t curmesg; /* Current message being decoded in object header */ unsigned merged_null_msgs = 0; /* Number of null messages merged together */ unsigned chunkno; /* Current chunk's index */ #ifndef NDEBUG @@ -1104,7 +1104,7 @@ H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image, nullcnt = 0; #endif /* NDEBUG */ while(p < eom_ptr) { - unsigned mesgno; /* Current message to operate on */ + size_t mesgno; /* Current message to operate on */ size_t mesg_size; /* Size of message read in */ unsigned id; /* ID (type) of current message */ uint8_t flags; /* Flags for current message */ @@ -1166,7 +1166,7 @@ H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image, /* Combine adjacent null messages */ mesgno = oh->nmesgs - 1; - oh->mesg[mesgno].raw_size += H5O_SIZEOF_MSGHDR_OH(oh) + mesg_size; + oh->mesg[mesgno].raw_size += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + mesg_size; oh->mesg[mesgno].dirty = TRUE; merged_null_msgs++; udata->merged_null_msgs++; diff --git a/src/H5Ocont.c b/src/H5Ocont.c index b609bfd..647532b 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -179,8 +179,8 @@ H5O_cont_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void UNUSED * FUNC_ENTER_NOAPI_NOINIT_NOERR /* Set return value */ - ret_value = H5F_SIZEOF_ADDR(f) + /* Continuation header address */ - H5F_SIZEOF_SIZE(f); /* Continuation header length */ + ret_value = (size_t)(H5F_SIZEOF_ADDR(f) + /* Continuation header address */ + H5F_SIZEOF_SIZE(f)); /* Continuation header length */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_cont_size() */ diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 7b812ec..1d1aa90 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -342,7 +342,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, void *cpy_udata = NULL; /* User data for passing to message callbacks */ uint64_t dst_oh_size; /* Total size of the destination OH */ size_t dst_oh_null; /* Size of the null message to add to destination OH */ - unsigned dst_oh_gap; /* Size of the gap in chunk #0 of destination OH */ + size_t dst_oh_gap; /* Size of the gap in chunk #0 of destination OH */ uint8_t *current_pos; /* Current position in destination image */ size_t msghdr_size; herr_t ret_value = SUCCEED; @@ -629,14 +629,14 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, /* Compute space for messages. */ dst_oh_size = 0; for(mesgno = 0; mesgno < oh_dst->nmesgs; mesgno++) { - dst_oh_size += H5O_SIZEOF_MSGHDR_OH(oh_dst); + dst_oh_size += (uint64_t)H5O_SIZEOF_MSGHDR_OH(oh_dst); dst_oh_size += oh_dst->mesg[mesgno].raw_size; } /* end for */ /* Check if we need to determine correct value for chunk #0 size bits */ if(oh_dst->version > H5O_VERSION_1) { /* Reset destination object header's "chunk 0 size" flags */ - oh_dst->flags &= ~H5O_HDR_CHUNK0_SIZE; + oh_dst->flags = (uint8_t)(oh_dst->flags & ~H5O_HDR_CHUNK0_SIZE); /* Determine correct value for chunk #0 size bits */ if(dst_oh_size > 4294967295) @@ -745,7 +745,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, /* Check if we need to add a NULL message to this header */ if(dst_oh_null > 0) { - unsigned null_idx; /* Index of new NULL message */ + size_t null_idx; /* Index of new NULL message */ /* Make sure we have enough space for new NULL message */ if(oh_dst->nmesgs + 1 > oh_dst->alloc_nmesgs) @@ -862,7 +862,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, /* Insert destination object header in cache */ 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") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header") oh_dst = NULL; inserted = TRUE; @@ -1413,7 +1413,7 @@ H5O_copy_free_comm_dt_cb(void *item, void *_key, void UNUSED *op_data) haddr_t *addr = (haddr_t *)item; H5O_copy_search_comm_dt_key_t *key = (H5O_copy_search_comm_dt_key_t *)_key; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI_NOINIT_NOERR HDassert(addr); HDassert(key); @@ -1449,7 +1449,7 @@ H5O_copy_comm_dt_cmp(const void *_key1, const void *_key2) const H5O_copy_search_comm_dt_key_t *key2 = (const H5O_copy_search_comm_dt_key_t *)_key2; int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check fileno. It is unlikely to be different so check if they are equal * first so only one comparison needs to be made. */ diff --git a/src/H5Odbg.c b/src/H5Odbg.c index 5c07b64..5901c61 100644 --- a/src/H5Odbg.c +++ b/src/H5Odbg.c @@ -398,7 +398,7 @@ H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, i if(0 == i) { if(H5F_addr_ne(oh->chunk[i].addr, addr)) HDfprintf(stream, "*** WRONG ADDRESS FOR CHUNK #0!\n"); - chunk_size = oh->chunk[i].size - H5O_SIZEOF_HDR(oh); + chunk_size = oh->chunk[i].size - (size_t)H5O_SIZEOF_HDR(oh); } /* end if */ else chunk_size = oh->chunk[i].size; @@ -424,7 +424,7 @@ H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, i unsigned chunkno; /* Chunk for message */ /* Accumulate message's size to total */ - mesg_total += H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[i].raw_size; + mesg_total += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[i].raw_size; /* For version 2 object header, add size of "OCHK" for continuation chunk */ if (oh->mesg[i].type->id == H5O_CONT_ID) diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 6158fd9..b482115 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -626,6 +626,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) case H5T_ORDER_ERROR: case H5T_ORDER_VAX: + case H5T_ORDER_MIXED: case H5T_ORDER_NONE: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "byte order is not supported in file format yet") @@ -696,6 +697,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) HDassert(dt->shared->version >= H5O_DTYPE_VERSION_3); break; + case H5T_ORDER_MIXED: case H5T_ORDER_ERROR: case H5T_ORDER_NONE: default: @@ -764,7 +766,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "normalization scheme is not supported in file format yet") } /* end switch */ - flags |= (dt->shared->u.atomic.u.f.sign << 8) & 0xff00; + flags = (unsigned)(flags | ((dt->shared->u.atomic.u.f.sign << 8) & 0xff00)); UINT16ENCODE(*pp, dt->shared->u.atomic.offset); UINT16ENCODE(*pp, dt->shared->u.atomic.prec); HDassert(dt->shared->u.atomic.u.f.epos <= 255); @@ -787,8 +789,9 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) flags |= 0x01; break; - case H5T_ORDER_ERROR: case H5T_ORDER_VAX: + case H5T_ORDER_MIXED: + case H5T_ORDER_ERROR: case H5T_ORDER_NONE: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "byte order is not supported in file format yet") @@ -806,8 +809,8 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) HDassert(dt->shared->u.atomic.lsb_pad == H5T_PAD_ZERO); HDassert(dt->shared->u.atomic.msb_pad == H5T_PAD_ZERO); - flags |= (dt->shared->u.atomic.u.s.pad & 0x0f); - flags |= (dt->shared->u.atomic.u.s.cset & 0x0f) << 4; + flags = (unsigned)(flags | (dt->shared->u.atomic.u.s.pad & 0x0f)); + flags = (unsigned)(flags | ((((unsigned)dt->shared->u.atomic.u.s.cset) & 0x0f) << 4)); break; case H5T_BITFIELD: @@ -822,8 +825,9 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) flags |= 0x01; break; - case H5T_ORDER_ERROR: case H5T_ORDER_VAX: + case H5T_ORDER_MIXED: + case H5T_ORDER_ERROR: case H5T_ORDER_NONE: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "byte order is not supported in file format yet") @@ -874,7 +878,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) z = HDstrlen(dt->shared->u.opaque.tag); aligned = (z + 7) & (H5T_OPAQUE_TAG_MAX - 8); - flags |= aligned; + flags = (unsigned)(flags | aligned); HDmemcpy(*pp, dt->shared->u.opaque.tag, MIN(z,aligned)); for(n = MIN(z, aligned); n < aligned; n++) (*pp)[n] = 0; @@ -918,7 +922,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) /* Member offset */ /* (starting with version 3 of the datatype message, use the minimum # of bytes required) */ if(dt->shared->version >= H5O_DTYPE_VERSION_3) - UINT32ENCODE_VAR(*pp, dt->shared->u.compnd.memb[i].offset, offset_nbytes) + UINT32ENCODE_VAR(*pp, (uint32_t)dt->shared->u.compnd.memb[i].offset, offset_nbytes) else UINT32ENCODE(*pp, dt->shared->u.compnd.memb[i].offset) @@ -1000,8 +1004,8 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) flags |= (dt->shared->u.vlen.type & 0x0f); if(dt->shared->u.vlen.type == H5T_VLEN_STRING) { - flags |= (dt->shared->u.vlen.pad & 0x0f) << 4; - flags |= ((unsigned)dt->shared->u.vlen.cset & 0x0f) << 8; + flags = (unsigned)(flags | (((unsigned)dt->shared->u.vlen.pad & 0x0f) << 4)); + flags = (unsigned)(flags | (((unsigned)dt->shared->u.vlen.cset & 0x0f) << 8)); } /* end if */ /* Encode base type of VL information */ @@ -1599,7 +1603,7 @@ H5O_dtype_shared_post_copy_upd(const H5O_loc_t UNUSED *src_oloc, { H5T_t *dt_dst = (H5T_t *)mesg_dst; /* Destination datatype */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI_NOINIT_NOERR if(dt_dst->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) { HDassert(H5T_committed(dt_dst)); @@ -1977,6 +1981,10 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, s = "none"; break; + case H5T_ORDER_MIXED: + s = "mixed"; + break; + case H5T_ORDER_ERROR: default: sprintf(buf, "H5T_ORDER_%d", dt->shared->u.atomic.order); diff --git a/src/H5Oefl.c b/src/H5Oefl.c index 4b4e257..14f9089 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -230,7 +230,7 @@ H5O_efl_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const void * */ HDassert(mesg->slot[u].name_offset); H5F_ENCODE_LENGTH(f, p, mesg->slot[u].name_offset); - H5F_ENCODE_LENGTH(f, p, mesg->slot[u].offset); + H5F_ENCODE_LENGTH(f, p, (hsize_t)mesg->slot[u].offset); H5F_ENCODE_LENGTH(f, p, mesg->slot[u].size); } /* end for */ @@ -351,13 +351,13 @@ H5O_efl_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void *_mesg) HDassert(f); HDassert(mesg); - ret_value = H5F_SIZEOF_ADDR(f) + /*heap address */ + ret_value = (size_t)H5F_SIZEOF_ADDR(f) + /*heap address */ 2 + /*slots allocated*/ 2 + /*num slots used*/ 4 + /*reserved */ - mesg->nused * (H5F_SIZEOF_SIZE(f) + /*name offset */ - H5F_SIZEOF_SIZE(f) + /*file offset */ - H5F_SIZEOF_SIZE(f)); /*file size */ + mesg->nused * ((size_t)H5F_SIZEOF_SIZE(f) + /*name offset */ + (size_t)H5F_SIZEOF_SIZE(f) + /*file offset */ + (size_t)H5F_SIZEOF_SIZE(f)); /*file size */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_efl_size() */ diff --git a/src/H5Ofill.c b/src/H5Ofill.c index f5569dc..1e8ccb1 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -397,11 +397,11 @@ H5O_fill_new_encode(H5F_t UNUSED *f, uint8_t *p, const void *_fill) /* Encode space allocation time */ HDassert(fill->alloc_time == (H5O_FILL_MASK_ALLOC_TIME & fill->alloc_time)); - flags |= (H5O_FILL_MASK_ALLOC_TIME & fill->alloc_time) << H5O_FILL_SHIFT_ALLOC_TIME; + flags = (uint8_t)(flags | ((H5O_FILL_MASK_ALLOC_TIME & fill->alloc_time) << H5O_FILL_SHIFT_ALLOC_TIME)); /* Encode fill value writing time */ HDassert(fill->fill_time == (H5O_FILL_MASK_FILL_TIME & fill->fill_time)); - flags |= (H5O_FILL_MASK_FILL_TIME & fill->fill_time) << H5O_FILL_SHIFT_FILL_TIME; + flags = (uint8_t)(flags | ((H5O_FILL_MASK_FILL_TIME & fill->fill_time) << H5O_FILL_SHIFT_FILL_TIME)); /* Check if we need to encode a fill value size */ if(fill->size < 0) { @@ -833,10 +833,11 @@ H5O_fill_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_fill, FILE *s fprintf(stream,"Incremental\n"); break; + case H5D_ALLOC_TIME_DEFAULT: + case H5D_ALLOC_TIME_ERROR: default: fprintf(stream,"Unknown!\n"); break; - } /* end switch */ HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Fill Time:"); switch(fill->fill_time) { @@ -852,6 +853,7 @@ H5O_fill_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_fill, FILE *s fprintf(stream,"If Set\n"); break; + case H5D_FILL_TIME_ERROR: default: fprintf(stream,"Unknown!\n"); break; @@ -872,6 +874,7 @@ H5O_fill_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_fill, FILE *s fprintf(stream,"User Defined\n"); break; + case H5D_FILL_VALUE_ERROR: default: fprintf(stream,"Unknown!\n"); break; diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index 3f0b15d..11bf43b 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -105,7 +105,7 @@ H5O_fsinfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, if(NULL == (fsinfo = H5FL_CALLOC(H5O_fsinfo_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - fsinfo->strategy = *p++; /* file space strategy */ + fsinfo->strategy = (H5F_file_space_type_t)*p++; /* file space strategy */ H5F_DECODE_LENGTH(f, p, fsinfo->threshold); /* free space section size threshold */ /* Addresses of free space managers: only exist for H5F_FILE_SPACE_ALL_PERSIST */ @@ -231,10 +231,10 @@ H5O_fsinfo_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void *_mesg /* Addresses of free-space managers exist only for H5F_FILE_SPACE_ALL_PERSIST type */ if(H5F_FILE_SPACE_ALL_PERSIST == fsinfo->strategy) - fs_addr_size = (H5FD_MEM_NTYPES - 1) * H5F_SIZEOF_ADDR(f); + fs_addr_size = (H5FD_MEM_NTYPES - 1) * (size_t)H5F_SIZEOF_ADDR(f); ret_value = 2 /* Version & strategy */ - + H5F_SIZEOF_SIZE(f) /* Threshold */ + + (size_t)H5F_SIZEOF_SIZE(f) /* Threshold */ + fs_addr_size; /* Addresses of free-space managers */ FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c index 418b053..d579984 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -184,7 +184,7 @@ H5O_ginfo_encode(H5F_t UNUSED *f, hbool_t UNUSED disable_shared, uint8_t *p, con /* The flags for the group info */ flags = ginfo->store_link_phase_change ? H5O_GINFO_STORE_PHASE_CHANGE : 0; - flags |= ginfo->store_est_entry_info ? H5O_GINFO_STORE_EST_ENTRY_INFO : 0; + flags = (unsigned char)(flags | (ginfo->store_est_entry_info ? H5O_GINFO_STORE_EST_ENTRY_INFO : 0)); *p++ = flags; /* Store the max. # of links to store compactly & the min. # of links to store densely */ @@ -273,12 +273,12 @@ H5O_ginfo_size(const H5F_t UNUSED *f, hbool_t UNUSED disable_shared, const void ret_value = 1 + /* Version */ 1 + /* Flags */ (ginfo->store_link_phase_change ? ( - 2 + /* "Max compact" links */ - 2 /* "Min dense" links */ + (size_t)(2 + /* "Max compact" links */ + 2) /* "Min dense" links */ ) : 0) + /* "Min dense" links */ (ginfo->store_est_entry_info ? ( - 2 + /* Estimated # of entries in group */ - 2 /* Estimated length of name of entry in group */ + (size_t)(2 + /* Estimated # of entries in group */ + 2) /* Estimated length of name of entry in group */ ) : 0); FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index e96483a..5d3d75c 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -206,7 +206,7 @@ H5O_linfo_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const void /* The flags for the link indices */ index_flags = linfo->track_corder ? H5O_LINFO_TRACK_CORDER : 0; - index_flags |= linfo->index_corder ? H5O_LINFO_INDEX_CORDER : 0; + index_flags = (uint8_t)(index_flags | (linfo->index_corder ? H5O_LINFO_INDEX_CORDER : 0)); *p++ = index_flags; /* Max. link creation order value for the group, if tracked */ @@ -296,10 +296,10 @@ H5O_linfo_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void *_mesg) /* Set return value */ ret_value = 1 /* Version */ + 1 /* Index flags */ - + (linfo->track_corder ? 8 : 0) /* Curr. max. creation order value */ - + H5F_SIZEOF_ADDR(f) /* Address of fractal heap to store "dense" links */ - + H5F_SIZEOF_ADDR(f) /* Address of v2 B-tree for indexing names of links */ - + (linfo->index_corder ? H5F_SIZEOF_ADDR(f) : 0); /* Address of v2 B-tree for indexing creation order values of links */ + + (linfo->track_corder ? (size_t)8 : 0) /* Curr. max. creation order value */ + + (size_t)H5F_SIZEOF_ADDR(f) /* Address of fractal heap to store "dense" links */ + + (size_t)H5F_SIZEOF_ADDR(f) /* Address of v2 B-tree for indexing names of links */ + + (linfo->index_corder ? (size_t)H5F_SIZEOF_ADDR(f) : 0); /* Address of v2 B-tree for indexing creation order values of links */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_linfo_size() */ @@ -474,7 +474,7 @@ H5O_linfo_post_copy_file_cb(const H5O_link_t *src_lnk, void *_udata) /* Insert the new object in the destination file's group */ /* (Doesn't increment the link count - that's already been taken care of for hard links) */ if(H5G__dense_insert(udata->dst_oloc->file, udata->dxpl_id, udata->dst_linfo, &dst_lnk) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, H5_ITER_ERROR, "unable to insert destination link") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINSERT, H5_ITER_ERROR, "unable to insert destination link") /* Reset metadata tag in dxpl_id */ H5_END_TAG(FAIL); diff --git a/src/H5Olink.c b/src/H5Olink.c index 88c9e28..4dda5fe 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -226,6 +226,9 @@ H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, break; /* User-defined links */ + case H5L_TYPE_EXTERNAL: + case H5L_TYPE_ERROR: + case H5L_TYPE_MAX: default: if(lnk->type < H5L_TYPE_UD_MIN || lnk->type > H5L_TYPE_MAX) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unknown link type") @@ -306,9 +309,9 @@ H5O_link_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const void link_flags = H5O_LINK_NAME_2; else link_flags = H5O_LINK_NAME_1; - link_flags |= lnk->corder_valid ? H5O_LINK_STORE_CORDER : 0; - link_flags |= (lnk->type != H5L_TYPE_HARD) ? H5O_LINK_STORE_LINK_TYPE : 0; - link_flags |= (lnk->cset != H5T_CSET_ASCII) ? H5O_LINK_STORE_NAME_CSET : 0; + link_flags = (unsigned char)(link_flags | (lnk->corder_valid ? H5O_LINK_STORE_CORDER : 0)); + link_flags = (unsigned char)(link_flags | ((lnk->type != H5L_TYPE_HARD) ? H5O_LINK_STORE_LINK_TYPE : 0)); + link_flags = (unsigned char)(link_flags | ((lnk->cset != H5T_CSET_ASCII) ? H5O_LINK_STORE_NAME_CSET : 0)); *p++ = link_flags; /* Store the type of a non-default link */ @@ -366,6 +369,9 @@ H5O_link_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const void break; /* User-defined links */ + case H5L_TYPE_EXTERNAL: + case H5L_TYPE_ERROR: + case H5L_TYPE_MAX: default: HDassert(lnk->type >= H5L_TYPE_UD_MIN && lnk->type <= H5L_TYPE_MAX); @@ -511,6 +517,9 @@ H5O_link_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void *_mesg) HDstrlen(lnk->u.soft.name); /* Link value */ break; + case H5L_TYPE_ERROR: + case H5L_TYPE_EXTERNAL: + case H5L_TYPE_MAX: default: /* Default is user-defined link type */ HDassert(lnk->type >= H5L_TYPE_UD_MIN); ret_value += 2 + /* User-defined data size */ @@ -837,6 +846,9 @@ H5O_link_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE * "Link Value:", lnk->u.soft.name); break; + case H5L_TYPE_ERROR: + case H5L_TYPE_EXTERNAL: + case H5L_TYPE_MAX: default: if(lnk->type >= H5L_TYPE_UD_MIN) { if(lnk->type == H5L_TYPE_EXTERNAL) { diff --git a/src/H5Omessage.c b/src/H5Omessage.c index c9a0997..1369583 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -76,7 +76,7 @@ typedef struct { static herr_t H5O_msg_reset_real(const H5O_msg_class_t *type, void *native); static herr_t H5O_msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, unsigned *oh_modified, void *_udata/*in,out*/); -static herr_t H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx, +static herr_t H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, const H5O_msg_class_t *type, const void *mesg, unsigned mesg_flags, unsigned update_flags); @@ -207,7 +207,7 @@ herr_t H5O_msg_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, unsigned mesg_flags, unsigned update_flags, void *mesg) { - int idx; /* Index of message to modify */ + size_t idx; /* Index of message to modify */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -220,11 +220,11 @@ H5O_msg_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *t HDassert(mesg); /* Allocate space for a new message */ - if((idx = H5O_msg_alloc(f, dxpl_id, oh, type, &mesg_flags, mesg)) < 0) + if(H5O_msg_alloc(f, dxpl_id, oh, type, &mesg_flags, mesg, &idx) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "unable to create new message") /* Copy the information for the message */ - if(H5O_copy_mesg(f, dxpl_id, oh, (unsigned)idx, type, mesg, mesg_flags, update_flags) < 0) + if(H5O_copy_mesg(f, dxpl_id, oh, idx, type, mesg, mesg_flags, update_flags) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to write message") #ifdef H5O_DEBUG H5O_assert(oh); @@ -364,7 +364,7 @@ H5O_msg_write_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *ty unsigned mesg_flags, unsigned update_flags, void *mesg) { H5O_mesg_t *idx_msg; /* Pointer to message to modify */ - unsigned idx; /* Index of message to modify */ + size_t idx; /* Index of message to modify */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -788,6 +788,7 @@ H5O_msg_count(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) { H5O_t *oh = NULL; /* Object header to operate on */ const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + unsigned msg_count; /* Message count */ int ret_value; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -805,7 +806,8 @@ H5O_msg_count(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") /* Count the messages of the correct type */ - ret_value = H5O_msg_count_real(oh, type); + msg_count = H5O_msg_count_real(oh, type); + H5_ASSIGN_OVERFLOW(ret_value, msg_count, unsigned, int); done: if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) @@ -1431,10 +1433,10 @@ H5O_msg_size_f(const H5F_t *f, hid_t ocpl_id, unsigned type_id, ret_value += extra_raw; /* Adjust size for alignment, if necessary */ - ret_value = H5O_ALIGN_F(f, ret_value); + ret_value = (size_t)H5O_ALIGN_F(f, ret_value); /* Add space for message header */ - ret_value += H5O_SIZEOF_MSGHDR_F(f, + ret_value += (size_t)H5O_SIZEOF_MSGHDR_F(f, (H5F_STORE_MSG_CRT_IDX(f) || oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)); done: @@ -1484,10 +1486,10 @@ H5O_msg_size_oh(const H5F_t *f, const H5O_t *oh, unsigned type_id, ret_value += extra_raw; /* Adjust size for alignment, if necessary */ - ret_value = H5O_ALIGN_OH(oh, ret_value); + ret_value = (size_t)H5O_ALIGN_OH(oh, ret_value); /* Add space for message header */ - ret_value += H5O_SIZEOF_MSGHDR_OH(oh); + ret_value += (size_t)H5O_SIZEOF_MSGHDR_OH(oh); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1894,12 +1896,13 @@ done: * *------------------------------------------------------------------------- */ -int +herr_t H5O_msg_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, - unsigned *mesg_flags, void *native) + unsigned *mesg_flags, void *native, size_t *mesg_idx) { + size_t new_idx; /* New index for message */ htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */ - int ret_value = FAIL; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1910,6 +1913,7 @@ H5O_msg_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, HDassert(!(*mesg_flags & H5O_MSG_FLAG_SHARED)); HDassert(type); HDassert(native); + HDassert(mesg_idx); /* Check if message is already shared */ if((shared_mesg = H5O_msg_is_shared(type->id, native)) < 0) @@ -1927,16 +1931,19 @@ H5O_msg_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, } /* end else */ /* Allocate space in the object header for the message */ - if((ret_value = H5O_alloc(f, dxpl_id, oh, type, native)) < 0) + if(H5O_alloc(f, dxpl_id, oh, type, native, &new_idx) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for message") /* Get the message's "creation index", if it has one */ if(type->get_crt_index) { /* Retrieve the creation index from the native message */ - if((type->get_crt_index)(native, &oh->mesg[ret_value].crt_idx) < 0) + if((type->get_crt_index)(native, &oh->mesg[new_idx].crt_idx) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve creation index") } /* end if */ + /* Set new message index */ + *mesg_idx = new_idx; + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_alloc() */ @@ -1956,7 +1963,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx, +H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, const H5O_msg_class_t *type, const void *mesg, unsigned mesg_flags, unsigned update_flags) { @@ -2293,7 +2300,7 @@ H5O_msg_get_chunkno(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message type not found") /* Set return value */ - ret_value = idx_msg->chunkno; + H5_ASSIGN_OVERFLOW(ret_value, idx_msg->chunkno, unsigned, int); done: if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 4108578..3eb5afb 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -538,8 +538,9 @@ H5_DLL herr_t H5O_dec_rc(H5O_t *oh); H5_DLL herr_t H5O_free(H5O_t *oh); /* Object header message routines */ -H5_DLL int H5O_msg_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, - const H5O_msg_class_t *type, unsigned *mesg_flags, void *mesg); +H5_DLL herr_t H5O_msg_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, + const H5O_msg_class_t *type, unsigned *mesg_flags, void *mesg, + size_t *mesg_idx); H5_DLL herr_t H5O_msg_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, unsigned mesg_flags, unsigned update_flags, void *mesg); @@ -573,8 +574,8 @@ H5_DLL herr_t H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, /* Object header allocation routines */ H5_DLL herr_t H5O_alloc_msgs(H5O_t *oh, size_t min_alloc); -H5_DLL int H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, - const H5O_msg_class_t *type, const void *mesg); +H5_DLL herr_t H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, + const H5O_msg_class_t *type, const void *mesg, size_t *mesg_idx); H5_DLL herr_t H5O_condense_header(H5F_t *f, H5O_t *oh, hid_t dxpl_id); H5_DLL herr_t H5O_release_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link); diff --git a/src/H5Opline.c b/src/H5Opline.c index f626106..1a2baa0 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -250,7 +250,7 @@ H5O_pline_encode(H5F_t UNUSED *f, uint8_t *p/*out*/, const void *mesg) HDassert(mesg); /* Message header */ - *p++ = pline->version; + *p++ = (uint8_t)pline->version; *p++ = (uint8_t)(pline->nused); if(pline->version == H5O_PLINE_VERSION_1) { *p++ = 0; /*reserved 1*/ @@ -467,7 +467,7 @@ H5O_pline_size(const H5F_t UNUSED *f, const void *mesg) ((pline->version == H5O_PLINE_VERSION_1 || pline->filter[i].id >= H5Z_FILTER_RESERVED) ? 2 : 0) + /*name length */ 2 + /*flags */ 2 + /*number of client data values */ - (pline->version == H5O_PLINE_VERSION_1 ? H5O_ALIGN_OLD(name_len) : name_len); /*length of the filter name */ + (pline->version == H5O_PLINE_VERSION_1 ? (size_t)H5O_ALIGN_OLD(name_len) : name_len); /*length of the filter name */ ret_value += pline->filter[i].cd_nelmts * 4; if(pline->version == H5O_PLINE_VERSION_1) diff --git a/src/H5Oshared.c b/src/H5Oshared.c index c29e2c7..e4a51ee 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -622,7 +622,7 @@ H5O_shared_copy_file(H5F_t *file_src, H5F_t *file_dst, H5_BEGIN_TAG(dxpl_id, H5AC__COPIED_TAG, FAIL); if(H5SM_try_share(file_dst, dxpl_id, NULL, H5SM_DEFER, mesg_type->id, _native_dst, mesg_flags) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to determine if message should be shared") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to determine if message should be shared") /* Reset metadata tag */ H5_END_TAG(FAIL); diff --git a/src/H5Oshmesg.c b/src/H5Oshmesg.c index 69c7d49..2575856 100644 --- a/src/H5Oshmesg.c +++ b/src/H5Oshmesg.c @@ -129,9 +129,9 @@ H5O_shmesg_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const voi HDassert(mesg); /* Store version, table address, and number of indexes */ - *p++ = mesg->version; + *p++ = (uint8_t)mesg->version; H5F_addr_encode(f, &p, mesg->addr); - *p++ = mesg->nindexes; + *p++ = (uint8_t)mesg->nindexes; FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_shmesg_encode() */ @@ -201,9 +201,9 @@ H5O_shmesg_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void UNUSED /* Sanity check */ HDassert(f); - ret_value = 1 + /* Version number */ + ret_value = (size_t)(1 + /* Version number */ H5F_SIZEOF_ADDR(f) + /* Table address */ - 1; /* Number of indexes */ + 1); /* Number of indexes */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_shmesg_size() */ diff --git a/src/H5Ostab.c b/src/H5Ostab.c index a28d8ea..5619a1b 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -227,7 +227,7 @@ H5O_stab_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void UNUSED * FUNC_ENTER_NOAPI_NOINIT_NOERR /* Set return value */ - ret_value=2 * H5F_SIZEOF_ADDR(f); + ret_value = (size_t)(2 * H5F_SIZEOF_ADDR(f)); FUNC_LEAVE_NOAPI(ret_value) } @@ -336,7 +336,7 @@ H5O_stab_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst, /* Create components of symbol table message */ if(H5G__stab_create_components(file_dst, stab_dst, size_hint, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "can't create symbol table components") + HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTINIT, NULL, "can't create symbol table components") /* Reset metadata tag */ H5_END_TAG(NULL); diff --git a/src/H5Otest.c b/src/H5Otest.c index a056068..b526b30 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -200,7 +200,7 @@ H5O_is_attr_empty_test(hid_t oid) /* Open the name index v2 B-tree */ /*!FIXME use ohdr proxy -NAF */ if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL, oh))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Reset metadata tag in dxpl_id */ H5_END_TAG(FAIL); @@ -294,7 +294,7 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) /* Open the name index v2 B-tree */ /*!FIXME use ohdr proxy -NAF */ if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL, oh))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Reset metadata tag in dxpl_id */ H5_END_TAG(FAIL); @@ -364,41 +364,41 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; if(oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ if(H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + HGOTO_ERROR_TAG(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ /* Check for 'dense' attribute storage file addresses being defined */ if(!H5F_addr_defined(ainfo.fheap_addr)) - HGOTO_DONE(FAIL) + HGOTO_DONE_TAG(FAIL, FAIL) if(!H5F_addr_defined(ainfo.name_bt2_addr)) - HGOTO_DONE(FAIL) + HGOTO_DONE_TAG(FAIL, FAIL) /* Open the name index v2 B-tree */ /*!FIXME use ohdr proxy -NAF */ if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL, oh))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Retrieve # of records in name index */ if(H5B2_get_nrec(bt2_name, name_count) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index") /* Check if there is a creation order index */ if(H5F_addr_defined(ainfo.corder_bt2_addr)) { /* Open the creation order index v2 B-tree */ /*!FIXME use ohdr proxy -NAF */ if(NULL == (bt2_corder = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.corder_bt2_addr, NULL, oh))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") /* Retrieve # of records in creation order index */ if(H5B2_get_nrec(bt2_corder, corder_count) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from creation order index") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from creation order index") } /* end if */ else *corder_count = 0; @@ -508,8 +508,8 @@ H5O_expunge_chunks_test(const H5O_loc_t *loc, hid_t dxpl_id) { H5O_t *oh = NULL; /* Object header */ haddr_t chk_addr[16]; /* Array of chunk addresses */ - unsigned nchunks; /* Number of chunks in object header */ - unsigned u; /* Local index variable */ + size_t nchunks; /* Number of chunks in object header */ + size_t u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5P.c b/src/H5P.c index 92b3d18..ba286fb 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -45,6 +45,13 @@ /* Local Typedefs */ /******************/ +/* Typedef for property iterator callback */ +typedef struct { + H5P_iterate_t iter_func; /* Iterator callback */ + hid_t id; /* Property list or class ID */ + void *iter_data; /* Iterator callback pointer */ +} H5P_iter_ud_t; + /********************/ /* Local Prototypes */ @@ -111,7 +118,7 @@ H5P_init_pub_interface(void) hid_t H5Pcopy(hid_t id) { - void *obj; /* Property object to copy */ + void *obj; /* Property object to copy */ hid_t ret_value=FALSE; /* return value */ FUNC_ENTER_API(FAIL) @@ -217,7 +224,7 @@ H5Pcreate_class(hid_t parent, const char *name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't retrieve parent class") /* Create the new property list class */ - if(NULL == (pclass = H5P_create_class(par_class, name, FALSE, cls_create, create_data, cls_copy, copy_data, cls_close, close_data))) + if(NULL == (pclass = H5P_create_class(par_class, name, H5P_TYPE_USER, cls_create, create_data, cls_copy, copy_data, cls_close, close_data))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list class") /* Get an atom for the class */ @@ -1045,6 +1052,45 @@ done: /*-------------------------------------------------------------------------- NAME + H5P__iterate_cb + PURPOSE + Internal callback routine when iterating over properties in property list + or class + USAGE + int H5P__iterate_cb(prop, udata) + H5P_genprop_t *prop; IN: Pointer to the property + void *udata; IN/OUT: Pointer to iteration data from user + RETURNS + Success: Returns the return value of the last call to ITER_FUNC + DESCRIPTION + This routine calls the actual callback routine for the property in the +property list or class. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static int +H5P__iterate_cb(H5P_genprop_t *prop, void *_udata) +{ + H5P_iter_ud_t *udata = (H5P_iter_ud_t *)_udata; /* Pointer to user data */ + int ret_value = 0; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(prop); + HDassert(udata); + + /* Call the user's callback routine */ + ret_value = (*udata->iter_func)(udata->id, prop->name, udata->iter_data); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__iterate_cb() */ + + +/*-------------------------------------------------------------------------- + NAME H5Piterate PURPOSE Routine to iterate over the properties in a property list or class @@ -1099,7 +1145,9 @@ iteration, the function's behavior is undefined. int H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data) { + H5P_iter_ud_t udata; /* User data for internal iterator callback */ int fake_idx = 0; /* Index when user doesn't provide one */ + void *obj; /* Property object to copy */ int ret_value; /* return value */ FUNC_ENTER_API(FAIL) @@ -1108,18 +1156,25 @@ H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data) /* Check arguments. */ if(H5I_GENPROP_LST != H5I_get_type(id) && H5I_GENPROP_CLS != H5I_get_type(id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property object"); + if(NULL == (obj = H5I_object(id))) + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist"); if(iter_func == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration callback"); + /* Set up user data */ + udata.iter_func = iter_func; + udata.id = id; + udata.iter_data = iter_data; + if(H5I_GENPROP_LST == H5I_get_type(id)) { /* Iterate over a property list */ - if((ret_value = H5P_iterate_plist(id, (idx ? idx : &fake_idx), iter_func, iter_data)) < 0) + if((ret_value = H5P_iterate_plist((H5P_genplist_t *)obj, TRUE, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over list"); } /* end if */ else if(H5I_GENPROP_CLS == H5I_get_type(id)) { /* Iterate over a property class */ - if((ret_value = H5P_iterate_pclass(id, (idx ? idx : &fake_idx), iter_func, iter_data)) < 0) + if((ret_value = H5P_iterate_pclass((H5P_genclass_t *)obj, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over class"); } /* end if */ else diff --git a/src/H5Pacpl.c b/src/H5Pacpl.c index 41a4f96..b30bf1e 100644 --- a/src/H5Pacpl.c +++ b/src/H5Pacpl.c @@ -64,6 +64,7 @@ /* Attribute creation property list class library initialization object */ const H5P_libclass_t H5P_CLS_ACRT[1] = {{ "attribute create", /* Class name for debugging */ + H5P_TYPE_ATTRIBUTE_CREATE, /* Class type */ &H5P_CLS_STRING_CREATE_g, /* Parent class ID */ &H5P_CLS_ATTRIBUTE_CREATE_g, /* Pointer to class ID */ &H5P_LST_ATTRIBUTE_CREATE_g, /* Pointer to default property list ID */ diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index 51e62fe..d21cdbf 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -33,12 +33,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* Files */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Ppkg.h" /* Property lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Ppkg.h" /* Property lists */ /****************/ @@ -72,7 +72,7 @@ /********************/ /* Property class callbacks */ -static herr_t H5P_dacc_reg_prop(H5P_genclass_t *pclass); +static herr_t H5P__dacc_reg_prop(H5P_genclass_t *pclass); /*********************/ @@ -82,15 +82,16 @@ static herr_t H5P_dacc_reg_prop(H5P_genclass_t *pclass); /* Dataset access property list class library initialization object */ const H5P_libclass_t H5P_CLS_DACC[1] = {{ "dataset access", /* Class name for debugging */ + H5P_TYPE_DATASET_ACCESS, /* Class type */ &H5P_CLS_LINK_ACCESS_g, /* Parent class ID */ &H5P_CLS_DATASET_ACCESS_g, /* Pointer to class ID */ &H5P_LST_DATASET_ACCESS_g, /* Pointer to default property list ID */ - H5P_dacc_reg_prop, /* Default property registration routine */ - NULL, /* Class creation callback */ + H5P__dacc_reg_prop, /* Default property registration routine */ + NULL, /* Class creation callback */ NULL, /* Class creation callback info */ - NULL, /* Class copy callback */ + NULL, /* Class copy callback */ NULL, /* Class copy callback info */ - NULL, /* Class close callback */ + NULL, /* Class close callback */ NULL /* Class close callback info */ }}; @@ -107,7 +108,7 @@ const H5P_libclass_t H5P_CLS_DACC[1] = {{ /*------------------------------------------------------------------------- - * Function: H5P_dacc_reg_prop + * Function: H5P__dacc_reg_prop * * Purpose: Register the dataset access property list class's * properties @@ -119,14 +120,14 @@ const H5P_libclass_t H5P_CLS_DACC[1] = {{ *------------------------------------------------------------------------- */ static herr_t -H5P_dacc_reg_prop(H5P_genclass_t *pclass) +H5P__dacc_reg_prop(H5P_genclass_t *pclass) { size_t rdcc_nslots = H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF; /* Default raw data chunk cache # of slots */ size_t rdcc_nbytes = H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF; /* Default raw data chunk cache # of bytes */ double rdcc_w0 = H5D_ACS_PREEMPT_READ_CHUNKS_DEF; /* Default raw data chunk cache dirty ratio */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Register the size of raw data chunk cache (elements) */ if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) @@ -142,7 +143,7 @@ H5P_dacc_reg_prop(H5P_genclass_t *pclass) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_dacc_reg_prop() */ +} /* end H5P__dacc_reg_prop() */ /*------------------------------------------------------------------------- @@ -186,24 +187,24 @@ H5Pset_chunk_cache(hid_t dapl_id, size_t rdcc_nslots, size_t rdcc_nbytes, double /* Check arguments. Note that we allow negative values - they are * considered to "unset" the property. */ - if (rdcc_w0 > 1.0) + if(rdcc_w0 > 1.0) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "raw data cache w0 value must be between 0.0 and 1.0 inclusive, or H5D_CHUNK_CACHE_W0_DEFAULT"); /* Get the plist structure */ - if (NULL == (plist = H5P_object_verify(dapl_id,H5P_DATASET_ACCESS))) + if(NULL == (plist = H5P_object_verify(dapl_id,H5P_DATASET_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Set sizes */ - if (H5P_set(plist, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &rdcc_nslots) < 0) + if(H5P_set(plist, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &rdcc_nslots) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data cache number of chunks"); - if (H5P_set(plist, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &rdcc_nbytes) < 0) + if(H5P_set(plist, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &rdcc_nbytes) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data cache byte size"); - if (H5P_set(plist, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &rdcc_w0) < 0) + if(H5P_set(plist, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &rdcc_w0) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set preempt read chunks"); done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pset_chunk_cache() */ /*------------------------------------------------------------------------- @@ -271,3 +272,4 @@ H5Pget_chunk_cache(hid_t dapl_id, size_t *rdcc_nslots, size_t *rdcc_nbytes, doub done: FUNC_LEAVE_API(ret_value) } + diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 5597822..89dd91f 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -66,7 +66,7 @@ /* Note that the compact & chunked layout initialization values are using the * contiguous layout initialization in the union, because the contiguous * layout is first in the union. These values are overridden in the - * H5P_init_def_layout() routine. -QAK + * H5P__init_def_layout() routine. -QAK */ #define H5D_DEF_LAYOUT_COMPACT {H5D_COMPACT, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}} #define H5D_DEF_LAYOUT_CONTIG {H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}} @@ -77,7 +77,7 @@ /* Definitions for storage layout property */ #define H5D_CRT_LAYOUT_SIZE sizeof(H5O_layout_t) #define H5D_CRT_LAYOUT_DEF H5D_DEF_LAYOUT_CONTIG -#define H5D_CRT_LAYOUT_CMP H5P_dcrt_layout_cmp +#define H5D_CRT_LAYOUT_CMP H5P__dcrt_layout_cmp /* Definitions for fill value. size=0 means fill value will be 0 as * library default; size=-1 means fill value is undefined. */ #define H5D_CRT_FILL_VALUE_SIZE sizeof(H5O_fill_t) @@ -89,7 +89,7 @@ /* Definitions for external file list */ #define H5D_CRT_EXT_FILE_LIST_SIZE sizeof(H5O_efl_t) #define H5D_CRT_EXT_FILE_LIST_DEF {HADDR_UNDEF, 0, 0, NULL} -#define H5D_CRT_EXT_FILE_LIST_CMP H5P_dcrt_ext_file_list_cmp +#define H5D_CRT_EXT_FILE_LIST_CMP H5P__dcrt_ext_file_list_cmp /******************/ @@ -107,19 +107,19 @@ /********************/ /* General routines */ -static herr_t H5P_set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout); +static herr_t H5P__set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout); #ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER -static herr_t H5P_init_def_layout(void); +static herr_t H5P__init_def_layout(void); #endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ /* Property class callbacks */ -static herr_t H5P_dcrt_reg_prop(H5P_genclass_t *pclass); -static herr_t H5P_dcrt_copy(hid_t new_plist_t, hid_t old_plist_t, void *copy_data); -static herr_t H5P_dcrt_close(hid_t dxpl_id, void *close_data); +static herr_t H5P__dcrt_reg_prop(H5P_genclass_t *pclass); +static herr_t H5P__dcrt_copy(hid_t new_plist_t, hid_t old_plist_t, void *copy_data); +static herr_t H5P__dcrt_close(hid_t dxpl_id, void *close_data); /* Property callbacks */ -static int H5P_dcrt_layout_cmp(const void *value1, const void *value2, size_t size); -static int H5P_dcrt_ext_file_list_cmp(const void *value1, const void *value2, size_t size); +static int H5P__dcrt_layout_cmp(const void *value1, const void *value2, size_t size); +static int H5P__dcrt_ext_file_list_cmp(const void *value1, const void *value2, size_t size); /*********************/ @@ -129,15 +129,16 @@ static int H5P_dcrt_ext_file_list_cmp(const void *value1, const void *value2, si /* Dataset creation property list class library initialization object */ const H5P_libclass_t H5P_CLS_DCRT[1] = {{ "dataset create", /* Class name for debugging */ + H5P_TYPE_DATASET_CREATE, /* Class type */ &H5P_CLS_OBJECT_CREATE_g, /* Parent class ID */ &H5P_CLS_DATASET_CREATE_g, /* Pointer to class ID */ &H5P_LST_DATASET_CREATE_g, /* Pointer to default property list ID */ - H5P_dcrt_reg_prop, /* Default property registration routine */ + H5P__dcrt_reg_prop, /* Default property registration routine */ NULL, /* Class creation callback */ NULL, /* Class creation callback info */ - H5P_dcrt_copy, /* Class copy callback */ + H5P__dcrt_copy, /* Class copy callback */ NULL, /* Class copy callback info */ - H5P_dcrt_close, /* Class close callback */ + H5P__dcrt_close, /* Class close callback */ NULL /* Class close callback info */ }}; @@ -164,7 +165,7 @@ static hbool_t H5P_dcrt_def_layout_init_g = FALSE; /*------------------------------------------------------------------------- - * Function: H5P_dcrt_reg_prop + * Function: H5P__dcrt_reg_prop * * Purpose: Register the dataset creation property list class's properties * @@ -175,7 +176,7 @@ static hbool_t H5P_dcrt_def_layout_init_g = FALSE; *------------------------------------------------------------------------- */ static herr_t -H5P_dcrt_reg_prop(H5P_genclass_t *pclass) +H5P__dcrt_reg_prop(H5P_genclass_t *pclass) { H5O_layout_t layout = H5D_CRT_LAYOUT_DEF; /* Default storage layout */ H5O_fill_t fill = H5D_CRT_FILL_VALUE_DEF; /* Default fill value */ @@ -183,7 +184,7 @@ H5P_dcrt_reg_prop(H5P_genclass_t *pclass) H5O_efl_t efl = H5D_CRT_EXT_FILE_LIST_DEF; /* Default external file list */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Register the storage layout property */ if(H5P_register_real(pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &layout, NULL, NULL, NULL, NULL, NULL, H5D_CRT_LAYOUT_CMP, NULL) < 0) @@ -203,11 +204,11 @@ H5P_dcrt_reg_prop(H5P_genclass_t *pclass) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_dcrt_reg_prop() */ +} /* end H5P__dcrt_reg_prop() */ /*------------------------------------------------------------------------- - * Function: H5P_dcrt_copy + * Function: H5P__dcrt_copy * * Purpose: Callback routine which is called whenever any dataset * creation property list is copied. This routine copies @@ -223,7 +224,7 @@ done: */ /* ARGSUSED */ static herr_t -H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) +H5P__dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) { H5O_fill_t src_fill, dst_fill; /* Source & destination fill values */ H5O_efl_t src_efl, dst_efl; /* Source & destination external file lists */ @@ -232,7 +233,7 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) H5P_genplist_t *dst_plist; /* Pointer to destination property list */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Verify property list IDs */ if(NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_plist_id))) @@ -281,6 +282,8 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) dst_layout.storage.u.chunk.ops = NULL; break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: default: HDassert(0 && "Unknown layout type!"); } /* end switch */ @@ -315,11 +318,11 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_dcrt_copy() */ +} /* end H5P__dcrt_copy() */ /*------------------------------------------------------------------------- - * Function: H5P_dcrt_close + * Function: H5P__dcrt_close * * Purpose: Callback routine which is called whenever any dataset create * property list is closed. This routine performs any generic @@ -335,14 +338,14 @@ done: */ /* ARGSUSED */ static herr_t -H5P_dcrt_close(hid_t dcpl_id, void UNUSED *close_data) +H5P__dcrt_close(hid_t dcpl_id, void UNUSED *close_data) { H5O_fill_t fill; /* Fill value */ H5O_efl_t efl; /* External file list */ H5P_genplist_t *plist; /* Property list */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id))) @@ -363,11 +366,11 @@ H5P_dcrt_close(hid_t dcpl_id, void UNUSED *close_data) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_dcrt_close() */ +} /* end H5P__dcrt_close() */ /*------------------------------------------------------------------------- - * Function: H5P_dcrt_layout_cmp + * Function: H5P__dcrt_layout_cmp * * Purpose: Callback routine which is called whenever the layout * property in the dataset creation property list is @@ -383,13 +386,13 @@ done: *------------------------------------------------------------------------- */ static int -H5P_dcrt_layout_cmp(const void *_layout1, const void *_layout2, size_t UNUSED size) +H5P__dcrt_layout_cmp(const void *_layout1, const void *_layout2, size_t UNUSED size) { const H5O_layout_t *layout1 = (const H5O_layout_t *)_layout1, /* Create local aliases for values */ *layout2 = (const H5O_layout_t *)_layout2; herr_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(layout1); @@ -426,13 +429,15 @@ H5P_dcrt_layout_cmp(const void *_layout1, const void *_layout2, size_t UNUSED si } /* end case */ break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: default: HDassert(0 && "Unknown layout type!"); } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_dcrt_layout_cmp() */ +} /* end H5P__dcrt_layout_cmp() */ /*------------------------------------------------------------------------- @@ -497,7 +502,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_dcrt_ext_file_list_cmp + * Function: H5P__dcrt_ext_file_list_cmp * * Purpose: Callback routine which is called whenever the external file * list property in the dataset creation property list is @@ -513,14 +518,14 @@ done: *------------------------------------------------------------------------- */ static int -H5P_dcrt_ext_file_list_cmp(const void *_efl1, const void *_efl2, size_t UNUSED size) +H5P__dcrt_ext_file_list_cmp(const void *_efl1, const void *_efl2, size_t UNUSED size) { const H5O_efl_t *efl1 = (const H5O_efl_t *)_efl1, /* Create local aliases for values */ *efl2 = (const H5O_efl_t *)_efl2; int cmp_value; /* Value from comparison */ herr_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(efl1); @@ -574,11 +579,11 @@ H5P_dcrt_ext_file_list_cmp(const void *_efl1, const void *_efl2, size_t UNUSED s done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_dcrt_ext_file_list_cmp() */ +} /* end H5P__dcrt_ext_file_list_cmp() */ /*------------------------------------------------------------------------- - * Function: H5P_set_layout + * Function: H5P__set_layout * * Purpose: Sets the layout of raw data in the file. * @@ -590,12 +595,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P_set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout) +H5P__set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout) { unsigned alloc_time_state; /* State of allocation time property */ herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get the allocation time state */ if(H5P_get(plist, H5D_CRT_ALLOC_TIME_STATE_NAME, &alloc_time_state) < 0) @@ -623,6 +628,8 @@ H5P_set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout) fill.alloc_time = H5D_ALLOC_TIME_INCR; break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: default: HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown layout type") } /* end switch */ @@ -638,12 +645,12 @@ H5P_set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_set_layout() */ +} /* end H5P__set_layout() */ #ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER /*------------------------------------------------------------------------- - * Function: H5P_init_def_layout + * Function: H5P__init_def_layout * * Purpose: Set the default layout information for the various types of * dataset layouts @@ -656,13 +663,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P_init_def_layout(void) +H5P__init_def_layout(void) { const H5O_layout_chunk_t def_layout_chunk = H5D_DEF_LAYOUT_CHUNK_INIT; const H5O_storage_compact_t def_store_compact = H5D_DEF_STORAGE_COMPACT_INIT; const H5O_storage_chunk_t def_store_chunk = H5D_DEF_STORAGE_CHUNK_INIT; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Initialize the default layout info for non-contigous layouts */ H5D_def_layout_compact_g.storage.u.compact = def_store_compact; @@ -673,7 +680,7 @@ H5P_init_def_layout(void) H5P_dcrt_def_layout_init_g = TRUE; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P_init_def_layout() */ +} /* end H5P__init_def_layout() */ #endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ @@ -719,7 +726,7 @@ H5Pset_layout(hid_t plist_id, H5D_layout_t layout_type) * the default layout structs have been initialized yet or not. *ick* -QAK */ if(!H5P_dcrt_def_layout_init_g) - if(H5P_init_def_layout() < 0) + if(H5P__init_def_layout() < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't initialize default layout info") #endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ @@ -737,12 +744,14 @@ H5Pset_layout(hid_t plist_id, H5D_layout_t layout_type) layout = &H5D_def_layout_chunk_g; break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: default: HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown layout type") } /* end switch */ /* Set value */ - if(H5P_set_layout(plist, layout) < 0) + if(H5P__set_layout(plist, layout) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout") done: @@ -847,7 +856,7 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]) * the default layout structs have been initialized yet or not. *ick* -QAK */ if(!H5P_dcrt_def_layout_init_g) - if(H5P_init_def_layout() < 0) + if(H5P__init_def_layout() < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't initialize default layout info") #endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ @@ -884,7 +893,7 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]) /* Set chunk information in property list */ chunk_layout.u.chunk.ndims = (unsigned)ndims; - if(H5P_set_layout(plist, &chunk_layout) < 0) + if(H5P__set_layout(plist, &chunk_layout) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set layout") done: @@ -1098,18 +1107,6 @@ done: * Programmer: Robb Matzke * Tuesday, March 3, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and set property for - * generic property list. - * - * Raymond Lu - * 7 April 2011 - * Starting from the 1.8.7 release, we allow dataspace to have - * zero dimension size. So the external storage size for - * dataset can be zero. *------------------------------------------------------------------------- */ herr_t @@ -1118,16 +1115,16 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size) size_t idx; hsize_t total, tmp; H5O_efl_t efl; - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*soh", plist_id, name, offset, size); /* Check arguments */ - if (!name || !*name) + if(!name || !*name) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") - if (offset<0) + if(offset < 0) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "negative external file offset") /* Get the plist structure */ @@ -1136,14 +1133,14 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size) if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") - if(efl.nused > 0 && H5O_EFL_UNLIMITED==efl.slot[efl.nused-1].size) + if(efl.nused > 0 && H5O_EFL_UNLIMITED == efl.slot[efl.nused - 1].size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "previous file size is unlimited") - if (H5O_EFL_UNLIMITED!=size) { - for (idx=0, total=size; idxname, 1, lib_class->create_func, lib_class->create_data, lib_class->copy_func, lib_class->copy_data, lib_class->close_func, lib_class->close_data))) + if(NULL == (new_pclass = H5P_create_class(par_pclass, lib_class->name, lib_class->type, lib_class->create_func, lib_class->create_data, lib_class->copy_func, lib_class->copy_data, lib_class->close_func, lib_class->close_data))) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") /* Call routine to register properties for class */ @@ -581,11 +603,11 @@ H5P_copy_pclass(H5P_genclass_t *pclass) */ /* Create the new property list class */ - if(NULL==(new_pclass=H5P_create_class(pclass->parent, pclass->name, 0, pclass->create_func, pclass->create_data, pclass->copy_func, pclass->copy_data, pclass->close_func, pclass->close_data))) + if(NULL == (new_pclass = H5P_create_class(pclass->parent, pclass->name, pclass->type, pclass->create_func, pclass->create_data, pclass->copy_func, pclass->copy_data, pclass->close_func, pclass->close_data))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, NULL, "unable to create property list class") /* Copy the properties registered for this class */ - if(pclass->nprops>0) { + if(pclass->nprops > 0) { H5SL_node_t *curr_node; /* Current node in skip list */ /* Walk through the properties in the old class */ @@ -974,17 +996,17 @@ H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type, H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close) { - H5P_genprop_t *prop=NULL; /* Pointer to new property copied */ + H5P_genprop_t *prop = NULL; /* Pointer to new property copied */ H5P_genprop_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT HDassert(name); - HDassert((size>0 && value!=NULL) || (size==0)); - HDassert(type!=H5P_PROP_WITHIN_UNKNOWN); + HDassert((size > 0 && value != NULL) || (size == 0)); + HDassert(type != H5P_PROP_WITHIN_UNKNOWN); /* Allocate the new property */ - if(NULL==(prop = H5FL_MALLOC (H5P_genprop_t))) + if(NULL == (prop = H5FL_MALLOC(H5P_genprop_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Set the property initial values */ @@ -994,37 +1016,37 @@ H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type, prop->type = type; /* Duplicate value, if it exists */ - if(value!=NULL) { - if(NULL==(prop->value = H5MM_malloc (prop->size))) + if(value != NULL) { + if(NULL == (prop->value = H5MM_malloc (prop->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - HDmemcpy(prop->value,value,prop->size); + HDmemcpy(prop->value, value, prop->size); } /* end if */ else - prop->value=NULL; + prop->value = NULL; /* Set the function pointers */ - prop->create=prp_create; - prop->set=prp_set; - prop->get=prp_get; - prop->del=prp_delete; - prop->copy=prp_copy; + prop->create = prp_create; + prop->set = prp_set; + prop->get = prp_get; + prop->del = prp_delete; + prop->copy = prp_copy; /* Use custom comparison routine if available, otherwise default to memcmp() */ - if(prp_cmp!=NULL) - prop->cmp=prp_cmp; + if(prp_cmp != NULL) + prop->cmp = prp_cmp; else - prop->cmp=&memcmp; - prop->close=prp_close; + prop->cmp = &memcmp; + prop->close = prp_close; /* Set return value */ - ret_value=prop; + ret_value = prop; done: /* Free any resources allocated */ - if(ret_value==NULL) { - if(prop!=NULL) { - if(prop->name!=NULL) + if(ret_value == NULL) { + if(prop != NULL) { + if(prop->name != NULL) H5MM_xfree(prop->name); - if(prop->value!=NULL) + if(prop->value != NULL) H5MM_xfree(prop->value); prop = H5FL_FREE(H5P_genprop_t, prop); } /* end if */ @@ -1074,7 +1096,7 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_find_prop_plist + H5P__find_prop_plist PURPOSE Internal routine to check for a property in a property list's skip list USAGE @@ -1090,12 +1112,12 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static H5P_genprop_t * -H5P_find_prop_plist(H5P_genplist_t *plist, const char *name) +H5P_genprop_t * +H5P__find_prop_plist(H5P_genplist_t *plist, const char *name) { H5P_genprop_t *ret_value; /* Property pointer return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(plist); HDassert(name); @@ -1129,7 +1151,7 @@ H5P_find_prop_plist(H5P_genplist_t *plist, const char *name) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_find_prop_plist() */ +} /* H5P__find_prop_plist() */ /*-------------------------------------------------------------------------- @@ -1430,11 +1452,11 @@ H5P_open_class_path_cb(void *_obj, hid_t UNUSED id, void *_key) PURPOSE Internal routine to create a new property list class. USAGE - H5P_genclass_t H5P_create_class(par_class, name, internal, + H5P_genclass_t H5P_create_class(par_class, name, type, cls_create, create_data, cls_close, close_data) H5P_genclass_t *par_class; IN: Pointer to parent class const char *name; IN: Name of class we are creating - hbool_t internal; IN: Whether this is an internal class or not + H5P_plist_type_t type; IN: Type of class we are creating H5P_cls_create_func_t; IN: The callback function to call when each property list in this class is created. void *create_data; IN: Pointer to user data to pass along to class @@ -1458,7 +1480,7 @@ H5P_open_class_path_cb(void *_obj, hid_t UNUSED id, void *_key) REVISION LOG --------------------------------------------------------------------------*/ H5P_genclass_t * -H5P_create_class(H5P_genclass_t *par_class, const char *name, hbool_t internal, +H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t type, H5P_cls_create_func_t cls_create, void *create_data, H5P_cls_copy_func_t cls_copy, void *copy_data, H5P_cls_close_func_t cls_close, void *close_data) @@ -1471,7 +1493,7 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, hbool_t internal, HDassert(name); /* Allow internal classes to break some rules */ /* (This allows the root of the tree to be created with this routine -QAK) */ - if(!internal) + if(type == H5P_TYPE_USER) HDassert(par_class); /* Allocate room for the class */ @@ -1482,11 +1504,11 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, hbool_t internal, pclass->parent = par_class; if(NULL == (pclass->name = H5MM_xstrdup(name))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, NULL, "propery list class name allocation failed") + pclass->type = type; pclass->nprops = 0; /* Classes are created without properties initially */ pclass->plists = 0; /* No properties lists of this class yet */ pclass->classes = 0; /* No classes derived from this class yet */ pclass->ref_count = 1; /* This is the first reference to the new class */ - pclass->internal = internal; pclass->deleted = FALSE; /* Not deleted yet... :-) */ pclass->revision = H5P_GET_NEXT_REV; /* Get a revision number for the class */ @@ -2123,7 +2145,7 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, */ if(pclass->plists > 0 || pclass->classes > 0) { if(NULL == (new_class = H5P_create_class(pclass->parent, pclass->name, - pclass->internal, pclass->create_func, pclass->create_data, + pclass->type, pclass->create_func, pclass->create_data, pclass->copy_func, pclass->copy_data, pclass->close_func, pclass->close_data))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy class") @@ -2335,8 +2357,9 @@ H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, /* Check if the property has been deleted */ if(NULL != H5SL_search(plist->del, name)) { char *temp_name = NULL; + /* Remove the property name from the deleted property skip list */ - if(NULL == (temp_name = H5SL_remove(plist->del, name))) + if(NULL == (temp_name = (char *)H5SL_remove(plist->del, name))) HGOTO_ERROR(H5E_PLIST,H5E_CANTDELETE,FAIL,"can't remove property from deleted skip list") /* free the name of the removed property */ @@ -2692,11 +2715,11 @@ H5P_get_size_plist(H5P_genplist_t *plist, const char *name, size_t *size) HDassert(size); /* Find property */ - if((prop=H5P_find_prop_plist(plist,name)) == NULL) + if(NULL == (prop = H5P__find_prop_plist(plist, name))) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist") /* Get property size */ - *size=prop->size; + *size = prop->size; done: FUNC_LEAVE_NOAPI(ret_value) @@ -3013,9 +3036,9 @@ H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) if(pclass1->ref_count < pclass2->ref_count) HGOTO_DONE(-1); if(pclass1->ref_count > pclass2->ref_count) HGOTO_DONE(1); - /* Check whether they are internal or not */ - if(pclass1->internal < pclass2->internal) HGOTO_DONE(-1); - if(pclass1->internal > pclass2->internal) HGOTO_DONE(1); + /* Check the property list types */ + if(pclass1->type < pclass2->type) HGOTO_DONE(-1); + if(pclass1->type > pclass2->type) HGOTO_DONE(1); /* Check whether they are deleted or not */ if(pclass1->deleted < pclass2->deleted) HGOTO_DONE(-1); @@ -3316,14 +3339,116 @@ done: /*-------------------------------------------------------------------------- NAME + H5P__iterate_plist_cb + PURPOSE + Internal callback routine when iterating over properties in property list + USAGE + int H5P__iterate_plist_cb(item, key, udata) + void *item; IN: Pointer to the property + void *key; IN: Pointer to the property's name + void *udata; IN/OUT: Pointer to iteration data from user + RETURNS + Success: Returns the return value of the last call to ITER_FUNC + DESCRIPTION + This routine calls the actual callback routine for the property in the +property list. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static int +H5P__iterate_plist_cb(void *_item, void *_key, void *_udata) +{ + H5P_genprop_t *item = (H5P_genprop_t *)_item; /* Pointer to the property */ + char *key = (char *)_key; /* Pointer to the property's name */ + H5P_iter_plist_ud_t *udata = (H5P_iter_plist_ud_t *)_udata; /* Pointer to user data */ + int ret_value = 0; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(item); + HDassert(key); + + /* Check if we've found the correctly indexed property */ + if(*udata->curr_idx_ptr >= udata->prev_idx) { + /* Call the callback function */ + ret_value = (*udata->cb_func)(item, udata->udata); + if(ret_value != 0) + HGOTO_DONE(ret_value); + } /* end if */ + + /* Increment the current index */ + (*udata->curr_idx_ptr)++; + + /* Add property name to "seen" list */ + if(H5SL_insert(udata->seen, key, key) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into seen skip list") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__iterate_plist_cb() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P__iterate_plist_pclass_cb + PURPOSE + Internal callback routine when iterating over properties in property class + USAGE + int H5P__iterate_plist_pclass_cb(item, key, udata) + void *item; IN: Pointer to the property + void *key; IN: Pointer to the property's name + void *udata; IN/OUT: Pointer to iteration data from user + RETURNS + Success: Returns the return value of the last call to ITER_FUNC + DESCRIPTION + This routine verifies that the property hasn't already been seen or was +deleted, and then chains to the property list callback. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static int +H5P__iterate_plist_pclass_cb(void *_item, void *_key, void *_udata) +{ + H5P_genprop_t *item = (H5P_genprop_t *)_item; /* Pointer to the property */ + char *key = (char *)_key; /* Pointer to the property's name */ + H5P_iter_plist_ud_t *udata = (H5P_iter_plist_ud_t *)_udata; /* Pointer to user data */ + int ret_value = 0; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(item); + HDassert(key); + + /* Only call iterator callback for properties we haven't seen + * before and that haven't been deleted. + */ + if(NULL == H5SL_search(udata->seen, key) && + NULL == H5SL_search(udata->plist->del, key)) + ret_value = H5P__iterate_plist_cb(item, key, udata); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__iterate_plist_pclass_cb() */ + + +/*-------------------------------------------------------------------------- + NAME H5P_iterate_plist PURPOSE Internal routine to iterate over the properties in a property list USAGE - herr_t H5P_iterate_plist(plist_id, idx, iter_func, iter_data) - hid_t plist_id; IN: ID of property list to iterate over + int H5P_iterate_plist(plist, iter_all_prop, idx, cb_func, iter_data) + const H5P_genplist_t *plist; IN: Property list to iterate over + hbool_t iter_all_prop; IN: Whether to iterate over all properties + (TRUE), or just non-default (i.e. changed) + properties (FALSE). int *idx; IN/OUT: Index of the property to begin with - H5P_iterate_t iter_func; IN: Function pointer to function to be + H5P_iterate_t cb_func; IN: Function pointer to function to be called with each property iterated over. void *iter_data; IN/OUT: Pointer to iteration data from user RETURNS @@ -3366,110 +3491,116 @@ iteration, the function's behavior is undefined. REVISION LOG --------------------------------------------------------------------------*/ int -H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_t iter_func, void *iter_data) +H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx, + H5P_iterate_int_t cb_func, void *udata) { H5P_genclass_t *tclass; /* Temporary class pointer */ - H5P_genplist_t *plist; /* Property list pointer */ - H5P_genprop_t *tmp; /* Temporary pointer to properties */ + H5P_iter_plist_ud_t udata_int; /* User data for skip list iterator */ H5SL_t *seen = NULL; /* Skip list to hold names of properties already seen */ - H5SL_node_t *curr_node; /* Current node in skip list */ int curr_idx = 0; /* Current iteration index */ - int ret_value = FAIL; /* Return value */ + int ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT + /* Sanity check */ + HDassert(plist); HDassert(idx); - HDassert(iter_func); - - /* Get the property list object */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HDassert(cb_func); /* Create the skip list to hold names of properties already seen */ - if((seen = H5SL_create(H5SL_TYPE_STR, NULL)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for seen properties") - - /* Walk through the changed properties in the list */ - if(H5SL_count(plist->props) > 0) { - curr_node = H5SL_first(plist->props); - while(curr_node != NULL) { - /* Get pointer to property from node */ - tmp = (H5P_genprop_t *)H5SL_item(curr_node); - - /* Check if we've found the correctly indexed property */ - if(curr_idx>=*idx) { - /* Call the callback function */ - ret_value=(*iter_func)(plist_id,tmp->name,iter_data); - - if(ret_value!=0) - HGOTO_DONE(ret_value); - } /* end if */ - - /* Increment the current index */ - curr_idx++; - - /* Add property name to "seen" list */ - if(H5SL_insert(seen,tmp->name,tmp->name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list") + if(NULL == (seen = H5SL_create(H5SL_TYPE_STR, NULL))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "can't create skip list for seen properties") + + /* Set up iterator callback info */ + udata_int.plist = plist; + udata_int.cb_func = cb_func; + udata_int.udata = udata; + udata_int.seen = seen; + udata_int.curr_idx_ptr = &curr_idx; + udata_int.prev_idx = *idx; + + /* Iterate over properties in property list proper */ + /* (Will be only the non-default (i.e. changed) properties) */ + ret_value = H5SL_iterate(plist->props, H5P__iterate_plist_cb, &udata_int); + if(ret_value != 0) + HGOTO_DONE(ret_value); + + /* Check for iterating over all properties, or just non-default ones */ + if(iter_all_prop) { + /* Walk up the class hiearchy */ + tclass = plist->pclass; + while(tclass != NULL) { + /* Iterate over properties in property list class */ + ret_value = H5SL_iterate(tclass->props, H5P__iterate_plist_pclass_cb, &udata_int); + if(ret_value != 0) + HGOTO_DONE(ret_value); - /* Get the next property node in the skip list */ - curr_node=H5SL_next(curr_node); + /* Go up to parent class */ + tclass = tclass->parent; } /* end while */ } /* end if */ - /* Walk up the class hiearchy */ - tclass=plist->pclass; - while(tclass!=NULL) { - if(tclass->nprops>0) { - /* Walk through the properties in the class */ - curr_node=H5SL_first(tclass->props); - while(curr_node!=NULL) { - /* Get pointer to property from node */ - tmp = (H5P_genprop_t *)H5SL_item(curr_node); - - /* Only call iterator callback for properties we haven't seen - * before and that haven't been deleted - */ - if(H5SL_search(seen,tmp->name) == NULL && - H5SL_search(plist->del,tmp->name) == NULL) { +done: + /* Set the index we stopped at */ + *idx = curr_idx; + /* Release the skip list of 'seen' properties */ + if(seen != NULL) + H5SL_close(seen); - /* Check if we've found the correctly indexed property */ - if(curr_idx>=*idx) { - /* Call the callback function */ - ret_value=(*iter_func)(plist_id,tmp->name,iter_data); + FUNC_LEAVE_NOAPI(ret_value) +} /* H5P_iterate_plist() */ - if(ret_value!=0) - HGOTO_DONE(ret_value); - } /* end if */ + +/*-------------------------------------------------------------------------- + NAME + H5P__iterate_pclass_cb + PURPOSE + Internal callback routine when iterating over properties in property list + class + USAGE + int H5P__iterate_pclass_cb(item, key, udata) + void *item; IN: Pointer to the property + void *key; IN: Pointer to the property's name + void *udata; IN/OUT: Pointer to iteration data from user + RETURNS + Success: Returns the return value of the last call to ITER_FUNC + DESCRIPTION + This routine calls the actual callback routine for the property in the +property list class. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static int +H5P__iterate_pclass_cb(void *_item, void *_key, void *_udata) +{ + H5P_genprop_t *item = (H5P_genprop_t *)_item; /* Pointer to the property */ + char *key = (char *)_key; /* Pointer to the property's name */ + H5P_iter_pclass_ud_t *udata = (H5P_iter_pclass_ud_t *)_udata; /* Pointer to user data */ + int ret_value = 0; /* Return value */ - /* Increment the current index */ - curr_idx++; + FUNC_ENTER_STATIC_NOERR - /* Add property name to "seen" list */ - if(H5SL_insert(seen,tmp->name,tmp->name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list") - } /* end if */ + /* Sanity check */ + HDassert(item); + HDassert(key); - /* Get the next property node in the skip list */ - curr_node=H5SL_next(curr_node); - } /* end while */ - } /* end if */ + /* Check if we've found the correctly indexed property */ + if(*udata->curr_idx_ptr >= udata->prev_idx) { + /* Call the callback function */ + ret_value = (*udata->cb_func)(item, udata->udata); + if(ret_value != 0) + HGOTO_DONE(ret_value); + } /* end if */ - /* Go up to parent class */ - tclass=tclass->parent; - } /* end while */ + /* Increment the current index */ + (*udata->curr_idx_ptr)++; done: - /* Set the index we stopped at */ - *idx=curr_idx; - - /* Release the skip list of 'seen' properties */ - if(seen!=NULL) - H5SL_close(seen); - FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_iterate_plist() */ +} /* end H5P__iterate_pclass_cb() */ /*-------------------------------------------------------------------------- @@ -3478,10 +3609,10 @@ done: PURPOSE Internal routine to iterate over the properties in a property class USAGE - herr_t H5P_iterate_pclass(pclass_id, idx, iter_func, iter_data) - hid_t pclass_id; IN: ID of property class to iterate over + herr_t H5P_iterate_pclass(pclass, idx, cb_func, iter_data) + const H5P_genpclass_t *pclass; IN: Property list class to iterate over int *idx; IN/OUT: Index of the property to begin with - H5P_iterate_t iter_func; IN: Function pointer to function to be + H5P_iterate_t cb_func; IN: Function pointer to function to be called with each property iterated over. void *iter_data; IN/OUT: Pointer to iteration data from user RETURNS @@ -3524,49 +3655,34 @@ iteration, the function's behavior is undefined. REVISION LOG --------------------------------------------------------------------------*/ int -H5P_iterate_pclass(hid_t pclass_id, int *idx, H5P_iterate_t iter_func, void *iter_data) +H5P_iterate_pclass(const H5P_genclass_t *pclass, int *idx, + H5P_iterate_int_t cb_func, void *udata) { - H5P_genclass_t *pclass; /* Property list pointer */ - H5SL_node_t *curr_node; /* Current node in skip list */ - H5P_genprop_t *prop; /* Temporary property pointer */ - int curr_idx=0; /* Current iteration index */ - int ret_value=FAIL; /* Return value */ + H5P_iter_pclass_ud_t udata_int; /* User data for skip list iterator */ + int curr_idx = 0; /* Current iteration index */ + int ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT + /* Sanity check */ + HDassert(pclass); HDassert(idx); - HDassert(iter_func); - - /* Get the property list object */ - if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class") - - /* Cycle through the properties and call the callback */ - curr_idx=0; - curr_node=H5SL_first(pclass->props); - while(curr_node!=NULL) { - if(curr_idx>=*idx) { - /* Get the property for the node */ - prop = (H5P_genprop_t *)H5SL_item(curr_node); - - /* Call the callback function */ - ret_value=(*iter_func)(pclass_id,prop->name,iter_data); - - /* Check if iteration function succeeded */ - if(ret_value!=0) - HGOTO_DONE(ret_value); - } /* end if */ + HDassert(cb_func); - /* Increment the iteration index */ - curr_idx++; + /* Set up iterator callback info */ + udata_int.cb_func = cb_func; + udata_int.udata = udata; + udata_int.curr_idx_ptr = &curr_idx; + udata_int.prev_idx = *idx; - /* Get the next property node in the skip list */ - curr_node=H5SL_next(curr_node); - } /* end while */ + /* Iterate over properties in property list class proper */ + ret_value = H5SL_iterate(pclass->props, H5P__iterate_pclass_cb, &udata_int); + if(ret_value != 0) + HGOTO_DONE(ret_value); done: /* Set the index we stopped at */ - *idx=curr_idx; + *idx = curr_idx; FUNC_LEAVE_NOAPI(ret_value) } /* H5P_iterate_pclass() */ @@ -4080,13 +4196,13 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist") /* If the property exists in the destination alread */ - if(H5P_find_prop_plist(dst_plist,name)!=NULL) { + if(NULL != H5P__find_prop_plist(dst_plist, name)) { /* Delete the property from the destination list, calling the 'close' callback if necessary */ if(H5P_remove(dst_id,dst_plist,name) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property") /* Get the pointer to the source property */ - prop=H5P_find_prop_plist(src_plist,name); + prop = H5P__find_prop_plist(src_plist, name); /* Make a copy of the source property */ if((new_prop=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) @@ -4108,25 +4224,26 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) /* If not, get the information required to do an H5Pinsert2 with the property into the destination list */ else { /* Get the pointer to the source property */ - prop=H5P_find_prop_plist(src_plist,name); + prop = H5P__find_prop_plist(src_plist, name); /* Create property object from parameters */ - if((new_prop=H5P_create_prop(prop->name,prop->size,H5P_PROP_WITHIN_LIST,prop->value,prop->create,prop->set,prop->get,prop->del,prop->copy,prop->cmp,prop->close)) == NULL) + if(NULL == (new_prop = H5P_create_prop(prop->name, prop->size, H5P_PROP_WITHIN_LIST, prop->value, + prop->create, prop->set, prop->get, + prop->del, prop->copy, prop->cmp, prop->close))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property") /* Call property creation callback, if it exists */ if(new_prop->create) { - if((new_prop->create)(new_prop->name,new_prop->size,new_prop->value) < 0) + if((new_prop->create)(new_prop->name, new_prop->size, new_prop->value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Can't initialize property") } /* end if */ /* Insert property into property list class */ - if(H5P_add_prop(dst_plist->props,new_prop) < 0) + if(H5P_add_prop(dst_plist->props, new_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into class") /* Increment property count for class */ dst_plist->nprops++; - } /* end else */ done: @@ -4202,7 +4319,8 @@ H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) /* Register the property into the destination */ orig_dst_pclass = dst_pclass; - if(H5P_register(&dst_pclass, name, prop->size, prop->value, prop->create, prop->set, prop->get, prop->del, prop->copy, prop->cmp, prop->close) < 0) + if(H5P_register(&dst_pclass, name, prop->size, prop->value, prop->create, prop->set, prop->get, + prop->del, prop->copy, prop->cmp, prop->close) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property") /* Check if the property class changed and needs to be substituted in the ID */ diff --git a/src/H5Plapl.c b/src/H5Plapl.c index 6c80493..ba5f9d7 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -53,6 +53,7 @@ #define H5L_ACS_ELINK_PREFIX_DEF NULL /*default is no prefix */ #define H5L_ACS_ELINK_PREFIX_DEL H5P_lacc_elink_pref_del #define H5L_ACS_ELINK_PREFIX_COPY H5P_lacc_elink_pref_copy +#define H5L_ACS_ELINK_PREFIX_CMP H5P_lacc_elink_pref_cmp #define H5L_ACS_ELINK_PREFIX_CLOSE H5P_lacc_elink_pref_close /* Definitions for setting fapl of external link access */ @@ -70,6 +71,7 @@ #define H5L_ACS_ELINK_CB_SIZE sizeof(H5L_elink_cb_t) #define H5L_ACS_ELINK_CB_DEF {NULL,NULL} + /******************/ /* Local Typedefs */ /******************/ @@ -90,8 +92,8 @@ static herr_t H5P_lacc_reg_prop(H5P_genclass_t *pclass); /* Property list callbacks */ static herr_t H5P_lacc_elink_pref_del(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P_lacc_elink_pref_copy(const char* name, size_t size, void* value); +static int H5P_lacc_elink_pref_cmp(const void *value1, const void *value2, size_t size); static herr_t H5P_lacc_elink_pref_close(const char* name, size_t size, void* value); - static herr_t H5P_lacc_elink_fapl_del(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P_lacc_elink_fapl_copy(const char* name, size_t size, void* value); static herr_t H5P_lacc_elink_fapl_close(const char* name, size_t size, void* value); @@ -104,6 +106,7 @@ static herr_t H5P_lacc_elink_fapl_close(const char* name, size_t size, void* val /* Dataset creation property list class library initialization object */ const H5P_libclass_t H5P_CLS_LACC[1] = {{ "link access", /* Class name for debugging */ + H5P_TYPE_LINK_ACCESS, /* Class type */ &H5P_CLS_ROOT_g, /* Parent class ID */ &H5P_CLS_LINK_ACCESS_g, /* Pointer to class ID */ &H5P_LST_LINK_ACCESS_g, /* Pointer to default property list ID */ @@ -162,7 +165,7 @@ H5P_lacc_reg_prop(H5P_genclass_t *pclass) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for external link prefix */ - if(H5P_register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &elink_prefix, NULL, NULL, NULL, H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, NULL, H5L_ACS_ELINK_PREFIX_CLOSE) < 0) + if(H5P_register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &elink_prefix, NULL, NULL, NULL, H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, H5L_ACS_ELINK_PREFIX_CMP, H5L_ACS_ELINK_PREFIX_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register fapl for link access */ @@ -343,6 +346,41 @@ H5P_lacc_elink_pref_copy(const char UNUSED *name, size_t UNUSED size, void *valu /*------------------------------------------------------------------------- + * Function: H5P_lacc_elink_pref_cmp + * + * Purpose: Callback routine which is called whenever the elink prefix + * property in the dataset creation property list is + * compared. + * + * Return: zero if VALUE1 and VALUE2 are equal, non zero otherwise. + * + * Programmer: Mohamad Chaarawi + * Thursday, November 3, 2011 + * + *------------------------------------------------------------------------- + */ +static int +H5P_lacc_elink_pref_cmp(const void *value1, const void *value2, size_t UNUSED size) +{ + const char *pref1 = *(const char **)value1; + const char *pref2 = *(const char **)value2; + int ret_value = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(NULL == pref1 && NULL != pref2) + HGOTO_DONE(1); + if(NULL != pref1 && NULL == pref2) + HGOTO_DONE(-1); + if(NULL != pref1 && NULL != pref2) + ret_value = HDstrcmp(pref1, pref2); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_lacc_elink_pref_cmp() */ + + +/*------------------------------------------------------------------------- * Function: H5P_lacc_elink_pref_close * * Purpose: Frees memory used to store the external link prefix string @@ -815,3 +853,4 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_elink_cb() */ + diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c index 60b4e37..b327df9 100644 --- a/src/H5Plcpl.c +++ b/src/H5Plcpl.c @@ -75,6 +75,7 @@ static herr_t H5P_lcrt_reg_prop(H5P_genclass_t *pclass); /* Link creation property list class library initialization object */ const H5P_libclass_t H5P_CLS_LCRT[1] = {{ "link create", /* Class name for debugging */ + H5P_TYPE_LINK_CREATE, /* Class type */ &H5P_CLS_STRING_CREATE_g, /* Parent class ID */ &H5P_CLS_LINK_CREATE_g, /* Pointer to class ID */ &H5P_LST_LINK_CREATE_g, /* Pointer to default property list ID */ @@ -120,7 +121,7 @@ H5P_lcrt_reg_prop(H5P_genclass_t *pclass) /* Register create intermediate groups property */ if(H5P_register_real(pclass, H5L_CRT_INTERMEDIATE_GROUP_NAME, H5L_CRT_INTERMEDIATE_GROUP_SIZE, &intmd_group, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index 217d0ba..024f79b 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -87,6 +87,7 @@ static int H5P_ocrt_pipeline_cmp(const void *value1, const void *value2, size_t /* Object creation property list class library initialization object */ const H5P_libclass_t H5P_CLS_OCRT[1] = {{ "object create", /* Class name for debugging */ + H5P_TYPE_OBJECT_CREATE, /* Class type */ &H5P_CLS_ROOT_g, /* Parent class ID */ &H5P_CLS_OBJECT_CREATE_g, /* Pointer to class ID */ NULL, /* Pointer to default property list ID */ @@ -137,15 +138,15 @@ H5P_ocrt_reg_prop(H5P_genclass_t *pclass) /* Register max. compact attribute storage property */ if(H5P_register_real(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, &attr_max_compact, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register min. dense attribute storage property */ if(H5P_register_real(pclass, H5O_CRT_ATTR_MIN_DENSE_NAME, H5O_CRT_ATTR_MIN_DENSE_SIZE, &attr_min_dense, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register object header flags property */ if(H5P_register_real(pclass, H5O_CRT_OHDR_FLAGS_NAME, H5O_CRT_OHDR_FLAGS_SIZE, &ohdr_flags, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the pipeline property */ if(H5P_register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &pline, NULL, NULL, NULL, NULL, NULL, H5O_CRT_PIPELINE_CMP, NULL) < 0) @@ -379,8 +380,8 @@ H5Pset_attr_creation_order(hid_t plist_id, unsigned crt_order_flags) ohdr_flags &= (uint8_t)~(H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED); /* Update with new attribute creation order flags */ - ohdr_flags |= (uint8_t)((crt_order_flags & H5P_CRT_ORDER_TRACKED) ? H5O_HDR_ATTR_CRT_ORDER_TRACKED : 0); - ohdr_flags |= (uint8_t)((crt_order_flags & H5P_CRT_ORDER_INDEXED) ? H5O_HDR_ATTR_CRT_ORDER_INDEXED : 0); + ohdr_flags = (uint8_t)(ohdr_flags | ((crt_order_flags & H5P_CRT_ORDER_TRACKED) ? H5O_HDR_ATTR_CRT_ORDER_TRACKED : 0)); + ohdr_flags = (uint8_t)(ohdr_flags | ((crt_order_flags & H5P_CRT_ORDER_INDEXED) ? H5O_HDR_ATTR_CRT_ORDER_INDEXED : 0)); /* Set object header flags */ if(H5P_set(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0) @@ -486,7 +487,7 @@ H5Pset_obj_track_times(hid_t plist_id, hbool_t track_times) ohdr_flags &= (uint8_t)~H5O_HDR_STORE_TIMES; /* Update with new time tracking flag */ - ohdr_flags |= (uint8_t)(track_times ? H5O_HDR_STORE_TIMES : 0); + ohdr_flags = (uint8_t)(ohdr_flags | (track_times ? H5O_HDR_STORE_TIMES : 0)); /* Set object header flags */ if(H5P_set(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0) @@ -1343,7 +1344,7 @@ H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/, * *------------------------------------------------------------------------- */ -int +static int H5P_ocrt_pipeline_cmp(const void *_pline1, const void *_pline2, size_t UNUSED size) { const H5O_pline_t *pline1 = (const H5O_pline_t *)_pline1, /* Create local aliases for values */ diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c index 23f8e4b..adea906 100644 --- a/src/H5Pocpypl.c +++ b/src/H5Pocpypl.c @@ -91,6 +91,7 @@ static int H5P_ocpy_merge_comm_dt_list_cmp(const void *value1, const void *value /* Object copy property list class library initialization object */ const H5P_libclass_t H5P_CLS_OCPY[1] = {{ "object copy", /* Class name for debugging */ + H5P_TYPE_OBJECT_COPY, /* Class type */ &H5P_CLS_ROOT_g, /* Parent class ID */ &H5P_CLS_OBJECT_COPY_g, /* Pointer to class ID */ &H5P_LST_OBJECT_COPY_g, /* Pointer to default property list ID */ @@ -141,15 +142,15 @@ H5P_ocpy_reg_prop(H5P_genclass_t *pclass) /* Register copy options property */ if(H5P_register_real(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, &ocpy_option, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register merge named dtype list property */ if(H5P_register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &merge_comm_dtype_list, NULL, NULL, NULL, NULL, NULL, H5O_CPY_MERGE_COMM_DT_LIST_CMP, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for callback when completing the search for a matching named datatype from the named dtype list */ if(H5P_register_real(pclass, H5O_CPY_MCDT_SEARCH_CB_NAME, H5O_CPY_MCDT_SEARCH_CB_SIZE, &mcdt_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index 7cc3c21..075c43b 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -84,23 +84,23 @@ typedef struct H5P_genprop_t { /* Define structure to hold class information */ struct H5P_genclass_t { struct H5P_genclass_t *parent; /* Pointer to parent class */ - char *name; /* Name of property list class */ - size_t nprops; /* Number of properties in class */ + char *name; /* Name of property list class */ + H5P_plist_type_t type; /* Type of property */ + size_t nprops; /* Number of properties in class */ unsigned plists; /* Number of property lists that have been created since the last modification to the class */ unsigned classes; /* Number of classes that have been derived since the last modification to the class */ unsigned ref_count; /* Number of oustanding ID's open on this class object */ - hbool_t internal; /* Whether this class is internal to the library or not */ hbool_t deleted; /* Whether this class has been deleted and is waiting for dependent classes & proplists to close */ unsigned revision; /* Revision number of a particular class (global) */ - H5SL_t *props; /* Skip list containing properties */ + H5SL_t *props; /* Skip list containing properties */ /* Callback function pointers & info */ H5P_cls_create_func_t create_func; /* Function to call when a property list is created */ - void *create_data; /* Pointer to user data to pass along to create callback */ - H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */ - void *copy_data; /* Pointer to user data to pass along to copy callback */ - H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */ - void *close_data; /* Pointer to user data to pass along to close callback */ + void *create_data; /* Pointer to user data to pass along to create callback */ + H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */ + void *copy_data; /* Pointer to user data to pass along to copy callback */ + H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */ + void *close_data; /* Pointer to user data to pass along to close callback */ }; /* Define structure to hold property list information */ @@ -123,6 +123,7 @@ typedef herr_t (*H5P_reg_prop_func_t)(H5P_genclass_t *pclass); */ typedef struct H5P_libclass_t { const char *name; /* Class name */ + H5P_plist_type_t type; /* Class type */ hid_t const * const par_class_id; /* Pointer to global parent class property list class ID */ hid_t * const class_id; /* Pointer to global property list class ID */ @@ -138,6 +139,8 @@ typedef struct H5P_libclass_t { void *close_data; /* Pointer to user data to pass along to close callback */ } H5P_libclass_t; +/* Property list/class iterator callback function pointer */ +typedef int (*H5P_iterate_int_t)(H5P_genprop_t *prop, void *udata); /*****************************/ /* Package Private Variables */ @@ -150,7 +153,7 @@ typedef struct H5P_libclass_t { /* Private functions, not part of the publicly documented API */ H5_DLL H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class, - const char *name, unsigned internal, + const char *name, H5P_plist_type_t type, H5P_cls_create_func_t cls_create, void *create_data, H5P_cls_copy_func_t cls_copy, void *copy_data, H5P_cls_close_func_t cls_close, void *close_data); @@ -176,10 +179,10 @@ H5_DLL H5P_genclass_t *H5P_get_class(const H5P_genplist_t *plist); H5_DLL herr_t H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops); H5_DLL int H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2); H5_DLL int H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2); -H5_DLL int H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_t iter_func, - void *iter_data); -H5_DLL int H5P_iterate_pclass(hid_t pclass_id, int *idx, H5P_iterate_t iter_func, - void *iter_data); +H5_DLL int H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, + int *idx, H5P_iterate_int_t iter_func, void *iter_data); +H5_DLL int H5P_iterate_pclass(const H5P_genclass_t *pclass, int *idx, + H5P_iterate_int_t iter_func, void *iter_data); H5_DLL herr_t H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name); H5_DLL herr_t H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name); H5_DLL herr_t H5P_unregister(H5P_genclass_t *pclass, const char *name); @@ -190,6 +193,7 @@ H5_DLL herr_t H5P_close_class(void *_pclass); H5_DLL herr_t H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[], size_t namelen, char name[], unsigned *filter_config); +H5_DLL H5P_genprop_t *H5P__find_prop_plist(H5P_genplist_t *plist, const char *name); /* Testing functions */ #ifdef H5P_TESTING diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index ab3f1d0..6ebca3e 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -42,6 +42,27 @@ typedef struct H5P_genplist_t H5P_genplist_t; typedef struct H5P_genclass_t H5P_genclass_t; +typedef enum H5P_plist_type_t { + H5P_TYPE_USER = 0, + H5P_TYPE_ROOT = 1, + H5P_TYPE_OBJECT_CREATE = 2, + H5P_TYPE_FILE_CREATE = 3, + H5P_TYPE_FILE_ACCESS = 4, + H5P_TYPE_DATASET_CREATE = 5, + H5P_TYPE_DATASET_ACCESS = 6, + H5P_TYPE_DATASET_XFER = 7, + H5P_TYPE_FILE_MOUNT = 8, + H5P_TYPE_GROUP_CREATE = 9, + H5P_TYPE_GROUP_ACCESS = 10, + H5P_TYPE_DATATYPE_CREATE = 11, + H5P_TYPE_DATATYPE_ACCESS = 12, + H5P_TYPE_STRING_CREATE = 13, + H5P_TYPE_ATTRIBUTE_CREATE = 14, + H5P_TYPE_OBJECT_COPY = 15, + H5P_TYPE_LINK_CREATE = 16, + H5P_TYPE_LINK_ACCESS = 17, + H5P_TYPE_MAX_TYPE +} H5P_plist_type_t; /*****************************/ /* Library Private Variables */ diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c index 91cf70b..8573985 100644 --- a/src/H5Pstrcpl.c +++ b/src/H5Pstrcpl.c @@ -73,6 +73,7 @@ static herr_t H5P_strcrt_reg_prop(H5P_genclass_t *pclass); /* String creation property list class library initialization object */ const H5P_libclass_t H5P_CLS_STRCRT[1] = {{ "string create", /* Class name for debugging */ + H5P_TYPE_STRING_CREATE, /* Class type */ &H5P_CLS_ROOT_g, /* Parent class ID */ &H5P_CLS_STRING_CREATE_g, /* Pointer to class ID */ NULL, /* Pointer to default property list ID */ @@ -108,7 +109,7 @@ const H5P_libclass_t H5P_CLS_STRCRT[1] = {{ * October 31, 2006 *------------------------------------------------------------------------- */ -herr_t +static herr_t H5P_strcrt_reg_prop(H5P_genclass_t *pclass) { H5T_cset_t char_encoding = H5P_STRCRT_CHAR_ENCODING_DEF; /* Default character set encoding */ diff --git a/src/H5R.c b/src/H5R.c index 8fac4bf..d45947b 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -217,7 +217,7 @@ H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5 HDassert(_ref); HDassert(loc); HDassert(name); - HDassert(ref_type > H5R_BADTYPE || ref_type < H5R_MAXTYPE); + HDassert(ref_type > H5R_BADTYPE && ref_type < H5R_MAXTYPE); /* Set up object location to fill in */ obj_loc.oloc = &oloc; @@ -272,7 +272,7 @@ H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5 HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "Invalid amount of space for serializing selection") /* Increase buffer size to allow for the dataset OID */ - buf_size += sizeof(haddr_t); + buf_size += (hssize_t)sizeof(haddr_t); /* Allocate the space to store the serialized information */ H5_CHECK_OVERFLOW(buf_size, hssize_t, size_t); @@ -418,7 +418,7 @@ H5R_dereference(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, H5R_type_t ref_type, FUNC_ENTER_NOAPI_NOINIT HDassert(_ref); - HDassert(ref_type > H5R_BADTYPE || ref_type < H5R_MAXTYPE); + HDassert(ref_type > H5R_BADTYPE && ref_type < H5R_MAXTYPE); HDassert(file); /* Initialize the object location */ @@ -525,6 +525,8 @@ H5R_dereference(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, H5R_type_t ref_type, } /* end case */ break; + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: default: HGOTO_ERROR(H5E_REFERENCE, H5E_BADTYPE, FAIL, "can't identify type of object referenced") } /* end switch */ @@ -880,7 +882,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -ssize_t +static ssize_t H5R_get_name(H5F_t *f, hid_t lapl_id, hid_t dxpl_id, hid_t id, H5R_type_t ref_type, const void *_ref, char *name, size_t size) { diff --git a/src/H5SL.c b/src/H5SL.c index b6c9f8e..7581858 100644 --- a/src/H5SL.c +++ b/src/H5SL.c @@ -745,7 +745,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5SL_release_common(H5SL_t *slist, H5SL_operator_t op, void *op_data) { H5SL_node_t *node, *next_node; /* Pointers to skip list nodes */ @@ -817,7 +817,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5SL_close_common(H5SL_t *slist, H5SL_operator_t op, void *op_data) { herr_t ret_value = SUCCEED; @@ -873,7 +873,7 @@ H5SL_create(H5SL_type_t type, H5SL_cmp_t cmp) FUNC_ENTER_NOAPI(NULL) /* Check args */ - HDassert(type>=H5SL_TYPE_INT && type<=H5SL_TYPE_GENERIC); + HDassert(type >= H5SL_TYPE_INT && type <= H5SL_TYPE_GENERIC); /* Allocate skip list structure */ if(NULL == (new_slist = H5FL_MALLOC(H5SL_t))) @@ -889,7 +889,7 @@ H5SL_create(H5SL_type_t type, H5SL_cmp_t cmp) new_slist->nobjs = 0; /* Allocate the header node */ - if(NULL == (header = H5SL_new_node(NULL, NULL, ULONG_MAX))) + if(NULL == (header = H5SL_new_node(NULL, NULL, (uint32_t)ULONG_MAX))) HGOTO_ERROR(H5E_SLIST ,H5E_NOSPACE, NULL, "can't create new skip list node") /* Initialize header node's forward pointer */ diff --git a/src/H5Sall.c b/src/H5Sall.c index c99d699..8d56c80 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -112,7 +112,7 @@ static const H5S_sel_iter_class_t H5S_sel_iter_all[1] = {{ * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5S_all_iter_init (H5S_sel_iter_t *iter, const H5S_t *space) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -445,7 +445,7 @@ H5S_all_copy(H5S_t *dst, const H5S_t UNUSED *src, hbool_t UNUSED share_selection EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -htri_t +static htri_t H5S_all_is_valid (const H5S_t UNUSED *space) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -475,7 +475,7 @@ H5S_all_is_valid (const H5S_t UNUSED *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -hssize_t +static hssize_t H5S_all_serial_size (const H5S_t UNUSED *space) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -509,7 +509,7 @@ H5S_all_serial_size (const H5S_t UNUSED *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_all_serialize (const H5S_t *space, uint8_t *buf) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -545,7 +545,7 @@ H5S_all_serialize (const H5S_t *space, uint8_t *buf) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_all_deserialize(H5S_t *space, const uint8_t UNUSED *buf) { herr_t ret_value; /* return value */ @@ -588,7 +588,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) { unsigned rank; /* Dataspace rank */ @@ -633,7 +633,7 @@ H5S_all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_all_offset(const H5S_t UNUSED *space, hsize_t *offset) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -666,7 +666,7 @@ H5S_all_offset(const H5S_t UNUSED *space, hsize_t *offset) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -htri_t +static htri_t H5S_all_is_contiguous(const H5S_t UNUSED *space) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -695,7 +695,7 @@ H5S_all_is_contiguous(const H5S_t UNUSED *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -htri_t +static htri_t H5S_all_is_single(const H5S_t UNUSED *space) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -725,7 +725,7 @@ H5S_all_is_single(const H5S_t UNUSED *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -htri_t +static htri_t H5S_all_is_regular(const H5S_t UNUSED *space) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -755,7 +755,7 @@ H5S_all_is_regular(const H5S_t UNUSED *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_all_adjust_u(H5S_t UNUSED *space, const hsize_t UNUSED *offset) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -945,7 +945,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_all_get_seq_list(const H5S_t UNUSED *space, unsigned UNUSED flags, H5S_sel_iter_t *iter, size_t UNUSED maxseq, size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off, size_t *len) diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 1eeb098..d9b306d 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -234,7 +234,7 @@ H5S_hyper_print_diminfo(FILE *f, const H5S_t *space) * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) { const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */ @@ -1614,7 +1614,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_hyper_copy (H5S_t *dst, const H5S_t *src, hbool_t share_selection) { H5S_hyper_sel_t *dst_hslab; /* Pointer to destination hyperslab info */ @@ -1749,7 +1749,7 @@ H5S_hyper_is_valid_helper (const H5S_hyper_span_info_t *spans, const hssize_t *o EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -htri_t +static htri_t H5S_hyper_is_valid (const H5S_t *space) { unsigned u; /* Counter */ @@ -2068,7 +2068,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_hyper_serialize (const H5S_t *space, uint8_t *buf) { const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */ @@ -2229,7 +2229,7 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t *buf) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_hyper_deserialize (H5S_t *space, const uint8_t *buf) { uint32_t rank; /* rank of points */ @@ -2705,7 +2705,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) { unsigned rank; /* Dataspace rank */ @@ -2772,7 +2772,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_hyper_offset(const H5S_t *space, hsize_t *offset) { const hssize_t *sel_offset; /* Pointer to the selection's offset */ @@ -2878,7 +2878,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -htri_t +static htri_t H5S_hyper_is_contiguous(const H5S_t *space) { unsigned small_contiguous, /* Flag for small contiguous block */ @@ -3063,7 +3063,7 @@ H5S_hyper_is_contiguous(const H5S_t *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -htri_t +static htri_t H5S_hyper_is_single(const H5S_t *space) { H5S_hyper_span_info_t *spans; /* Hyperslab span info node */ @@ -3133,7 +3133,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -htri_t +static htri_t H5S_hyper_is_regular(const H5S_t *space) { htri_t ret_value; /* return value */ @@ -3175,7 +3175,7 @@ H5S_hyper_is_regular(const H5S_t *space) * changing the hyperslab selection of one data space causes a core dump * when closing some other data space. --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_hyper_release(H5S_t *space) { herr_t ret_value = SUCCEED; @@ -4008,7 +4008,7 @@ H5S_hyper_adjust_helper_u (H5S_hyper_span_info_t *spans, const hsize_t *offset) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_hyper_adjust_u(H5S_t *space, const hsize_t *offset) { unsigned u; /* Local index variable */ diff --git a/src/H5Snone.c b/src/H5Snone.c index e9a3bf9..021dd61 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -113,7 +113,7 @@ static const H5S_sel_iter_class_t H5S_sel_iter_none[1] = {{ * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t UNUSED *space) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -589,7 +589,7 @@ H5S_none_bounds(const H5S_t UNUSED *space, hsize_t UNUSED *start, hsize_t UNUSED EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_none_offset(const H5S_t UNUSED *space, hsize_t UNUSED *offset) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -708,7 +708,7 @@ H5S_none_is_regular(const H5S_t UNUSED *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_none_adjust_u(H5S_t UNUSED *space, const hsize_t UNUSED *offset) { FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 7e82295..817b2f2 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -120,7 +120,7 @@ H5FL_DEFINE_STATIC(H5S_pnt_list_t); * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1136,7 +1136,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_point_offset(const H5S_t *space, hsize_t *offset) { const hsize_t *pnt; /* Pointer to a selected point's coordinates */ @@ -1316,7 +1316,7 @@ H5S_point_is_regular(const H5S_t *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_point_adjust_u(H5S_t *space, const hsize_t *offset) { H5S_pnt_node_t *node; /* Point node */ diff --git a/src/H5T.c b/src/H5T.c index cee62b9..f6514f0 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -734,7 +734,7 @@ DESCRIPTION Initializes any interface-specific data or routines. --------------------------------------------------------------------------*/ -herr_t +static herr_t H5T_init_interface(void) { H5T_t *native_schar=NULL; /* Datatype structure for native signed char */ @@ -3155,7 +3155,7 @@ done: *------------------------------------------------------------------------- */ H5T_t * -H5T_copy(const H5T_t *old_dt, H5T_copy_t method) +H5T_copy(H5T_t *old_dt, H5T_copy_t method) { H5T_t *new_dt = NULL, *tmp = NULL; H5T_shared_t *reopened_fo = NULL; @@ -3840,8 +3840,10 @@ H5T_set_size(H5T_t *dt, size_t size) case H5T_ENUM: case H5T_VLEN: case H5T_ARRAY: - assert("can't happen" && 0); case H5T_REFERENCE: + assert("can't happen" && 0); + case H5T_NO_CLASS: + case H5T_NCLASSES: assert("invalid type" && 0); default: assert("not implemented yet" && 0); @@ -4296,6 +4298,9 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) /*void */ break; + case H5R_BADTYPE: + case H5R_MAXTYPE: + assert("invalid type" && 0); default: assert("not implemented yet" && 0); } @@ -5147,7 +5152,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) } /* end for */ /* Apply the accumulated size change to the datatype */ - dt->shared->size += accum_change; + dt->shared->size = (size_t)(dt->shared->size + accum_change); break; case H5T_VLEN: /* Recurse on the VL information if it's VL, compound or array, then free VL sequence */ diff --git a/src/H5Tarray.c b/src/H5Tarray.c index e9c8fe7..9986631 100644 --- a/src/H5Tarray.c +++ b/src/H5Tarray.c @@ -279,7 +279,7 @@ H5T__get_array_ndims(const H5T_t *dt) HDassert(dt->shared->type == H5T_ARRAY); /* Retrieve the number of dimensions */ - FUNC_LEAVE_NOAPI(dt->shared->u.array.ndims) + FUNC_LEAVE_NOAPI((int)dt->shared->u.array.ndims) } /* end H5T__get_array_ndims */ @@ -337,9 +337,8 @@ int H5T__get_array_dims(const H5T_t *dt, hsize_t dims[]) { unsigned u; /* Local index variable */ - int ret_value; /* return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_PACKAGE_NOERR HDassert(dt); HDassert(dt->shared->type == H5T_ARRAY); @@ -350,10 +349,7 @@ H5T__get_array_dims(const H5T_t *dt, hsize_t dims[]) dims[u] = dt->shared->u.array.dim[u]; /* Pass along the array rank as the return value */ - ret_value = dt->shared->u.array.ndims; - -done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI((int)dt->shared->u.array.ndims) } /* end H5T__get_array_dims */ #ifndef H5_NO_DEPRECATED_SYMBOLS diff --git a/src/H5Tfields.c b/src/H5Tfields.c index aa1efe8..163bab3 100644 --- a/src/H5Tfields.c +++ b/src/H5Tfields.c @@ -83,7 +83,7 @@ H5Tget_nmembers(hid_t type_id) H5TRACE1("Is", "i", type_id); /* Check args */ - if(NULL == (dt = H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if((ret_value = H5T_get_nmembers(dt)) < 0) @@ -165,7 +165,7 @@ H5Tget_member_name(hid_t type_id, unsigned membno) FUNC_ENTER_API(NULL) /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") if(NULL == (ret_value = H5T__get_member_name(dt, membno))) @@ -217,6 +217,17 @@ H5T__get_member_name(H5T_t const *dt, unsigned membno) ret_value = H5MM_xstrdup(dt->shared->u.enumer.name[membno]); break; + case H5T_NO_CLASS: + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: + case H5T_VLEN: + case H5T_ARRAY: + case H5T_NCLASSES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "operation not supported for type class") } /*lint !e788 All appropriate cases are covered */ @@ -255,31 +266,41 @@ H5Tget_member_index(hid_t type_id, const char *name) H5TRACE2("Is", "i*s", type_id, name); /* Check arguments */ - assert(name); - if(NULL==(dt=H5I_object_verify(type_id,H5I_DATATYPE))) + HDassert(name); + if(NULL == (dt = (H5T_t*)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Locate member by name */ - switch (dt->shared->type) { + switch(dt->shared->type) { case H5T_COMPOUND: - for(i=0; i< dt->shared->u.compnd.nmembs; i++) { + for(i = 0; i < dt->shared->u.compnd.nmembs; i++) if(!HDstrcmp(dt->shared->u.compnd.memb[i].name, name)) HGOTO_DONE((int)i) - } break; case H5T_ENUM: - for(i=0; i< dt->shared->u.enumer.nmembs; i++) { + for(i = 0; i < dt->shared->u.enumer.nmembs; i++) if(!HDstrcmp(dt->shared->u.enumer.name[i], name)) HGOTO_DONE((int)i) - } break; + + case H5T_NO_CLASS: + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: + case H5T_VLEN: + case H5T_ARRAY: + case H5T_NCLASSES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "operation not supported for this type") } /*lint !e788 All appropriate cases are covered */ done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Tget_member_index() */ /*------------------------------------------------------------------------- @@ -308,7 +329,7 @@ H5T__sort_value(const H5T_t *dt, int *map) unsigned i, j; /* Local index variables */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_PACKAGE_NOERR /* Check args */ HDassert(dt); @@ -381,7 +402,6 @@ H5T__sort_value(const H5T_t *dt, int *map) } /* end if */ } /* end else */ -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__sort_value() */ @@ -411,9 +431,8 @@ H5T__sort_name(const H5T_t *dt, int *map) size_t size; hbool_t swapped; uint8_t tbuf[32]; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_PACKAGE_NOERR /* Check args */ assert(dt); @@ -488,7 +507,6 @@ H5T__sort_name(const H5T_t *dt, int *map) } } -done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(SUCCEED) } diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 0c96896..345924c 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -106,7 +106,7 @@ H5_DLLVAR H5T_order_t H5T_native_order_g; /* Private functions */ H5_DLL herr_t H5TN_init_interface(void); H5_DLL herr_t H5T_init(void); -H5_DLL H5T_t *H5T_copy(const H5T_t *old_dt, H5T_copy_t method); +H5_DLL H5T_t *H5T_copy(H5T_t *old_dt, H5T_copy_t method); H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable); H5_DLL herr_t H5T_close(H5T_t *dt); H5_DLL H5T_t *H5T_get_super(const H5T_t *dt); diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index 48948a7..9fa3863 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -537,7 +537,7 @@ done: * *------------------------------------------------------------------------- */ -void +static void H5Z_xform_destroy_parse_tree(H5Z_node *tree) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -567,7 +567,7 @@ H5Z_xform_destroy_parse_tree(H5Z_node *tree) * *------------------------------------------------------------------------- */ -void * +static void * H5Z_xform_parse(const char *expression, H5Z_datval_ptrs* dat_val_pointers) { H5Z_token tok; @@ -1251,7 +1251,7 @@ done: * *------------------------------------------------------------------------- */ -void * +static void * H5Z_xform_copy_tree(H5Z_node* tree, H5Z_datval_ptrs* dat_val_pointers, H5Z_datval_ptrs* new_dat_val_pointers) { H5Z_node* ret_value=NULL; @@ -1386,7 +1386,7 @@ H5Z_op_is_numbs2(H5Z_node* _tree) * *------------------------------------------------------------------------- */ -void +static void H5Z_xform_reduce_tree(H5Z_node* tree) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1516,7 +1516,7 @@ H5Z_xform_create(const char *expr) * we don't need to allocate any space since no array will have to be * stored */ if(count > 0) - if(NULL == (data_xform_prop->dat_val_pointers->ptr_dat_val = (void *)H5MM_calloc(count * sizeof(void *)))) + if(NULL == (data_xform_prop->dat_val_pointers->ptr_dat_val = (void **)H5MM_calloc(count * sizeof(void *)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for pointers in transform array") /* Initialize the num_ptrs field, which will be used to keep track of the number of copies @@ -1651,7 +1651,7 @@ H5Z_xform_copy(H5Z_data_xform_t **data_xform_prop) count++; if(count > 0) - if(NULL == (new_data_xform_prop->dat_val_pointers->ptr_dat_val = (void *)H5MM_calloc(count * sizeof(void *)))) + if(NULL == (new_data_xform_prop->dat_val_pointers->ptr_dat_val = (void **)H5MM_calloc(count * sizeof(void *)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for pointers in transform array") /* Zero out num_pointers prior to H5Z_xform_cop_tree call; that call will increment it to the right amount */ diff --git a/src/H5private.h b/src/H5private.h index 0bf990d..2d97ad3 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -2315,7 +2315,8 @@ func_init_failed: \ /* Close Function */ \ } -/* Macro to begin/end tagging (when FUNC_ENTER_*TAG macros are insufficient) */ +/* Macro to begin/end tagging (when FUNC_ENTER_*TAG macros are insufficient). + * Make sure to use HGOTO_ERROR_TAG and HGOTO_DONE_TAG between these macros! */ #define H5_BEGIN_TAG(dxpl, tag, err) { \ haddr_t prv_tag = HADDR_UNDEF; \ hid_t my_dxpl_id = dxpl; \ diff --git a/src/H5public.h b/src/H5public.h index c7b3dc1..5efb4c5 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -75,10 +75,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 124 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 125 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "FA_a5" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.124-FA_a5" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.125-FA_a5" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/Makefile.in b/src/Makefile.in index c79b802..92454fb 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -487,7 +487,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 114 +LT_VERS_REVISION = 115 LT_VERS_AGE = 0 H5detect_CFLAGS = -g $(AM_CFLAGS) diff --git a/test/objcopy.c b/test/objcopy.c index 2270d19..1c66097 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -11982,6 +11982,104 @@ error: /*------------------------------------------------------------------------- + * Function: test_copy_iterate + * + * Purpose: Tests iterating over objects in the root group, copying + * all of them. + * + * Return: Success: 0 + * Failure: number of errors + * + * Programmer: Neil Fortner + * Thursday, July 12, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_copy_iterate_cb(hid_t loc_id, const char *name, + const H5L_info_t UNUSED *link_info, void *op_data) +{ + hid_t dst_loc_id = *((hid_t *)op_data); + + if(H5Ocopy(loc_id, name, dst_loc_id, name, H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + return(H5_ITER_CONT); + +error: + return(H5_ITER_ERROR); +} /* end test_copy_iterate_cb */ + +static int +test_copy_iterate(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl) +{ + hid_t fid1 = -1, fid2 = -1; /* File IDs */ + hid_t gid = -1; /* Group ID */ + int i; + char grp_name[8]; + char src_filename[NAME_BUF_SIZE]; + char dst_filename[NAME_BUF_SIZE]; + + TESTING("H5Ocopy(): inside H5Literate() callback"); + + /* Initialize the filenames */ + h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); + h5_fixname(FILENAME[1], src_fapl, dst_filename, sizeof dst_filename); + + /* Reset file address checking info */ + addr_reset(); + + /* Create source file */ + if((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) + TEST_ERROR + + /* Create groups */ + for(i=0; i<9; i++) { + HDsnprintf(grp_name, sizeof(grp_name), "grp%d", i); + if((gid = H5Gcreate2(fid1, grp_name, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT)) < 0) + TEST_ERROR + if(H5Gclose(gid) < 0) + TEST_ERROR + } /* end for */ + + /* Create destination file */ + if((fid2 = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) + TEST_ERROR + + /* Close files */ + if(H5Fclose(fid1) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + + /* Reopen files */ + if((fid1 = H5Fopen(src_filename, H5F_ACC_RDWR, src_fapl)) < 0) TEST_ERROR + if((fid2 = H5Fopen(dst_filename, H5F_ACC_RDWR, dst_fapl)) < 0) TEST_ERROR + + /* Iterate over links in the root group, copying each object */ + if((gid = H5Gopen2(fid1, "/", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Literate(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_copy_iterate_cb, + &fid2) < 0) + TEST_ERROR + + /* Close */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Fclose(fid1); + H5Fclose(fid2); + } H5E_END_TRY; + return 1; +} /* end test_copy_iterate */ + + +/*------------------------------------------------------------------------- * Function: test_copy_option * * Purpose: Create a group in SRC file and copy it to DST file @@ -12838,6 +12936,7 @@ main(void) nerrors += test_copy_same_file_named_datatype(fcpl_src, src_fapl); nerrors += test_copy_old_layout(fcpl_dst, dst_fapl); nerrors += test_copy_null_ref(fcpl_src, fcpl_dst, src_fapl, dst_fapl); + nerrors += test_copy_iterate(fcpl_src, fcpl_dst, src_fapl, dst_fapl); } /* TODO: not implemented diff --git a/tools/h5copy/testh5copy.sh b/tools/h5copy/testh5copy.sh index 4501e29..9b4fcff 100644 --- a/tools/h5copy/testh5copy.sh +++ b/tools/h5copy/testh5copy.sh @@ -76,6 +76,9 @@ H5LS_BIN=`pwd`/../h5ls/$H5LS # The path of the h5ls tool binary CMP='cmp -s' DIFF='diff -c' CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' nerrors=0 verbose=yes @@ -105,17 +108,26 @@ COPY_TESTFILES_TO_TESTDIR() echo $tstfile | tr -d ' ' | grep '^#' > /dev/null RET=$? if [ $RET -eq 1 ]; then - if [ -a $tstfile ]; then - $CP -f $tstfile $TESTDIR - else - echo "Error: FAILED to copy $tstfile." - echo " $tstfile doesn't exist!" - exit $EXIT_FAILURE + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $TESTDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi fi fi done } + # Print a "SKIP" message SKIP() { TESTING $H5COPY $@ diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh index be6a28e..8be8a54 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -41,6 +41,9 @@ H5DIFF_BIN=`pwd`/$H5DIFF # The path of the tool binary CMP='cmp -s' DIFF='diff -c' CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' nerrors=0 verbose=yes @@ -320,12 +323,20 @@ COPY_TESTFILES_TO_TESTDIR() echo $tstfile | tr -d ' ' | grep '^#' > /dev/null RET=$? if [ $RET -eq 1 ]; then - $CP -f $tstfile $TESTDIR - if [ $? -ne 0 ]; then - echo "Error: FAILED to copy $tstfile ." + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $TESTDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." - # Comment out this to CREATE expected file - exit $EXIT_FAILURE + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi fi fi done @@ -827,14 +838,7 @@ TOOLTEST h5diff_221.txt -c non_comparables1.h5 non_comparables2.h5 /g2 # entire file # All the comparables should display differences. -if test -n "$pmode"; then - # parallel mode: - # skip due to ph5diff hangs on koala (linux64-LE) and ember intermittently. - # (HDFFV-8003 - TBD) - SKIP -c non_comparables1.h5 non_comparables2.h5 -else - TOOLTEST h5diff_222.txt -c non_comparables1.h5 non_comparables2.h5 -fi +TOOLTEST h5diff_222.txt -c non_comparables1.h5 non_comparables2.h5 # non-comparable test for common objects (same name) with different object types # (HDFFV-7644) diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index fa71558..0ca6aa9 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -40,6 +40,9 @@ H5IMPORT_BIN=`pwd`/$H5IMPORT # The path of the h5import tool binary CMP='cmp -s' DIFF='diff -c' CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' nerrors=0 verbose=yes @@ -351,18 +354,25 @@ COPY_TESTFILES_TO_TESTDIR() echo $tstfile | tr -d ' ' | grep '^#' > /dev/null RET=$? if [ $RET -eq 1 ]; then - if [ -a $tstfile ]; then - $CP -f $tstfile $TESTDIR - else - echo "Error: FAILED to copy $tstfile" - echo " $tstfile doesn't exist!" - exit $EXIT_FAILURE + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $TESTDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi fi fi done } - # Print a line-line message left justified in a field of 70 characters # beginning with the word "Testing". # diff --git a/tools/h5dump/testh5dumppbits.sh.in b/tools/h5dump/testh5dumppbits.sh.in index 991fe7a..3d9685c 100644 --- a/tools/h5dump/testh5dumppbits.sh.in +++ b/tools/h5dump/testh5dumppbits.sh.in @@ -40,6 +40,9 @@ H5IMPORT_BIN=`pwd`/$H5IMPORT # The path of the h5import tool binary CMP='cmp -s' DIFF='diff -c' CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' nerrors=0 verbose=yes @@ -165,18 +168,25 @@ COPY_TESTFILES_TO_TESTDIR() echo $tstfile | tr -d ' ' | grep '^#' > /dev/null RET=$? if [ $RET -eq 1 ]; then - if [ -a $tstfile ]; then - $CP -f $tstfile $TESTDIR - else - echo "Error: FAILED to copy $tstfile" - echo " $tstfile doesn't exist!" - exit $EXIT_FAILURE + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $TESTDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi fi fi done } - # Print a line-line message left justified in a field of 70 characters # beginning with the word "Testing". # diff --git a/tools/h5dump/testh5dumpxml.sh.in b/tools/h5dump/testh5dumpxml.sh.in index 4e6081b..1a6b2b1 100644 --- a/tools/h5dump/testh5dumpxml.sh.in +++ b/tools/h5dump/testh5dumpxml.sh.in @@ -27,6 +27,9 @@ DUMPER_BIN=`pwd`/$DUMPER # The path of the tool binary CMP='cmp -s' DIFF='diff -c' CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' nerrors=0 verbose=yes @@ -195,12 +198,20 @@ COPY_TESTFILES_TO_TESTDIR() echo $tstfile | tr -d ' ' | grep '^#' > /dev/null RET=$? if [ $RET -eq 1 ]; then - if [ -a $tstfile ]; then - $CP -f $tstfile $TESTDIR - else - echo "Error: FAILED to copy $tstfile" - echo " $tstfile doesn't exist!" - exit $EXIT_FAILURE + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $TESTDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi fi fi done diff --git a/tools/h5import/CMakeLists.txt b/tools/h5import/CMakeLists.txt index 5bbcf02..a655bf2 100644 --- a/tools/h5import/CMakeLists.txt +++ b/tools/h5import/CMakeLists.txt @@ -263,6 +263,18 @@ IF (BUILD_TESTING) ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_H5_DUMPTEST testname datasetname testfile) + MACRO (ADD_H5_SKIP_DUMPTEST testname datasetname testfile) + ADD_TEST ( + NAME H5IMPORT-DUMP-${testname}-SKIPPED + COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${testname} ${datasetname} ${testfile} --- DEFLATE filter not available" + ) + ENDMACRO (ADD_H5_SKIP_DUMPTEST testname datasetname testfile) + + # -------------------------------------------------------------------- + # Determine if filter is available for h5diff + # -------------------------------------------------------------------- + SET (USE_FILTER_DEFLATE H5_HAVE_FILTER_DEFLATE) + ############################################################################## ############################################################################## ### T H E T E S T S ### @@ -314,11 +326,19 @@ IF (BUILD_TESTING) # ----- TESTING "BINARY F64 - rank 3 - Output LE+CHUNKED+Extended+Compressed " ADD_H5_TEST (BINARY_F64 binfp64.bin testfiles/binfp64.conf binfp64.h5) - ADD_H5_DUMPTEST (BINARY_F64 "/fp/bin/64-bit" binfp64.h5 BINARY) + IF (NOT USE_FILTER_DEFLATE) + ADD_H5_SKIP_DUMPTEST (BINARY_F64 "/fp/bin/64-bit" binfp64.h5 BINARY) + ELSE (NOT USE_FILTER_DEFLATE) + ADD_H5_DUMPTEST (BINARY_F64 "/fp/bin/64-bit" binfp64.h5 BINARY) + ENDIF (NOT USE_FILTER_DEFLATE) # ----- TESTING "BINARY I8 - rank 3 - Output I16LE + Chunked+Extended+Compressed " ADD_H5_TEST (BINARY_I8 binin8.bin testfiles/binin8.conf binin8.h5) - ADD_H5_DUMPTEST (BINARY_I8 "/int/bin/8-bit" binin8.h5 BINARY) + IF (NOT USE_FILTER_DEFLATE) + ADD_H5_SKIP_DUMPTEST (BINARY_I8 "/int/bin/8-bit" binin8.h5 BINARY) + ELSE (NOT USE_FILTER_DEFLATE) + ADD_H5_DUMPTEST (BINARY_I8 "/int/bin/8-bit" binin8.h5 BINARY) + ENDIF (NOT USE_FILTER_DEFLATE) # ----- TESTING "BINARY I16 - rank 3 - Output order LE + CHUNKED + extended " ADD_H5_TEST (BINARY_I16 binin16.bin testfiles/binin16.conf binin16.h5) diff --git a/tools/h5import/h5importtestutil.sh b/tools/h5import/h5importtestutil.sh index 5be3118..4831f71 100755 --- a/tools/h5import/h5importtestutil.sh +++ b/tools/h5import/h5importtestutil.sh @@ -16,11 +16,17 @@ # HDF Utilities Test script # Usage: h5importtestutil.sh [machine-type] +# Determine which filters are available +USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@" + TESTNAME=h5import EXIT_SUCCESS=0 EXIT_FAILURE=1 CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' # initialize errors variable nerrors=0 @@ -125,12 +131,20 @@ COPY_TESTFILES_TO_TESTDIR() echo $tstfile | tr -d ' ' | grep '^#' > /dev/null RET=$? if [ $RET -eq 1 ]; then - if [ -a $tstfile ]; then - $CP -f $tstfile $TESTDIR - else - echo "Error: FAILED to copy $tstfile" - echo " $tstfile doesn't exist!" - exit $EXIT_FAILURE + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $TESTDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi fi fi done @@ -141,6 +155,12 @@ TESTING() { echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' } +# Print a "SKIP" message +SKIP() { + TESTING $TESTNAME $@ + echo " -SKIP-" +} + TOOLTEST() { err=0 @@ -273,13 +293,21 @@ TOOLTEST $TESTDIR/txtfp64.txt -c $TESTDIR/txtfp64.conf -o txtfp64.h5 TESTING "BINARY F64 - rank 3 - Output LE+CHUNKED+Extended+Compressed " TOOLTEST binfp64.bin -c $TESTDIR/binfp64.conf -o binfp64.h5 TESTING "H5DUMP-BINARY F64 - rank 3 - Output LE+CHUNKED+Extended+Compressed " -TOOLTEST2 "/fp/bin/64-bit" binfp64.h5 +if test $USE_FILTER_DEFLATE != "yes"; then + SKIP "/fp/bin/64-bit" binfp64.h5 +else + TOOLTEST2 "/fp/bin/64-bit" binfp64.h5 +fi TESTING "BINARY I8 - rank 3 - Output I16LE + Chunked+Extended+Compressed " TOOLTEST binin8.bin -c $TESTDIR/binin8.conf -o binin8.h5 TESTING "H5DUMP-BINARY I8 - rank 3 - Output I16LE + Chunked+Extended+Compressed " -TOOLTEST2 "/int/bin/8-bit" binin8.h5 +if test $USE_FILTER_DEFLATE != "yes"; then + SKIP "/int/bin/8-bit" binin8.h5 +else + TOOLTEST2 "/int/bin/8-bit" binin8.h5 +fi TESTING "BINARY I16 - rank 3 - Output order LE + CHUNKED + extended " TOOLTEST binin16.bin -c $TESTDIR/binin16.conf -o binin16.h5 diff --git a/tools/h5jam/testh5jam.sh.in b/tools/h5jam/testh5jam.sh.in index f359926..29e02bd 100644 --- a/tools/h5jam/testh5jam.sh.in +++ b/tools/h5jam/testh5jam.sh.in @@ -36,6 +36,9 @@ CMP='cmp -s' DIFF='diff -c' AWK='awk' CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' nerrors=0 verbose=yes @@ -103,12 +106,20 @@ COPY_TESTFILES_TO_TESTDIR() echo $tstfile | tr -d ' ' | grep '^#' > /dev/null RET=$? if [ $RET -eq 1 ]; then - if [ -a $tstfile ]; then - $CP -f $tstfile $TESTDIR - else - echo "Error: FAILED to copy $tstfile" - echo " $tstfile doesn't exist!" - exit $EXIT_FAILURE + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $TESTDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi fi fi done diff --git a/tools/h5ls/testh5ls.sh.in b/tools/h5ls/testh5ls.sh.in index 8f793ba3d..c0667f5 100644 --- a/tools/h5ls/testh5ls.sh.in +++ b/tools/h5ls/testh5ls.sh.in @@ -26,6 +26,9 @@ CMP='cmp -s' DIFF='diff -c' CP='cp' NLINES=20 # Max. lines of output to display if test fails +DIRNAME='dirname' +LS='ls' +AWK='awk' WORDS_BIGENDIAN="@WORDS_BIGENDIAN@" @@ -169,12 +172,20 @@ COPY_TESTFILES_TO_TESTDIR() echo $tstfile | tr -d ' ' | grep '^#' > /dev/null RET=$? if [ $RET -eq 1 ]; then - if [ -a $tstfile ]; then - $CP -f $tstfile $TESTDIR - else - echo "Error: FAILED to copy $tstfile" - echo " $tstfile doesn't exist!" - exit $EXIT_FAILURE + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $TESTDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi fi fi done diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in index e05b03f..b702152 100644 --- a/tools/h5repack/h5repack.sh.in +++ b/tools/h5repack/h5repack.sh.in @@ -42,6 +42,9 @@ H5DUMP_BIN=`pwd`/$H5DUMP # The path of the h5dump tool binary GREP='grep' CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' H5DETECTSZIP=testh5repack_detect_szip H5DETECTSZIP_BIN=`pwd`/$H5DETECTSZIP @@ -137,12 +140,20 @@ COPY_TESTFILES_TO_TESTDIR() echo $tstfile | tr -d ' ' | grep '^#' > /dev/null RET=$? if [ $RET -eq 1 ]; then - if [ -a $tstfile ]; then - $CP -f $tstfile $TESTDIR - else - echo "Error: FAILED to copy $tstfile" - echo " $tstfile doesn't exist!" - exit $EXIT_FAILURE + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $TESTDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi fi fi done diff --git a/tools/h5stat/testh5stat.sh.in b/tools/h5stat/testh5stat.sh.in index c605295..8646fd3 100644 --- a/tools/h5stat/testh5stat.sh.in +++ b/tools/h5stat/testh5stat.sh.in @@ -33,6 +33,9 @@ STAT_BIN=`pwd`/$STAT # The path of the tool binary CMP='cmp -s' DIFF='diff -c' CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' nerrors=0 verbose=yes @@ -108,12 +111,20 @@ COPY_TESTFILES_TO_TESTDIR() echo $tstfile | tr -d ' ' | grep '^#' > /dev/null RET=$? if [ $RET -eq 1 ]; then - if [ -a $tstfile ]; then - $CP -f $tstfile $TESTDIR - else - echo "Error: FAILED to copy $tstfile" - echo " $tstfile doesn't exist!" - exit $EXIT_FAILURE + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $TESTDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi fi fi done diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index 6d48d5f..21420ce 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -40,6 +40,7 @@ H5_SET_LIB_OPTIONS ( HDF5_TOOLS_LIB_NAME_RELEASE HDF5_TOOLS_LIB_NAME_DEBUG ) +#SET_TARGET_PROPERTIES (hdf5_tools PROPERTIES COMPILE_DEFINITIONS H5DIFF_DEBUG) SET_TARGET_PROPERTIES (hdf5_tools PROPERTIES FOLDER libraries/tools) ############################################################################## diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index bcd63f1..48e82bb 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -21,23 +21,6 @@ #include "h5diff.h" #include "ph5diff.h" -/* - * Debug printf macros. The prefix allows output filtering by test scripts. - */ -#ifdef H5DIFF_DEBUG -#define h5diffdebug(x) HDfprintf(stderr, "h5diff debug: " x) -#define h5diffdebug2(x1, x2) HDfprintf(stderr, "h5diff debug: " x1, x2) -#define h5diffdebug3(x1, x2, x3) HDfprintf(stderr, "h5diff debug: " x1, x2, x3) -#define h5diffdebug4(x1, x2, x3, x4) HDfprintf(stderr, "h5diff debug: " x1, x2, x3, x4) -#define h5diffdebug5(x1, x2, x3, x4, x5) HDfprintf(stderr, "h5diff debug: " x1, x2, x3, x4, x5) -#else -#define h5diffdebug(x) -#define h5diffdebug2(x1, x2) -#define h5diffdebug3(x1, x2, x3) -#define h5diffdebug4(x1, x2, x3, x4) -#define h5diffdebug5(x1, x2, x3, x4, x5) -#endif - /*------------------------------------------------------------------------- * Function: print_objname @@ -369,6 +352,7 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch trav_table_t *table; size_t idx; + h5difftrace("build_match_list start\n"); /* init */ trav_table_init( &table ); @@ -378,6 +362,7 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch * All the objects belong to given groups are the cadidates. * So prepare to compare paths without the group names. */ + /* if obj1 is not root */ if (HDstrcmp (objname1,"/") != 0) path1_offset = HDstrlen(objname1); @@ -390,7 +375,6 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch */ while(curr1 < info1->nused && curr2 < info2->nused) { - path1_lp = (info1->paths[curr1].path) + path1_offset; path2_lp = (info2->paths[curr2].path) + path2_offset; type1_l = info1->paths[curr1].type; @@ -399,7 +383,8 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch /* criteria is string compare */ cmp = HDstrcmp(path1_lp, path2_lp); - if(cmp == 0) { + if(cmp == 0) + { if(!is_exclude_path(path1_lp, type1_l, options)) { infile[0] = 1; @@ -470,29 +455,9 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch } /* end while */ free_exclude_path_list (options); - /*------------------------------------------------------ - * print the list - */ - if(options->m_verbose) - { - parallel_print("\n"); - /* if given objects is group under root */ - if (HDstrcmp (objname1,"/") || HDstrcmp (objname2,"/")) - parallel_print("group1 group2\n"); - else - parallel_print("file1 file2\n"); - parallel_print("---------------------------------------\n"); - for(i = 0; i < table->nobjs; i++) - { - char c1, c2; - c1 = (table->objs[i].flags[0]) ? 'x' : ' '; - c2 = (table->objs[i].flags[1]) ? 'x' : ' '; - parallel_print("%5c %6c %-15s\n", c1, c2, table->objs[i].name); - } /* end for */ - parallel_print ("\n"); - } /* end if */ *table_out = table; + h5difftrace("build_match_list finish\n"); } @@ -653,6 +618,7 @@ hsize_t h5diff(const char *fname1, int l_ret2 = -1; const char * obj1fullname = NULL; const char * obj2fullname = NULL; + int both_objs_grp = 0; /* init to group type */ h5trav_type_t obj1type = H5TRAV_TYPE_GROUP; h5trav_type_t obj2type = H5TRAV_TYPE_GROUP; @@ -675,6 +641,7 @@ hsize_t h5diff(const char *fname1, /* list for common objects */ trav_table_t *match_list = NULL; + h5difftrace("h5diff start\n"); /* init filenames */ HDmemset(filenames, 0, MAX_FILENAME * 2); /* init link info struct */ @@ -723,6 +690,7 @@ hsize_t h5diff(const char *fname1, trav_info_init(fname1, file1_id, &info1_obj); trav_info_init(fname2, file2_id, &info2_obj); + h5difftrace("trav_info_init initialized\n"); /* if any object is specified */ if (objname1) { @@ -751,6 +719,7 @@ hsize_t h5diff(const char *fname1, /*---------------------------------------------------------- * check if obj1 is root, group, single object or symlink */ + h5difftrace("h5diff check if obj1 is root, group, single object or symlink\n"); if(!HDstrcmp((char *)obj1fullname, "/")) { obj1type = H5TRAV_TYPE_GROUP; @@ -778,6 +747,7 @@ hsize_t h5diff(const char *fname1, */ if(src_linfo1.type == H5L_TYPE_HARD) { + int idx = 0; /* optional data pass */ info1_obj->opts = (diff_opt_t*)options; @@ -789,6 +759,9 @@ hsize_t h5diff(const char *fname1, } obj1type = oinfo1.type; trav_info_add(info1_obj, obj1fullname, obj1type); + idx = info1_obj->nused - 1; + info1_obj->paths[idx].objno = oinfo1.addr; + info1_obj->paths[idx].fileno = oinfo1.fileno; } else if (src_linfo1.type == H5L_TYPE_SOFT) { @@ -805,6 +778,7 @@ hsize_t h5diff(const char *fname1, /*---------------------------------------------------------- * check if obj2 is root, group, single object or symlink */ + h5difftrace("h5diff check if obj2 is root, group, single object or symlink\n"); if(!HDstrcmp(obj2fullname, "/")) { obj2type = H5TRAV_TYPE_GROUP; @@ -832,6 +806,7 @@ hsize_t h5diff(const char *fname1, */ if(src_linfo2.type == H5L_TYPE_HARD) { + int idx = 0; /* optional data pass */ info2_obj->opts = (diff_opt_t*)options; @@ -843,6 +818,9 @@ hsize_t h5diff(const char *fname1, } obj2type = oinfo2.type; trav_info_add(info2_obj, obj2fullname, obj2type); + idx = info2_obj->nused - 1; + info2_obj->paths[idx].objno = oinfo2.addr; + info2_obj->paths[idx].fileno = oinfo2.fileno; } else if (src_linfo2.type == H5L_TYPE_SOFT) { @@ -859,11 +837,14 @@ hsize_t h5diff(const char *fname1, /* if no object specified */ else { + h5difftrace("h5diff no object specified\n"); /* set root group */ obj1fullname = (char*)HDcalloc(2, sizeof(char)); HDstrcat((char *)obj1fullname, "/"); + obj1type = H5TRAV_TYPE_GROUP; obj2fullname = (char*)HDcalloc(2, sizeof(char)); HDstrcat((char *)obj2fullname, "/"); + obj2type = H5TRAV_TYPE_GROUP; } @@ -883,9 +864,11 @@ hsize_t h5diff(const char *fname1, /*------------------------------- * check symbolic link (object1) */ + h5difftrace("h5diff check symbolic link (object1)\n"); /* dangling link */ if (l_ret1 == 0) { + h5difftrace("h5diff ... dangling link\n"); if (options->no_dangle_links) { /* treat dangling link is error */ @@ -913,15 +896,27 @@ hsize_t h5diff(const char *fname1, goto out; } else if(l_ret1 != 2) /* symbolic link */ + { obj1type = trg_linfo1.trg_type; + h5difftrace("h5diff ... ... trg_linfo1.trg_type == H5L_TYPE_HARD\n"); + if (info1_lp != NULL) { + int idx = info1_lp->nused - 1; + h5difftrace("h5diff ... ... ... info1_obj not null\n"); + info1_lp->paths[idx].type = trg_linfo1.trg_type; + info1_lp->paths[idx].objno = trg_linfo1.objno; + info1_lp->paths[idx].fileno = trg_linfo1.fileno; + } + h5difftrace("h5diff check symbolic link (object1) finished\n"); + } /*------------------------------- * check symbolic link (object2) */ - + h5difftrace("h5diff check symbolic link (object2)\n"); /* dangling link */ if (l_ret2 == 0) { + h5difftrace("h5diff ... dangling link\n"); if (options->no_dangle_links) { /* treat dangling link is error */ @@ -949,11 +944,21 @@ hsize_t h5diff(const char *fname1, goto out; } else if(l_ret2 != 2) /* symbolic link */ + { obj2type = trg_linfo2.trg_type; + if (info2_lp != NULL) { + int idx = info2_lp->nused - 1; + h5difftrace("h5diff ... ... ... info2_obj not null\n"); + info2_lp->paths[idx].type = trg_linfo2.trg_type; + info2_lp->paths[idx].objno = trg_linfo2.objno; + info2_lp->paths[idx].fileno = trg_linfo2.fileno; + } + h5difftrace("h5diff check symbolic link (object1) finished\n"); + } } /* end of if follow symlinks */ /* - * If verbose options is not used, don't need to traverse thorugh the list + * If verbose options is not used, don't need to traverse through the list * of objects in the group to display objects information, * So use h5tools_is_obj_same() to improve performance by skipping * comparing details of same objects. @@ -961,26 +966,26 @@ hsize_t h5diff(const char *fname1, if(!(options->m_verbose || options->m_report)) { + h5difftrace("h5diff NOT (options->m_verbose || options->m_report)\n"); /* if no danglink links */ if ( l_ret1 > 0 && l_ret2 > 0 ) - if (h5tools_is_obj_same(file1_id,obj1fullname,file2_id,obj2fullname)!=0) + if (h5tools_is_obj_same(file1_id, obj1fullname, file2_id, obj2fullname)!=0) goto out; } - - /* if both obj1 and obj2 are group */ - if (obj1type == H5TRAV_TYPE_GROUP && obj2type == H5TRAV_TYPE_GROUP) + both_objs_grp = (obj1type == H5TRAV_TYPE_GROUP && obj2type == H5TRAV_TYPE_GROUP); + if (both_objs_grp) { - - /* - * traverse group1 + h5difftrace("h5diff both_objs_grp TRUE\n"); + /* + * traverse group1 */ trav_info_init(fname1, file1_id, &info1_grp); /* optional data pass */ info1_grp->opts = (diff_opt_t*)options; - if(h5trav_visit(file1_id,obj1fullname,TRUE,TRUE, - trav_grp_objs,trav_grp_symlinks, info1_grp) < 0) + if(h5trav_visit(file1_id, obj1fullname, TRUE, TRUE, + trav_grp_objs, trav_grp_symlinks, info1_grp) < 0) { parallel_print("Error: Could not get file contents\n"); options->err_stat = 1; @@ -988,28 +993,30 @@ hsize_t h5diff(const char *fname1, } info1_lp = info1_grp; - /* - * traverse group2 + /* + * traverse group2 */ trav_info_init(fname2, file2_id, &info2_grp); /* optional data pass */ info2_grp->opts = (diff_opt_t*)options; - if(h5trav_visit(file2_id,obj2fullname,TRUE,TRUE, - trav_grp_objs,trav_grp_symlinks, info2_grp) < 0) + if(h5trav_visit(file2_id, obj2fullname, TRUE, TRUE, + trav_grp_objs, trav_grp_symlinks, info2_grp) < 0) { parallel_print("Error: Could not get file contents\n"); options->err_stat = 1; goto out; } /* end if */ info2_lp = info2_grp; - + } #ifdef H5_HAVE_PARALLEL - if(g_Parallel) + if(g_Parallel) + { + /* if both obj1 and obj2 are group */ + if (both_objs_grp) { - if((HDstrlen(fname1) > MAX_FILENAME) || - (HDstrlen(fname2) > MAX_FILENAME)) + if((HDstrlen(fname1) > MAX_FILENAME) || (HDstrlen(fname2) > MAX_FILENAME)) { HDfprintf(stderr, "The parallel diff only supports path names up to %d characters\n", MAX_FILENAME); MPI_Abort(MPI_COMM_WORLD, 0); @@ -1021,26 +1028,45 @@ hsize_t h5diff(const char *fname1, /* Alert the worker tasks that there's going to be work. */ for(i = 1; i < g_nTasks; i++) MPI_Send(filenames, (MAX_FILENAME * 2), MPI_CHAR, i, MPI_TAG_PARALLEL, MPI_COMM_WORLD); - } /* end if */ -#endif - build_match_list (obj1fullname, info1_lp, obj2fullname, info2_lp, - &match_list, options); - nfound = diff_match(file1_id, obj1fullname, info1_lp, - file2_id, obj2fullname, info2_lp, - match_list, options); - } - else - { -#ifdef H5_HAVE_PARALLEL - if(g_Parallel) + } + else + { /* Only single object diff, parallel workers won't be needed */ phdiff_dismiss_workers(); + } + } /* end if */ #endif - nfound = diff_compare(file1_id, fname1, obj1fullname, info1_lp, - file2_id, fname2, obj2fullname, info2_lp, - options); + /* process the objects */ + build_match_list (obj1fullname, info1_lp, obj2fullname, info2_lp, + &match_list, options); + if (both_objs_grp) + { + /*------------------------------------------------------ + * print the list + */ + if(options->m_verbose) + { + parallel_print("\n"); + /* if given objects is group under root */ + if (HDstrcmp (obj1fullname,"/") || HDstrcmp (obj2fullname,"/")) + parallel_print("group1 group2\n"); + else + parallel_print("file1 file2\n"); + parallel_print("---------------------------------------\n"); + for(i = 0; i < match_list->nobjs; i++) + { + char c1, c2; + c1 = (match_list->objs[i].flags[0]) ? 'x' : ' '; + c2 = (match_list->objs[i].flags[1]) ? 'x' : ' '; + parallel_print("%5c %6c %-15s\n", c1, c2, match_list->objs[i].name); + } /* end for */ + parallel_print ("\n"); + } /* end if */ } + nfound = diff_match(file1_id, obj1fullname, info1_lp, + file2_id, obj2fullname, info2_lp, + match_list, options); out: #ifdef H5_HAVE_PARALLEL @@ -1077,6 +1103,7 @@ out: H5Fclose(file1_id); H5Fclose(file2_id); } H5E_END_TRY; + h5difftrace("h5diff finish\n"); return nfound; } @@ -1125,6 +1152,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, size_t idx2 = 0; + h5difftrace("diff_match start\n"); /* * if not root, prepare object name to be pre-appended to group path to * make full path @@ -1142,7 +1170,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, *------------------------------------------------------------------------- */ - /* not valid compare nused when --exclude-path option is used */ + /* not valid compare used when --exclude-path option is used */ if (!options->exclude_path) { /* number of different objects */ @@ -1222,7 +1250,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, { int workerFound = 0; - h5diffdebug("beginning of big else block\n"); + h5difftrace("Beginning of big else block\n"); /* We're in parallel mode */ /* Since the data type of diff value is hsize_t which can * be arbitary large such that there is no MPI type that @@ -1247,7 +1275,6 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, args.argdata.type[1] = info2->paths[idx2].type; args.argdata.is_same_trgobj = table->objs[i].is_same_trgobj; - h5diffdebug2("busyTasks=%d\n", busyTasks); /* if there are any outstanding print requests, let's handle one. */ if(busyTasks > 0) { @@ -1319,7 +1346,6 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, } /* end if */ } /* end for */ - h5diffdebug2("workerfound is %d \n", workerFound); if(!workerFound) { /* if they were all busy, we've got to wait for one free up @@ -1395,7 +1421,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, HDfree (obj2_fullpath); } /* end if */ } /* end for */ - h5diffdebug("done with for loop\n"); + h5difftrace("done with for loop\n"); #ifdef H5_HAVE_PARALLEL if(g_Parallel) @@ -1411,14 +1437,6 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp; busyTasks--; } /* end if */ - else if(Status.MPI_TAG == MPI_TAG_TOK_RETURN) - { - MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status); - nfound += nFoundbyWorker.nfound; - options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp; - busyTasks--; - havePrintToken = 1; - } /* end else-if */ else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST) { MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status); @@ -1490,7 +1508,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, /* Print any final data waiting in our queue */ print_incoming_data(); } /* end if */ - h5diffdebug("done with if block\n"); + h5difftrace("done with if block\n"); HDfree(workerTasks); } @@ -1499,130 +1517,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, /* free table */ if (table) trav_table_free(table); - - return nfound; -} - - -/*------------------------------------------------------------------------- - * Function: diff_compare - * - * Purpose: get objects from list, and check for the same type - * - * Return: Number of differences found - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * Date: May 9, 2003 - * - * Programmer: Jonathan Kim - * - add following links feature (Feb 11,2010) - *------------------------------------------------------------------------- - */ - -hsize_t diff_compare(hid_t file1_id, - const char *file1_name, - const char *obj1_name, - trav_info_t *info1, - hid_t file2_id, - const char *file2_name, - const char *obj2_name, - trav_info_t *info2, - diff_opt_t *options) -{ - int f1 = 0; - int f2 = 0; - hsize_t nfound = 0; - ssize_t i,j; - int l_ret; - int is_dangle_link1 = 0; - int is_dangle_link2 = 0; - const char *obj1name = obj1_name; - const char *obj2name = obj2_name; - diff_args_t argdata; - - /* local variables for diff() */ - h5trav_type_t obj1type, obj2type; - - /* to get link info */ - h5tool_link_info_t linkinfo1; - h5tool_link_info_t linkinfo2; - - /* init link info struct */ - HDmemset(&linkinfo1, 0, sizeof(h5tool_link_info_t)); - HDmemset(&linkinfo2, 0, sizeof(h5tool_link_info_t)); - - i = h5trav_getindex (info1, obj1name); - j = h5trav_getindex (info2, obj2name); - - if (i == -1) - { - parallel_print ("Object <%s> could not be found in <%s>\n", obj1name, - file1_name); - f1 = 1; - } - if (j == -1) - { - parallel_print ("Object <%s> could not be found in <%s>\n", obj2name, - file2_name); - f2 = 1; - } - if (f1 || f2) - { - options->err_stat = 1; - return 0; - } - /* use the name with "/" first, as obtained by iterator function */ - obj1name = info1->paths[i].path; - obj2name = info2->paths[j].path; - - obj1type = info1->paths[i].type; - obj2type = info2->paths[j].type; - - /* Set argdata to pass other args into diff() */ - argdata.type[0] = obj1type; - argdata.type[1] = obj2type; - argdata.is_same_trgobj = 0; - - nfound = diff(file1_id, obj1name, - file2_id, obj2name, - options, &argdata); - -out: - /*------------------------------- - * handle dangling link(s) */ - /* both obj1 and obj2 are dangling links */ - if(is_dangle_link1 && is_dangle_link2) - { - if(print_objname(options, nfound)) - { - do_print_objname("dangling link", obj1name, obj2name, options); - print_found(nfound); - } - } - /* obj1 is dangling link */ - else if (is_dangle_link1) - { - if(options->m_verbose) - parallel_print("obj1 <%s> is a dangling link.\n", obj1name); - nfound++; - if(print_objname(options, nfound)) - print_found(nfound); - } - /* obj2 is dangling link */ - else if (is_dangle_link2) - { - if(options->m_verbose) - parallel_print("obj2 <%s> is a dangling link.\n", obj2name); - nfound++; - if(print_objname(options, nfound)) - print_found(nfound); - } - - /* free link info buffer */ - if (linkinfo1.trg_path) - HDfree((char *)linkinfo1.trg_path); - if (linkinfo2.trg_path) - HDfree((char *)linkinfo2.trg_path); + h5difftrace("diff_match finish\n"); return nfound; } @@ -1672,11 +1567,12 @@ hsize_t diff(hid_t file1_id, hsize_t nfound = 0; h5trav_type_t object_type; - /* to get link info */ h5tool_link_info_t linkinfo1; h5tool_link_info_t linkinfo2; + h5difftrace("diff start\n"); + /*init link info struct */ HDmemset(&linkinfo1,0,sizeof(h5tool_link_info_t)); HDmemset(&linkinfo2,0,sizeof(h5tool_link_info_t)); @@ -1776,6 +1672,7 @@ hsize_t diff(hid_t file1_id, */ if (argdata->is_same_trgobj) { + h5difftrace("argdata->is_same_trgobj\n"); is_hard_link = (object_type == H5TRAV_TYPE_DATASET || object_type == H5TRAV_TYPE_NAMED_DATATYPE || object_type == H5TRAV_TYPE_GROUP); @@ -2061,6 +1958,7 @@ out2: H5Tclose(grp2_id); /* enable error reporting */ } H5E_END_TRY; + h5difftrace("diff finish\n"); return nfound; } diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index 6985b68..f05d0de 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -19,6 +19,23 @@ #include "hdf5.h" #include "h5trav.h" +/* + * Debug printf macros. The prefix allows output filtering by test scripts. + */ +#ifdef H5DIFF_DEBUG +#define h5difftrace(x) HDfprintf(stderr, "h5diff debug: " x) +#define h5diffdebug2(x1, x2) HDfprintf(stderr, "h5diff debug: " x1, x2) +#define h5diffdebug3(x1, x2, x3) HDfprintf(stderr, "h5diff debug: " x1, x2, x3) +#define h5diffdebug4(x1, x2, x3, x4) HDfprintf(stderr, "h5diff debug: " x1, x2, x3, x4) +#define h5diffdebug5(x1, x2, x3, x4, x5) HDfprintf(stderr, "h5diff debug: " x1, x2, x3, x4, x5) +#else +#define h5difftrace(x) +#define h5diffdebug2(x1, x2) +#define h5diffdebug3(x1, x2, x3) +#define h5diffdebug4(x1, x2, x3, x4) +#define h5diffdebug5(x1, x2, x3, x4, x5) +#endif + #define MAX_FILENAME 1024 /*------------------------------------------------------------------------- @@ -118,15 +135,6 @@ hsize_t diff_datasetid( hid_t dset1_id, const char *obj2_name, diff_opt_t *options); -hsize_t diff_compare( hid_t file1_id, - const char *file1_name, - const char *obj1_name, - trav_info_t *info1, - hid_t file2_id, - const char *file2_name, - const char *obj2_name, - trav_info_t *info2, - diff_opt_t *options ); hsize_t diff_match( hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id, const char *grp2, trav_info_t *info2, diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 604a825..1e7f88b 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -230,6 +230,7 @@ hsize_t diff_array( void *_mem1, mcomp_t members; H5T_class_t type_class; + h5difftrace("diff_array start\n"); /* get the size. */ size = H5Tget_size( m_type ); type_class = H5Tget_class(m_type); @@ -344,6 +345,7 @@ hsize_t diff_array( void *_mem1, } /* i */ close_member_types(&members); } /* switch */ + h5difftrace("diff_array finish\n"); return nfound; } @@ -423,6 +425,7 @@ hsize_t diff_datum(void *_mem1, double per; int both_zero; + h5difftrace("diff_datum start\n"); type_size = H5Tget_size( m_type ); type_class = H5Tget_class(m_type); @@ -2537,6 +2540,7 @@ hsize_t diff_datum(void *_mem1, break; /* H5T_FLOAT class */ } /* switch */ + h5difftrace("diff_datum finish\n"); return nfound; } @@ -2822,6 +2826,7 @@ hsize_t character_compare(unsigned char *mem1, HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + h5difftrace("character_compare start\n"); if (temp1_uchar != temp2_uchar) { @@ -2836,6 +2841,7 @@ hsize_t character_compare(unsigned char *mem1, } nfound++; } + h5difftrace("character_compare finish\n"); return nfound; } @@ -2872,6 +2878,7 @@ hsize_t character_compare_opt(unsigned char *mem1, HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + h5difftrace("character_compare_opt start\n"); /* -d and !-p */ if (options->d && !options->p) @@ -2927,6 +2934,7 @@ hsize_t character_compare_opt(unsigned char *mem1, } nfound++; } + h5difftrace("character_compare_opt finish\n"); return nfound; @@ -2965,6 +2973,7 @@ hsize_t diff_float(unsigned char *mem1, int isnan1=0; int isnan2=0; + h5difftrace("diff_float start\n"); /*------------------------------------------------------------------------- * -d and !-p @@ -3202,6 +3211,7 @@ hsize_t diff_float(unsigned char *mem1, } + h5difftrace("diff_float finish\n"); return nfound; } @@ -3239,6 +3249,7 @@ hsize_t diff_double(unsigned char *mem1, int isnan1=0; int isnan2=0; + h5difftrace("diff_double start\n"); /*------------------------------------------------------------------------- * -d and !-p *------------------------------------------------------------------------- @@ -3479,6 +3490,7 @@ hsize_t diff_double(unsigned char *mem1, } + h5difftrace("diff_double finish\n"); return nfound; } @@ -3521,6 +3533,7 @@ hsize_t diff_ldouble(unsigned char *mem1, int isnan1=0; int isnan2=0; + h5difftrace("diff_ldouble start\n"); /*------------------------------------------------------------------------- * -d and !-p @@ -3762,6 +3775,7 @@ hsize_t diff_ldouble(unsigned char *mem1, } + h5difftrace("diff_ldouble finish\n"); return nfound; } @@ -3802,6 +3816,7 @@ hsize_t diff_schar(unsigned char *mem1, double per; int both_zero; + h5difftrace("diff_schar start\n"); /* -d and !-p */ if (options->d && !options->p) @@ -3943,6 +3958,7 @@ hsize_t diff_schar(unsigned char *mem1, } /* nelmts */ } + h5difftrace("diff_schar finish\n"); return nfound; } @@ -3979,6 +3995,7 @@ hsize_t diff_uchar(unsigned char *mem1, double per; int both_zero; + h5difftrace("diff_uchar start\n"); /* -d and !-p */ if (options->d && !options->p) @@ -4121,6 +4138,7 @@ hsize_t diff_uchar(unsigned char *mem1, } /* nelmts */ } + h5difftrace("diff_uchar finish\n"); return nfound; } @@ -4155,6 +4173,7 @@ hsize_t diff_short(unsigned char *mem1, double per; int both_zero; + h5difftrace("diff_short start\n"); /* -d and !-p */ if (options->d && !options->p) { @@ -4298,6 +4317,7 @@ hsize_t diff_short(unsigned char *mem1, } /* nelmts */ } + h5difftrace("diff_short finish\n"); return nfound; } @@ -4333,6 +4353,7 @@ hsize_t diff_ushort(unsigned char *mem1, double per; int both_zero; + h5difftrace("diff_ushort start\n"); /* -d and !-p */ if (options->d && !options->p) { @@ -4476,6 +4497,7 @@ hsize_t diff_ushort(unsigned char *mem1, } /* nelmts */ } + h5difftrace("diff_ushort finish\n"); return nfound; } @@ -4512,6 +4534,7 @@ hsize_t diff_int(unsigned char *mem1, double per; int both_zero; + h5difftrace("diff_int start\n"); /* -d and !-p */ if (options->d && !options->p) { @@ -4655,6 +4678,7 @@ hsize_t diff_int(unsigned char *mem1, } /* nelmts */ } + h5difftrace("diff_int finish\n"); return nfound; } @@ -4691,6 +4715,7 @@ hsize_t diff_uint(unsigned char *mem1, double per; int both_zero; + h5difftrace("diff_uint start\n"); /* -d and !-p */ if (options->d && !options->p) { @@ -4832,6 +4857,7 @@ hsize_t diff_uint(unsigned char *mem1, } /* nelmts */ } + h5difftrace("diff_uint finish\n"); return nfound; } @@ -4868,6 +4894,7 @@ hsize_t diff_long(unsigned char *mem1, double per; int both_zero; + h5difftrace("diff_long start\n"); /* -d and !-p */ if (options->d && !options->p) { @@ -5014,6 +5041,7 @@ hsize_t diff_long(unsigned char *mem1, } /* nelmts */ } + h5difftrace("diff_long finish\n"); return nfound; } @@ -5051,6 +5079,7 @@ hsize_t diff_ulong(unsigned char *mem1, double per; int both_zero; + h5difftrace("diff_ulong start\n"); /* -d and !-p */ if (options->d && !options->p) @@ -5198,6 +5227,7 @@ hsize_t diff_ulong(unsigned char *mem1, } /* nelmts */ } + h5difftrace("diff_ulong finish\n"); return nfound; } @@ -5234,6 +5264,7 @@ hsize_t diff_llong(unsigned char *mem1, double per; int both_zero; + h5difftrace("diff_llong start\n"); /* -d and !-p */ if (options->d && !options->p) { @@ -5371,6 +5402,7 @@ hsize_t diff_llong(unsigned char *mem1, } /* nelmts */ } + h5difftrace("diff_llong finish\n"); return nfound; } @@ -5408,6 +5440,7 @@ hsize_t diff_ullong(unsigned char *mem1, double per; int both_zero; + h5difftrace("diff_ullong start\n"); /* -d and !-p */ if (options->d && !options->p) { @@ -5549,6 +5582,7 @@ hsize_t diff_ullong(unsigned char *mem1, } /* nelmts */ } + h5difftrace("diff_ullong finish\n"); return nfound; } @@ -5575,6 +5609,7 @@ int ull2float(unsigned long long ull_value, float *f_value) size_t src_size; size_t dst_size; + h5difftrace("ull2float start\n"); if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0) return -1; @@ -5592,6 +5627,7 @@ int ull2float(unsigned long long ull_value, float *f_value) if(buf) HDfree(buf); + h5difftrace("ull2float finish\n"); return 0; @@ -5601,6 +5637,7 @@ error: } H5E_END_TRY; if(buf) HDfree(buf); + h5difftrace("ull2float errored\n"); return -1; } @@ -5620,6 +5657,7 @@ error: static hbool_t equal_double(double value, double expected, diff_opt_t *options) { + h5difftrace("equal_double start\n"); if ( options->do_nans ) { @@ -5656,6 +5694,7 @@ hbool_t equal_double(double value, double expected, diff_opt_t *options) if ( ABS( (value-expected) ) < DBL_EPSILON) return TRUE; } + h5difftrace("equal_double finish\n"); return FALSE; } @@ -5673,6 +5712,7 @@ hbool_t equal_double(double value, double expected, diff_opt_t *options) static hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *options) { + h5difftrace("equal_ldouble start\n"); if ( options->do_nans ) { @@ -5709,6 +5749,7 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio if ( ABS( (value-expected) ) < DBL_EPSILON) return TRUE; } + h5difftrace("equal_ldouble finish\n"); return FALSE; } @@ -5730,6 +5771,7 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio static hbool_t equal_float(float value, float expected, diff_opt_t *options) { + h5difftrace("equal_float start\n"); if ( options->do_nans ) { @@ -5766,6 +5808,7 @@ hbool_t equal_float(float value, float expected, diff_opt_t *options) if ( ABS( (value-expected) ) < FLT_EPSILON) return TRUE; } + h5difftrace("equal_float finish\n"); return FALSE; @@ -5795,6 +5838,7 @@ my_isnan(dtype_t type, void *val) int retval = 0; char s[256]; + h5difftrace("my_isnan start\n"); if (FLT_FLOAT==type) { float x; @@ -5893,6 +5937,7 @@ my_isnan(dtype_t type, void *val) } } #endif /*H5_VMS*/ + h5difftrace("my_isnan finish\n"); return retval; } diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index c1ed429..da58cde 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -218,6 +218,7 @@ hsize_t diff_datasetid( hid_t did1, int i; unsigned int vl_data = 0; /*contains VL datatypes */ + h5difftrace("diff_datasetid start\n"); /* Get the dataspace handle */ if ( (sid1 = H5Dget_space(did1)) < 0 ) goto error; @@ -263,6 +264,7 @@ hsize_t diff_datasetid( hid_t did1, * check for empty datasets *------------------------------------------------------------------------- */ + h5difftrace("check for empty datasets\n"); storage_size1=H5Dget_storage_size(did1); storage_size2=H5Dget_storage_size(did2); @@ -300,6 +302,7 @@ hsize_t diff_datasetid( hid_t did1, * memory type and sizes *------------------------------------------------------------------------- */ + h5difftrace("check for memory type and sizes\n"); if ((m_tid1=h5tools_get_native_type(f_tid1)) < 0) goto error; @@ -315,10 +318,12 @@ hsize_t diff_datasetid( hid_t did1, */ if (can_compare) { + h5difftrace("can_compare for sign\n"); sign1=H5Tget_sign(m_tid1); sign2=H5Tget_sign(m_tid2); if ( sign1 != sign2 ) { + h5difftrace("sign1 != sign2\n"); if ((options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) { parallel_print("Not comparable: <%s> has sign %s ", obj1_name, get_sign(sign1)); @@ -341,6 +346,7 @@ hsize_t diff_datasetid( hid_t did1, */ if(can_compare) /* it is possible to compare */ { + h5difftrace("can_compare attempt\n"); /*----------------------------------------------------------------- * get number of elements @@ -360,8 +366,10 @@ hsize_t diff_datasetid( hid_t did1, * "upgrade" the smaller memory size *------------------------------------------------------------------ */ + h5difftrace("upgrade the smaller memory size?\n"); if(m_size1 != m_size2) { + h5difftrace("m_size1 != m_size2\n"); if(m_size1 < m_size2) { H5Tclose(m_tid1); @@ -399,6 +407,7 @@ hsize_t diff_datasetid( hid_t did1, } /* end if */ if(buf1 != NULL && buf2 != NULL) { + h5difftrace("buf1 != NULL && buf2 != NULL\n"); if(H5Dread(did1, m_tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1) < 0) goto error; if(H5Dread(did2, m_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2) < 0) @@ -519,6 +528,7 @@ hsize_t diff_datasetid( hid_t did1, * the if condition refers to cases when the dataset is a referenced object *------------------------------------------------------------------------- */ + h5difftrace("compare attributes?\n"); if(obj1_name) nfound += diff_attr(did1,did2,obj1_name,obj2_name,options); @@ -526,6 +536,7 @@ hsize_t diff_datasetid( hid_t did1, * close *------------------------------------------------------------------------- */ + h5difftrace("compare attributes?\n"); /* free */ if(buf1 != NULL) { @@ -553,6 +564,7 @@ hsize_t diff_datasetid( hid_t did1, H5Tclose(m_tid1); H5Tclose(m_tid2); } H5E_END_TRY; + h5difftrace("diff_datasetid finish\n"); return nfound; @@ -603,6 +615,7 @@ error: H5Tclose(m_tid2); /* enable error reporting */ } H5E_END_TRY; + h5difftrace("diff_datasetid errored\n"); return nfound; } diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 24aa81a..7b6098d 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1064,37 +1064,6 @@ init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) } /*------------------------------------------------------------------------- - * Function: do_bin_output - * - * Purpose: Dump memory buffer to a binary file stream - * - * Return: Success: SUCCEED - * Failure: FAIL - *------------------------------------------------------------------------- - */ -int -do_bin_output(FILE *stream, FILE *err_stream, hid_t container, hsize_t nelmts, hid_t tid, void *_mem) -{ - HERR_INIT(int, SUCCEED) - unsigned char *mem = (unsigned char*)_mem; - size_t size; /* datum size */ - hsize_t i; /* element counter */ - - if((size = H5Tget_size(tid)) == 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - - for (i = 0; i < nelmts; i++) { - if (render_bin_output(stream, container, tid, mem + i * size) < 0) { - HDfprintf(err_stream,"\nError in writing binary stream\n"); - return FAIL; - } - } - -CATCH - return ret_value; -} - -/*------------------------------------------------------------------------- * Function: render_bin_output * * Purpose: Write one element of memory buffer to a binary file stream @@ -1104,369 +1073,182 @@ CATCH *------------------------------------------------------------------------- */ int -render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem) +render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts) { HERR_INIT(int, SUCCEED) unsigned char *mem = (unsigned char*)_mem; size_t size; /* datum size */ - float tempfloat; - double tempdouble; - unsigned long long tempullong; - long long templlong; - unsigned long tempulong; - long templong; - unsigned int tempuint; - int tempint; - unsigned short tempushort; - short tempshort; - unsigned char tempuchar; - char tempschar; -#if H5_SIZEOF_LONG_DOUBLE !=0 - long double templdouble; -#endif -#ifdef DEBUG_H5DUMP_BIN - static char fmt_llong[8], fmt_ullong[8]; - if (!fmt_llong[0]) { - HDsprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH); - HDsprintf(fmt_ullong, "%%%su", H5_PRINTF_LL_WIDTH); - } -#endif + hsize_t block_index; + H5T_class_t type_class; if((size = H5Tget_size(tid)) == 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - if (H5Tequal(tid, H5T_NATIVE_FLOAT)) { - HDmemcpy(&tempfloat, mem, sizeof(float)); -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, "%g ", tempfloat); -#else - if (1 != HDfwrite(&tempfloat, size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } - else if (H5Tequal(tid, H5T_NATIVE_DOUBLE)) { - HDmemcpy(&tempdouble, mem, sizeof(double)); -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, "%g ", tempdouble); -#else - if (1 != HDfwrite(&tempdouble, size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } -#if H5_SIZEOF_LONG_DOUBLE !=0 - else if (H5Tequal(tid, H5T_NATIVE_LDOUBLE)) { - HDmemcpy(&templdouble, mem, sizeof(long double)); -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, "%Lf ", templdouble); -#else - if (1 != HDfwrite(&templdouble, size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } -#endif - else if (H5T_STRING == H5Tget_class(tid)) { - unsigned int i; - H5T_str_t pad; - char *s; - - pad = H5Tget_strpad(tid); - - if (H5Tis_variable_str(tid)) { - s = *(char**) mem; - if (s != NULL) - size = HDstrlen(s); - } - else { - s = (char *) mem; - if((size = H5Tget_size(tid)) == 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - } - for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) { - HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char)); -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, "%d", tempuchar); -#else - if (1 != HDfwrite(&tempuchar, size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } /* i */ - } - else if (H5Tequal(tid, H5T_NATIVE_INT)) { - HDmemcpy(&tempint, mem, sizeof(int)); -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, "%d ", tempint); -#else - if (1 != HDfwrite(&tempint, size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } - else if (H5Tequal(tid, H5T_NATIVE_UINT)) { - HDmemcpy(&tempuint, mem, sizeof(unsigned int)); -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, "%u ", tempuint); -#else - if (1 != HDfwrite(&tempuint, size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } - else if (H5Tequal(tid, H5T_NATIVE_SCHAR)) { - HDmemcpy(&tempschar, mem, sizeof(char)); -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, "%d ", tempschar); -#else - if (1 != HDfwrite(&tempschar, size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } - else if (H5Tequal(tid, H5T_NATIVE_UCHAR)) { - HDmemcpy(&tempuchar, mem, sizeof(unsigned char)); -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, "%u ", tempuchar); -#else - if (1 != HDfwrite(&tempuchar, size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } - else if (H5Tequal(tid, H5T_NATIVE_SHORT)) { - HDmemcpy(&tempshort, mem, sizeof(short)); -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, "%d ", tempshort); -#else - if (1 != HDfwrite(&tempshort, size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } - else if (H5Tequal(tid, H5T_NATIVE_USHORT)) { - HDmemcpy(&tempushort, mem, sizeof(unsigned short)); -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, "%u ", tempushort); -#else - if (1 != HDfwrite(&tempushort, size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } - else if (H5Tequal(tid, H5T_NATIVE_LONG)) { - HDmemcpy(&templong, mem, sizeof(long)); -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, "%ld ", templong); -#else - if (1 != HDfwrite(&templong, size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } - else if (H5Tequal(tid, H5T_NATIVE_ULONG)) { - HDmemcpy(&tempulong, mem, sizeof(unsigned long)); -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, "%lu ", tempulong); -#else - if (1 != HDfwrite(&tempulong, size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } - else if (H5Tequal(tid, H5T_NATIVE_LLONG)) { - HDmemcpy(&templlong, mem, sizeof(long long)); -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, fmt_llong, templlong); -#else - if (1 != HDfwrite(&templlong, size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } - else if (H5Tequal(tid, H5T_NATIVE_ULLONG)) { - HDmemcpy(&tempullong, mem, sizeof(unsigned long long)); -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, fmt_ullong, tempullong); -#else - if (1 != HDfwrite(&tempullong, size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } - else if (H5Tequal(tid, H5T_NATIVE_HSSIZE)) { - if (sizeof(hssize_t) == sizeof(int)) { - HDmemcpy(&tempint, mem, sizeof(int)); -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, "%d ", tempint); -#else - if (1 != HDfwrite(&tempint, size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } - else if (sizeof(hssize_t) == sizeof(long)) { - HDmemcpy(&templong, mem, sizeof(long)); -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, "%ld ", templong); -#else - if (1 != HDfwrite(&templong, size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } - else { - HDmemcpy(&templlong, mem, sizeof(long long)); -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, fmt_llong, templlong); -#else - if (1 != HDfwrite(&templlong, size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } - } - else if (H5Tequal(tid, H5T_NATIVE_HSIZE)) { - if (sizeof(hsize_t) == sizeof(int)) { - HDmemcpy(&tempuint, mem, sizeof(unsigned int)); -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, "%u ", tempuint); -#else - if (1 != HDfwrite(&tempuint, size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } - else if (sizeof(hsize_t) == sizeof(long)) { - HDmemcpy(&tempulong, mem, sizeof(unsigned long)); -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, "%lu ", tempulong); -#else - if (1 != HDfwrite(&tempulong, size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } - else { - HDmemcpy(&tempullong, mem, sizeof(unsigned long long)); -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, fmt_ullong, tempullong); -#else - if (1 != HDfwrite(&tempullong, size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } - } - else if (H5Tget_class(tid) == H5T_COMPOUND) { - unsigned j; - hid_t memb; - unsigned nmembs; - size_t offset; + if((type_class = H5Tget_class(tid)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed"); - nmembs = H5Tget_nmembers(tid); + switch (type_class) { + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_ENUM: + block_index = block_nelmts * size; + while(block_index > 0) { + size_t bytes_in = 0; /* # of bytes to write */ + size_t bytes_wrote = 0; /* # of bytes written */ + size_t item_size = size; /* size of items in bytes */ - for (j = 0; j < nmembs; j++) { - offset = H5Tget_member_offset(tid, j); - memb = H5Tget_member_type(tid, j); + if(block_index > sizeof(size_t)) + bytes_in = sizeof(size_t); + else + bytes_in = (size_t)block_index; - if (render_bin_output(stream, container, memb, mem + offset) < 0) - return FAIL; + bytes_wrote = HDfwrite(mem, 1, bytes_in, stream); - H5Tclose(memb); - } - } - else if (H5Tget_class(tid) == H5T_ENUM) { - unsigned int i; - if (1 == size) { -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, "0x%02x", mem[0]); -#else - if (1 != HDfwrite(&mem[0], size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } - else { - for (i = 0; i < size; i++) { -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, "%s%02x", i?":":"", mem[i]); -#else - if (1 != HDfwrite(&mem[i], sizeof(char), 1, stream)) + if(bytes_wrote != bytes_in || (0 == bytes_wrote && HDferror(stream))) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } /*i*/ - }/*else 1 */ - } - else if (H5Tget_class(tid) == H5T_ARRAY) { - int k, ndims; - hsize_t i, dims[H5S_MAX_RANK], temp_nelmts, nelmts; - hid_t memb; - - /* get the array's base datatype for each element */ - memb = H5Tget_super(tid); - size = H5Tget_size(memb); - ndims = H5Tget_array_ndims(tid); - H5Tget_array_dims2(tid, dims); - HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK); - - /* calculate the number of array elements */ - for (k = 0, nelmts = 1; k < ndims; k++) { - temp_nelmts = nelmts; - temp_nelmts *= dims[k]; - nelmts = (size_t) temp_nelmts; - } - - /* dump the array element */ - for (i = 0; i < nelmts; i++) { - if (render_bin_output(stream, container, memb, mem + i * size) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed"); - } - H5Tclose(memb); - } - else if (H5Tget_class(tid) == H5T_VLEN) { - unsigned int i; - hsize_t nelmts; - hid_t memb; - - /* get the VL sequences's base datatype for each element */ - memb = H5Tget_super(tid); - size = H5Tget_size(memb); - - /* Get the number of sequence elements */ - nelmts = ((hvl_t *) mem)->len; - - for (i = 0; i < nelmts; i++) { - /* dump the array element */ - 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 = H5Rdereference2(container, H5P_DEFAULT, 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) { -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, "0x%02x", mem[0]); -#else - if (1 != HDfwrite(&mem[0], size, 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } - else { - for (i = 0; i < size; i++) { -#ifdef DEBUG_H5DUMP_BIN - HDfprintf(stream, "%s%02x", i?":":"", mem[i]); -#else - if (1 != HDfwrite(&mem[i], sizeof(char), 1, stream)) + block_index -= (hsize_t)bytes_wrote; + mem = mem + bytes_wrote; + } + break; + case H5T_STRING: + { + unsigned int i; + H5T_str_t pad; + char *s; + unsigned char tempuchar; + + pad = H5Tget_strpad(tid); + + for (block_index = 0; block_index < block_nelmts; block_index++) { + mem = ((unsigned char*)_mem) + block_index * size; + + if (H5Tis_variable_str(tid)) { + s = *(char**) mem; + if (s != NULL) + size = HDstrlen(s); + } + else { + s = (char *) mem; + } + for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) { + HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char)); + if (1 != HDfwrite(&tempuchar, size, 1, stream)) + H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); + } /* i */ + } /* for (block_index = 0; block_index < block_nelmts; block_index++) */ + } + break; + case H5T_COMPOUND: + { + unsigned j; + hid_t memb; + unsigned nmembs; + size_t offset; + + nmembs = H5Tget_nmembers(tid); + + for (block_index = 0; block_index < block_nelmts; block_index++) { + mem = ((unsigned char*)_mem) + block_index * size; + for (j = 0; j < nmembs; j++) { + offset = H5Tget_member_offset(tid, j); + memb = H5Tget_member_type(tid, j); + + if (render_bin_output(stream, container, memb, mem + offset, 1) < 0) + return FAIL; + + H5Tclose(memb); + } + } + } + break; + case H5T_ARRAY: + { + int k, ndims; + hsize_t i, dims[H5S_MAX_RANK], temp_nelmts, nelmts; + hid_t memb; + + /* get the array's base datatype for each element */ + memb = H5Tget_super(tid); + ndims = H5Tget_array_ndims(tid); + H5Tget_array_dims2(tid, dims); + HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK); + + /* calculate the number of array elements */ + for (k = 0, nelmts = 1; k < ndims; k++) { + temp_nelmts = nelmts; + temp_nelmts *= dims[k]; + nelmts = (size_t) temp_nelmts; + } + + for (block_index = 0; block_index < block_nelmts; block_index++) { + mem = ((unsigned char*)_mem) + block_index * size; + /* dump the array element */ + if (render_bin_output(stream, container, memb, mem, nelmts) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed"); + } + H5Tclose(memb); + } + break; + case H5T_VLEN: + { + unsigned int i; + hsize_t nelmts; + hid_t memb; + + /* get the VL sequences's base datatype for each element */ + memb = H5Tget_super(tid); + + for (block_index = 0; block_index < block_nelmts; block_index++) { + mem = ((unsigned char*)_mem) + block_index * size; + /* Get the number of sequence elements */ + nelmts = ((hvl_t *) mem)->len; + + /* dump the array element */ + if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed"); + } + H5Tclose(memb); + } + break; + case H5T_REFERENCE: + { + if (H5Tequal(tid, H5T_STD_REF_DSETREG)) { + if (region_output) { + /* region data */ + hid_t region_id, region_space; + H5S_sel_type region_type; + + for (block_index = 0; block_index < block_nelmts; block_index++) { + mem = ((unsigned char*)_mem) + block_index * size; + region_id = H5Rdereference2(container, H5P_DEFAULT, 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)) { + ; + } + } + break; + default: + for (block_index = 0; block_index < block_nelmts; block_index++) { + mem = ((unsigned char*)_mem) + block_index * size; + if (size != HDfwrite(mem, sizeof(char), size, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); -#endif - } /*i*/ - }/*else 1 */ + } + break; } CATCH @@ -1552,12 +1334,8 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, 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 (numindex = 0; numindex < numelem; numindex++) { - - render_bin_output(stream, container, type_id, - ((char*)region_buf + numindex * type_size)); - /* Render the region data element end */ - } /* end for (jndx = 0; jndx < numelem; jndx++) */ + render_bin_output(stream, container, type_id, (char*)region_buf, numelem); + /* Render the region data element end */ } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */ done: @@ -1684,12 +1462,10 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id, 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"); + 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++) */ + render_bin_output(stream, container, type_id, (char*)region_buf, npoints); done: HDfree(region_buf); diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 83484db..15e4e00 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -569,8 +569,7 @@ H5TOOLS_DLL void h5tools_simple_prefix(FILE *stream, const h5tool_format_t *i H5TOOLS_DLL void h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hsize_t elmtno, hsize_t *ptdata, int secnum); -H5TOOLS_DLL int do_bin_output(FILE *stream, FILE *err_stream, hid_t container, hsize_t nelmts, hid_t tid, void *_mem); -H5TOOLS_DLL int render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem); +H5TOOLS_DLL int render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t nelmts); H5TOOLS_DLL 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); H5TOOLS_DLL hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id, diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 8805793..2e6a99d 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -283,7 +283,9 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai /* binary dump */ if (bin_output) { - do_bin_output(rawdatastream, rawoutstream, container, nelmts, type, _mem); + if (render_bin_output(rawdatastream, container, type, _mem, nelmts) < 0) { + HDfprintf(rawoutstream,"\nError in writing binary stream\n"); + } } /* end if */ else { /* setup */ diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 9dac227..11850f2 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -708,6 +708,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai unsigned nmembs; static char fmt_llong[8], fmt_ullong[8]; H5T_str_t pad; + H5T_class_t type_class; /* * some tempvars to store the value before we append it to the string to @@ -744,532 +745,544 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } } } - else if (H5Tequal(type, H5T_NATIVE_FLOAT)) { - float tempfloat; + else { + if((type_class = H5Tget_class(type)) < 0) + return NULL; + switch (type_class) { + case H5T_FLOAT: + if (H5Tequal(type, H5T_NATIVE_FLOAT)) { + float tempfloat; - HDmemcpy(&tempfloat, vp, sizeof(float)); - h5tools_str_append(str, OPT(info->fmt_float, "%g"), tempfloat); - } - else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) { - double tempdouble; + HDmemcpy(&tempfloat, vp, sizeof(float)); + h5tools_str_append(str, OPT(info->fmt_float, "%g"), tempfloat); + } + else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) { + double tempdouble; - HDmemcpy(&tempdouble, vp, sizeof(double)); - h5tools_str_append(str, OPT(info->fmt_double, "%g"), tempdouble); + HDmemcpy(&tempdouble, vp, sizeof(double)); + h5tools_str_append(str, OPT(info->fmt_double, "%g"), tempdouble); #if H5_SIZEOF_LONG_DOUBLE !=0 - } - else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) { - long double templdouble; + } + else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) { + long double templdouble; - HDmemcpy(&templdouble, vp, sizeof(long double)); - h5tools_str_append(str, "%Lf", templdouble); + HDmemcpy(&templdouble, vp, sizeof(long double)); + h5tools_str_append(str, "%Lf", templdouble); #endif - } - else if (info->ascii && (H5Tequal(type, H5T_NATIVE_SCHAR) || - H5Tequal(type, H5T_NATIVE_UCHAR))) { - h5tools_print_char(str, info, (char) (*ucp_vp)); - } - else if (H5T_STRING == H5Tget_class(type)) { - unsigned int i; - char quote = '\0'; - char *s; - - quote = '\0'; - if (H5Tis_variable_str(type)) { - /* cp_vp is the pointer into the struct where a `char*' is stored. So we have - * to dereference the pointer to get the `char*' to pass to HDstrlen(). */ - s = *(char**) cp_vp; - if (s != NULL) - size = HDstrlen(s); - } - else { - s = cp_vp; - size = H5Tget_size(type); - } - pad = H5Tget_strpad(type); - - /* Check for NULL pointer for string */ - if (s == NULL) { - h5tools_str_append(str, "NULL"); - } - else { - for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) { - int j = 1; - - /* - * Count how many times the next character repeats. If the - * threshold is zero then that means it can repeat any number - * of times. - */ - if (info->str_repeat > 0) - while (i + j < size && s[i] == s[i + j]) - j++; - - /* - * Print the opening quote. If the repeat count is high enough to - * warrant printing the number of repeats instead of enumerating - * the characters, then make sure the character to be repeated is - * in it's own quote. - */ - if (info->str_repeat > 0 && j > info->str_repeat) { - if (quote) - h5tools_str_append(str, "%c", quote); - - quote = '\''; - h5tools_str_append(str, "%s%c", i ? " " : "", quote); - } - else if (!quote) { - quote = '"'; - h5tools_str_append(str, "%s%c", i ? " " : "", quote); } + break; + case H5T_STRING: + { + unsigned int i; + char quote = '\0'; + char *s; - /* Print the character */ - h5tools_print_char(str, info, s[i]); - - /* Print the repeat count */ - if (info->str_repeat && j > info->str_repeat) { + quote = '\0'; + if (H5Tis_variable_str(type)) { + /* cp_vp is the pointer into the struct where a `char*' is stored. So we have + * to dereference the pointer to get the `char*' to pass to HDstrlen(). */ + s = *(char**) cp_vp; + if (s != NULL) size = HDstrlen(s); + } + else { + s = cp_vp; + size = H5Tget_size(type); + } + pad = H5Tget_strpad(type); + + /* Check for NULL pointer for string */ + if (s == NULL) { + h5tools_str_append(str, "NULL"); + } + else { + for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) { + int j = 1; + + /* + * Count how many times the next character repeats. If the + * threshold is zero then that means it can repeat any number + * of times. + */ + if (info->str_repeat > 0) while (i + j < size && s[i] == s[i + j]) + j++; + + /* + * Print the opening quote. If the repeat count is high enough to + * warrant printing the number of repeats instead of enumerating + * the characters, then make sure the character to be repeated is + * in it's own quote. + */ + if (info->str_repeat > 0 && j > info->str_repeat) { + if (quote) h5tools_str_append(str, "%c", quote); + + quote = '\''; + h5tools_str_append(str, "%s%c", i ? " " : "", quote); + } + else if (!quote) { + quote = '"'; + h5tools_str_append(str, "%s%c", i ? " " : "", quote); + } + + /* Print the character */ + h5tools_print_char(str, info, s[i]); + + /* Print the repeat count */ + if (info->str_repeat && j > info->str_repeat) { #ifdef REPEAT_VERBOSE - h5tools_str_append(str, "%c repeats %d times", quote, j - 1); + h5tools_str_append(str, "%c repeats %d times", quote, j - 1); #else - h5tools_str_append(str, "%c*%d", quote, j - 1); + h5tools_str_append(str, "%c*%d", quote, j - 1); #endif /* REPEAT_VERBOSE */ - quote = '\0'; - i += j - 1; - } + quote = '\0'; + i += j - 1; + } - } + } - if (quote) - h5tools_str_append(str, "%c", quote); + if (quote) h5tools_str_append(str, "%c", quote); - if (i == 0) - /*empty string*/ - h5tools_str_append(str, "\"\""); - } /* end else */ - } - else if (H5Tequal(type, H5T_NATIVE_INT)) { - HDmemcpy(&tempint, vp, sizeof(int)); - if(packed_bits_num) { - if(packed_data_offset >= 8*sizeof(int)) - tempint = 0; - else - tempint = (tempint >> packed_data_offset) & packed_data_mask; - } - h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint); - } - else if (H5Tequal(type, H5T_NATIVE_UINT)) { - HDmemcpy(&tempuint, vp, sizeof(unsigned int)); - if(packed_bits_num) { - if(packed_data_offset >= 8*sizeof(unsigned int)) - tempuint = 0; - else - tempuint = (tempuint >> packed_data_offset) & packed_data_mask; - } - h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint); - } - else if (H5Tequal(type, H5T_NATIVE_SCHAR)) { - signed char tempchar; - HDmemcpy(&tempchar, cp_vp, sizeof(char)); - if(packed_bits_num) { - if(packed_data_offset >= 8*sizeof(char)) - tempchar = 0; - else - tempchar = (tempchar >> packed_data_offset) & packed_data_mask; - } + if (i == 0) + /*empty string*/ + h5tools_str_append(str, "\"\""); + } /* end else */ + } + break; + case H5T_INTEGER: + if (H5Tequal(type, H5T_NATIVE_INT)) { + HDmemcpy(&tempint, vp, sizeof(int)); + if (packed_bits_num) { + if (packed_data_offset >= 8 * sizeof(int)) + tempint = 0; + else + tempint = (tempint >> packed_data_offset) & packed_data_mask; + } + h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint); + } + else if (H5Tequal(type, H5T_NATIVE_UINT)) { + HDmemcpy(&tempuint, vp, sizeof(unsigned int)); + if (packed_bits_num) { + if (packed_data_offset >= 8 * sizeof(unsigned int)) + tempuint = 0; + else + tempuint = (tempuint >> packed_data_offset) & packed_data_mask; + } + h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint); + } + else if (info->ascii && (H5Tequal(type, H5T_NATIVE_SCHAR) || H5Tequal(type, H5T_NATIVE_UCHAR))) { + h5tools_print_char(str, info, (char) (*ucp_vp)); + } + else if (H5Tequal(type, H5T_NATIVE_SCHAR)) { + signed char tempchar; + HDmemcpy(&tempchar, cp_vp, sizeof(char)); + if (packed_bits_num) { + if (packed_data_offset >= 8 * sizeof(char)) + tempchar = 0; + else + tempchar = (tempchar >> packed_data_offset) & packed_data_mask; + } #ifdef H5_VMS - h5tools_str_append(str, OPT(info->fmt_schar, "%hd"), tempchar); + h5tools_str_append(str, OPT(info->fmt_schar, "%hd"), tempchar); #else - h5tools_str_append(str, OPT(info->fmt_schar, "%hhd"), tempchar); + h5tools_str_append(str, OPT(info->fmt_schar, "%hhd"), tempchar); #endif - } - else if (H5Tequal(type, H5T_NATIVE_UCHAR)) { - unsigned char tempuchar; - HDmemcpy(&tempuchar, ucp_vp, sizeof(unsigned char)); - if(packed_bits_num) { - if(packed_data_offset >= 8*sizeof(unsigned char)) - tempuchar = 0; - else - tempuchar = (tempuchar >> packed_data_offset) & packed_data_mask; - } - h5tools_str_append(str, OPT(info->fmt_uchar, "%u"), tempuchar); - } - else if (H5Tequal(type, H5T_NATIVE_SHORT)) { - short tempshort; - - HDmemcpy(&tempshort, vp, sizeof(short)); - if(packed_bits_num) { - if(packed_data_offset >= 8*sizeof(short)) - tempshort = 0; - else - tempshort = (tempshort >> packed_data_offset) & packed_data_mask; - } - h5tools_str_append(str, OPT(info->fmt_short, "%d"), tempshort); - } - else if (H5Tequal(type, H5T_NATIVE_USHORT)) { - unsigned short tempushort; - - HDmemcpy(&tempushort, vp, sizeof(unsigned short)); - if(packed_bits_num) { - if(packed_data_offset >= 8*sizeof(unsigned short)) - tempushort = 0; - else - tempushort = (tempushort >> packed_data_offset) & packed_data_mask; - } - h5tools_str_append(str, OPT(info->fmt_ushort, "%u"), tempushort); - } - else if (H5Tequal(type, H5T_NATIVE_LONG)) { - HDmemcpy(&templong, vp, sizeof(long)); - if(packed_bits_num) { - if(packed_data_offset >= 8*sizeof(long)) - templong = 0; - else - templong = (templong >> packed_data_offset) & packed_data_mask; - } - h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong); - } - else if (H5Tequal(type, H5T_NATIVE_ULONG)) { - HDmemcpy(&tempulong, vp, sizeof(unsigned long)); - if(packed_bits_num) { - if(packed_data_offset >= 8*sizeof(unsigned long)) - tempulong = 0; - else - tempulong = (tempulong >> packed_data_offset) & packed_data_mask; - } - h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong); - } - else if (H5Tequal(type, H5T_NATIVE_LLONG)) { - HDmemcpy(&templlong, vp, sizeof(long long)); - if(packed_bits_num) { - if(packed_data_offset >= 8*sizeof(long long)) - templlong = 0; - else - templlong = (templlong >> packed_data_offset) & packed_data_mask; - } - h5tools_str_append(str, OPT(info->fmt_llong, fmt_llong), templlong); - } - else if (H5Tequal(type, H5T_NATIVE_ULLONG)) { - HDmemcpy(&tempullong, vp, sizeof(unsigned long long)); - if(packed_bits_num) { - if(packed_data_offset >= 8*sizeof(unsigned long long)) - tempullong = 0; - else - tempullong = (tempullong >> packed_data_offset) & packed_data_mask; - } - h5tools_str_append(str, OPT(info->fmt_ullong, fmt_ullong), tempullong); - } - else if (H5Tequal(type, H5T_NATIVE_HSSIZE)) { - if (sizeof(hssize_t) == sizeof(int)) { - HDmemcpy(&tempint, vp, sizeof(int)); - h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint); - } - else if (sizeof(hssize_t) == sizeof(long)) { - HDmemcpy(&templong, vp, sizeof(long)); - h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong); - } - else { - HDmemcpy(&templlong, vp, sizeof(long long)); - h5tools_str_append(str, OPT(info->fmt_llong, fmt_llong), templlong); - } - } - else if (H5Tequal(type, H5T_NATIVE_HSIZE)) { - if (sizeof(hsize_t) == sizeof(int)) { - HDmemcpy(&tempuint, vp, sizeof(unsigned int)); - h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint); - } - else if (sizeof(hsize_t) == sizeof(long)) { - HDmemcpy(&tempulong, vp, sizeof(long)); - h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong); - } - else { - HDmemcpy(&tempullong, vp, sizeof(unsigned long long)); - h5tools_str_append(str, OPT(info->fmt_ullong, fmt_ullong), tempullong); - } - } - else if (H5Tget_class(type) == H5T_COMPOUND) { - if(ctx->cmpd_listv) { /* there is */ - int save_indent_level; /* The indentation level */ - size_t curr_field; /* Current field to display */ - int i = 0, x = 0; /* Local index variable */ - H5LD_memb_t **listv; /* Vector of information for */ - - listv = ctx->cmpd_listv; - ctx->cmpd_listv = NULL; - - h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{")); - - /* - * Go through the vector containing info about the comma-separated list of - * compound fields and then members in each field: - * put in "{", "}", ",", member name and value accordingly. - */ - save_indent_level = ctx->indent_level; - for(curr_field = 0; listv[curr_field] != NULL; curr_field++) { - if (curr_field) - h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", "OPTIONAL_LINE_BREAK)); - else - h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); - - if(info->arr_linebreak) - h5tools_str_indent(str, info, ctx); - - /* Process members of each field */ - for(i = 0; listv[curr_field]->names[i] != NULL; i++) { - h5tools_str_append(str, OPT(info->cmpd_name, ""), listv[curr_field]->names[i]); - if(i) { - ctx->indent_level++; - h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{")); - } - } - h5tools_str_sprint(str, info, container, listv[curr_field]->last_tid, cp_vp + listv[curr_field]->tot_offset, ctx); - if(ctx->indent_level > 0) - for(x = ctx->indent_level; x > 0; x--) - h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}")); - ctx->indent_level = save_indent_level; - } - - - if(info->arr_linebreak) { - h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); - h5tools_str_indent(str, info, ctx); - } - h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}")); - - ctx->cmpd_listv = info->cmpd_listv; - - } else { - unsigned j; - - nmembs = H5Tget_nmembers(type); - h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{")); - - ctx->indent_level++; - - for (j = 0; j < nmembs; j++) { - if (j) - h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", "OPTIONAL_LINE_BREAK)); - else - h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); - - if(info->arr_linebreak) - h5tools_str_indent(str, info, ctx); - - /* The name */ - name = H5Tget_member_name(type, j); - h5tools_str_append(str, OPT(info->cmpd_name, ""), name); - HDfree(name); - - /* The value */ - offset = H5Tget_member_offset(type, j); - memb = H5Tget_member_type(type, j); - - h5tools_str_sprint(str, info, container, memb, cp_vp + offset, ctx); - - H5Tclose(memb); - } - ctx->indent_level--; - - - if(info->arr_linebreak) { - h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); - h5tools_str_indent(str, info, ctx); - } - h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}")); - - } - } - else if (H5Tget_class(type) == H5T_ENUM) { - char enum_name[1024]; - - if (H5Tenum_nameof(type, vp, enum_name, sizeof enum_name) >= 0) { - h5tools_str_append(str, h5tools_escape(enum_name, sizeof(enum_name))); - } - else { - size_t i; - n = H5Tget_size(type); - if (1 == n) { - h5tools_str_append(str, "0x%02x", ucp_vp[0]); - } - else { - for (i = 0; i < n; i++) - h5tools_str_append(str, "%s%02x", i ? ":" : "", ucp_vp[i]); - } - } - } - else if (H5Tequal(type, H5T_STD_REF_DSETREG)) { - if (h5tools_str_is_zero(vp, H5Tget_size(type))) { - h5tools_str_append(str, "NULL"); - } - else { - h5tools_str_sprint_region(str, info, container, vp); - } - } - else if (H5Tequal(type, H5T_STD_REF_OBJ)) { - /* - * Object references -- show the type and OID of the referenced - * object. - */ - if (h5tools_str_is_zero(vp, H5Tget_size(type))) { - h5tools_str_append(str, "NULL"); - } - else { - H5O_info_t oi; - const char *path; - - obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, vp); - H5Oget_info(obj, &oi); - - /* Print object type and close object */ - switch (oi.type) { - case H5O_TYPE_GROUP: - h5tools_str_append(str, H5_TOOLS_GROUP); + } + else if (H5Tequal(type, H5T_NATIVE_UCHAR)) { + unsigned char tempuchar; + HDmemcpy(&tempuchar, ucp_vp, sizeof(unsigned char)); + if (packed_bits_num) { + if (packed_data_offset >= 8 * sizeof(unsigned char)) + tempuchar = 0; + else + tempuchar = (tempuchar >> packed_data_offset) & packed_data_mask; + } + h5tools_str_append(str, OPT(info->fmt_uchar, "%u"), tempuchar); + } + else if (H5Tequal(type, H5T_NATIVE_SHORT)) { + short tempshort; + + HDmemcpy(&tempshort, vp, sizeof(short)); + if (packed_bits_num) { + if (packed_data_offset >= 8 * sizeof(short)) + tempshort = 0; + else + tempshort = (tempshort >> packed_data_offset) & packed_data_mask; + } + h5tools_str_append(str, OPT(info->fmt_short, "%d"), tempshort); + } + else if (H5Tequal(type, H5T_NATIVE_USHORT)) { + unsigned short tempushort; + + HDmemcpy(&tempushort, vp, sizeof(unsigned short)); + if (packed_bits_num) { + if (packed_data_offset >= 8 * sizeof(unsigned short)) + tempushort = 0; + else + tempushort = (tempushort >> packed_data_offset) & packed_data_mask; + } + h5tools_str_append(str, OPT(info->fmt_ushort, "%u"), tempushort); + } + else if (H5Tequal(type, H5T_NATIVE_LONG)) { + HDmemcpy(&templong, vp, sizeof(long)); + if (packed_bits_num) { + if (packed_data_offset >= 8 * sizeof(long)) + templong = 0; + else + templong = (templong >> packed_data_offset) & packed_data_mask; + } + h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong); + } + else if (H5Tequal(type, H5T_NATIVE_ULONG)) { + HDmemcpy(&tempulong, vp, sizeof(unsigned long)); + if (packed_bits_num) { + if (packed_data_offset >= 8 * sizeof(unsigned long)) + tempulong = 0; + else + tempulong = (tempulong >> packed_data_offset) & packed_data_mask; + } + h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong); + } + else if (H5Tequal(type, H5T_NATIVE_LLONG)) { + HDmemcpy(&templlong, vp, sizeof(long long)); + if (packed_bits_num) { + if (packed_data_offset >= 8 * sizeof(long long)) + templlong = 0; + else + templlong = (templlong >> packed_data_offset) & packed_data_mask; + } + h5tools_str_append(str, OPT(info->fmt_llong, fmt_llong), templlong); + } + else if (H5Tequal(type, H5T_NATIVE_ULLONG)) { + HDmemcpy(&tempullong, vp, sizeof(unsigned long long)); + if (packed_bits_num) { + if (packed_data_offset >= 8 * sizeof(unsigned long long)) + tempullong = 0; + else + tempullong = (tempullong >> packed_data_offset) & packed_data_mask; + } + h5tools_str_append(str, OPT(info->fmt_ullong, fmt_ullong), tempullong); + } + else if (H5Tequal(type, H5T_NATIVE_HSSIZE)) { + if (sizeof(hssize_t) == sizeof(int)) { + HDmemcpy(&tempint, vp, sizeof(int)); + h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint); + } + else if (sizeof(hssize_t) == sizeof(long)) { + HDmemcpy(&templong, vp, sizeof(long)); + h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong); + } + else { + HDmemcpy(&templlong, vp, sizeof(long long)); + h5tools_str_append(str, OPT(info->fmt_llong, fmt_llong), templlong); + } + } + else if (H5Tequal(type, H5T_NATIVE_HSIZE)) { + if (sizeof(hsize_t) == sizeof(int)) { + HDmemcpy(&tempuint, vp, sizeof(unsigned int)); + h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint); + } + else if (sizeof(hsize_t) == sizeof(long)) { + HDmemcpy(&tempulong, vp, sizeof(long)); + h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong); + } + else { + HDmemcpy(&tempullong, vp, sizeof(unsigned long long)); + h5tools_str_append(str, OPT(info->fmt_ullong, fmt_ullong), tempullong); + } + } break; + case H5T_COMPOUND: + if(ctx->cmpd_listv) { /* there is */ + int save_indent_level; /* The indentation level */ + size_t curr_field; /* Current field to display */ + int i = 0, x = 0; /* Local index variable */ + H5LD_memb_t **listv; /* Vector of information for */ + + listv = ctx->cmpd_listv; + ctx->cmpd_listv = NULL; + + h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{")); + + /* + * Go through the vector containing info about the comma-separated list of + * compound fields and then members in each field: + * put in "{", "}", ",", member name and value accordingly. + */ + save_indent_level = ctx->indent_level; + for(curr_field = 0; listv[curr_field] != NULL; curr_field++) { + if (curr_field) + h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", "OPTIONAL_LINE_BREAK)); + else + h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); + + if(info->arr_linebreak) + h5tools_str_indent(str, info, ctx); + + /* Process members of each field */ + for(i = 0; listv[curr_field]->names[i] != NULL; i++) { + h5tools_str_append(str, OPT(info->cmpd_name, ""), listv[curr_field]->names[i]); + if(i) { + ctx->indent_level++; + h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{")); + } + } + h5tools_str_sprint(str, info, container, listv[curr_field]->last_tid, cp_vp + listv[curr_field]->tot_offset, ctx); + if(ctx->indent_level > 0) + for(x = ctx->indent_level; x > 0; x--) + h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}")); + ctx->indent_level = save_indent_level; + } + + + if(info->arr_linebreak) { + h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); + h5tools_str_indent(str, info, ctx); + } + h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}")); + + ctx->cmpd_listv = info->cmpd_listv; + + } else { + unsigned j; + + nmembs = H5Tget_nmembers(type); + h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{")); + + ctx->indent_level++; + + for (j = 0; j < nmembs; j++) { + if (j) + h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", "OPTIONAL_LINE_BREAK)); + else + h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); + + if (info->arr_linebreak) h5tools_str_indent(str, info, ctx); + + /* The name */ + name = H5Tget_member_name(type, j); + h5tools_str_append(str, OPT(info->cmpd_name, ""), name); + HDfree(name); + + /* The value */ + offset = H5Tget_member_offset(type, j); + memb = H5Tget_member_type(type, j); + + h5tools_str_sprint(str, info, container, memb, cp_vp + offset, ctx); + + H5Tclose(memb); + } + ctx->indent_level--; + + if (info->arr_linebreak) { + h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); + h5tools_str_indent(str, info, ctx); + } + h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}")); - case H5O_TYPE_DATASET: - h5tools_str_append(str, H5_TOOLS_DATASET); + } break; - - case H5O_TYPE_NAMED_DATATYPE: - h5tools_str_append(str, H5_TOOLS_DATATYPE); + case H5T_ENUM: + { + char enum_name[1024]; + + if (H5Tenum_nameof(type, vp, enum_name, sizeof enum_name) >= 0) { + h5tools_str_append(str, h5tools_escape(enum_name, sizeof(enum_name))); + } + else { + size_t i; + n = H5Tget_size(type); + if (1 == n) { + h5tools_str_append(str, "0x%02x", ucp_vp[0]); + } + else { + for (i = 0; i < n; i++) + h5tools_str_append(str, "%s%02x", i ? ":" : "", ucp_vp[i]); + } + } + } break; - - default: - h5tools_str_append(str, "%u-", (unsigned) oi.type); + case H5T_REFERENCE: + if (H5Tequal(type, H5T_STD_REF_DSETREG)) { + if (h5tools_str_is_zero(vp, H5Tget_size(type))) { + h5tools_str_append(str, "NULL"); + } + else { + h5tools_str_sprint_region(str, info, container, vp); + } + } + else if (H5Tequal(type, H5T_STD_REF_OBJ)) { + /* + * Object references -- show the type and OID of the referenced + * object. + */ + if (h5tools_str_is_zero(vp, H5Tget_size(type))) { + h5tools_str_append(str, "NULL"); + } + else { + H5O_info_t oi; + const char *path; + + obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, vp); + H5Oget_info(obj, &oi); + + /* Print object type and close object */ + switch (oi.type) { + case H5O_TYPE_GROUP: + h5tools_str_append(str, H5_TOOLS_GROUP); + break; + + case H5O_TYPE_DATASET: + h5tools_str_append(str, H5_TOOLS_DATASET); + break; + + case H5O_TYPE_NAMED_DATATYPE: + h5tools_str_append(str, H5_TOOLS_DATATYPE); + break; + + default: + h5tools_str_append(str, "%u-", (unsigned) oi.type); + break; + } /* end switch */ + H5Oclose(obj); + + /* Print OID */ + if (info->obj_hidefileno) + h5tools_str_append(str, info->obj_format, oi.addr); + else + h5tools_str_append(str, info->obj_format, oi.fileno, oi.addr); + + /* Print name */ + path = lookup_ref_path(*(haddr_t *) vp); + if (path) { + h5tools_str_append(str, " "); + h5tools_str_append(str, path); + h5tools_str_append(str, " "); + } /* end if */ + } /* end else */ + } break; - } /* end switch */ - H5Oclose(obj); - - /* Print OID */ - if (info->obj_hidefileno) - h5tools_str_append(str, info->obj_format, oi.addr); - else - h5tools_str_append(str, info->obj_format, oi.fileno, oi.addr); - - /* Print name */ - path = lookup_ref_path(*(haddr_t *) vp); - if (path) { - h5tools_str_append(str, " "); - h5tools_str_append(str, path); - h5tools_str_append(str, " "); - } /* end if */ - } /* end else */ - } - else if (H5Tget_class(type) == H5T_ARRAY) { - int k, ndims; - hsize_t i, dims[H5S_MAX_RANK], temp_nelmts; - static int is_next_arry_elmt = 0; - - /* Get the array's base datatype for each element */ - memb = H5Tget_super(type); - size = H5Tget_size(memb); - ndims = H5Tget_array_ndims(type); - H5Tget_array_dims2(type, dims); - HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK); - - /* Calculate the number of array elements */ - for (k = 0, nelmts = 1; k < ndims; k++) { - temp_nelmts = nelmts; - temp_nelmts *= dims[k]; - HDassert(temp_nelmts == (hsize_t) ((size_t) temp_nelmts)); - nelmts = (size_t) temp_nelmts; - } - /* Print the opening bracket */ - h5tools_str_append(str, "%s", OPT(info->arr_pre, "[")); - - ctx->indent_level++; - - for (i = 0; i < nelmts; i++) { - if (i) - h5tools_str_append(str, "%s", OPT(info->arr_sep, "," OPTIONAL_LINE_BREAK)); - - if (info->arr_linebreak && i && i % dims[ndims - 1] == 0) { - h5tools_str_append(str, "%s", "\n"); - h5tools_str_indent(str, info, ctx); - - } /* end if */ - else if (i && info->arr_sep) { - /* if next element begin, add next line with indent */ - if (is_next_arry_elmt) { - is_next_arry_elmt = 0; - - h5tools_str_append(str, "%s", "\n "); - h5tools_str_indent(str, info, ctx); - + case H5T_ARRAY: + { + int k, ndims; + hsize_t i, dims[H5S_MAX_RANK], temp_nelmts; + static int is_next_arry_elmt = 0; + + /* Get the array's base datatype for each element */ + memb = H5Tget_super(type); + size = H5Tget_size(memb); + ndims = H5Tget_array_ndims(type); + H5Tget_array_dims2(type, dims); + HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK); + + /* Calculate the number of array elements */ + for (k = 0, nelmts = 1; k < ndims; k++) { + temp_nelmts = nelmts; + temp_nelmts *= dims[k]; + HDassert(temp_nelmts == (hsize_t) ((size_t) temp_nelmts)); + nelmts = (size_t) temp_nelmts; + } + /* Print the opening bracket */ + h5tools_str_append(str, "%s", OPT(info->arr_pre, "[")); + + ctx->indent_level++; + + for (i = 0; i < nelmts; i++) { + if (i) h5tools_str_append(str, "%s", OPT(info->arr_sep, "," OPTIONAL_LINE_BREAK)); + + if (info->arr_linebreak && i && i % dims[ndims - 1] == 0) { + h5tools_str_append(str, "%s", "\n"); + h5tools_str_indent(str, info, ctx); + + } /* end if */ + else if (i && info->arr_sep) { + /* if next element begin, add next line with indent */ + if (is_next_arry_elmt) { + is_next_arry_elmt = 0; + + h5tools_str_append(str, "%s", "\n "); + h5tools_str_indent(str, info, ctx); + + } + /* otherwise just add space */ + else + h5tools_str_append(str, " "); + + } /* end else if */ + + /* Dump values in an array element */ + is_next_arry_elmt = 0; /* dump all values in the array element, so turn it off */ + h5tools_str_sprint(str, info, container, memb, cp_vp + i * size, ctx); + } /* end for */ + + ctx->indent_level--; + + /* Print the closing bracket */ + h5tools_str_append(str, "%s", OPT(info->arr_suf, "]")); + is_next_arry_elmt = 1; /* set for begining of next array element */ + H5Tclose(memb); } - /* otherwise just add space */ - else - h5tools_str_append(str, " "); - - } /* end else if */ - - /* Dump values in an array element */ - is_next_arry_elmt = 0; /* dump all values in the array element, so turn it off */ - h5tools_str_sprint(str, info, container, memb, cp_vp + i * size, ctx); - } /* end for */ - - ctx->indent_level--; - - /* Print the closing bracket */ - h5tools_str_append(str, "%s", OPT(info->arr_suf, "]")); - is_next_arry_elmt = 1; /* set for begining of next array element */ - H5Tclose(memb); - } - else if (H5Tget_class(type) == H5T_VLEN) { - unsigned int i; + break; + case H5T_VLEN: + { + unsigned int i; - /* Get the VL sequences's base datatype for each element */ - memb = H5Tget_super(type); - size = H5Tget_size(memb); + /* Get the VL sequences's base datatype for each element */ + memb = H5Tget_super(type); + size = H5Tget_size(memb); - /* Print the opening bracket */ - h5tools_str_append(str, "%s", OPT(info->vlen_pre, "(")); + /* Print the opening bracket */ + h5tools_str_append(str, "%s", OPT(info->vlen_pre, "(")); - /* Get the number of sequence elements */ - nelmts = ((hvl_t *) cp_vp)->len; + /* Get the number of sequence elements */ + nelmts = ((hvl_t *) cp_vp)->len; - for (i = 0; i < nelmts; i++) { - if (i) - h5tools_str_append(str, "%s", OPT(info->vlen_sep, "," OPTIONAL_LINE_BREAK)); + for (i = 0; i < nelmts; i++) { + if (i) h5tools_str_append(str, "%s", OPT(info->vlen_sep, "," OPTIONAL_LINE_BREAK)); #ifdef LATER - /* Need to fix so VL data breaks at correct location on end of line -QAK */ - if (info->arr_linebreak && h5tools_str_len(str)>=info->line_ncols) { - int x; + /* Need to fix so VL data breaks at correct location on end of line -QAK */ + if (info->arr_linebreak && h5tools_str_len(str)>=info->line_ncols) { + int x; - h5tools_str_append(str, "%s", "\n"); + h5tools_str_append(str, "%s", "\n"); - /* need to indent some more here */ - if (ctx->indent_level >= 0) - h5tools_str_append(str, "%s", OPT(info->line_pre, "")); + /* need to indent some more here */ + if (ctx->indent_level >= 0) + h5tools_str_append(str, "%s", OPT(info->line_pre, "")); - for (x = 0; x < ctx->indent_level + 1; x++) - h5tools_str_append(str,"%s",OPT(info->line_indent,"")); - } /* end if */ + for (x = 0; x < ctx->indent_level + 1; x++) + h5tools_str_append(str,"%s",OPT(info->line_indent,"")); + } /* end if */ #endif /* LATER */ - ctx->indent_level++; + ctx->indent_level++; - /* Dump the array element */ - h5tools_str_sprint(str, info, container, memb, - ((char *) (((hvl_t *) cp_vp)->p)) + i * size, ctx); + /* Dump the array element */ + h5tools_str_sprint(str, info, container, memb, ((char *) (((hvl_t *) cp_vp)->p)) + i * size, ctx); - ctx->indent_level--; - } /* end for */ + ctx->indent_level--; + } /* end for */ - h5tools_str_append(str, "%s", OPT(info->vlen_suf, ")")); - H5Tclose(memb); - } - else { - /* All other types get printed as hexadecimal */ - size_t i; - n = H5Tget_size(type); - if (1 == n) { - h5tools_str_append(str, "0x%02x", ucp_vp[0]); - } - else { - for (i = 0; i < n; i++) - h5tools_str_append(str, "%s%02x", i ? ":" : "", ucp_vp[i]); - } - } + h5tools_str_append(str, "%s", OPT(info->vlen_suf, ")")); + H5Tclose(memb); + } + break; + default: + { + /* All other types get printed as hexadecimal */ + size_t i; + n = H5Tget_size(type); + if (1 == n) { + h5tools_str_append(str, "0x%02x", ucp_vp[0]); + } + else { + for (i = 0; i < n; i++) + h5tools_str_append(str, "%s%02x", i ? ":" : "", ucp_vp[i]); + } + } + break; + } /* end switch */ + } return h5tools_str_fmt(str, start, OPT(info->elmt_fmt, "%s")); } diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 11ab5f3..79322bc 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -852,6 +852,8 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_ /* set target obj type to return */ link_info->trg_type = trg_oinfo.type; + link_info->objno = trg_oinfo.addr; + link_info->fileno = trg_oinfo.fileno; } /* end if */ else link_info->trg_type = H5O_TYPE_UNKNOWN; diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index f30974a..10c643d 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -161,6 +161,8 @@ typedef struct { H5O_type_t trg_type; /* OUT: target type */ const char *trg_path; /* OUT: target obj path. This must be freed * when used with H5tools_get_symlink_info() */ + haddr_t objno; /* OUT: target object address */ + unsigned long fileno; /* OUT: File number that target object is located in */ H5L_info_t linfo; /* OUT: link info */ h5tool_opt_t opt; /* IN: options */ } h5tool_link_info_t; diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 0215c46..8455360 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -354,6 +354,31 @@ trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type) info->paths[idx].objno = HADDR_UNDEF; } /* end trav_info_add() */ + +/*------------------------------------------------------------------------- + * Function: trav_fileinfo_add + * + * Purpose: Add a file addr & fileno to info struct + * + * Return: void + * + *------------------------------------------------------------------------- + */ +void +trav_fileinfo_add(trav_info_t *info, hid_t loc_id) +{ + H5O_info_t oinfo; + size_t idx = info->nused - 1; + + if ( info->paths[idx].path && HDstrcmp(info->paths[idx].path, ".")) + H5Oget_info_by_name(loc_id, info->paths[idx].path, &oinfo, H5P_DEFAULT); + else + H5Oget_info(loc_id, &oinfo); + + info->paths[idx].objno = oinfo.addr; + info->paths[idx].fileno = oinfo.fileno; +} /* end trav_fileinfo_add() */ + /*------------------------------------------------------------------------- * Function: trav_info_visit_obj diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h index c416cf8..3548c6b 100644 --- a/tools/lib/h5trav.h +++ b/tools/lib/h5trav.h @@ -177,6 +177,8 @@ H5TOOLS_DLL void trav_info_free(trav_info_t *info); H5TOOLS_DLL void trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type); +H5TOOLS_DLL void trav_fileinfo_add(trav_info_t *info, hid_t loc_id); + /*------------------------------------------------------------------------- * table private functions *------------------------------------------------------------------------- diff --git a/vms/src/h5pubconf.h b/vms/src/h5pubconf.h index e6cb4e5..90df1b4 100644 --- a/vms/src/h5pubconf.h +++ b/vms/src/h5pubconf.h @@ -502,7 +502,7 @@ #define H5_PACKAGE_NAME "HDF5" /* Define to the full name and version of this package. */ -#define H5_PACKAGE_STRING "HDF5 1.9.124-FA_a5" +#define H5_PACKAGE_STRING "HDF5 1.9.125-FA_a5" /* Define to the one symbol short name of this package. */ #define H5_PACKAGE_TARNAME "hdf5" @@ -511,7 +511,7 @@ #define H5_PACKAGE_URL "" /* Define to the version of this package. */ -#define H5_PACKAGE_VERSION "1.9.124-FA_a5" +#define H5_PACKAGE_VERSION "1.9.125-FA_a5" /* Width for printf() for type `long long' or `__int64', use `ll' */ #define H5_PRINTF_LL_WIDTH "ll" @@ -674,7 +674,7 @@ /* #undef H5_USING_MEMCHECKER */ /* Version number of package */ -#define H5_VERSION "1.9.124-FA_a5" +#define H5_VERSION "1.9.125-FA_a5" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ diff --git a/windows/src/H5pubconf.h b/windows/src/H5pubconf.h index 05276d8..3a75ea7 100644 --- a/windows/src/H5pubconf.h +++ b/windows/src/H5pubconf.h @@ -527,7 +527,7 @@ #define H5_PACKAGE_NAME "HDF5" /* Define to the full name and version of this package. */ -#define H5_PACKAGE_STRING "HDF5 1.9.124-FA_a5" +#define H5_PACKAGE_STRING "HDF5 1.9.125-FA_a5" /* Define to the one symbol short name of this package. */ #define H5_PACKAGE_TARNAME "hdf5" @@ -536,7 +536,7 @@ #define H5_PACKAGE_URL "" /* Define to the version of this package. */ -#define H5_PACKAGE_VERSION "1.9.124-FA_a5" +#define H5_PACKAGE_VERSION "1.9.125-FA_a5" /* Width for printf() for type `long long' or `__int64', use `ll' */ #define H5_PRINTF_LL_WIDTH "I64" @@ -707,7 +707,7 @@ /* #undef H5_USING_MEMCHECKER */ /* Version number of package */ -#define H5_VERSION "1.9.124-FA_a5" +#define H5_VERSION "1.9.125-FA_a5" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ -- cgit v0.12