diff --git a/.github/workflows/cmake-bintest.yml b/.github/workflows/cmake-bintest.yml index 48be210173b..4f815a4102e 100644 --- a/.github/workflows/cmake-bintest.yml +++ b/.github/workflows/cmake-bintest.yml @@ -163,7 +163,7 @@ jobs: - name: Get published binary (MacOS) uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: - name: tgz-osx12-${{ inputs.build_mode }}-binary + name: tgz-osx-${{ inputs.build_mode }}-binary path: ${{ github.workspace }} - name: Uncompress hdf5 binary (MacOS) @@ -189,12 +189,12 @@ jobs: ls ${{ runner.workspace }} # symlinks the compiler executables to a common location - - name: Setup GNU Fortran - uses: fortran-lang/setup-fortran@v1 - id: setup-fortran - with: - compiler: gcc - version: 12 + # - name: Setup GNU Fortran + # uses: fortran-lang/setup-fortran@v1 + # id: setup-fortran + # with: + # compiler: gcc + # version: 12 - name: Run ctest (MacOS) id: run-ctest diff --git a/.github/workflows/cmake-ctest.yml b/.github/workflows/cmake-ctest.yml index 1a69de624e6..6cf9b96209e 100644 --- a/.github/workflows/cmake-ctest.yml +++ b/.github/workflows/cmake-ctest.yml @@ -308,7 +308,7 @@ jobs: cp ${{ runner.workspace }}/hdf5/build114/${{ inputs.preset_name }}-Clang/README.md ${{ runner.workspace }}/build114/hdf5 cp ${{ runner.workspace }}/hdf5/build114/${{ inputs.preset_name }}-Clang/*.tar.gz ${{ runner.workspace }}/build114/hdf5 cd "${{ runner.workspace }}/build114" - tar -zcvf ${{ steps.set-file-base.outputs.FILE_BASE }}-osx12.tar.gz hdf5 + tar -zcvf ${{ steps.set-file-base.outputs.FILE_BASE }}-osx.tar.gz hdf5 shell: bash - name: List files in the space (MacOS) @@ -320,8 +320,8 @@ jobs: - name: Save published binary (MacOS) uses: actions/upload-artifact@v4 with: - name: tgz-osx12-binary - path: ${{ runner.workspace }}/build114/${{ steps.set-file-base.outputs.FILE_BASE }}-osx12.tar.gz + name: tgz-osx-binary + path: ${{ runner.workspace }}/build114/${{ steps.set-file-base.outputs.FILE_BASE }}-osx.tar.gz if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` build_and_test_S3_linux: @@ -413,9 +413,6 @@ jobs: compiler: intel version: '2024.1' - - name: Enable Developer Command Prompt - uses: ilammy/msvc-dev-cmd@v1.13.0 - - name: Set file base name (Windows_intel) id: set-file-base run: | diff --git a/.github/workflows/main-cmake.yml b/.github/workflows/main-cmake.yml index 0a0842f7b94..5e5fb054673 100644 --- a/.github/workflows/main-cmake.yml +++ b/.github/workflows/main-cmake.yml @@ -261,7 +261,7 @@ jobs: - name: Save published binary (Mac) uses: actions/upload-artifact@v4 with: - name: tgz-osx12-${{ inputs.build_mode }}-binary + name: tgz-osx-${{ inputs.build_mode }}-binary path: ${{ runner.workspace }}/build/HDF5-*-Darwin.tar.gz if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` if: ${{ (matrix.os == 'macos-13') && (inputs.thread_safety != 'TS') }} diff --git a/.github/workflows/release-files.yml b/.github/workflows/release-files.yml index e4d1a093af7..6b881b40f68 100644 --- a/.github/workflows/release-files.yml +++ b/.github/workflows/release-files.yml @@ -103,7 +103,7 @@ jobs: - name: Get published binary (MacOS) uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: - name: tgz-osx12-binary + name: tgz-osx-binary path: ${{ github.workspace }} - name: Get published binary (Linux) @@ -148,12 +148,26 @@ jobs: name: abi-reports path: ${{ github.workspace }} + - name: Get published nonversioned source (tgz) + if: ${{ (inputs.use_environ == 'release') }} + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + with: + name: tgz-tarball-nover + path: ${{ github.workspace }} + + - name: Get published nonversioned source (zip) + if: ${{ (inputs.use_environ == 'release') }} + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + with: + name: zip-tarball-nover + path: ${{ github.workspace }} + - name: Create sha256 sums for files run: | sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen.zip > ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}.tar.gz >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}.zip >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt - sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-osx12.tar.gz >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt + sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-osx.tar.gz >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.tar.gz >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.deb.tar.gz >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.rpm.tar.gz >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt @@ -163,6 +177,11 @@ jobs: sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-win-vs2022_intel.zip >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}.html.abi.reports.tar.gz >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt + - name: Create sha256 sums for files for nonversioned files + run: | + sha256sum hdf5.zip >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt + sha256sum hdf5.tar.gz >> ${{ steps.get-file-base.outputs.FILE_BASE }}.sha256sums.txt + - name: Store snapshot name run: | echo "${{ steps.get-file-base.outputs.FILE_BASE }}" > ./last-file.txt @@ -190,7 +209,7 @@ jobs: ${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen.zip ${{ steps.get-file-base.outputs.FILE_BASE }}.tar.gz ${{ steps.get-file-base.outputs.FILE_BASE }}.zip - ${{ steps.get-file-base.outputs.FILE_BASE }}-osx12.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}-osx.tar.gz ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.tar.gz ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.deb.tar.gz ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.rpm.tar.gz @@ -214,7 +233,9 @@ jobs: ${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen.zip ${{ steps.get-file-base.outputs.FILE_BASE }}.tar.gz ${{ steps.get-file-base.outputs.FILE_BASE }}.zip - ${{ steps.get-file-base.outputs.FILE_BASE }}-osx12.tar.gz + hdf5.tar.gz + hdf5.zip + ${{ steps.get-file-base.outputs.FILE_BASE }}-osx.tar.gz ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.tar.gz ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.deb.tar.gz ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.rpm.tar.gz diff --git a/.github/workflows/remove-files.yml b/.github/workflows/remove-files.yml index 3238bc50096..032130cc8ff 100644 --- a/.github/workflows/remove-files.yml +++ b/.github/workflows/remove-files.yml @@ -50,7 +50,7 @@ jobs: ${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen.zip ${{ steps.get-file-base.outputs.FILE_BASE }}.tar.gz ${{ steps.get-file-base.outputs.FILE_BASE }}.zip - ${{ steps.get-file-base.outputs.FILE_BASE }}-osx12.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}-osx.tar.gz ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.tar.gz ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.deb.tar.gz ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.rpm.tar.gz diff --git a/.github/workflows/tarball.yml b/.github/workflows/tarball.yml index 8286f9860cc..db566f8c8d7 100644 --- a/.github/workflows/tarball.yml +++ b/.github/workflows/tarball.yml @@ -144,6 +144,14 @@ jobs: mv hdf5-${{ steps.version.outputs.SOURCE_TAG }}.zip ${{ inputs.use_tag }}.zip shell: bash + - name: Copy the release file source to a non-versioned file name + id: cp-to-non-versioned + if: ${{ (inputs.use_environ == 'release') }} + run: | + cp ${{ inputs.use_tag }}.tar.gz hdf5.tar.gz + cp ${{ inputs.use_tag }}.zip hdf5.zip + shell: bash + - name: List files in the repository run: | ls -l ${{ github.workspace }} @@ -164,6 +172,22 @@ jobs: path: ${{ steps.set-file-base.outputs.FILE_BASE }}.zip if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + - name: Save tgz-tarball-nover + if: ${{ (inputs.use_environ == 'release') }} + uses: actions/upload-artifact@v4 + with: + name: tgz-tarball-nover + path: hdf5.tar.gz + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + + - name: Save zip-tarball-nover + if: ${{ (inputs.use_environ == 'release') }} + uses: actions/upload-artifact@v4 + with: + name: zip-tarball-nover + path: hdf5.zip + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + - name: Save NEWSLETTER uses: actions/upload-artifact@v4 with: diff --git a/.gitignore b/.gitignore index d2fc4c79651..d6b8b714dcb 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,8 @@ m4/ltversion.m4 m4/lt~obsolete.m4 src/H5Edefin.h src/H5Einit.h +src/H5Emajdef.h +src/H5Emindef.h src/H5Epubgen.h src/H5Eterm.h src/H5config.h.in diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake index dbd68fd110d..6329fefd816 100644 --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake @@ -9,9 +9,9 @@ # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # -option (USE_LIBAEC_STATIC "Use static AEC library " OFF) -option (ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" OFF) -option (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" OFF) +option (USE_LIBAEC_STATIC "Use static AEC library" OFF) +option (ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB else search" OFF) +option (SZIP_USE_EXTERNAL "Use External Library Building for SZIP else search" OFF) if (NOT ZLIB_USE_LOCALCONTENT) set (ZLIB_URL ${ZLIB_TGZ_ORIGPATH}/${ZLIB_TGZ_NAME}) @@ -32,8 +32,8 @@ include (ExternalProject) set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO GIT TGZ)") set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO GIT TGZ) if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") - set (ZLIB_USE_EXTERNAL ON CACHE BOOL "Use External Library Building for ZLIB" FORCE) - set (SZIP_USE_EXTERNAL ON CACHE BOOL "Use External Library Building for SZIP" FORCE) + set (ZLIB_USE_EXTERNAL ON CACHE BOOL "Use External Library Building for ZLIB else search" FORCE) + set (SZIP_USE_EXTERNAL ON CACHE BOOL "Use External Library Building for SZIP else search" FORCE) if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT") set (ZLIB_URL ${ZLIB_GIT_URL} CACHE STRING "Path to zlib git repository") set (ZLIB_BRANCH ${ZLIB_GIT_BRANCH}) @@ -57,9 +57,9 @@ if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MAT endif () else () set (HDF5_ENABLE_Z_LIB_SUPPORT OFF CACHE BOOL "" FORCE) - set (ZLIB_USE_EXTERNAL OFF CACHE BOOL "Use External Library Building for ZLIB") + set (ZLIB_USE_EXTERNAL OFF CACHE BOOL "Use External Library Building for ZLIB else search") set (HDF5_ENABLE_SZIP_SUPPORT OFF CACHE BOOL "" FORCE) - set (SZIP_USE_EXTERNAL OFF CACHE BOOL "Use External Library Building for SZIP") + set (SZIP_USE_EXTERNAL OFF CACHE BOOL "Use External Library Building for SZIP else search") endif () endif () @@ -71,20 +71,20 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT) if (NOT H5_ZLIB_HEADER) if (NOT ZLIB_USE_EXTERNAL) find_package (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) - if (NOT ZLIB_FOUND) + if (NOT H5_ZLIB_FOUND) find_package (ZLIB) # Legacy find endif () - if (ZLIB_FOUND) + if (H5_ZLIB_FOUND) set (H5_ZLIB_HEADER "zlib.h") - set (ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR}) - set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}) + set (H5_ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR}) + set (H5_ZLIB_INCLUDE_DIRS ${H5_ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}) set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) endif () else () if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") EXTERNAL_ZLIB_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT}) message (VERBOSE "Filter HDF5_ZLIB is built") - set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_STATIC_LIBRARY}) + set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${H5_ZLIB_STATIC_LIBRARY}) endif () endif () else () @@ -93,14 +93,14 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT) set (H5_HAVE_ZLIB_H 1) set (H5_HAVE_LIBZ 1) endif () - if (ZLIB_FOUND) + if (H5_ZLIB_FOUND) set (H5_HAVE_FILTER_DEFLATE 1) set (H5_HAVE_ZLIB_H 1) set (H5_HAVE_LIBZ 1) if (H5_HAVE_FILTER_DEFLATE) set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} DEFLATE") endif () - set (HDF5_COMP_INCLUDE_DIRECTORIES "${HDF5_COMP_INCLUDE_DIRECTORIES};${ZLIB_INCLUDE_DIRS}") + set (HDF5_COMP_INCLUDE_DIRECTORIES "${HDF5_COMP_INCLUDE_DIRECTORIES};${H5_ZLIB_INCLUDE_DIRS}") message (VERBOSE "Filter HDF5_ZLIB is ON") else () set (HDF5_ENABLE_Z_LIB_SUPPORT OFF CACHE BOOL "" FORCE) @@ -115,21 +115,15 @@ option (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" ON) if (HDF5_ENABLE_SZIP_SUPPORT) option (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" ON) if (NOT SZIP_USE_EXTERNAL) + set(libaec_USE_STATIC_LIBS ${HDF5_USE_LIBAEC_STATIC}) set(SZIP_FOUND FALSE) - set(libaec_USE_STATIC_LIBS ${USE_LIBAEC_STATIC}) - find_package (libaec 1.0.5 CONFIG) - if (SZIP_FOUND) - set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) - endif () + find_package (SZIP NAMES ${LIBAEC_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) if (NOT SZIP_FOUND) - find_package (SZIP NAMES ${LIBAEC_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) - if (NOT SZIP_FOUND) - find_package (SZIP) # Legacy find - endif () + find_package (SZIP) # Legacy find endif () - if (SZIP_FOUND) - set (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR}) - set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIRS} ${SZIP_INCLUDE_DIR}) + if (H5_SZIP_FOUND) + set (H5_SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR}) + set (H5_SZIP_INCLUDE_DIRS ${H5_SZIP_INCLUDE_DIRS} ${SZIP_INCLUDE_DIR}) set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) endif () else () @@ -137,14 +131,14 @@ if (HDF5_ENABLE_SZIP_SUPPORT) EXTERNAL_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${HDF5_ENABLE_SZIP_ENCODING}) message (VERBOSE "Filter SZIP is built") message (VERBOSE "... with library AEC") - set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_STATIC_LIBRARY}) + set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${H5_SZIP_STATIC_LIBRARY}) endif () endif () - if (SZIP_FOUND) + if (H5_SZIP_FOUND) set (H5_HAVE_FILTER_SZIP 1) set (H5_HAVE_SZLIB_H 1) set (H5_HAVE_LIBSZ 1) - set (HDF5_COMP_INCLUDE_DIRECTORIES "${HDF5_COMP_INCLUDE_DIRECTORIES};${SZIP_INCLUDE_DIRS}") + set (HDF5_COMP_INCLUDE_DIRECTORIES "${HDF5_COMP_INCLUDE_DIRECTORIES};${H5_SZIP_INCLUDE_DIRS}") message (VERBOSE "Filter SZIP is ON") if (H5_HAVE_FILTER_SZIP) set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} DECODE") diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 9229c4e1a7e..10e4036ca34 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -454,20 +454,20 @@ The HDF5 data model, file format, API, library, and tools are open and distribut if (HDF5_PACKAGE_EXTLIBS) if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") - if (ZLIB_FOUND AND ZLIB_USE_EXTERNAL) + if (H5_ZLIB_FOUND AND ZLIB_USE_EXTERNAL) if (WIN32) - set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};HDF5_ZLIB;ALL;/") + set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${H5_ZLIB_INCLUDE_DIR_GEN};HDF5_ZLIB;ALL;/") else () - set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};HDF5_ZLIB;libraries;/") - set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};HDF5_ZLIB;configinstall;/") + set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${H5_ZLIB_INCLUDE_DIR_GEN};HDF5_ZLIB;libraries;/") + set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${H5_ZLIB_INCLUDE_DIR_GEN};HDF5_ZLIB;configinstall;/") endif () endif () - if (SZIP_FOUND AND SZIP_USE_EXTERNAL) + if (H5_SZIP_FOUND AND SZIP_USE_EXTERNAL) if (WIN32) - set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;ALL;/") + set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${H5_SZIP_INCLUDE_DIR_GEN};SZIP;ALL;/") else () - set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;libraries;/") - set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;configinstall;/") + set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${H5_SZIP_INCLUDE_DIR_GEN};SZIP;libraries;/") + set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${H5_SZIP_INCLUDE_DIR_GEN};SZIP;configinstall;/") endif () endif () if (PLUGIN_FOUND AND PLUGIN_USE_EXTERNAL) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee65c2a607d..4527d8024e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,8 +105,8 @@ mark_as_advanced (HDF5_LIB_INFIX) # else () # set (H5_ZLIB_HEADER "vtk_zlib.h") # # Set vars that FindZlib would have set if used in sub project -# set (ZLIB_INCLUDE_DIRS "${VTK_ZLIB_INCLUDE_DIRS}") -# set (ZLIB_LIBRARIES vtkzlib) +# set (H5_ZLIB_INCLUDE_DIRS "${VTK_H5_ZLIB_INCLUDE_DIRS}") +# set (H5_ZLIB_LIBRARIES vtkzlib) # endif () # endif () # @@ -947,7 +947,7 @@ endif () add_subdirectory (src) if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") - if ((ZLIB_FOUND AND ZLIB_USE_EXTERNAL) OR (SZIP_FOUND AND SZIP_USE_EXTERNAL)) + if ((H5_ZLIB_FOUND AND ZLIB_USE_EXTERNAL) OR (H5_SZIP_FOUND AND SZIP_USE_EXTERNAL)) if (BUILD_STATIC_LIBS) add_dependencies (${HDF5_LIB_TARGET} ${LINK_COMP_LIBS}) endif () diff --git a/CMakePlugins.cmake b/CMakePlugins.cmake index 7fd332a2ebe..f607c2cfb39 100644 --- a/CMakePlugins.cmake +++ b/CMakePlugins.cmake @@ -9,7 +9,7 @@ # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # -option (PLUGIN_USE_EXTERNAL "Use External Library Building for filter PLUGIN" OFF) +option (PLUGIN_USE_EXTERNAL "Use External Library Building for filter PLUGIN else search" OFF) if (NOT PLUGIN_USE_LOCALCONTENT) set (PLUGIN_URL ${PLUGIN_TGZ_ORIGPATH}/${PLUGIN_TGZ_NAME}) @@ -26,7 +26,7 @@ include (ExternalProject) set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO GIT TGZ)") set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO GIT TGZ) if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") - set (PLUGIN_USE_EXTERNAL ON CACHE BOOL "Use External Library Building for PLUGIN" FORCE) + set (PLUGIN_USE_EXTERNAL ON CACHE BOOL "Use External Library Building for PLUGIN else search" FORCE) if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT") set (PLUGIN_URL ${PLUGIN_GIT_URL} CACHE STRING "Path to PLUGIN git repository") set (PLUGIN_BRANCH ${PLUGIN_GIT_BRANCH}) @@ -41,7 +41,7 @@ if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MAT endif () endif () else () - set (PLUGIN_USE_EXTERNAL OFF CACHE BOOL "Use External Library Building for PLUGIN") + set (PLUGIN_USE_EXTERNAL OFF CACHE BOOL "Use External Library Building for PLUGIN else search") message (VERBOSE "Filter PLUGIN not built") endif () endif () diff --git a/CMakePresets.json b/CMakePresets.json index 61afadd7b92..de1229d57c4 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -46,6 +46,8 @@ "BLOSC_PACKAGE_NAME": {"type": "STRING", "value": "blosc"}, "BLOSC_ZLIB_TGZ_NAME": {"type": "STRING", "value": "zlib-1.3.tar.gz"}, "BLOSC_ZLIB_PACKAGE_NAME": {"type": "STRING", "value": "zlib"}, + "BLOSC2_TGZ_NAME": {"type": "STRING", "value": "c-blosc2-2.14.4.tar.gz"}, + "BLOSC2_PACKAGE_NAME": {"type": "STRING", "value": "blosc2"}, "BZ2_TGZ_NAME": {"type": "STRING", "value": "bzip2-bzip2-1.0.8.tar.gz"}, "BZ2_PACKAGE_NAME": {"type": "STRING", "value": "bz2"}, "FPZIP_TGZ_NAME": {"type": "STRING", "value": "fpzip-1.3.0.tar.gz"}, diff --git a/HDF5Examples/C/H5FLT/CMakeLists.txt b/HDF5Examples/C/H5FLT/CMakeLists.txt index 9345b662565..79c7e794685 100644 --- a/HDF5Examples/C/H5FLT/CMakeLists.txt +++ b/HDF5Examples/C/H5FLT/CMakeLists.txt @@ -24,6 +24,14 @@ else () set (BLOSC_AVAILABLE 0) endif () +option (ENABLE_BLOSC2 "Enable Library Building for blosc2 plugin" ON) +if (ENABLE_BLOSC2) + set (BLOSC_AVAILABLE 1) + set (dyn_examples ${dyn_examples} h5ex_d_blosc2) +else () + set (BLOSC_AVAILABLE 0) +endif () + option (ENABLE_BSHUF "Enable Library Building for bshuf plugin" ON) if (ENABLE_BSHUF) if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") diff --git a/HDF5Examples/C/H5FLT/h5ex_d_blosc2.c b/HDF5Examples/C/H5FLT/h5ex_d_blosc2.c new file mode 100644 index 00000000000..dae0becb4a2 --- /dev/null +++ b/HDF5Examples/C/H5FLT/h5ex_d_blosc2.c @@ -0,0 +1,234 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of the HDF5 BLOSC2 filter plugin source. The full * + * copyright notice, including terms governing use, modification, and * + * terms governing use, modification, and redistribution, is contained in * + * the file COPYING, which can be found at the root of the BLOSC2 source code * + * distribution tree. If you do not have access to this file, you may * + * request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + + This example shows how to write data and read it from a dataset + using blosc2 compression. + blosc2 filter is not available in HDF5. + The example uses a new feature available in HDF5 version 1.8.11 + to discover, load and register filters at run time. + + ************************************************************/ + +#include "hdf5.h" +#include +#include + +#define FILE "h5ex_d_blosc2.h5" +#define DATASET "DS1" +#define DIM0 32 +#define DIM1 64 +#define CHUNK0 4 +#define CHUNK1 8 +#define H5Z_FILTER_BLOSC2 32026 + +int +main(void) +{ + hid_t file_id = H5I_INVALID_HID; /* Handles */ + hid_t space_id = H5I_INVALID_HID; /* Handles */ + hid_t dset_id = H5I_INVALID_HID; /* Handles */ + hid_t dcpl_id = H5I_INVALID_HID; /* Handles */ + herr_t status; + htri_t avail; + H5Z_filter_t filter_id = 0; + char filter_name[128]; + hsize_t dims[2] = {DIM0, DIM1}, chunk[2] = {CHUNK0, CHUNK1}; + size_t nelmts = 10; /* number of elements in cd_values */ + unsigned int flags; + unsigned filter_config; + const unsigned int cd_values[10] = {0, 0, 0, 0, 4, 1, 2, 2, 4, 8}; /* blosc parameters */ + unsigned int values_out[10] = {99, 99, 99, 99, 99, 99, 99, 99, 99, 99}; + int wdata[DIM0][DIM1], /* Write buffer */ + rdata[DIM0][DIM1], /* Read buffer */ + max; + hsize_t i, j; + int ret_value = 1; + + /* + * Initialize data. + */ + for (i = 0; i < DIM0; i++) + for (j = 0; j < DIM1; j++) + wdata[i][j] = i * j - j; + + /* + * Create a new file using the default properties. + */ + file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (file_id < 0) + goto done; + + /* + * Create dataspace. Setting maximum size to NULL sets the maximum + * size to be the current size. + */ + space_id = H5Screate_simple(2, dims, NULL); + if (space_id < 0) + goto done; + + /* + * Create the dataset creation property list, add the gzip + * compression filter and set the chunk size. + */ + dcpl_id = H5Pcreate(H5P_DATASET_CREATE); + if (dcpl_id < 0) + goto done; + + status = H5Pset_filter(dcpl_id, H5Z_FILTER_BLOSC2, H5Z_FLAG_OPTIONAL, nelmts, cd_values); + if (status < 0) + goto done; + + /* + * Check that filter is registered with the library now. + * If it is registered, retrieve filter's configuration. + */ + avail = H5Zfilter_avail(H5Z_FILTER_BLOSC2); + if (avail) { + status = H5Zget_filter_info(H5Z_FILTER_BLOSC2, &filter_config); + if ((filter_config & H5Z_FILTER_CONFIG_ENCODE_ENABLED) && + (filter_config & H5Z_FILTER_CONFIG_DECODE_ENABLED)) + printf("blosc2 filter is available for encoding and decoding.\n"); + } + else { + printf("H5Zfilter_avail - not found.\n"); + goto done; + } + status = H5Pset_chunk(dcpl_id, 2, chunk); + if (status < 0) + printf("failed to set chunk.\n"); + + /* + * Create the dataset. + */ + printf("....Create dataset ................\n"); + dset_id = H5Dcreate(file_id, DATASET, H5T_STD_I32LE, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); + if (dset_id < 0) { + printf("failed to create dataset.\n"); + goto done; + } + + /* + * Write the data to the dataset. + */ + printf("....Writing blosc2 compressed data ................\n"); + status = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0]); + if (status < 0) + printf("failed to write data.\n"); + + /* + * Close and release resources. + */ + H5Dclose(dset_id); + dset_id = -1; + H5Pclose(dcpl_id); + dcpl_id = -1; + H5Sclose(space_id); + space_id = -1; + H5Fclose(file_id); + file_id = -1; + status = H5close(); + if (status < 0) { + printf("/nFAILED to close library/n"); + goto done; + } + + printf("....Close the file and reopen for reading ........\n"); + /* + * Now we begin the read section of this example. + */ + + /* + * Open file and dataset using the default properties. + */ + file_id = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT); + if (file_id < 0) + goto done; + + dset_id = H5Dopen(file_id, DATASET, H5P_DEFAULT); + if (dset_id < 0) + goto done; + + /* + * Retrieve dataset creation property list. + */ + dcpl_id = H5Dget_create_plist(dset_id); + if (dcpl_id < 0) + goto done; + + /* + * Retrieve and print the filter id, compression level and filter's name for blosc. + */ + filter_id = H5Pget_filter2(dcpl_id, (unsigned)0, &flags, &nelmts, values_out, sizeof(filter_name), + filter_name, NULL); + printf("Filter info is available from the dataset creation property\n "); + printf(" Filter identifier is "); + switch (filter_id) { + case H5Z_FILTER_BLOSC2: + printf("%d\n", filter_id); + printf(" Number of parameters is %d with the value %u %u %u\n", nelmts, values_out[4], + values_out[5], values_out[6]); + printf(" To find more about the filter check %s\n", filter_name); + break; + default: + printf("Not expected filter\n"); + break; + } + + /* + * Read the data using the default properties. + */ + printf("....Reading blosc2 compressed data ................\n"); + status = H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0]); + if (status < 0) + printf("failed to read data.\n"); + + /* + * Find the maximum value in the dataset, to verify that it was + * read correctly. + */ + max = rdata[0][0]; + for (i = 0; i < DIM0; i++) + for (j = 0; j < DIM1; j++) { + /*printf("%d \n", rdata[i][j]); */ + if (max < rdata[i][j]) + max = rdata[i][j]; + } + /* + * Print the maximum value. + */ + printf("Maximum value in %s is %d\n", DATASET, max); + /* + * Check that filter is registered with the library now. + */ + avail = H5Zfilter_avail(H5Z_FILTER_BLOSC2); + if (avail) + printf("blosc2 filter is available now since H5Dread triggered loading of the filter.\n"); + + ret_value = 0; + +done: + /* + * Close and release resources. + */ + if (dcpl_id >= 0) + H5Pclose(dcpl_id); + if (dset_id >= 0) + H5Dclose(dset_id); + if (space_id >= 0) + H5Sclose(space_id); + if (file_id >= 0) + H5Fclose(file_id); + + return ret_value; +} diff --git a/HDF5Examples/C/H5FLT/tfiles/h5ex_d_blosc2.ddl b/HDF5Examples/C/H5FLT/tfiles/h5ex_d_blosc2.ddl new file mode 100644 index 00000000000..df86cd05ef3 --- /dev/null +++ b/HDF5Examples/C/H5FLT/tfiles/h5ex_d_blosc2.ddl @@ -0,0 +1,209 @@ +HDF5 "h5ex_d_blosc2.h5" { +GROUP "/" { + DATASET "DS1" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 32, 64 ) / ( 32, 64 ) } + STORAGE_LAYOUT { + CHUNKED ( 4, 8 ) + SIZE 21247 (0.386:1 COMPRESSION) + } + FILTERS { + USER_DEFINED_FILTER { + FILTER_ID 32026 + COMMENT HDF5 blosc2 filter; see https://github.com/HDFGroup/hdf5_plugins/blob/master/docs/RegisteredFilterPlugins.md + PARAMS { 1 0 4 128 4 1 2 2 4 8 } + } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + DATA { + (0,0): 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, + (0,15): -15, -16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26, + (0,27): -27, -28, -29, -30, -31, -32, -33, -34, -35, -36, -37, -38, + (0,39): -39, -40, -41, -42, -43, -44, -45, -46, -47, -48, -49, -50, + (0,51): -51, -52, -53, -54, -55, -56, -57, -58, -59, -60, -61, -62, + (0,63): -63, + (1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,21): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,42): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,63): 0, + (2,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + (2,18): 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + (2,34): 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + (2,50): 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + (3,0): 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, + (3,17): 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, + (3,33): 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, + (3,49): 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, + (3,62): 124, 126, + (4,0): 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, + (4,17): 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, + (4,33): 99, 102, 105, 108, 111, 114, 117, 120, 123, 126, 129, 132, 135, + (4,46): 138, 141, 144, 147, 150, 153, 156, 159, 162, 165, 168, 171, + (4,58): 174, 177, 180, 183, 186, 189, + (5,0): 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, + (5,17): 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, + (5,31): 124, 128, 132, 136, 140, 144, 148, 152, 156, 160, 164, 168, + (5,43): 172, 176, 180, 184, 188, 192, 196, 200, 204, 208, 212, 216, + (5,55): 220, 224, 228, 232, 236, 240, 244, 248, 252, + (6,0): 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, + (6,16): 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, + (6,29): 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 200, + (6,41): 205, 210, 215, 220, 225, 230, 235, 240, 245, 250, 255, 260, + (6,53): 265, 270, 275, 280, 285, 290, 295, 300, 305, 310, 315, + (7,0): 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, + (7,16): 96, 102, 108, 114, 120, 126, 132, 138, 144, 150, 156, 162, 168, + (7,29): 174, 180, 186, 192, 198, 204, 210, 216, 222, 228, 234, 240, + (7,41): 246, 252, 258, 264, 270, 276, 282, 288, 294, 300, 306, 312, + (7,53): 318, 324, 330, 336, 342, 348, 354, 360, 366, 372, 378, + (8,0): 0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, + (8,16): 112, 119, 126, 133, 140, 147, 154, 161, 168, 175, 182, 189, + (8,28): 196, 203, 210, 217, 224, 231, 238, 245, 252, 259, 266, 273, + (8,40): 280, 287, 294, 301, 308, 315, 322, 329, 336, 343, 350, 357, + (8,52): 364, 371, 378, 385, 392, 399, 406, 413, 420, 427, 434, 441, + (9,0): 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, + (9,16): 128, 136, 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, + (9,28): 224, 232, 240, 248, 256, 264, 272, 280, 288, 296, 304, 312, + (9,40): 320, 328, 336, 344, 352, 360, 368, 376, 384, 392, 400, 408, + (9,52): 416, 424, 432, 440, 448, 456, 464, 472, 480, 488, 496, 504, + (10,0): 0, 9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 99, 108, 117, 126, + (10,15): 135, 144, 153, 162, 171, 180, 189, 198, 207, 216, 225, 234, + (10,27): 243, 252, 261, 270, 279, 288, 297, 306, 315, 324, 333, 342, + (10,39): 351, 360, 369, 378, 387, 396, 405, 414, 423, 432, 441, 450, + (10,51): 459, 468, 477, 486, 495, 504, 513, 522, 531, 540, 549, 558, + (10,63): 567, + (11,0): 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, + (11,15): 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, + (11,27): 270, 280, 290, 300, 310, 320, 330, 340, 350, 360, 370, 380, + (11,39): 390, 400, 410, 420, 430, 440, 450, 460, 470, 480, 490, 500, + (11,51): 510, 520, 530, 540, 550, 560, 570, 580, 590, 600, 610, 620, + (11,63): 630, + (12,0): 0, 11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 121, 132, 143, 154, + (12,15): 165, 176, 187, 198, 209, 220, 231, 242, 253, 264, 275, 286, + (12,27): 297, 308, 319, 330, 341, 352, 363, 374, 385, 396, 407, 418, + (12,39): 429, 440, 451, 462, 473, 484, 495, 506, 517, 528, 539, 550, + (12,51): 561, 572, 583, 594, 605, 616, 627, 638, 649, 660, 671, 682, + (12,63): 693, + (13,0): 0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, + (13,14): 168, 180, 192, 204, 216, 228, 240, 252, 264, 276, 288, 300, + (13,26): 312, 324, 336, 348, 360, 372, 384, 396, 408, 420, 432, 444, + (13,38): 456, 468, 480, 492, 504, 516, 528, 540, 552, 564, 576, 588, + (13,50): 600, 612, 624, 636, 648, 660, 672, 684, 696, 708, 720, 732, + (13,62): 744, 756, + (14,0): 0, 13, 26, 39, 52, 65, 78, 91, 104, 117, 130, 143, 156, 169, + (14,14): 182, 195, 208, 221, 234, 247, 260, 273, 286, 299, 312, 325, + (14,26): 338, 351, 364, 377, 390, 403, 416, 429, 442, 455, 468, 481, + (14,38): 494, 507, 520, 533, 546, 559, 572, 585, 598, 611, 624, 637, + (14,50): 650, 663, 676, 689, 702, 715, 728, 741, 754, 767, 780, 793, + (14,62): 806, 819, + (15,0): 0, 14, 28, 42, 56, 70, 84, 98, 112, 126, 140, 154, 168, 182, + (15,14): 196, 210, 224, 238, 252, 266, 280, 294, 308, 322, 336, 350, + (15,26): 364, 378, 392, 406, 420, 434, 448, 462, 476, 490, 504, 518, + (15,38): 532, 546, 560, 574, 588, 602, 616, 630, 644, 658, 672, 686, + (15,50): 700, 714, 728, 742, 756, 770, 784, 798, 812, 826, 840, 854, + (15,62): 868, 882, + (16,0): 0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, 195, + (16,14): 210, 225, 240, 255, 270, 285, 300, 315, 330, 345, 360, 375, + (16,26): 390, 405, 420, 435, 450, 465, 480, 495, 510, 525, 540, 555, + (16,38): 570, 585, 600, 615, 630, 645, 660, 675, 690, 705, 720, 735, + (16,50): 750, 765, 780, 795, 810, 825, 840, 855, 870, 885, 900, 915, + (16,62): 930, 945, + (17,0): 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, + (17,14): 224, 240, 256, 272, 288, 304, 320, 336, 352, 368, 384, 400, + (17,26): 416, 432, 448, 464, 480, 496, 512, 528, 544, 560, 576, 592, + (17,38): 608, 624, 640, 656, 672, 688, 704, 720, 736, 752, 768, 784, + (17,50): 800, 816, 832, 848, 864, 880, 896, 912, 928, 944, 960, 976, + (17,62): 992, 1008, + (18,0): 0, 17, 34, 51, 68, 85, 102, 119, 136, 153, 170, 187, 204, 221, + (18,14): 238, 255, 272, 289, 306, 323, 340, 357, 374, 391, 408, 425, + (18,26): 442, 459, 476, 493, 510, 527, 544, 561, 578, 595, 612, 629, + (18,38): 646, 663, 680, 697, 714, 731, 748, 765, 782, 799, 816, 833, + (18,50): 850, 867, 884, 901, 918, 935, 952, 969, 986, 1003, 1020, 1037, + (18,62): 1054, 1071, + (19,0): 0, 18, 36, 54, 72, 90, 108, 126, 144, 162, 180, 198, 216, 234, + (19,14): 252, 270, 288, 306, 324, 342, 360, 378, 396, 414, 432, 450, + (19,26): 468, 486, 504, 522, 540, 558, 576, 594, 612, 630, 648, 666, + (19,38): 684, 702, 720, 738, 756, 774, 792, 810, 828, 846, 864, 882, + (19,50): 900, 918, 936, 954, 972, 990, 1008, 1026, 1044, 1062, 1080, + (19,61): 1098, 1116, 1134, + (20,0): 0, 19, 38, 57, 76, 95, 114, 133, 152, 171, 190, 209, 228, 247, + (20,14): 266, 285, 304, 323, 342, 361, 380, 399, 418, 437, 456, 475, + (20,26): 494, 513, 532, 551, 570, 589, 608, 627, 646, 665, 684, 703, + (20,38): 722, 741, 760, 779, 798, 817, 836, 855, 874, 893, 912, 931, + (20,50): 950, 969, 988, 1007, 1026, 1045, 1064, 1083, 1102, 1121, 1140, + (20,61): 1159, 1178, 1197, + (21,0): 0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, + (21,14): 280, 300, 320, 340, 360, 380, 400, 420, 440, 460, 480, 500, + (21,26): 520, 540, 560, 580, 600, 620, 640, 660, 680, 700, 720, 740, + (21,38): 760, 780, 800, 820, 840, 860, 880, 900, 920, 940, 960, 980, + (21,50): 1000, 1020, 1040, 1060, 1080, 1100, 1120, 1140, 1160, 1180, + (21,60): 1200, 1220, 1240, 1260, + (22,0): 0, 21, 42, 63, 84, 105, 126, 147, 168, 189, 210, 231, 252, 273, + (22,14): 294, 315, 336, 357, 378, 399, 420, 441, 462, 483, 504, 525, + (22,26): 546, 567, 588, 609, 630, 651, 672, 693, 714, 735, 756, 777, + (22,38): 798, 819, 840, 861, 882, 903, 924, 945, 966, 987, 1008, 1029, + (22,50): 1050, 1071, 1092, 1113, 1134, 1155, 1176, 1197, 1218, 1239, + (22,60): 1260, 1281, 1302, 1323, + (23,0): 0, 22, 44, 66, 88, 110, 132, 154, 176, 198, 220, 242, 264, 286, + (23,14): 308, 330, 352, 374, 396, 418, 440, 462, 484, 506, 528, 550, + (23,26): 572, 594, 616, 638, 660, 682, 704, 726, 748, 770, 792, 814, + (23,38): 836, 858, 880, 902, 924, 946, 968, 990, 1012, 1034, 1056, + (23,49): 1078, 1100, 1122, 1144, 1166, 1188, 1210, 1232, 1254, 1276, + (23,59): 1298, 1320, 1342, 1364, 1386, + (24,0): 0, 23, 46, 69, 92, 115, 138, 161, 184, 207, 230, 253, 276, 299, + (24,14): 322, 345, 368, 391, 414, 437, 460, 483, 506, 529, 552, 575, + (24,26): 598, 621, 644, 667, 690, 713, 736, 759, 782, 805, 828, 851, + (24,38): 874, 897, 920, 943, 966, 989, 1012, 1035, 1058, 1081, 1104, + (24,49): 1127, 1150, 1173, 1196, 1219, 1242, 1265, 1288, 1311, 1334, + (24,59): 1357, 1380, 1403, 1426, 1449, + (25,0): 0, 24, 48, 72, 96, 120, 144, 168, 192, 216, 240, 264, 288, 312, + (25,14): 336, 360, 384, 408, 432, 456, 480, 504, 528, 552, 576, 600, + (25,26): 624, 648, 672, 696, 720, 744, 768, 792, 816, 840, 864, 888, + (25,38): 912, 936, 960, 984, 1008, 1032, 1056, 1080, 1104, 1128, 1152, + (25,49): 1176, 1200, 1224, 1248, 1272, 1296, 1320, 1344, 1368, 1392, + (25,59): 1416, 1440, 1464, 1488, 1512, + (26,0): 0, 25, 50, 75, 100, 125, 150, 175, 200, 225, 250, 275, 300, + (26,13): 325, 350, 375, 400, 425, 450, 475, 500, 525, 550, 575, 600, + (26,25): 625, 650, 675, 700, 725, 750, 775, 800, 825, 850, 875, 900, + (26,37): 925, 950, 975, 1000, 1025, 1050, 1075, 1100, 1125, 1150, 1175, + (26,48): 1200, 1225, 1250, 1275, 1300, 1325, 1350, 1375, 1400, 1425, + (26,58): 1450, 1475, 1500, 1525, 1550, 1575, + (27,0): 0, 26, 52, 78, 104, 130, 156, 182, 208, 234, 260, 286, 312, + (27,13): 338, 364, 390, 416, 442, 468, 494, 520, 546, 572, 598, 624, + (27,25): 650, 676, 702, 728, 754, 780, 806, 832, 858, 884, 910, 936, + (27,37): 962, 988, 1014, 1040, 1066, 1092, 1118, 1144, 1170, 1196, + (27,47): 1222, 1248, 1274, 1300, 1326, 1352, 1378, 1404, 1430, 1456, + (27,57): 1482, 1508, 1534, 1560, 1586, 1612, 1638, + (28,0): 0, 27, 54, 81, 108, 135, 162, 189, 216, 243, 270, 297, 324, + (28,13): 351, 378, 405, 432, 459, 486, 513, 540, 567, 594, 621, 648, + (28,25): 675, 702, 729, 756, 783, 810, 837, 864, 891, 918, 945, 972, + (28,37): 999, 1026, 1053, 1080, 1107, 1134, 1161, 1188, 1215, 1242, + (28,47): 1269, 1296, 1323, 1350, 1377, 1404, 1431, 1458, 1485, 1512, + (28,57): 1539, 1566, 1593, 1620, 1647, 1674, 1701, + (29,0): 0, 28, 56, 84, 112, 140, 168, 196, 224, 252, 280, 308, 336, + (29,13): 364, 392, 420, 448, 476, 504, 532, 560, 588, 616, 644, 672, + (29,25): 700, 728, 756, 784, 812, 840, 868, 896, 924, 952, 980, 1008, + (29,37): 1036, 1064, 1092, 1120, 1148, 1176, 1204, 1232, 1260, 1288, + (29,47): 1316, 1344, 1372, 1400, 1428, 1456, 1484, 1512, 1540, 1568, + (29,57): 1596, 1624, 1652, 1680, 1708, 1736, 1764, + (30,0): 0, 29, 58, 87, 116, 145, 174, 203, 232, 261, 290, 319, 348, + (30,13): 377, 406, 435, 464, 493, 522, 551, 580, 609, 638, 667, 696, + (30,25): 725, 754, 783, 812, 841, 870, 899, 928, 957, 986, 1015, 1044, + (30,37): 1073, 1102, 1131, 1160, 1189, 1218, 1247, 1276, 1305, 1334, + (30,47): 1363, 1392, 1421, 1450, 1479, 1508, 1537, 1566, 1595, 1624, + (30,57): 1653, 1682, 1711, 1740, 1769, 1798, 1827, + (31,0): 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360, + (31,13): 390, 420, 450, 480, 510, 540, 570, 600, 630, 660, 690, 720, + (31,25): 750, 780, 810, 840, 870, 900, 930, 960, 990, 1020, 1050, 1080, + (31,37): 1110, 1140, 1170, 1200, 1230, 1260, 1290, 1320, 1350, 1380, + (31,47): 1410, 1440, 1470, 1500, 1530, 1560, 1590, 1620, 1650, 1680, + (31,57): 1710, 1740, 1770, 1800, 1830, 1860, 1890 + } + } +} +} diff --git a/HDF5Examples/C/H5FLT/tfiles/h5ex_d_blosc2.h5 b/HDF5Examples/C/H5FLT/tfiles/h5ex_d_blosc2.h5 new file mode 100644 index 00000000000..27339367f5d Binary files /dev/null and b/HDF5Examples/C/H5FLT/tfiles/h5ex_d_blosc2.h5 differ diff --git a/HDF5Examples/C/H5FLT/tfiles/h5ex_d_blosc2.tst b/HDF5Examples/C/H5FLT/tfiles/h5ex_d_blosc2.tst new file mode 100644 index 00000000000..de97edfa1b6 --- /dev/null +++ b/HDF5Examples/C/H5FLT/tfiles/h5ex_d_blosc2.tst @@ -0,0 +1,11 @@ +blosc2 filter is available for encoding and decoding. +....Create dataset ................ +....Writing blosc2 compressed data ................ +....Close the file and reopen for reading ........ +Filter info is available from the dataset creation property + Filter identifier is 32026 + Number of parameters is 10 with the value 4 1 2 + To find more about the filter check HDF5 blosc2 filter; see https://github.com/HDFGroup/hdf5_plugins/blob/master/docs/RegisteredFilterPlugins.md +....Reading blosc2 compressed data ................ +Maximum value in DS1 is 1890 +blosc2 filter is available now since H5Dread triggered loading of the filter. diff --git a/bin/h5vers b/bin/h5vers index 29470e1968b..129ad1bf526 100755 --- a/bin/h5vers +++ b/bin/h5vers @@ -95,6 +95,8 @@ sub setvers { $_[0] =~ s/^(\#\s*define\s+H5_VERS_MINOR\s+)\d+/$1$vers[1]/m; $_[0] =~ s/^(\#\s*define\s+H5_VERS_RELEASE\s+)\d+/$1$vers[2]/m; $_[0] =~ s/^(\#\s*define\s+H5_VERS_SUBRELEASE\s+\")[^\"]*/$1$vers[3]/m; + $_[0] =~ s/^(\#\s*define\s+H5_VERS_STR\s+\")[^\"]*/ + sprintf("%s%d.%d.%d%s%s", $1, @vers[0,1,2], $vers[3]?"-":"", $vers[3])/me; $_[0] =~ s/^(\#\s*define\s+H5_VERS_INFO\s+\")[^\"]*/ sprintf("%sHDF5 library version: %d.%d.%d%s%s", $1, @vers[0,1,2], $vers[3]?"-":"", $vers[3])/me; diff --git a/bin/make_err b/bin/make_err index 618a2df46ac..58722a4fd82 100755 --- a/bin/make_err +++ b/bin/make_err @@ -47,7 +47,7 @@ sub print_warning ($) { my $fh = shift; print $fh "\n/* Generated automatically by bin/make_err -- do not edit */\n"; - print $fh "/* Add new errors to H5err.txt file */\n\n"; + print $fh "/* Add new errors to H5err.txt file */\n"; } ############################################################################## @@ -92,7 +92,7 @@ sub parse_line ($) { # Get the major error's name & description ($name, $desc) = ($line =~ /^\s*MAJOR,\s*(\w*),\s*(.*)\n/); #print "MAJOR: name=$name, desc=$desc\n"; - + # Check if the name already exists as a major or minor error message if(exists($major{$name}) || exists($minor{$name})) { die "duplicated name: $name"; @@ -103,12 +103,12 @@ sub parse_line ($) { } # Parse minor error lines elsif($line =~ /^\s*MINOR,/) { - my $min_section; # Minor errors have a section they below to also + my $min_section; # Minor errors have a section they belong to also # Get the minor error's section, name & description ($min_section, $name, $desc) = ($line =~ /^\s*MINOR,\s*(\w*),\s*(\w*),\s*(.*)\n/); #print "MINOR: min_section=$min_section, name=$name, desc=$desc\n"; - + # Check for valid section if(!exists($section{$min_section})) { die "unknown section: $min_section"; @@ -121,7 +121,7 @@ sub parse_line ($) { # Store the minor errors in a hash table, indexed by the name $minor{$name}=$desc; - + # Add the minor error to the list for the section push @{$section_list{$min_section}}, $name; } @@ -130,7 +130,7 @@ sub parse_line ($) { # Get the section's name & description ($name, $desc) = ($line =~ /^\s*SECTION,\s*(\w*),\s*(.*)\n/); #print "SECTION: name=$name, desc=$desc\n"; - + # Check if the section has already been defined if(exists($section{$name})) { die "duplicated name: $name"; @@ -178,10 +178,10 @@ sub create_public ($) { print HEADER "\n/*********************/\n"; print HEADER "/* Major error codes */\n"; print HEADER "/*********************/\n\n"; - foreach $name (keys %major) { + foreach $name (sort keys %major) { printf HEADER "#define %-20s (H5OPEN %s_g)\n",$name,$name; } - foreach $name (keys %major) { + foreach $name (sort keys %major) { printf HEADER "H5_DLLVAR hid_t %-20s /* %s */\n","${name}_g;",$major{$name}; } @@ -189,14 +189,14 @@ sub create_public ($) { print HEADER "\n/*********************/\n"; print HEADER "/* Minor error codes */\n"; print HEADER "/*********************/\n"; - while ( ($sect_name, $sect_desc) = each (%section)) { - print HEADER "\n/* $sect_desc */\n"; + foreach $sect_name (sort keys %section) { + print HEADER "\n/* $section{$sect_name} */\n"; # Iterate over all the minor errors in each section - for $name ( @{$section_list{$sect_name}}) { + for $name (sort @{$section_list{$sect_name}}) { printf HEADER "#define %-20s (H5OPEN %s_g)\n",$name,$name; } - for $name ( @{$section_list{$sect_name}}) { + for $name (sort @{$section_list{$sect_name}}) { printf HEADER "H5_DLLVAR hid_t %-20s /* %s */\n","${name}_g;",$minor{$name}; } } @@ -213,6 +213,84 @@ sub create_public ($) { close HEADER; } +############################################################################## +# Create the generated portion of the H5E major message definition code +# +sub create_majdef ($) { + my $prefix = shift; # Get the prefix for the generated file + my $file = "H5Emajdef.h"; # Name of file to generate + my $name; # Name of error message + + # Rename previous file +# rename "${prefix}${file}", "${prefix}${file}~" or die "unable to make backup"; + + # Open new header file + open HEADER, ">${prefix}${file}" or die "unable to modify source"; + + # Create file contents + + print_copyright(*HEADER); + print_warning(*HEADER); + print_startprotect(*HEADER, $file); + + # Iterate over all the major errors + print HEADER "\n/***********************************/\n"; + print HEADER "/* Major error message definitions */\n"; + print HEADER "/***********************************/\n\n"; + print HEADER "/* clang-format off */\n"; + foreach $name (sort keys %major) { + printf HEADER "static const H5E_msg_t ${name}_msg_s = {false, \"${major{$name}}\", H5E_MAJOR, &H5E_err_cls_s};\n"; + } + print HEADER "/* clang-format on */\n"; + + print_endprotect(*HEADER, $file); + + # Close header file + close HEADER; +} + +############################################################################## +# Create the generated portion of the H5E minor message definition code +# +sub create_mindef ($) { + my $prefix = shift; # Get the prefix for the generated file + my $file = "H5Emindef.h"; # Name of file to generate + my $name; # Name of error message + my $sect_name; # Section of minor error messages + + # Rename previous file +# rename "${prefix}${file}", "${prefix}${file}~" or die "unable to make backup"; + + # Open new header file + open HEADER, ">${prefix}${file}" or die "unable to modify source"; + + # Create file contents + + print_copyright(*HEADER); + print_warning(*HEADER); + print_startprotect(*HEADER, $file); + + # Iterate over all the minor error sections + print HEADER "\n/***********************************/\n"; + print HEADER "/* Minor error message definitions */\n"; + print HEADER "/***********************************/\n\n"; + print HEADER "/* clang-format off */\n"; + foreach $sect_name (sort keys %section) { + print HEADER "\n/* $sect_name: $section{$sect_name} */\n"; + + # Iterate over all the minor errors in each section + for $name (sort @{$section_list{$sect_name}}) { + printf HEADER "static const H5E_msg_t ${name}_msg_s = {false, \"${minor{$name}}\", H5E_MINOR, &H5E_err_cls_s};\n"; + } + } + print HEADER "/* clang-format on */\n"; + + print_endprotect(*HEADER, $file); + + # Close header file + close HEADER; +} + ############################################################################## # Create the generated portion of the H5E initialization code # @@ -220,6 +298,7 @@ sub create_init ($) { my $prefix = shift; # Get the prefix for the generated file my $file = "H5Einit.h"; # Name of file to generate my $name; # Name of error message + my $last_name; # Name of previous error message my $desc; # Description of error message my $sect_name; # Section of minor error messages my $sect_desc; # Description of section @@ -242,18 +321,17 @@ sub create_init ($) { print HEADER "\n/*********************/\n"; print HEADER "/* Major error codes */\n"; print HEADER "/*********************/\n\n"; - foreach $name (keys %major) { - print HEADER " "x(0*$indent),"assert(${name}_g==H5I_INVALID_HID);\n"; - print HEADER " "x(0*$indent),"if((msg = H5E__create_msg(cls, H5E_MAJOR, \"${major{$name}}\"))==NULL)\n"; - print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, \"error message initialization failed\");\n"; - print HEADER " "x(0*$indent),"if((${name}_g = H5I_register(H5I_ERROR_MSG, msg, false))<0)\n"; + foreach $name (sort keys %major) { + print HEADER "/* $name */\n"; + print HEADER " "x(0*$indent),"assert(H5I_INVALID_HID == ${name}_g);\n"; + print HEADER " "x(0*$indent),"if((${name}_g = H5I_register(H5I_ERROR_MSG, &${name}_msg_s, false)) < 0)\n"; print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, \"can't register error message\");\n"; if ($first_major == 0) { print HEADER " "x(0*$indent),"\n/* Remember first major error code ID */\n"; print HEADER " "x(0*$indent),"assert(H5E_first_maj_id_g==H5I_INVALID_HID);\n"; print HEADER " "x(0*$indent),"H5E_first_maj_id_g = ${name}_g;\n\n"; $first_major = 1; - } + } $last_name = $name; } print HEADER " "x(0*$indent),"\n/* Remember last major error code ID */\n"; @@ -264,15 +342,14 @@ sub create_init ($) { print HEADER "\n/*********************/\n"; print HEADER "/* Minor error codes */\n"; print HEADER "/*********************/\n\n"; - while ( ($sect_name, $sect_desc) = each (%section)) { - print HEADER "\n"," "x(0*$indent),"/* $sect_desc */\n"; + foreach $sect_name (sort keys %section) { + print HEADER "\n/* $section{$sect_name} */\n"; # Iterate over all the minor errors in each section - for $name ( @{$section_list{$sect_name}}) { - print HEADER " "x(0*$indent),"assert(${name}_g==H5I_INVALID_HID);\n"; - print HEADER " "x(0*$indent),"if((msg = H5E__create_msg(cls, H5E_MINOR, \"${minor{$name}}\"))==NULL)\n"; - print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, \"error message initialization failed\");\n"; - print HEADER " "x(0*$indent),"if((${name}_g = H5I_register(H5I_ERROR_MSG, msg, true))<0)\n"; + for $name (sort @{$section_list{$sect_name}}) { + print HEADER "/* $name */\n"; + print HEADER " "x(0*$indent),"assert(H5I_INVALID_HID == ${name}_g);\n"; + print HEADER " "x(0*$indent),"if((${name}_g = H5I_register(H5I_ERROR_MSG, &${name}_msg_s, false)) < 0)\n"; print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, \"can't register error message\");\n"; if ($first_minor == 0) { @@ -319,25 +396,25 @@ sub create_term ($) { # Iterate over all the major errors print HEADER "\n/* Reset major error IDs */\n"; - foreach $name (keys %major) { - print HEADER " "x($indent),"\n${name}_g="; + foreach $name (sort keys %major) { + print HEADER " "x($indent),"${name}_g =\n"; } - print HEADER " H5I_INVALID_HID;\n"; - print HEADER " "x(0*$indent),"H5E_first_maj_id_g = H5I_INVALID_HID;\n\n"; + print HEADER " "x(2*$indent),"H5I_INVALID_HID;\n"; + print HEADER "\n"," "x(0*$indent),"H5E_first_maj_id_g = H5I_INVALID_HID;\n"; print HEADER " "x(0*$indent),"H5E_last_maj_id_g = H5I_INVALID_HID;\n\n"; # Iterate over all the minor error sections print HEADER "\n/* Reset minor error IDs */\n"; - while ( ($sect_name, $sect_desc) = each (%section)) { - print HEADER "\n"," "x(0*$indent),"\n/* $sect_desc */"; + foreach $sect_name (sort keys %section) { + print HEADER "\n/* $sect_name: $section{$sect_name} */\n"; # Iterate over all the minor errors in each section - for $name ( @{$section_list{$sect_name}}) { - print HEADER " "x($indent),"\n${name}_g="; + for $name (sort @{$section_list{$sect_name}}) { + print HEADER " "x($indent),"${name}_g =\n"; } } - print HEADER " H5I_INVALID_HID;\n"; - print HEADER " "x(0*$indent),"H5E_first_min_id_g = H5I_INVALID_HID;\n\n"; + print HEADER " "x(2*$indent),"H5I_INVALID_HID;\n"; + print HEADER "\n"," "x(0*$indent),"H5E_first_min_id_g = H5I_INVALID_HID;\n"; print HEADER " "x(0*$indent),"H5E_last_min_id_g = H5I_INVALID_HID;\n\n"; print_endprotect(*HEADER, $file); @@ -356,6 +433,7 @@ sub create_define ($) { my $desc; # Description of error message my $sect_name; # Section of minor error messages my $sect_desc; # Description of section + my $num_msg; # Number of messages # Rename previous file # rename "${prefix}${file}", "${prefix}${file}~" or die "unable to make backup"; @@ -370,21 +448,29 @@ sub create_define ($) { print_startprotect(*HEADER, $file); # Iterate over all the major errors + $num_msg = 0; print HEADER "\n/* Major error IDs */\n"; - foreach $name (keys %major) { - printf HEADER "hid_t %-20s = FAIL; /* %s */\n","${name}_g",$major{$name}; + foreach $name (sort keys %major) { + printf HEADER "hid_t %-20s = H5I_INVALID_HID; /* %s */\n","${name}_g",$major{$name}; + $num_msg++; } + print HEADER "\n/* Number of major error messages */\n"; + printf HEADER "#define H5E_NUM_MAJ_ERRORS %d\n", $num_msg; # Iterate over all the minor error sections + $num_msg = 0; print HEADER "\n/* Minor error IDs */\n"; - while ( ($sect_name, $sect_desc) = each (%section)) { - print HEADER "\n/* $sect_desc */\n"; + foreach $sect_name (sort keys %section) { + print HEADER "\n/* $sect_name: $section{$sect_name} */\n"; # Iterate over all the minor errors in each section - for $name ( @{$section_list{$sect_name}}) { - printf HEADER "hid_t %-20s = FAIL; /* %s */\n","${name}_g",$minor{$name}; + for $name (sort @{$section_list{$sect_name}}) { + printf HEADER "hid_t %-20s = H5I_INVALID_HID; /* %s */\n","${name}_g",$minor{$name}; + $num_msg++; } } + print HEADER "\n/* Number of minor error messages */\n"; + printf HEADER "#define H5E_NUM_MIN_ERRORS %d\n", $num_msg; print_endprotect(*HEADER, $file); @@ -409,10 +495,14 @@ for $file (@ARGV) { } } close SOURCE; - + # Create header files print "Generating 'H5Epubgen.h'\n"; create_public($prefix); + print "Generating 'H5Emajdef.h'\n"; + create_majdef($prefix); + print "Generating 'H5Emindef.h'\n"; + create_mindef($prefix); print "Generating 'H5Einit.h'\n"; create_init($prefix); print "Generating 'H5Eterm.h'\n"; diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index e629a800c76..a79d7c3a024 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -610,9 +610,7 @@ Attribute::~Attribute() Attribute & Attribute::operator=(const Attribute &original) { - if (&original != this) { - setId(original.id); - } + IdComponent::operator=(original); return *this; } diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index 248e71f9571..48358b3a5cb 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -279,9 +279,7 @@ Group::~Group() Group & Group::operator=(const Group &original) { - if (&original != this) { - setId(original.id); - } + IdComponent::operator=(original); return *this; } diff --git a/config/cmake/HDF5PluginCache.cmake b/config/cmake/HDF5PluginCache.cmake index e96c45db371..8c667077b88 100644 --- a/config/cmake/HDF5PluginCache.cmake +++ b/config/cmake/HDF5PluginCache.cmake @@ -6,7 +6,7 @@ # examples are the tests for plugins set (H5PL_BUILD_TESTING ON CACHE BOOL "Enable H5PL testing" FORCE) -set (BUILD_EXAMPLES ${HDF5_BUILD_EXAMPLES} CACHE BOOL "Build H5PL Examples" FORCE) +set (H5PL_BUILD_EXAMPLES ${HDF5_BUILD_EXAMPLES} CACHE BOOL "Build H5PL Examples" FORCE) #preset HDF5 cache vars to this projects libraries instead of searching set (H5PL_HDF5_HEADER "H5pubconf.h" CACHE STRING "Name of HDF5 header" FORCE) diff --git a/config/cmake/HDF5PluginMacros.cmake b/config/cmake/HDF5PluginMacros.cmake index e2bdce3f33f..3ef5b90527e 100644 --- a/config/cmake/HDF5PluginMacros.cmake +++ b/config/cmake/HDF5PluginMacros.cmake @@ -44,7 +44,7 @@ macro (FILTER_OPTION plname) string(TOLOWER ${plname} PLUGIN_NAME) option (ENABLE_${plname} "Enable Library Building for ${plname} plugin" ON) if (ENABLE_${plname}) - option (HDF_${plname}_USE_EXTERNAL "Use External Library Building for ${PLUGIN_NAME} plugin" OFF) + option (HDF_${plname}_USE_EXTERNAL "Use External Library Building for ${PLUGIN_NAME} plugin else search" OFF) mark_as_advanced (HDF_${plname}_USE_EXTERNAL) if (H5PL_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR H5PL_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") set (HDF_${plname}_USE_EXTERNAL ON CACHE BOOL "Use External Library Building for ${PLUGIN_NAME} plugin" FORCE) diff --git a/config/cmake/HDFLibMacros.cmake b/config/cmake/HDFLibMacros.cmake index 4039a503825..8a8813c3036 100644 --- a/config/cmake/HDFLibMacros.cmake +++ b/config/cmake/HDFLibMacros.cmake @@ -34,13 +34,13 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) endif() add_library(${HDF_PACKAGE_NAMESPACE}zlib-static ALIAS zlib-static) - set (ZLIB_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}zlib-static") - set (ZLIB_LIBRARIES ${ZLIB_STATIC_LIBRARY}) + set (H5_ZLIB_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}zlib-static") + set (H5_ZLIB_LIBRARIES ${H5_ZLIB_STATIC_LIBRARY}) - set (ZLIB_INCLUDE_DIR_GEN "${hdf5_zlib_BINARY_DIR}") - set (ZLIB_INCLUDE_DIR "${hdf5_zlib_SOURCE_DIR}") - set (ZLIB_FOUND 1) - set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR_GEN} ${ZLIB_INCLUDE_DIR}) + set (H5_ZLIB_INCLUDE_DIR_GEN "${hdf5_zlib_BINARY_DIR}") + set (H5_ZLIB_INCLUDE_DIR "${hdf5_zlib_SOURCE_DIR}") + set (H5_ZLIB_FOUND 1) + set (H5_ZLIB_INCLUDE_DIRS ${H5_ZLIB_INCLUDE_DIR_GEN} ${H5_ZLIB_INCLUDE_DIR}) endmacro () #------------------------------------------------------------------------------- @@ -70,11 +70,11 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) add_library (${HDF_PACKAGE_NAMESPACE}szaec-static ALIAS szaec-static) add_library (${HDF_PACKAGE_NAMESPACE}aec-static ALIAS aec-static) - set (SZIP_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}szaec-static;${HDF_PACKAGE_NAMESPACE}aec-static") - set (SZIP_LIBRARIES ${SZIP_STATIC_LIBRARY}) + set (H5_SZIP_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}szaec-static;${HDF_PACKAGE_NAMESPACE}aec-static") + set (H5_SZIP_LIBRARIES ${H5_SZIP_STATIC_LIBRARY}) - set (SZIP_INCLUDE_DIR_GEN "${szip_BINARY_DIR}") - set (SZIP_INCLUDE_DIR "${szip_SOURCE_DIR}/include") - set (SZIP_FOUND 1) - set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR_GEN} ${SZIP_INCLUDE_DIR}) + set (H5_SZIP_INCLUDE_DIR_GEN "${szip_BINARY_DIR}") + set (H5_SZIP_INCLUDE_DIR "${szip_SOURCE_DIR}/include") + set (H5_SZIP_FOUND 1) + set (H5_SZIP_INCLUDE_DIRS ${H5_SZIP_INCLUDE_DIR_GEN} ${H5_SZIP_INCLUDE_DIR}) endmacro () diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index 6a3526febf6..590be628211 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -113,6 +113,18 @@ set (BLOSC_ZLIB_TGZ_NAME "zlib-1.3.tar.gz" CACHE STRING "Use ZLib from compresse set (BLOSC_ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of BLOSC_ZLIB package" FORCE) +######## +# blosc2 +######## + +set (BLOSC2_GIT_URL "https://github.com/Blosc/c-blosc2.git" CACHE STRING "Use BLOSC2 from Github repository" FORCE) +set (BLOSC2_GIT_BRANCH "main" CACHE STRING "" FORCE) + +set (BLOSC2_TGZ_ORIGPATH "https://github.com/Blosc/c-blosc2/archive/refs/tags" CACHE STRING "Use PLUGINS from original location" FORCE) +set (BLOSC2_TGZ_NAME "c-blosc2-2.14.4.tar.gz" CACHE STRING "Use BLOSC2 from compressed file" FORCE) + +set (BLOSC2_PACKAGE_NAME "blosc2" CACHE STRING "Name of BLOSC2 package" FORCE) + ######## # bzip2 ######## diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index d208d65e888..33bdf10d7f8 100644 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -62,9 +62,9 @@ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRIN ### ext libs on system #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=NO") #set(ENV{ZLIB_ROOT} "some_location") -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib -DZLIB_INCLUDE_DIR:PATH=some_location/include") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DH5_ZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib -DH5_ZLIB_INCLUDE_DIR:PATH=some_location/include") #set(ENV{SZIP_ROOT} "some_location") -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib -DSZIP_INCLUDE_DIR:PATH=some_location/include") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DH5_SZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib -DH5_SZIP_INCLUDE_DIR:PATH=some_location/include") ### disable using ext zlib #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF") diff --git a/configure.ac b/configure.ac index 3486e80129a..4d64c5a4f52 100644 --- a/configure.ac +++ b/configure.ac @@ -4609,5 +4609,12 @@ if test "X$HDF_FORTRAN" = "Xyes"; then esac fi +## HDF5 configure code created by autotools with gcc 4.9.2 is adding problematic +## linker flags: -l with no library name; -l , specifically gfortran or m. +## This sed script corrects "-l " first and then "-l " with no library name. +## If the order is not preserved, all instances of "-l " will be removed. +sed -e '/^postdeps/ s/-l \([a-zA-Z]\)/-l\1/g' -e '/^postdeps/ s/-l //g' libtool > libtool.bak +mv -- libtool.bak libtool + ## show the configure settings cat src/libhdf5.settings diff --git a/doxygen/dox/IntroParHDF5.dox b/doxygen/dox/IntroParHDF5.dox index 414a186af89..884d9d254b2 100644 --- a/doxygen/dox/IntroParHDF5.dox +++ b/doxygen/dox/IntroParHDF5.dox @@ -23,8 +23,13 @@ Implementation requirements were to: \li Not have a reserved process, as this might interfere with parallel algorithms. \li Not spawn any processes, as this is not even commonly supported now. -The following shows the Parallel HDF5 implementation layers. +The following shows the Parallel HDF5 implementation layers: + + +
+\image html pimplayer.gif +
\subsection subsec_pintro_prog Parallel Programming with HDF5 This tutorial assumes that you are somewhat familiar with parallel programming with MPI (Message Passing Interface). diff --git a/doxygen/dox/VOLConnGuide.dox b/doxygen/dox/VOLConnGuide.dox index d1b78506fbe..190d1fb2048 100644 --- a/doxygen/dox/VOLConnGuide.dox +++ b/doxygen/dox/VOLConnGuide.dox @@ -306,6 +306,13 @@ it may be some time before that work is complete. \subsection subsecVOLPassthrough Passthrough Connectors Coming Soon +Note: +Passthrough VOL connectors should avoid doing anything with the file in the open and create +callbacks except opening it. If connectors need to do anything else they should use the post +open callback (H5VL_NATIVE_FILE_POST_OPEN op_type for the file "optional" callback), +making sure to perform operations on the file only after passing the post open call down to +the terminal connector. The post open callback is made for both file open and file create calls. + \subsection subsecVOLAsync Asynchronous Operations Coming Soon diff --git a/doxygen/img/pimplayer.gif b/doxygen/img/pimplayer.gif new file mode 100755 index 00000000000..7413b697ae6 Binary files /dev/null and b/doxygen/img/pimplayer.gif differ diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 1b23c94a976..855310879ef 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -406,7 +406,7 @@ if (BUILD_STATIC_LIBS) endif () if (BUILD_SHARED_LIBS) - if(WIN32) + if(MSVC) set(DLLDEF ${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def) else() set(DLLDEF "") diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index 8d8396fcbff..2fdf085f4b9 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -155,7 +155,7 @@ H5Iff.lo: $(srcdir)/H5Iff.F90 H5f90global.lo H5Lff.lo: $(srcdir)/H5Lff.F90 H5f90global.lo H5Off.lo: $(srcdir)/H5Off.F90 H5f90global.lo H5Pff.lo: $(srcdir)/H5Pff.F90 H5f90global.lo H5fortkit.lo -H5Rff.lo: $(srcdir)/H5Rff.F90 H5f90global.lo +H5Rff.lo: $(srcdir)/H5Rff.F90 H5f90global.lo H5fortkit.lo H5Sff.lo: $(srcdir)/H5Sff.F90 H5f90global.lo H5Tff.lo: $(srcdir)/H5Tff.F90 H5f90global.lo H5VLff.lo: $(srcdir)/H5VLff.F90 H5f90global.lo H5fortkit.lo diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index f225eb8f3b4..a9361ad5029 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -193,7 +193,7 @@ if (BUILD_STATIC_LIBS) add_dependencies(${HDF5_HL_F90_LIB_TARGET} H5HLgen) endif () if (BUILD_SHARED_LIBS) - if(WIN32) + if(MSVC) set(DLLDEF ${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def) else() set(DLLDEF "") diff --git a/java/lib/junit.jar b/java/lib/junit.jar index aaf74448492..6da55d8b852 100644 Binary files a/java/lib/junit.jar and b/java/lib/junit.jar differ diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 072edb4ff95..edae8d0848c 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -351,8 +351,6 @@ TESTING JUnit-TestH5 sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5.ext > JUnit-TestH5.out if diff JUnit-TestH5.out JUnit-TestH5.txt > /dev/null; then @@ -372,8 +370,6 @@ TESTING JUnit-TestH5Eparams sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Eparams.ext > JUnit-TestH5Eparams.out if diff JUnit-TestH5Eparams.out JUnit-TestH5Eparams.txt > /dev/null; then @@ -393,8 +389,6 @@ TESTING JUnit-TestH5Eregister sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Eregister.ext > JUnit-TestH5Eregister.out if diff JUnit-TestH5Eregister.out JUnit-TestH5Eregister.txt > /dev/null; then @@ -414,8 +408,6 @@ TESTING JUnit-TestH5Fparams sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Fparams.ext > JUnit-TestH5Fparams.out if diff JUnit-TestH5Fparams.out JUnit-TestH5Fparams.txt > /dev/null; then @@ -435,8 +427,6 @@ TESTING JUnit-TestH5Fbasic sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Fbasic.ext > JUnit-TestH5Fbasic.out if diff JUnit-TestH5Fbasic.out JUnit-TestH5Fbasic.txt > /dev/null; then @@ -456,8 +446,6 @@ TESTING JUnit-TestH5F sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5F.ext > JUnit-TestH5F.out if diff JUnit-TestH5F.out JUnit-TestH5F.txt > /dev/null; then @@ -477,8 +465,6 @@ TESTING JUnit-TestH5Fswmr sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Fswmr.ext > JUnit-TestH5Fswmr.out if diff JUnit-TestH5Fswmr.out JUnit-TestH5Fswmr.txt > /dev/null; then @@ -498,8 +484,6 @@ TESTING JUnit-TestH5Gbasic sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Gbasic.ext > JUnit-TestH5Gbasic.out if diff JUnit-TestH5Gbasic.out JUnit-TestH5Gbasic.txt > /dev/null; then @@ -519,8 +503,6 @@ TESTING JUnit-TestH5G sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5G.ext > JUnit-TestH5G.out if diff JUnit-TestH5G.out JUnit-TestH5G.txt > /dev/null; then @@ -540,8 +522,6 @@ TESTING JUnit-TestH5Sbasic sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Sbasic.ext > JUnit-TestH5Sbasic.out if diff JUnit-TestH5Sbasic.out JUnit-TestH5Sbasic.txt > /dev/null; then @@ -561,8 +541,6 @@ TESTING JUnit-TestH5S sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5S.ext > JUnit-TestH5S.out if diff JUnit-TestH5S.out JUnit-TestH5S.txt > /dev/null; then @@ -582,8 +560,6 @@ TESTING JUnit-TestH5Tparams sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Tparams.ext > JUnit-TestH5Tparams.out if diff JUnit-TestH5Tparams.out JUnit-TestH5Tparams.txt > /dev/null; then @@ -603,8 +579,6 @@ TESTING JUnit-TestH5Tbasic sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Tbasic.ext > JUnit-TestH5Tbasic.out if diff JUnit-TestH5Tbasic.out JUnit-TestH5Tbasic.txt > /dev/null; then @@ -624,8 +598,6 @@ TESTING JUnit-TestH5T sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5T.ext > JUnit-TestH5T.out if diff JUnit-TestH5T.out JUnit-TestH5T.txt > /dev/null; then @@ -645,8 +617,6 @@ TESTING JUnit-TestH5Dparams sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Dparams.ext > JUnit-TestH5Dparams.out if diff JUnit-TestH5Dparams.out JUnit-TestH5Dparams.txt > /dev/null; then @@ -666,8 +636,6 @@ TESTING JUnit-TestH5D sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5D.ext > JUnit-TestH5D.out if diff JUnit-TestH5D.out JUnit-TestH5D.txt > /dev/null; then @@ -687,8 +655,6 @@ TESTING JUnit-TestH5Drw sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Drw.ext > JUnit-TestH5Drw.out if diff JUnit-TestH5Drw.out JUnit-TestH5Drw.txt > /dev/null; then @@ -708,8 +674,6 @@ TESTING JUnit-TestH5Dplist sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Dplist.ext > JUnit-TestH5Dplist.out if diff JUnit-TestH5Dplist.out JUnit-TestH5Dplist.txt > /dev/null; then @@ -729,8 +693,6 @@ TESTING JUnit-TestH5Lparams sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Lparams.ext > JUnit-TestH5Lparams.out if diff JUnit-TestH5Lparams.out JUnit-TestH5Lparams.txt > /dev/null; then @@ -750,8 +712,6 @@ TESTING JUnit-TestH5Lbasic sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Lbasic.ext > JUnit-TestH5Lbasic.out if diff JUnit-TestH5Lbasic.out JUnit-TestH5Lbasic.txt > /dev/null; then @@ -771,8 +731,6 @@ TESTING JUnit-TestH5Lcreate sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Lcreate.ext > JUnit-TestH5Lcreate.out if diff JUnit-TestH5Lcreate.out JUnit-TestH5Lcreate.txt > /dev/null; then @@ -792,8 +750,6 @@ TESTING JUnit-TestH5R sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5R.ext > JUnit-TestH5R.out if diff JUnit-TestH5R.out JUnit-TestH5R.txt > /dev/null; then @@ -813,8 +769,6 @@ TESTING JUnit-TestH5Rref sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Rref.ext > JUnit-TestH5Rref.out if diff JUnit-TestH5Rref.out JUnit-TestH5Rref.txt > /dev/null; then @@ -834,8 +788,6 @@ TESTING JUnit-TestH5P sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5P.ext > JUnit-TestH5P.out if diff JUnit-TestH5P.out JUnit-TestH5P.txt > /dev/null; then @@ -855,8 +807,6 @@ TESTING JUnit-TestH5PData sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5PData.ext > JUnit-TestH5PData.out if diff JUnit-TestH5PData.out JUnit-TestH5PData.txt > /dev/null; then @@ -876,8 +826,6 @@ TESTING JUnit-TestH5Pfapl sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Pfapl.ext > JUnit-TestH5Pfapl.out if diff JUnit-TestH5Pfapl.out JUnit-TestH5Pfapl.txt > /dev/null; then @@ -897,8 +845,6 @@ TESTING JUnit-TestH5Pvirtual sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Pvirtual.ext > JUnit-TestH5Pvirtual.out if diff JUnit-TestH5Pvirtual.out JUnit-TestH5Pvirtual.txt > /dev/null; then @@ -918,8 +864,6 @@ TESTING JUnit-TestH5Plist sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Plist.ext > JUnit-TestH5Plist.out if diff JUnit-TestH5Plist.out JUnit-TestH5Plist.txt > /dev/null; then @@ -939,8 +883,6 @@ TESTING JUnit-TestH5A sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5A.ext > JUnit-TestH5A.out if diff JUnit-TestH5A.out JUnit-TestH5A.txt > /dev/null; then @@ -960,8 +902,6 @@ TESTING JUnit-TestH5Arw sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Arw.ext > JUnit-TestH5Arw.out if diff JUnit-TestH5Arw.out JUnit-TestH5Arw.txt > /dev/null; then @@ -981,8 +921,6 @@ TESTING JUnit-TestH5Oparams sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Oparams.ext > JUnit-TestH5Oparams.out if diff JUnit-TestH5Oparams.out JUnit-TestH5Oparams.txt > /dev/null; then @@ -1002,8 +940,6 @@ TESTING JUnit-TestH5Obasic sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Obasic.ext > JUnit-TestH5Obasic.out if diff JUnit-TestH5Obasic.out JUnit-TestH5Obasic.txt > /dev/null; then @@ -1023,8 +959,6 @@ TESTING JUnit-TestH5Ocreate sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Ocreate.ext > JUnit-TestH5Ocreate.out if diff JUnit-TestH5Ocreate.out JUnit-TestH5Ocreate.txt > /dev/null; then @@ -1044,8 +978,6 @@ TESTING JUnit-TestH5OcopyOld sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5OcopyOld.ext > JUnit-TestH5OcopyOld.out if diff JUnit-TestH5OcopyOld.out JUnit-TestH5OcopyOld.txt > /dev/null; then @@ -1065,8 +997,6 @@ TESTING JUnit-TestH5Ocopy sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Ocopy.ext > JUnit-TestH5Ocopy.out if diff JUnit-TestH5Ocopy.out JUnit-TestH5Ocopy.txt > /dev/null; then @@ -1086,8 +1016,6 @@ TESTING JUnit-TestH5PL sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5PL.ext > JUnit-TestH5PL.out if diff JUnit-TestH5PL.out JUnit-TestH5PL.txt > /dev/null; then @@ -1107,8 +1035,6 @@ TESTING JUnit-TestH5VL sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5VL.ext > JUnit-TestH5VL.out if diff JUnit-TestH5VL.out JUnit-TestH5VL.txt > /dev/null; then @@ -1128,8 +1054,6 @@ TESTING JUnit-TestH5Z sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Z.ext > JUnit-TestH5Z.out if diff JUnit-TestH5Z.out JUnit-TestH5Z.txt > /dev/null; then @@ -1149,8 +1073,6 @@ TESTING JUnit-TestH5E sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5E.ext > JUnit-TestH5E.out if diff JUnit-TestH5E.out JUnit-TestH5E.txt > /dev/null; then @@ -1170,8 +1092,6 @@ TESTING JUnit-TestH5Edefault sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Edefault.ext > JUnit-TestH5Edefault.out if diff JUnit-TestH5Edefault.out JUnit-TestH5Edefault.txt > /dev/null; then @@ -1192,8 +1112,6 @@ if test $USE_FILTER_SZIP = "yes"; then sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Giterate.ext > JUnit-TestH5Giterate.out if diff JUnit-TestH5Giterate.out JUnit-TestH5Giterate.txt > /dev/null; then @@ -1214,8 +1132,6 @@ if test "X$ROS3_VFD" = "Xyes"; then sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*\.,[0-9]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Pfapls3.ext > JUnit-TestH5Pfapls3.out if diff JUnit-TestH5Pfapls3.out JUnit-TestH5Pfapls3.txt > /dev/null; then @@ -1236,8 +1152,6 @@ if test "X$HAVE_LIBHDFS" = "Xyes"; then sed -e 's/ thread [0-9]*//' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*\.,[0-9]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5Pfaplhdfs.ext > JUnit-TestH5Pfaplhdfs.out if diff JUnit-TestH5Pfaplhdfs.out JUnit-TestH5Pfaplhdfs.txt > /dev/null; then diff --git a/java/test/testfiles/JUnit-TestH5.txt b/java/test/testfiles/JUnit-TestH5.txt index b282a9138c5..a8d3b963972 100644 --- a/java/test/testfiles/JUnit-TestH5.txt +++ b/java/test/testfiles/JUnit-TestH5.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5get_libversion_null_param .testJ2C .testIsSerializable diff --git a/java/test/testfiles/JUnit-TestH5A.txt b/java/test/testfiles/JUnit-TestH5A.txt index f31c86c6f4a..9661285eca1 100644 --- a/java/test/testfiles/JUnit-TestH5A.txt +++ b/java/test/testfiles/JUnit-TestH5A.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Acreate2_nullname .testH5Acreate_by_name .testH5Aget_name_by_idx diff --git a/java/test/testfiles/JUnit-TestH5Arw.txt b/java/test/testfiles/JUnit-TestH5Arw.txt index 49d3b1c3db4..7f3904222de 100644 --- a/java/test/testfiles/JUnit-TestH5Arw.txt +++ b/java/test/testfiles/JUnit-TestH5Arw.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Aread_128bit_floats .testH5Aread_64bit_floats .testH5Aread_8bit_ints diff --git a/java/test/testfiles/JUnit-TestH5D.txt b/java/test/testfiles/JUnit-TestH5D.txt index 4c306213450..1651176c1ee 100644 --- a/java/test/testfiles/JUnit-TestH5D.txt +++ b/java/test/testfiles/JUnit-TestH5D.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5DArrayenum_rw .testH5DVLwrVL .testH5Dget_storage_size diff --git a/java/test/testfiles/JUnit-TestH5Dparams.txt b/java/test/testfiles/JUnit-TestH5Dparams.txt index 9acedd7e19a..127c9ea29d9 100644 --- a/java/test/testfiles/JUnit-TestH5Dparams.txt +++ b/java/test/testfiles/JUnit-TestH5Dparams.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Dget_space_status_invalid .testH5Dget_access_plist_invalid .testH5Dget_type_invalid diff --git a/java/test/testfiles/JUnit-TestH5Dplist.txt b/java/test/testfiles/JUnit-TestH5Dplist.txt index 64e924a9860..5f0f15b2e66 100644 --- a/java/test/testfiles/JUnit-TestH5Dplist.txt +++ b/java/test/testfiles/JUnit-TestH5Dplist.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5P_dset_no_attrs_hint .testH5Dset_extent diff --git a/java/test/testfiles/JUnit-TestH5Drw.txt b/java/test/testfiles/JUnit-TestH5Drw.txt index 6b854cf3570..4453bbde866 100644 --- a/java/test/testfiles/JUnit-TestH5Drw.txt +++ b/java/test/testfiles/JUnit-TestH5Drw.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Dread_32bit_floats .testH5Dread_32bit_ints .testH5Dread_64bit_ints diff --git a/java/test/testfiles/JUnit-TestH5E.txt b/java/test/testfiles/JUnit-TestH5E.txt index 8c5e5e41606..172c6d79957 100644 --- a/java/test/testfiles/JUnit-TestH5E.txt +++ b/java/test/testfiles/JUnit-TestH5E.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Eget_msg_major .testH5Eget_msg_minor .testH5Epush diff --git a/java/test/testfiles/JUnit-TestH5Edefault.txt b/java/test/testfiles/JUnit-TestH5Edefault.txt index bb43c643e8a..04e724aa83c 100644 --- a/java/test/testfiles/JUnit-TestH5Edefault.txt +++ b/java/test/testfiles/JUnit-TestH5Edefault.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Eset_current_stack_invalid_stkid .testH5Eset_current_stack .testH5Eget_num diff --git a/java/test/testfiles/JUnit-TestH5Eparams.txt b/java/test/testfiles/JUnit-TestH5Eparams.txt index 92f80685560..08a24667030 100644 --- a/java/test/testfiles/JUnit-TestH5Eparams.txt +++ b/java/test/testfiles/JUnit-TestH5Eparams.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5EprintInt .testH5Eget_msg .testH5Eget_num diff --git a/java/test/testfiles/JUnit-TestH5Eregister.txt b/java/test/testfiles/JUnit-TestH5Eregister.txt index 132e123b700..223104ffd89 100644 --- a/java/test/testfiles/JUnit-TestH5Eregister.txt +++ b/java/test/testfiles/JUnit-TestH5Eregister.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Eregister_class_lib_name_null .testH5Eregister_class_version_null .testH5Eunregister_class_invalid_classid diff --git a/java/test/testfiles/JUnit-TestH5F.txt b/java/test/testfiles/JUnit-TestH5F.txt index f79ac40ee1d..d408fa18a8d 100644 --- a/java/test/testfiles/JUnit-TestH5F.txt +++ b/java/test/testfiles/JUnit-TestH5F.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Fget_access_plist .testH5Fget_fileno_diff .testH5Fget_fileno_same diff --git a/java/test/testfiles/JUnit-TestH5Fbasic.txt b/java/test/testfiles/JUnit-TestH5Fbasic.txt index cd4e2826f92..7626c1415af 100644 --- a/java/test/testfiles/JUnit-TestH5Fbasic.txt +++ b/java/test/testfiles/JUnit-TestH5Fbasic.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Fget_mdc_size .testH5Fget_mdc_hit_rate .testH5F_dset_no_attrs_hint diff --git a/java/test/testfiles/JUnit-TestH5Fparams.txt b/java/test/testfiles/JUnit-TestH5Fparams.txt index 91a843517b7..b7ce871ce63 100644 --- a/java/test/testfiles/JUnit-TestH5Fparams.txt +++ b/java/test/testfiles/JUnit-TestH5Fparams.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Fis_accessible_null .testH5Fcreate_null .testH5Fflush_local diff --git a/java/test/testfiles/JUnit-TestH5Fswmr.txt b/java/test/testfiles/JUnit-TestH5Fswmr.txt index f943892de53..14a301e3a1b 100644 --- a/java/test/testfiles/JUnit-TestH5Fswmr.txt +++ b/java/test/testfiles/JUnit-TestH5Fswmr.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Fstart_swmr_write .testH5Fswmr_read_attempts diff --git a/java/test/testfiles/JUnit-TestH5G.txt b/java/test/testfiles/JUnit-TestH5G.txt index cbcea1d7ac3..331b7755354 100644 --- a/java/test/testfiles/JUnit-TestH5G.txt +++ b/java/test/testfiles/JUnit-TestH5G.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Gget_info_by_name .testH5Gget_create_plist .testH5Gopen diff --git a/java/test/testfiles/JUnit-TestH5Gbasic.txt b/java/test/testfiles/JUnit-TestH5Gbasic.txt index 35216965b5b..b2dff333ca5 100644 --- a/java/test/testfiles/JUnit-TestH5Gbasic.txt +++ b/java/test/testfiles/JUnit-TestH5Gbasic.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Gget_info_by_name_not_exists .testH5Gget_info_by_idx_not_exists .testH5Gget_info_by_name diff --git a/java/test/testfiles/JUnit-TestH5Giterate.txt b/java/test/testfiles/JUnit-TestH5Giterate.txt index 38402afcbf1..057a023b348 100644 --- a/java/test/testfiles/JUnit-TestH5Giterate.txt +++ b/java/test/testfiles/JUnit-TestH5Giterate.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Gget_obj_info_all Time: XXXX diff --git a/java/test/testfiles/JUnit-TestH5Lbasic.txt b/java/test/testfiles/JUnit-TestH5Lbasic.txt index b9b580c2fb9..50419b942a3 100644 --- a/java/test/testfiles/JUnit-TestH5Lbasic.txt +++ b/java/test/testfiles/JUnit-TestH5Lbasic.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Lget_info_by_idx_not_exist_name .testH5Lget_name_by_idx_not_exist .testH5Lvisit diff --git a/java/test/testfiles/JUnit-TestH5Lcreate.txt b/java/test/testfiles/JUnit-TestH5Lcreate.txt index cbd5d36c88c..aac49fb4177 100644 --- a/java/test/testfiles/JUnit-TestH5Lcreate.txt +++ b/java/test/testfiles/JUnit-TestH5Lcreate.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Lget_info_by_idx_n0_create .testH5Ldelete_soft_link_dangle .testH5Lget_value_by_idx_external_create diff --git a/java/test/testfiles/JUnit-TestH5Lparams.txt b/java/test/testfiles/JUnit-TestH5Lparams.txt index a22741c360a..33b2161b621 100644 --- a/java/test/testfiles/JUnit-TestH5Lparams.txt +++ b/java/test/testfiles/JUnit-TestH5Lparams.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Lcopy_invalid .testH5Lget_value_by_idx_null .testH5Lcreate_external_invalid diff --git a/java/test/testfiles/JUnit-TestH5Obasic.txt b/java/test/testfiles/JUnit-TestH5Obasic.txt index c39c01d4937..6aaa4b45e3a 100644 --- a/java/test/testfiles/JUnit-TestH5Obasic.txt +++ b/java/test/testfiles/JUnit-TestH5Obasic.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Oexists_by_name .testH5Oget_native_info_dataset .testH5Oopen_by_token diff --git a/java/test/testfiles/JUnit-TestH5Ocopy.txt b/java/test/testfiles/JUnit-TestH5Ocopy.txt index 7f66410e109..a070bbcb979 100644 --- a/java/test/testfiles/JUnit-TestH5Ocopy.txt +++ b/java/test/testfiles/JUnit-TestH5Ocopy.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5OcopyRefsDatasettosameFile .testH5OcopyNullRef .testH5OcopyRefsDatasettodiffFile diff --git a/java/test/testfiles/JUnit-TestH5OcopyOld.txt b/java/test/testfiles/JUnit-TestH5OcopyOld.txt index 7f66410e109..a070bbcb979 100644 --- a/java/test/testfiles/JUnit-TestH5OcopyOld.txt +++ b/java/test/testfiles/JUnit-TestH5OcopyOld.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5OcopyRefsDatasettosameFile .testH5OcopyNullRef .testH5OcopyRefsDatasettodiffFile diff --git a/java/test/testfiles/JUnit-TestH5Ocreate.txt b/java/test/testfiles/JUnit-TestH5Ocreate.txt index 5bc9e077222..ad1a31f8da5 100644 --- a/java/test/testfiles/JUnit-TestH5Ocreate.txt +++ b/java/test/testfiles/JUnit-TestH5Ocreate.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Oget_info_by_idx_n0_create .testH5Oget_info_softlink_dangle .testH5Oget_info_softlink diff --git a/java/test/testfiles/JUnit-TestH5Oparams.txt b/java/test/testfiles/JUnit-TestH5Oparams.txt index b756bcf784c..1a6533f8275 100644 --- a/java/test/testfiles/JUnit-TestH5Oparams.txt +++ b/java/test/testfiles/JUnit-TestH5Oparams.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Oget_comment_by_name_null .testH5Oget_native_info_by_name_invalid .testH5Ovisit_by_name_nullname diff --git a/java/test/testfiles/JUnit-TestH5P.txt b/java/test/testfiles/JUnit-TestH5P.txt index 01acadd200f..429a83a8bbb 100644 --- a/java/test/testfiles/JUnit-TestH5P.txt +++ b/java/test/testfiles/JUnit-TestH5P.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Pset_nbit .testH5Pset_shared_mesg_index_InvalidFlag .testH5Pset_shared_mesg_phase_change diff --git a/java/test/testfiles/JUnit-TestH5PData.txt b/java/test/testfiles/JUnit-TestH5PData.txt index 6356d69997c..5ae27f26a6f 100644 --- a/java/test/testfiles/JUnit-TestH5PData.txt +++ b/java/test/testfiles/JUnit-TestH5PData.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5P_buffer .testH5Pdata_transform diff --git a/java/test/testfiles/JUnit-TestH5PL.txt b/java/test/testfiles/JUnit-TestH5PL.txt index fb78bb534ec..fa848300f9e 100644 --- a/java/test/testfiles/JUnit-TestH5PL.txt +++ b/java/test/testfiles/JUnit-TestH5PL.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .TestH5PLplugins .TestH5PLpaths diff --git a/java/test/testfiles/JUnit-TestH5Pfapl.txt b/java/test/testfiles/JUnit-TestH5Pfapl.txt index c34ac1c28de..d48e89f19ea 100644 --- a/java/test/testfiles/JUnit-TestH5Pfapl.txt +++ b/java/test/testfiles/JUnit-TestH5Pfapl.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5P_elink_fapl .testH5P_fapl_direct .testH5P_alignment diff --git a/java/test/testfiles/JUnit-TestH5Pfaplhdfs.txt b/java/test/testfiles/JUnit-TestH5Pfaplhdfs.txt index 47a00a4eb92..7c66937697f 100644 --- a/java/test/testfiles/JUnit-TestH5Pfaplhdfs.txt +++ b/java/test/testfiles/JUnit-TestH5Pfaplhdfs.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Pget_fapl_hdfs_invalid_fapl_id .testH5Pget_fapl_hdfs_fapl_id_of_wrong_driver_type .testHDFS_fapl diff --git a/java/test/testfiles/JUnit-TestH5Pfapls3.txt b/java/test/testfiles/JUnit-TestH5Pfapls3.txt index 3f46342cca4..232ff961a6d 100644 --- a/java/test/testfiles/JUnit-TestH5Pfapls3.txt +++ b/java/test/testfiles/JUnit-TestH5Pfapls3.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Pset_fapl_ros3_specified .testH5Pset_fapl_ros3 .testH5Pget_fapl_ros3_invalid_fapl_id diff --git a/java/test/testfiles/JUnit-TestH5Plist.txt b/java/test/testfiles/JUnit-TestH5Plist.txt index ed9843a9a2e..037615a86f7 100644 --- a/java/test/testfiles/JUnit-TestH5Plist.txt +++ b/java/test/testfiles/JUnit-TestH5Plist.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5P_genprop_basic_class .testH5P_genprop_class_iter .testH5P_genprop_basic_class_prop diff --git a/java/test/testfiles/JUnit-TestH5Pvirtual.txt b/java/test/testfiles/JUnit-TestH5Pvirtual.txt index e57f6832d8b..1c90ecf5517 100644 --- a/java/test/testfiles/JUnit-TestH5Pvirtual.txt +++ b/java/test/testfiles/JUnit-TestH5Pvirtual.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Pget_source_datasetname .testH5Pvirtual_storage .testH5Pget_selection_source_dataset diff --git a/java/test/testfiles/JUnit-TestH5R.txt b/java/test/testfiles/JUnit-TestH5R.txt index 2420d62cd96..728adfa692b 100644 --- a/java/test/testfiles/JUnit-TestH5R.txt +++ b/java/test/testfiles/JUnit-TestH5R.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Ropen_attr_Nullref .testH5Rget_attr_name_Nullref .testH5Ropen_region_Nullref diff --git a/java/test/testfiles/JUnit-TestH5Rref.txt b/java/test/testfiles/JUnit-TestH5Rref.txt index 05019c03561..7695c9231af 100644 --- a/java/test/testfiles/JUnit-TestH5Rref.txt +++ b/java/test/testfiles/JUnit-TestH5Rref.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Rget_region_dataset .testH5Rget_object .testH5Rget_region_attribute diff --git a/java/test/testfiles/JUnit-TestH5S.txt b/java/test/testfiles/JUnit-TestH5S.txt index 6bde487845b..2a177179a05 100644 --- a/java/test/testfiles/JUnit-TestH5S.txt +++ b/java/test/testfiles/JUnit-TestH5S.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Sget_select_npoints .testH5Sget_select_type .testH5Sset_extent_simple diff --git a/java/test/testfiles/JUnit-TestH5Sbasic.txt b/java/test/testfiles/JUnit-TestH5Sbasic.txt index 34224429f3f..459f2b1accd 100644 --- a/java/test/testfiles/JUnit-TestH5Sbasic.txt +++ b/java/test/testfiles/JUnit-TestH5Sbasic.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Sclose_invalid .testH5Screate_simple_max_default .testH5Screate_simple_dims_null diff --git a/java/test/testfiles/JUnit-TestH5T.txt b/java/test/testfiles/JUnit-TestH5T.txt index 446adcb63bd..06e7a9cbb5b 100644 --- a/java/test/testfiles/JUnit-TestH5T.txt +++ b/java/test/testfiles/JUnit-TestH5T.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Tvlen_create .testH5Tenum_create_functions .testH5Tenum_functions diff --git a/java/test/testfiles/JUnit-TestH5Tbasic.txt b/java/test/testfiles/JUnit-TestH5Tbasic.txt index 131c4f58677..9023a4f702e 100644 --- a/java/test/testfiles/JUnit-TestH5Tbasic.txt +++ b/java/test/testfiles/JUnit-TestH5Tbasic.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Tequal_not .testH5Tcopy .testH5Tequal diff --git a/java/test/testfiles/JUnit-TestH5Tparams.txt b/java/test/testfiles/JUnit-TestH5Tparams.txt index 9f725ac0386..fba219dd235 100644 --- a/java/test/testfiles/JUnit-TestH5Tparams.txt +++ b/java/test/testfiles/JUnit-TestH5Tparams.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Tget_member_type_invalid .testH5Treclaim_invalid .testH5Tenum_insert_null diff --git a/java/test/testfiles/JUnit-TestH5VL.txt b/java/test/testfiles/JUnit-TestH5VL.txt index ff949693535..7e05fd79e0a 100644 --- a/java/test/testfiles/JUnit-TestH5VL.txt +++ b/java/test/testfiles/JUnit-TestH5VL.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5VLget_connector_id_by_name .testH5VLget_connector_id_by_value .testH5VLget_connector_id diff --git a/java/test/testfiles/JUnit-TestH5Z.txt b/java/test/testfiles/JUnit-TestH5Z.txt index 63fc2277f42..c299507145e 100644 --- a/java/test/testfiles/JUnit-TestH5Z.txt +++ b/java/test/testfiles/JUnit-TestH5Z.txt @@ -1,4 +1,4 @@ -JUnit version 4.11 +JUnit version 4.13.2 .testH5Zfilter_avail .testH5Zunregister_predefined .testH5Zget_filter_info diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index d36e80e1027..553030f6cba 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -283,11 +283,11 @@ IV. Further considerations A. Download the binary packages and install them in a central location. For example on Windows, create a folder extlibs and install the packages there. Add the following CMake options: - -DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib - -DZLIB_INCLUDE_DIR:PATH=some_location/include + -DH5_ZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib + -DH5_ZLIB_INCLUDE_DIR:PATH=some_location/include -DZLIB_USE_EXTERNAL:BOOL=OFF - -DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib - -DSZIP_INCLUDE_DIR:PATH=some_location/include + -DH5_SZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib + -DH5_SZIP_INCLUDE_DIR:PATH=some_location/include -DSZIP_USE_EXTERNAL:BOOL=OFF where "some_location" is the full path to the extlibs folder. Also the appropriate environment variable must be set; @@ -499,10 +499,10 @@ These five steps are described in detail below. * Visual Studio 17 2022 is: - * SZIP_INCLUDE_DIR:PATH= - * SZIP_LIBRARY:FILEPATH= - * ZLIB_INCLUDE_DIR:PATH= - * ZLIB_LIBRARY:FILEPATH= + * H5_SZIP_INCLUDE_DIR:PATH= + * H5_SZIP_LIBRARY:FILEPATH= + * H5_ZLIB_INCLUDE_DIR:PATH= + * H5_ZLIB_LIBRARY:FILEPATH= * :BOOL=[ON | OFF] is: @@ -574,6 +574,14 @@ These five steps are described in detail below. set (BLOSC_ZLIB_TGZ_NAME "zlib-1.3.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE) set (BLOSC_ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of BLOSC_ZLIB package" FORCE) ######## + # blosc2 + ######## + set (BLOSC2_GIT_URL "https://github.com/Blosc/c-blosc2.git" CACHE STRING "Use BLOSC2 from Github repository" FORCE) + set (BLOSC2_GIT_BRANCH "main" CACHE STRING "" FORCE) + set (BLOSC2_TGZ_ORIGPATH "https://github.com/Blosc/c-blosc2/archive/refs/tags" CACHE STRING "Use PLUGINS from original location" FORCE) + set (BLOSC2_TGZ_NAME "c-blosc2-2.14.4.tar.gz" CACHE STRING "Use BLOSC2 from compressed file" FORCE) + set (BLOSC2_PACKAGE_NAME "blosc2" CACHE STRING "Name of BLOSC2 package" FORCE) + ######## # bzip2 ######## set (BZ2_GIT_URL "https://github.com/libarchive/bzip2.git" CACHE STRING "Use BZ2 from GitHub repository" FORCE) @@ -918,19 +926,19 @@ HDF5_ENABLE_PLUGIN_SUPPORT "Enable PLUGIN Filters" OFF HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF HDF5_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" ON -ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" OFF +ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB else search" OFF ZLIB_TGZ_ORIGPATH "Use ZLIB from original location" "https://github.com/madler/zlib/releases/download/v1.2.13" ZLIB_TGZ_NAME "Use ZLIB from original compressed file" "zlib-1.2.13.tar.gz" ZLIB_USE_LOCALCONTENT "Use local file for ZLIB FetchContent" ON -SZIP_USE_EXTERNAL "Use External Library Building for SZIP" OFF +SZIP_USE_EXTERNAL "Use External Library Building for SZIP else search" OFF if (HDF5_ENABLE_SZIP_SUPPORT) HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" ON LIBAEC_TGZ_ORIGPATH "Use LIBAEC from original location" "https://github.com/MathisRosenhauer/libaec/releases/download/v1.0.6" LIBAEC_TGZ_NAME "Use LIBAEC from original compressed file" "libaec-1.0.6.tar.gz" LIBAEC_USE_LOCALCONTENT "Use local file for LIBAEC FetchContent" ON -PLUGIN_USE_EXTERNAL "Use External Library Building for PLUGINS" OFF +PLUGIN_USE_EXTERNAL "Use External Library Building for PLUGINS else search" OFF if (WINDOWS) H5_DEFAULT_PLUGINDIR "%ALLUSERSPROFILE%/hdf5/lib/plugin" else () diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 0108f235722..c0237ab9e85 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -502,6 +502,23 @@ Bug Fixes since HDF5-1.14.4 release =================================== Library ------- + - Fixed a leak of datatype IDs created internally during datatype conversion + + Fixed an issue where the library could leak IDs that it creates internally + for compound datatype members during datatype conversion. When the library's + table of datatype conversion functions is modified (such as when a new + conversion function is registered with the library from within an application), + the compound datatype conversion function has to recalculate data that it + has cached. When recalculating that data, the library was registering new + IDs for each of the members of the source and destination compound datatypes + involved in the conversion process and was overwriting the old cached IDs + without first closing them. This would result in use-after-free issues due + to multiple IDs pointing to the same internal H5T_t structure, as well as + crashes due to the library not gracefully handling partially initialized or + partially freed datatypes on library termination. + + Fixes h5py GitHub #2419 + - Fixed function H5Requal actually to compare the reference pointers Fixed an issue with H5Requal always returning true because the @@ -1019,6 +1036,22 @@ Bug Fixes since HDF5-1.14.4 release Configuration ------------- + - Fixed/reverted an Autotools configure hack that causes problems on MacOS + + A sed line in configure.ac was added in the past to paper over some + problems with older versions of the Autotools that would add incorrect + linker flags. This used the -i option in a way that caused silent + errors on MacOS that did not break the build. + + The original fix for this problem (in 1.14.4) removed the sed line + entirely, but it turns out that the sed cleanup is still necessary + on some systems, where empty -l options will be added to the libtool + script. + + This sed line has been restored and reworked to not use -i. + + Fixes GitHub issues #3843 and #4448 + - Fixed a list index out of range issue in the runTest.cmake file Fixed an issue in config/cmake/runTest.cmake where the CMake logic @@ -1046,16 +1079,6 @@ Bug Fixes since HDF5-1.14.4 release * HDF5_ENABLE_DOXY_WARNINGS: ON/OFF (Default: OFF) * --enable-doxygen-errors: enable/disable (Default: disable) - - Removed an Autotools configure hack that causes problems on MacOS - - A sed line in configure.ac was added in the past to paper over some - problems with older versions of the Autotools that would add incorrect - linker flags. This hack is not needed with recent versions of the - Autotools and the sed line errors on MacOS (though this was a silent - error that didn't break the build) so the hack has been removed. - - Fixes GitHub issue #3843 - - Fixed an issue where the h5tools_test_utils test program was being installed on the system for Autotools builds of HDF5 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8ff62e8c9f9..f1b77ec1da8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -870,6 +870,8 @@ set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5Edefin.h ${HDF5_SRC_DIR}/H5Einit.h + ${HDF5_SRC_DIR}/H5Emajdef.h + ${HDF5_SRC_DIR}/H5Emindef.h ${HDF5_SRC_DIR}/H5Epkg.h ${HDF5_SRC_DIR}/H5Eprivate.h ${HDF5_SRC_DIR}/H5Eterm.h diff --git a/src/H5Adense.c b/src/H5Adense.c index 48004d2aa70..52a6244d7be 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -839,6 +839,7 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name, cons htri_t attr_sharable; /* Flag indicating attributes are shareable */ htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */ bool attr_exists; /* Attribute exists in v2 B-tree */ + H5O_ainfo_t tainfo = *ainfo; /* Copy of ainfo */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -977,8 +978,12 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name, cons else if (shared_mesg < 0) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "error determining if message should be shared"); - /* Delete old attribute from dense storage */ - if (H5A__dense_remove(f, ainfo, old_name) < 0) + /* Deactivate the field so that H5A__dense_remove() won't delete the new renamed attribute + that was just added to the creation order index v2 B-tree via H5A__dense_insert() */ + tainfo.corder_bt2_addr = HADDR_UNDEF; + + /* Only delete the old attribute (before rename) from the name index v2 B-tree */ + if (H5A__dense_remove(f, (const H5O_ainfo_t *)&tainfo, old_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute in dense storage"); done: diff --git a/src/H5Apublic.h b/src/H5Apublic.h index 7960efd546b..256d19cf355 100644 --- a/src/H5Apublic.h +++ b/src/H5Apublic.h @@ -115,7 +115,7 @@ H5_DLL herr_t H5Aclose_async(hid_t attr_id, hid_t es_id); * \acpl_id * \aapl_id * - * \return \hid_tv{attribute} + * \return \hid_ti{attribute} * * \details H5Acreate2() creates an attribute, \p attr_name, which is attached * to the object specified by the identifier \p loc_id. @@ -173,7 +173,7 @@ H5_DLL hid_t H5Acreate_async(hid_t loc_id, const char *attr_name, hid_t type_id * \aapl_id * \lapl_id * - * \return \hid_tv{attribute} + * \return \hid_ti{attribute} * * \details H5Acreate_by_name() creates an attribute, \p attr_name, which is * attached to the object specified by \p loc_id and \p obj_name. @@ -389,7 +389,7 @@ H5_DLL herr_t H5Aexists_by_name_async(hid_t loc_id, const char *obj_name, const * * \attr_id * - * \return \hid_tv{attribute's creation property list} + * \return \hid_ti{attribute's creation property list} * * \details H5Aget_create_plist() returns an identifier for the attribute * creation property list associated with the attribute specified @@ -567,7 +567,7 @@ H5_DLL ssize_t H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t * * \attr_id * - * \return \hid_tv{attribute dataspace} + * \return \hid_ti{attribute dataspace} * * \details H5Aget_space() retrieves a copy of the dataspace for an * attribute. The dataspace identifier returned from this @@ -747,7 +747,7 @@ H5_DLL herr_t H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t * \param[in] attr_name Name of attribute to open * \aapl_id * - * \return \hid_tv{attribute} + * \return \hid_ti{attribute} * * \details H5Aopen() opens an existing attribute, \p attr_name, that is * attached to the object specified by an object identifier, \p obj_id. @@ -795,7 +795,7 @@ H5_DLL hid_t H5Aopen_async(hid_t obj_id, const char *attr_name, hid_t aapl_id, * \aapl_id * \lapl_id * - * \return \hid_tv{attribute} + * \return \hid_ti{attribute} * * \details H5Aopen_by_idx() opens an existing attribute that is attached * to an object specified by location and name, \p loc_id and @@ -850,7 +850,7 @@ H5_DLL hid_t H5Aopen_by_idx_async(hid_t loc_id, const char *obj_name, H5_index_ * \aapl_id * \lapl_id * - * \return \hid_tv{attribute} + * \return \hid_ti{attribute} * * \details H5Aopen_by_name() opens an existing attribute, \p attr_name, * that is attached to an object specified by location and name, @@ -1128,7 +1128,7 @@ typedef herr_t (*H5A_operator1_t)(hid_t location_id /*in*/, const char *attr_nam * \space_id * \acpl_id * - * \return \hid_tv{attribute} + * \return \hid_ti{attribute} * * \deprecation_note{H5Acreate2()} * @@ -1215,7 +1215,7 @@ H5_DLL herr_t H5Aiterate1(hid_t loc_id, unsigned *idx, H5A_operator1_t op, void * \loc_id * \param[in] idx Index of the attribute to open * - * \return \hid_tv{attribute} + * \return \hid_ti{attribute} * * \deprecation_note{H5Aopen_by_idx()} * @@ -1241,7 +1241,7 @@ H5_DLL hid_t H5Aopen_idx(hid_t loc_id, unsigned idx); * \loc_id * \param[in] name Attribute name * - * \return \hid_tv{attribute} + * \return \hid_ti{attribute} * * \deprecation_note{H5Aopen_by_name()} * diff --git a/src/H5D.c b/src/H5D.c index d15c4fa2dcd..d014d27cacb 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -2137,7 +2137,7 @@ H5Dformat_convert(hid_t dset_id) /* Convert the dataset */ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_INTERNAL, FAIL, "can't convert dataset format"); + HGOTO_ERROR(H5E_DATASET, H5E_CANTUPDATE, FAIL, "can't convert dataset format"); done: FUNC_LEAVE_API(ret_value) @@ -2442,7 +2442,7 @@ H5Dchunk_iter(hid_t dset_id, hid_t dxpl_id, H5D_chunk_iter_op_t op, void *op_dat /* Iterate over the chunks */ if ((ret_value = H5VL_dataset_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL)) < 0) - HERROR(H5E_BADITER, H5E_BADITER, "error iterating over dataset chunks"); + HERROR(H5E_DATASET, H5E_BADITER, "error iterating over dataset chunks"); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Dint.c b/src/H5Dint.c index 71ddda387c7..66340c8fa54 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1495,7 +1495,7 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id) /* Check if dataset was already open */ if (NULL == (shared_fo = (H5D_shared_t *)H5FO_opened(dataset->oloc.file, dataset->oloc.addr))) { /* Clear any errors from H5FO_opened() */ - H5E_clear_stack(NULL); + H5E_clear_stack(); /* Open the dataset object */ if (H5D__open_oid(dataset, dapl_id) < 0) diff --git a/src/H5Dmodule.h b/src/H5Dmodule.h index 27e5799968e..e791f7cf00e 100644 --- a/src/H5Dmodule.h +++ b/src/H5Dmodule.h @@ -2737,6 +2737,7 @@ allocated if necessary. * * * + * * * * diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index d6ab1a8836c..11874878fd7 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -884,7 +884,7 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_ent_t *vir src_file_open = true; else /* Reset the error stack */ - H5E_clear_stack(NULL); + H5E_clear_stack(); } /* end if */ else /* Source file is ".", use the virtual dataset's file */ @@ -906,7 +906,7 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_ent_t *vir /* Dataset does not exist */ if (NULL == source_dset->dset) { /* Reset the error stack */ - H5E_clear_stack(NULL); + H5E_clear_stack(); source_dset->dset_exists = false; } /* end if */ diff --git a/src/H5E.c b/src/H5E.c index 4f2edd78ebf..0eb256f4ad4 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -57,10 +57,6 @@ /* Local Macros */ /****************/ -/* HDF5 error class */ -#define H5E_CLS_NAME "HDF5" -#define H5E_CLS_LIB_NAME "HDF5" - /******************/ /* Local Typedefs */ /******************/ @@ -72,30 +68,13 @@ /********************/ /* Local Prototypes */ /********************/ -/* Static function declarations */ -static herr_t H5E__set_default_auto(H5E_t *stk); -static H5E_cls_t *H5E__register_class(const char *cls_name, const char *lib_name, const char *version); -static herr_t H5E__unregister_class(H5E_cls_t *cls, void **request); -static ssize_t H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size); -static int H5E__close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata); -static herr_t H5E__close_msg(H5E_msg_t *err, void **request); -static H5E_msg_t *H5E__create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg); -static H5E_t *H5E__get_current_stack(void); -static herr_t H5E__set_current_stack(H5E_t *estack); -static herr_t H5E__close_stack(H5E_t *err_stack, void **request); -static ssize_t H5E__get_num(const H5E_t *err_stack); -static herr_t H5E__print2(hid_t err_stack, FILE *stream); -static herr_t H5E__append_stack(H5E_t *dst_estack, const H5E_t *src_stack); /*********************/ /* Package Variables */ /*********************/ -/* First & last major and minor error codes registered by the library */ -hid_t H5E_first_maj_id_g = H5I_INVALID_HID; -hid_t H5E_last_maj_id_g = H5I_INVALID_HID; -hid_t H5E_first_min_id_g = H5I_INVALID_HID; -hid_t H5E_last_min_id_g = H5I_INVALID_HID; +/* Declare extern the free list to manage the H5E_stack_t struct */ +H5FL_EXTERN(H5E_stack_t); /*****************************/ /* Library Private Variables */ @@ -105,280 +84,6 @@ hid_t H5E_last_min_id_g = H5I_INVALID_HID; /* Local Variables */ /*******************/ -/* Declare a free list to manage the H5E_t struct */ -H5FL_DEFINE_STATIC(H5E_t); - -/* Declare a free list to manage the H5E_cls_t struct */ -H5FL_DEFINE_STATIC(H5E_cls_t); - -/* Declare a free list to manage the H5E_msg_t struct */ -H5FL_DEFINE_STATIC(H5E_msg_t); - -/* Error class ID class */ -static const H5I_class_t H5I_ERRCLS_CLS[1] = {{ - H5I_ERROR_CLASS, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ - (H5I_free_t)H5E__unregister_class /* Callback routine for closing objects of this class */ -}}; - -/* Error message ID class */ -static const H5I_class_t H5I_ERRMSG_CLS[1] = {{ - H5I_ERROR_MSG, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ - (H5I_free_t)H5E__close_msg /* Callback routine for closing objects of this class */ -}}; - -/* Error stack ID class */ -static const H5I_class_t H5I_ERRSTK_CLS[1] = {{ - H5I_ERROR_STACK, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ - (H5I_free_t)H5E__close_stack /* Callback routine for closing objects of this class */ -}}; - -/*------------------------------------------------------------------------- - * Function: H5E_init - * - * Purpose: Initialize the interface from some other layer. - * - * Return: Success: non-negative - * Failure: negative - *------------------------------------------------------------------------- - */ -herr_t -H5E_init(void) -{ - H5E_cls_t *cls; /* Pointer to error class */ - H5E_msg_t *msg; /* Pointer to new error message */ - char lib_vers[128]; /* Buffer to constructu library version within */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Initialize the ID group for the error class IDs */ - if (H5I_register_type(H5I_ERRCLS_CLS) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group"); - - /* Initialize the ID group for the major error IDs */ - if (H5I_register_type(H5I_ERRMSG_CLS) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group"); - - /* Initialize the ID group for the error stacks */ - if (H5I_register_type(H5I_ERRSTK_CLS) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group"); - -#ifndef H5_HAVE_THREADSAFE - H5E_stack_g[0].nused = 0; - H5E__set_default_auto(H5E_stack_g); -#endif /* H5_HAVE_THREADSAFE */ - - /* Allocate the HDF5 error class */ - assert(H5E_ERR_CLS_g == (-1)); - snprintf(lib_vers, sizeof(lib_vers), "%u.%u.%u%s", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE, - (strlen(H5_VERS_SUBRELEASE) > 0 ? "-" H5_VERS_SUBRELEASE : "")); - if (NULL == (cls = H5E__register_class(H5E_CLS_NAME, H5E_CLS_LIB_NAME, lib_vers))) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "class initialization failed"); - if ((H5E_ERR_CLS_g = H5I_register(H5I_ERROR_CLASS, cls, false)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error class"); - -/* Include the automatically generated error code initialization */ -#include "H5Einit.h" - -done: - FUNC_LEAVE_NOAPI(ret_value) -} - -/*------------------------------------------------------------------------- - * Function: H5E_term_package - * - * Purpose: Terminates the H5E interface - * - * Return: Success: Positive if anything is done that might - * affect other interfaces; zero otherwise. - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -int -H5E_term_package(void) -{ - int n = 0; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - int64_t ncls, nmsg, nstk; - - /* Check if there are any open error stacks, classes or messages */ - ncls = H5I_nmembers(H5I_ERROR_CLASS); - nmsg = H5I_nmembers(H5I_ERROR_MSG); - nstk = H5I_nmembers(H5I_ERROR_STACK); - - if ((ncls + nmsg + nstk) > 0) { - /* Clear the default error stack. Note that - * the following H5I_clear_type calls do not - * force the clears and will not be able to - * clear any error message IDs that are still - * in use by the default error stack unless we - * clear that stack manually. - * - * Error message IDs will typically still be - * in use by the default error stack when the - * application does H5E_BEGIN/END_TRY cleanup - * at the very end. - */ - H5E_clear_stack(NULL); - - /* Clear any outstanding error stacks */ - if (nstk > 0) - (void)H5I_clear_type(H5I_ERROR_STACK, false, false); - - /* Clear all the error classes */ - if (ncls > 0) { - (void)H5I_clear_type(H5I_ERROR_CLASS, false, false); - - /* Reset the HDF5 error class, if its been closed */ - if (H5I_nmembers(H5I_ERROR_CLASS) == 0) - H5E_ERR_CLS_g = -1; - } /* end if */ - - /* Clear all the error messages */ - if (nmsg > 0) { - (void)H5I_clear_type(H5I_ERROR_MSG, false, false); - - /* Reset the HDF5 error messages, if they've been closed */ - if (H5I_nmembers(H5I_ERROR_MSG) == 0) { -/* Include the automatically generated error code termination */ -#include "H5Eterm.h" - } /* end if */ - } /* end if */ - - n++; /*H5I*/ - } /* end if */ - else { - /* Destroy the error class, message, and stack id groups */ - n += (H5I_dec_type_ref(H5I_ERROR_STACK) > 0); - n += (H5I_dec_type_ref(H5I_ERROR_CLASS) > 0); - n += (H5I_dec_type_ref(H5I_ERROR_MSG) > 0); - - } /* end else */ - - FUNC_LEAVE_NOAPI(n) -} /* end H5E_term_package() */ - -/*-------------------------------------------------------------------------- - * Function: H5E__set_default_auto - * - * Purpose: Initialize "automatic" error stack reporting info to library - * default - * - * Return: SUCCEED/FAIL - * - *-------------------------------------------------------------------------- - */ -static herr_t -H5E__set_default_auto(H5E_t *stk) -{ - FUNC_ENTER_PACKAGE_NOERR - -#ifndef H5_NO_DEPRECATED_SYMBOLS -#ifdef H5_USE_16_API_DEFAULT - stk->auto_op.vers = 1; -#else /* H5_USE_16_API */ - stk->auto_op.vers = 2; -#endif /* H5_USE_16_API_DEFAULT */ - - stk->auto_op.func1 = stk->auto_op.func1_default = (H5E_auto1_t)H5Eprint1; - stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5E__print2; - stk->auto_op.is_default = true; -#else /* H5_NO_DEPRECATED_SYMBOLS */ - stk->auto_op.func2 = (H5E_auto2_t)H5E__print2; -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - - stk->auto_data = NULL; - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E__set_default_auto() */ - -#ifdef H5_HAVE_THREADSAFE -/*------------------------------------------------------------------------- - * Function: H5E__get_stack - * - * Purpose: Support function for H5E__get_my_stack() to initialize and - * acquire per-thread error stack. - * - * Return: Success: Pointer to an error stack struct (H5E_t *) - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -H5E_t * -H5E__get_stack(void) -{ - H5E_t *estack = NULL; - - FUNC_ENTER_PACKAGE_NOERR - - estack = (H5E_t *)H5TS_get_thread_local_value(H5TS_errstk_key_g); - - if (!estack) { - /* No associated value with current thread - create one */ -#ifdef H5_HAVE_WIN_THREADS - /* Win32 has to use LocalAlloc to match the LocalFree in DllMain */ - estack = (H5E_t *)LocalAlloc(LPTR, sizeof(H5E_t)); -#else - /* Use malloc here since this has to match the free in the - * destructor and we want to avoid the codestack there. - */ - estack = (H5E_t *)malloc(sizeof(H5E_t)); -#endif /* H5_HAVE_WIN_THREADS */ - assert(estack); - - /* Set the thread-specific info */ - estack->nused = 0; - H5E__set_default_auto(estack); - - /* (It's not necessary to release this in this API, it is - * released by the "key destructor" set up in the H5TS - * routines. See calls to pthread_key_create() in H5TS.c -QAK) - */ - H5TS_set_thread_local_value(H5TS_errstk_key_g, (void *)estack); - } /* end if */ - - /* Set return value */ - FUNC_LEAVE_NOAPI(estack) -} /* end H5E__get_stack() */ -#endif /* H5_HAVE_THREADSAFE */ - -/*------------------------------------------------------------------------- - * Function: H5E__free_class - * - * Purpose: Private function to free an error class. - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -static herr_t -H5E__free_class(H5E_cls_t *cls) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Check arguments */ - assert(cls); - - /* Free error class structure */ - cls->cls_name = (char *)H5MM_xfree((void *)cls->cls_name); - cls->lib_name = (char *)H5MM_xfree((void *)cls->lib_name); - cls->lib_vers = (char *)H5MM_xfree((void *)cls->lib_vers); - cls = H5FL_FREE(H5E_cls_t, cls); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E__free_class() */ - /*------------------------------------------------------------------------- * Function: H5Eregister_class * @@ -413,52 +118,6 @@ H5Eregister_class(const char *cls_name, const char *lib_name, const char *versio FUNC_LEAVE_API(ret_value) } /* end H5Eregister_class() */ -/*------------------------------------------------------------------------- - * Function: H5E__register_class - * - * Purpose: Private function to register an error class. - * - * Return: Success: Pointer to an error class struct - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -static H5E_cls_t * -H5E__register_class(const char *cls_name, const char *lib_name, const char *version) -{ - H5E_cls_t *cls = NULL; /* Pointer to error class */ - H5E_cls_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Check arguments */ - assert(cls_name); - assert(lib_name); - assert(version); - - /* Allocate space for new error class */ - if (NULL == (cls = H5FL_CALLOC(H5E_cls_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - - /* Duplicate string information */ - if (NULL == (cls->cls_name = strdup(cls_name))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - if (NULL == (cls->lib_name = strdup(lib_name))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - if (NULL == (cls->lib_vers = strdup(version))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - - /* Set the return value */ - ret_value = cls; - -done: - if (!ret_value) - if (cls && H5E__free_class(cls) < 0) - HDONE_ERROR(H5E_ERROR, H5E_CANTRELEASE, NULL, "unable to free error class"); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E__register_class() */ - /*------------------------------------------------------------------------- * Function: H5Eunregister_class * @@ -490,37 +149,6 @@ H5Eunregister_class(hid_t class_id) FUNC_LEAVE_API(ret_value) } /* end H5Eunregister_class() */ -/*------------------------------------------------------------------------- - * Function: H5E__unregister_class - * - * Purpose: Private function to close an error class. - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -static herr_t -H5E__unregister_class(H5E_cls_t *cls, void H5_ATTR_UNUSED **request) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Check arguments */ - assert(cls); - - /* Iterate over all the messages and delete those in this error class */ - if (H5I_iterate(H5I_ERROR_MSG, H5E__close_msg_cb, cls, false) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_BADITER, FAIL, "unable to free all messages in this error class"); - - /* Free error class structure */ - if (H5E__free_class(cls) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "unable to free error class"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E__unregister_class() */ - /*------------------------------------------------------------------------- * Function: H5Eget_class_name * @@ -551,75 +179,6 @@ H5Eget_class_name(hid_t class_id, char *name /*out*/, size_t size) FUNC_LEAVE_API(ret_value) } /* end H5Eget_class_name() */ -/*------------------------------------------------------------------------- - * Function: H5E__get_class_name - * - * Purpose: Private function to retrieve error class name. - * - * Return: Success: Name length (zero means no name) - * Failure: -1 - * - *------------------------------------------------------------------------- - */ -static ssize_t -H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size) -{ - ssize_t len = -1; /* Length of error class's name */ - - FUNC_ENTER_PACKAGE_NOERR - - /* Check arguments */ - assert(cls); - - /* Get the class's name */ - len = (ssize_t)strlen(cls->cls_name); - - /* Set the user's buffer, if provided */ - if (name) { - strncpy(name, cls->cls_name, size); - if ((size_t)len >= size) - name[size - 1] = '\0'; - } /* end if */ - - /* Return the full length */ - FUNC_LEAVE_NOAPI(len) -} /* end H5E__get_class_name() */ - -/*------------------------------------------------------------------------- - * Function: H5E__close_msg_cb - * - * Purpose: H5I_iterate callback function to close error messages in the - * error class. - * - * Return: Success: H5_ITER_CONT (0) - * Failure: H5_ITER_ERROR (-1) - * - *------------------------------------------------------------------------- - */ -static int -H5E__close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata) -{ - H5E_msg_t *err_msg = (H5E_msg_t *)obj_ptr; - H5E_cls_t *cls = (H5E_cls_t *)udata; - int ret_value = H5_ITER_CONT; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Check arguments */ - assert(err_msg); - - /* Close the message if it is in the class being closed */ - if (err_msg->cls == cls) { - if (H5E__close_msg(err_msg, NULL) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, H5_ITER_ERROR, "unable to close error message"); - if (NULL == H5I_remove(obj_id)) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREMOVE, H5_ITER_ERROR, "unable to remove error message"); - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E__close_msg_cb() */ - /*------------------------------------------------------------------------- * Function: H5Eclose_msg * @@ -648,31 +207,6 @@ H5Eclose_msg(hid_t err_id) FUNC_LEAVE_API(ret_value) } /* end H5Eclose_msg() */ -/*------------------------------------------------------------------------- - * Function: H5E__close_msg - * - * Purpose: Private function to close an error message. - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -static herr_t -H5E__close_msg(H5E_msg_t *err, void H5_ATTR_UNUSED **request) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Check arguments */ - assert(err); - - /* Release message */ - err->msg = (char *)H5MM_xfree((void *)err->msg); - /* Don't free err->cls here */ - err = H5FL_FREE(H5E_msg_t, err); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E__close_msg() */ - /*------------------------------------------------------------------------- * Function: H5Ecreate_msg * @@ -714,50 +248,6 @@ H5Ecreate_msg(hid_t class_id, H5E_type_t msg_type, const char *msg_str) FUNC_LEAVE_API(ret_value) } /* end H5Ecreate_msg() */ -/*------------------------------------------------------------------------- - * Function: H5E__create_msg - * - * Purpose: Private function to create a major or minor error. - * - * Return: Success: Pointer to a message struct - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -static H5E_msg_t * -H5E__create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str) -{ - H5E_msg_t *msg = NULL; /* Pointer to new error message */ - H5E_msg_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Check arguments */ - assert(cls); - assert(msg_type == H5E_MAJOR || msg_type == H5E_MINOR); - assert(msg_str); - - /* Allocate new message object */ - if (NULL == (msg = H5FL_MALLOC(H5E_msg_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - - /* Fill new message object */ - msg->cls = cls; - msg->type = msg_type; - if (NULL == (msg->msg = strdup(msg_str))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - - /* Set return value */ - ret_value = msg; - -done: - if (!ret_value) - if (msg && H5E__close_msg(msg, NULL) < 0) - HDONE_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, NULL, "unable to close error message"); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E__create_msg() */ - /*------------------------------------------------------------------------- * Function: H5Eget_msg * @@ -801,13 +291,13 @@ H5Eget_msg(hid_t msg_id, H5E_type_t *type /*out*/, char *msg_str /*out*/, size_t hid_t H5Ecreate_stack(void) { - H5E_t *stk; /* Error stack */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5E_stack_t *stk; /* Error stack */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) /* Allocate a new error stack */ - if (NULL == (stk = H5FL_CALLOC(H5E_t))) + if (NULL == (stk = H5FL_CALLOC(H5E_stack_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed"); /* Set the "automatic" error reporting info to the library default */ @@ -835,8 +325,8 @@ H5Ecreate_stack(void) hid_t H5Eget_current_stack(void) { - H5E_t *stk; /* Error stack */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5E_stack_t *stk; /* Error stack */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ /* Don't clear the error stack! :-) */ FUNC_ENTER_API_NOCLEAR(H5I_INVALID_HID) @@ -853,68 +343,6 @@ H5Eget_current_stack(void) FUNC_LEAVE_API(ret_value) } /* end H5Eget_current_stack() */ -/*------------------------------------------------------------------------- - * Function: H5E__get_current_stack - * - * Purpose: Private function to register an error stack. - * - * Return: Success: Pointer to an error class struct - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -static H5E_t * -H5E__get_current_stack(void) -{ - H5E_t *current_stack; /* Pointer to the current error stack */ - H5E_t *estack_copy = NULL; /* Pointer to new error stack to return */ - unsigned u; /* Local index variable */ - H5E_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Get a pointer to the current error stack */ - if (NULL == (current_stack = H5E__get_my_stack())) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get current error stack"); - - /* Allocate a new error stack */ - if (NULL == (estack_copy = H5FL_CALLOC(H5E_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - - /* Make a copy of current error stack */ - estack_copy->nused = current_stack->nused; - for (u = 0; u < current_stack->nused; u++) { - H5E_error2_t *current_error, *new_error; /* Pointers to errors on each stack */ - - /* Get pointers into the current error stack location */ - current_error = &(current_stack->slot[u]); - new_error = &(estack_copy->slot[u]); - - /* Set error stack entry */ - if (H5E__set_stack_entry(new_error, current_error->file_name, current_error->func_name, - current_error->line, current_error->cls_id, current_error->maj_num, - current_error->min_num, current_error->desc) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, NULL, "can't set error entry"); - } /* end for */ - - /* Copy the "automatic" error reporting information */ - estack_copy->auto_op = current_stack->auto_op; - estack_copy->auto_data = current_stack->auto_data; - - /* Empty current error stack */ - H5E_clear_stack(current_stack); - - /* Set the return value */ - ret_value = estack_copy; - -done: - if (ret_value == NULL) - if (estack_copy) - estack_copy = H5FL_FREE(H5E_t, estack_copy); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E__get_current_stack() */ - /*------------------------------------------------------------------------- * Function: H5Eset_current_stack * @@ -928,13 +356,13 @@ H5E__get_current_stack(void) herr_t H5Eset_current_stack(hid_t err_stack) { - H5E_t *estack; - herr_t ret_value = SUCCEED; /* Return value */ + H5E_stack_t *estack; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) if (err_stack != H5E_DEFAULT) { - if (NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) + if (NULL == (estack = (H5E_stack_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID"); /* Set the current error stack */ @@ -953,54 +381,6 @@ H5Eset_current_stack(hid_t err_stack) FUNC_LEAVE_API(ret_value) } /* end H5Eset_current_stack() */ -/*------------------------------------------------------------------------- - * Function: H5E__set_current_stack - * - * Purpose: Private function to replace an error stack. - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -static herr_t -H5E__set_current_stack(H5E_t *estack) -{ - H5E_t *current_stack; /* Default error stack */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity check */ - assert(estack); - - /* Get a pointer to the current error stack */ - if (NULL == (current_stack = H5E__get_my_stack())) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); - - /* Empty current error stack */ - H5E_clear_stack(current_stack); - - /* Copy new stack to current error stack */ - current_stack->nused = estack->nused; - for (u = 0; u < current_stack->nused; u++) { - H5E_error2_t *current_error, *new_error; /* Pointers to errors on each stack */ - - /* Get pointers into the current error stack location */ - current_error = &(current_stack->slot[u]); - new_error = &(estack->slot[u]); - - /* Set error stack entry */ - if (H5E__set_stack_entry(current_error, new_error->file_name, new_error->func_name, new_error->line, - new_error->cls_id, new_error->maj_num, new_error->min_num, - new_error->desc) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set error entry"); - } /* end for */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E__set_current_stack() */ - /*------------------------------------------------------------------------- * Function: H5Eclose_stack * @@ -1034,32 +414,6 @@ H5Eclose_stack(hid_t stack_id) FUNC_LEAVE_API(ret_value) } /* end H5Eclose_stack() */ -/*------------------------------------------------------------------------- - * Function: H5E__close_stack - * - * Purpose: Private function to close an error stack. - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -static herr_t -H5E__close_stack(H5E_t *estack, void H5_ATTR_UNUSED **request) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Sanity check */ - assert(estack); - - /* Release the stack's error information */ - H5E_clear_stack(estack); - - /* Free the stack structure */ - estack = H5FL_FREE(H5E_t, estack); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E__close_stack() */ - /*------------------------------------------------------------------------- * Function: H5Eget_num * @@ -1073,8 +427,8 @@ H5E__close_stack(H5E_t *estack, void H5_ATTR_UNUSED **request) ssize_t H5Eget_num(hid_t error_stack_id) { - H5E_t *estack; /* Error stack to operate on */ - ssize_t ret_value; /* Return value */ + H5E_stack_t *estack; /* Error stack to operate on */ + ssize_t ret_value; /* Return value */ /* Don't clear the error stack! :-) */ FUNC_ENTER_API_NOCLEAR((-1)) @@ -1086,10 +440,10 @@ H5Eget_num(hid_t error_stack_id) } /* end if */ else { /* Only clear the error stack if it's not the default stack */ - H5E_clear_stack(NULL); + H5E_clear_stack(); /* Get the error stack to operate on */ - if (NULL == (estack = (H5E_t *)H5I_object_verify(error_stack_id, H5I_ERROR_STACK))) + if (NULL == (estack = (H5E_stack_t *)H5I_object_verify(error_stack_id, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not an error stack ID"); } /* end else */ @@ -1101,26 +455,6 @@ H5Eget_num(hid_t error_stack_id) FUNC_LEAVE_API(ret_value) } /* end H5Eget_num() */ -/*------------------------------------------------------------------------- - * Function: H5E__get_num - * - * Purpose: Private function to retrieve number of errors in error stack. - * - * Return: Success: The number of errors - * Failure: -1 (can't fail at this time) - * - *------------------------------------------------------------------------- - */ -static ssize_t -H5E__get_num(const H5E_t *estack) -{ - FUNC_ENTER_PACKAGE_NOERR - - assert(estack); - - FUNC_LEAVE_NOAPI((ssize_t)estack->nused) -} /* end H5E__get_num() */ - /*------------------------------------------------------------------------- * Function: H5Epop * @@ -1133,8 +467,8 @@ H5E__get_num(const H5E_t *estack) herr_t H5Epop(hid_t err_stack, size_t count) { - H5E_t *estack; - herr_t ret_value = SUCCEED; /* Return value */ + H5E_stack_t *estack; + herr_t ret_value = SUCCEED; /* Return value */ /* Don't clear the error stack! :-) */ FUNC_ENTER_API_NOCLEAR(FAIL) @@ -1146,10 +480,10 @@ H5Epop(hid_t err_stack, size_t count) } /* end if */ else { /* Only clear the error stack if it's not the default stack */ - H5E_clear_stack(NULL); + H5E_clear_stack(); /* Get the error stack to operate on */ - if (NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) + if (NULL == (estack = (H5E_stack_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID"); } /* end else */ @@ -1188,11 +522,12 @@ herr_t H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *fmt, ...) { - va_list ap; /* Varargs info */ - H5E_t *estack; /* Pointer to error stack to modify */ - char *tmp = NULL; /* Buffer to place formatted description in */ - bool va_started = false; /* Whether the variable argument list is open */ - herr_t ret_value = SUCCEED; /* Return value */ + H5E_stack_t *estack; /* Pointer to error stack to modify */ + va_list ap; /* Varargs info */ + bool va_started = false; /* Whether the variable argument list is open */ + const char *tmp_file; /* Copy of the file name */ + const char *tmp_func; /* Copy of the function name */ + herr_t ret_value = SUCCEED; /* Return value */ /* Don't clear the error stack! :-) */ FUNC_ENTER_API_NOCLEAR(FAIL) @@ -1201,10 +536,10 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid estack = NULL; else { /* Only clear the error stack if it's not the default stack */ - H5E_clear_stack(NULL); + H5E_clear_stack(); /* Get the error stack to operate on */ - if (NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) + if (NULL == (estack = (H5E_stack_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID"); } /* end else */ @@ -1217,22 +552,30 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid va_start(ap, fmt); va_started = true; - /* Use the vasprintf() routine, since it does what we're trying to do below */ - if (HDvasprintf(&tmp, fmt, ap) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + /* Duplicate string information */ + if (NULL == (tmp_file = strdup(file))) + HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "can't duplicate file string"); + if (NULL == (tmp_func = strdup(func))) + HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "can't duplicate function string"); + + /* Increment refcount on non-library IDs */ + if (cls_id != H5E_ERR_CLS_g) + if (H5I_inc_ref(cls_id, false) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment class ID"); + if (maj_id < H5E_first_maj_id_g || maj_id > H5E_last_maj_id_g) + if (H5I_inc_ref(maj_id, false) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment major error ID"); + if (min_id < H5E_first_min_id_g || min_id > H5E_last_min_id_g) + if (H5I_inc_ref(min_id, false) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment minor error ID"); /* Push the error on the stack */ - if (H5E__push_stack(estack, file, func, line, cls_id, maj_id, min_id, tmp) < 0) + if (H5E__push_stack(estack, true, tmp_file, tmp_func, line, cls_id, maj_id, min_id, fmt, &ap) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't push error on stack"); done: if (va_started) va_end(ap); - /* Memory was allocated with HDvasprintf so it needs to be freed - * with free - */ - if (tmp) - free(tmp); FUNC_LEAVE_API(ret_value) } /* end H5Epush2() */ @@ -1249,8 +592,8 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid herr_t H5Eclear2(hid_t err_stack) { - H5E_t *estack; /* Error stack to operate on */ - herr_t ret_value = SUCCEED; /* Return value */ + H5E_stack_t *estack; /* Error stack to operate on */ + herr_t ret_value = SUCCEED; /* Return value */ /* Don't clear the error stack! :-) */ FUNC_ENTER_API_NOCLEAR(FAIL) @@ -1260,14 +603,14 @@ H5Eclear2(hid_t err_stack) estack = NULL; else { /* Only clear the error stack if it's not the default stack */ - H5E_clear_stack(NULL); + H5E_clear_stack(); - if (NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) + if (NULL == (estack = (H5E_stack_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID"); } /* end else */ /* Clear the error stack */ - if (H5E_clear_stack(estack) < 0) + if (H5E__clear_stack(estack) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack"); done: @@ -1302,44 +645,6 @@ H5Eprint2(hid_t err_stack, FILE *stream) FUNC_LEAVE_API(ret_value) } /* end H5Eprint2() */ -/*------------------------------------------------------------------------- - * Function: H5E__print2 - * - * Purpose: Internal helper routine for H5Eprint2. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -static herr_t -H5E__print2(hid_t err_stack, FILE *stream) -{ - H5E_t *estack; /* Error stack to operate on */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Need to check for errors */ - if (err_stack == H5E_DEFAULT) { - if (NULL == (estack = H5E__get_my_stack())) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); - } /* end if */ - else { - /* Only clear the error stack if it's not the default stack */ - H5E_clear_stack(NULL); - - if (NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID"); - } /* end else */ - - /* Print error stack */ - if (H5E__print(estack, stream, false) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E__print2() */ - /*------------------------------------------------------------------------- * Function: H5Ewalk2 * @@ -1353,7 +658,7 @@ H5E__print2(hid_t err_stack, FILE *stream) herr_t H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, void *client_data) { - H5E_t *estack; /* Error stack to operate on */ + H5E_stack_t *estack; /* Error stack to operate on */ H5E_walk_op_t op; /* Operator for walking error stack */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1367,9 +672,9 @@ H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, voi } /* end if */ else { /* Only clear the error stack if it's not the default stack */ - H5E_clear_stack(NULL); + H5E_clear_stack(); - if (NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) + if (NULL == (estack = (H5E_stack_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID"); } /* end else */ @@ -1398,7 +703,7 @@ H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, voi herr_t H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func /*out*/, void **client_data /*out*/) { - H5E_t *estack; /* Error stack to operate on */ + H5E_stack_t *estack; /* Error stack to operate on */ H5E_auto_op_t op; /* Error stack function */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1411,9 +716,9 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func /*out*/, void **client_data /*ou } /* end if */ else { /* Only clear the error stack if it's not the default stack */ - H5E_clear_stack(NULL); + H5E_clear_stack(); - if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK))) + if (NULL == (estack = (H5E_stack_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID"); } /* end else */ @@ -1456,7 +761,7 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func /*out*/, void **client_data /*ou herr_t H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) { - H5E_t *estack; /* Error stack to operate on */ + H5E_stack_t *estack; /* Error stack to operate on */ H5E_auto_op_t op; /* Error stack operator */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1469,9 +774,9 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) } /* end if */ else { /* Only clear the error stack if it's not the default stack */ - H5E_clear_stack(NULL); + H5E_clear_stack(); - if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK))) + if (NULL == (estack = (H5E_stack_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID"); } /* end else */ @@ -1514,8 +819,8 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) herr_t H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack) { - H5E_t *estack; /* Error stack to operate on */ - herr_t ret_value = SUCCEED; /* Return value */ + H5E_stack_t *estack; /* Error stack to operate on */ + herr_t ret_value = SUCCEED; /* Return value */ /* Don't clear the error stack! :-) */ FUNC_ENTER_API_NOCLEAR(FAIL) @@ -1526,9 +831,9 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack) } /* end if */ else { /* Only clear the error stack if it's not the default stack */ - H5E_clear_stack(NULL); + H5E_clear_stack(); - if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK))) + if (NULL == (estack = (H5E_stack_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID"); } /* end else */ @@ -1557,16 +862,16 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack) herr_t H5Eappend_stack(hid_t dst_stack_id, hid_t src_stack_id, hbool_t close_source_stack) { - H5E_t *dst_stack, *src_stack; /* Error stacks */ - herr_t ret_value = SUCCEED; /* Return value */ + H5E_stack_t *dst_stack, *src_stack; /* Error stacks */ + herr_t ret_value = SUCCEED; /* Return value */ /* Don't clear the error stack! :-) */ FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (dst_stack = (H5E_t *)H5I_object_verify(dst_stack_id, H5I_ERROR_STACK))) + if (NULL == (dst_stack = (H5E_stack_t *)H5I_object_verify(dst_stack_id, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dst_stack_id not a error stack ID"); - if (NULL == (src_stack = (H5E_t *)H5I_object_verify(src_stack_id, H5I_ERROR_STACK))) + if (NULL == (src_stack = (H5E_stack_t *)H5I_object_verify(src_stack_id, H5I_ERROR_STACK))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "src_stack_id not a error stack ID"); /* Append the source stack to the destination stack */ @@ -1584,51 +889,3 @@ H5Eappend_stack(hid_t dst_stack_id, hid_t src_stack_id, hbool_t close_source_sta done: FUNC_LEAVE_API(ret_value) } /* end H5Eappend_stack() */ - -/*------------------------------------------------------------------------- - * Function: H5E__append_stack - * - * Purpose: Private function to append error stacks. - * - * Return: Non-negative value on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -static herr_t -H5E__append_stack(H5E_t *dst_stack, const H5E_t *src_stack) -{ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity checks */ - assert(dst_stack); - assert(src_stack); - - /* Copy the errors from the source stack to the destination stack */ - for (u = 0; u < src_stack->nused; u++) { - const H5E_error2_t *src_error; /* Pointers to source error on stack */ - H5E_error2_t *dst_error; /* Pointers to destination error on stack */ - - /* Get pointers into the current error stack location */ - src_error = &(src_stack->slot[u]); - dst_error = &(dst_stack->slot[dst_stack->nused]); - - /* Set error stack entry */ - if (H5E__set_stack_entry(dst_error, src_error->file_name, src_error->func_name, src_error->line, - src_error->cls_id, src_error->maj_num, src_error->min_num, - src_error->desc) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set error entry"); - - /* Increment # of errors in destination stack */ - dst_stack->nused++; - - /* Check for destination stack full */ - if (dst_stack->nused >= H5E_NSLOTS) - break; - } /* end for */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E__append_stack() */ diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c index 1f85b00c8f2..06648000ae1 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -182,13 +182,29 @@ H5Eget_minor(H5E_minor_t min) herr_t H5Epush1(const char *file, const char *func, unsigned line, H5E_major_t maj, H5E_minor_t min, const char *str) { - herr_t ret_value = SUCCEED; /* Return value */ + const char *tmp_file; /* Copy of the file name */ + const char *tmp_func; /* Copy of the function name */ + herr_t ret_value = SUCCEED; /* Return value */ /* Don't clear the error stack! :-) */ FUNC_ENTER_API_NOCLEAR(FAIL) + /* Duplicate string information */ + if (NULL == (tmp_file = strdup(file))) + HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "can't duplicate file string"); + if (NULL == (tmp_func = strdup(func))) + HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "can't duplicate function string"); + + /* Increment refcount on non-library IDs */ + if (maj < H5E_first_maj_id_g || maj > H5E_last_maj_id_g) + if (H5I_inc_ref(maj, false) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment major error ID"); + if (min < H5E_first_min_id_g || min > H5E_last_min_id_g) + if (H5I_inc_ref(min, false) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment minor error ID"); + /* Push the error on the default error stack */ - if (H5E__push_stack(NULL, file, func, line, H5E_ERR_CLS_g, maj, min, str) < 0) + if (H5E__push_stack(NULL, true, tmp_file, tmp_func, line, H5E_ERR_CLS_g, maj, min, str, NULL) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't push error on stack"); done: @@ -214,7 +230,7 @@ H5Eclear1(void) FUNC_ENTER_API_NOCLEAR(FAIL) /* Clear the default error stack */ - if (H5E_clear_stack(NULL) < 0) + if (H5E_clear_stack() < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack"); done: @@ -237,8 +253,8 @@ H5Eclear1(void) herr_t H5Eprint1(FILE *stream) { - H5E_t *estack; /* Error stack to operate on */ - herr_t ret_value = SUCCEED; /* Return value */ + H5E_stack_t *estack; /* Error stack to operate on */ + herr_t ret_value = SUCCEED; /* Return value */ /* Don't clear the error stack! :-) */ FUNC_ENTER_API_NOCLEAR(FAIL) @@ -268,7 +284,7 @@ H5Eprint1(FILE *stream) herr_t H5Ewalk1(H5E_direction_t direction, H5E_walk1_t func, void *client_data) { - H5E_t *estack; /* Error stack to operate on */ + H5E_stack_t *estack; /* Error stack to operate on */ H5E_walk_op_t walk_op; /* Error stack walking callback */ herr_t ret_value = SUCCEED; /* Return value */ @@ -304,7 +320,7 @@ H5Ewalk1(H5E_direction_t direction, H5E_walk1_t func, void *client_data) herr_t H5Eget_auto1(H5E_auto1_t *func /*out*/, void **client_data /*out*/) { - H5E_t *estack; /* Error stack to operate on */ + H5E_stack_t *estack; /* Error stack to operate on */ H5E_auto_op_t auto_op; /* Error stack operator */ herr_t ret_value = SUCCEED; /* Return value */ @@ -352,7 +368,7 @@ H5Eget_auto1(H5E_auto1_t *func /*out*/, void **client_data /*out*/) herr_t H5Eset_auto1(H5E_auto1_t func, void *client_data) { - H5E_t *estack; /* Error stack to operate on */ + H5E_stack_t *estack; /* Error stack to operate on */ H5E_auto_op_t auto_op; /* Error stack operator */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Eint.c b/src/H5Eint.c index e59988d0264..00b6efbe33d 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -30,6 +30,7 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5Epkg.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5TSprivate.h" /* Thread stuff */ @@ -38,6 +39,10 @@ /* Local Macros */ /****************/ +/* HDF5 error class */ +#define H5E_CLS_NAME "HDF5" +#define H5E_CLS_LIB_NAME "HDF5" + /******************/ /* Local Typedefs */ /******************/ @@ -59,7 +64,15 @@ typedef struct H5E_print_t { static herr_t H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data); #endif /* H5_NO_DEPRECATED_SYMBOLS */ static herr_t H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data); -static herr_t H5E__clear_entries(H5E_t *estack, size_t nentries); +static herr_t H5E__copy_stack_entry(H5E_entry_t *dst_entry, const H5E_entry_t *src_entry); +static herr_t H5E__set_stack_entry(H5E_error2_t *err_entry, const char *file, const char *func, unsigned line, + hid_t cls_id, hid_t maj_id, hid_t min_id, const char *desc, va_list *ap); +static herr_t H5E__clear_entries(H5E_stack_t *estack, size_t nentries); +static herr_t H5E__unregister_class(H5E_cls_t *cls, void **request); +static int H5E__close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata); +static void H5E__free_msg(H5E_msg_t *msg); +static herr_t H5E__close_msg(H5E_msg_t *err, void **request); +static herr_t H5E__close_stack(H5E_stack_t *err_stack, void **request); /*********************/ /* Package Variables */ @@ -69,9 +82,18 @@ static herr_t H5E__clear_entries(H5E_t *estack, size_t nentries); /* * The current error stack. */ -H5E_t H5E_stack_g[1]; +H5E_stack_t H5E_stack_g[1]; #endif /* H5_HAVE_THREADSAFE */ +/* Declare a free list to manage the H5E_stack_t struct */ +H5FL_DEFINE(H5E_stack_t); + +/* Declare a free list to manage the H5E_cls_t struct */ +H5FL_DEFINE_STATIC(H5E_cls_t); + +/* Declare a free list to manage the H5E_msg_t struct */ +H5FL_DEFINE_STATIC(H5E_msg_t); + /*****************************/ /* Library Private Variables */ /*****************************/ @@ -98,6 +120,738 @@ char H5E_mpi_error_str[MPI_MAX_ERROR_STRING]; int H5E_mpi_error_str_len; #endif /* H5_HAVE_PARALLEL */ +/* First & last major and minor error codes registered by the library */ +hid_t H5E_first_maj_id_g = H5I_INVALID_HID; +hid_t H5E_last_maj_id_g = H5I_INVALID_HID; +hid_t H5E_first_min_id_g = H5I_INVALID_HID; +hid_t H5E_last_min_id_g = H5I_INVALID_HID; + +/* Error class ID class */ +static const H5I_class_t H5I_ERRCLS_CLS[1] = {{ + H5I_ERROR_CLASS, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5E__unregister_class /* Callback routine for closing objects of this class */ +}}; + +/* Error message ID class */ +static const H5I_class_t H5I_ERRMSG_CLS[1] = {{ + H5I_ERROR_MSG, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5E__close_msg /* Callback routine for closing objects of this class */ +}}; + +/* Error stack ID class */ +static const H5I_class_t H5I_ERRSTK_CLS[1] = {{ + H5I_ERROR_STACK, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5E__close_stack /* Callback routine for closing objects of this class */ +}}; + +/* Library's error class */ +static const H5E_cls_t H5E_err_cls_s = {false, H5E_CLS_NAME, H5E_CLS_LIB_NAME, H5_VERS_STR}; + +/* Include the automatically generated major error message definitions */ +#include "H5Emajdef.h" + +/* Include the automatically generated minor error message definitions */ +#include "H5Emindef.h" + +/*------------------------------------------------------------------------- + * Function: H5E_init + * + * Purpose: Initialize the interface from some other layer. + * + * Return: Success: non-negative + * Failure: negative + *------------------------------------------------------------------------- + */ +herr_t +H5E_init(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Initialize the ID group for the error class IDs */ + if (H5I_register_type(H5I_ERRCLS_CLS) < 0) + HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group"); + + /* Initialize the ID group for the major error IDs */ + if (H5I_register_type(H5I_ERRMSG_CLS) < 0) + HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group"); + + /* Initialize the ID group for the error stacks */ + if (H5I_register_type(H5I_ERRSTK_CLS) < 0) + HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group"); + +#ifndef H5_HAVE_THREADSAFE + H5E_stack_g[0].nused = 0; + H5E__set_default_auto(H5E_stack_g); +#endif /* H5_HAVE_THREADSAFE */ + + /* Register the HDF5 error class */ + if ((H5E_ERR_CLS_g = H5I_register(H5I_ERROR_CLASS, &H5E_err_cls_s, false)) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error class"); + +/* Include the automatically generated error code initialization */ +#include "H5Einit.h" + +done: + FUNC_LEAVE_NOAPI(ret_value) +} + +/*------------------------------------------------------------------------- + * Function: H5E_term_package + * + * Purpose: Terminates the H5E interface + * + * Return: Success: Positive if anything is done that might + * affect other interfaces; zero otherwise. + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +int +H5E_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + int64_t ncls, nmsg, nstk; + + /* Check if there are any open error stacks, classes or messages */ + ncls = H5I_nmembers(H5I_ERROR_CLASS); + nmsg = H5I_nmembers(H5I_ERROR_MSG); + nstk = H5I_nmembers(H5I_ERROR_STACK); + + if ((ncls + nmsg + nstk) > 0) { + /* Clear the default error stack. Note that + * the following H5I_clear_type calls do not + * force the clears and will not be able to + * clear any error message IDs that are still + * in use by the default error stack unless we + * clear that stack manually. + * + * Error message IDs will typically still be + * in use by the default error stack when the + * application does H5E_BEGIN/END_TRY cleanup + * at the very end. + */ + H5E_clear_stack(); + + /* Clear any outstanding error stacks */ + if (nstk > 0) + (void)H5I_clear_type(H5I_ERROR_STACK, false, false); + + /* Clear all the error classes */ + if (ncls > 0) { + (void)H5I_clear_type(H5I_ERROR_CLASS, false, false); + + /* Reset the HDF5 error class, if its been closed */ + if (H5I_nmembers(H5I_ERROR_CLASS) == 0) + H5E_ERR_CLS_g = H5I_INVALID_HID; + } /* end if */ + + /* Clear all the error messages */ + if (nmsg > 0) { + (void)H5I_clear_type(H5I_ERROR_MSG, false, false); + + /* Reset the HDF5 error messages, if they've been closed */ + if (H5I_nmembers(H5I_ERROR_MSG) == 0) { +/* Include the automatically generated error code termination */ +#include "H5Eterm.h" + } /* end if */ + } /* end if */ + + n++; /*H5I*/ + } /* end if */ + else { + /* Destroy the error class, message, and stack id groups */ + n += (H5I_dec_type_ref(H5I_ERROR_STACK) > 0); + n += (H5I_dec_type_ref(H5I_ERROR_CLASS) > 0); + n += (H5I_dec_type_ref(H5I_ERROR_MSG) > 0); + + } /* end else */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5E_term_package() */ + +#ifdef H5_HAVE_THREADSAFE +/*------------------------------------------------------------------------- + * Function: H5E__get_stack + * + * Purpose: Support function for H5E__get_my_stack() to initialize and + * acquire per-thread error stack. + * + * Return: Success: Pointer to an error stack struct (H5E_t *) + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +H5E_stack_t * +H5E__get_stack(void) +{ + H5E_stack_t *estack = NULL; + + FUNC_ENTER_PACKAGE_NOERR + + estack = (H5E_stack_t *)H5TS_get_thread_local_value(H5TS_errstk_key_g); + + if (!estack) { + /* No associated value with current thread - create one */ +#ifdef H5_HAVE_WIN_THREADS + /* Win32 has to use LocalAlloc to match the LocalFree in DllMain */ + estack = (H5E_stack_t *)LocalAlloc(LPTR, sizeof(H5E_stack_t)); +#else + /* Use malloc here since this has to match the free in the + * destructor and we want to avoid the codestack there. + */ + estack = (H5E_stack_t *)malloc(sizeof(H5E_stack_t)); +#endif /* H5_HAVE_WIN_THREADS */ + assert(estack); + + /* Set the thread-specific info */ + estack->nused = 0; + H5E__set_default_auto(estack); + + /* (It's not necessary to release this in this API, it is + * released by the "key destructor" set up in the H5TS + * routines. See calls to pthread_key_create() in H5TS.c -QAK) + */ + H5TS_set_thread_local_value(H5TS_errstk_key_g, (void *)estack); + } /* end if */ + + /* Set return value */ + FUNC_LEAVE_NOAPI(estack) +} /* end H5E__get_stack() */ +#endif /* H5_HAVE_THREADSAFE */ + +/*------------------------------------------------------------------------- + * Function: H5E__free_class + * + * Purpose: Private function to free an error class. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5E__free_class(H5E_cls_t *cls) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Check arguments */ + assert(cls); + + /* Free resources, if application registered this class */ + if (cls->app_cls) { + /* Free error class structure */ + cls->cls_name = H5MM_xfree_const(cls->cls_name); + cls->lib_name = H5MM_xfree_const(cls->lib_name); + cls->lib_vers = H5MM_xfree_const(cls->lib_vers); + cls = H5FL_FREE(H5E_cls_t, cls); + } + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5E__free_class() */ + +/*------------------------------------------------------------------------- + * Function: H5E__register_class + * + * Purpose: Private function to register an error class. + * + * Return: Success: Pointer to an error class struct + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +H5E_cls_t * +H5E__register_class(const char *cls_name, const char *lib_name, const char *version) +{ + H5E_cls_t *cls = NULL; /* Pointer to error class */ + H5E_cls_t *ret_value = NULL; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check arguments */ + assert(cls_name); + assert(lib_name); + assert(version); + + /* Allocate space for new error class */ + if (NULL == (cls = H5FL_CALLOC(H5E_cls_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + + /* Application registered class */ + cls->app_cls = true; + + /* Duplicate string information */ + if (NULL == (cls->cls_name = strdup(cls_name))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + if (NULL == (cls->lib_name = strdup(lib_name))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + if (NULL == (cls->lib_vers = strdup(version))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + + /* Set the return value */ + ret_value = cls; + +done: + if (!ret_value) + if (cls && H5E__free_class(cls) < 0) + HDONE_ERROR(H5E_ERROR, H5E_CANTRELEASE, NULL, "unable to free error class"); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5E__register_class() */ + +/*------------------------------------------------------------------------- + * Function: H5E__unregister_class + * + * Purpose: Private function to close an error class. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5E__unregister_class(H5E_cls_t *cls, void H5_ATTR_UNUSED **request) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check arguments */ + assert(cls); + + /* Iterate over all the messages and delete those in this error class */ + if (H5I_iterate(H5I_ERROR_MSG, H5E__close_msg_cb, cls, false) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_BADITER, FAIL, "unable to free all messages in this error class"); + + /* Free error class structure */ + if (H5E__free_class(cls) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "unable to free error class"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5E__unregister_class() */ + +/*------------------------------------------------------------------------- + * Function: H5E__get_class_name + * + * Purpose: Private function to retrieve error class name. + * + * Return: Success: Name length (zero means no name) + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +ssize_t +H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size) +{ + ssize_t len = -1; /* Length of error class's name */ + + FUNC_ENTER_PACKAGE_NOERR + + /* Check arguments */ + assert(cls); + + /* Get the class's name */ + len = (ssize_t)strlen(cls->cls_name); + + /* Set the user's buffer, if provided */ + if (name) { + strncpy(name, cls->cls_name, size); + if ((size_t)len >= size) + name[size - 1] = '\0'; + } /* end if */ + + /* Return the full length */ + FUNC_LEAVE_NOAPI(len) +} /* end H5E__get_class_name() */ + +/*------------------------------------------------------------------------- + * Function: H5E__close_msg_cb + * + * Purpose: H5I_iterate callback function to close error messages in the + * error class. + * + * Return: Success: H5_ITER_CONT (0) + * Failure: H5_ITER_ERROR (-1) + * + *------------------------------------------------------------------------- + */ +static int +H5E__close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata) +{ + H5E_msg_t *err_msg = (H5E_msg_t *)obj_ptr; + H5E_cls_t *cls = (H5E_cls_t *)udata; + int ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check arguments */ + assert(err_msg); + + /* Close the message if it is in the class being closed */ + if (err_msg->cls == cls) { + if (H5E__close_msg(err_msg, NULL) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, H5_ITER_ERROR, "unable to close error message"); + if (NULL == H5I_remove(obj_id)) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREMOVE, H5_ITER_ERROR, "unable to remove error message"); + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5E__close_msg_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5E__free_msg + * + * Purpose: Private function to free an application error message. + * + * Return: none + * + *------------------------------------------------------------------------- + */ +static void +H5E__free_msg(H5E_msg_t *msg) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Check arguments */ + assert(msg); + assert(msg->app_msg); + + /* Free resources */ + msg->msg = H5MM_xfree_const(msg->msg); + msg = H5FL_FREE(H5E_msg_t, msg); + + FUNC_LEAVE_NOAPI_VOID +} /* end H5E__free_msg() */ + +/*------------------------------------------------------------------------- + * Function: H5E__close_msg + * + * Purpose: Private function to close an error message. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5E__close_msg(H5E_msg_t *err, void H5_ATTR_UNUSED **request) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Check arguments */ + assert(err); + + /* Free resources, if application registered this message */ + if (err->app_msg) + /* Free message */ + H5E__free_msg(err); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5E__close_msg() */ + +/*------------------------------------------------------------------------- + * Function: H5E__create_msg + * + * Purpose: Private function to create a major or minor error. + * + * Return: Success: Pointer to a message struct + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +H5E_msg_t * +H5E__create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str) +{ + H5E_msg_t *msg = NULL; /* Pointer to new error message */ + H5E_msg_t *ret_value = NULL; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check arguments */ + assert(cls); + assert(msg_type == H5E_MAJOR || msg_type == H5E_MINOR); + assert(msg_str); + + /* Allocate new message object */ + if (NULL == (msg = H5FL_CALLOC(H5E_msg_t))) + HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, NULL, "memory allocation failed"); + + /* Fill new message object */ + msg->app_msg = true; + msg->cls = cls; + msg->type = msg_type; + if (NULL == (msg->msg = strdup(msg_str))) + HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, NULL, "memory allocation failed"); + + /* Set return value */ + ret_value = msg; + +done: + if (!ret_value) + if (msg) + H5E__free_msg(msg); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5E__create_msg() */ + +/*------------------------------------------------------------------------- + * Function: H5E__get_current_stack + * + * Purpose: Private function to register an error stack. + * + * Return: Success: Pointer to an error class struct + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +H5E_stack_t * +H5E__get_current_stack(void) +{ + H5E_stack_t *current_stack; /* Pointer to the current error stack */ + H5E_stack_t *estack_copy = NULL; /* Pointer to new error stack to return */ + unsigned u; /* Local index variable */ + H5E_stack_t *ret_value = NULL; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Get a pointer to the current error stack */ + if (NULL == (current_stack = H5E__get_my_stack())) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get current error stack"); + + /* Allocate a new error stack */ + if (NULL == (estack_copy = H5FL_CALLOC(H5E_stack_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + + /* Make a copy of current error stack */ + estack_copy->nused = current_stack->nused; + for (u = 0; u < current_stack->nused; u++) + if (H5E__copy_stack_entry(&estack_copy->entries[u], ¤t_stack->entries[u]) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, NULL, "can't set error entry"); + + /* Copy the "automatic" error reporting information */ + estack_copy->auto_op = current_stack->auto_op; + estack_copy->auto_data = current_stack->auto_data; + + /* Empty current error stack */ + H5E__clear_stack(current_stack); + + /* Set the return value */ + ret_value = estack_copy; + +done: + if (ret_value == NULL) + if (estack_copy) + estack_copy = H5FL_FREE(H5E_stack_t, estack_copy); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5E__get_current_stack() */ + +/*------------------------------------------------------------------------- + * Function: H5E__set_current_stack + * + * Purpose: Private function to replace an error stack. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5E__set_current_stack(H5E_stack_t *estack) +{ + H5E_stack_t *current_stack; /* Default error stack */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + assert(estack); + + /* Get a pointer to the current error stack */ + if (NULL == (current_stack = H5E__get_my_stack())) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); + + /* Empty current error stack */ + H5E__clear_stack(current_stack); + + /* Copy new stack to current error stack */ + current_stack->nused = estack->nused; + for (u = 0; u < current_stack->nused; u++) + if (H5E__copy_stack_entry(¤t_stack->entries[u], &estack->entries[u]) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set error entry"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5E__set_current_stack() */ + +/*------------------------------------------------------------------------- + * Function: H5E__close_stack + * + * Purpose: Private function to close an error stack. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5E__close_stack(H5E_stack_t *estack, void H5_ATTR_UNUSED **request) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity check */ + assert(estack); + + /* Release the stack's error information */ + H5E__clear_stack(estack); + + /* Free the stack structure */ + estack = H5FL_FREE(H5E_stack_t, estack); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5E__close_stack() */ + +/*------------------------------------------------------------------------- + * Function: H5E__get_num + * + * Purpose: Private function to retrieve number of errors in error stack. + * + * Return: Success: The number of errors + * Failure: -1 (can't fail at this time) + * + *------------------------------------------------------------------------- + */ +ssize_t +H5E__get_num(const H5E_stack_t *estack) +{ + FUNC_ENTER_PACKAGE_NOERR + + assert(estack); + + FUNC_LEAVE_NOAPI((ssize_t)estack->nused) +} /* end H5E__get_num() */ + +/*------------------------------------------------------------------------- + * Function: H5E__print2 + * + * Purpose: Internal helper routine for H5Eprint2. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5E__print2(hid_t err_stack, FILE *stream) +{ + H5E_stack_t *estack; /* Error stack to operate on */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Need to check for errors */ + if (err_stack == H5E_DEFAULT) { + if (NULL == (estack = H5E__get_my_stack())) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); + } /* end if */ + else { + /* Only clear the error stack if it's not the default stack */ + H5E_clear_stack(); + + if (NULL == (estack = (H5E_stack_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID"); + } /* end else */ + + /* Print error stack */ + if (H5E__print(estack, stream, false) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5E__print2() */ + +/*------------------------------------------------------------------------- + * Function: H5E__append_stack + * + * Purpose: Private function to append error stacks. + * + * Return: Non-negative value on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5E__append_stack(H5E_stack_t *dst_stack, const H5E_stack_t *src_stack) +{ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity checks */ + assert(dst_stack); + assert(src_stack); + + /* Copy the errors from the source stack to the destination stack */ + for (u = 0; u < src_stack->nused; u++) { + /* Copy error stack entry */ + if (H5E__copy_stack_entry(&dst_stack->entries[dst_stack->nused], &src_stack->entries[u]) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set error entry"); + + /* Increment # of errors in destination stack */ + dst_stack->nused++; + + /* Check for destination stack full */ + if (dst_stack->nused >= H5E_MAX_ENTRIES) + break; + } /* end for */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5E__append_stack() */ + +/*-------------------------------------------------------------------------- + * Function: H5E__set_default_auto + * + * Purpose: Initialize "automatic" error stack reporting info to library + * default + * + * Return: SUCCEED/FAIL + * + *-------------------------------------------------------------------------- + */ +void +H5E__set_default_auto(H5E_stack_t *stk) +{ + FUNC_ENTER_PACKAGE_NOERR + +#ifndef H5_NO_DEPRECATED_SYMBOLS +#ifdef H5_USE_16_API_DEFAULT + stk->auto_op.vers = 1; +#else /* H5_USE_16_API */ + stk->auto_op.vers = 2; +#endif /* H5_USE_16_API_DEFAULT */ + + stk->auto_op.func1 = stk->auto_op.func1_default = (H5E_auto1_t)H5Eprint1; + stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5E__print2; + stk->auto_op.is_default = true; +#else /* H5_NO_DEPRECATED_SYMBOLS */ + stk->auto_op.func2 = (H5E_auto2_t)H5E__print2; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + stk->auto_data = NULL; + + FUNC_LEAVE_NOAPI_VOID +} /* end H5E__set_default_auto() */ + /*------------------------------------------------------------------------- * Function: H5E__get_msg * @@ -171,15 +925,15 @@ H5E__get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size) static herr_t H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) { - H5E_print_t *eprint = (H5E_print_t *)client_data; - FILE *stream; /* I/O stream to print output to */ - H5E_cls_t *cls_ptr; /* Pointer to error class */ - H5E_msg_t *maj_ptr; /* Pointer to major error info */ - H5E_msg_t *min_ptr; /* Pointer to minor error info */ - const char *maj_str = "No major description"; /* Major error description */ - const char *min_str = "No minor description"; /* Minor error description */ - unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */ - herr_t ret_value = SUCCEED; + H5E_print_t *eprint = (H5E_print_t *)client_data; + FILE *stream; /* I/O stream to print output to */ + const H5E_cls_t *cls_ptr; /* Pointer to error class */ + H5E_msg_t *maj_ptr; /* Pointer to major error info */ + H5E_msg_t *min_ptr; /* Pointer to minor error info */ + const char *maj_str = "No major description"; /* Major error description */ + const char *min_str = "No minor description"; /* Minor error description */ + bool have_desc = true; /* Flag to indicate whether the error has a "real" description */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE_NOERR @@ -250,7 +1004,7 @@ H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) /* Check for "real" error description - used to format output more nicely */ if (err_desc->desc == NULL || strlen(err_desc->desc) == 0) - have_desc = 0; + have_desc = false; /* Print error message */ fprintf(stream, "%*s#%03d: %s line %u in %s()%s%s\n", H5E_INDENT, "", n, err_desc->file_name, @@ -301,7 +1055,7 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) H5E_msg_t *min_ptr; /* Pointer to minor error info */ const char *maj_str = "No major description"; /* Major error description */ const char *min_str = "No minor description"; /* Minor error description */ - unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */ + bool have_desc = true; /* Flag to indicate whether the error has a "real" description */ herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE_NOERR @@ -378,7 +1132,7 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) /* Check for "real" error description - used to format output more nicely */ if (err_desc->desc == NULL || strlen(err_desc->desc) == 0) - have_desc = 0; + have_desc = false; /* Print error message */ fprintf(stream, "%*s#%03u: %s line %u in %s()%s%s\n", H5E_INDENT, "", n, err_desc->file_name, @@ -404,7 +1158,7 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) *------------------------------------------------------------------------- */ herr_t -H5E__print(const H5E_t *estack, FILE *stream, bool bk_compatible) +H5E__print(const H5E_stack_t *estack, FILE *stream, bool bk_compatible) { H5E_print_t eprint; /* Callback information to pass to H5E_walk() */ H5E_walk_op_t walk_op; /* Error stack walking callback */ @@ -474,7 +1228,7 @@ H5E__print(const H5E_t *estack, FILE *stream, bool bk_compatible) *------------------------------------------------------------------------- */ herr_t -H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op, void *client_data) +H5E__walk(const H5E_stack_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op, void *client_data) { int i; /* Local index variable */ herr_t ret_value = H5_ITER_CONT; /* Return value */ @@ -499,12 +1253,12 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o if (H5E_WALK_UPWARD == direction) { for (i = 0; i < (int)estack->nused && ret_value == H5_ITER_CONT; i++) { /* Point to each error record on the stack and pass it to callback function.*/ - old_err.maj_num = estack->slot[i].maj_num; - old_err.min_num = estack->slot[i].min_num; - old_err.func_name = estack->slot[i].func_name; - old_err.file_name = estack->slot[i].file_name; - old_err.desc = estack->slot[i].desc; - old_err.line = estack->slot[i].line; + old_err.maj_num = estack->entries[i].err.maj_num; + old_err.min_num = estack->entries[i].err.min_num; + old_err.file_name = estack->entries[i].err.file_name; + old_err.func_name = estack->entries[i].err.func_name; + old_err.line = estack->entries[i].err.line; + old_err.desc = estack->entries[i].err.desc; ret_value = (op->u.func1)(i, &old_err, client_data); } /* end for */ @@ -513,12 +1267,12 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int); for (i = (int)(estack->nused - 1); i >= 0 && ret_value == H5_ITER_CONT; i--) { /* Point to each error record on the stack and pass it to callback function.*/ - old_err.maj_num = estack->slot[i].maj_num; - old_err.min_num = estack->slot[i].min_num; - old_err.func_name = estack->slot[i].func_name; - old_err.file_name = estack->slot[i].file_name; - old_err.desc = estack->slot[i].desc; - old_err.line = estack->slot[i].line; + old_err.maj_num = estack->entries[i].err.maj_num; + old_err.min_num = estack->entries[i].err.min_num; + old_err.file_name = estack->entries[i].err.file_name; + old_err.func_name = estack->entries[i].err.func_name; + old_err.line = estack->entries[i].err.line; + old_err.desc = estack->entries[i].err.desc; ret_value = (op->u.func1)((int)(estack->nused - (size_t)(i + 1)), &old_err, client_data); } /* end for */ @@ -537,13 +1291,13 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o ret_value = SUCCEED; if (H5E_WALK_UPWARD == direction) { for (i = 0; i < (int)estack->nused && ret_value == H5_ITER_CONT; i++) - ret_value = (op->u.func2)((unsigned)i, estack->slot + i, client_data); + ret_value = (op->u.func2)((unsigned)i, &estack->entries[i].err, client_data); } /* end if */ else { H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int); for (i = (int)(estack->nused - 1); i >= 0 && ret_value == H5_ITER_CONT; i--) - ret_value = (op->u.func2)((unsigned)(estack->nused - (size_t)(i + 1)), estack->slot + i, - client_data); + ret_value = (op->u.func2)((unsigned)(estack->nused - (size_t)(i + 1)), + &estack->entries[i].err, client_data); } /* end else */ if (ret_value < 0) @@ -567,7 +1321,7 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o *------------------------------------------------------------------------- */ herr_t -H5E__get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data) +H5E__get_auto(const H5E_stack_t *estack, H5E_auto_op_t *op, void **client_data) { FUNC_ENTER_PACKAGE_NOERR @@ -603,7 +1357,7 @@ H5E__get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data) *------------------------------------------------------------------------- */ herr_t -H5E__set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data) +H5E__set_auto(H5E_stack_t *estack, const H5E_auto_op_t *op, void *client_data) { FUNC_ENTER_PACKAGE_NOERR @@ -626,11 +1380,10 @@ H5E__set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data) *------------------------------------------------------------------------- */ herr_t -H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned line, hid_t cls_id, hid_t maj_id, - hid_t min_id, const char *fmt, ...) +H5E_printf_stack(const char *file, const char *func, unsigned line, hid_t maj_id, hid_t min_id, + const char *fmt, ...) { va_list ap; /* Varargs info */ - char *tmp = NULL; /* Buffer to place formatted description in */ bool va_started = false; /* Whether the variable argument list is open */ herr_t ret_value = SUCCEED; /* Return value */ @@ -644,9 +1397,8 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - assert(cls_id > 0); - assert(maj_id > 0); - assert(min_id > 0); + assert(maj_id >= H5E_first_maj_id_g && maj_id <= H5E_last_maj_id_g); + assert(min_id >= H5E_first_min_id_g && min_id <= H5E_last_min_id_g); assert(fmt); /* Note that the variable-argument parsing for the format is identical in @@ -658,22 +1410,13 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin va_start(ap, fmt); va_started = true; - /* Use the vasprintf() routine, since it does what we're trying to do below */ - if (HDvasprintf(&tmp, fmt, ap) < 0) - HGOTO_DONE(FAIL); - /* Push the error on the stack */ - if (H5E__push_stack(estack, file, func, line, cls_id, maj_id, min_id, tmp) < 0) + if (H5E__push_stack(NULL, false, file, func, line, H5E_ERR_CLS_g, maj_id, min_id, fmt, &ap) < 0) HGOTO_DONE(FAIL); done: if (va_started) va_end(ap); - /* Memory was allocated with HDvasprintf so it needs to be freed - * with free - */ - if (tmp) - free(tmp); FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_printf_stack() */ @@ -696,8 +1439,8 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin *------------------------------------------------------------------------- */ herr_t -H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line, hid_t cls_id, hid_t maj_id, - hid_t min_id, const char *desc) +H5E__push_stack(H5E_stack_t *estack, bool app_entry, const char *file, const char *func, unsigned line, + hid_t cls_id, hid_t maj_id, hid_t min_id, const char *fmt, va_list *ap) { herr_t ret_value = SUCCEED; /* Return value */ @@ -723,9 +1466,10 @@ H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line /* * Push the error if there's room. Otherwise just forget it. */ - if (estack->nused < H5E_NSLOTS) { - if (H5E__set_stack_entry(&estack->slot[estack->nused], file, func, line, cls_id, maj_id, min_id, - desc) < 0) + if (estack->nused < H5E_MAX_ENTRIES) { + estack->entries[estack->nused].app_entry = app_entry; + if (H5E__set_stack_entry(&estack->entries[estack->nused].err, file, func, line, cls_id, maj_id, + min_id, fmt, ap) < 0) HGOTO_DONE(FAIL); estack->nused++; } /* end if */ @@ -734,6 +1478,56 @@ H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line FUNC_LEAVE_NOAPI(ret_value) } /* end H5E__push_stack() */ +/*------------------------------------------------------------------------- + * Function: H5E__copy_stack_entry + * + * Purpose: Copy a stack entry + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5E__copy_stack_entry(H5E_entry_t *dst_entry, const H5E_entry_t *src_entry) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + assert(dst_entry); + assert(src_entry); + + /* Shallow copy all fields */ + *dst_entry = *src_entry; + + /* Deep copy application entries */ + if (dst_entry->app_entry) { + /* Note: don't waste time incrementing library internal error IDs */ + if (dst_entry->err.cls_id != H5E_ERR_CLS_g) + if (H5I_inc_ref(dst_entry->err.cls_id, false) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error class"); + if (dst_entry->err.maj_num < H5E_first_maj_id_g || dst_entry->err.maj_num > H5E_last_maj_id_g) + if (H5I_inc_ref(dst_entry->err.maj_num, false) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error message"); + if (dst_entry->err.min_num < H5E_first_min_id_g || dst_entry->err.min_num > H5E_last_min_id_g) + if (H5I_inc_ref(dst_entry->err.min_num, false) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error message"); + /* The library's 'func' & 'file' strings are statically allocated (by the compiler) + * there's no need to duplicate them. + */ + if (NULL == (dst_entry->err.file_name = strdup(src_entry->err.file_name))) + HGOTO_ERROR(H5E_ERROR, H5E_CANTCOPY, FAIL, "unable to duplicate file name"); + if (NULL == (dst_entry->err.func_name = strdup(src_entry->err.func_name))) + HGOTO_ERROR(H5E_ERROR, H5E_CANTCOPY, FAIL, "unable to duplicate function name"); + } + if (NULL == (dst_entry->err.desc = strdup(src_entry->err.desc))) + HGOTO_ERROR(H5E_ERROR, H5E_CANTCOPY, FAIL, "unable to duplicate error description"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5E__copy_stack_entry() */ + /*------------------------------------------------------------------------- * Function: H5E__set_stack_entry * @@ -743,9 +1537,9 @@ H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5E__set_stack_entry(H5E_error2_t *err_entry, const char *file, const char *func, unsigned line, hid_t cls_id, - hid_t maj_id, hid_t min_id, const char *desc) + hid_t maj_id, hid_t min_id, const char *fmt, va_list *ap) { herr_t ret_value = SUCCEED; /* Return value */ @@ -772,31 +1566,40 @@ H5E__set_stack_entry(H5E_error2_t *err_entry, const char *file, const char *func func = "Unknown_Function"; if (!file) file = "Unknown_File"; - if (!desc) - desc = "No description given"; + if (!fmt) + fmt = "No description given"; - /* Increment the IDs to indicate that they are used in this stack */ - /* Note: don't waste time incrementing library internal error IDs */ - if (cls_id != H5E_ERR_CLS_g) - if (H5I_inc_ref_noherr(cls_id, false) < 0) - HGOTO_DONE(FAIL); - err_entry->cls_id = cls_id; - if (maj_id < H5E_first_maj_id_g || maj_id > H5E_last_maj_id_g) - if (H5I_inc_ref_noherr(maj_id, false) < 0) - HGOTO_DONE(FAIL); + /* Set the entry fields */ + /* NOTE: non-library IDs have already been incremented */ + err_entry->cls_id = cls_id; err_entry->maj_num = maj_id; - if (min_id < H5E_first_min_id_g || min_id > H5E_last_min_id_g) - if (H5I_inc_ref_noherr(min_id, false) < 0) - HGOTO_DONE(FAIL); err_entry->min_num = min_id; - /* The 'func' & 'file' strings are statically allocated (by the compiler) - * there's no need to duplicate them. + /* The 'func' & 'file' strings are either statically allocated (by the + * compiler), for internal error messages, or have already been duplicated, + * for application errors, so there's no need to duplicate them here. */ err_entry->func_name = func; err_entry->file_name = file; err_entry->line = line; - if (NULL == (err_entry->desc = strdup(desc))) - HGOTO_DONE(FAIL); + if (ap) { + char *desc = NULL; + + /* GCC complains about the 'fmt' parameter, but it's either from static + * strings in the library, which we know are OK, or from application + * error push calls, and the application should be sanity checking their + * strings. + */ + H5_GCC_CLANG_DIAG_OFF("format-nonliteral") + if (HDvasprintf(&desc, fmt, *ap) < 0) + HGOTO_DONE(FAIL); + H5_GCC_CLANG_DIAG_ON("format-nonliteral") + + err_entry->desc = desc; + } + else { + if (NULL == (err_entry->desc = strdup(fmt))) + HGOTO_DONE(FAIL); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -813,11 +1616,10 @@ H5E__set_stack_entry(H5E_error2_t *err_entry, const char *file, const char *func *------------------------------------------------------------------------- */ static herr_t -H5E__clear_entries(H5E_t *estack, size_t nentries) +H5E__clear_entries(H5E_stack_t *estack, size_t nentries) { - H5E_error2_t *error; /* Pointer to error stack entry to clear */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -827,29 +1629,34 @@ H5E__clear_entries(H5E_t *estack, size_t nentries) /* Empty the error stack from the top down */ for (u = 0; nentries > 0; nentries--, u++) { - error = &(estack->slot[estack->nused - (u + 1)]); + H5E_entry_t *error; /* Pointer to error stack entry to clear */ + + error = &(estack->entries[estack->nused - (u + 1)]); /* Decrement the IDs to indicate that they are no longer used by this stack */ /* (In reverse order that they were incremented, so that reference counts work well) */ /* Note: don't decrement library internal error IDs, since they weren't incremented */ - if (error->min_num < H5E_first_min_id_g || error->min_num > H5E_last_min_id_g) - if (H5I_dec_ref(error->min_num) < 0) + if (error->err.min_num < H5E_first_min_id_g || error->err.min_num > H5E_last_min_id_g) + if (H5I_dec_ref(error->err.min_num) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error message"); - if (error->maj_num < H5E_first_maj_id_g || error->maj_num > H5E_last_maj_id_g) - if (H5I_dec_ref(error->maj_num) < 0) + if (error->err.maj_num < H5E_first_maj_id_g || error->err.maj_num > H5E_last_maj_id_g) + if (H5I_dec_ref(error->err.maj_num) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error message"); - if (error->cls_id != H5E_ERR_CLS_g) - if (H5I_dec_ref(error->cls_id) < 0) + if (error->err.cls_id != H5E_ERR_CLS_g) + if (H5I_dec_ref(error->err.cls_id) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error class"); /* Release strings */ - /* The 'func' & 'file' strings are statically allocated (by the compiler) - * and are not allocated, so there's no need to free them. + /* The library's 'func' & 'file' strings are statically allocated (by the + * compiler) and are not allocated, so there's no need to free them. */ - error->func_name = NULL; - error->file_name = NULL; - if (error->desc) - error->desc = (const char *)H5MM_xfree_const(error->desc); + if (error->app_entry) { + H5MM_xfree_const(error->err.file_name); + H5MM_xfree_const(error->err.func_name); + } + error->err.file_name = NULL; + error->err.func_name = NULL; + error->err.desc = (const char *)H5MM_xfree_const(error->err.desc); } /* Decrement number of errors on stack */ @@ -862,34 +1669,61 @@ H5E__clear_entries(H5E_t *estack, size_t nentries) /*------------------------------------------------------------------------- * Function: H5E_clear_stack * - * Purpose: Private function to clear the error stack for the - * specified error stack. + * Purpose: Clear the default error stack * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5E_clear_stack(H5E_t *estack) +H5E_clear_stack(void) { - herr_t ret_value = SUCCEED; /* Return value */ + H5E_stack_t *estack; /* Error stack to clear */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) + /* Get 'default' error stack */ + if (NULL == (estack = H5E__get_my_stack())) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); + + /* Empty the error stack */ + if (H5E__clear_entries(estack, estack->nused) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5E_clear_stack() */ + +/*------------------------------------------------------------------------- + * Function: H5E__clear_stack + * + * Purpose: Clear the specified error stack + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5E__clear_stack(H5E_stack_t *estack) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + /* Check for 'default' error stack */ if (estack == NULL) if (NULL == (estack = H5E__get_my_stack())) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); /* Empty the error stack */ - assert(estack); if (estack->nused) if (H5E__clear_entries(estack, estack->nused) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack"); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_clear_stack() */ +} /* end H5E__clear_stack() */ /*------------------------------------------------------------------------- * Function: H5E__pop @@ -902,7 +1736,7 @@ H5E_clear_stack(H5E_t *estack) *------------------------------------------------------------------------- */ herr_t -H5E__pop(H5E_t *estack, size_t count) +H5E__pop(H5E_stack_t *estack, size_t count) { herr_t ret_value = SUCCEED; /* Return value */ @@ -934,8 +1768,8 @@ H5E__pop(H5E_t *estack, size_t count) herr_t H5E_dump_api_stack(void) { - H5E_t *estack = H5E__get_my_stack(); - herr_t ret_value = SUCCEED; /* Return value */ + H5E_stack_t *estack = H5E__get_my_stack(); + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOERR diff --git a/src/H5Epkg.h b/src/H5Epkg.h index 48373f4d974..2d950ca3d7b 100644 --- a/src/H5Epkg.h +++ b/src/H5Epkg.h @@ -34,8 +34,8 @@ /* Amount to indent each error */ #define H5E_INDENT 2 -/* Number of slots in an error stack */ -#define H5E_NSLOTS 32 +/* Number of entries in an error stack */ +#define H5E_MAX_ENTRIES 32 #ifdef H5_HAVE_THREADSAFE /* @@ -45,7 +45,7 @@ * be handled by the pthread library. * * In order for this macro to work, H5E__get_my_stack() must be preceded - * by "H5E_t *estack =". + * by "H5E_stack_t *estack =". */ #define H5E__get_my_stack() H5E__get_stack() #else /* H5_HAVE_THREADSAFE */ @@ -88,25 +88,33 @@ typedef struct { /* Error class */ typedef struct H5E_cls_t { - char *cls_name; /* Name of error class */ - char *lib_name; /* Name of library within class */ - char *lib_vers; /* Version of library */ + bool app_cls; /* Whether the class came from app */ + const char *cls_name; /* Name of error class */ + const char *lib_name; /* Name of library within class */ + const char *lib_vers; /* Version of library */ } H5E_cls_t; /* Major or minor message */ typedef struct H5E_msg_t { - char *msg; /* Message for error */ - H5E_type_t type; /* Type of error (major or minor) */ - H5E_cls_t *cls; /* Which error class this message belongs to */ + bool app_msg; /* Whether the message came from app */ + const char *msg; /* Message for error */ + H5E_type_t type; /* Type of error (major or minor) */ + const H5E_cls_t *cls; /* Which error class this message belongs to */ } H5E_msg_t; +/* Error stack entry */ +typedef struct H5E_entry_t { + bool app_entry; /* Whether the entry came from app */ + H5E_error2_t err; /* Error entry */ +} H5E_entry_t; + /* Error stack */ -struct H5E_t { - size_t nused; /* Num slots currently used in stack */ - H5E_error2_t slot[H5E_NSLOTS]; /* Array of error records */ - H5E_auto_op_t auto_op; /* Operator for 'automatic' error reporting */ - void *auto_data; /* Callback data for 'automatic error reporting */ -}; +typedef struct H5E_stack_t { + size_t nused; /* Num entries currently on stack */ + H5E_entry_t entries[H5E_MAX_ENTRIES]; /* Array of error entries */ + H5E_auto_op_t auto_op; /* Operator for 'automatic' error reporting */ + void *auto_data; /* Callback data for 'automatic error reporting */ +} H5E_stack_t; /*****************************/ /* Package Private Variables */ @@ -116,7 +124,7 @@ struct H5E_t { /* * The current error stack. */ -H5_DLLVAR H5E_t H5E_stack_g[1]; +H5_DLLVAR H5E_stack_t H5E_stack_g[1]; #endif /* First & last major and minor error codes registered by the library */ @@ -128,20 +136,28 @@ H5_DLLVAR hid_t H5E_last_min_id_g; /******************************/ /* Package Private Prototypes */ /******************************/ -H5_DLL herr_t H5E__term_deprec_interface(void); #ifdef H5_HAVE_THREADSAFE -H5_DLL H5E_t *H5E__get_stack(void); +H5_DLL H5E_stack_t *H5E__get_stack(void); #endif /* H5_HAVE_THREADSAFE */ -H5_DLL herr_t H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line, hid_t cls_id, - hid_t maj_id, hid_t min_id, const char *desc); -H5_DLL herr_t H5E__set_stack_entry(H5E_error2_t *err_entry, const char *file, const char *func, unsigned line, - hid_t cls_id, hid_t maj_id, hid_t min_id, const char *desc); -H5_DLL ssize_t H5E__get_msg(const H5E_msg_t *msg_ptr, H5E_type_t *type, char *msg, size_t size); -H5_DLL herr_t H5E__print(const H5E_t *estack, FILE *stream, bool bk_compat); -H5_DLL herr_t H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op, - void *client_data); -H5_DLL herr_t H5E__get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data); -H5_DLL herr_t H5E__set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data); -H5_DLL herr_t H5E__pop(H5E_t *err_stack, size_t count); +H5_DLL H5E_cls_t *H5E__register_class(const char *cls_name, const char *lib_name, const char *version); +H5_DLL ssize_t H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size); +H5_DLL H5E_msg_t *H5E__create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg); +H5_DLL ssize_t H5E__get_msg(const H5E_msg_t *msg_ptr, H5E_type_t *type, char *msg, size_t size); +H5_DLL void H5E__set_default_auto(H5E_stack_t *stk); +H5_DLL H5E_stack_t *H5E__get_current_stack(void); +H5_DLL herr_t H5E__set_current_stack(H5E_stack_t *estack); +H5_DLL ssize_t H5E__get_num(const H5E_stack_t *err_stack); +H5_DLL herr_t H5E__push_stack(H5E_stack_t *estack, bool app_entry, const char *file, const char *func, + unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *fmt, + va_list *ap); +H5_DLL herr_t H5E__print(const H5E_stack_t *estack, FILE *stream, bool bk_compat); +H5_DLL herr_t H5E__print2(hid_t err_stack, FILE *stream); +H5_DLL herr_t H5E__walk(const H5E_stack_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op, + void *client_data); +H5_DLL herr_t H5E__get_auto(const H5E_stack_t *estack, H5E_auto_op_t *op, void **client_data); +H5_DLL herr_t H5E__set_auto(H5E_stack_t *estack, const H5E_auto_op_t *op, void *client_data); +H5_DLL herr_t H5E__pop(H5E_stack_t *err_stack, size_t count); +H5_DLL herr_t H5E__append_stack(H5E_stack_t *dst_estack, const H5E_stack_t *src_stack); +H5_DLL herr_t H5E__clear_stack(H5E_stack_t *estack); #endif /* H5Epkg_H */ diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index fd86e96806b..3777805aeb9 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -21,9 +21,6 @@ /* Private headers needed by this file */ #include "H5private.h" -/* Typedef for error stack (defined in H5Epkg.h) */ -typedef struct H5E_t H5E_t; - /* * HERROR macro, used to facilitate error reporting between a FUNC_ENTER() * and a FUNC_LEAVE() within a function body. The arguments are the major @@ -31,7 +28,7 @@ typedef struct H5E_t H5E_t; */ #define HERROR(maj_id, min_id, ...) \ do { \ - H5E_printf_stack(NULL, __FILE__, __func__, __LINE__, H5E_ERR_CLS_g, maj_id, min_id, __VA_ARGS__); \ + H5E_printf_stack(__FILE__, __func__, __LINE__, maj_id, min_id, __VA_ARGS__); \ } while (0) /* @@ -185,9 +182,9 @@ extern int H5E_mpi_error_str_len; /* Library-private functions defined in H5E package */ H5_DLL herr_t H5E_init(void); -H5_DLL herr_t H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned line, hid_t cls_id, - hid_t maj_id, hid_t min_id, const char *fmt, ...) H5_ATTR_FORMAT(printf, 8, 9); -H5_DLL herr_t H5E_clear_stack(H5E_t *estack); +H5_DLL herr_t H5E_printf_stack(const char *file, const char *func, unsigned line, hid_t maj_idx, + hid_t min_idx, const char *fmt, ...) H5_ATTR_FORMAT(printf, 6, 7); +H5_DLL herr_t H5E_clear_stack(void); H5_DLL herr_t H5E_dump_api_stack(void); #endif /* H5Eprivate_H */ diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 22efa901812..49fd484a4eb 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -779,7 +779,7 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad if (!file->memb[file->nmembs]) { if (0 == file->nmembs) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open member file"); - H5E_clear_stack(NULL); + H5E_clear_stack(); break; } file->nmembs++; @@ -1497,7 +1497,7 @@ H5FD__family_delete(const char *filename, hid_t fapl_id) if (0 == current_member) HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete member file"); else - H5E_clear_stack(NULL); + H5E_clear_stack(); break; } current_member++; diff --git a/src/H5FDonion.c b/src/H5FDonion.c index 45a90de9165..f1b46d83ada 100644 --- a/src/H5FDonion.c +++ b/src/H5FDonion.c @@ -468,7 +468,7 @@ H5FD__onion_commit_new_revision_record(H5FD_onion_t *file) if ((true == file->is_open_rw) && (H5FD__onion_merge_revision_index_into_archival_index( file->rev_index, &file->curr_rev_record.archival_index) < 0)) - HGOTO_ERROR(H5E_VFL, H5E_INTERNAL, FAIL, "unable to update index to write"); + HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to update index to write"); if (NULL == (buf = H5MM_malloc(H5FD_ONION_ENCODED_SIZE_REVISION_RECORD + (size_t)rec->comment_size + (H5FD_ONION_ENCODED_SIZE_INDEX_ENTRY * rec->archival_index.n_entries)))) diff --git a/src/H5Fint.c b/src/H5Fint.c index 45ded824a7e..3c3c4cb8dd3 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -859,7 +859,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c char *ptr; /* Reset the error stack */ - H5E_clear_stack(NULL); + H5E_clear_stack(); /* Get last component of file_name */ H5_GET_LAST_DELIMITER(file_name, ptr) @@ -880,7 +880,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Adjust temporary file name if file not opened */ if (NULL == src_file) { /* Reset the error stack */ - H5E_clear_stack(NULL); + H5E_clear_stack(); /* Strip ":" */ strncpy(temp_file_name, &file_name[2], temp_file_name_len); @@ -928,11 +928,11 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Check for file not opened */ if (NULL == src_file) /* Reset the error stack */ - H5E_clear_stack(NULL); + H5E_clear_stack(); /* Leave if file was opened */ else break; - H5E_clear_stack(NULL); + H5E_clear_stack(); } /* end if */ } /* end while */ @@ -955,7 +955,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Check for file not opened */ if (NULL == src_file) /* Reset the error stack */ - H5E_clear_stack(NULL); + H5E_clear_stack(); } /* end if */ /* Try searching from main file's "extpath": see description in H5F_open() & H5_build_extpath() */ @@ -976,7 +976,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Check for file not opened */ if (NULL == src_file) /* Reset the error stack */ - H5E_clear_stack(NULL); + H5E_clear_stack(); } /* end if */ } /* end if */ @@ -988,7 +988,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Check for file not opened */ if (NULL == src_file) /* Reset the error stack */ - H5E_clear_stack(NULL); + H5E_clear_stack(); } /* end if */ /* try the 'resolved' name for the virtual file */ @@ -1019,7 +1019,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Check for file not opened */ if (NULL == src_file) /* Reset the error stack */ - H5E_clear_stack(NULL); + H5E_clear_stack(); } /* end if */ /* Set return value (possibly NULL or valid H5F_t *) */ @@ -1893,7 +1893,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) */ if ((tent_flags == flags) || (lf == NULL)) { if (tent_flags != flags) { - H5E_clear_stack(NULL); + H5E_clear_stack(); tent_flags = flags; } diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 7e12ff111d0..06d13ebffdd 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -131,6 +131,10 @@ (H5F_SUPERBLOCK_FIXED_SIZE + \ H5F_SUPERBLOCK_VARLEN_SIZE((s)->super_vers, (s)->sizeof_addr, (s)->sizeof_size)) +/* Optimistic read size for superblock */ +/* Size of a v2+ superblock, w/8-byte addresses & lengths */ +#define H5F_SUPERBLOCK_SPEC_READ_SIZE (H5F_SUPERBLOCK_FIXED_SIZE + H5F_SUPERBLOCK_VARLEN_SIZE(2, 8, 8)) + /* For superblock version 0 & 1: Offset to the file consistency flags (status_flags) in the superblock (excluding H5F_SUPERBLOCK_FIXED_SIZE) */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 3e5bc9a3a2b..b42240dfb11 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -415,8 +415,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, bool initial_read) HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "can't get property list"); /* Make certain we can read the fixed-size portion of the superblock */ - if (H5F__set_eoa(f, H5FD_MEM_SUPER, - (haddr_t)(H5F_SUPERBLOCK_FIXED_SIZE + H5F_SUPERBLOCK_MINIMAL_VARLEN_SIZE)) < 0) + if (H5F__set_eoa(f, H5FD_MEM_SUPER, (haddr_t)H5F_SUPERBLOCK_SPEC_READ_SIZE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "set end of space allocation request failed"); /* Set up the user data for cache callbacks */ @@ -582,13 +581,10 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, bool initial_read) if (H5F_INTENT(f) & H5F_ACC_SWMR_READ) { /* - * When the file is opened for SWMR read access, skip the check if: - * --the file is already marked for SWMR writing and - * --the file has version 3 superblock for SWMR support + * When the file is opened for SWMR read access, skip the check if + * the file has a version 3 superblock capable of SWMR support */ - if ((sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS) && - (sblock->status_flags & H5F_SUPER_WRITE_ACCESS) && - sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_3) + if (sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_3) skip_eof_check = true; } if (!skip_eof_check && initial_read) { diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 9c475ab26a2..2a425099b47 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -306,8 +306,7 @@ H5F__cache_superblock_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t assert(image_len); /* Set the initial image length size */ - *image_len = H5F_SUPERBLOCK_FIXED_SIZE + /* Fixed size of superblock */ - H5F_SUPERBLOCK_MINIMAL_VARLEN_SIZE; + *image_len = H5F_SUPERBLOCK_SPEC_READ_SIZE; FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5F__cache_superblock_get_initial_load_size() */ diff --git a/src/H5Gint.c b/src/H5Gint.c index 34072df90e6..a7268adcbba 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -439,7 +439,7 @@ H5G_open(const H5G_loc_t *loc) if ((shared_fo = (H5G_shared_t *)H5FO_opened(grp->oloc.file, grp->oloc.addr)) == NULL) { /* Clear any errors from H5FO_opened() */ - H5E_clear_stack(NULL); + H5E_clear_stack(); /* Open the group object */ if (H5G__open_oid(grp) < 0) @@ -506,7 +506,8 @@ static herr_t H5G__open_oid(H5G_t *grp) { bool obj_opened = false; - herr_t ret_value = SUCCEED; + htri_t msg_exists; + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE @@ -523,8 +524,14 @@ H5G__open_oid(H5G_t *grp) obj_opened = true; /* Check if this object has the right message(s) to be treated as a group */ - if ((H5O_msg_exists(&(grp->oloc), H5O_STAB_ID) <= 0) && (H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID) <= 0)) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "not a group"); + if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check if symbol table message exists"); + if (!msg_exists) { + if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check if link info message exists"); + if (!msg_exists) + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "not a group"); + } done: if (ret_value < 0) { diff --git a/src/H5Gloc.c b/src/H5Gloc.c index 6e9d29845a0..897debcb1bd 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -591,7 +591,7 @@ H5G__loc_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_ if (lnk) *exists = false; else - HGOTO_ERROR(H5E_SYM, H5E_INTERNAL, FAIL, "no object or link info?"); + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "no object or link info?"); else *exists = true; diff --git a/src/H5Gnode.c b/src/H5Gnode.c index f211e74e041..cc45f39b1d6 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -1428,7 +1428,7 @@ H5G_node_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, had if (NULL == (sn = (H5G_node_t *)H5AC_protect(f, H5AC_SNODE, addr, f, H5AC__READ_ONLY_FLAG))) { H5G_bt_common_t udata; /*data to pass through B-tree */ - H5E_clear_stack(NULL); /* discard that error */ + H5E_clear_stack(); /* discard that error */ udata.heap = heap; udata.block_size = H5HL_heap_get_size(heap); if (H5B_debug(f, addr, stream, indent, fwidth, H5B_SNODE, &udata) < 0) diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 1ebd13681b1..6c7e6db8824 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -999,7 +999,7 @@ H5G__stab_valid(H5O_loc_t *grp_oloc, H5O_stab_t *alt_stab) /* Update the symbol table message and clear errors if necessary */ if (changed) { - H5E_clear_stack(NULL); + H5E_clear_stack(); if (H5O_msg_write(grp_oloc, H5O_STAB_ID, 0, H5O_UPDATE_TIME | H5O_UPDATE_FORCE, &stab) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to correct symbol table message"); } /* end if */ diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 00732c3c987..d113b576b18 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -199,7 +199,7 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc /*in,out*/, const H5O_link_t *lnk, H5G /* Check if we just needed to know if the object exists */ if (target & H5G_TARGET_EXISTS) { /* Clear any errors from the stack */ - H5E_clear_stack(NULL); + H5E_clear_stack(); /* Indicate that the object doesn't exist */ *obj_exists = false; diff --git a/src/H5Iint.c b/src/H5Iint.c index 1df3ae907a8..fe3b90c2454 100644 --- a/src/H5Iint.c +++ b/src/H5Iint.c @@ -1230,27 +1230,6 @@ H5I_dec_app_ref_always_close_async(hid_t id, void **token) FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_dec_app_ref_always_close_async() */ -/*------------------------------------------------------------------------- - * Function: H5I_do_inc_ref - * - * Purpose: Helper function for H5I_inc_ref/H5I_inc_ref_noherr to - * actually increment the reference count for an object. - * - * Return: The new reference count (can't fail) - * - *------------------------------------------------------------------------- - */ -static inline int -H5I_do_inc_ref(H5I_id_info_t *info, bool app_ref) -{ - /* Adjust reference counts */ - ++(info->count); - if (app_ref) - ++(info->app_count); - - return (int)(app_ref ? info->app_count : info->count); -} - /*------------------------------------------------------------------------- * Function: H5I_inc_ref * @@ -1276,58 +1255,17 @@ H5I_inc_ref(hid_t id, bool app_ref) if (NULL == (info = H5I__find_id(id))) HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "can't locate ID"); - /* Set return value */ - ret_value = H5I_do_inc_ref(info, app_ref); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_inc_ref() */ - -/*------------------------------------------------------------------------- - * Function: H5I_inc_ref_noherr - * - * Purpose: Increment the reference count for an object. Exactly like - * H5I_inc_ref, except that it makes use of HGOTO_DONE on - * failure instead of HGOTO_ERROR. This function is - * specifically meant to be used in the H5E package, where we - * have to avoid calling any function or macro that may call - * HGOTO_ERROR and similar. Otherwise, we can cause a stack - * overflow that looks like (for example): - * - * H5E_printf_stack() - * H5E__push_stack() - * H5I_inc_ref() - * H5I__find_id() (FAIL) - * HGOTO_ERROR() - * H5E_printf_stack() - * ... - * - * Return: Success: The new reference count - * Failure: -1 - * - *------------------------------------------------------------------------- - */ -int -H5I_inc_ref_noherr(hid_t id, bool app_ref) -{ - H5I_id_info_t *info = NULL; /* Pointer to the ID info */ - int ret_value = 0; /* Return value */ - - FUNC_ENTER_NOAPI_NOERR - - /* Sanity check */ - assert(id >= 0); - - /* General lookup of the ID */ - if (NULL == (info = H5I__find_id(id))) - HGOTO_DONE((-1)); + /* Adjust reference counts */ + ++(info->count); + if (app_ref) + ++(info->app_count); /* Set return value */ - ret_value = H5I_do_inc_ref(info, app_ref); + ret_value = (int)(app_ref ? info->app_count : info->count); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_inc_ref_noherr() */ +} /* end H5I_inc_ref() */ /*------------------------------------------------------------------------- * Function: H5I_get_ref diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h index 83fdacc686f..75a5787b616 100644 --- a/src/H5Iprivate.h +++ b/src/H5Iprivate.h @@ -68,7 +68,6 @@ H5_DLL H5I_type_t H5I_get_type(hid_t id); H5_DLL herr_t H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, bool app_ref); H5_DLL int H5I_get_ref(hid_t id, bool app_ref); H5_DLL int H5I_inc_ref(hid_t id, bool app_ref); -H5_DLL int H5I_inc_ref_noherr(hid_t id, bool app_ref); H5_DLL int H5I_dec_ref(hid_t id); H5_DLL int H5I_dec_app_ref(hid_t id); H5_DLL int H5I_dec_app_ref_async(hid_t id, void **token); diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index d6002046269..6299b7583af 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -1468,7 +1468,7 @@ H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src, H5O_loc_t *oloc_dst /*i if (H5G_loc_find(&dst_root_loc, suggestion->path, &obj_loc /*out*/) < 0) /* Ignore errors - i.e. suggestions not present in * destination file */ - H5E_clear_stack(NULL); + H5E_clear_stack(); else /* Check object and add to skip list if appropriate */ if (H5O__copy_search_comm_dt_check(&obj_oloc, &udata) < 0) { diff --git a/src/H5Odbg.c b/src/H5Odbg.c index 78bace66392..cfdff270e40 100644 --- a/src/H5Odbg.c +++ b/src/H5Odbg.c @@ -87,6 +87,10 @@ H5O__assert(const H5O_t *oh) FUNC_ENTER_PACKAGE_NOERR + assert(oh); + assert(oh->chunk || oh->nchunks == 0); + assert(oh->mesg || oh->nmesgs == 0); + /* Initialize the tracking variables */ hdr_size = 0; meta_space = (size_t)H5O_SIZEOF_HDR(oh) + (size_t)(H5O_SIZEOF_CHKHDR_OH(oh) * (oh->nchunks - 1)); @@ -140,6 +144,8 @@ H5O__assert(const H5O_t *oh) uint8_t H5_ATTR_NDEBUG_UNUSED *curr_hdr; /* Start of current message header */ size_t curr_tot_size; /* Total size of current message (including header) */ + assert(curr_msg->type); + curr_hdr = curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh); curr_tot_size = curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh); diff --git a/src/H5Oint.c b/src/H5Oint.c index cf414a2d407..460ccb63a7b 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -1112,7 +1112,9 @@ H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, bool pin_all_chunks) if (cont_msg_info.msgs) cont_msg_info.msgs = (H5O_cont_t *)H5FL_SEQ_FREE(H5O_cont_t, cont_msg_info.msgs); - if (H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) + /* Unprotect the ohdr and delete it from cache since if we failed to load it it's in an inconsistent + * state */ + if (H5O_unprotect(loc, oh, H5AC__DELETED_FLAG) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header"); } @@ -1233,10 +1235,21 @@ H5O_unprotect(const H5O_loc_t *loc, H5O_t *oh, unsigned oh_flags) } /* end if */ } /* end for */ - /* Reet the flag from the unprotect */ + /* Reset the flag from the unprotect */ oh->chunks_pinned = false; } /* end if */ + /* Remove the other chunks if we're removing the ohdr (due to a failure) */ + if (oh_flags & H5AC__DELETED_FLAG) { + unsigned u; /* Local index variable */ + + /* Iterate over chunks > 0 */ + for (u = 1; u < oh->nchunks; u++) + /* Expunge chunk proxy from cache */ + if (H5AC_expunge_entry(loc->file, H5AC_OHDR_CHK, oh->chunk[u].addr, H5AC__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to expunge object header chunk"); + } /* end if */ + /* Unprotect the object header */ if (H5AC_unprotect(loc->file, H5AC_OHDR, oh->chunk[0].addr, oh, oh_flags) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); @@ -1600,7 +1613,7 @@ H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type) /* Look up class for object header */ if (NULL == (obj_class = H5O__obj_class_real(oh))) { /* Clear error stack from "failed" class lookup */ - H5E_clear_stack(NULL); + H5E_clear_stack(); /* Set type to "unknown" */ *obj_type = H5O_TYPE_UNKNOWN; diff --git a/src/H5Opublic.h b/src/H5Opublic.h index 23c4e4eb59b..28954d4cb45 100644 --- a/src/H5Opublic.h +++ b/src/H5Opublic.h @@ -234,7 +234,7 @@ extern "C" { * \param[in] name Path to the object; relative to \p loc_id * \lapl_id * - * \return \hid_tv{object} + * \return \hid_ti{object} * * \details H5Oopen() opens a group, dataset, or committed (named) datatype * specified by a location, \p loc_id, and a path name, \p name, in an HDF5 file. @@ -311,7 +311,7 @@ H5_DLL hid_t H5Oopen_by_token(hid_t loc_id, H5O_token_t token); * \param[in] n Object to open * \lapl_id * - * \return \hid_tv{object} + * \return \hid_ti{object} * * \details H5Oopen_by_idx() opens the nth object in the group specified by \p loc_id * and \p group_name. @@ -1769,7 +1769,7 @@ typedef herr_t (*H5O_iterate1_t)(hid_t obj, const char *name, const H5O_info1_t * \fgdta_loc_obj_id{loc_id} * \param[in] addr Object's address in the file * - * \return \hid_tv{object} + * \return \hid_ti{object} * * \deprecated As of HDF5-1.12 this function has been deprecated in favor of * the function H5Oopen_by_token(). diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 13688ce6f15..0f05977cec3 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -882,7 +882,7 @@ H5_DLL hid_t H5Pcreate_class(hid_t parent, const char *name, H5P_cls_create_func * * \param[in] buf Buffer holding the encoded property list * - * \return \hid_tv{object} + * \return \hid_ti{object} * * \details Given a binary property list description in a buffer, H5Pdecode() * reconstructs the HDF5 property list and returns an identifier diff --git a/src/H5SM.c b/src/H5SM.c index 5179a285ee9..94f2ea534fc 100644 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -944,7 +944,7 @@ H5SM_can_share(H5F_t *f, H5SM_master_table_t *table, ssize_t *sohm_index_num, un * then this type of message isn't shareable */ if ((index_num = H5SM__get_index(my_table, type_id)) < 0) { - H5E_clear_stack(NULL); /*ignore error*/ + H5E_clear_stack(); /*ignore error*/ HGOTO_DONE(false); } /* end if */ @@ -1337,9 +1337,9 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, bool def found = true; } /* end if */ else - H5E_clear_stack(NULL); /*ignore error*/ - } /* end else */ - } /* end else */ + H5E_clear_stack(); /*ignore error*/ + } /* end else */ + } /* end else */ if (found) { /* If the message was found, it's shared in the heap (now). Set up a diff --git a/src/H5Spublic.h b/src/H5Spublic.h index a05b8c56437..3697374d49c 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -179,7 +179,7 @@ H5_DLL herr_t H5Sclose(hid_t space_id); * \param[in] count Number of blocks included in the hyperslab * \param[in] block Size of a block in the hyperslab * - * \return \hid_tv{dataspace} + * \return \hid_t{dataspace} * * \details H5Scombine_hyperslab() combines a hyperslab selection specified * by \p start, \p stride, \p count and \p block with the current @@ -224,7 +224,7 @@ H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_i * * \space_id * - * \return \hid_tv{dataspace} + * \return \hid_t{dataspace} * * \details H5Scopy() creates a new dataspace which is an exact copy of the * dataspace identified by \p space_id. The dataspace identifier diff --git a/src/H5T.c b/src/H5T.c index 7d63d003e27..3e0c0b75072 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -2724,14 +2724,14 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_con "unable to decrement reference count on temporary ID"); tmp_sid = tmp_did = H5I_INVALID_HID; tmp_stype = tmp_dtype = NULL; - if (H5E_clear_stack(NULL) < 0) + if (H5E_clear_stack() < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRESET, FAIL, "unable to clear current error stack"); continue; } /* end if */ } /* end if */ else if ((conv->u.lib_func)(old_path->src, old_path->dst, &cdata, &conv_ctx, 0, 0, 0, NULL, NULL) < 0) { - if (H5E_clear_stack(NULL) < 0) + if (H5E_clear_stack() < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRESET, FAIL, "unable to clear current error stack"); continue; } /* end if */ @@ -2773,7 +2773,7 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_con } /* We don't care about any failures during the freeing process */ - if (H5E_clear_stack(NULL) < 0) + if (H5E_clear_stack() < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRESET, FAIL, "unable to clear current error stack"); } /* end for */ } /* end else */ @@ -3888,7 +3888,7 @@ H5T_copy_reopen(H5T_t *old_dt) if (NULL == (reopened_fo = (H5T_shared_t *)H5FO_opened(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr))) { /* Clear any errors from H5FO_opened() */ - H5E_clear_stack(NULL); + H5E_clear_stack(); /* Open named datatype again */ if (H5O_open(&old_dt->oloc) < 0) @@ -5294,7 +5294,7 @@ H5T__init_path_table(void) fprintf(H5DEBUG(T), "H5T: unable to initialize no-op conversion function (ignored)\n"); #endif /* Ignore any errors from the conversion function */ - if (H5E_clear_stack(NULL) < 0) + if (H5E_clear_stack() < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRESET, FAIL, "unable to clear current error stack"); } /* end if */ @@ -5427,7 +5427,7 @@ H5T__path_find_init_new_path(H5T_path_t *path, const H5T_t *src, const H5T_t *ds if (status < 0) { memset(&(path->cdata), 0, sizeof(H5T_cdata_t)); /* ignore the error */ - if (H5E_clear_stack(NULL) < 0) + if (H5E_clear_stack() < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRESET, FAIL, "unable to clear current error stack"); path_init_error = true; } @@ -5512,7 +5512,7 @@ H5T__path_free(H5T_path_t *path, H5T_conv_ctx_t *conv_ctx) if (status < 0) { /* Ignore any error from shutting down the path */ - if (H5E_clear_stack(NULL) < 0) + if (H5E_clear_stack() < 0) /* Push error, but keep going */ HDONE_ERROR(H5E_DATATYPE, H5E_CANTRESET, FAIL, "unable to clear current error stack"); diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index eed0e3b1dc4..e1b4e0d1a7a 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -1037,7 +1037,7 @@ H5T_open(const H5G_loc_t *loc) /* Check if datatype was already open */ if (NULL == (shared_fo = (H5T_shared_t *)H5FO_opened(loc->oloc->file, loc->oloc->addr))) { /* Clear any errors from H5FO_opened() */ - H5E_clear_stack(NULL); + H5E_clear_stack(); /* Open the datatype object */ if (NULL == (dt = H5T__open_oid(loc))) diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index f34954d1517..02622dab936 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -3806,7 +3806,7 @@ H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned * Otherwise, if no VOL connectors are available, throw * error from original file open failure. */ - H5E_clear_stack(NULL); + H5E_clear_stack(); if (NULL == (ret_value = H5VL__file_open(find_connector_ud.cls, name, flags, find_connector_ud.fapl_id, dxpl_id, req))) diff --git a/src/H5Z.c b/src/H5Z.c index a7c1d76c782..d995f0676c6 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -781,7 +781,7 @@ H5Z__prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id, hi if (NULL == (fclass = H5Z_find(pline->filter[u].id))) { /* Ignore errors from optional filters */ if (pline->filter[u].flags & H5Z_FLAG_OPTIONAL) - H5E_clear_stack(NULL); + H5E_clear_stack(); else HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "required filter was not located"); } /* end if */ @@ -1448,7 +1448,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i *nbytes = *buf_size; failed |= (unsigned)1 << idx; - H5E_clear_stack(NULL); + H5E_clear_stack(); } else *nbytes = new_nbytes; @@ -1465,7 +1465,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i if ((pline->filter[idx].flags & H5Z_FLAG_OPTIONAL) == 0) HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "required filter is not registered"); failed |= (unsigned)1 << idx; - H5E_clear_stack(NULL); + H5E_clear_stack(); continue; /* filter excluded */ } /* end if */ @@ -1501,7 +1501,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i *nbytes = *buf_size; } failed |= (unsigned)1 << idx; - H5E_clear_stack(NULL); + H5E_clear_stack(); } else *nbytes = new_nbytes; diff --git a/src/H5private.h b/src/H5private.h index 5654fd900b7..0a55fc15a46 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1305,7 +1305,7 @@ H5_DLL herr_t H5CX_pop(bool update_dxpl_props); FUNC_ENTER_API_INIT(err); \ FUNC_ENTER_API_PUSH(err); \ /* Clear thread error stack entering public functions */ \ - H5E_clear_stack(NULL); \ + H5E_clear_stack(); \ { /* diff --git a/src/H5public.h b/src/H5public.h index 940f1bea372..21134ed1cfa 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -88,6 +88,10 @@ * For pre-releases like \c snap0. Empty string for official releases. */ #define H5_VERS_SUBRELEASE "1" +/** + * Short version string + */ +#define H5_VERS_STR "1.14.5-1" /** * Full version string */ diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 05d291ec03b..a996f60ab01 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -57,7 +57,7 @@ struct timezone { * MinGW and the newer, conforming MSVC preprocessor do not exhibit this * behavior. */ -#if (defined(_MSC_VER) && !defined(_MSVC_TRADITIONAL)) || _MSVC_TRADITIONAL +#if (defined(_MSC_VER) && !defined(_MSVC_TRADITIONAL)) || defined(_MSVC_TRADITIONAL) /* Using the MSVC traditional preprocessor */ #define HDopen(S, F, ...) Wopen(S, F, __VA_ARGS__) #else diff --git a/src/Makefile.am b/src/Makefile.am index 29706101001..7cc64eff84a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -182,9 +182,9 @@ settings_DATA=libhdf5.settings # Error header generation # -# Actually, H5Einit.h, H5Eterm.h, H5Edefin.h and H5Epubgen.h all -# depend on H5err.txt, but the perl script generates them all, so just -# list one here. +# Actually, H5Einit.h, H5Eterm.h, H5Edefin.h, H5Emajdef.h, H5Emindef.h, +# and H5Epubgen.h all depend on H5err.txt, but the perl script generates them +# all, so just list one here. $(top_srcdir)/src/H5Edefin.h: $(top_srcdir)/src/H5err.txt perl $(top_srcdir)/bin/make_err $? diff --git a/test/tattr.c b/test/tattr.c index d38fdaabc8d..e15ed5fb736 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -2898,6 +2898,11 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) VERIFY(is_dense, true, "H5O__is_attr_dense_test"); } + /* Verify github issue #1388 that the last renamed attribute + with/without tracking corder can be deleted */ + ret = H5Adelete(dataset, new_attrname); + CHECK(ret, FAIL, "H5Adelete"); + /* Close Dataset */ ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); @@ -2930,8 +2935,8 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) dataset = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); CHECK(dataset, H5I_INVALID_HID, "H5Dopen2"); - /* Verify renamed attributes */ - for (u = 0; u < (max_compact * 2); u++) { + /* Verify renamed attributes (the last attribute was deleted) */ + for (u = 0; u < (max_compact * 2 - 1); u++) { unsigned value; /* Attribute value */ /* Open attribute */
FilterSetFilter Params
BLOSCUD=32001,0,0
BLOSC2UD=32026,0,0
BSHUFUD=32004,0,0
BZIP2UD=307,0,1,9
JPEGUD=32019,0,4,q,c,r,t