summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVailin Choi <vchoi@jam.ad.hdfgroup.org>2017-11-25 08:12:26 (GMT)
committerVailin Choi <vchoi@jam.ad.hdfgroup.org>2017-11-25 08:22:24 (GMT)
commit96784c9873433b57de813c5afadd5d9771103686 (patch)
treec180d5c2a0163c2c273cb72b7b7df006e7be7a3f
parenta7ba8af0d145fee16a758ae4150316c7f2a38263 (diff)
parentf3fd3f293f2734fea98f508f190bf531edc72f7a (diff)
downloadhdf5-96784c9873433b57de813c5afadd5d9771103686.zip
hdf5-96784c9873433b57de813c5afadd5d9771103686.tar.gz
hdf5-96784c9873433b57de813c5afadd5d9771103686.tar.bz2
(1) Merge branch 'develop' into bugfix/version_bounds
(2) Add two new options to h5repack for low and high bounds as in H5Pset_libver_bounds. (3) Modify message pre_copy callbacks so that H5Ocopy can handle version bounds check. (4) Add version bounds check for cache image feature.
-rw-r--r--CMakeFilters.cmake16
-rw-r--r--CMakeLists.txt14
-rw-r--r--MANIFEST28
-rwxr-xr-xbin/h5vers10
-rw-r--r--config/cmake/UseJava.cmake6
-rw-r--r--config/cmake/cacheinit.cmake2
-rw-r--r--config/cmake/hdf5-config.cmake.in8
-rw-r--r--config/cmake_ext_mod/FindMPI.cmake1754
-rw-r--r--config/cmake_ext_mod/FindMPI/fortranparam_mpi.f90.in4
-rw-r--r--config/cmake_ext_mod/FindMPI/libver_mpi.c19
-rw-r--r--config/cmake_ext_mod/FindMPI/libver_mpi.f90.in7
-rw-r--r--config/cmake_ext_mod/FindMPI/mpiver.f90.in10
-rw-r--r--config/cmake_ext_mod/FindMPI/test_mpi.c37
-rw-r--r--config/cmake_ext_mod/FindMPI/test_mpi.f90.in6
-rw-r--r--config/conclude.am84
-rw-r--r--configure.ac19
-rw-r--r--fortran/CMakeLists.txt2
-rw-r--r--fortran/examples/CMakeLists.txt4
-rw-r--r--fortran/examples/CMakeTests.cmake4
-rw-r--r--fortran/src/CMakeLists.txt14
-rw-r--r--fortran/src/H5f90global.F905
-rw-r--r--fortran/testpar/CMakeLists.txt4
-rw-r--r--fortran/testpar/CMakeTests.cmake2
-rw-r--r--hl/tools/h5watch/CMakeLists.txt2
-rw-r--r--hl/tools/h5watch/h5watch.c1
-rw-r--r--release_docs/RELEASE.txt53
-rw-r--r--src/CMakeLists.txt16
-rw-r--r--src/H5Aint.c14
-rw-r--r--src/H5Dchunk.c2
-rw-r--r--src/H5Dcompact.c2
-rw-r--r--src/H5Dcontig.c2
-rw-r--r--src/H5Dint.c822
-rw-r--r--src/H5Dlayout.c11
-rw-r--r--src/H5Dpkg.h136
-rw-r--r--src/H5Dprivate.h34
-rw-r--r--src/H5F.c712
-rw-r--r--src/H5FSint.c3
-rw-r--r--src/H5Fint.c794
-rw-r--r--src/H5Fprivate.h3
-rw-r--r--src/H5Fquery.c628
-rw-r--r--src/H5Fsuper.c4
-rw-r--r--src/H5Gnode.c6
-rw-r--r--src/H5MM.c8
-rw-r--r--src/H5O.c2739
-rw-r--r--src/H5Oalloc.c15
-rw-r--r--src/H5Oattr.c14
-rw-r--r--src/H5Ocopy.c24
-rw-r--r--src/H5Odtype.c27
-rw-r--r--src/H5Ofill.c215
-rw-r--r--src/H5Oint.c2765
-rw-r--r--src/H5Olayout.c39
-rw-r--r--src/H5Opkg.h8
-rw-r--r--src/H5Opline.c11
-rw-r--r--src/H5Oprivate.h8
-rw-r--r--src/H5Osdspace.c7
-rw-r--r--src/H5PLplugin_cache.c4
-rw-r--r--src/H5Pdapl.c278
-rw-r--r--src/H5Ppublic.h82
-rw-r--r--src/H5R.c765
-rw-r--r--src/H5Rdeprec.c118
-rw-r--r--src/H5Rint.c767
-rw-r--r--src/H5Rmodule.h11
-rw-r--r--src/H5Rpkg.h14
-rw-r--r--src/H5Rprivate.h34
-rw-r--r--src/H5Rpublic.h73
-rw-r--r--src/H5S.c12
-rw-r--r--src/H5Sprivate.h5
-rw-r--r--src/H5T.c12
-rw-r--r--src/H5Tprivate.h4
-rw-r--r--src/H5Z.c691
-rw-r--r--src/H5Zprivate.h7
-rw-r--r--src/H5Zszip.c46
-rw-r--r--src/Makefile.am4
-rw-r--r--src/libhdf5.settings.in1
-rw-r--r--test/CMakeLists.txt96
-rw-r--r--test/CMakeTests.cmake12
-rw-r--r--test/Makefile.am49
-rw-r--r--test/cross_read.c2
-rw-r--r--test/dsets.c2
-rw-r--r--test/dynlib1.c95
-rw-r--r--test/dynlib3.c103
-rw-r--r--test/dynlib4.c102
-rw-r--r--test/filenotclosed.c6
-rw-r--r--test/filter_plugin.c1511
-rw-r--r--test/filter_plugin1_dsets.c93
-rw-r--r--test/filter_plugin2_dsets.c88
-rw-r--r--test/filter_plugin3_dsets.c119
-rw-r--r--test/filter_plugin4_groups.c106
-rw-r--r--test/plugin.c1217
-rw-r--r--test/tattr.c890
-rw-r--r--test/tcoords.c10
-rw-r--r--test/test_filter_plugin.sh.in (renamed from test/test_plugin.sh.in)46
-rw-r--r--test/tfile.c127
-rw-r--r--test/tmisc.c62
-rw-r--r--testpar/CMakeLists.txt4
-rw-r--r--testpar/CMakeTests.cmake4
-rw-r--r--testpar/t_pread.c60
-rw-r--r--tools/lib/h5diff.c1093
-rw-r--r--tools/lib/h5diff.h22
-rw-r--r--tools/lib/h5diff_array.c1721
-rw-r--r--tools/lib/h5diff_attr.c260
-rw-r--r--tools/lib/h5diff_dset.c572
-rw-r--r--tools/lib/h5diff_util.c84
-rw-r--r--tools/lib/h5tools.c464
-rw-r--r--tools/lib/h5tools_dump.c191
-rw-r--r--tools/lib/h5tools_filters.c65
-rw-r--r--tools/lib/h5tools_str.c8
-rw-r--r--tools/lib/h5tools_type.c124
-rw-r--r--tools/lib/h5tools_utils.c224
-rw-r--r--tools/lib/h5trav.c533
-rw-r--r--tools/lib/ph5diff.h2
-rw-r--r--tools/src/h5diff/h5diff_common.c85
-rw-r--r--tools/src/h5diff/h5diff_common.h4
-rw-r--r--tools/src/h5diff/h5diff_main.c12
-rw-r--r--tools/src/h5diff/ph5diff_main.c18
-rw-r--r--tools/src/h5jam/h5jam.c6
-rw-r--r--tools/src/h5ls/h5ls.c2
-rw-r--r--tools/src/h5repack/h5repack.c60
-rw-r--r--tools/src/h5repack/h5repack.h30
-rw-r--r--tools/src/h5repack/h5repack_copy.c266
-rw-r--r--tools/src/h5repack/h5repack_filters.c4
-rw-r--r--tools/src/h5repack/h5repack_main.c23
-rw-r--r--tools/src/h5repack/h5repack_refs.c47
-rw-r--r--tools/src/misc/h5mkgrp.c2
-rw-r--r--tools/test/h5copy/CMakeLists.txt48
-rw-r--r--tools/test/h5copy/CMakeTests.cmake158
-rw-r--r--tools/test/h5copy/dynlib_copy.c (renamed from test/dynlib2.c)57
-rw-r--r--tools/test/h5copy/testfiles/h5copy_plugin_fail_ERR.out.h5.txt3
-rw-r--r--tools/test/h5copy/testfiles/h5copy_plugin_test.out.h5.txt3
-rw-r--r--tools/test/h5copy/testfiles/tudfilter.h5bin0 -> 4816 bytes
-rw-r--r--tools/test/h5copy/testfiles/tudfilter.h5.txt2
-rw-r--r--tools/test/h5copy/testfiles/tudfilter.h5_ERR.txt2
-rw-r--r--tools/test/h5copy/testfiles/tudfilter2.h5bin0 -> 4816 bytes
-rw-r--r--tools/test/h5diff/CMakeTests.cmake4
-rw-r--r--tools/test/h5diff/Makefile.am5
-rw-r--r--tools/test/h5diff/testfiles/h5diff_454_ERR.err2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_454_ERR.txt2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_455_ERR.err2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_455_ERR.txt2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_457_ERR.err2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_457_ERR.txt2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_458_ERR.err2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_458_ERR.txt2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_459_ERR.err2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_459_ERR.txt2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_60.txt4
-rw-r--r--tools/test/h5diff/testfiles/h5diff_61.txt48
-rw-r--r--tools/test/h5diff/testfiles/h5diff_62.txt62
-rw-r--r--tools/test/h5diff/testfiles/h5diff_63.txt8
-rw-r--r--tools/test/h5diff/testfiles/h5diff_70.txt756
-rw-r--r--tools/test/h5diff/testfiles/h5diff_700.txt756
-rw-r--r--tools/test/h5diff/testfiles/h5diff_701.txt756
-rw-r--r--tools/test/h5diff/testfiles/h5diff_702.txt756
-rw-r--r--tools/test/h5diff/testfiles/h5diff_703.txt756
-rw-r--r--tools/test/h5diff/testfiles/h5diff_80.txt252
-rw-r--r--tools/test/h5diff/testfiles/h5diff_udfail.txt2
-rw-r--r--tools/test/h5dump/Makefile.am5
-rw-r--r--tools/test/h5format_convert/CMakeTests.cmake59
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_v_err.ddl1
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_v_err.ddl.err8
-rw-r--r--tools/test/h5format_convert/testh5fc.sh.in136
-rw-r--r--tools/test/h5ls/Makefile.am5
-rw-r--r--tools/test/h5repack/CMakeTests.cmake4
-rw-r--r--tools/test/h5repack/Makefile.am9
-rw-r--r--tools/test/h5repack/h5repacktst.c6
-rw-r--r--tools/test/h5repack/testfiles/h5repack-help.txt3
-rw-r--r--tools/test/misc/CMakeTestsClear.cmake6
-rw-r--r--tools/test/perform/CMakeTests.cmake7
168 files changed, 15166 insertions, 14379 deletions
diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake
index 804b16b..71dabb1 100644
--- a/CMakeFilters.cmake
+++ b/CMakeFilters.cmake
@@ -45,8 +45,8 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT)
if (NOT ZLIB_FOUND)
find_package (ZLIB) # Legacy find
if (ZLIB_FOUND)
- set (LINK_LIBS ${LINK_LIBS} ${ZLIB_LIBRARIES})
- set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${ZLIB_LIBRARIES})
+ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES})
+ set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${ZLIB_LIBRARIES})
endif ()
endif ()
endif ()
@@ -78,9 +78,9 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT)
set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} DEFLATE")
endif ()
if (BUILD_SHARED_LIBS)
- set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${ZLIB_SHARED_LIBRARY})
+ set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${ZLIB_SHARED_LIBRARY})
endif ()
- set (LINK_LIBS ${LINK_LIBS} ${ZLIB_STATIC_LIBRARY})
+ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_STATIC_LIBRARY})
INCLUDE_DIRECTORIES (${ZLIB_INCLUDE_DIRS})
message (STATUS "Filter ZLIB is ON")
endif ()
@@ -96,8 +96,8 @@ if (HDF5_ENABLE_SZIP_SUPPORT)
if (NOT SZIP_FOUND)
find_package (SZIP) # Legacy find
if (SZIP_FOUND)
- set (LINK_LIBS ${LINK_LIBS} ${SZIP_LIBRARIES})
- set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${SZIP_LIBRARIES})
+ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES})
+ set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${SZIP_LIBRARIES})
endif ()
endif ()
endif ()
@@ -119,9 +119,9 @@ if (HDF5_ENABLE_SZIP_SUPPORT)
endif ()
endif ()
if (BUILD_SHARED_LIBS)
- set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${SZIP_SHARED_LIBRARY})
+ set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${SZIP_SHARED_LIBRARY})
endif ()
- set (LINK_LIBS ${LINK_LIBS} ${SZIP_STATIC_LIBRARY})
+ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_STATIC_LIBRARY})
INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS})
message (STATUS "Filter SZIP is ON")
if (H5_HAVE_FILTER_SZIP)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 23452cd..f2640b1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -482,7 +482,6 @@ option (BUILD_SHARED_LIBS "Build Shared Libraries" ON)
set (H5_ENABLE_SHARED_LIB NO)
if (BUILD_SHARED_LIBS)
set (H5_ENABLE_SHARED_LIB YES)
- set (LINK_SHARED_LIBS ${LINK_LIBS})
endif ()
set (H5_ENABLE_STATIC_LIB YES)
set (CMAKE_POSITION_INDEPENDENT_CODE ON)
@@ -623,16 +622,15 @@ INCLUDE_DIRECTORIES (${HDF5_BINARY_DIR} ${HDF5_SRC_DIR} ${CMAKE_RUNTIME_OUTPUT_D
set (CMAKE_MODULE_PATH ${HDF_RESOURCES_DIR} ${HDF_RESOURCES_EXT_DIR} ${CMAKE_MODULE_PATH})
option (HDF5_ENABLE_PARALLEL "Enable parallel build (requires MPI)" OFF)
if (HDF5_ENABLE_PARALLEL)
- include (FindMPI)
- INCLUDE_DIRECTORIES (${MPI_C_INCLUDE_PATH})
+ find_package(MPI REQUIRED)
if (MPI_C_FOUND)
set (H5_HAVE_PARALLEL 1)
# MPI checks, only do these if MPI_C_FOUND is true, otherwise they always fail
# and once set, they are cached as false and not regenerated
set (CMAKE_REQUIRED_LIBRARIES "${MPI_C_LIBRARIES}" )
# Used by Fortran + MPI
- CHECK_SYMBOL_EXISTS (MPI_Comm_c2f "${MPI_C_INCLUDE_PATH}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Comm)
- CHECK_SYMBOL_EXISTS (MPI_Info_c2f "${MPI_C_INCLUDE_PATH}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Info)
+ CHECK_SYMBOL_EXISTS (MPI_Comm_c2f "${MPI_C_INCLUDE_DIRS}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Comm)
+ CHECK_SYMBOL_EXISTS (MPI_Info_c2f "${MPI_C_INCLUDE_DIRS}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Info)
else ()
message (STATUS "Parallel libraries not found")
endif ()
@@ -878,6 +876,8 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for
endif ()
include (${HDF_RESOURCES_DIR}/HDF5UseFortran.cmake)
+ set (LINK_Fortran_LIBS ${LINK_LIBS})
+ set (LINK_Fortran_SHARED_LIBS ${LINK_SHARED_LIBS})
if (HDF5_ENABLE_F2003)
if (NOT FORTRAN_HAVE_ISO_C_BINDING)
@@ -887,8 +887,8 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for
# Parallel IO usage requires MPI to be Linked and Included
if (H5_HAVE_PARALLEL)
- set (LINK_Fortran_LIBS ${LINK_LIBS} ${MPI_Fortran_LIBRARIES})
- set (LINK_Fortran_SHARED_LIBS ${LINK_SHARED_LIBS} ${MPI_Fortran_LIBRARIES})
+ set (LINK_Fortran_LIBS ${LINK_Fortran_LIBS} ${MPI_Fortran_LIBRARIES})
+ set (LINK_Fortran_SHARED_LIBS ${LINK_Fortran_SHARED_LIBS} ${MPI_Fortran_LIBRARIES})
if (MPI_Fortran_LINK_FLAGS)
set (CMAKE_Fortran_EXE_LINKER_FLAGS "${MPI_Fortran_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}")
endif ()
diff --git a/MANIFEST b/MANIFEST
index e0e30c7..9b91c78 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -753,6 +753,7 @@
./src/H5Oflush.c
./src/H5Ofsinfo.c
./src/H5Oginfo.c
+./src/H5Oint.c
./src/H5Olayout.c
./src/H5Olinfo.c
./src/H5Olink.c
@@ -810,6 +811,7 @@
./src/H5PLextern.h
./src/H5R.c
./src/H5Rdeprec.c
+./src/H5Rint.c
./src/H5Rmodule.h
./src/H5Rpkg.h
./src/H5Rprivate.h
@@ -936,10 +938,6 @@
./test/dt_arith.c
./test/dtypes.c
./test/dtransform.c
-./test/dynlib1.c
-./test/dynlib2.c
-./test/dynlib3.c
-./test/dynlib4.c
./test/earray.c
./test/efc.c
./test/enc_dec_plist.c
@@ -967,6 +965,11 @@
./test/fill_old.h5
./test/fillval.c
./test/filter_fail.c
+./test/filter_plugin.c
+./test/filter_plugin1_dsets.c
+./test/filter_plugin2_dsets.c
+./test/filter_plugin3_dsets.c
+./test/filter_plugin4_groups.c
./test/flush1.c
./test/flush2.c
./test/flushrefresh.c
@@ -1030,7 +1033,6 @@
./test/page_buffer.c
./test/paged_nopersist.h5
./test/paged_persist.h5
-./test/plugin.c
./test/reserved.c
./test/pool.c
./test/set_extent.c
@@ -1065,12 +1067,12 @@
./test/testerror.sh.in
./test/testlinks_env.sh.in
./test/test_filenotclosed.sh.in
+./test/test_filter_plugin.sh.in
./test/testflushrefresh.sh.in
./test/testframe.c
./test/testhdf5.c
./test/testhdf5.h
./test/testlibinfo.sh.in
-./test/test_plugin.sh.in
./test/test_usecases.sh.in
./test/testmeta.c
./test/testswmr.sh.in
@@ -1355,6 +1357,7 @@
./tools/test/h5format_convert/testfiles/h5fc_v_n_all.ddl
./tools/test/h5format_convert/testfiles/h5fc_v_bt1.ddl
./tools/test/h5format_convert/testfiles/h5fc_v_err.ddl
+./tools/test/h5format_convert/testfiles/h5fc_v_err.ddl.err
./tools/test/h5format_convert/testfiles/h5fc_v_non_chunked.ddl
./tools/test/h5format_convert/testfiles/h5fc_d_file.ddl
./tools/test/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl
@@ -1434,6 +1437,7 @@
./tools/test/h5copy/Makefile.am
./tools/test/h5copy/h5copygentest.c
./tools/test/h5copy/testh5copy.sh.in
+./tools/test/h5copy/dynlib_copy.c
./tools/lib/Makefile.am
@@ -2524,6 +2528,12 @@
./tools/test/h5copy/testfiles/h5copy_misc1.out
./tools/test/h5copy/testfiles/h5copytst_new.h5
./tools/test/h5copy/testfiles/h5copytst_new.out.ls
+./tools/test/h5copy/testfiles/h5copy_plugin_fail_ERR.out.h5.txt
+./tools/test/h5copy/testfiles/h5copy_plugin_test.out.h5.txt
+./tools/test/h5copy/testfiles/tudfilter.h5
+./tools/test/h5copy/testfiles/tudfilter2.h5
+./tools/test/h5copy/testfiles/tudfilter.h5.txt
+./tools/test/h5copy/testfiles/tudfilter.h5_ERR.txt
# test files for h5mkgrp
./tools/testfiles/h5mkgrp_nested_p.ls
@@ -3099,6 +3109,12 @@
./config/cmake_ext_mod/NSIS.template.in
./config/cmake_ext_mod/runTest.cmake
./config/cmake_ext_mod/version.plist.in
+./config/cmake_ext_mod/FindMPI/fortranparam_mpi.f90.in
+./config/cmake_ext_mod/FindMPI/libver_mpi.c
+./config/cmake_ext_mod/FindMPI/libver_mpi.f90.in
+./config/cmake_ext_mod/FindMPI/mpiver.f90.in
+./config/cmake_ext_mod/FindMPI/test_mpi.c
+./config/cmake_ext_mod/FindMPI/test_mpi.f90.in
# CMake-specific User Files
./config/cmake/UserMacros/Windows_MT.cmake
diff --git a/bin/h5vers b/bin/h5vers
index 5228903..a00beb7 100755
--- a/bin/h5vers
+++ b/bin/h5vers
@@ -198,7 +198,7 @@ my $H5_JAVA = $file;
$H5_JAVA =~ s/[^\/]*$/..\/java\/src\/hdf\/hdf5lib\/H5.java/;
die "unable to read file: $H5_JAVA\n" unless -r $file;
my $TESTH5_JAVA = $file;
-$TESTH5_JAVA =~ s/[^\/]*$/..\/java\/test\/TestH5.java/;
+$TESTH5_JAVA =~ s/[^\/]*$/..\/java\/test\/TestH5.java/;
die "unable to read file: $TESTH5_JAVA\n" unless -r $file;
my $REPACK_LAYOUT_PLUGIN_VERSION = $file;
$REPACK_LAYOUT_PLUGIN_VERSION =~ s/[^\/]*$/..\/tools\/test\/h5repack\/testfiles\/h5repack_layout.h5-plugin_version_test.ddl/;
@@ -354,7 +354,7 @@ if ($HDF5CONFIGCMAKE) {
my $sub_rel_ver_str = (
$newver[3] eq ""
? sprintf("\"%s\"", "")
- : sprintf("\"%s\"", "-".$newver[3].", currently under development")
+ : sprintf("\"%s\"", "-".$newver[3])
);
my $version_string = sprintf("\"%d.%d.%d\"", @newver[0,1,2]);
@@ -377,7 +377,7 @@ if ($H5_JAVA) {
my $version_string2 = sprintf("%d, %d, %d", @newver[0,1,2]);
$data =~ s/\@version HDF5 .* <BR>/\@version HDF5 $version_string1 <BR>/;
- $data =~ s/ public final static int LIB_VERSION\[\] = { \d*, \d*, \d* };/ public final static int LIB_VERSION[] = { $version_string2 };/;
+ $data =~ s/ public final static int LIB_VERSION\[\] = { \d*, \d*, \d* };/ public final static int LIB_VERSION[] = { $version_string2 };/;
write_file($H5_JAVA, $data);
}
@@ -395,7 +395,7 @@ if ($TESTH5_JAVA) {
my $version_string2 = sprintf("int majnum = %d, minnum = %d, relnum = %d", @newver[0,1,2]);
$data =~ s/ int libversion\[\] = { .* };/ int libversion\[\] = { $version_string1 };/;
- $data =~ s/ int majnum = \d*, minnum = \d*, relnum = \d*;/ $version_string2;/;
+ $data =~ s/ int majnum = \d*, minnum = \d*, relnum = \d*;/ $version_string2;/;
write_file($TESTH5_JAVA, $data);
}
@@ -410,7 +410,7 @@ if ($REPACK_LAYOUT_PLUGIN_VERSION) {
write_file($REPACK_LAYOUT_PLUGIN_VERSION, $data);
}
-# helper function to read the file for updating c++/src/cpp_doc_config,
+# helper function to read the file for updating c++/src/cpp_doc_config,
# config/cmake/scripts/HDF5Config.cmake, and java files.
# The version string in that file is not at the top, so the string replacement
# is not for the first line, and reading/writing the entire file as one string
diff --git a/config/cmake/UseJava.cmake b/config/cmake/UseJava.cmake
index 9b3bf02..52b37a9 100644
--- a/config/cmake/UseJava.cmake
+++ b/config/cmake/UseJava.cmake
@@ -482,6 +482,8 @@ function(add_jar _TARGET_NAME)
else()
get_filename_component(_add_jar_OUTPUT_DIR ${_add_jar_OUTPUT_DIR} ABSOLUTE)
endif()
+ # ensure output directory exists
+ file (MAKE_DIRECTORY "${_add_jar_OUTPUT_DIR}")
if (_add_jar_ENTRY_POINT)
set(_ENTRY_POINT_OPTION e)
@@ -516,7 +518,7 @@ function(add_jar _TARGET_NAME)
set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}")
endforeach()
- set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${_add_jar_OUTPUT_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir")
+ set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir")
set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}.jar")
if (_add_jar_OUTPUT_NAME AND _add_jar_VERSION)
@@ -547,7 +549,7 @@ function(add_jar _TARGET_NAME)
list(APPEND _JAVA_COMPILE_FILELISTS ${_JAVA_FULL})
elseif (_JAVA_EXT MATCHES ".java")
- file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${_add_jar_OUTPUT_DIR} ${_JAVA_FULL})
+ file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${CMAKE_CURRENT_BINARY_DIR} ${_JAVA_FULL})
file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL})
string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN)
string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN)
diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake
index d37c339..d5c5e52 100644
--- a/config/cmake/cacheinit.cmake
+++ b/config/cmake/cacheinit.cmake
@@ -29,7 +29,7 @@ set (HDF5_ENABLE_SZIP_SUPPORT ON CACHE BOOL "Use SZip Filter" FORCE)
set (HDF5_ENABLE_SZIP_ENCODING ON CACHE BOOL "Use SZip Encoding" FORCE)
-set (MPIEXEC_MAX_NUMPROCS "3" CACHE STRING "Minimum number of processes for HDF parallel tests" FORCE)
+set (MPIEXEC_MAX_NUMPROCS "4" CACHE STRING "Minimum number of processes for HDF parallel tests" FORCE)
set (HDF5_ENABLE_ALL_WARNINGS ON CACHE BOOL "Enable all warnings" FORCE)
diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in
index 712dc05..01c27df 100644
--- a/config/cmake/hdf5-config.cmake.in
+++ b/config/cmake/hdf5-config.cmake.in
@@ -50,8 +50,12 @@ set (${HDF5_PACKAGE_NAME}_TOOLSET "@CMAKE_GENERATOR_TOOLSET@")
# Dependencies
#-----------------------------------------------------------------------------
if (${HDF5_PACKAGE_NAME}_ENABLE_PARALLEL)
- set (${HDF5_PACKAGE_NAME}_MPI_C_INCLUDE_PATH "@MPI_C_INCLUDE_PATH@")
+ set (${HDF5_PACKAGE_NAME}_MPI_C_INCLUDE_PATH "@MPI_C_INCLUDE_DIRS@")
set (${HDF5_PACKAGE_NAME}_MPI_C_LIBRARIES "@MPI_C_LIBRARIES@")
+ if (${HDF5_PACKAGE_NAME}_BUILD_FORTRAN)
+ set (${HDF5_PACKAGE_NAME}_MPI_Fortran_INCLUDE_PATH "@MPI_Fortran_INCLUDE_DIRS@")
+ set (${HDF5_PACKAGE_NAME}_MPI_Fortran_LIBRARIES "@MPI_Fortran_LIBRARIES@")
+ endif ()
endif ()
if (${HDF5_PACKAGE_NAME}_BUILD_JAVA)
@@ -67,7 +71,7 @@ endif ()
#-----------------------------------------------------------------------------
# Directories
#-----------------------------------------------------------------------------
-set (${HDF5_PACKAGE_NAME}_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@" "${${HDF5_PACKAGE_NAME}_MPI_C_INCLUDE_PATH}")
+set (${HDF5_PACKAGE_NAME}_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@" "${${HDF5_PACKAGE_NAME}_MPI_C_INCLUDE_DIRS}")
set (${HDF5_PACKAGE_NAME}_SHARE_DIR "@PACKAGE_SHARE_INSTALL_DIR@")
set_and_check (${HDF5_PACKAGE_NAME}_BUILD_DIR "@PACKAGE_CURRENT_BUILD_DIR@")
diff --git a/config/cmake_ext_mod/FindMPI.cmake b/config/cmake_ext_mod/FindMPI.cmake
index f566ade..8084472 100644
--- a/config/cmake_ext_mod/FindMPI.cmake
+++ b/config/cmake_ext_mod/FindMPI.cmake
@@ -4,27 +4,45 @@
# FindMPI
# -------
#
-# Find a Message Passing Interface (MPI) implementation
+# Find a Message Passing Interface (MPI) implementation.
#
# The Message Passing Interface (MPI) is a library used to write
# high-performance distributed-memory parallel applications, and is
# typically deployed on a cluster. MPI is a standard interface (defined
# by the MPI forum) for which many implementations are available.
#
-# Variables
-# ^^^^^^^^^
+# Variables for using MPI
+# ^^^^^^^^^^^^^^^^^^^^^^^
+#
+# The module exposes the components ``C``, ``CXX``, ``MPICXX`` and ``Fortran``.
+# Each of these controls the various MPI languages to search for.
+# The difference between ``CXX`` and ``MPICXX`` is that ``CXX`` refers to the
+# MPI C API being usable from C++, whereas ``MPICXX`` refers to the MPI-2 C++ API
+# that was removed again in MPI-3.
+#
+# Depending on the enabled components the following variables will be set:
+#
+# ``MPI_FOUND``
+# Variable indicating that MPI settings for all requested languages have been found.
+# If no components are specified, this is true if MPI settings for all enabled languages
+# were detected. Note that the ``MPICXX`` component does not affect this variable.
+# ``MPI_VERSION``
+# Minimal version of MPI detected among the requested languages, or all enabled languages
+# if no components were specified.
#
# This module will set the following variables per language in your
# project, where ``<lang>`` is one of C, CXX, or Fortran:
#
# ``MPI_<lang>_FOUND``
-# Variable indicating the MPI settings for ``<lang>`` were found.
+# Variable indicating the MPI settings for ``<lang>`` were found and that
+# simple MPI test programs compile with the provided settings.
# ``MPI_<lang>_COMPILER``
-# MPI Compiler wrapper for ``<lang>``.
-# ``MPI_<lang>_COMPILE_FLAGS``
-# Compilation flags for MPI programs, separated by spaces.
-# This is *not* a :ref:`;-list <CMake Language Lists>`.
-# ``MPI_<lang>_INCLUDE_PATH``
+# MPI compiler for ``<lang>`` if such a program exists.
+# ``MPI_<lang>_COMPILE_OPTIONS``
+# Compilation options for MPI programs in ``<lang>``, given as a :ref:`;-list <CMake Language Lists>`.
+# ``MPI_<lang>_COMPILE_DEFINITIONS``
+# Compilation definitions for MPI programs in ``<lang>``, given as a :ref:`;-list <CMake Language Lists>`.
+# ``MPI_<lang>_INCLUDE_DIRS``
# Include path(s) for MPI header.
# ``MPI_<lang>_LINK_FLAGS``
# Linker flags for MPI programs.
@@ -36,53 +54,172 @@
# ``MPI::MPI_<lang>``
# Target for using MPI from ``<lang>``.
#
-# Additionally, FindMPI sets the following variables for running MPI
-# programs from the command line:
+# The following variables indicating which bindings are present will be defined:
#
-# ``MPIEXEC``
-# Executable for running MPI programs, if provided.
+# ``MPI_MPICXX_FOUND``
+# Variable indicating whether the MPI-2 C++ bindings are present (introduced in MPI-2, removed with MPI-3).
+# ``MPI_Fortran_HAVE_F77_HEADER``
+# True if the Fortran 77 header ``mpif.h`` is available.
+# ``MPI_Fortran_HAVE_F90_MODULE``
+# True if the Fortran 90 module ``mpi`` can be used for accessing MPI (MPI-2 and higher only).
+# ``MPI_Fortran_HAVE_F08_MODULE``
+# True if the Fortran 2008 ``mpi_f08`` is available to MPI programs (MPI-3 and higher only).
+#
+# If possible, the MPI version will be determined by this module. The facilities to detect the MPI version
+# were introduced with MPI-1.2, and therefore cannot be found for older MPI versions.
+#
+# ``MPI_<lang>_VERSION_MAJOR``
+# Major version of MPI implemented for ``<lang>`` by the MPI distribution.
+# ``MPI_<lang>_VERSION_MINOR``
+# Minor version of MPI implemented for ``<lang>`` by the MPI distribution.
+# ``MPI_<lang>_VERSION``
+# MPI version implemented for ``<lang>`` by the MPI distribution.
+#
+# Note that there's no variable for the C bindings being accessible through ``mpi.h``, since the MPI standards
+# always have required this binding to work in both C and C++ code.
+#
+# For running MPI programs, the module sets the following variables
+#
+# ``MPIEXEC_EXECUTABLE``
+# Executable for running MPI programs, if such exists.
# ``MPIEXEC_NUMPROC_FLAG``
-# Flag to pass to ``MPIEXEC`` before giving it the number of processors to run on.
+# Flag to pass to ``mpiexec`` before giving it the number of processors to run on.
# ``MPIEXEC_MAX_NUMPROCS``
# Number of MPI processors to utilize. Defaults to the number
# of processors detected on the host system.
# ``MPIEXEC_PREFLAGS``
-# Flags to pass to ``MPIEXEC`` directly before the executable to run.
+# Flags to pass to ``mpiexec`` directly before the executable to run.
# ``MPIEXEC_POSTFLAGS``
-# Flags to pass to ``MPIEXEC`` after other flags.
+# Flags to pass to ``mpiexec`` after other flags.
+#
+# Variables for locating MPI
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^
+#
+# This module performs a three step search for an MPI implementation:
+#
+# 1. Check if the compiler has MPI support built-in. This is the case if the user passed a
+# compiler wrapper as ``CMAKE_<LANG>_COMPILER`` or if they're on a Cray system.
+# 2. Attempt to find an MPI compiler wrapper and determine the compiler information from it.
+# 3. Try to find an MPI implementation that does not ship such a wrapper by guessing settings.
+# Currently, only Microsoft MPI and MPICH2 on Windows are supported.
+#
+# For controlling the second step, the following variables may be set:
+#
+# ``MPI_<lang>_COMPILER``
+# Search for the specified compiler wrapper and use it.
+# ``MPI_<lang>_COMPILER_FLAGS``
+# Flags to pass to the MPI compiler wrapper during interrogation. Some compiler wrappers
+# support linking debug or tracing libraries if a specific flag is passed and this variable
+# may be used to obtain them.
+# ``MPI_COMPILER_FLAGS``
+# Used to initialize ``MPI_<lang>_COMPILER_FLAGS`` if no language specific flag has been given.
+# Empty by default.
+# ``MPI_EXECUTABLE_SUFFIX``
+# A suffix which is appended to all names that are being looked for. For instance you may set this
+# to ``.mpich`` or ``.openmpi`` to prefer the one or the other on Debian and its derivatives.
+#
+# In order to control the guessing step, the following variable may be set:
#
-# Usage
-# ^^^^^
+# ``MPI_GUESS_LIBRARY_NAME``
+# Valid values are ``MSMPI`` and ``MPICH2``. If set, only the given library will be searched for.
+# By default, ``MSMPI`` will be preferred over ``MPICH2`` if both are available.
+# This also sets ``MPI_SKIP_COMPILER_WRAPPER`` to ``true``, which may be overridden.
#
-# To use this module, call ``find_package(MPI)``. If you are happy with the
-# auto-detected configuration for your language, then you're done. If
-# not, you have two options:
+# Each of the search steps may be skipped with the following control variables:
#
-# 1. Set ``MPI_<lang>_COMPILER`` to the MPI wrapper (e.g. ``mpicc``) of your
-# choice and reconfigure. FindMPI will attempt to determine all the
-# necessary variables using *that* compiler's compile and link flags.
-# 2. If this fails, or if your MPI implementation does not come with
-# a compiler wrapper, then set both ``MPI_<lang>_LIBRARIES`` and
-# ``MPI_<lang>_INCLUDE_PATH``. You may also set any other variables
-# listed above, but these two are required. This will circumvent
-# autodetection entirely.
+# ``MPI_ASSUME_NO_BUILTIN_MPI``
+# If true, the module assumes that the compiler itself does not provide an MPI implementation and
+# skips to step 2.
+# ``MPI_SKIP_COMPILER_WRAPPER``
+# If true, no compiler wrapper will be searched for.
+# ``MPI_SKIP_GUESSING``
+# If true, the guessing step will be skipped.
#
-# When configuration is successful, ``MPI_<lang>_COMPILER`` will be set to
-# the compiler wrapper for ``<lang>``, if it was found. ``MPI_<lang>_FOUND``
-# and other variables above will be set if any MPI implementation was
-# found for ``<lang>``, regardless of whether a compiler was found.
+# Additionally, the following control variable is available to change search behavior:
#
-# When using ``MPIEXEC`` to execute MPI applications, you should typically
-# use all of the ``MPIEXEC`` flags as follows:
+# ``MPI_CXX_SKIP_MPICXX``
+# Add some definitions that will disable the MPI-2 C++ bindings.
+# Currently supported are MPICH, Open MPI, Platform MPI and derivatives thereof,
+# for example MVAPICH or Intel MPI.
+#
+# If the find procedure fails for a variable ``MPI_<lang>_WORKS``, then the settings detected by or passed to
+# the module did not work and even a simple MPI test program failed to compile.
+#
+# If all of these parameters were not sufficient to find the right MPI implementation, a user may
+# disable the entire autodetection process by specifying both a list of libraries in ``MPI_<lang>_LIBRARIES``
+# and a list of include directories in ``MPI_<lang>_ADDITIONAL_INCLUDE_DIRS``.
+# Any other variable may be set in addition to these two. The module will then validate the MPI settings and store the
+# settings in the cache.
+#
+# Cache variables for MPI
+# ^^^^^^^^^^^^^^^^^^^^^^^
+#
+# The variable ``MPI_<lang>_INCLUDE_DIRS`` will be assembled from the following variables.
+# For C and CXX:
+#
+# ``MPI_<lang>_HEADER_DIR``
+# Location of the ``mpi.h`` header on disk.
+#
+# For Fortran:
+#
+# ``MPI_Fortran_F77_HEADER_DIR``
+# Location of the Fortran 77 header ``mpif.h``, if it exists.
+# ``MPI_Fortran_MODULE_DIR``
+# Location of the ``mpi`` or ``mpi_f08`` modules, if available.
+#
+# For all languages the following variables are additionally considered:
+#
+# ``MPI_<lang>_ADDITIONAL_INCLUDE_DIRS``
+# A :ref:`;-list <CMake Language Lists>` of paths needed in addition to the normal include directories.
+# ``MPI_<include_name>_INCLUDE_DIR``
+# Path variables for include folders referred to by ``<include_name>``.
+# ``MPI_<lang>_ADDITIONAL_INCLUDE_VARS``
+# A :ref:`;-list <CMake Language Lists>` of ``<include_name>`` that will be added to the include locations of ``<lang>``.
+#
+# The variable ``MPI_<lang>_LIBRARIES`` will be assembled from the following variables:
+#
+# ``MPI_<lib_name>_LIBRARY``
+# The location of a library called ``<lib_name>`` for use with MPI.
+# ``MPI_<lang>_LIB_NAMES``
+# A :ref:`;-list <CMake Language Lists>` of ``<lib_name>`` that will be added to the include locations of ``<lang>``.
+#
+# Usage of mpiexec
+# ^^^^^^^^^^^^^^^^
+#
+# When using ``MPIEXEC_EXECUTABLE`` to execute MPI applications, you should typically
+# use all of the ``MPIEXEC_EXECUTABLE`` flags as follows:
#
# ::
#
-# ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS}
+# ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS}
# ${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS
#
# where ``EXECUTABLE`` is the MPI program, and ``ARGS`` are the arguments to
# pass to the MPI program.
#
+# Advanced variables for using MPI
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+#
+# The module can perform some advanced feature detections upon explicit request.
+#
+# **Important notice:** The following checks cannot be performed without *executing* an MPI test program.
+# Consider the special considerations for the behavior of :command:`try_run` during cross compilation.
+# Moreover, running an MPI program can cause additional issues, like a firewall notification on some systems.
+# You should only enable these detections if you absolutely need the information.
+#
+# If the following variables are set to true, the respective search will be performed:
+#
+# ``MPI_DETERMINE_Fortran_CAPABILITIES``
+# Determine for all available Fortran bindings what the values of ``MPI_SUBARRAYS_SUPPORTED`` and
+# ``MPI_ASYNC_PROTECTS_NONBLOCKING`` are and make their values available as ``MPI_Fortran_<binding>_SUBARRAYS``
+# and ``MPI_Fortran_<binding>_ASYNCPROT``, where ``<binding>`` is one of ``F77_HEADER``, ``F90_MODULE`` and
+# ``F08_MODULE``.
+# ``MPI_DETERMINE_LIBRARY_VERSION``
+# For each language, find the output of ``MPI_Get_library_version`` and make it available as ``MPI_<lang>_LIBRARY_VERSION``.
+# This information is usually tied to the runtime component of an MPI implementation and might differ depending on ``<lang>``.
+# Note that the return value is entirely implementation defined. This information might be used to identify
+# the MPI vendor and for example pick the correct one of multiple third party binaries that matches the MPI vendor.
+#
# Backward Compatibility
# ^^^^^^^^^^^^^^^^^^^^^^
#
@@ -91,54 +228,62 @@
#
# ::
#
-# MPI_FOUND MPI_COMPILER MPI_LIBRARY
-# MPI_COMPILE_FLAGS MPI_INCLUDE_PATH MPI_EXTRA_LIBRARY
-# MPI_LINK_FLAGS MPI_LIBRARIES
+# MPI_COMPILER MPI_LIBRARY MPI_EXTRA_LIBRARY
+# MPI_COMPILE_FLAGS MPI_INCLUDE_PATH MPI_LINK_FLAGS
+# MPI_LIBRARIES
#
# In new projects, please use the ``MPI_<lang>_XXX`` equivalents.
+# Additionally, the following variables are deprecated:
+#
+# ``MPI_<lang>_COMPILE_FLAGS``
+# Use ``MPI_<lang>_COMPILE_OPTIONS`` and ``MPI_<lang>_COMPILE_DEFINITIONS`` instead.
+# ``MPI_<lang>_INCLUDE_PATH``
+# For consumption use ``MPI_<lang>_INCLUDE_DIRS`` and for specifying folders use ``MPI_<lang>_ADDITIONAL_INCLUDE_DIRS`` instead.
+# ``MPIEXEC``
+# Use ``MPIEXEC_EXECUTABLE`` instead.
+
+cmake_policy(PUSH)
+cmake_policy(SET CMP0057 NEW) # if IN_LIST
# include this to handle the QUIETLY and REQUIRED arguments
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
include(GetPrerequisites)
-#
-# This part detects MPI compilers, attempting to wade through the mess of compiler names in
-# a sensible way.
-#
-# The compilers are detected in this order:
-#
-# 1. Try to find the most generic available MPI compiler, as this is usually set up by
-# cluster admins, e.g. if plain old mpicc is available, we'll use it and assume it's
-# the right compiler.
-#
-# 2. If a generic mpicc is NOT found, then we attempt to find one that matches
-# CMAKE_<lang>_COMPILER_ID. e.g. if you are using XL compilers, we'll try to find mpixlc
-# and company, but not mpiicc. This hopefully prevents toolchain mismatches.
-#
-# If you want to force a particular MPI compiler other than what we autodetect (e.g. if you
-# want to compile regular stuff with GNU and parallel stuff with Intel), you can always set
-# your favorite MPI_<lang>_COMPILER explicitly and this stuff will be ignored.
-#
-
-# Start out with the generic MPI compiler names, as these are most commonly used.
-set(_MPI_C_COMPILER_NAMES mpicc mpcc mpicc_r mpcc_r mpicc.bat)
-set(_MPI_CXX_COMPILER_NAMES mpicxx mpiCC mpcxx mpCC mpic++ mpc++
- mpicxx_r mpiCC_r mpcxx_r mpCC_r mpic++_r mpc++_r
- mpicxx.bat)
-set(_MPI_Fortran_COMPILER_NAMES mpif95 mpif95_r mpf95 mpf95_r
+# Generic compiler names
+set(_MPI_C_GENERIC_COMPILER_NAMES mpicc mpcc mpicc_r mpcc_r)
+set(_MPI_CXX_GENERIC_COMPILER_NAMES mpicxx mpiCC mpcxx mpCC mpic++ mpc++
+ mpicxx_r mpiCC_r mpcxx_r mpCC_r mpic++_r mpc++_r)
+set(_MPI_Fortran_GENERIC_COMPILER_NAMES mpif95 mpif95_r mpf95 mpf95_r
mpif90 mpif90_r mpf90 mpf90_r
- mpif77 mpif77_r mpf77 mpf77_r)
+ mpif77 mpif77_r mpf77 mpf77_r
+ mpifc)
# GNU compiler names
set(_MPI_GNU_C_COMPILER_NAMES mpigcc mpgcc mpigcc_r mpgcc_r)
-set(_MPI_GNU_CXX_COMPILER_NAMES mpig++ mpg++ mpig++_r mpg++_r)
+set(_MPI_GNU_CXX_COMPILER_NAMES mpig++ mpg++ mpig++_r mpg++_r mpigxx)
set(_MPI_GNU_Fortran_COMPILER_NAMES mpigfortran mpgfortran mpigfortran_r mpgfortran_r
mpig77 mpig77_r mpg77 mpg77_r)
-# Intel MPI compiler names
-set(_MPI_Intel_C_COMPILER_NAMES mpiicc mpiicc.bat)
-set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc mpiicxx mpiic++ mpiiCC mpiicpc.bat)
-set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort mpiif95 mpiif90 mpiif77 mpiifort.bat)
+# Intel MPI compiler names on Windows
+if(WIN32)
+ list(APPEND _MPI_C_GENERIC_COMPILER_NAMES mpicc.bat)
+ list(APPEND _MPI_CXX_GENERIC_COMPILER_NAMES mpicxx.bat)
+ list(APPEND _MPI_Fortran_GENERIC_COMPILER_NAMES mpifc.bat)
+
+ # Intel MPI compiler names
+ set(_MPI_Intel_C_COMPILER_NAMES mpiicc.bat)
+ set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc.bat)
+ set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort.bat mpif77.bat mpif90.bat)
+
+ # Intel MPI compiler names for MSMPI
+ set(_MPI_MSVC_C_COMPILER_NAMES mpicl.bat)
+ set(_MPI_MSVC_CXX_COMPILER_NAMES mpicl.bat)
+else()
+ # Intel compiler names
+ set(_MPI_Intel_C_COMPILER_NAMES mpiicc)
+ set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc mpiicxx mpiic++)
+ set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort mpiif95 mpiif90 mpiif77)
+endif()
# PGI compiler names
set(_MPI_PGI_C_COMPILER_NAMES mpipgcc mppgcc)
@@ -154,548 +299,1127 @@ set(_MPI_XL_Fortran_COMPILER_NAMES mpixlf95 mpixlf95_r mpxlf95 mpxlf95
mpixlf77 mpixlf77_r mpxlf77 mpxlf77_r
mpixlf mpixlf_r mpxlf mpxlf_r)
-# append vendor-specific compilers to the list if we either don't know the compiler id,
-# or if we know it matches the regular compiler.
-foreach (lang C CXX Fortran)
- foreach (id GNU Intel PGI XL)
- if (NOT CMAKE_${lang}_COMPILER_ID OR CMAKE_${lang}_COMPILER_ID STREQUAL id)
- list(APPEND _MPI_${lang}_COMPILER_NAMES ${_MPI_${id}_${lang}_COMPILER_NAMES})
+# Prepend vendor-specific compiler wrappers to the list. If we don't know the compiler,
+# attempt all of them.
+# By attempting vendor-specific compiler names first, we should avoid situations where the compiler wrapper
+# stems from a proprietary MPI and won't know which compiler it's being used for. For instance, Intel MPI
+# controls its settings via the I_MPI_CC environment variables if the generic name is being used.
+# If we know which compiler we're working with, we can use the most specialized wrapper there is in order to
+# pick up the right settings for it.
+foreach (LANG IN ITEMS C CXX Fortran)
+ set(_MPI_${LANG}_COMPILER_NAMES "")
+ foreach (id IN ITEMS GNU Intel MSVC PGI XL)
+ if (NOT CMAKE_${LANG}_COMPILER_ID OR CMAKE_${LANG}_COMPILER_ID STREQUAL id)
+ list(APPEND _MPI_${LANG}_COMPILER_NAMES ${_MPI_${id}_${LANG}_COMPILER_NAMES}${MPI_EXECUTABLE_SUFFIX})
endif()
- unset(_MPI_${id}_${lang}_COMPILER_NAMES) # clean up the namespace here
+ unset(_MPI_${id}_${LANG}_COMPILER_NAMES)
endforeach()
+ list(APPEND _MPI_${LANG}_COMPILER_NAMES ${_MPI_${LANG}_GENERIC_COMPILER_NAMES}${MPI_EXECUTABLE_SUFFIX})
+ unset(_MPI_${LANG}_GENERIC_COMPILER_NAMES)
endforeach()
+# Names to try for mpiexec
+# Only mpiexec commands are guaranteed to behave as described in the standard,
+# mpirun commands are not covered by the standard in any way whatsoever.
+# lamexec is the executable for LAM/MPI, srun is for SLURM or Open MPI with SLURM support.
+# srun -n X <executable> is however a valid command, so it behaves 'like' mpiexec.
+set(_MPIEXEC_NAMES_BASE mpiexec mpiexec.hydra mpiexec.mpd mpirun lamexec srun)
-# Names to try for MPI exec
-set(_MPI_EXEC_NAMES mpiexec mpirun lamexec srun)
-
-# Grab the path to MPI from the registry if we're on windows.
-set(_MPI_PREFIX_PATH)
-if(WIN32)
- # MSMPI
- file(TO_CMAKE_PATH "$ENV{MSMPI_BIN}" msmpi_bin_path) # The default path ends with a '\' and doesn't mix with ';' when appending.
- list(APPEND _MPI_PREFIX_PATH "${msmpi_bin_path}")
- unset(msmpi_bin_path)
- list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MPI;InstallRoot]/Bin")
- list(APPEND _MPI_PREFIX_PATH "$ENV{MSMPI_INC}/..") # The SDK is installed separately from the runtime
- # MPICH
- list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]/..")
- list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH2;Path]")
- list(APPEND _MPI_PREFIX_PATH "$ENV{ProgramW6432}/MPICH2/")
- # INTEL MPI
- list(APPEND _MPI_PREFIX_PATH "$ENV{I_MPI_ROOT}/intel64/")
-
-endif()
-
-# Build a list of prefixes to search for MPI.
-foreach(SystemPrefixDir ${CMAKE_SYSTEM_PREFIX_PATH})
- foreach(MpiPackageDir ${_MPI_PREFIX_PATH})
- if(EXISTS ${SystemPrefixDir}/${MpiPackageDir})
- list(APPEND _MPI_PREFIX_PATH "${SystemPrefixDir}/${MpiPackageDir}")
- endif()
- endforeach()
+unset(_MPIEXEC_NAMES)
+foreach(_MPIEXEC_NAME IN LISTS _MPIEXEC_NAMES_BASE)
+ list(APPEND _MPIEXEC_NAMES "${_MPIEXEC_NAME}${MPI_EXECUTABLE_SUFFIX}")
endforeach()
+unset(_MPIEXEC_NAMES_BASE)
-function (_mpi_check_compiler compiler options cmdvar resvar)
+function (_MPI_check_compiler LANG QUERY_FLAG OUTPUT_VARIABLE RESULT_VARIABLE)
+ if(DEFINED MPI_${LANG}_COMPILER_FLAGS)
+ separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS NATIVE_COMMAND "${MPI_${LANG}_COMPILER_FLAGS}")
+ else()
+ separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS NATIVE_COMMAND "${MPI_COMPILER_FLAGS}")
+ endif()
execute_process(
- COMMAND "${compiler}" ${options}
- OUTPUT_VARIABLE cmdline OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_VARIABLE cmdline ERROR_STRIP_TRAILING_WHITESPACE
- RESULT_VARIABLE success)
- # Intel MPI 5.0.1 will return a zero return code even when the
- # argument to the MPI compiler wrapper is unknown. Attempt to
- # catch this case.
- if(cmdline MATCHES "undefined reference" OR cmdline MATCHES "unrecognized")
- set(success 255 )
- endif()
- set(${cmdvar} "${cmdline}" PARENT_SCOPE)
- set(${resvar} "${success}" PARENT_SCOPE)
+ COMMAND ${MPI_${LANG}_COMPILER} ${_MPI_COMPILER_WRAPPER_OPTIONS} ${QUERY_FLAG}
+ OUTPUT_VARIABLE WRAPPER_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE WRAPPER_OUTPUT ERROR_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE WRAPPER_RETURN)
+ # Some compiler wrappers will yield spurious zero return values, for example
+ # Intel MPI tolerates unknown arguments and if the MPI wrappers loads a shared
+ # library that has invalid or missing version information there would be warning
+ # messages emitted by ld.so in the compiler output. In either case, we'll treat
+ # the output as invalid.
+ if("${WRAPPER_OUTPUT}" MATCHES "undefined reference|unrecognized|need to set|no version information available")
+ set(WRAPPER_RETURN 255)
+ endif()
+ # Ensure that no error output might be passed upwards.
+ if(NOT WRAPPER_RETURN EQUAL 0)
+ unset(WRAPPER_OUTPUT)
+ endif()
+ set(${OUTPUT_VARIABLE} "${WRAPPER_OUTPUT}" PARENT_SCOPE)
+ set(${RESULT_VARIABLE} "${WRAPPER_RETURN}" PARENT_SCOPE)
endfunction()
-#
-# interrogate_mpi_compiler(lang try_libs)
-#
-# Attempts to extract compiler and linker args from an MPI compiler. The arguments set
-# by this function are:
-#
-# MPI_<lang>_INCLUDE_PATH MPI_<lang>_LINK_FLAGS MPI_<lang>_FOUND
-# MPI_<lang>_COMPILE_FLAGS MPI_<lang>_LIBRARIES
-#
-# MPI_<lang>_COMPILER must be set beforehand to the absolute path to an MPI compiler for
-# <lang>. Additionally, MPI_<lang>_INCLUDE_PATH and MPI_<lang>_LIBRARIES may be set
-# to skip autodetection.
-#
-# If try_libs is TRUE, this will also attempt to find plain MPI libraries in the usual
-# way. In general, this is not as effective as interrogating the compilers, as it
-# ignores language-specific flags and libraries. However, some MPI implementations
-# (Windows implementations) do not have compiler wrappers, so this approach must be used.
-#
-function (interrogate_mpi_compiler lang try_libs)
- # MPI_${lang}_NO_INTERROGATE will be set to a compiler name when the *regular* compiler was
- # discovered to be the MPI compiler. This happens on machines like the Cray XE6 that use
- # modules to set cc, CC, and ftn to the MPI compilers. If the user force-sets another MPI
- # compiler, MPI_${lang}_COMPILER won't be equal to MPI_${lang}_NO_INTERROGATE, and we'll
- # inspect that compiler anew. This allows users to set new compilers w/o rm'ing cache.
- string(COMPARE NOTEQUAL "${MPI_${lang}_NO_INTERROGATE}" "${MPI_${lang}_COMPILER}" interrogate)
-
- # If MPI is set already in the cache, don't bother with interrogating the compiler.
- if (interrogate AND ((NOT MPI_${lang}_INCLUDE_PATH) OR (NOT MPI_${lang}_LIBRARIES)))
- if (MPI_${lang}_COMPILER)
- # Check whether the -showme:compile option works. This indicates that we have either OpenMPI
- # or a newer version of LAM-MPI, and implies that -showme:link will also work.
- _mpi_check_compiler("${MPI_${lang}_COMPILER}" "-showme:compile" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN)
- if (MPI_COMPILER_RETURN EQUAL 0)
- # If we appear to have -showme:compile, then we should
- # also have -showme:link. Try it.
- execute_process(
- COMMAND ${MPI_${lang}_COMPILER} -showme:link
- OUTPUT_VARIABLE MPI_LINK_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_VARIABLE MPI_LINK_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
- RESULT_VARIABLE MPI_COMPILER_RETURN)
-
- if (MPI_COMPILER_RETURN EQUAL 0)
- # We probably have -showme:incdirs and -showme:libdirs as well,
- # so grab that while we're at it.
- execute_process(
- COMMAND ${MPI_${lang}_COMPILER} -showme:incdirs
- OUTPUT_VARIABLE MPI_INCDIRS OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_VARIABLE MPI_INCDIRS ERROR_STRIP_TRAILING_WHITESPACE)
-
- execute_process(
- COMMAND ${MPI_${lang}_COMPILER} -showme:libdirs
- OUTPUT_VARIABLE MPI_LIBDIRS OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_VARIABLE MPI_LIBDIRS ERROR_STRIP_TRAILING_WHITESPACE)
+function (_MPI_interrogate_compiler lang)
+ unset(MPI_COMPILE_CMDLINE)
+ unset(MPI_LINK_CMDLINE)
+
+ unset(MPI_COMPILE_OPTIONS_WORK)
+ unset(MPI_COMPILE_DEFINITIONS_WORK)
+ unset(MPI_INCLUDE_DIRS_WORK)
+ unset(MPI_LINK_FLAGS_WORK)
+ unset(MPI_LIB_NAMES_WORK)
+ unset(MPI_LIB_FULLPATHS_WORK)
+
+ # Check whether the -showme:compile option works. This indicates that we have either Open MPI
+ # or a newer version of LAM/MPI, and implies that -showme:link will also work.
+ # Open MPI also supports -show, but separates linker and compiler information
+ _MPI_check_compiler(${LANG} "-showme:compile" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN)
+ if (MPI_COMPILER_RETURN EQUAL 0)
+ _MPI_check_compiler(${LANG} "-showme:link" MPI_LINK_CMDLINE MPI_COMPILER_RETURN)
+
+ if (NOT MPI_COMPILER_RETURN EQUAL 0)
+ unset(MPI_COMPILE_CMDLINE)
+ endif()
+ endif()
- else()
- # reset things here if something went wrong.
- set(MPI_COMPILE_CMDLINE)
- set(MPI_LINK_CMDLINE)
- endif()
- endif ()
+ # MPICH and MVAPICH offer -compile-info and -link-info.
+ # For modern versions, both do the same as -show. However, for old versions, they do differ
+ # when called for mpicxx and mpif90 and it's necessary to use them over -show in order to find the
+ # removed MPI C++ bindings.
+ if (NOT MPI_COMPILER_RETURN EQUAL 0)
+ _MPI_check_compiler(${LANG} "-compile-info" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN)
+
+ if (MPI_COMPILER_RETURN EQUAL 0)
+ _MPI_check_compiler(${LANG} "-link-info" MPI_LINK_CMDLINE MPI_COMPILER_RETURN)
- # Older versions of LAM-MPI have "-showme". Try to find that.
if (NOT MPI_COMPILER_RETURN EQUAL 0)
- _mpi_check_compiler("${MPI_${lang}_COMPILER}" "-showme" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN)
+ unset(MPI_COMPILE_CMDLINE)
endif()
+ endif()
+ endif()
- # MVAPICH uses -compile-info and -link-info. Try them.
- if (NOT MPI_COMPILER_RETURN EQUAL 0)
- _mpi_check_compiler("${MPI_${lang}_COMPILER}" "-compile-info" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN)
-
- # If we have compile-info, also have link-info.
- if (MPI_COMPILER_RETURN EQUAL 0)
- execute_process(
- COMMAND ${MPI_${lang}_COMPILER} -link-info
- OUTPUT_VARIABLE MPI_LINK_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_VARIABLE MPI_LINK_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
- RESULT_VARIABLE MPI_COMPILER_RETURN)
- endif()
+ # MPICH, MVAPICH2 and Intel MPI just use "-show". Open MPI also offers this, but the
+ # -showme commands are more specialized.
+ if (NOT MPI_COMPILER_RETURN EQUAL 0)
+ _MPI_check_compiler(${LANG} "-show" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN)
+ endif()
- # make sure we got compile and link. Reset vars if something's wrong.
- if (NOT MPI_COMPILER_RETURN EQUAL 0)
- set(MPI_COMPILE_CMDLINE)
- set(MPI_LINK_CMDLINE)
- endif()
- endif()
+ # Older versions of LAM/MPI have "-showme". Open MPI also supports this.
+ # Unknown to MPICH, MVAPICH and Intel MPI.
+ if (NOT MPI_COMPILER_RETURN EQUAL 0)
+ _MPI_check_compiler(${LANG} "-showme" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN)
+ endif()
- # MPICH just uses "-show". Try it.
- if (NOT MPI_COMPILER_RETURN EQUAL 0)
- _mpi_check_compiler("${MPI_${lang}_COMPILER}" "-show" MPI_COMPILE_CMDLINE MPI_COMPILER_RETURN)
- endif()
+ if (NOT (MPI_COMPILER_RETURN EQUAL 0) OR NOT (DEFINED MPI_COMPILE_CMDLINE))
+ # Cannot interrogate this compiler, so exit.
+ set(MPI_${LANG}_WRAPPER_FOUND FALSE PARENT_SCOPE)
+ return()
+ endif()
+ unset(MPI_COMPILER_RETURN)
- if (MPI_COMPILER_RETURN EQUAL 0)
- # We have our command lines, but we might need to copy MPI_COMPILE_CMDLINE
- # into MPI_LINK_CMDLINE, if we didn't find the link line.
- if (NOT MPI_LINK_CMDLINE)
- set(MPI_LINK_CMDLINE ${MPI_COMPILE_CMDLINE})
- endif()
+ # We have our command lines, but we might need to copy MPI_COMPILE_CMDLINE
+ # into MPI_LINK_CMDLINE, if we didn't find the link line.
+ if (NOT DEFINED MPI_LINK_CMDLINE)
+ set(MPI_LINK_CMDLINE "${MPI_COMPILE_CMDLINE}")
+ endif()
+
+ # At this point, we obtained some output from a compiler wrapper that works.
+ # We'll now try to parse it into variables with meaning to us.
+ if("${LANG}" STREQUAL "Fortran")
+ # Some MPICH-1 and MVAPICH-1 versions return a three command answer for Fortran, consisting
+ # out of a symlink command for mpif.h, the actual compiler command and a deletion of the
+ # created symlink. We need to detect that case, remember the include path and drop the
+ # symlink/deletion operation to obtain the link/compile lines we'd usually expect.
+ if("${MPI_COMPILE_CMDLINE}" MATCHES "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h")
+ get_filename_component(MPI_INCLUDE_DIRS_WORK "${CMAKE_MATCH_1}" DIRECTORY)
+ string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}")
+ string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}")
+ string(REGEX REPLACE "\nrm -f mpif.h$" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}")
+ string(REGEX REPLACE "\nrm -f mpif.h$" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}")
+ endif()
+ endif()
+
+ # The Intel MPI wrapper on Linux will emit some objcopy commands after its compile command
+ # if -static_mpi was passed to the wrapper. To avoid spurious matches, we need to drop these lines.
+ if(UNIX)
+ string(REGEX REPLACE "(^|\n)objcopy[^\n]+(\n|$)" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}")
+ string(REGEX REPLACE "(^|\n)objcopy[^\n]+(\n|$)" "" MPI_LINK_CMDLINE "${MPI_LINK_CMDLINE}")
+ endif()
+
+ # Extract compile options from the compile command line.
+ string(REGEX MATCHALL "(^| )-f([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_OPTIONS "${MPI_COMPILE_CMDLINE}")
+
+ foreach(_MPI_COMPILE_OPTION IN LISTS MPI_ALL_COMPILE_OPTIONS)
+ string(REGEX REPLACE "^ " "" _MPI_COMPILE_OPTION "${_MPI_COMPILE_OPTION}")
+ # Ignore -fstack-protector directives: These occur on MPICH and MVAPICH when the libraries
+ # themselves were built with this flag. However, this flag is unrelated to using MPI, and
+ # we won't match the accompanying --param-ssp-size and -Wp,-D_FORTIFY_SOURCE flags and therefore
+ # produce inconsistent results with the regularly flags.
+ # Similarly, aliasing flags do not belong into our flag array.
+ if(NOT "${_MPI_COMPILE_OPTION}" MATCHES "^-f(stack-protector|(no-|)strict-aliasing|PI[CE]|pi[ce])")
+ list(APPEND MPI_COMPILE_OPTIONS_WORK "${_MPI_COMPILE_OPTION}")
+ endif()
+ endforeach()
+
+ # Same deal, with the definitions. We also treat arguments passed to the preprocessor directly.
+ string(REGEX MATCHALL "(^| )(-Wp,|-Xpreprocessor |)[-/]D([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_DEFINITIONS "${MPI_COMPILE_CMDLINE}")
+
+ foreach(_MPI_COMPILE_DEFINITION IN LISTS MPI_ALL_COMPILE_DEFINITIONS)
+ string(REGEX REPLACE "^ ?(-Wp,|-Xpreprocessor )?[-/]D" "" _MPI_COMPILE_DEFINITION "${_MPI_COMPILE_DEFINITION}")
+ string(REPLACE "\"" "" _MPI_COMPILE_DEFINITION "${_MPI_COMPILE_DEFINITION}")
+ if(NOT "${_MPI_COMPILE_DEFINITION}" MATCHES "^_FORTIFY_SOURCE.*")
+ list(APPEND MPI_COMPILE_DEFINITIONS_WORK "${_MPI_COMPILE_DEFINITION}")
+ endif()
+ endforeach()
+
+ # Extract include paths from compile command line
+ string(REGEX MATCHALL "(^| )[-/]I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}")
+
+ # If extracting failed to work, we'll try using -showme:incdirs.
+ if (NOT MPI_ALL_INCLUDE_PATHS)
+ _MPI_check_compiler(${LANG} "-showme:incdirs" MPI_INCDIRS_CMDLINE MPI_INCDIRS_COMPILER_RETURN)
+ if(MPI_INCDIRS_COMPILER_RETURN)
+ separate_arguments(MPI_ALL_INCLUDE_PATHS NATIVE_COMMAND "${MPI_INCDIRS_CMDLINE}")
+ endif()
+ endif()
+
+ foreach(_MPI_INCLUDE_PATH IN LISTS MPI_ALL_INCLUDE_PATHS)
+ string(REGEX REPLACE "^ ?[-/]I" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}")
+ string(REPLACE "\"" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}")
+ get_filename_component(_MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}" REALPATH)
+ list(APPEND MPI_INCLUDE_DIRS_WORK "${_MPI_INCLUDE_PATH}")
+ endforeach()
+
+ # Extract linker paths from the link command line
+ string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker |)(-L|[/-]LIBPATH:|[/-]libpath:)([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}")
+
+ # If extracting failed to work, we'll try using -showme:libdirs.
+ if (NOT MPI_ALL_LINK_PATHS)
+ _MPI_check_compiler(${LANG} "-showme:libdirs" MPI_LIBDIRS_CMDLINE MPI_LIBDIRS_COMPILER_RETURN)
+ if(MPI_LIBDIRS_COMPILER_RETURN)
+ separate_arguments(MPI_ALL_LINK_PATHS NATIVE_COMMAND "${MPI_LIBDIRS_CMDLINE}")
+ endif()
+ endif()
+
+ foreach(_MPI_LPATH IN LISTS MPI_ALL_LINK_PATHS)
+ string(REGEX REPLACE "^ ?(-Wl,|-Xlinker )?(-L|[/-]LIBPATH:|[/-]libpath:)" "" _MPI_LPATH "${_MPI_LPATH}")
+ string(REPLACE "\"" "" _MPI_LPATH "${_MPI_LPATH}")
+ get_filename_component(_MPI_LPATH "${_MPI_LPATH}" REALPATH)
+ list(APPEND MPI_LINK_DIRECTORIES_WORK "${_MPI_LPATH}")
+ endforeach()
+
+ # Extract linker flags from the link command line
+ string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker )([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")
+
+ foreach(_MPI_LINK_FLAG IN LISTS MPI_ALL_LINK_FLAGS)
+ string(STRIP "${_MPI_LINK_FLAG}" _MPI_LINK_FLAG)
+ # MPI might be marked to build with non-executable stacks but this should not propagate.
+ if (NOT "${_MPI_LINK_FLAG}" MATCHES "(-Wl,|-Xlinker )-z,noexecstack")
+ if (MPI_LINK_FLAGS_WORK)
+ string(APPEND MPI_LINK_FLAGS_WORK " ${_MPI_LINK_FLAG}")
else()
- message(STATUS "Unable to determine MPI from MPI driver ${MPI_${lang}_COMPILER}")
- set(MPI_COMPILE_CMDLINE)
- set(MPI_LINK_CMDLINE)
+ set(MPI_LINK_FLAGS_WORK "${_MPI_LINK_FLAG}")
endif()
+ endif()
+ endforeach()
- # Here, we're done with the interrogation part, and we'll try to extract args we care
- # about from what we learned from the compiler wrapper scripts.
-
- # If interrogation came back with something, extract our variable from the MPI command line
- if (MPI_COMPILE_CMDLINE OR MPI_LINK_CMDLINE)
- # Extract compile flags from the compile command line.
- string(REGEX MATCHALL "(^| )-[Df]([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_FLAGS "${MPI_COMPILE_CMDLINE}")
- set(MPI_COMPILE_FLAGS_WORK)
+ # Extract the set of libraries to link against from the link command
+ # line
+ string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
- foreach(FLAG ${MPI_ALL_COMPILE_FLAGS})
- string(REGEX REPLACE "^ " "" FLAG ${FLAG})
- if (MPI_COMPILE_FLAGS_WORK)
- set(MPI_COMPILE_FLAGS_WORK "${MPI_COMPILE_FLAGS_WORK} ${FLAG}")
- else()
- set(MPI_COMPILE_FLAGS_WORK ${FLAG})
- endif()
- endforeach()
+ foreach(_MPI_LIB_NAME IN LISTS MPI_LIBNAMES)
+ string(REGEX REPLACE "^ ?-l" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}")
+ string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}")
+ get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY)
+ if(NOT "${_MPI_LIB_PATH}" STREQUAL "")
+ list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}")
+ else()
+ list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}")
+ endif()
+ endforeach()
- # Extract include paths from compile command line
- string(REGEX MATCHALL "(^| )-I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}")
- set(MPI_INCLUDE_PATH_WORK)
+ if(WIN32)
+ # A compiler wrapper on Windows will just have the name of the
+ # library to link on its link line, potentially with a full path
+ string(REGEX MATCHALL "(^| )([^\" ]+\\.lib|\"[^\"]+\\.lib\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
+ foreach(_MPI_LIB_NAME IN LISTS MPI_LIBNAMES)
+ string(REGEX REPLACE "^ " "" _MPI_LIB_NAME "${_MPI_LIB_NAME}")
+ string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}")
+ get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY)
+ if(NOT "${_MPI_LIB_PATH}" STREQUAL "")
+ list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}")
+ else()
+ list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}")
+ endif()
+ endforeach()
+ else()
+ # On UNIX platforms, archive libraries can be given with full path.
+ string(REGEX MATCHALL "(^| )([^\" ]+\\.a|\"[^\"]+\\.a\")" MPI_LIBFULLPATHS "${MPI_LINK_CMDLINE}")
+ foreach(_MPI_LIB_NAME IN LISTS MPI_LIBFULLPATHS)
+ string(REGEX REPLACE "^ " "" _MPI_LIB_NAME "${_MPI_LIB_NAME}")
+ string(REPLACE "\"" "" _MPI_LIB_NAME "${_MPI_LIB_NAME}")
+ get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_NAME}" DIRECTORY)
+ if(NOT "${_MPI_LIB_PATH}" STREQUAL "")
+ list(APPEND MPI_LIB_FULLPATHS_WORK "${_MPI_LIB_NAME}")
+ else()
+ list(APPEND MPI_LIB_NAMES_WORK "${_MPI_LIB_NAME}")
+ endif()
+ endforeach()
+ endif()
- foreach(IPATH ${MPI_ALL_INCLUDE_PATHS})
- string(REGEX REPLACE "^ ?-I" "" IPATH ${IPATH})
- string(REPLACE "//" "/" IPATH ${IPATH})
- string(REPLACE "\"" "" IPATH ${IPATH})
- file(TO_CMAKE_PATH "${IPATH}" IPATH)
- list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH})
- endforeach()
+ # An MPI compiler wrapper could have its MPI libraries in the implictly
+ # linked directories of the compiler itself.
+ if(DEFINED CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES)
+ list(APPEND MPI_LINK_DIRECTORIES_WORK "${CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES}")
+ endif()
- # try using showme:incdirs if extracting didn't work.
- if (NOT MPI_INCLUDE_PATH_WORK)
- set(MPI_INCLUDE_PATH_WORK ${MPI_INCDIRS})
- separate_arguments(MPI_INCLUDE_PATH_WORK)
- endif()
+ # Determine full path names for all of the libraries that one needs
+ # to link against in an MPI program
+ unset(MPI_PLAIN_LIB_NAMES_WORK)
+ foreach(_MPI_LIB_NAME IN LISTS MPI_LIB_NAMES_WORK)
+ get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB_NAME}" NAME_WE)
+ list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}")
+ find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY
+ NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}"
+ HINTS ${MPI_LINK_DIRECTORIES_WORK}
+ DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI"
+ )
+ mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY)
+ endforeach()
- # If all else fails, just search for mpi.h in the normal include paths.
- if (NOT MPI_INCLUDE_PATH_WORK)
- set(MPI_HEADER_PATH "MPI_HEADER_PATH-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
- find_path(MPI_HEADER_PATH mpi.h
- HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
- PATH_SUFFIXES include)
- set(MPI_INCLUDE_PATH_WORK ${MPI_HEADER_PATH})
- endif()
+ # Deal with the libraries given with full path next
+ unset(MPI_DIRECT_LIB_NAMES_WORK)
+ foreach(_MPI_LIB_FULLPATH IN LISTS MPI_LIB_FULLPATHS_WORK)
+ get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB_FULLPATH}" NAME_WE)
+ get_filename_component(_MPI_LIB_NAME "${_MPI_LIB_FULLPATH}" NAME)
+ get_filename_component(_MPI_LIB_PATH "${_MPI_LIB_FULLPATH}" DIRECTORY)
+ list(APPEND MPI_DIRECT_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}")
+ find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY
+ NAMES "${_MPI_LIB_NAME}"
+ HINTS ${_MPI_LIB_PATH}
+ DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI"
+ )
+ mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY)
+ endforeach()
+ if(MPI_DIRECT_LIB_NAMES_WORK)
+ set(MPI_PLAIN_LIB_NAMES_WORK "${MPI_DIRECT_LIB_NAMES_WORK};${MPI_PLAIN_LIB_NAMES_WORK}")
+ endif()
- # Extract linker paths from the link command line
- string(REGEX MATCHALL "(^| |-Wl,)(-L|/LIBPATH:)([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}")
- set(MPI_LINK_PATH)
- foreach(LPATH ${MPI_ALL_LINK_PATHS})
- string(REGEX REPLACE "^(| |-Wl,)(-L|/LIBPATH:)" "" LPATH ${LPATH})
- string(REPLACE "//" "/" LPATH ${LPATH})
- list(APPEND MPI_LINK_PATH ${LPATH})
- endforeach()
+ # MPI might require pthread to work. The above mechanism wouldn't detect it, but we need to
+ # link it in that case. -lpthread is covered by the normal library treatment on the other hand.
+ if("${MPI_COMPILE_CMDLINE}" MATCHES "-pthread")
+ list(APPEND MPI_COMPILE_OPTIONS_WORK "-pthread")
+ if(MPI_LINK_FLAGS_WORK)
+ string(APPEND MPI_LINK_FLAGS_WORK " -pthread")
+ else()
+ set(MPI_LINK_FLAGS_WORK "-pthread")
+ endif()
+ endif()
- # try using showme:libdirs if extracting didn't work.
- if (NOT MPI_LINK_PATH)
- set(MPI_LINK_PATH ${MPI_LIBDIRS})
- separate_arguments(MPI_LINK_PATH)
- endif()
+ # If we found MPI, set up all of the appropriate cache entries
+ if(NOT MPI_${LANG}_COMPILE_OPTIONS)
+ set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_COMPILE_OPTIONS_WORK} CACHE STRING "MPI ${LANG} compilation options" FORCE)
+ endif()
+ if(NOT MPI_${LANG}_COMPILE_DEFINITIONS)
+ set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_COMPILE_DEFINITIONS_WORK} CACHE STRING "MPI ${LANG} compilation definitions" FORCE)
+ endif()
+ if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)
+ set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_INCLUDE_DIRS_WORK} CACHE STRING "MPI ${LANG} additional include directories" FORCE)
+ endif()
+ if(NOT MPI_${LANG}_LINK_FLAGS)
+ set(MPI_${LANG}_LINK_FLAGS ${MPI_LINK_FLAGS_WORK} CACHE STRING "MPI ${LANG} linker flags" FORCE)
+ endif()
+ if(NOT MPI_${LANG}_LIB_NAMES)
+ set(MPI_${LANG}_LIB_NAMES ${MPI_PLAIN_LIB_NAMES_WORK} CACHE STRING "MPI ${LANG} libraries to link against" FORCE)
+ endif()
+ set(MPI_${LANG}_WRAPPER_FOUND TRUE PARENT_SCOPE)
+endfunction()
- # Extract linker flags from the link command line
- string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker )([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")
- set(MPI_LINK_FLAGS_WORK)
- foreach(FLAG ${MPI_ALL_LINK_FLAGS})
- string(REGEX REPLACE "^ " "" FLAG ${FLAG})
- if (MPI_LINK_FLAGS_WORK)
- set(MPI_LINK_FLAGS_WORK "${MPI_LINK_FLAGS_WORK} ${FLAG}")
- else()
- set(MPI_LINK_FLAGS_WORK ${FLAG})
- endif()
- endforeach()
+function(_MPI_guess_settings LANG)
+ set(MPI_GUESS_FOUND FALSE)
+ # Currently only MSMPI and MPICH2 on Windows are supported, so we can skip this search if we're not targeting that.
+ if(WIN32)
+ # MSMPI
+
+ # The environment variables MSMPI_INC and MSMPILIB32/64 are the only ways of locating the MSMPI_SDK,
+ # which is installed separately from the runtime. Thus it's possible to have mpiexec but not MPI headers
+ # or import libraries and vice versa.
+ if(NOT MPI_GUESS_LIBRARY_NAME OR "${MPI_GUESS_LIBRARY_NAME}" STREQUAL "MSMPI")
+ # We first attempt to locate the msmpi.lib. Should be find it, we'll assume that the MPI present is indeed
+ # Microsoft MPI.
+ if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
+ set(MPI_MSMPI_LIB_PATH "$ENV{MSMPI_LIB64}")
+ set(MPI_MSMPI_INC_PATH_EXTRA "$ENV{MSMPI_INC}/x64")
+ else()
+ set(MPI_MSMPI_LIB_PATH "$ENV{MSMPI_LIB32}")
+ set(MPI_MSMPI_INC_PATH_EXTRA "$ENV{MSMPI_INC}/x86")
+ endif()
- # Extract the set of libraries to link against from the link command
- # line
- string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
- if(WIN32)
- # The intel wrappers on windows link against static versions of the MPI libraries.
- # The static libraries are simply listed on the command line without -l.
- # For instance: " icl ... impi.lib "
- string(REGEX MATCHALL "(^| )([^\" ]+)\\.lib" tmp "${MPI_LINK_CMDLINE}")
- list(APPEND MPI_LIBNAMES ${tmp})
+ find_library(MPI_msmpi_LIBRARY
+ NAMES msmpi
+ HINTS ${MPI_MSMPI_LIB_PATH}
+ DOC "Location of the msmpi library for Microsoft MPI")
+ mark_as_advanced(MPI_msmpi_LIBRARY)
+
+ if(MPI_msmpi_LIBRARY)
+ # Next, we attempt to locate the MPI header. Note that for Fortran we know that mpif.h is a way
+ # MSMPI can be used and therefore that header has to be present.
+ if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)
+ get_filename_component(MPI_MSMPI_INC_DIR "$ENV{MSMPI_INC}" REALPATH)
+ set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_MSMPI_INC_DIR}" CACHE STRING "MPI ${LANG} additional include directories" FORCE)
+ unset(MPI_MSMPI_INC_DIR)
endif()
- # add the compiler implicit directories because some compilers
- # such as the intel compiler have libraries that show up
- # in the showme list that can only be found in the implicit
- # link directories of the compiler.
- if (DEFINED CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES)
- set(MPI_LINK_PATH "${MPI_LINK_PATH};${CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES}")
- endif ()
-
- # Determine full path names for all of the libraries that one needs
- # to link against in an MPI program
- foreach(LIB ${MPI_LIBNAMES})
- string(REGEX REPLACE "^ ?-l" "" LIB ${LIB})
- if(WIN32)
- string(REGEX REPLACE "\\.lib$" "" LIB ${LIB})
+ # For MSMPI, one can compile the MPI module by building the mpi.f90 shipped with the MSMPI SDK,
+ # thus it might be present or provided by the user. Figuring out which is supported is done later on.
+ # The PGI Fortran compiler for instance ships a prebuilt set of modules in its own include folder.
+ # Should a user be employing PGI or have built its own set and provided it via cache variables, the
+ # splitting routine would have located the module files.
+
+ # For C and C++, we're done here (MSMPI does not ship the MPI-2 C++ bindings) - however, for Fortran
+ # we need some extra library to glue Fortran support together:
+ # MSMPI ships 2-4 Fortran libraries, each for different Fortran compiler behaviors. The library names
+ # ending with a c are using the cdecl calling convention, whereas those ending with an s are for Fortran
+ # implementations using stdcall. Therefore, the 64-bit MSMPI only ships those ending in 'c', whereas the 32-bit
+ # has both variants available.
+ # The second difference is the last but one letter, if it's an e(nd), the length of a string argument is
+ # passed by the Fortran compiler after all other arguments on the parameter list, if it's an m(ixed),
+ # it's passed immediately after the string address.
+
+ # To summarize:
+ # - msmpifec: CHARACTER length passed after the parameter list and using cdecl calling convention
+ # - msmpifmc: CHARACTER length passed directly after string address and using cdecl calling convention
+ # - msmpifes: CHARACTER length passed after the parameter list and using stdcall calling convention
+ # - msmpifms: CHARACTER length passed directly after string address and using stdcall calling convention
+ # 32-bit MSMPI ships all four libraries, 64-bit MSMPI ships only the first two.
+
+ # As is, Intel Fortran and PGI Fortran both use the 'ec' variant of the calling convention, whereas
+ # the old Compaq Visual Fortran compiler defaulted to the 'ms' version. It's possible to make Intel Fortran
+ # use the CVF calling convention using /iface:cvf, but we assume - and this is also assumed in FortranCInterface -
+ # this isn't the case. It's also possible to make CVF use the 'ec' variant, using /iface=(cref,nomixed_str_len_arg).
+
+ # Our strategy is now to locate all libraries, but enter msmpifec into the LIB_NAMES array.
+ # Should this not be adequate it's a straightforward way for a user to change the LIB_NAMES array and
+ # have his library found. Still, this should not be necessary outside of exceptional cases, as reasoned.
+ if ("${LANG}" STREQUAL "Fortran")
+ set(MPI_MSMPI_CALLINGCONVS c)
+ if("${CMAKE_SIZEOF_VOID_P}" EQUAL 4)
+ list(APPEND MPI_MSMPI_CALLINGCONVS s)
endif()
- string(STRIP ${LIB} LIB)
- # MPI_LIB is cached by find_library, but we don't want that. Clear it first.
- set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
- find_library(MPI_LIB NAMES ${LIB} HINTS ${MPI_LINK_PATH})
-
- if (MPI_LIB)
- list(APPEND MPI_LIBRARIES_WORK ${MPI_LIB})
- elseif (NOT MPI_FIND_QUIETLY)
- message(WARNING "Unable to find MPI library ${LIB}")
+ foreach(mpistrlenpos IN ITEMS e m)
+ foreach(mpicallingconv IN LISTS MPI_MSMPI_CALLINGCONVS)
+ find_library(MPI_msmpif${mpistrlenpos}${mpicallingconv}_LIBRARY
+ NAMES msmpif${mpistrlenpos}${mpicallingconv}
+ HINTS "${MPI_MSMPI_LIB_PATH}"
+ DOC "Location of the msmpi${mpistrlenpos}${mpicallingconv} library for Microsoft MPI")
+ mark_as_advanced(MPI_msmpif${mpistrlenpos}${mpicallingconv}_LIBRARY)
+ endforeach()
+ endforeach()
+ if(NOT MPI_${LANG}_LIB_NAMES)
+ set(MPI_${LANG}_LIB_NAMES "msmpi;msmpifec" CACHE STRING "MPI ${LANG} libraries to link against" FORCE)
endif()
- endforeach()
- # Sanity check MPI_LIBRARIES to make sure there are enough libraries
- list(LENGTH MPI_LIBRARIES_WORK MPI_NUMLIBS)
- list(LENGTH MPI_LIBNAMES MPI_NUMLIBS_EXPECTED)
- if (NOT MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED)
- set(MPI_LIBRARIES_WORK "MPI_${lang}_LIBRARIES-NOTFOUND")
+ # At this point we're *not* done. MSMPI requires an additional include file for Fortran giving the value
+ # of MPI_AINT. This file is called mpifptr.h located in the x64 and x86 subfolders, respectively.
+ find_path(MPI_mpifptr_INCLUDE_DIR
+ NAMES "mpifptr.h"
+ HINTS "${MPI_MSMPI_INC_PATH_EXTRA}"
+ DOC "Location of the mpifptr.h extra header for Microsoft MPI")
+ if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_VARS)
+ set(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS "mpifptr" CACHE STRING "MPI ${LANG} additional include directory variables, given in the form MPI_<name>_INCLUDE_DIR." FORCE)
+ endif()
+ mark_as_advanced(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS MPI_mpifptr_INCLUDE_DIR)
+ else()
+ if(NOT MPI_${LANG}_LIB_NAMES)
+ set(MPI_${LANG}_LIB_NAMES "msmpi" CACHE STRING "MPI ${LANG} libraries to link against" FORCE)
+ endif()
endif()
+ mark_as_advanced(MPI_${LANG}_LIB_NAMES)
+ set(MPI_GUESS_FOUND TRUE)
endif()
+ endif()
- elseif(try_libs)
- # If we didn't have an MPI compiler script to interrogate, attempt to find everything
- # with plain old find functions. This is nasty because MPI implementations have LOTS of
- # different library names, so this section isn't going to be very generic. We need to
- # make sure it works for MS MPI, though, since there are no compiler wrappers for that.
- find_path(MPI_HEADER_PATH mpi.h
- HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
- PATH_SUFFIXES include Inc)
- set(MPI_INCLUDE_PATH_WORK ${MPI_HEADER_PATH})
-
- # Decide between 32-bit and 64-bit libraries for Microsoft's MPI
- if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
- set(MS_MPI_ARCH_DIR x64)
- set(MS_MPI_ARCH_DIR2 amd64)
- else()
- set(MS_MPI_ARCH_DIR x86)
- set(MS_MPI_ARCH_DIR2 i386)
- endif()
+ # At this point there's not many MPIs that we could still consider.
+ # OpenMPI 1.6.x and below supported Windows, but these ship compiler wrappers that still work.
+ # The only other relevant MPI implementation without a wrapper is MPICH2, which had Windows support in 1.4.1p1 and older.
+ if(NOT MPI_GUESS_LIBRARY_NAME OR "${MPI_GUESS_LIBRARY_NAME}" STREQUAL "MPICH2")
+ set(MPI_MPICH_PREFIX_PATHS
+ "$ENV{ProgramW6432}/MPICH2/lib"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]/../lib"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH2;Path]/lib"
+ )
- set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
- find_library(MPI_LIB
- NAMES mpi mpich mpich2 msmpi
- HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
- PATH_SUFFIXES lib lib/${MS_MPI_ARCH_DIR} Lib Lib/${MS_MPI_ARCH_DIR} lib/${MS_MPI_ARCH_DIR2} Lib/${MS_MPI_ARCH_DIR2})
- set(MPI_LIBRARIES_WORK ${MPI_LIB})
-
- # Right now, we only know about the extra libs for C++.
- # We could add Fortran here (as there is usually libfmpich, etc.), but
- # this really only has to work with MS MPI on Windows.
- # Assume that other MPI's are covered by the compiler wrappers.
- if (${lang} STREQUAL CXX)
- set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
- find_library(MPI_LIB
- NAMES mpi++ mpicxx cxx mpi_cxx
- HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
- PATH_SUFFIXES lib)
- if (MPI_LIBRARIES_WORK AND MPI_LIB)
- list(APPEND MPI_LIBRARIES_WORK ${MPI_LIB})
+ # All of C, C++ and Fortran will need mpi.lib, so we'll look for this first
+ find_library(MPI_mpi_LIBRARY
+ NAMES mpi
+ HINTS ${MPI_MPICH_PREFIX_PATHS})
+ mark_as_advanced(MPI_mpi_LIBRARY)
+ # If we found mpi.lib, we detect the rest of MPICH2
+ if(MPI_mpi_LIBRARY)
+ set(MPI_MPICH_LIB_NAMES "mpi")
+ # If MPI-2 C++ bindings are requested, we need to locate cxx.lib as well.
+ # Otherwise, MPICH_SKIP_MPICXX will be defined and these bindings aren't needed.
+ if("${LANG}" STREQUAL "CXX" AND NOT MPI_CXX_SKIP_MPICXX)
+ find_library(MPI_cxx_LIBRARY
+ NAMES cxx
+ HINTS ${MPI_MPICH_PREFIX_PATHS})
+ mark_as_advanced(MPI_cxx_LIBRARY)
+ list(APPEND MPI_MPICH_LIB_NAMES "cxx")
+ # For Fortran, MPICH2 provides three different libraries:
+ # fmpich2.lib which uses uppercase symbols and cdecl,
+ # fmpich2s.lib which uses uppercase symbols and stdcall (32-bit only),
+ # fmpich2g.lib which uses lowercase symbols with double underscores and cdecl.
+ # fmpich2s.lib would be useful for Compaq Visual Fortran, fmpich2g.lib has to be used with GNU g77 and is also
+ # provided in the form of an .a archive for MinGW and Cygwin. From our perspective, fmpich2.lib is the only one
+ # we need to try, and if it doesn't work with the given Fortran compiler we'd find out later on during validation
+ elseif("${LANG}" STREQUAL "Fortran")
+ find_library(MPI_fmpich2_LIBRARY
+ NAMES fmpich2
+ HINTS ${MPI_MPICH_PREFIX_PATHS})
+ find_library(MPI_fmpich2s_LIBRARY
+ NAMES fmpich2s
+ HINTS ${MPI_MPICH_PREFIX_PATHS})
+ find_library(MPI_fmpich2g_LIBRARY
+ NAMES fmpich2g
+ HINTS ${MPI_MPICH_PREFIX_PATHS})
+ mark_as_advanced(MPI_fmpich2_LIBRARY MPI_fmpich2s_LIBRARY MPI_fmpich2g_LIBRARY)
+ list(APPEND MPI_MPICH_LIB_NAMES "fmpich2")
endif()
- endif()
- if (${lang} STREQUAL Fortran)
- set(MPI_HEADER_PATH "MPI_HEADER_PATH-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
- find_path(MPI_HEADER_PATH mpifptr.h
- HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
- PATH_SUFFIXES include Include include/${MS_MPI_ARCH_DIR} Include/${MS_MPI_ARCH_DIR2} Include/${MS_MPI_ARCH_DIR} include/${MS_MPI_ARCH_DIR2} Inc Inc/${MS_MPI_ARCH_DIR} Inc/${MS_MPI_ARCH_DIR2})
- if (MPI_INCLUDE_PATH_WORK AND MPI_HEADER_PATH)
- list(APPEND MPI_INCLUDE_PATH_WORK ${MPI_HEADER_PATH})
- endif ()
-
- set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
- find_library(MPI_LIB
- NAMES fmpi fmpich fmpich2 fmpich2g msmpifec msmpifmc
- HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
- PATH_SUFFIXES lib lib/${MS_MPI_ARCH_DIR} Lib Lib/${MS_MPI_ARCH_DIR})
- if (MPI_LIBRARIES_WORK AND MPI_LIB)
- list(APPEND MPI_LIBRARIES_WORK ${MPI_LIB})
- endif ()
- endif ()
-
- if (NOT MPI_LIBRARIES_WORK)
- set(MPI_LIBRARIES_WORK "MPI_${lang}_LIBRARIES-NOTFOUND")
+ if(NOT MPI_${LANG}_LIB_NAMES)
+ set(MPI_${LANG}_LIB_NAMES "${MPI_MPICH_LIB_NAMES}" CACHE STRING "MPI ${LANG} libraries to link against" FORCE)
+ endif()
+ unset(MPI_MPICH_LIB_NAMES)
+
+ if(NOT MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)
+ # For MPICH2, the include folder would be in ../include relative to the library folder.
+ get_filename_component(MPI_MPICH_ROOT_DIR "${MPI_mpi_LIBRARY}" DIRECTORY)
+ get_filename_component(MPI_MPICH_ROOT_DIR "${MPI_MPICH_ROOT_DIR}" DIRECTORY)
+ if(IS_DIRECTORY "${MPI_MPICH_ROOT_DIR}/include")
+ set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_MPICH_ROOT_DIR}/include" CACHE STRING "MPI ${LANG} additional include directory variables, given in the form MPI_<name>_INCLUDE_DIR." FORCE)
+ endif()
+ unset(MPI_MPICH_ROOT_DIR)
+ endif()
+ set(MPI_GUESS_FOUND TRUE)
endif()
+ unset(MPI_MPICH_PREFIX_PATHS)
endif()
+ endif()
+ set(MPI_${LANG}_GUESS_FOUND "${MPI_GUESS_FOUND}" PARENT_SCOPE)
+endfunction()
- # If we found MPI, set up all of the appropriate cache entries
- set(MPI_${lang}_COMPILE_FLAGS ${MPI_COMPILE_FLAGS_WORK} CACHE STRING "MPI ${lang} compilation flags" FORCE)
- set(MPI_${lang}_INCLUDE_PATH ${MPI_INCLUDE_PATH_WORK} CACHE STRING "MPI ${lang} include path" FORCE)
- set(MPI_${lang}_LINK_FLAGS ${MPI_LINK_FLAGS_WORK} CACHE STRING "MPI ${lang} linking flags" FORCE)
- set(MPI_${lang}_LIBRARIES ${MPI_LIBRARIES_WORK} CACHE STRING "MPI ${lang} libraries to link against" FORCE)
- mark_as_advanced(MPI_${lang}_COMPILE_FLAGS MPI_${lang}_INCLUDE_PATH MPI_${lang}_LINK_FLAGS MPI_${lang}_LIBRARIES)
+function(_MPI_adjust_compile_definitions LANG)
+ if("${LANG}" STREQUAL "CXX")
+ # To disable the C++ bindings, we need to pass some definitions since the mpi.h header has to deal with both C and C++
+ # bindings in MPI-2.
+ if(MPI_CXX_SKIP_MPICXX AND NOT MPI_${LANG}_COMPILE_DEFINITIONS MATCHES "SKIP_MPICXX")
+ # MPICH_SKIP_MPICXX is being used in MPICH and derivatives like MVAPICH or Intel MPI
+ # OMPI_SKIP_MPICXX is being used in Open MPI
+ # _MPICC_H is being used for IBM Platform MPI
+ list(APPEND MPI_${LANG}_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX" "OMPI_SKIP_MPICXX" "_MPICC_H")
+ set(MPI_${LANG}_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}" CACHE STRING "MPI ${LANG} compilation definitions" FORCE)
+ endif()
+ endif()
+endfunction()
+
+macro(_MPI_assemble_libraries LANG)
+ set(MPI_${LANG}_LIBRARIES "")
+ foreach(mpilib IN LISTS MPI_${LANG}_LIB_NAMES)
+ list(APPEND MPI_${LANG}_LIBRARIES ${MPI_${mpilib}_LIBRARY})
+ endforeach()
+endmacro()
- # clear out our temporary lib/header detection variable here.
- set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE INTERNAL "Scratch variable for MPI lib detection" FORCE)
- set(MPI_HEADER_PATH "MPI_HEADER_PATH-NOTFOUND" CACHE INTERNAL "Scratch variable for MPI header detection" FORCE)
+macro(_MPI_assemble_include_dirs LANG)
+ set(MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}")
+ if("${LANG}" MATCHES "(C|CXX)")
+ if(MPI_${LANG}_HEADER_DIR)
+ list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}")
+ endif()
+ else() # Fortran
+ if(MPI_${LANG}_F77_HEADER_DIR)
+ list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}")
+ endif()
+ if(MPI_${LANG}_MODULE_DIR AND NOT "${MPI_${LANG}_MODULE_DIR}" IN_LIST MPI_${LANG}_INCLUDE_DIRS)
+ list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}")
+ endif()
endif()
+ if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS)
+ foreach(mpiadditionalinclude IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS)
+ list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${mpiadditionalinclude}_INCLUDE_DIR}")
+ endforeach()
+ endif()
+endmacro()
- # finally set a found variable for each MPI language
- if (MPI_${lang}_INCLUDE_PATH AND MPI_${lang}_LIBRARIES)
- set(MPI_${lang}_FOUND TRUE PARENT_SCOPE)
- else()
- set(MPI_${lang}_FOUND FALSE PARENT_SCOPE)
+function(_MPI_split_include_dirs LANG)
+ # Backwards compatibility: Search INCLUDE_PATH if given.
+ if(MPI_${LANG}_INCLUDE_PATH)
+ list(APPEND MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_INCLUDE_PATH}")
endif()
+
+ # We try to find the headers/modules among those paths (and system paths)
+ # For C/C++, we just need to have a look for mpi.h.
+ if("${LANG}" MATCHES "(C|CXX)")
+ find_path(MPI_${LANG}_HEADER_DIR "mpi.h"
+ HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}
+ )
+ mark_as_advanced(MPI_${LANG}_HEADER_DIR)
+ if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)
+ list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}")
+ endif()
+ # Fortran is more complicated here: An implementation could provide
+ # any of the Fortran 77/90/2008 APIs for MPI. For example, MSMPI
+ # only provides Fortran 77 and - if mpi.f90 is built - potentially
+ # a Fortran 90 module.
+ elseif("${LANG}" STREQUAL "Fortran")
+ find_path(MPI_${LANG}_F77_HEADER_DIR "mpif.h"
+ HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}
+ )
+ find_path(MPI_${LANG}_MODULE_DIR
+ NAMES "mpi.mod" "mpi_f08.mod"
+ HINTS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}
+ )
+ if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)
+ list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS
+ "${MPI_${LANG}_F77_HEADER_DIR}"
+ "${MPI_${LANG}_MODULE_DIR}"
+ )
+ endif()
+ mark_as_advanced(MPI_${LANG}_F77_HEADER_DIR MPI_${LANG}_MODULE_DIR)
+ endif()
+ set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories" FORCE)
endfunction()
+macro(_MPI_create_imported_target LANG)
+ if(NOT TARGET MPI::MPI_${LANG})
+ add_library(MPI::MPI_${LANG} INTERFACE IMPORTED)
+ endif()
+
+ set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_OPTIONS "${MPI_${LANG}_COMPILE_OPTIONS}")
+ set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}")
-# This function attempts to compile with the regular compiler, to see if MPI programs
-# work with it. This is a last ditch attempt after we've tried interrogating mpicc and
-# friends, and after we've tried to find generic libraries. Works on machines like
-# Cray XE6, where the modules environment changes what MPI version cc, CC, and ftn use.
-function(try_regular_compiler lang success)
- set(scratch_directory ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
- if (${lang} STREQUAL Fortran)
- set(test_file ${scratch_directory}/cmake_mpi_test.f90)
- file(WRITE ${test_file}
- "program hello\n"
- "include 'mpif.h'\n"
- "integer ierror\n"
- "call MPI_INIT(ierror)\n"
- "call MPI_FINALIZE(ierror)\n"
- "end\n")
+ set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_LIBRARIES "")
+ if(MPI_${LANG}_LINK_FLAGS)
+ set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${MPI_${LANG}_LINK_FLAGS}")
+ endif()
+ # If the compiler links MPI implicitly, no libraries will be found as they're contained within
+ # CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES already.
+ if(MPI_${LANG}_LIBRARIES)
+ set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${MPI_${LANG}_LIBRARIES}")
+ endif()
+ # Given the new design of FindMPI, INCLUDE_DIRS will always be located, even under implicit linking.
+ set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${MPI_${LANG}_INCLUDE_DIRS}")
+endmacro()
+
+function(_MPI_try_staged_settings LANG MPI_TEST_FILE_NAME MODE RUN_BINARY)
+ set(WORK_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI")
+ set(SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/FindMPI")
+ set(BIN_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI/${MPI_TEST_FILE_NAME}_${LANG}.bin")
+ unset(MPI_TEST_COMPILE_DEFINITIONS)
+ if("${LANG}" STREQUAL "Fortran")
+ if("${MODE}" STREQUAL "F90_MODULE")
+ set(MPI_Fortran_INCLUDE_LINE "use mpi\n implicit none")
+ elseif("${MODE}" STREQUAL "F08_MODULE")
+ set(MPI_Fortran_INCLUDE_LINE "use mpi_f08\n implicit none")
+ else() # F77 header
+ set(MPI_Fortran_INCLUDE_LINE "implicit none\n include 'mpif.h'")
+ endif()
+ configure_file("${SRC_DIR}/${MPI_TEST_FILE_NAME}.f90.in" "${WORK_DIR}/${MPI_TEST_FILE_NAME}.f90" @ONLY)
+ set(MPI_TEST_SOURCE_FILE "${WORK_DIR}/${MPI_TEST_FILE_NAME}.f90")
+ elseif("${LANG}" STREQUAL "CXX")
+ configure_file("${SRC_DIR}/${MPI_TEST_FILE_NAME}.c" "${WORK_DIR}/${MPI_TEST_FILE_NAME}.cpp" COPYONLY)
+ set(MPI_TEST_SOURCE_FILE "${WORK_DIR}/${MPI_TEST_FILE_NAME}.cpp")
+ if("${MODE}" STREQUAL "TEST_MPICXX")
+ set(MPI_TEST_COMPILE_DEFINITIONS TEST_MPI_MPICXX)
+ endif()
+ else() # C
+ set(MPI_TEST_SOURCE_FILE "${SRC_DIR}/${MPI_TEST_FILE_NAME}.c")
+ endif()
+ if(RUN_BINARY)
+ try_run(MPI_RUN_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} MPI_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}
+ "${CMAKE_BINARY_DIR}" SOURCES "${MPI_TEST_SOURCE_FILE}"
+ COMPILE_DEFINITIONS ${MPI_TEST_COMPILE_DEFINITIONS}
+ LINK_LIBRARIES MPI::MPI_${LANG}
+ RUN_OUTPUT_VARIABLE MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE})
+ set(MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} "${MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}}" PARENT_SCOPE)
else()
- if (${lang} STREQUAL CXX)
- set(test_file ${scratch_directory}/cmake_mpi_test.cpp)
- else()
- set(test_file ${scratch_directory}/cmake_mpi_test.c)
- endif()
- file(WRITE ${test_file}
- "#include <mpi.h>\n"
- "int main(int argc, char **argv) {\n"
- " MPI_Init(&argc, &argv);\n"
- " MPI_Finalize();\n"
- "}\n")
- endif()
- try_compile(compiler_has_mpi ${scratch_directory} ${test_file})
- if (compiler_has_mpi)
- set(MPI_${lang}_NO_INTERROGATE ${CMAKE_${lang}_COMPILER} CACHE STRING "Whether to interrogate MPI ${lang} compiler" FORCE)
- set(MPI_${lang}_COMPILER ${CMAKE_${lang}_COMPILER} CACHE STRING "MPI ${lang} compiler" FORCE)
- set(MPI_${lang}_COMPILE_FLAGS "" CACHE STRING "MPI ${lang} compilation flags" FORCE)
- set(MPI_${lang}_INCLUDE_PATH "" CACHE STRING "MPI ${lang} include path" FORCE)
- set(MPI_${lang}_LINK_FLAGS "" CACHE STRING "MPI ${lang} linking flags" FORCE)
- set(MPI_${lang}_LIBRARIES "" CACHE STRING "MPI ${lang} libraries to link against" FORCE)
- endif()
- set(${success} ${compiler_has_mpi} PARENT_SCOPE)
- unset(compiler_has_mpi CACHE)
+ try_compile(MPI_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}
+ "${CMAKE_BINARY_DIR}" SOURCES "${MPI_TEST_SOURCE_FILE}"
+ COMPILE_DEFINITIONS ${MPI_TEST_COMPILE_DEFINITIONS}
+ LINK_LIBRARIES MPI::MPI_${LANG}
+ COPY_FILE "${BIN_FILE}")
+ endif()
endfunction()
-# End definitions, commence real work here.
+macro(_MPI_check_lang_works LANG)
+ # For Fortran we may have by the MPI-3 standard an implementation that provides:
+ # - the mpi_f08 module
+ # - *both*, the mpi module and 'mpif.h'
+ # Since older MPI standards (MPI-1) did not define anything but 'mpif.h', we need to check all three individually.
+ if( NOT MPI_${LANG}_WORKS )
+ if("${LANG}" STREQUAL "Fortran")
+ set(MPI_Fortran_INTEGER_LINE "(kind=MPI_INTEGER_KIND)")
+ _MPI_try_staged_settings(${LANG} test_mpi F77_HEADER FALSE)
+ _MPI_try_staged_settings(${LANG} test_mpi F90_MODULE FALSE)
+ _MPI_try_staged_settings(${LANG} test_mpi F08_MODULE FALSE)
+
+ set(MPI_${LANG}_WORKS FALSE)
+
+ foreach(mpimethod IN ITEMS F77_HEADER F08_MODULE F90_MODULE)
+ if(MPI_RESULT_${LANG}_test_mpi_${mpimethod})
+ set(MPI_${LANG}_WORKS TRUE)
+ set(MPI_${LANG}_HAVE_${mpimethod} TRUE)
+ else()
+ set(MPI_${LANG}_HAVE_${mpimethod} FALSE)
+ endif()
+ endforeach()
+ # MPI-1 versions had no MPI_INTGER_KIND defined, so we need to try without it.
+ # However, MPI-1 also did not define the Fortran 90 and 08 modules, so we only try the F77 header.
+ unset(MPI_Fortran_INTEGER_LINE)
+ if(NOT MPI_${LANG}_WORKS)
+ _MPI_try_staged_settings(${LANG} test_mpi F77_HEADER_NOKIND FALSE)
+ if(MPI_RESULT_${LANG}_test_mpi_F77_HEADER_NOKIND)
+ set(MPI_${LANG}_WORKS TRUE)
+ set(MPI_${LANG}_HAVE_F77_HEADER TRUE)
+ endif()
+ endif()
+ else()
+ _MPI_try_staged_settings(${LANG} test_mpi normal FALSE)
+ # If 'test_mpi' built correctly, we've found valid MPI settings. There might not be MPI-2 C++ support, but there can't
+ # be MPI-2 C++ support without the C bindings being present, so checking for them is sufficient.
+ set(MPI_${LANG}_WORKS "${MPI_RESULT_${LANG}_test_mpi_normal}")
+ endif()
+ endif()
+endmacro()
+
+# Some systems install various MPI implementations in separate folders in some MPI prefix
+# This macro enumerates all such subfolders and adds them to the list of hints that will be searched.
+macro(MPI_search_mpi_prefix_folder PREFIX_FOLDER)
+ if(EXISTS "${PREFIX_FOLDER}")
+ file(GLOB _MPI_folder_children RELATIVE "${PREFIX_FOLDER}" "${PREFIX_FOLDER}/*")
+ foreach(_MPI_folder_child IN LISTS _MPI_folder_children)
+ if(IS_DIRECTORY "${PREFIX_FOLDER}/${_MPI_folder_child}")
+ list(APPEND MPI_HINT_DIRS "${PREFIX_FOLDER}/${_MPI_folder_child}")
+ endif()
+ endforeach()
+ endif()
+endmacro()
+
+set(MPI_HINT_DIRS ${MPI_HOME} $ENV{MPI_HOME} $ENV{I_MPI_ROOT})
+if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux")
+ # SUSE Linux Enterprise Server stores its MPI implementations under /usr/lib64/mpi/gcc/<name>
+ # We enumerate the subfolders and append each as a prefix
+ MPI_search_mpi_prefix_folder("/usr/lib64/mpi/gcc")
+elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
+ # MSMPI stores its runtime in a special folder, this adds the possible locations to the hints.
+ list(APPEND MPI_HINT_DIRS $ENV{MSMPI_BIN} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MPI;InstallRoot]")
+elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "FreeBSD")
+ # FreeBSD ships mpich under the normal system paths - but available openmpi implementations
+ # will be found in /usr/local/mpi/<name>
+ MPI_search_mpi_prefix_folder("/usr/local/mpi/")
+endif()
-# Most mpi distros have some form of mpiexec which gives us something we can reliably look for.
-find_program(MPIEXEC
- NAMES ${_MPI_EXEC_NAMES}
- HINTS ${MPI_HOME} $ENV{MPI_HOME}
- PATHS ${_MPI_PREFIX_PATH}
- PATH_SUFFIXES bin
+# Most MPI distributions have some form of mpiexec or mpirun which gives us something we can look for.
+# The MPI standard does not mandate the existence of either, but instead only makes requirements if a distribution
+# ships an mpiexec program (mpirun executables are not regulated by the standard).
+find_program(MPIEXEC_EXECUTABLE
+ NAMES ${_MPIEXEC_NAMES}
+ PATH_SUFFIXES bin sbin
+ HINTS ${MPI_HINT_DIRS}
DOC "Executable for running MPI programs.")
# call get_filename_component twice to remove mpiexec and the directory it exists in (typically bin).
# This gives us a fairly reliable base directory to search for /bin /lib and /include from.
-get_filename_component(_MPI_BASE_DIR "${MPIEXEC}" PATH)
+get_filename_component(_MPI_BASE_DIR "${MPIEXEC_EXECUTABLE}" PATH)
get_filename_component(_MPI_BASE_DIR "${_MPI_BASE_DIR}" PATH)
# According to the MPI standard, section 8.8 -n is a guaranteed, and the only guaranteed way to
# launch an MPI process using mpiexec if such a program exists.
-set(MPIEXEC_NUMPROC_FLAG "-n" CACHE STRING "Flag used by MPI to specify the number of processes for MPIEXEC; the next option will be the number of processes.")
-set(MPIEXEC_PREFLAGS "" CACHE STRING "These flags will be directly before the executable that is being run by MPIEXEC.")
-set(MPIEXEC_POSTFLAGS "" CACHE STRING "These flags will come after all flags given to MPIEXEC.")
-
-# Set the number of processes to the processor count and the previous default
-# of 2 if that couldn't be determined.
-include(${CMAKE_ROOT}/Modules/ProcessorCount.cmake)
-ProcessorCount(_MPIEXEC_NUMPROCS)
-if("${_MPIEXEC_NUMPROCS}" EQUAL "0")
- set(_MPIEXEC_NUMPROCS 2)
-endif()
-set(MPIEXEC_MAX_NUMPROCS "${_MPIEXEC_NUMPROCS}" CACHE STRING "Maximum number of processors available to run MPI applications.")
-unset(_MPIEXEC_NUMPROCS)
-mark_as_advanced(MPIEXEC MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS)
+set(MPIEXEC_NUMPROC_FLAG "-n" CACHE STRING "Flag used by MPI to specify the number of processes for mpiexec; the next option will be the number of processes.")
+set(MPIEXEC_PREFLAGS "" CACHE STRING "These flags will be directly before the executable that is being run by mpiexec.")
+set(MPIEXEC_POSTFLAGS "" CACHE STRING "These flags will be placed after all flags passed to mpiexec.")
+# Set the number of processes to the physical processor count
+cmake_host_system_information(RESULT _MPIEXEC_NUMPROCS QUERY NUMBER_OF_PHYSICAL_CORES)
+set(MPIEXEC_MAX_NUMPROCS "${_MPIEXEC_NUMPROCS}" CACHE STRING "Maximum number of processors available to run MPI applications.")
+unset(_MPIEXEC_NUMPROCS)
+mark_as_advanced(MPIEXEC_EXECUTABLE MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS)
#=============================================================================
# Backward compatibility input hacks. Propagate the FindMPI hints to C and
# CXX if the respective new versions are not defined. Translate the old
-# MPI_LIBRARY and MPI_EXTRA_LIBRARY to respective MPI_${lang}_LIBRARIES.
+# MPI_LIBRARY and MPI_EXTRA_LIBRARY to respective MPI_${LANG}_LIBRARIES.
#
# Once we find the new variables, we translate them back into their old
# equivalents below.
-foreach (lang C CXX)
+foreach (LANG IN ITEMS C CXX)
# Old input variables.
set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS)
# Set new vars based on their old equivalents, if the new versions are not already set.
foreach (var ${_MPI_OLD_INPUT_VARS})
- if (NOT MPI_${lang}_${var} AND MPI_${var})
- set(MPI_${lang}_${var} "${MPI_${var}}")
+ if (NOT MPI_${LANG}_${var} AND MPI_${var})
+ set(MPI_${LANG}_${var} "${MPI_${var}}")
endif()
endforeach()
- # Special handling for MPI_LIBRARY and MPI_EXTRA_LIBRARY, which we nixed in the
- # new FindMPI. These need to be merged into MPI_<lang>_LIBRARIES
- if (NOT MPI_${lang}_LIBRARIES AND (MPI_LIBRARY OR MPI_EXTRA_LIBRARY))
- set(MPI_${lang}_LIBRARIES ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
+ # Chop the old compile flags into options and definitions
+ if(MPI_${LANG}_COMPILE_FLAGS)
+ unset(MPI_${LANG}_COMPILE_OPTIONS)
+ unset(MPI_${LANG}_COMPILE_DEFINITIONS)
+ separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}")
+ foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS)
+ if("${_MPI_FLAG}" MATCHES "^ *[-/D]([^ ]+)")
+ list(APPEND MPI_${LANG}_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}")
+ else()
+ list(APPEND MPI_${LANG}_COMPILE_FLAGS "${_MPI_FLAG}")
+ endif()
+ endforeach()
+ unset(MPI_SEPARATE_FLAGS)
+ endif()
+
+ # If a list of libraries was given, we'll split it into new-style cache variables
+ if(NOT MPI_${LANG}_LIB_NAMES)
+ foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY)
+ get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE)
+ get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME)
+ get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY)
+ list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}")
+ find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY
+ NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}"
+ HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB}
+ DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI"
+ )
+ mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY)
+ endforeach()
endif()
endforeach()
#=============================================================================
+unset(MPI_VERSION)
+unset(MPI_VERSION_MAJOR)
+unset(MPI_VERSION_MINOR)
+
+unset(_MPI_MIN_VERSION)
# This loop finds the compilers and sends them off for interrogation.
-foreach (lang C CXX Fortran)
- if (CMAKE_${lang}_COMPILER_WORKS)
- # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler.
- if (MPI_${lang}_COMPILER)
- if (NOT IS_ABSOLUTE "${MPI_${lang}_COMPILER}")
- # Get rid of our default list of names and just search for the name the user wants.
- set(_MPI_${lang}_COMPILER_NAMES ${MPI_${lang}_COMPILER})
- set(MPI_${lang}_COMPILER "MPI_${lang}_COMPILER-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
- endif()
- # If the user specifies a compiler, we don't want to try to search libraries either.
- set(try_libs FALSE)
+foreach(LANG IN ITEMS C CXX Fortran)
+ if(CMAKE_${LANG}_COMPILER_LOADED)
+ if(NOT MPI_FIND_COMPONENTS)
+ set(_MPI_FIND_${LANG} TRUE)
+ elseif( ${LANG} IN_LIST MPI_FIND_COMPONENTS)
+ set(_MPI_FIND_${LANG} TRUE)
+ elseif( ${LANG} STREQUAL CXX AND NOT MPI_CXX_SKIP_MPICXX AND MPICXX IN_LIST MPI_FIND_COMPONENTS )
+ set(_MPI_FIND_${LANG} TRUE)
else()
- set(try_libs TRUE)
+ set(_MPI_FIND_${LANG} FALSE)
endif()
+ else()
+ set(_MPI_FIND_${LANG} FALSE)
+ endif()
+ if(_MPI_FIND_${LANG})
+ if( ${LANG} STREQUAL CXX AND NOT MPICXX IN_LIST MPI_FIND_COMPONENTS )
+ set(MPI_CXX_SKIP_MPICXX FALSE CACHE BOOL "If true, the MPI-2 C++ bindings are disabled using definitions.")
+ mark_as_advanced(MPI_CXX_SKIP_MPICXX)
+ endif()
+ if(NOT (MPI_${LANG}_LIB_NAMES AND (MPI_${LANG}_INCLUDE_PATH OR MPI_${LANG}_INCLUDE_DIRS OR MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS)))
+ if(NOT MPI_${LANG}_COMPILER AND NOT MPI_ASSUME_NO_BUILTIN_MPI)
+ # Should the imported targets be empty, we effectively try whether the compiler supports MPI on its own, which is the case on e.g.
+ # Cray PrgEnv.
+ _MPI_create_imported_target(${LANG})
+ _MPI_check_lang_works(${LANG})
+
+ # If the compiler can build MPI code on its own, it functions as an MPI compiler and we'll set the variable to point to it.
+ if(MPI_${LANG}_WORKS)
+ set(MPI_${LANG}_COMPILER "${CMAKE_${LANG}_COMPILER}" CACHE FILEPATH "MPI compiler for ${LANG}" FORCE)
+ endif()
+ endif()
- find_program(MPI_${lang}_COMPILER
- NAMES ${_MPI_${lang}_COMPILER_NAMES}
- HINTS ${_MPI_BASE_DIR}/bin
- PATHS ${_MPI_PREFIX_PATH}
- )
- interrogate_mpi_compiler(${lang} ${try_libs})
- mark_as_advanced(MPI_${lang}_COMPILER)
+ # If the user specified a library name we assume they prefer that library over a wrapper. If not, they can disable skipping manually.
+ if(NOT DEFINED MPI_SKIP_COMPILER_WRAPPER AND MPI_GUESS_LIBRARY_NAME)
+ set(MPI_SKIP_COMPILER_WRAPPER TRUE)
+ endif()
+ if(NOT MPI_SKIP_COMPILER_WRAPPER)
+ if(MPI_${LANG}_COMPILER)
+ # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler.
+ if (NOT IS_ABSOLUTE "${MPI_${LANG}_COMPILER}")
+ # Get rid of our default list of names and just search for the name the user wants.
+ set(_MPI_${LANG}_COMPILER_NAMES "${MPI_${LANG}_COMPILER}")
+ unset(MPI_${LANG}_COMPILER CACHE)
+ endif()
+ # If the user specifies a compiler, we don't want to try to search libraries either.
+ set(MPI_PINNED_COMPILER TRUE)
+ else()
+ set(MPI_PINNED_COMPILER FALSE)
+ endif()
- # last ditch try -- if nothing works so far, just try running the regular compiler and
- # see if we can create an MPI executable.
- set(regular_compiler_worked 0)
- if (NOT MPI_${lang}_LIBRARIES OR NOT MPI_${lang}_INCLUDE_PATH)
- try_regular_compiler(${lang} regular_compiler_worked)
- endif()
+ # If we have an MPI base directory, we'll try all compiler names in that one first.
+ # This should prevent mixing different MPI environments
+ if(_MPI_BASE_DIR)
+ find_program(MPI_${LANG}_COMPILER
+ NAMES ${_MPI_${LANG}_COMPILER_NAMES}
+ PATH_SUFFIXES bin sbin
+ HINTS ${_MPI_BASE_DIR}
+ NO_DEFAULT_PATH
+ DOC "MPI compiler for ${LANG}"
+ )
+ endif()
+
+ # If the base directory did not help (for example because the mpiexec isn't in the same directory as the compilers),
+ # we shall try searching in the default paths.
+ find_program(MPI_${LANG}_COMPILER
+ NAMES ${_MPI_${LANG}_COMPILER_NAMES}
+ PATH_SUFFIXES bin sbin
+ DOC "MPI compiler for ${LANG}"
+ )
+
+ if(MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER)
+ set(MPI_SKIP_GUESSING TRUE)
+ elseif(MPI_${LANG}_COMPILER)
+ _MPI_interrogate_compiler(${LANG})
+ else()
+ set(MPI_${LANG}_WRAPPER_FOUND FALSE)
+ endif()
+ else()
+ set(MPI_${LANG}_WRAPPER_FOUND FALSE)
+ set(MPI_PINNED_COMPILER FALSE)
+ endif()
- # add fortran mpi module path if ENV VAR exists
- set (MPI_${lang}_INCLUDE_PATH "${MPI_${lang}_INCLUDE_PATH};$ENV{MPI_FORTRAN_MOD_DIR}")
+ if(NOT MPI_${LANG}_WRAPPER_FOUND AND NOT MPI_PINNED_COMPILER)
+ # For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the
+ # settings for C. An MPI distribution that is in this situation would be IBM Platform MPI.
+ if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND)
+ set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" )
+ set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" )
+ set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories")
+ set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" )
+ set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" )
+ set(MPI_${LANG}_WRAPPER_FOUND TRUE)
+ elseif(NOT MPI_SKIP_GUESSING)
+ _MPI_guess_settings(${LANG})
+ endif()
+ endif()
+ endif()
- set(MPI_${lang}_FIND_QUIETLY ${MPI_FIND_QUIETLY})
- set(MPI_${lang}_FIND_REQUIRED ${MPI_FIND_REQUIRED})
- set(MPI_${lang}_FIND_VERSION ${MPI_FIND_VERSION})
- set(MPI_${lang}_FIND_VERSION_EXACT ${MPI_FIND_VERSION_EXACT})
+ _MPI_split_include_dirs(${LANG})
+ if(NOT MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER)
+ _MPI_assemble_include_dirs(${LANG})
+ _MPI_assemble_libraries(${LANG})
+ endif()
+ _MPI_adjust_compile_definitions(${LANG})
+ # We always create imported targets even if they're empty
+ _MPI_create_imported_target(${LANG})
- if (regular_compiler_worked)
- find_package_handle_standard_args(MPI_${lang} DEFAULT_MSG MPI_${lang}_COMPILER)
- else()
- find_package_handle_standard_args(MPI_${lang} DEFAULT_MSG MPI_${lang}_LIBRARIES MPI_${lang}_INCLUDE_PATH)
+ if(NOT MPI_${LANG}_WORKS)
+ _MPI_check_lang_works(${LANG})
endif()
- if(MPI_${lang}_FOUND)
- if(NOT TARGET MPI::MPI_${lang})
- add_library(MPI::MPI_${lang} INTERFACE IMPORTED)
+ # Next, we'll initialize the MPI variables that have not been previously set.
+ set(MPI_${LANG}_COMPILE_OPTIONS "" CACHE STRING "MPI ${LANG} compilation flags" )
+ set(MPI_${LANG}_COMPILE_DEFINITIONS "" CACHE STRING "MPI ${LANG} compilation definitions" )
+ set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "MPI ${LANG} additional include directories")
+ set(MPI_${LANG}_LINK_FLAGS "" CACHE STRING "MPI ${LANG} linker flags" )
+ set(MPI_${LANG}_LIB_NAMES "" CACHE STRING "MPI ${LANG} libraries to link against" )
+ mark_as_advanced(MPI_${LANG}_COMPILE_OPTIONS MPI_${LANG}_COMPILE_DEFINITIONS MPI_${LANG}_LINK_FLAGS
+ MPI_${LANG}_LIB_NAMES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS MPI_${LANG}_COMPILER)
+
+ # If we've found MPI, then we'll perform additional analysis: Determine the MPI version, MPI library version, supported
+ # MPI APIs (i.e. MPI-2 C++ bindings). For Fortran we also need to find specific parameters if we're under MPI-3.
+ if(MPI_${LANG}_WORKS)
+ if("${LANG}" STREQUAL "CXX" AND NOT DEFINED MPI_MPICXX_FOUND)
+ if(NOT MPI_CXX_SKIP_MPICXX AND NOT MPI_CXX_VALIDATE_SKIP_MPICXX)
+ _MPI_try_staged_settings(${LANG} test_mpi MPICXX FALSE)
+ if(MPI_RESULT_${LANG}_test_mpi_MPICXX)
+ set(MPI_MPICXX_FOUND TRUE)
+ else()
+ set(MPI_MPICXX_FOUND FALSE)
+ endif()
+ else()
+ set(MPI_MPICXX_FOUND FALSE)
+ endif()
+ endif()
+
+ # At this point, we know the bindings present but not the MPI version or anything else.
+ if(NOT DEFINED MPI_${LANG}_VERSION)
+ unset(MPI_${LANG}_VERSION_MAJOR)
+ unset(MPI_${LANG}_VERSION_MINOR)
+ endif()
+ set(MPI_BIN_FOLDER ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI)
+
+ # For Fortran, we'll want to use the most modern MPI binding to test capabilities other than the
+ # Fortran parameters, since those depend on the method of consumption.
+ # For C++, we can always use the C bindings, and should do so, since the C++ bindings do not exist in MPI-3
+ # whereas the C bindings do, and the C++ bindings never offered any feature advantage over their C counterparts.
+ if("${LANG}" STREQUAL "Fortran")
+ if(MPI_${LANG}_HAVE_F08_MODULE)
+ set(MPI_${LANG}_HIGHEST_METHOD F08_MODULE)
+ elseif(MPI_${LANG}_HAVE_F90_MODULE)
+ set(MPI_${LANG}_HIGHEST_METHOD F90_MODULE)
+ else()
+ set(MPI_${LANG}_HIGHEST_METHOD F77_HEADER)
+ endif()
+
+ # Another difference between C and Fortran is that we can't use the preprocessor to determine whether MPI_VERSION
+ # and MPI_SUBVERSION are provided. These defines did not exist in MPI 1.0 and 1.1 and therefore might not
+ # exist. For C/C++, test_mpi.c will handle the MPI_VERSION extraction, but for Fortran, we need mpiver.f90.
+ if(NOT DEFINED MPI_${LANG}_VERSION)
+ _MPI_try_staged_settings(${LANG} mpiver ${MPI_${LANG}_HIGHEST_METHOD} FALSE)
+ if(MPI_RESULT_${LANG}_mpiver_${MPI_${LANG}_HIGHEST_METHOD})
+ file(STRINGS ${MPI_BIN_FOLDER}/mpiver_${LANG}.bin _MPI_VERSION_STRING LIMIT_COUNT 1 REGEX "INFO:MPI-VER")
+ if("${_MPI_VERSION_STRING}" MATCHES ".*INFO:MPI-VER\\[([0-9]+)\\.([0-9]+)\\].*")
+ set(MPI_${LANG}_VERSION_MAJOR "${CMAKE_MATCH_1}")
+ set(MPI_${LANG}_VERSION_MINOR "${CMAKE_MATCH_2}")
+ set(MPI_${LANG}_VERSION "${MPI_${LANG}_VERSION_MAJOR}.${MPI_${LANG}_VERSION_MINOR}")
+ endif()
+ endif()
+ endif()
+
+ # Finally, we want to find out which capabilities a given interface supports, compare the MPI-3 standard.
+ # This is determined by interface specific parameters MPI_SUBARRAYS_SUPPORTED and MPI_ASYNC_PROTECTS_NONBLOCKING
+ # and might vary between the different methods of consumption.
+ if(MPI_DETERMINE_Fortran_CAPABILITIES AND NOT MPI_Fortran_CAPABILITIES_DETERMINED)
+ foreach(mpimethod IN ITEMS F08_MODULE F90_MODULE F77_HEADER)
+ if(MPI_${LANG}_HAVE_${mpimethod})
+ set(MPI_${LANG}_${mpimethod}_SUBARRAYS FALSE)
+ set(MPI_${LANG}_${mpimethod}_ASYNCPROT FALSE)
+ _MPI_try_staged_settings(${LANG} fortranparam_mpi ${mpimethod} TRUE)
+ if(MPI_RESULT_${LANG}_fortranparam_mpi_${mpimethod} AND
+ NOT "${MPI_RUN_RESULT_${LANG}_fortranparam_mpi_${mpimethod}}" STREQUAL "FAILED_TO_RUN")
+ if("${MPI_RUN_OUTPUT_${LANG}_fortranparam_mpi_${mpimethod}}" MATCHES
+ ".*INFO:SUBARRAYS\\[ *([TF]) *\\]-ASYNCPROT\\[ *([TF]) *\\].*")
+ if("${CMAKE_MATCH_1}" STREQUAL "T")
+ set(MPI_${LANG}_${mpimethod}_SUBARRAYS TRUE)
+ endif()
+ if("${CMAKE_MATCH_2}" STREQUAL "T")
+ set(MPI_${LANG}_${mpimethod}_ASYNCPROT TRUE)
+ endif()
+ endif()
+ endif()
+ endif()
+ endforeach()
+ set(MPI_Fortran_CAPABILITIES_DETERMINED TRUE)
+ endif()
+ else()
+ set(MPI_${LANG}_HIGHEST_METHOD normal)
+
+ # By the MPI-2 standard, MPI_VERSION and MPI_SUBVERSION are valid for both C and C++ bindings.
+ if(NOT DEFINED MPI_${LANG}_VERSION)
+ file(STRINGS ${MPI_BIN_FOLDER}/test_mpi_${LANG}.bin _MPI_VERSION_STRING LIMIT_COUNT 1 REGEX "INFO:MPI-VER")
+ if("${_MPI_VERSION_STRING}" MATCHES ".*INFO:MPI-VER\\[([0-9]+)\\.([0-9]+)\\].*")
+ set(MPI_${LANG}_VERSION_MAJOR "${CMAKE_MATCH_1}")
+ set(MPI_${LANG}_VERSION_MINOR "${CMAKE_MATCH_2}")
+ set(MPI_${LANG}_VERSION "${MPI_${LANG}_VERSION_MAJOR}.${MPI_${LANG}_VERSION_MINOR}")
+ endif()
+ endif()
endif()
- if(MPI_${lang}_COMPILE_FLAGS)
- separate_arguments(_MPI_${lang}_COMPILE_OPTIONS NATIVE_COMMAND "${MPI_${lang}_COMPILE_FLAGS}")
- set_property(TARGET MPI::MPI_${lang} PROPERTY
- INTERFACE_COMPILE_OPTIONS "${_MPI_${lang}_COMPILE_OPTIONS}")
+
+ unset(MPI_BIN_FOLDER)
+
+ # At this point, we have dealt with determining the MPI version and parameters for each Fortran method available.
+ # The one remaining issue is to determine which MPI library is installed.
+ # Determining the version and vendor of the MPI library is only possible via MPI_Get_library_version() at runtime,
+ # and therefore we cannot do this while cross-compiling (a user may still define MPI_<lang>_LIBRARY_VERSION_STRING
+ # themselves and we'll attempt splitting it, which is equivalent to provide the try_run output).
+ # It's also worth noting that the installed version string can depend on the language, or on the system the binary
+ # runs on if MPI is not statically linked.
+ if(MPI_DETERMINE_LIBRARY_VERSION AND NOT MPI_${LANG}_LIBRARY_VERSION_STRING)
+ _MPI_try_staged_settings(${LANG} libver_mpi ${MPI_${LANG}_HIGHEST_METHOD} TRUE)
+ if(MPI_RESULT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD} AND
+ "${MPI_RUN_RESULT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD}}" EQUAL "0")
+ string(STRIP "${MPI_RUN_OUTPUT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD}}"
+ MPI_${LANG}_LIBRARY_VERSION_STRING)
+ else()
+ set(MPI_${LANG}_LIBRARY_VERSION_STRING "NOTFOUND")
+ endif()
endif()
+ endif()
- unset(_MPI_${lang}_LINK_LINE)
- if(MPI_${lang}_LINK_FLAGS)
- list(APPEND _MPI_${lang}_LINK_LINE "${MPI_${lang}_LINK_FLAGS}")
+ set(MPI_${LANG}_FIND_QUIETLY ${MPI_FIND_QUIETLY})
+ set(MPI_${LANG}_FIND_VERSION ${MPI_FIND_VERSION})
+ set(MPI_${LANG}_FIND_VERSION_EXACT ${MPI_FIND_VERSION_EXACT})
+
+ unset(MPI_${LANG}_REQUIRED_VARS)
+ if (MPI_${LANG}_WRAPPER_FOUND OR MPI_${LANG}_GUESS_FOUND)
+ foreach(mpilibname IN LISTS MPI_${LANG}_LIB_NAMES)
+ list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpilibname}_LIBRARY")
+ endforeach()
+ list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_LIB_NAMES")
+ if("${LANG}" STREQUAL "Fortran")
+ # For Fortran we only need one of the module or header directories to have *some* support for MPI.
+ if(NOT MPI_${LANG}_MODULE_DIR)
+ list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_F77_HEADER_DIR")
+ endif()
+ if(NOT MPI_${LANG}_F77_HEADER_DIR)
+ list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_MODULE_DIR")
+ endif()
+ else()
+ list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_HEADER_DIR")
+ endif()
+ if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS)
+ foreach(mpiincvar IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS)
+ list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpiincvar}_INCLUDE_DIR")
+ endforeach()
+ endif()
+ # Append the works variable now. If the settings did not work, this will show up properly.
+ list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_WORKS")
+ else()
+ # If the compiler worked implicitly, use its path as output.
+ # Should the compiler variable be set, we also require it to work.
+ list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_COMPILER")
+ if(MPI_${LANG}_COMPILER)
+ list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${LANG}_WORKS")
endif()
- list(APPEND _MPI_${lang}_LINK_LINE "${MPI_${lang}_LIBRARIES}")
- set_property(TARGET MPI::MPI_${lang} PROPERTY
- INTERFACE_LINK_LIBRARIES "${_MPI_${lang}_LINK_LINE}")
+ endif()
+ find_package_handle_standard_args(MPI_${LANG} REQUIRED_VARS ${MPI_${LANG}_REQUIRED_VARS}
+ VERSION_VAR MPI_${LANG}_VERSION)
- set_property(TARGET MPI::MPI_${lang} PROPERTY
- INTERFACE_INCLUDE_DIRECTORIES "${MPI_${lang}_INCLUDE_PATH}")
+ if(DEFINED MPI_${LANG}_VERSION)
+ if(NOT _MPI_MIN_VERSION OR _MPI_MIN_VERSION VERSION_GREATER MPI_${LANG}_VERSION)
+ set(_MPI_MIN_VERSION MPI_${LANG}_VERSION)
+ endif()
endif()
endif()
endforeach()
+unset(_MPI_REQ_VARS)
+foreach(LANG IN ITEMS C CXX Fortran)
+ if((NOT MPI_FIND_COMPONENTS AND CMAKE_${LANG}_COMPILER_LOADED) OR LANG IN_LIST MPI_FIND_COMPONENTS)
+ list(APPEND _MPI_REQ_VARS "MPI_${LANG}_FOUND")
+ endif()
+endforeach()
+
+if(MPICXX IN_LIST MPI_FIND_COMPONENTS)
+ list(APPEND _MPI_REQ_VARS "MPI_MPICXX_FOUND")
+endif()
+
+find_package_handle_standard_args(MPI
+ REQUIRED_VARS ${_MPI_REQ_VARS}
+ VERSION_VAR ${_MPI_MIN_VERSION}
+ HANDLE_COMPONENTS)
#=============================================================================
# More backward compatibility stuff
-#
-# Bare MPI sans ${lang} vars are set to CXX then C, depending on what was found.
+
+# For compatibility reasons, we also define MPIEXEC
+set(MPIEXEC "${MPIEXEC_EXECUTABLE}")
+
+# Copy over MPI_<LANG>_INCLUDE_PATH from the assembled INCLUDE_DIRS.
+foreach(LANG IN ITEMS C CXX Fortran)
+ if(MPI_${LANG}_FOUND)
+ set(MPI_${LANG}_INCLUDE_PATH "${MPI_${LANG}_INCLUDE_DIRS}")
+ unset(MPI_${LANG}_COMPILE_FLAGS)
+ if(MPI_${LANG}_COMPILE_OPTIONS)
+ set(MPI_${LANG}_COMPILE_FLAGS "${MPI_${LANG}_COMPILE_OPTIONS}")
+ endif()
+ if(MPI_${LANG}_COMPILE_DEFINITIONS)
+ foreach(_MPI_DEF IN LISTS MPI_${LANG}_COMPILE_DEFINITIONS)
+ string(APPEND MPI_${LANG}_COMPILE_FLAGS " -D${_MPI_DEF}")
+ endforeach()
+ endif()
+ endif()
+endforeach()
+
+# Bare MPI sans ${LANG} vars are set to CXX then C, depending on what was found.
# This mimics the behavior of the old language-oblivious FindMPI.
-set(_MPI_OLD_VARS FOUND COMPILER INCLUDE_PATH COMPILE_FLAGS LINK_FLAGS LIBRARIES)
+set(_MPI_OLD_VARS COMPILER INCLUDE_PATH COMPILE_FLAGS LINK_FLAGS LIBRARIES)
if (MPI_CXX_FOUND)
foreach (var ${_MPI_OLD_VARS})
set(MPI_${var} ${MPI_CXX_${var}})
@@ -704,28 +1428,26 @@ elseif (MPI_C_FOUND)
foreach (var ${_MPI_OLD_VARS})
set(MPI_${var} ${MPI_C_${var}})
endforeach()
-else()
- # Note that we might still have found Fortran, but you'll need to use MPI_Fortran_FOUND
- set(MPI_FOUND FALSE)
endif()
# Chop MPI_LIBRARIES into the old-style MPI_LIBRARY and MPI_EXTRA_LIBRARY, and set them in cache.
if (MPI_LIBRARIES)
list(GET MPI_LIBRARIES 0 MPI_LIBRARY_WORK)
- set(MPI_LIBRARY ${MPI_LIBRARY_WORK} CACHE FILEPATH "MPI library to link against" FORCE)
+ set(MPI_LIBRARY "${MPI_LIBRARY_WORK}")
+ unset(MPI_LIBRARY_WORK)
else()
- set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND" CACHE FILEPATH "MPI library to link against" FORCE)
+ set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND")
endif()
list(LENGTH MPI_LIBRARIES MPI_NUMLIBS)
if (MPI_NUMLIBS GREATER 1)
- set(MPI_EXTRA_LIBRARY_WORK ${MPI_LIBRARIES})
+ set(MPI_EXTRA_LIBRARY_WORK "${MPI_LIBRARIES}")
list(REMOVE_AT MPI_EXTRA_LIBRARY_WORK 0)
- set(MPI_EXTRA_LIBRARY ${MPI_EXTRA_LIBRARY_WORK} CACHE STRING "Extra MPI libraries to link against" FORCE)
+ set(MPI_EXTRA_LIBRARY "${MPI_EXTRA_LIBRARY_WORK}")
+ unset(MPI_EXTRA_LIBRARY_WORK)
else()
- set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND" CACHE STRING "Extra MPI libraries to link against" FORCE)
+ set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND")
endif()
-mark_as_advanced(MPI_LIBRARY MPI_EXTRA_LIBRARY)
#=============================================================================
# unset these vars to cleanup namespace
@@ -733,5 +1455,7 @@ unset(_MPI_OLD_VARS)
unset(_MPI_PREFIX_PATH)
unset(_MPI_BASE_DIR)
foreach (lang C CXX Fortran)
- unset(_MPI_${lang}_COMPILER_NAMES)
+ unset(_MPI_${LANG}_COMPILER_NAMES)
endforeach()
+
+cmake_policy(POP)
diff --git a/config/cmake_ext_mod/FindMPI/fortranparam_mpi.f90.in b/config/cmake_ext_mod/FindMPI/fortranparam_mpi.f90.in
new file mode 100644
index 0000000..30f912c
--- /dev/null
+++ b/config/cmake_ext_mod/FindMPI/fortranparam_mpi.f90.in
@@ -0,0 +1,4 @@
+ program mpi_ver
+ @MPI_Fortran_INCLUDE_LINE@
+ print *, 'INFO:SUBARRAYS[', MPI_SUBARRAYS_SUPPORTED, ']-ASYNCPROT[', MPI_ASYNC_PROTECTS_NONBLOCKING, ']'
+ end program mpi_ver
diff --git a/config/cmake_ext_mod/FindMPI/libver_mpi.c b/config/cmake_ext_mod/FindMPI/libver_mpi.c
new file mode 100644
index 0000000..be9d19d
--- /dev/null
+++ b/config/cmake_ext_mod/FindMPI/libver_mpi.c
@@ -0,0 +1,19 @@
+#include <mpi.h>
+
+#ifdef __cplusplus
+#include <cstdio>
+#else
+#include <stdio.h>
+#endif
+
+int main(int argc, char* argv[])
+{
+ char mpilibver_str[MPI_MAX_LIBRARY_VERSION_STRING];
+ int mpilibver_len;
+ MPI_Get_library_version(mpilibver_str, &mpilibver_len);
+#ifdef __cplusplus
+ std::puts(mpilibver_str);
+#else
+ puts(mpilibver_str);
+#endif
+}
diff --git a/config/cmake_ext_mod/FindMPI/libver_mpi.f90.in b/config/cmake_ext_mod/FindMPI/libver_mpi.f90.in
new file mode 100644
index 0000000..7938587
--- /dev/null
+++ b/config/cmake_ext_mod/FindMPI/libver_mpi.f90.in
@@ -0,0 +1,7 @@
+ program mpi_ver
+ @MPI_Fortran_INCLUDE_LINE@
+ character(len=MPI_MAX_LIBRARY_VERSION_STRING) :: mpilibver_str
+ integer(kind=MPI_INTEGER_KIND) :: ierror, reslen
+ call MPI_GET_LIBRARY_VERSION(mpilibver_str, reslen, ierror)
+ print *, mpilibver_str
+ end program mpi_ver
diff --git a/config/cmake_ext_mod/FindMPI/mpiver.f90.in b/config/cmake_ext_mod/FindMPI/mpiver.f90.in
new file mode 100644
index 0000000..a254523
--- /dev/null
+++ b/config/cmake_ext_mod/FindMPI/mpiver.f90.in
@@ -0,0 +1,10 @@
+ program mpi_ver
+ @MPI_Fortran_INCLUDE_LINE@
+ integer(kind=kind(MPI_VERSION)), parameter :: zero = ichar('0')
+ character, dimension(17), parameter :: mpiver_str =&
+ (/ 'I', 'N', 'F', 'O', ':', 'M', 'P', 'I', '-', 'V', 'E', 'R', '[', &
+ char(zero + MPI_VERSION), &
+ '.', &
+ char(zero + MPI_SUBVERSION), ']' /)
+ print *, mpiver_str
+ end program mpi_ver
diff --git a/config/cmake_ext_mod/FindMPI/test_mpi.c b/config/cmake_ext_mod/FindMPI/test_mpi.c
new file mode 100644
index 0000000..b8a308a
--- /dev/null
+++ b/config/cmake_ext_mod/FindMPI/test_mpi.c
@@ -0,0 +1,37 @@
+#include <mpi.h>
+
+#ifdef __cplusplus
+#include <cstdio>
+#else
+#include <stdio.h>
+#endif
+
+#if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
+const char mpiver_str[] = { 'I', 'N',
+ 'F', 'O',
+ ':', 'M',
+ 'P', 'I',
+ '-', 'V',
+ 'E', 'R',
+ '[', ('0' + MPI_VERSION),
+ '.', ('0' + MPI_SUBVERSION),
+ ']', '\0' };
+#endif
+
+int main(int argc, char* argv[])
+{
+#if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
+#ifdef __cplusplus
+ std::puts(mpiver_str);
+#else
+ puts(mpiver_str);
+#endif
+#endif
+#ifdef TEST_MPI_MPICXX
+ MPI::MPI_Init(&argc, &argv);
+ MPI::MPI_Finalize();
+#else
+ MPI_Init(&argc, &argv);
+ MPI_Finalize();
+#endif
+}
diff --git a/config/cmake_ext_mod/FindMPI/test_mpi.f90.in b/config/cmake_ext_mod/FindMPI/test_mpi.f90.in
new file mode 100644
index 0000000..4d43a04
--- /dev/null
+++ b/config/cmake_ext_mod/FindMPI/test_mpi.f90.in
@@ -0,0 +1,6 @@
+ program hello
+ @MPI_Fortran_INCLUDE_LINE@
+ integer@MPI_Fortran_INTEGER_LINE@ ierror
+ call MPI_INIT(ierror)
+ call MPI_FINALIZE(ierror)
+ end program
diff --git a/config/conclude.am b/config/conclude.am
index 55b805a..4bdbb0b 100644
--- a/config/conclude.am
+++ b/config/conclude.am
@@ -16,27 +16,25 @@
## Textually included at the end of most HDF5 Makefiles.am.
## Contains build rules.
-# Automake needs to be taught how to build lib, dyn, progs and tests targets.
+# Automake needs to be taught how to build lib, progs and tests targets.
# These will be filled in automatically for the most part (e.g.,
# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG, and
# EXTRA_TEST variables are supplied to allow the user to force targets to
# be built at certain times.
LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES) \
$(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
-DYN = $(dyn_LTLIBRARIES)
PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS) \
$(EXTRA_PROG)
chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST)
TESTS = $(TEST_PROG) $(TEST_SCRIPT) $(EXTRA_TEST)
-dyndir=$(libdir)
TEST_EXTENSIONS = .sh
SH_LOG_COMPILER = $(SHELL)
AM_SH_LOG_FLAGS =
+REALTIMEOUTPUT = $(realtimeOutput)
# lib/progs/tests targets recurse into subdirectories. build-* targets
# build files in this directory.
-build-dyn: $(DYN)
build-lib: $(LIB)
build-progs: $(LIB) $(PROGS)
build-tests: $(LIB) $(PROGS) $(chk_TESTS)
@@ -44,7 +42,7 @@ build-tests: $(LIB) $(PROGS) $(chk_TESTS)
# General rule for recursive building targets.
# BUILT_SOURCES contain targets that need to be built before anything else
# in the directory (e.g., for Fortran type detection)
-lib dyn progs tests check-s check-p :: $(BUILT_SOURCES)
+lib progs tests check-s check-p :: $(BUILT_SOURCES)
@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
@for d in X $(SUBDIRS); do \
if test $$d != X && test $$d != .; then \
@@ -127,28 +125,62 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
echo "No need to test $${tname} again."; \
else \
- echo "============================" > $${log}; \
- if test "X$(FORTRAN_API)" = "Xyes"; then \
- echo "Fortran API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \
- echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
- elif test "X$(CXX_API)" = "Xyes"; then \
- echo "C++ API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \
- echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log};\
- else \
- echo "Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \
- echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
- fi; \
- echo "============================" >> $${log}; \
- srcdir="$(srcdir)" \
- $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
- && touch $(@:.chkexe_=.chkexe) || \
- (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
- (cat $${log} && false) || exit 1; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ echo "============================" | tee $${log}; \
+ else \
+ echo "============================" > $${log}; \
+ fi; \
+ if test "X$(FORTRAN_API)" = "Xyes"; then \
+ echo "Fortran API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" | tee -a $${log}; \
+ else \
+ echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+ fi; \
+ elif test "X$(CXX_API)" = "Xyes"; then \
+ echo "C++ API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" | tee -a $${log};\
+ else \
+ echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log};\
+ fi; \
+ else \
+ echo "Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" | tee -a $${log}; \
+ else \
+ echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+ fi; \
+ fi; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ echo "============================" | tee -a $${log}; \
+ else \
+ echo "============================" >> $${log}; \
+ fi; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ srcdir="$(srcdir)" \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) | tee -a $${log} 2>&1 \
+ && touch $(@:.chkexe_=.chkexe) || \
+ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
+ (cat $${log} && false) || exit 1; \
+ else \
+ srcdir="$(srcdir)" \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+ && touch $(@:.chkexe_=.chkexe) || \
+ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
+ (cat $${log} && false) || exit 1; \
+ fi; \
echo "" >> $${log}; \
- echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
- echo "============================" >> $${log}; \
- echo "Finished testing $${tname} $(TEST_FLAGS)"; \
- cat $${log}; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ echo "Finished testing $${tname} $(TEST_FLAGS)" | tee -a $${log}; \
+ echo "============================" | tee -a $${log}; \
+ else \
+ echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+ echo "============================" >> $${log}; \
+ fi; \
+ if test -z "$(REALTIMEOUTPUT)"; then \
+ cat $${log}; \
+ fi; \
fi; \
fi
diff --git a/configure.ac b/configure.ac
index ed7727b..5562d5c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -99,6 +99,7 @@ AC_CONFIG_COMMANDS([pubconf], [
AC_CANONICAL_HOST
AC_SUBST([CPPFLAGS])
AC_SUBST([JNIFLAGS])
+AC_SUBST([AR_FLAGS])
## H5_CFLAGS (and company) are for CFLAGS that should be used on HDF5, but
## not exported to h5cc (or h5fc, etc.)
@@ -139,6 +140,7 @@ JNIFLAGS="${JNIFLAGS}"
JAVACFLAGS="${JAVACFLAGS}"
JAVAFLAGS="${JAVAFLAGS}"
LDFLAGS="${LDFLAGS}"
+AR_FLAGS="${AR_FLAGS}"
## Configure may need to alter any of the *FLAGS variables in order for
## various checks to work correctly. Save the user's value here so it
@@ -757,12 +759,17 @@ fi
## Check which archiving tool to use. This needs to be done before
## the AM_PROG_LIBTOOL macro.
##
-
if test -z "$AR"; then
AC_CHECK_PROGS([AR], [ar xar], [:], [$PATH])
fi
AC_SUBST([AR])
+# Set the default ar flags to cr
+# The Automake default is to use cru and the 'u' causes ar
+# to emit warnings on some platforms.
+AR_FLAGS=cr
+
+
## Export the AR macro so that it will be placed in the libtool file
## correctly.
export AR
@@ -3369,17 +3376,17 @@ AC_CONFIG_FILES([src/libhdf5.settings
Makefile
src/Makefile
test/Makefile
+ test/H5srcdir_str.h
test/testcheck_version.sh
test/testerror.sh
test/testflushrefresh.sh
- test/H5srcdir_str.h
test/testlibinfo.sh
test/testlinks_env.sh
- test/test_filenotclosed.sh
test/testswmr.sh
- test/test_plugin.sh
- test/test_usecases.sh
test/testvdsswmr.sh
+ test/test_filenotclosed.sh
+ test/test_filter_plugin.sh
+ test/test_usecases.sh
testpar/Makefile
tools/Makefile
tools/lib/Makefile
@@ -3518,7 +3525,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then
case "`uname`" in
Linux*)
if test "X$FC_BASENAME" = "Xnagfor"; then
- cat libtool | awk '/NAG_Fortran/{flag=1}flag&&/wl=/{$NF="wl=\"-Wl,Wl,,\"";flag=0}1' > libtool.tmp && mv -f libtool.tmp libtool && chmod 755 libtool
+ cat libtool | awk '/BEGIN LIBTOOL TAG CONFIG: FC/{flag=1}flag&&/wl=/{$NF="wl=\"-Wl,-Wl,,\"";flag=0}1' > libtool.tmp && mv -f libtool.tmp libtool && chmod 755 libtool
fi
;;
esac
diff --git a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt
index f7179cf..075e1da 100644
--- a/fortran/CMakeLists.txt
+++ b/fortran/CMakeLists.txt
@@ -2,8 +2,6 @@ cmake_minimum_required (VERSION 3.2.2)
PROJECT (HDF5_F90 C CXX Fortran)
if (H5_HAVE_PARALLEL)
- INCLUDE (FindMPI)
- set (LINK_LIBS ${LINK_LIBS} ${MPI_Fortran_LIBRARIES})
if (MPI_Fortran_LINK_FLAGS)
set (CMAKE_EXE_LINKER_FLAGS "${MPI_Fortran_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}")
endif ()
diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt
index a5c3422..426df7e 100644
--- a/fortran/examples/CMakeLists.txt
+++ b/fortran/examples/CMakeLists.txt
@@ -81,7 +81,7 @@ foreach (example ${F2003_examples})
set_target_properties (f03_ex_${example} PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER examples/fortran03
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
)
if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
add_executable (f03_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
@@ -107,7 +107,6 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
target_link_libraries (f90_ex_ph5example
${HDF5_F90_LIB_TARGET}
${HDF5_LIB_TARGET}
- ${MPI_Fortran_LIBRARIES}
)
target_include_directories (f90_ex_ph5example PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
set_target_properties (f90_ex_ph5example PROPERTIES
@@ -122,7 +121,6 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
target_link_libraries (f90_ex_ph5example-shared
${HDF5_F90_LIBSH_TARGET}
${HDF5_LIBSH_TARGET}
- ${MPI_Fortran_LIBRARIES}
)
target_include_directories (f90_ex_ph5example-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
set_target_properties (f90_ex_ph5example-shared PROPERTIES
diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake
index 3403571..b130f30 100644
--- a/fortran/examples/CMakeTests.cmake
+++ b/fortran/examples/CMakeTests.cmake
@@ -153,8 +153,8 @@ if (HDF5_ENABLE_F2003)
endif ()
if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
- add_test (NAME f90_ex_ph5example COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:f90_ex_ph5example>)
+ add_test (NAME f90_ex_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:f90_ex_ph5example> ${MPIEXEC_POSTFLAGS})
if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
- add_test (NAME f90_ex-shared_ph5example COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:f90_ex_ph5example>)
+ add_test (NAME f90_ex-shared_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:f90_ex_ph5example> ${MPIEXEC_POSTFLAGS})
endif ()
endif ()
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt
index 6d51feb..e34c778 100644
--- a/fortran/src/CMakeLists.txt
+++ b/fortran/src/CMakeLists.txt
@@ -126,7 +126,7 @@ set (f90CStub_C_HDRS
add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS})
TARGET_C_PROPERTIES (${HDF5_F90_C_LIB_TARGET} STATIC " " " ")
-target_link_libraries (${HDF5_F90_C_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_LIBS})
+target_link_libraries (${HDF5_F90_C_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET})
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIB_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_F90_C_LIB_TARGET} ${HDF5_F90_C_LIB_NAME} STATIC)
set_target_properties (${HDF5_F90_C_LIB_TARGET} PROPERTIES
@@ -139,7 +139,7 @@ set (install_targets ${HDF5_F90_C_LIB_TARGET})
if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
add_library (${HDF5_F90_C_LIBSH_TARGET} SHARED ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS})
TARGET_C_PROPERTIES (${HDF5_F90_C_LIBSH_TARGET} SHARED " " " ")
- target_link_libraries (${HDF5_F90_C_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${LINK_SHARED_LIBS})
+ target_link_libraries (${HDF5_F90_C_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET})
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIBSH_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_F90_C_LIBSH_TARGET} ${HDF5_F90_C_LIB_NAME} SHARED ${HDF5_F_PACKAGE_SOVERSION})
set_target_properties (${HDF5_F90_C_LIBSH_TARGET} PROPERTIES
@@ -241,9 +241,10 @@ endif ()
add_library (${HDF5_F90_LIB_TARGET} STATIC ${f90_F_SOURCES})
set (SHARED_LINK_FLAGS " ")
TARGET_FORTRAN_PROPERTIES (${HDF5_F90_LIB_TARGET} STATIC " " " ")
-target_link_libraries (${HDF5_F90_LIB_TARGET} ${HDF5_F90_C_LIB_TARGET} ${HDF5_LIB_TARGET})
+target_link_libraries (${HDF5_F90_LIB_TARGET} PUBLIC ${HDF5_F90_C_LIB_TARGET})
+target_link_libraries (${HDF5_F90_LIB_TARGET} PRIVATE ${LINK_Fortran_LIBS})
if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
- target_link_libraries (${HDF5_F90_LIB_TARGET} ${MPI_Fortran_LIBRARIES})
+ target_include_directories (${HDF5_F90_LIB_TARGET} PUBLIC ${MPI_Fortran_INCLUDE_DIRS})
endif ()
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} STATIC)
@@ -268,9 +269,10 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
set (SHARED_LINK_FLAGS "/DLL /DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def")
endif ()
TARGET_FORTRAN_PROPERTIES (${HDF5_F90_LIBSH_TARGET} SHARED " " ${SHARED_LINK_FLAGS})
- target_link_libraries (${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_C_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ target_link_libraries (${HDF5_F90_LIBSH_TARGET} PUBLIC ${HDF5_F90_C_LIBSH_TARGET})
+ target_link_libraries (${HDF5_F90_LIBSH_TARGET} PRIVATE ${LINK_Fortran_LIBS})
if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
- target_link_libraries (${HDF5_F90_LIBSH_TARGET} ${MPI_Fortran_LIBRARIES})
+ target_include_directories (${HDF5_F90_LIBSH_TARGET} PUBLIC ${MPI_Fortran_INCLUDE_DIRS})
endif ()
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIBSH_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_LIB_NAME} SHARED ${HDF5_F_PACKAGE_SOVERSION})
diff --git a/fortran/src/H5f90global.F90 b/fortran/src/H5f90global.F90
index dd2b171..629418a 100644
--- a/fortran/src/H5f90global.F90
+++ b/fortran/src/H5f90global.F90
@@ -142,10 +142,7 @@ MODULE H5GLOBAL
INTEGER(HID_T), DIMENSION(PREDEF_TYPES_LEN) :: predef_types
EQUIVALENCE (predef_types(1), H5T_NATIVE_INTEGER_KIND(1))
- EQUIVALENCE (predef_types(2), H5T_NATIVE_INTEGER_KIND(2))
- EQUIVALENCE (predef_types(3), H5T_NATIVE_INTEGER_KIND(3))
- EQUIVALENCE (predef_types(4), H5T_NATIVE_INTEGER_KIND(4))
- EQUIVALENCE (predef_types(5), H5T_NATIVE_INTEGER_KIND(5))
+ ! EQUIVALENCE predef_types(2:5) are unnecessary and violate the standard
EQUIVALENCE (predef_types(6), H5T_NATIVE_INTEGER)
EQUIVALENCE (predef_types(7), H5T_NATIVE_REAL)
EQUIVALENCE (predef_types(8), H5T_NATIVE_DOUBLE)
diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt
index 909cbaf..4aa7f43 100644
--- a/fortran/testpar/CMakeLists.txt
+++ b/fortran/testpar/CMakeLists.txt
@@ -4,7 +4,7 @@ PROJECT (HDF5_FORTRAN_TESTPAR C CXX Fortran)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${MPI_Fortran_INCLUDE_PATH} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src)
+set (TESTPAR_INCLUDES ${MPI_Fortran_INCLUDE_DIRS} ${CMAKE_Fortran_MODULE_DIRECTORY}/static ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src)
#-----------------------------------------------------------------------------
# Add Tests
@@ -27,7 +27,7 @@ target_link_libraries (parallel_test
if (WIN32 AND MSVC)
target_link_libraries (parallel_test "ws2_32.lib")
endif ()
-target_include_directories (parallel_test PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
+target_include_directories (parallel_test PRIVATE ${TESTPAR_INCLUDES})
set_target_properties (parallel_test PROPERTIES LINKER_LANGUAGE Fortran)
set_target_properties (parallel_test PROPERTIES FOLDER test/fortran)
diff --git a/fortran/testpar/CMakeTests.cmake b/fortran/testpar/CMakeTests.cmake
index 5736256..d00a6fc 100644
--- a/fortran/testpar/CMakeTests.cmake
+++ b/fortran/testpar/CMakeTests.cmake
@@ -15,4 +15,4 @@
### T E S T I N G ###
##############################################################################
##############################################################################
-add_test (NAME FORT_parallel_test COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:parallel_test>)
+add_test (NAME FORT_parallel_test COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:parallel_test> ${MPIEXEC_POSTFLAGS})
diff --git a/hl/tools/h5watch/CMakeLists.txt b/hl/tools/h5watch/CMakeLists.txt
index fde40e3..6b8d5f2 100644
--- a/hl/tools/h5watch/CMakeLists.txt
+++ b/hl/tools/h5watch/CMakeLists.txt
@@ -5,7 +5,7 @@ PROJECT (HDF5_HL_TOOLS_H5WATCH)
# Define Sources
#-----------------------------------------------------------------------------
set (H5WATCH_SOURCES
- ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/h5watch
+ ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/h5watch.c
)
#-- Add h5watch program
diff --git a/hl/tools/h5watch/h5watch.c b/hl/tools/h5watch/h5watch.c
index 11514b0..d1f4e32 100644
--- a/hl/tools/h5watch/h5watch.c
+++ b/hl/tools/h5watch/h5watch.c
@@ -704,6 +704,7 @@ parse_command_line(int argc, const char *argv[])
case 'h': /* --help */
usage(h5tools_getprogname());
leave(EXIT_SUCCESS);
+ break;
case 'V': /* --version */
print_version(progname);
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index db3e4e0..a1b59b1 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -78,13 +78,13 @@ New Features
file driver in HDF5 by previously having called H5Pset_fapl_mpio().
HDF5 parallel file operations which do not employ multiple ranks
- e.g. specifiying MPI_COMM_SELF (whose MPI_Comm_size == 1)
+ e.g. specifiying MPI_COMM_SELF (whose MPI_Comm_size == 1)
as opposed to MPI_COMM_WORLD, will not be affected by this
optimization. Conversely, parallel file operations on subgroups
of MPI_COMM_WORLD are allowed to be run in parallel with each
subgroup operating as an independant collection of processes.
- (RAW – 2017/10/10, HDFFV-10294)
+ (RAW - 2017/10/10, HDFFV-10294)
- Large MPI-IO transfers
@@ -109,7 +109,7 @@ New Features
fulfill the original user request without encountering API
errors.
- (RAW – 2017/07/11, HDFFV-8839)
+ (RAW - 2017/07/11, HDFFV-8839)
Fortran Library:
----------------
@@ -157,6 +157,17 @@ Bug Fixes since HDF5-1.10.1 release
Library
-------
+ - filter plugin handling in H5PL.c and H5Z.c
+
+ It was discovered that the dynamic loading process used by
+ filter plugins had issues with library dependencies.
+
+ CMake build process changed to use LINK INTERFACE keywords, which
+ allowed HDF5 C library to make dependent libraries private. The
+ filter plugin libraries no longer require dependent libraries
+ (such as szip or zlib) to be available.
+ (ADB - 2017/11/16, HDFFV-10328)
+
- H5Zfilter_avail in H5Z.c
The public function checked for plugins, while the private
@@ -166,12 +177,35 @@ Bug Fixes since HDF5-1.10.1 release
Moved check for plugin from public to private function. Updated
H5P__set_filter due to change in H5Z_filter_avail. Updated tests.
- (ADB - 2017/10/10, HDFFV-10297)
+ (ADB - 2017/10/10, HDFFV-10297, HDFFV-10319)
Configuration
-------------
- cmake
+ The hdf5 library used shared szip and zlib, which needlessly required
+ applications to link with the same szip and zlib libraries.
+
+ Changed the target_link_libraries commands to use the static libs.
+ Removed improper link duplication of szip and zlib.
+ Adjusted the link dependencies and the link interface values of
+ the target_link_libraries commands.
+
+ (ADB - 2017/11/14, HDFFV-10329)
+
+ - cmake MPI
+
+ CMake implementation for MPI was problematic and would create incorrect
+ MPI library references in the hdf5 libraries.
+
+ Reworked the CMake MPI code to properly create CMake targets.Also merged
+ the latest CMake FindMPI.cmake changes to the local copy. This is necessary
+ until HDF changes the CMake minimum to 3.9 or greater.
+
+ (ADB - 2017/11/02, HDFFV-10321)
+
+ - cmake
+
Too many commands for POST_BUILD step caused command line to be
too big on windows.
@@ -186,7 +220,8 @@ Bug Fixes since HDF5-1.10.1 release
Fortran
--------
- -
+ - Fixed compilation errors when using Intel 18 Fortran compilers
+ (MSB - 2017/11/3, HDFFV-10322)
Tools
-----
@@ -199,8 +234,12 @@ Bug Fixes since HDF5-1.10.1 release
Modified H5Zfilter_avail and private function, H5Z_filter_avail.
Moved check for plugin from public to private function. Updated
H5P__set_filter due to change in H5Z_filter_avail. Updated tests.
+ Note, h5repack output display has changed to clarify the individual
+ steps of the repack process. The output indicates if an operation
+ applies to all objects. Lines with notation and no information
+ have been removed.
- (ADB - 2017/10/10, HDFFV-10297)
+ (ADB - 2017/10/10, HDFFV-10297, HDFFV-10319)
- h5repack
@@ -209,7 +248,7 @@ Bug Fixes since HDF5-1.10.1 release
Added another parameter to the 'UD=' option to set the flag by default
to '0' or H5Z_FLAG_MANDATORY, the other choice is '1' or H5Z_FLAG_OPTIONAL.
- (ADB - 2017/08/31, HDFFV-10276)
+ (ADB - 2017/08/31, HDFFV-10269)
- h5ls
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 96ea589..b163b8a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -454,6 +454,7 @@ set (H5O_SOURCES
${HDF5_SRC_DIR}/H5Oflush.c
${HDF5_SRC_DIR}/H5Ofsinfo.c
${HDF5_SRC_DIR}/H5Oginfo.c
+ ${HDF5_SRC_DIR}/H5Oint.c
${HDF5_SRC_DIR}/H5Olayout.c
${HDF5_SRC_DIR}/H5Olinfo.c
${HDF5_SRC_DIR}/H5Olink.c
@@ -532,6 +533,7 @@ IDE_GENERATED_PROPERTIES ("H5PL" "${H5PL_HDRS}" "${H5PL_SOURCES}" )
set (H5R_SOURCES
${HDF5_SRC_DIR}/H5R.c
${HDF5_SRC_DIR}/H5Rdeprec.c
+ ${HDF5_SRC_DIR}/H5Rint.c
)
set (H5R_HDRS
${HDF5_SRC_DIR}/H5Rpkg.h
@@ -881,12 +883,12 @@ set (gen_SRCS ${HDF5_BINARY_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c)
add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS})
TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC " " " ")
-target_link_libraries (${HDF5_LIB_TARGET} ${LINK_LIBS})
+target_link_libraries (${HDF5_LIB_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS})
if (NOT WIN32)
- target_link_libraries (${HDF5_LIB_TARGET} dl)
+ target_link_libraries (${HDF5_LIB_TARGET} PUBLIC dl)
endif ()
if (H5_HAVE_PARALLEL AND MPI_C_FOUND)
- target_link_libraries (${HDF5_LIB_TARGET} ${MPI_C_LIBRARIES})
+ target_include_directories (${HDF5_LIB_TARGET} PUBLIC ${MPI_C_INCLUDE_DIRS})
endif ()
set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET})
H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC)
@@ -925,12 +927,12 @@ if (BUILD_SHARED_LIBS)
set (shared_gen_SRCS ${HDF5_BINARY_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c)
add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS})
TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED " " " ")
- target_link_libraries (${HDF5_LIBSH_TARGET} ${LINK_SHARED_LIBS})
+ target_link_libraries (${HDF5_LIBSH_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS})
if (NOT WIN32)
- target_link_libraries (${HDF5_LIBSH_TARGET} dl)
+ target_link_libraries (${HDF5_LIBSH_TARGET} PUBLIC dl)
endif ()
if (H5_HAVE_PARALLEL AND MPI_C_FOUND)
- target_link_libraries (${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES})
+ target_include_directories (${HDF5_LIBSH_TARGET} PUBLIC ${MPI_C_INCLUDE_DIRS})
endif ()
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION})
@@ -945,7 +947,7 @@ if (BUILD_SHARED_LIBS)
APPEND PROPERTY COMPILE_DEFINITIONS
"H5_HAVE_THREADSAFE"
)
- target_link_libraries (${HDF5_LIBSH_TARGET} Threads::Threads)
+ target_link_libraries (${HDF5_LIBSH_TARGET} PUBLIC Threads::Threads)
endif ()
if (HDF5_ENABLE_DEBUG_APIS)
diff --git a/src/H5Aint.c b/src/H5Aint.c
index bfc69ec..117dbce 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -102,6 +102,12 @@ static herr_t H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type
/* Package Variables */
/*********************/
+/* Format version bounds for attribute */
+const unsigned H5O_attr_ver_bounds[] = {
+ H5O_ATTR_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5O_ATTR_VERSION_3, /* H5F_LIBVER_V18 */
+ H5O_ATTR_VERSION_LATEST /* H5F_LIBVER_LATEST */
+};
/*****************************/
/* Library Private Variables */
@@ -112,13 +118,6 @@ static herr_t H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type
/* Local Variables */
/*******************/
-/* Format version bounds for attribute */
-static const unsigned H5O_attr_ver_bounds[] = {
- H5O_ATTR_VERSION_1, /* H5F_LIBVER_EARLIEST */
- H5O_ATTR_VERSION_3, /* H5F_LIBVER_V18 */
- H5O_ATTR_VERSION_LATEST /* H5F_LIBVER_LATEST */
-};
-
typedef H5A_t* H5A_t_ptr;
H5FL_SEQ_DEFINE(H5A_t_ptr);
@@ -1861,7 +1860,6 @@ herr_t
H5A_set_version(const H5F_t *f, H5A_t *attr)
{
hbool_t type_shared, space_shared; /* Flags to indicate that shared messages are used for this attribute */
- hbool_t use_latest_format; /* Flag indicating the latest attribute version support is enabled */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index af6599a..0d7fcc9 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -5720,7 +5720,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
H5D_rdcc_ent_t *ent = NULL; /* Cache entry */
unsigned idx; /* Index of chunk in cache, if present */
unsigned u; /* Counter */
- H5D_shared_t *shared_fo = udata->cpy_info->shared_fo;
+ H5D_shared_t *shared_fo = (H5D_shared_t *)udata->cpy_info->shared_fo;
/* See if the written chunk is in the chunk cache */
if(shared_fo && shared_fo->cache.chunk.nslots > 0) {
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index 041d28f..43e7754 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -431,7 +431,7 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds
void *bkg = NULL; /* Temporary buffer for copying data */
void *reclaim_buf = NULL; /* Buffer for reclaiming data */
hid_t buf_sid = -1; /* ID for buffer dataspace */
- H5D_shared_t *shared_fo = cpy_info->shared_fo; /* Pointer to the shared struct for dataset object */
+ H5D_shared_t *shared_fo = (H5D_shared_t *)cpy_info->shared_fo; /* Pointer to the shared struct for dataset object */
H5O_storage_compact_t *storage_src = _storage_src; /* Pointer to storage_src */
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index 86de017..aab4901 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -1363,7 +1363,7 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
hsize_t buf_dim[1] = {0}; /* Dimension for buffer */
hbool_t is_vlen = FALSE; /* Flag to indicate that VL type conversion should occur */
hbool_t fix_ref = FALSE; /* Flag to indicate that ref values should be fixed */
- H5D_shared_t *shared_fo = cpy_info->shared_fo; /* Pointer to the shared struct for dataset object */
+ H5D_shared_t *shared_fo = (H5D_shared_t *)cpy_info->shared_fo; /* Pointer to the shared struct for dataset object */
hbool_t try_sieve = FALSE; /* Try to get data from the sieve buffer */
haddr_t sieve_start = HADDR_UNDEF; /* Start location of sieve buffer */
haddr_t sieve_end = HADDR_UNDEF; /* End locations of sieve buffer */
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 9ed7d71..c1a66ca 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -21,14 +21,14 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5FOprivate.h" /* File objects */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Lprivate.h" /* Links */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5FOprivate.h" /* File objects */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -54,18 +54,18 @@ typedef struct {
/* General stuff */
static herr_t H5D__get_dxpl_cache_real(hid_t dxpl_id, H5D_dxpl_cache_t *cache);
static H5D_shared_t *H5D__new(hid_t dcpl_id, hbool_t creating,
- hbool_t vl_type);
+ hbool_t vl_type);
static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id,
- const H5T_t *type);
+ const H5T_t *type);
static herr_t H5D__cache_dataspace_info(const H5D_t *dset);
static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space);
static herr_t H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset,
- hid_t dapl_id);
+ hid_t dapl_id);
static herr_t H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id,
- char **extfile_prefix);
+ char **extfile_prefix);
static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id);
static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite,
- hsize_t old_dim[]);
+ hsize_t old_dim[]);
static herr_t H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id);
/*********************/
@@ -109,9 +109,9 @@ static H5D_shared_t H5D_def_dset;
/* Dataset ID class */
static const H5I_class_t H5I_DATASET_CLS[1] = {{
- H5I_DATASET, /* ID class value */
- 0, /* Class flags */
- 0, /* # of reserved IDs for class */
+ H5I_DATASET, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
(H5I_free_t)H5D_close /* Callback routine for closing objects of this class */
}};
@@ -121,17 +121,13 @@ static hbool_t H5D_top_package_initialize_s = FALSE;
/*-------------------------------------------------------------------------
- * Function: H5D_init
+ * Function: H5D_init
*
- * Purpose: Initialize the interface from some other layer.
+ * Purpose: Initialize the interface from some other layer.
*
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Saturday, March 4, 2000
+ * Return: Success: non-negative
*
+ * Failure: negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -149,7 +145,7 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5D__init_package -- Initialize interface-specific information
+ H5D__init_package -- Initialize interface-specific information
USAGE
herr_t H5D__init_package()
@@ -211,28 +207,24 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_top_term_package
- *
- * Purpose: Close the "top" of the interface, releasing IDs, etc.
- *
- * Return: Success: Positive if anything was done that might
- * affect other interfaces; zero otherwise.
- * Failure: Negative.
+ * Function: H5D_top_term_package
*
- * Programmer: Quincey Koziol
- * Sunday, September 13, 2015
+ * Purpose: Close the "top" of the interface, releasing IDs, etc.
*
+ * Return: Success: Positive if anything was done that might
+ * affect other interfaces; zero otherwise.
+ * Failure: Negative.
*-------------------------------------------------------------------------
*/
int
H5D_top_term_package(void)
{
- int n = 0;
+ int n = 0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
if(H5D_top_package_initialize_s) {
- if(H5I_nmembers(H5I_DATASET) > 0) {
+ if(H5I_nmembers(H5I_DATASET) > 0) {
/* The dataset API uses the "force" flag set to true because it
* is using the "file objects" (H5FO) API functions to track open
* objects in the file. Using the H5FO code means that dataset
@@ -255,9 +247,9 @@ H5D_top_term_package(void)
*
* QAK - 5/13/03
*/
- (void)H5I_clear_type(H5I_DATASET, TRUE, FALSE);
+ (void)H5I_clear_type(H5I_DATASET, TRUE, FALSE);
n++; /*H5I*/
- } /* end if */
+ } /* end if */
/* Mark closed */
if(0 == n)
@@ -269,26 +261,22 @@ H5D_top_term_package(void)
/*-------------------------------------------------------------------------
- * Function: H5D_term_package
- *
- * Purpose: Terminate this interface.
+ * Function: H5D_term_package
*
- * Note: Finishes shutting down the interface, after
- * H5D_top_term_package() is called
+ * Purpose: Terminate this interface.
*
- * Return: Success: Positive if anything was done that might
- * affect other interfaces; zero otherwise.
- * Failure: Negative.
- *
- * Programmer: Robb Matzke
- * Friday, November 20, 1998
+ * Note: Finishes shutting down the interface, after
+ * H5D_top_term_package() is called
*
+ * Return: Success: Positive if anything was done that might
+ * affect other interfaces; zero otherwise.
+ * Failure: Negative.
*-------------------------------------------------------------------------
*/
int
H5D_term_package(void)
{
- int n = 0;
+ int n = 0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -440,17 +428,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__create_named
- *
- * Purpose: Internal routine to create a new dataset.
+ * Function: H5D__create_named
*
- * Return: Success: Non-NULL, pointer to new dataset object.
+ * Purpose: Internal routine to create a new dataset.
*
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * Thursday, April 5, 2007
+ * Return: Success: Non-NULL, pointer to new dataset object.
*
+ * Failure: NULL
*-------------------------------------------------------------------------
*/
H5D_t *
@@ -460,7 +444,7 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id,
{
H5O_obj_create_t ocrt_info; /* Information for object creation */
H5D_obj_create_t dcrt_info; /* Information for dataset creation */
- H5D_t *ret_value = NULL; /* Return value */
+ H5D_t *ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -505,11 +489,7 @@ done:
*
* Return:
* Success: Non-negative
- *
* Failture: Negative
- *
- * Programmer: Raymond Lu
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -557,7 +537,7 @@ H5D__get_space_status(H5D_t *dset, H5D_space_status_t *allocation, hid_t dxpl_id
*allocation = H5D_SPACE_STATUS_NOT_ALLOCATED;
else if(space_allocated == full_size)
*allocation = H5D_SPACE_STATUS_ALLOCATED;
- else
+ else
*allocation = H5D_SPACE_STATUS_PART_ALLOCATED;
} /* end if */
else {
@@ -575,17 +555,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__new
- *
- * Purpose: Creates a new, empty dataset structure
+ * Function: H5D__new
*
- * Return: Success: Pointer to a new dataset descriptor.
- *
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * Monday, October 12, 1998
+ * Purpose: Creates a new, empty dataset structure
*
+ * Return: Success: Pointer to a new dataset descriptor.
+ * Failure: NULL
*-------------------------------------------------------------------------
*/
static H5D_shared_t *
@@ -636,17 +611,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__init_type
- *
- * Purpose: Copy a datatype for a dataset's use, performing all the
- * necessary adjustments, etc.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Function: H5D__init_type
*
- * Programmer: Quincey Koziol
- * Thursday, June 24, 2004
+ * Purpose: Copy a datatype for a dataset's use, performing all the
+ * necessary adjustments, etc.
*
+ * Return: Success: SUCCEED
+ * Failure: FAIL
*-------------------------------------------------------------------------
*/
static herr_t
@@ -712,16 +683,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__cache_dataspace_info
- *
- * Purpose: Cache dataspace info for a dataset
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Function: H5D__cache_dataspace_info
*
- * Programmer: Quincey Koziol
- * Wednesday, November 19, 2014
+ * Purpose: Cache dataspace info for a dataset
*
+ * Return: Success: SUCCEED
+ * Failure: FAIL
*-------------------------------------------------------------------------
*/
static herr_t
@@ -756,17 +723,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__init_space
+ * Function: H5D__init_space
*
- * Purpose: Copy a dataspace for a dataset's use, performing all the
+ * Purpose: Copy a dataspace for a dataset's use, performing all the
* necessary adjustments, etc.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * Tuesday, July 24, 2007
- *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
*-------------------------------------------------------------------------
*/
static herr_t
@@ -803,16 +766,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__update_oh_info
- *
- * Purpose: Create and fill object header for dataset
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Function: H5D__update_oh_info
*
- * Programmer: Bill Wendling
- * Thursday, October 31, 2002
+ * Purpose: Create and fill object header for dataset
*
+ * Return: Success: SUCCEED
+ * Failure: FAIL
*-------------------------------------------------------------------------
*/
static herr_t
@@ -823,9 +782,9 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
H5O_loc_t *oloc = NULL; /* Dataset's object location */
H5O_layout_t *layout; /* Dataset's layout information */
H5T_t *type; /* Dataset's datatype */
- H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */
- H5D_fill_value_t fill_status; /* Fill value status */
- hbool_t fill_changed = FALSE; /* Flag indicating the fill value was changed */
+ H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */
+ H5D_fill_value_t fill_status; /* Fill value status */
+ hbool_t fill_changed = FALSE; /* Flag indicating the fill value was changed */
hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
herr_t ret_value = SUCCEED; /* Return value */
@@ -867,10 +826,12 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
if(fill_prop->buf && fill_prop->size > 0 && H5O_fill_convert(fill_prop, type, &fill_changed, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert fill value to dataset type")
- fill_prop->fill_defined = TRUE;
- } else if(fill_status == H5D_FILL_VALUE_UNDEFINED) {
- fill_prop->fill_defined = FALSE;
- } else
+ fill_prop->fill_defined = TRUE;
+ }
+ else if(fill_status == H5D_FILL_VALUE_UNDEFINED) {
+ fill_prop->fill_defined = FALSE;
+ }
+ else
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine if fill value is defined")
/* Check for invalid fill & allocation time setting */
@@ -953,17 +914,17 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
(H5P_exist_plist(dc_plist, H5O_BOGUS_MSG_ID_NAME) > 0) ) {
uint8_t bogus_flags = 0; /* Flags for creating "bogus" message */
- unsigned bogus_id; /* "bogus" ID */
+ unsigned bogus_id; /* "bogus" ID */
- /* Retrieve "bogus" message ID */
+ /* Retrieve "bogus" message ID */
if(H5P_get(dc_plist, H5O_BOGUS_MSG_ID_NAME, &bogus_id) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus ID options")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus ID options")
/* Retrieve "bogus" message flags */
if(H5P_get(dc_plist, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus message options")
/* Add a "bogus" message (for error testing). */
- if(H5O_bogus_oh(file, dxpl_id, oh, bogus_id, (unsigned)bogus_flags) < 0)
+ if(H5O_bogus_oh(file, dxpl_id, oh, bogus_id, (unsigned)bogus_flags) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create 'bogus' message")
} /* end if */
}
@@ -1002,9 +963,6 @@ done:
* should be used.
*
* Return: SUCCEED/FAIL
- *
- * Programmer: Steffen Kiess
- * October 16, 2015
*--------------------------------------------------------------------------
*/
static herr_t
@@ -1017,7 +975,7 @@ H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, char **extfile_prefix
size_t extfile_prefix_len; /* length of expanded prefix */
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
-
+
FUNC_ENTER_NOAPI_NOINIT
@@ -1056,7 +1014,7 @@ H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, char **extfile_prefix
extpath_len = HDstrlen(extpath);
prefix_len = HDstrlen(prefix);
extfile_prefix_len = extpath_len + prefix_len - HDstrlen("${ORIGIN}") + 1;
-
+
if(NULL == (*extfile_prefix = (char *)H5MM_malloc(extfile_prefix_len)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer")
HDsnprintf(*extfile_prefix, extfile_prefix_len, "%s%s", extpath, prefix + HDstrlen("${ORIGIN}"));
@@ -1073,32 +1031,27 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__create
- *
- * Purpose: Creates a new dataset with name NAME in file F and associates
- * with it a datatype TYPE for each element as stored in the
- * file, dimensionality information or dataspace SPACE, and
- * other miscellaneous properties CREATE_PARMS. All arguments
- * are deep-copied before being associated with the new dataset,
- * so the caller is free to subsequently modify them without
- * affecting the dataset.
- *
- * Return: Success: Pointer to a new dataset
- *
- * Failure: NULL
- *
- * Programmer: Robb Matzke
- * Thursday, December 4, 1997
- *
+ * Function: H5D__create
+ *
+ * Purpose: Creates a new dataset with name NAME in file F and associates
+ * with it a datatype TYPE for each element as stored in the
+ * file, dimensionality information or dataspace SPACE, and
+ * other miscellaneous properties CREATE_PARMS. All arguments
+ * are deep-copied before being associated with the new dataset,
+ * so the caller is free to subsequently modify them without
+ * affecting the dataset.
+ *
+ * Return: Success: Pointer to a new dataset
+ * Failure: NULL
*-------------------------------------------------------------------------
*/
H5D_t *
H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
hid_t dapl_id, hid_t dxpl_id)
{
- const H5T_t *type; /* Datatype for dataset */
- H5D_t *new_dset = NULL;
- H5P_genplist_t *dc_plist = NULL; /* New Property list */
+ const H5T_t *type; /* Datatype for dataset */
+ H5D_t *new_dset = NULL;
+ H5P_genplist_t *dc_plist = NULL; /* New Property list */
hbool_t has_vl_type = FALSE; /* Flag to indicate a VL-type for dataset */
hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
hbool_t layout_copied = FALSE; /* Flag to indicate that layout message was copied */
@@ -1106,7 +1059,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
hbool_t pline_copied = FALSE; /* Flag to indicate that pipeline message was copied */
hbool_t efl_copied = FALSE; /* Flag to indicate that external file list message was copied */
H5G_loc_t dset_loc; /* Dataset location */
- H5D_t *ret_value = NULL; /* Return value */
+ H5D_t *ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1246,7 +1199,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
/* Set up append flush parameters for the dataset */
if(H5D__append_flush_setup(new_dset, dapl_id) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set up flush append property")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set up flush append property")
/* Set the external file prefix */
if(H5D_build_extfile_prefix(new_dset, dapl_id, &new_dset->shared->extfile_prefix) < 0)
@@ -1314,10 +1267,6 @@ done:
*
* Return: Success: Ptr to a new dataset.
* Failure: NULL
- *
- * Programmer: Neil Fortner
- * Friday, March 6, 2015
- *
*-------------------------------------------------------------------------
*/
H5D_t *
@@ -1372,17 +1321,13 @@ done:
/*
*-------------------------------------------------------------------------
- * Function: H5D_open
+ * Function: H5D_open
*
- * Purpose: Checks if dataset is already open, or opens a dataset for
+ * Purpose: Checks if dataset is already open, or opens a dataset for
* access.
*
- * Return: Success: Dataset ID
- * Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * Friday, December 20, 2002
- *
+ * Return: Success: Dataset ID
+ * Failure: FAIL
*-------------------------------------------------------------------------
*/
H5D_t *
@@ -1494,19 +1439,15 @@ done:
/*
*-------------------------------------------------------------------------
- * Function: H5D__flush_append_setup
+ * Function: H5D__flush_append_setup
*
- * Purpose: Set the append flush parameters for a dataset
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Vailin Choi
- * Wednesday, January 8, 2014
+ * Purpose: Set the append flush parameters for a dataset
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id)
+H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id)
{
herr_t ret_value = SUCCEED; /* return value */
@@ -1523,47 +1464,47 @@ H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id)
if(dapl_id != H5P_DATASET_ACCESS_DEFAULT && dset->shared->layout.type == H5D_CHUNKED) {
H5P_genplist_t *dapl; /* data access property list object pointer */
- /* Get dataset access property list */
- if(NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for dapl ID");
+ /* Get dataset access property list */
+ if(NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for dapl ID");
- /* Check if append flush property exists */
- if(H5P_exist_plist(dapl, H5D_ACS_APPEND_FLUSH_NAME) > 0) {
+ /* Check if append flush property exists */
+ if(H5P_exist_plist(dapl, H5D_ACS_APPEND_FLUSH_NAME) > 0) {
H5D_append_flush_t info;
- /* Get append flush property */
- if(H5P_get(dapl, H5D_ACS_APPEND_FLUSH_NAME, &info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get append flush info")
- if(info.ndims > 0) {
- hsize_t curr_dims[H5S_MAX_RANK]; /* current dimension sizes */
- hsize_t max_dims[H5S_MAX_RANK]; /* current dimension sizes */
- int rank; /* dataspace # of dimensions */
- unsigned u; /* local index variable */
-
- /* Get dataset rank */
- if((rank = H5S_get_simple_extent_dims(dset->shared->space, curr_dims, max_dims)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions")
- if(info.ndims != (unsigned)rank)
- HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "boundary dimension rank does not match dataset rank")
-
- /* Validate boundary sizes */
- for(u = 0; u < info.ndims; u++)
- if(info.boundary[u] != 0) /* when a non-zero boundary is set */
- /* the dimension is extendible? */
- if(max_dims[u] != H5S_UNLIMITED && max_dims[u] == curr_dims[u])
- break;
+ /* Get append flush property */
+ if(H5P_get(dapl, H5D_ACS_APPEND_FLUSH_NAME, &info) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get append flush info")
+ if(info.ndims > 0) {
+ hsize_t curr_dims[H5S_MAX_RANK]; /* current dimension sizes */
+ hsize_t max_dims[H5S_MAX_RANK]; /* current dimension sizes */
+ int rank; /* dataspace # of dimensions */
+ unsigned u; /* local index variable */
+
+ /* Get dataset rank */
+ if((rank = H5S_get_simple_extent_dims(dset->shared->space, curr_dims, max_dims)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions")
+ if(info.ndims != (unsigned)rank)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "boundary dimension rank does not match dataset rank")
+
+ /* Validate boundary sizes */
+ for(u = 0; u < info.ndims; u++)
+ if(info.boundary[u] != 0) /* when a non-zero boundary is set */
+ /* the dimension is extendible? */
+ if(max_dims[u] != H5S_UNLIMITED && max_dims[u] == curr_dims[u])
+ break;
/* At least one boundary dimension is not extendible */
- if(u != info.ndims)
- HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "boundary dimension is not valid")
+ if(u != info.ndims)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "boundary dimension is not valid")
/* Copy append flush settings */
- dset->shared->append_flush.ndims = info.ndims;
- dset->shared->append_flush.func = info.func;
- dset->shared->append_flush.udata = info.udata;
- HDmemcpy(dset->shared->append_flush.boundary, info.boundary, sizeof(info.boundary));
- } /* end if */
- } /* end if */
+ dset->shared->append_flush.ndims = info.ndims;
+ dset->shared->append_flush.func = info.func;
+ dset->shared->append_flush.udata = info.udata;
+ HDmemcpy(dset->shared->append_flush.boundary, info.boundary, sizeof(info.boundary));
+ } /* end if */
+ } /* end if */
} /* end if */
done:
@@ -1572,15 +1513,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__open_oid
- *
- * Purpose: Opens a dataset for access.
+ * Function: H5D__open_oid
*
- * Return: Dataset pointer on success, NULL on failure
- *
- * Programmer: Quincey Koziol
- * Monday, October 12, 1998
+ * Purpose: Opens a dataset for access.
*
+ * Return: Dataset pointer on success, NULL on failure
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1590,8 +1527,8 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id)
H5O_fill_t *fill_prop; /* Pointer to dataset's fill value info */
unsigned alloc_time_state; /* Allocation time state */
htri_t msg_exists; /* Whether a particular type of message exists */
- hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
- herr_t ret_value = SUCCEED; /* Return value */
+ hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC_TAG(dxpl_id, dataset->oloc.addr, FAIL)
@@ -1637,7 +1574,7 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id)
/* Set up flush append property */
if(H5D__append_flush_setup(dataset, dapl_id))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set up flush append property")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set up flush append property")
/* Point at dataset's copy, to cache it for later */
fill_prop = &dataset->shared->dcpl_cache.fill;
@@ -1650,7 +1587,7 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message")
} /* end if */
else {
- /* For backward compatibility, try to retrieve the old fill value message */
+ /* For backward compatibility, try to retrieve the old fill value message */
if((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_FILL_ID, dxpl_id)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists")
if(msg_exists) {
@@ -1725,7 +1662,7 @@ done:
if(H5F_addr_defined(dataset->oloc.addr) && H5O_close(&(dataset->oloc), NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release object header")
if(dataset->shared) {
- if(layout_init)
+ if(layout_init)
if(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset, dxpl_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info")
if(dataset->shared->space && H5S_close(dataset->shared->space) < 0)
@@ -1748,17 +1685,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_close
- *
- * Purpose: Insures that all data has been saved to the file, closes the
- * dataset object header, and frees all resources used by the
- * descriptor.
- *
- * Return: Non-negative on success/Negative on failure
+ * Function: H5D_close
*
- * Programmer: Robb Matzke
- * Thursday, December 4, 1997
+ * Purpose: Insures that all data has been saved to the file, closes the
+ * dataset object header, and frees all resources used by the
+ * descriptor.
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -1881,7 +1814,7 @@ H5D_close(H5D_t *dataset)
if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__GET_CORKED, &corked) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status")
if(corked)
- if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__UNCORK, NULL) < 0)
+ if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__UNCORK, NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTUNCORK, FAIL, "unable to uncork an object")
/*
@@ -1905,9 +1838,9 @@ H5D_close(H5D_t *dataset)
/* Evict dataset metadata if evicting on close */
if(!file_closed && H5F_SHARED(dataset->oloc.file) && H5F_EVICT_ON_CLOSE(dataset->oloc.file)) {
- if(H5AC_flush_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, H5AC_ind_read_dxpl_id) < 0)
+ if(H5AC_flush_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, H5AC_ind_read_dxpl_id) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata")
- if(H5AC_evict_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, FALSE, H5AC_ind_read_dxpl_id) < 0)
+ if(H5AC_evict_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, FALSE, H5AC_ind_read_dxpl_id) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata")
} /* end if */
@@ -1954,23 +1887,19 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_mult_refresh_close
+ * Function: H5D_mult_refresh_close
*
- * Purpose: Closing down the needed information when the dataset has
- * multiple opens. (From H5O_refresh_metadata_close())
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Vailin Choi
- * 12/24/15
+ * Purpose: Closing down the needed information when the dataset has
+ * multiple opens. (From H5O_refresh_metadata_close())
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
H5D_mult_refresh_close(hid_t dset_id, hid_t dxpl_id)
{
- H5D_t *dataset; /* Dataset to refresh */
- herr_t ret_value = SUCCEED; /* return value */
+ H5D_t *dataset; /* Dataset to refresh */
+ herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2036,16 +1965,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_mult_refresh_reopen
- *
- * Purpose: Re-initialize the needed info when the dataset has multiple
- * opens. (From H5O_refresh_metadata_reopen())
- *
- * Return: Non-negative on success/Negative on failure
+ * Function: H5D_mult_refresh_reopen
*
- * Programmer: Vailin Choi
- * 12/24/15
+ * Purpose: Re-initialize the needed info when the dataset has multiple
+ * opens. (From H5O_refresh_metadata_reopen())
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -2060,25 +1985,25 @@ H5D_mult_refresh_reopen(H5D_t *dataset, hid_t dxpl_id)
HDassert(dataset->shared->fo_count > 0);
if(dataset->shared->fo_count > 1) {
- /* Release dataspace info */
- if(H5S_close(dataset->shared->space) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
-
- /* Re-load dataspace info */
- if(NULL == (dataset->shared->space = H5S_read(&(dataset->oloc), dxpl_id)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header")
-
- /* Cache the dataset's dataspace info */
- if(H5D__cache_dataspace_info(dataset) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info")
-
- /* Release layout info */
- if(H5O_msg_reset(H5O_LAYOUT_ID, &dataset->shared->layout) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset layout info")
-
- /* Re-load layout message info */
- if(NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, &(dataset->shared->layout), dxpl_id))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message")
+ /* Release dataspace info */
+ if(H5S_close(dataset->shared->space) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
+
+ /* Re-load dataspace info */
+ if(NULL == (dataset->shared->space = H5S_read(&(dataset->oloc), dxpl_id)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header")
+
+ /* Cache the dataset's dataspace info */
+ if(H5D__cache_dataspace_info(dataset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info")
+
+ /* Release layout info */
+ if(H5O_msg_reset(H5O_LAYOUT_ID, &dataset->shared->layout) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset layout info")
+
+ /* Re-load layout message info */
+ if(NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, &(dataset->shared->layout), dxpl_id))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message")
} /* end if */
done:
@@ -2087,16 +2012,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_oloc
- *
- * Purpose: Returns a pointer to the object location for a dataset.
+ * Function: H5D_oloc
*
- * Return: Success: Ptr to location
- * Failure: NULL
- *
- * Programmer: Robb Matzke
- * Friday, April 24, 1998
+ * Purpose: Returns a pointer to the object location for a dataset.
*
+ * Return: Success: Ptr to location
+ * Failure: NULL
*-------------------------------------------------------------------------
*/
H5O_loc_t *
@@ -2110,16 +2031,12 @@ H5D_oloc(H5D_t *dataset)
/*-------------------------------------------------------------------------
- * Function: H5D_nameof
- *
- * Purpose: Returns a pointer to the group hier. path for a dataset.
+ * Function: H5D_nameof
*
- * Return: Success: Ptr to entry
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * Monday, September 12, 2005
+ * Purpose: Returns a pointer to the group hier. path for a dataset.
*
+ * Return: Success: Ptr to entry
+ * Failure: NULL
*-------------------------------------------------------------------------
*/
H5G_name_t *
@@ -2133,17 +2050,13 @@ H5D_nameof(H5D_t *dataset)
/*-------------------------------------------------------------------------
- * Function: H5D_typeof
- *
- * Purpose: Returns a pointer to the dataset's datatype. The datatype
- * is not copied.
+ * Function: H5D_typeof
*
- * Return: Success: Ptr to the dataset's datatype, uncopied.
- * Failure: NULL
- *
- * Programmer: Robb Matzke
- * Thursday, June 4, 1998
+ * Purpose: Returns a pointer to the dataset's datatype. The datatype
+ * is not copied.
*
+ * Return: Success: Ptr to the dataset's datatype, uncopied.
+ * Failure: NULL
*-------------------------------------------------------------------------
*/
H5T_t *
@@ -2161,15 +2074,11 @@ H5D_typeof(const H5D_t *dset)
/*-------------------------------------------------------------------------
- * Function: H5D__alloc_storage
- *
- * Purpose: Allocate storage for the raw data of a dataset.
+ * Function: H5D__alloc_storage
*
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Friday, January 16, 1998
+ * Purpose: Allocate storage for the raw data of a dataset.
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -2177,11 +2086,11 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc,
hbool_t full_overwrite, hsize_t old_dim[])
{
const H5D_t *dset = io_info->dset; /* The dataset object */
- H5F_t *f = dset->oloc.file; /* The dataset's file pointer */
- H5O_layout_t *layout; /* The dataset's layout information */
- hbool_t must_init_space = FALSE; /* Flag to indicate that space should be initialized */
- hbool_t addr_set = FALSE; /* Flag to indicate that the dataset's storage address was set */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t *f = dset->oloc.file; /* The dataset's file pointer */
+ H5O_layout_t *layout; /* The dataset's layout information */
+ hbool_t must_init_space = FALSE; /* Flag to indicate that space should be initialized */
+ hbool_t addr_set = FALSE; /* Flag to indicate that the dataset's storage address was set */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2231,19 +2140,18 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc,
} /* end if */
/* If space allocation is set to 'early' and we are extending
- * the dataset, indicate that space should be allocated, so the
+ * the dataset, indicate that space should be allocated, so the
* index gets expanded. -QAK
*/
- if(dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_EARLY
- && time_alloc == H5D_ALLOC_EXTEND)
- must_init_space = TRUE;
+ if(dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_EARLY && time_alloc == H5D_ALLOC_EXTEND)
+ must_init_space = TRUE;
break;
case H5D_COMPACT:
/* Check if space is already allocated */
if(NULL == layout->storage.u.compact.buf) {
- /* Reserve space in layout header message for the entire array.
- * Starting from the 1.8.7 release, we allow dataspace to have
+ /* Reserve space in layout header message for the entire array.
+ * Starting from the 1.8.7 release, we allow dataspace to have
* zero dimension size. So the storage size can be zero.
* SLU 2011/4/4 */
if(layout->storage.u.compact.size > 0) {
@@ -2255,7 +2163,8 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc,
/* Indicate that we should initialize storage space */
must_init_space = TRUE;
- } else {
+ }
+ else {
layout->storage.u.compact.dirty = FALSE;
must_init_space = FALSE;
}
@@ -2297,7 +2206,7 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc,
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset with fill value")
} /* end if */
else {
- H5D_fill_value_t fill_status; /* The fill value status */
+ H5D_fill_value_t fill_status; /* The fill value status */
/* Check the dataset's fill-value status */
if(H5P_is_fill_value_defined(&dset->shared->dcpl_cache.fill, &fill_status) < 0)
@@ -2331,24 +2240,20 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__init_storage
- *
- * Purpose: Initialize the data for a new dataset. If a selection is
- * defined for SPACE then initialize only that part of the
- * dataset.
+ * Function: H5D__init_storage
*
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Monday, October 5, 1998
+ * Purpose: Initialize the data for a new dataset. If a selection is
+ * defined for SPACE then initialize only that part of the
+ * dataset.
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
static herr_t
H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[])
{
const H5D_t *dset = io_info->dset; /* dataset pointer */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2407,22 +2312,18 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__get_storage_size
- *
- * Purpose: Determines how much space has been reserved to store the raw
- * data of a dataset.
- *
- * Return: Non-negative on success, negative on failure
+ * Function: H5D__get_storage_size
*
- * Programmer: Robb Matzke
- * Wednesday, April 21, 1999
+ * Purpose: Determines how much space has been reserved to store the raw
+ * data of a dataset.
*
+ * Return: Non-negative on success, negative on failure
*-------------------------------------------------------------------------
*/
herr_t
H5D__get_storage_size(H5D_t *dset, hid_t dxpl_id, hsize_t *storage_size)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dxpl_id, dset->oloc.addr, FAIL)
@@ -2466,24 +2367,19 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__get_offset
+ * Function: H5D__get_offset
*
- * Purpose: Private function for H5D__get_offset. Returns the address
- * of dataset in file.
- *
- * Return: Success: the address of dataset
- *
- * Failure: HADDR_UNDEF
- *
- * Programmer: Raymond Lu
- * November 6, 2002
+ * Purpose: Private function for H5D__get_offset. Returns the address
+ * of dataset in file.
*
+ * Return: Success: the address of dataset
+ * Failure: HADDR_UNDEF
*-------------------------------------------------------------------------
*/
haddr_t
H5D__get_offset(const H5D_t *dset)
{
- haddr_t ret_value = HADDR_UNDEF;
+ haddr_t ret_value = HADDR_UNDEF;
FUNC_ENTER_PACKAGE
@@ -2515,18 +2411,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_vlen_reclaim
- *
- * Purpose: Frees the buffers allocated for storing variable-length data
- * in memory. Only frees the VL data in the selection defined in the
- * dataspace. The dataset transfer property list is required to find the
- * correct allocation/free methods for the VL data in the buffer.
+ * Function: H5D_vlen_reclaim
*
- * Return: Non-negative on success, negative on failure
- *
- * Programmer: Quincey Koziol
- * Tuesday, November 22, 2005
+ * Purpose: Frees the buffers allocated for storing variable-length data
+ * in memory. Only frees the VL data in the selection defined in the
+ * dataspace. The dataset transfer property list is required to find the
+ * correct allocation/free methods for the VL data in the buffer.
*
+ * Return: Non-negative on success, negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -2536,7 +2428,7 @@ H5D_vlen_reclaim(hid_t type_id, H5S_t *space, hid_t plist_id, void *buf)
H5S_sel_iter_op_t dset_op; /* Operator for iteration */
H5T_vlen_alloc_info_t _vl_alloc_info; /* VL allocation info buffer */
H5T_vlen_alloc_info_t *vl_alloc_info = &_vl_alloc_info; /* VL allocation info */
- herr_t ret_value = FAIL; /* Return value */
+ herr_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2566,18 +2458,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__vlen_get_buf_size_alloc
- *
- * Purpose: This routine makes certain there is enough space in the temporary
- * buffer for the new data to read in. All the VL data read in is actually
- * placed in this buffer, overwriting the previous data. Needless to say,
- * this data is not actually usable.
- *
- * Return: Non-negative on success, negative on failure
+ * Function: H5D__vlen_get_buf_size_alloc
*
- * Programmer: Quincey Koziol
- * Tuesday, August 17, 1999
+ * Purpose: This routine makes certain there is enough space in the temporary
+ * buffer for the new data to read in. All the VL data read in is actually
+ * placed in this buffer, overwriting the previous data. Needless to say,
+ * this data is not actually usable.
*
+ * Return: Non-negative on success, negative on failure
*-------------------------------------------------------------------------
*/
void *
@@ -2600,14 +2488,14 @@ H5D__vlen_get_buf_size_alloc(size_t size, void *info)
/*-------------------------------------------------------------------------
- * Function: H5D__vlen_get_buf_size
+ * Function: H5D__vlen_get_buf_size
*
- * Purpose: This routine checks the number of bytes required to store a single
- * element from a dataset in memory, creating a selection with just the
- * single element selected to read in the element and using a custom memory
- * allocator for any VL data encountered.
- * The *size value is modified according to how many bytes are
- * required to store the element in memory.
+ * Purpose: This routine checks the number of bytes required to store a single
+ * element from a dataset in memory, creating a selection with just the
+ * single element selected to read in the element and using a custom memory
+ * allocator for any VL data encountered.
+ * The *size value is modified according to how many bytes are
+ * required to store the element in memory.
*
* Implementation: This routine actually performs the read with a custom
* memory manager which basically just counts the bytes requested and
@@ -2617,11 +2505,7 @@ H5D__vlen_get_buf_size_alloc(size_t size, void *info)
* Kinda kludgy, but easier than the other method of trying to figure out
* the sizes without actually reading the data in... - QAK
*
- * Return: Non-negative on success, negative on failure
- *
- * Programmer: Quincey Koziol
- * Tuesday, August 17, 1999
- *
+ * Return: Non-negative on success, negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -2658,15 +2542,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__check_filters
- *
- * Purpose: Check if the filters have be initialized for the dataset
- *
- * Return: Non-negative on success/Negative on failure
+ * Function: H5D__check_filters
*
- * Programmer: Quincey Koziol
- * Thursday, October 11, 2007
+ * Purpose: Check if the filters have be initialized for the dataset
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -2712,16 +2592,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__set_extent
+ * Function: H5D__set_extent
*
- * Purpose: Based on H5D_extend, allows change to a lower dimension,
- * calls H5S_set_extent and H5D__chunk_prune_by_extent instead
- *
- * Return: Non-negative on success, negative on failure
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- * April 9, 2002
+ * Purpose: Based on H5D_extend, allows change to a lower dimension,
+ * calls H5S_set_extent and H5D__chunk_prune_by_extent instead
*
+ * Return: Non-negative on success, negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -2795,7 +2671,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id)
dset->shared->cache.chunk.scaled_dims[u] > dset->shared->cache.chunk.nslots))
update_chunks = TRUE;
- if( !(scaled_power2up = H5VM_power2up(scaled)) )
+ if(!(scaled_power2up = H5VM_power2up(scaled)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2")
/* Check if the number of bits required to encode the scaled size value changed */
@@ -2884,7 +2760,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id)
&& (dset->shared->dcpl_cache.pline.nused > 0))
if(H5D__chunk_update_old_edge_chunks(dset, dxpl_id, curr_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to do update old edge chunks")
- } /* end if */
+ } /* end if */
/* Mark the dataspace as dirty, for later writing to the file */
if(H5D__mark(dset, dxpl_id, H5D_MARK_SPACE) < 0)
@@ -2897,16 +2773,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__flush_sieve_buf
+ * Function: H5D__flush_sieve_buf
*
- * Purpose: Flush any dataset sieve buffer info cached in memory
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * July 27, 2009
+ * Purpose: Flush any dataset sieve buffer info cached in memory
*
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -2938,16 +2810,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__flush_real
- *
- * Purpose: Flush any dataset information cached in memory
- *
- * Return: Success: Non-negative
- * Failure: Negative
+ * Function: H5D__flush_real
*
- * Programmer: Quincey Koziol
- * December 6, 2007
+ * Purpose: Flush any dataset information cached in memory
*
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -2975,29 +2843,25 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__format_convert
+ * Function: H5D__format_convert
*
- * Purpose: For chunked: downgrade the chunk indexing type to version 1 B-tree
- * For compact/contiguous: downgrade layout version to 3
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Vailin Choi
- * Feb 2015
+ * Purpose: For chunked: downgrade the chunk indexing type to version 1 B-tree
+ * For compact/contiguous: downgrade layout version to 3
*
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
H5D__format_convert(H5D_t *dataset, hid_t dxpl_id)
{
- H5D_chk_idx_info_t new_idx_info; /* Index info for the new layout */
- H5D_chk_idx_info_t idx_info; /* Index info for the current layout */
+ H5D_chk_idx_info_t new_idx_info; /* Index info for the new layout */
+ H5D_chk_idx_info_t idx_info; /* Index info for the current layout */
H5O_layout_t *newlayout = NULL; /* The new layout */
hbool_t init_new_index = FALSE; /* Indicate that the new chunk index is initialized */
- hbool_t delete_old_layout = FALSE; /* Indicate that the old layout message is deleted */
+ hbool_t delete_old_layout = FALSE; /* Indicate that the old layout message is deleted */
hbool_t add_new_layout = FALSE; /* Indicate that the new layout message is added */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dxpl_id, dataset->oloc.addr, FAIL)
@@ -3047,7 +2911,7 @@ H5D__format_convert(H5D_t *dataset, hid_t dxpl_id)
if((new_idx_info.storage->ops->create)(&new_idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create chunk index")
- /* Iterate over the chunks in the current index and insert the chunk addresses
+ /* Iterate over the chunks in the current index and insert the chunk addresses
* into the version 1 B-tree chunk index
*/
if(H5D__chunk_format_convert(dataset, &idx_info, &new_idx_info) < 0)
@@ -3090,7 +2954,7 @@ H5D__format_convert(H5D_t *dataset, hid_t dxpl_id)
case H5D_NLAYOUTS:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type")
- default:
+ default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type")
} /* end switch */
@@ -3132,16 +2996,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__mark
- *
- * Purpose: Mark some aspect of a dataset as dirty
+ * Function: H5D__mark
*
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * July 4, 2008
+ * Purpose: Mark some aspect of a dataset as dirty
*
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -3197,24 +3057,20 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__flush_cb
- *
- * Purpose: Flush any dataset information cached in memory
+ * Function: H5D__flush_cb
*
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * November 8, 2007
+ * Purpose: Flush any dataset information cached in memory
*
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
static int
H5D__flush_cb(void *_dataset, hid_t H5_ATTR_UNUSED id, void *_udata)
{
- H5D_t *dataset = (H5D_t *)_dataset; /* Dataset pointer */
+ H5D_t *dataset = (H5D_t *)_dataset; /* Dataset pointer */
H5D_flush_ud_t *udata = (H5D_flush_ud_t *)_udata; /* User data for callback */
- int ret_value = H5_ITER_CONT; /* Return value */
+ int ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -3234,23 +3090,19 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_flush
- *
- * Purpose: Flush any dataset information cached in memory
+ * Function: H5D_flush
*
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Ray Lu
- * August 14, 2002
+ * Purpose: Flush any dataset information cached in memory
*
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
H5D_flush(const H5F_t *f, hid_t dxpl_id)
{
- H5D_flush_ud_t udata; /* User data for callback */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_flush_ud_t udata; /* User data for callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -3271,19 +3123,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_get_create_plist
- *
- * Purpose: Private function for H5Dget_create_plist
- *
- * Return: Success: ID for a copy of the dataset creation
- * property list. The template should be
- * released by calling H5P_close().
+ * Function: H5D_get_create_plist
*
- * Failure: FAIL
- *
- * Programmer: Robb Matzke
- * Tuesday, February 3, 1998
+ * Purpose: Private function for H5Dget_create_plist
*
+ * Return: Success: ID for a copy of the dataset creation
+ * property list. The template should be
+ * released by calling H5P_close().
+ * Failure: FAIL
*-------------------------------------------------------------------------
*/
hid_t
@@ -3294,8 +3141,8 @@ H5D_get_create_plist(H5D_t *dset)
H5O_layout_t copied_layout; /* Layout to tweak */
H5O_fill_t copied_fill; /* Fill value to tweak */
H5O_efl_t copied_efl; /* External file list to tweak */
- hid_t new_dcpl_id = FAIL;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ hid_t new_dcpl_id = FAIL;
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -3336,7 +3183,7 @@ H5D_get_create_plist(H5D_t *dset)
/* Reset index info, if the chunk ops are set */
if(copied_layout.storage.u.chunk.ops)
- /* Reset address and pointer of the array struct for the chunked storage index */
+ /* Reset address and pointer of the array struct for the chunked storage index */
if(H5D_chunk_idx_reset(&copied_layout.storage.u.chunk, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to reset chunked storage index in dest")
@@ -3453,18 +3300,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_get_access_plist
- *
- * Purpose: Returns a copy of the dataset access property list.
- *
- * Return: Success: ID for a copy of the dataset access
- * property list.
- *
- * Failure: FAIL
+ * Function: H5D_get_access_plist
*
- * Programmer: Mohamad Chaarawi
- * March, 2012
+ * Purpose: Returns a copy of the dataset access property list.
*
+ * Return: Success: ID for a copy of the dataset access
+ * property list.
+ * Failure: FAIL
*-------------------------------------------------------------------------
*/
hid_t
@@ -3522,24 +3364,19 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_get_space
- *
- * Purpose: Returns and ID for the dataspace of the dataset.
- *
- * Return: Success: ID for dataspace
- *
- * Failure: FAIL
+ * Function: H5D_get_space
*
- * Programmer: Mohamad Chaarawi
- * March, 2012
+ * Purpose: Returns and ID for the dataspace of the dataset.
*
+ * Return: Success: ID for dataspace
+ * Failure: FAIL
*-------------------------------------------------------------------------
*/
hid_t
H5D_get_space(H5D_t *dset)
{
- H5S_t *space = NULL;
- hid_t ret_value = H5I_INVALID_HID;
+ H5S_t *space = NULL;
+ hid_t ret_value = H5I_INVALID_HID;
FUNC_ENTER_NOAPI_NOINIT
@@ -3567,24 +3404,19 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_get_type
+ * Function: H5D_get_type
*
- * Purpose: Returns and ID for the datatype of the dataset.
- *
- * Return: Success: ID for datatype
- *
- * Failure: FAIL
- *
- * Programmer: Mohamad Chaarawi
- * March, 2012
+ * Purpose: Returns and ID for the datatype of the dataset.
*
+ * Return: Success: ID for datatype
+ * Failure: FAIL
*-------------------------------------------------------------------------
*/
hid_t
H5D_get_type(H5D_t *dset)
{
- H5T_t *dt = NULL;
- hid_t ret_value = FAIL;
+ H5T_t *dt = NULL;
+ hid_t ret_value = FAIL;
FUNC_ENTER_NOAPI_NOINIT
@@ -3618,15 +3450,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__refresh
+ * Function: H5D__refresh
*
- * Purpose: Refreshes all buffers associated with a dataset.
- *
- * Return: SUCCEED/FAIL
- *
- * Programmer: Dana Robinson
- * November 2015
+ * Purpose: Refreshes all buffers associated with a dataset.
*
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -3653,7 +3481,7 @@ H5D__refresh(hid_t dset_id, H5D_t *dset, hid_t dxpl_id)
if(H5D__virtual_refresh_source_dsets(dset, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh VDS source datasets")
} /* end if */
-
+
/* Refresh dataset object */
if((H5O_refresh_metadata(dset_id, dset->oloc, dxpl_id)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh dataset")
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c
index 08d7929..5a4d537 100644
--- a/src/H5Dlayout.c
+++ b/src/H5Dlayout.c
@@ -46,6 +46,11 @@
/* Package Variables */
/*********************/
+const unsigned H5O_layout_ver_bounds[] = {
+ H5O_LAYOUT_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5O_LAYOUT_VERSION_3, /* H5F_LIBVER_V18 */
+ H5O_LAYOUT_VERSION_LATEST /* H5F_LIBVER_LATEST */
+};
/*****************************/
/* Library Private Variables */
@@ -56,12 +61,6 @@
/* Local Variables */
/*******************/
-/* Format version bounds for layout */
-static const unsigned H5O_layout_ver_bounds[] = {
- H5O_LAYOUT_VERSION_1, /* H5F_LIBVER_EARLIEST */
- H5O_LAYOUT_VERSION_3, /* H5F_LIBVER_V18 */
- H5O_LAYOUT_VERSION_LATEST /* H5F_LIBVER_LATEST */
-};
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 097fab7..beb1089 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -12,12 +12,12 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
- * Monday, April 14, 2003
+ * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Monday, April 14, 2003
*
- * Purpose: This file contains declarations which are visible only within
- * the H5D package. Source files outside the H5D package should
- * include H5Dprivate.h instead.
+ * Purpose: This file contains declarations which are visible only within
+ * the H5D package. Source files outside the H5D package should
+ * include H5Dprivate.h instead.
*/
#if !(defined H5D_FRIEND || defined H5D_MODULE)
#error "Do not include this file outside the H5D package!"
@@ -30,12 +30,12 @@
#include "H5Dprivate.h"
/* Other private headers needed by this file */
-#include "H5ACprivate.h" /* Metadata cache */
+#include "H5ACprivate.h" /* Metadata cache */
#include "H5B2private.h" /* v2 B-trees */
-#include "H5Fprivate.h" /* File access */
-#include "H5Gprivate.h" /* Groups */
-#include "H5SLprivate.h" /* Skip lists */
-#include "H5Tprivate.h" /* Datatypes */
+#include "H5Fprivate.h" /* File access */
+#include "H5Gprivate.h" /* Groups */
+#include "H5SLprivate.h" /* Skip lists */
+#include "H5Tprivate.h" /* Datatypes */
/**************************/
/* Package Private Macros */
@@ -70,22 +70,22 @@
/* See H5O_layout_chunk_t */
/* Fixed array creation values */
-#define H5D_FARRAY_CREATE_PARAM_SIZE 1 /* Size of the creation parameters in bytes */
-#define H5D_FARRAY_MAX_DBLK_PAGE_NELMTS_BITS 10 /* i.e. 1024 elements per data block page */
+#define H5D_FARRAY_CREATE_PARAM_SIZE 1 /* Size of the creation parameters in bytes */
+#define H5D_FARRAY_MAX_DBLK_PAGE_NELMTS_BITS 10 /* i.e. 1024 elements per data block page */
/* Extensible array creation values */
-#define H5D_EARRAY_CREATE_PARAM_SIZE 5 /* Size of the creation parameters in bytes */
-#define H5D_EARRAY_MAX_NELMTS_BITS 32 /* i.e. 4 giga-elements */
-#define H5D_EARRAY_IDX_BLK_ELMTS 4
-#define H5D_EARRAY_SUP_BLK_MIN_DATA_PTRS 4
-#define H5D_EARRAY_DATA_BLK_MIN_ELMTS 16
-#define H5D_EARRAY_MAX_DBLOCK_PAGE_NELMTS_BITS 10 /* i.e. 1024 elements per data block page */
+#define H5D_EARRAY_CREATE_PARAM_SIZE 5 /* Size of the creation parameters in bytes */
+#define H5D_EARRAY_MAX_NELMTS_BITS 32 /* i.e. 4 giga-elements */
+#define H5D_EARRAY_IDX_BLK_ELMTS 4
+#define H5D_EARRAY_SUP_BLK_MIN_DATA_PTRS 4
+#define H5D_EARRAY_DATA_BLK_MIN_ELMTS 16
+#define H5D_EARRAY_MAX_DBLOCK_PAGE_NELMTS_BITS 10 /* i.e. 1024 elements per data block page */
/* v2 B-tree creation values for raw meta_size */
-#define H5D_BT2_CREATE_PARAM_SIZE 6 /* Size of the creation parameters in bytes */
-#define H5D_BT2_NODE_SIZE 2048
-#define H5D_BT2_SPLIT_PERC 100
-#define H5D_BT2_MERGE_PERC 40
+#define H5D_BT2_CREATE_PARAM_SIZE 6 /* Size of the creation parameters in bytes */
+#define H5D_BT2_NODE_SIZE 2048
+#define H5D_BT2_SPLIT_PERC 100
+#define H5D_BT2_MERGE_PERC 40
/****************************/
@@ -97,23 +97,23 @@ typedef struct H5D_type_info_t {
/* Initial values */
const H5T_t *mem_type; /* Pointer to memory datatype */
const H5T_t *dset_type; /* Pointer to dataset datatype */
- H5T_path_t *tpath; /* Datatype conversion path */
+ H5T_path_t *tpath; /* Datatype conversion path */
hid_t src_type_id; /* Source datatype ID */
hid_t dst_type_id; /* Destination datatype ID */
/* Computed/derived values */
- size_t src_type_size; /* Size of source type */
- size_t dst_type_size; /* Size of destination type */
- size_t max_type_size; /* Size of largest source/destination type */
- hbool_t is_conv_noop; /* Whether the type conversion is a NOOP */
- hbool_t is_xform_noop; /* Whether the data transform is a NOOP */
+ size_t src_type_size; /* Size of source type */
+ size_t dst_type_size; /* Size of destination type */
+ size_t max_type_size; /* Size of largest source/destination type */
+ hbool_t is_conv_noop; /* Whether the type conversion is a NOOP */
+ hbool_t is_xform_noop; /* Whether the data transform is a NOOP */
const H5T_subset_info_t *cmpd_subset; /* Info related to the compound subset conversion functions */
- H5T_bkg_t need_bkg; /* Type of background buf needed */
- size_t request_nelmts; /* Requested strip mine */
- uint8_t *tconv_buf; /* Datatype conv buffer */
- hbool_t tconv_buf_allocated; /* Whether the type conversion buffer was allocated */
- uint8_t *bkg_buf; /* Background buffer */
- hbool_t bkg_buf_allocated; /* Whether the background buffer was allocated */
+ H5T_bkg_t need_bkg; /* Type of background buf needed */
+ size_t request_nelmts; /* Requested strip mine */
+ uint8_t *tconv_buf; /* Datatype conv buffer */
+ hbool_t tconv_buf_allocated; /* Whether the type conversion buffer was allocated */
+ uint8_t *bkg_buf; /* Background buffer */
+ hbool_t bkg_buf_allocated; /* Whether the background buffer was allocated */
} H5D_type_info_t;
/* Forward declaration of structs used below */
@@ -191,13 +191,13 @@ typedef struct {
} H5D_chunk_storage_t;
typedef struct {
- void *buf; /* Buffer for compact dataset */
+ void *buf; /* Buffer for compact dataset */
hbool_t *dirty; /* Pointer to dirty flag to mark */
} H5D_compact_storage_t;
typedef union H5D_storage_t {
H5D_contig_storage_t contig; /* Contiguous information for dataset */
- H5D_chunk_storage_t chunk; /* Chunk information for dataset */
+ H5D_chunk_storage_t chunk; /* Chunk information for dataset */
H5D_compact_storage_t compact; /* Compact information for dataset */
H5O_efl_t efl; /* External file list information for dataset */
} H5D_storage_t;
@@ -261,10 +261,10 @@ typedef struct H5D_chk_idx_info_t {
* The chunk's file address, filter mask and size on disk are not key values.
*/
typedef struct H5D_chunk_rec_t {
- hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Logical offset to start */
- uint32_t nbytes; /* Size of stored data */
- uint32_t filter_mask; /* Excluded filters */
- haddr_t chunk_addr; /* Address of chunk in file */
+ hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Logical offset to start */
+ uint32_t nbytes; /* Size of stored data */
+ uint32_t filter_mask; /* Excluded filters */
+ haddr_t chunk_addr; /* Address of chunk in file */
} H5D_chunk_rec_t;
/*
@@ -273,9 +273,9 @@ typedef struct H5D_chunk_rec_t {
* to which the index points.
*/
typedef struct H5D_chunk_common_ud_t {
- const H5O_layout_chunk_t *layout; /* Chunk layout description */
- const H5O_storage_chunk_t *storage; /* Chunk storage description */
- const hsize_t *scaled; /* Scaled coordinates for a chunk */
+ const H5O_layout_chunk_t *layout; /* Chunk layout description */
+ const H5O_storage_chunk_t *storage; /* Chunk storage description */
+ const hsize_t *scaled; /* Scaled coordinates for a chunk */
} H5D_chunk_common_ud_t;
/* B-tree callback info for various operations */
@@ -286,7 +286,7 @@ typedef struct H5D_chunk_ud_t {
/* Upward */
unsigned idx_hint; /* Index of chunk in cache, if present */
H5F_block_t chunk_block; /* Offset/length of chunk in file */
- unsigned filter_mask; /* Excluded filters */
+ unsigned filter_mask; /* Excluded filters */
hbool_t new_unfilt_chunk; /* Whether the chunk just became unfiltered */
hsize_t chunk_idx; /* Chunk index for EA, FA indexing */
} H5D_chunk_ud_t;
@@ -386,11 +386,11 @@ typedef struct H5D_chunk_map_t {
/* Cached information about a particular chunk */
typedef struct H5D_chunk_cached_t {
hbool_t valid; /*whether cache info is valid*/
- hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled offset of chunk*/
- haddr_t addr; /*file address of chunk */
- uint32_t nbytes; /*size of stored data */
- hsize_t chunk_idx; /*index of chunk in dataset */
- unsigned filter_mask; /*excluded filters */
+ hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled offset of chunk*/
+ haddr_t addr; /*file address of chunk */
+ uint32_t nbytes; /*size of stored data */
+ hsize_t chunk_idx; /*index of chunk in dataset */
+ unsigned filter_mask; /*excluded filters */
} H5D_chunk_cached_t;
/****************************/
@@ -407,23 +407,23 @@ typedef struct H5D_virtual_held_file_t {
struct H5D_rdcc_ent_t; /* Forward declaration of struct used below */
typedef struct H5D_rdcc_t {
struct {
- unsigned ninits; /* Number of chunk creations */
- unsigned nhits; /* Number of cache hits */
- unsigned nmisses;/* Number of cache misses */
- unsigned nflushes;/* Number of cache flushes */
+ unsigned ninits; /* Number of chunk creations */
+ unsigned nhits; /* Number of cache hits */
+ unsigned nmisses; /* Number of cache misses */
+ unsigned nflushes; /* Number of cache flushes */
} stats;
- size_t nbytes_max; /* Maximum cached raw data in bytes */
- size_t nslots; /* Number of chunk slots allocated */
- double w0; /* Chunk preemption policy */
- struct H5D_rdcc_ent_t *head; /* Head of doubly linked list */
- struct H5D_rdcc_ent_t *tail; /* Tail of doubly linked list */
+ size_t nbytes_max; /* Maximum cached raw data in bytes */
+ size_t nslots; /* Number of chunk slots allocated */
+ double w0; /* Chunk preemption policy */
+ struct H5D_rdcc_ent_t *head; /* Head of doubly linked list */
+ struct H5D_rdcc_ent_t *tail; /* Tail of doubly linked list */
struct H5D_rdcc_ent_t *tmp_head; /* Head of temporary doubly linked list. Chunks on this list are not in the hash table (slot). The head entry is a sentinel (does not refer to an actual chunk). */
- size_t nbytes_used; /* Current cached raw data in bytes */
- int nused; /* Number of chunk slots in use */
+ size_t nbytes_used; /* Current cached raw data in bytes */
+ int nused; /* Number of chunk slots in use */
H5D_chunk_cached_t last; /* Cached copy of last chunk information */
struct H5D_rdcc_ent_t **slot; /* Chunk slots, each points to a chunk*/
- H5SL_t *sel_chunks; /* Skip list containing information for each chunk selected */
- H5S_t *single_space; /* Dataspace for single element I/O on chunks */
+ H5SL_t *sel_chunks; /* Skip list containing information for each chunk selected */
+ H5S_t *single_space; /* Dataspace for single element I/O on chunks */
H5D_chunk_info_t *single_chunk_info; /* Pointer to single chunk's info */
/* Cached information about scaled dataspace dimensions */
@@ -459,10 +459,10 @@ typedef struct H5D_shared_t {
hbool_t checked_filters;/* TRUE if dataset passes can_apply check */
/* Cached dataspace info */
- unsigned ndims; /* The dataset's dataspace rank */
- hsize_t curr_dims[H5S_MAX_RANK]; /* The curr. size of dataset dimensions */
- hsize_t curr_power2up[H5S_MAX_RANK]; /* The curr. dim sizes, rounded up to next power of 2 */
- hsize_t max_dims[H5S_MAX_RANK]; /* The max. size of dataset dimensions */
+ unsigned ndims; /* The dataset's dataspace rank */
+ hsize_t curr_dims[H5S_MAX_RANK]; /* The curr. size of dataset dimensions */
+ hsize_t curr_power2up[H5S_MAX_RANK]; /* The curr. dim sizes, rounded up to next power of 2 */
+ hsize_t max_dims[H5S_MAX_RANK]; /* The max. size of dataset dimensions */
/* Buffered/cached information for types of raw data storage*/
struct {
@@ -474,7 +474,7 @@ typedef struct H5D_shared_t {
H5D_rdcc_t chunk; /* Information about chunked data */
} cache;
- H5D_append_flush_t append_flush; /* Append flush property information */
+ H5D_append_flush_t append_flush; /* Append flush property information */
char *extfile_prefix; /* expanded external file prefix */
} H5D_shared_t;
@@ -689,7 +689,7 @@ H5_DLL herr_t H5D__chunk_bh_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh,
H5_DLL herr_t H5D__chunk_dump_index(H5D_t *dset, hid_t dxpl_id, FILE *stream);
H5_DLL herr_t H5D__chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
H5O_storage_t *store);
-H5_DLL herr_t H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters,
+H5_DLL herr_t H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters,
hsize_t *offset, uint32_t data_size, const void *buf);
H5_DLL herr_t H5D__chunk_direct_read(const H5D_t *dset, hid_t dxpl_id, hsize_t *offset,
uint32_t *filters, void *buf);
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index 5d565bb..fb994d8 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -21,10 +21,10 @@
#include "H5Dpublic.h"
/* Private headers needed by this file */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Sprivate.h" /* Dataspaces */
-#include "H5Zprivate.h" /* Data filters */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Sprivate.h" /* Dataspaces */
+#include "H5Zprivate.h" /* Data filters */
/**************************/
@@ -33,18 +33,18 @@
/*
* Feature: Define H5D_DEBUG on the compiler command line if you want to
- * debug dataset I/O. NDEBUG must not be defined in order for this
- * to have any effect.
+ * debug dataset I/O. NDEBUG must not be defined in order for this
+ * to have any effect.
*/
#ifdef NDEBUG
# undef H5D_DEBUG
#endif
/* ======== Dataset creation property names ======== */
-#define H5D_CRT_LAYOUT_NAME "layout" /* Storage layout */
-#define H5D_CRT_FILL_VALUE_NAME "fill_value" /* Fill value */
+#define H5D_CRT_LAYOUT_NAME "layout" /* Storage layout */
+#define H5D_CRT_FILL_VALUE_NAME "fill_value" /* Fill value */
#define H5D_CRT_ALLOC_TIME_STATE_NAME "alloc_time_state" /* Space allocation time state */
-#define H5D_CRT_EXT_FILE_LIST_NAME "efl" /* External file list */
+#define H5D_CRT_EXT_FILE_LIST_NAME "efl" /* External file list */
/* ======== Dataset access property names ======== */
#define H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME "rdcc_nslots" /* Size of raw data chunk cache(slots) */
@@ -75,11 +75,11 @@
#define H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME "mpio_chunk_opt_ratio"
#define H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME "actual_chunk_opt_mode"
#define H5D_MPIO_ACTUAL_IO_MODE_NAME "actual_io_mode"
-#define H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME "local_no_collective_cause" /* cause of broken collective I/O in each process */
+#define H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME "local_no_collective_cause" /* cause of broken collective I/O in each process */
#define H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME "global_no_collective_cause" /* cause of broken collective I/O in all processes */
-#define H5D_XFER_EDC_NAME "err_detect" /* EDC */
-#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */
-#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */
+#define H5D_XFER_EDC_NAME "err_detect" /* EDC */
+#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */
+#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */
#define H5D_XFER_XFORM_NAME "data_transform" /* Data transform */
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
/* Collective chunk instrumentation properties */
@@ -152,10 +152,10 @@ typedef struct H5D_copy_file_ud_t {
/* Structure for dataset append flush property (H5Pset_append_flush) */
typedef struct H5D_append_flush_t {
- unsigned ndims; /* The # of dimensions for "boundary" */
- hsize_t boundary[H5S_MAX_RANK]; /* The dimension sizes for determining boundary */
- H5D_append_cb_t func; /* The callback function */
- void *udata; /* User data */
+ unsigned ndims; /* The # of dimensions for "boundary" */
+ hsize_t boundary[H5S_MAX_RANK]; /* The dimension sizes for determining boundary */
+ H5D_append_cb_t func; /* The callback function */
+ void *udata; /* User data */
} H5D_append_flush_t;
diff --git a/src/H5F.c b/src/H5F.c
index 1ee16e1..03be1b1 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -21,20 +21,20 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Aprivate.h" /* Attributes */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5Gprivate.h" /* Groups */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5SMprivate.h" /* Shared Object Header Messages */
-#include "H5Tprivate.h" /* Datatypes */
+#include "H5private.h" /* Generic Functions */
+#include "H5Aprivate.h" /* Attributes */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* File access */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5SMprivate.h" /* Shared Object Header Messages */
+#include "H5Tprivate.h" /* Datatypes */
/****************/
@@ -76,10 +76,10 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* File ID class */
static const H5I_class_t H5I_FILE_CLS[1] = {{
- H5I_FILE, /* ID class value */
- 0, /* Class flags */
- 0, /* # of reserved IDs for class */
- (H5I_free_t)H5F_close /* Callback routine for closing objects of this class */
+ H5I_FILE, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5F_close /* Callback routine for closing objects of this class */
}};
@@ -113,27 +113,22 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_term_package
+ * Function: H5F_term_package
*
- * Purpose: Terminate this interface: free all memory and reset global
- * variables to their initial values. Release all ID groups
- * associated with this interface.
- *
- * Return: Success: Positive if anything was done that might
- * have affected other interfaces; zero
- * otherwise.
- *
- * Failure: Never fails.
- *
- * Programmer: Robb Matzke
- * Friday, February 19, 1999
+ * Purpose: Terminate this interface: free all memory and reset global
+ * variables to their initial values. Release all ID groups
+ * associated with this interface.
*
+ * Return: Success: Positive if anything was done that might
+ * have affected other interfaces;
+ * zero otherwise.
+ * Failure: Never fails.
*-------------------------------------------------------------------------
*/
int
H5F_term_package(void)
{
- int n = 0;
+ int n = 0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -141,7 +136,7 @@ H5F_term_package(void)
if(H5I_nmembers(H5I_FILE) > 0) {
(void)H5I_clear_type(H5I_FILE, FALSE, FALSE);
n++; /*H5I*/
- } /* end if */
+ } /* end if */
else {
/* Make certain we've cleaned up all the shared file objects */
H5F_sfile_assert_num(0);
@@ -160,18 +155,14 @@ H5F_term_package(void)
/*-------------------------------------------------------------------------
- * Function: H5Fget_create_plist
- *
- * Purpose: Get an atom for a copy of the file-creation property list for
- * this file. This function returns an atom with a copy of the
- * properties used to create a file.
- *
- * Return: Success: template ID
+ * Function: H5Fget_create_plist
*
- * Failure: FAIL
- *
- * Programmer: Unknown
+ * Purpose: Get an atom for a copy of the file-creation property list for
+ * this file. This function returns an atom with a copy of the
+ * properties used to create a file.
*
+ * Return: Success: template ID
+ * Failure: FAIL
*-------------------------------------------------------------------------
*/
hid_t
@@ -200,24 +191,19 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fget_access_plist
+ * Function: H5Fget_access_plist
*
- * Purpose: Returns a copy of the file access property list of the
- * specified file.
+ * Purpose: Returns a copy of the file access property list of the
+ * specified file.
*
* NOTE: Make sure that, if you are going to overwrite
* information in the copied property list that was
* previously opened and assigned to the property list, then
* you must close it before overwriting the values.
*
- * Return: Success: Object ID for a copy of the file access
- * property list.
- *
- * Failure: FAIL
- *
- * Programmer: Robb Matzke
- * Wednesday, February 18, 1998
- *
+ * Return: Success: Object ID for a copy of the file access
+ * property list.
+ * Failure: FAIL
*-------------------------------------------------------------------------
*/
hid_t
@@ -243,23 +229,19 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fget_obj_count
- *
- * Purpose: Public function returning the number of opened object IDs
- * (files, datasets, groups and datatypes) in the same file.
- *
- * Return: Non-negative on success; negative on failure.
+ * Function: H5Fget_obj_count
*
- * Programmer: Raymond Lu
- * Wednesday, Dec 5, 2001
+ * Purpose: Public function returning the number of opened object IDs
+ * (files, datasets, groups and datatypes) in the same file.
*
+ * Return: Non-negative on success; negative on failure.
*-------------------------------------------------------------------------
*/
ssize_t
H5Fget_obj_count(hid_t file_id, unsigned types)
{
H5F_t *f = NULL; /* File to query */
- size_t obj_count = 0; /* Number of opened objects */
+ size_t obj_count = 0; /* Number of opened objects */
ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -284,21 +266,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fget_object_ids
+ * Function: H5Fget_object_ids
*
- * Purpose: Public function to return a list of opened object IDs.
- *
- * Return: Non-negative on success; negative on failure.
- *
- * Programmer: Raymond Lu
- * Wednesday, Dec 5, 2001
- *
- * Modification:
- * Raymond Lu
- * 24 September 2008
- * Changed the return value to ssize_t and MAX_OBJTS to size_t to
- * accommadate potential large number of objects.
+ * Purpose: Public function to return a list of opened object IDs.
*
+ * Return: Non-negative on success; negative on failure.
*-------------------------------------------------------------------------
*/
ssize_t
@@ -339,10 +311,6 @@ done:
*
* Return: Success: non-negative value.
* Failure: negative.
- *
- * Programmer: Raymond Lu
- * Sep. 16, 2002
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -372,23 +340,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fis_hdf5
- *
- * Purpose: Check the file signature to detect an HDF5 file.
+ * Function: H5Fis_hdf5
*
- * Bugs: This function is not robust: it only uses the default file
- * driver when attempting to open the file when in fact it
- * should use all known file drivers.
+ * Purpose: Check the file signature to detect an HDF5 file.
*
- * Return: Success: TRUE/FALSE
+ * Bugs: This function is not robust: it only uses the default file
+ * driver when attempting to open the file when in fact it
+ * should use all known file drivers.
*
- * Failure: Negative
- *
- * Programmer: Unknown
- *
- * Modifications:
- * Robb Matzke, 1999-08-02
- * Rewritten to use the virtual file layer.
+ * Return: Success: TRUE/FALSE
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
htri_t
@@ -414,40 +375,34 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fcreate
- *
- * Purpose: This is the primary function for creating HDF5 files . The
- * flags parameter determines whether an existing file will be
- * overwritten or not. All newly created files are opened for
- * both reading and writing. All flags may be combined with the
- * bit-wise OR operator (`|') to change the behavior of the file
- * create call.
- *
- * The more complex behaviors of a file's creation and access
- * are controlled through the file-creation and file-access
- * property lists. The value of H5P_DEFAULT for a template
- * value indicates that the library should use the default
- * values for the appropriate template.
- *
- * See also: H5Fpublic.h for the list of supported flags. H5Ppublic.h for
- * the list of file creation and file access properties.
- *
- * Return: Success: A file ID
- *
- * Failure: FAIL
- *
- * Programmer: Unknown
- *
+ * Function: H5Fcreate
+ *
+ * Purpose: This is the primary function for creating HDF5 files . The
+ * flags parameter determines whether an existing file will be
+ * overwritten or not. All newly created files are opened for
+ * both reading and writing. All flags may be combined with the
+ * bit-wise OR operator (`|') to change the behavior of the file
+ * create call.
+ *
+ * The more complex behaviors of a file's creation and access
+ * are controlled through the file-creation and file-access
+ * property lists. The value of H5P_DEFAULT for a template
+ * value indicates that the library should use the default
+ * values for the appropriate template.
+ *
+ * See also: H5Fpublic.h for the list of supported flags. H5Ppublic.h for
+ * the list of file creation and file access properties.
+ *
+ * Return: Success: A file ID
+ * Failure: FAIL
*-------------------------------------------------------------------------
*/
hid_t
H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
{
- hbool_t ci_load = FALSE; /* whether MDC ci load requested */
- hbool_t ci_write = FALSE; /* whether MDC CI write requested */
- H5F_t *new_file = NULL; /*file struct for new file */
- hid_t dxpl_id = H5AC_ind_read_dxpl_id; /*dxpl used by library */
- hid_t ret_value; /*return value */
+ H5F_t *new_file = NULL; /*file struct for new file */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /*dxpl used by library */
+ hid_t ret_value; /*return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("i", "*sIuii", filename, flags, fcpl_id, fapl_id);
@@ -481,7 +436,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
* reading and writing.
*/
if (0==(flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC)))
- flags |= H5F_ACC_EXCL; /*default*/
+ flags |= H5F_ACC_EXCL; /*default*/
flags |= H5F_ACC_RDWR | H5F_ACC_CREAT;
/*
@@ -490,12 +445,6 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
if(NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id, dxpl_id)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file")
- /* Check to see if both SWMR and cache image are requested. Fail if so */
- if(H5C_cache_image_status(new_file, &ci_load, &ci_write) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MDC cache image status")
- if((ci_load || ci_write) && (flags & (H5F_ACC_SWMR_READ | H5F_ACC_SWMR_WRITE)))
- HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, FAIL, "can't have both SWMR and cache image")
-
/* Get an atom for the file */
if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file")
@@ -512,53 +461,48 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fopen
+ * Function: H5Fopen
*
- * Purpose: This is the primary function for accessing existing HDF5
- * files. The FLAGS argument determines whether writing to an
- * existing file will be allowed or not. All flags may be
- * combined with the bit-wise OR operator (`|') to change the
- * behavior of the file open call. The more complex behaviors
- * of a file's access are controlled through the file-access
- * property list.
+ * Purpose: This is the primary function for accessing existing HDF5
+ * files. The FLAGS argument determines whether writing to an
+ * existing file will be allowed or not. All flags may be
+ * combined with the bit-wise OR operator (`|') to change the
+ * behavior of the file open call. The more complex behaviors
+ * of a file's access are controlled through the file-access
+ * property list.
*
- * See Also: H5Fpublic.h for a list of possible values for FLAGS.
+ * See Also: H5Fpublic.h for a list of possible values for FLAGS.
*
- * Return: Success: A file ID
- *
- * Failure: FAIL
- *
- * Programmer: Unknown
+ * Return: Success: A file ID
+ * Failure: FAIL
*
* Modifications:
- * Robb Matzke, 1997-07-18
- * File struct creation and destruction is through H5F_new() and
- * H5F__dest(). Reading the root symbol table entry is done with
- * H5G_decode().
- *
- * Robb Matzke, 1997-09-23
- * Most of the work is now done by H5F_open() since H5Fcreate()
- * and H5Fopen() originally contained almost identical code.
- *
- * Robb Matzke, 1998-02-18
- * Added better error checking for the flags and the file access
- * property list. It used to be possible to make the library
- * dump core by passing an object ID that was not a file access
- * property list.
- *
- * Robb Matzke, 1999-08-02
- * The file access property list is passed to the H5F_open() as
- * object IDs.
+ * Robb Matzke, 1997-07-18
+ * File struct creation and destruction is through H5F_new() and
+ * H5F__dest(). Reading the root symbol table entry is done with
+ * H5G_decode().
+ *
+ * Robb Matzke, 1997-09-23
+ * Most of the work is now done by H5F_open() since H5Fcreate()
+ * and H5Fopen() originally contained almost identical code.
+ *
+ * Robb Matzke, 1998-02-18
+ * Added better error checking for the flags and the file access
+ * property list. It used to be possible to make the library
+ * dump core by passing an object ID that was not a file access
+ * property list.
+ *
+ * Robb Matzke, 1999-08-02
+ * The file access property list is passed to the H5F_open() as
+ * object IDs.
*-------------------------------------------------------------------------
*/
hid_t
H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
{
- hbool_t ci_load = FALSE; /* whether MDC ci load requested */
- hbool_t ci_write = FALSE; /* whether MDC CI write requested */
- H5F_t *new_file = NULL; /*file struct for new file */
- hid_t dxpl_id = H5AC_ind_read_dxpl_id; /*dxpl used by library */
- hid_t ret_value; /*return value */
+ H5F_t *new_file = NULL; /* file struct for new file */
+ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /* dxpl used by library */
+ hid_t ret_value; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("i", "*sIui", filename, flags, fapl_id);
@@ -585,12 +529,6 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open file")
- /* Check to see if both SWMR and cache image are requested. Fail if so */
- if(H5C_cache_image_status(new_file, &ci_load, &ci_write) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MDC cache image status")
- if((ci_load || ci_write) && (flags & (H5F_ACC_SWMR_READ | H5F_ACC_SWMR_WRITE)))
- HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, FAIL, "can't have both SWMR and cache image")
-
/* Get an atom for the file */
if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle")
@@ -607,25 +545,21 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fflush
- *
- * Purpose: Flushes all outstanding buffers of a file to disk but does
- * not remove them from the cache. The OBJECT_ID can be a file,
- * dataset, group, attribute, or named data type.
- *
- * Return: Non-negative on success/Negative on failure
+ * Function: H5Fflush
*
- * Programmer: Robb Matzke
- * Thursday, August 6, 1998
+ * Purpose: Flushes all outstanding buffers of a file to disk but does
+ * not remove them from the cache. The OBJECT_ID can be a file,
+ * dataset, group, attribute, or named data type.
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
H5Fflush(hid_t object_id, H5F_scope_t scope)
{
- H5F_t *f = NULL; /* File to flush */
- H5O_loc_t *oloc = NULL; /* Object location for ID */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t *f = NULL; /* File to flush */
+ H5O_loc_t *oloc = NULL; /* Object location for ID */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iFs", object_id, scope);
@@ -638,7 +572,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope)
case H5I_GROUP:
{
- H5G_t *grp;
+ H5G_t *grp;
if(NULL == (grp = (H5G_t *)H5I_object(object_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid group identifier")
@@ -648,7 +582,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope)
case H5I_DATATYPE:
{
- H5T_t *type;
+ H5T_t *type;
if(NULL == (type = (H5T_t *)H5I_object(object_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid type identifier")
@@ -658,7 +592,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope)
case H5I_DATASET:
{
- H5D_t *dset;
+ H5D_t *dset;
if(NULL == (dset = (H5D_t *)H5I_object(object_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
@@ -668,7 +602,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope)
case H5I_ATTR:
{
- H5A_t *attr;
+ H5A_t *attr;
if(NULL == (attr = (H5A_t *)H5I_object(object_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid attribute identifier")
@@ -701,7 +635,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope)
/* Flush the file */
/*
- * Nothing to do if the file is read only. This determination is
+ * Nothing to do if the file is read only. This determination is
* made at the shared open(2) flags level, implying that opening a
* file twice, once for read-only and once for read-write, and then
* calling H5Fflush() with the read-only handle, still causes data
@@ -727,24 +661,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fclose
- *
- * Purpose: This function closes the file specified by FILE_ID by
- * flushing all data to storage, and terminating access to the
- * file through FILE_ID. If objects (e.g., datasets, groups,
- * etc.) are open in the file then the underlying storage is not
- * closed until those objects are closed; however, all data for
- * the file and the open objects is flushed.
- *
- * Return: Success: Non-negative
+ * Function: H5Fclose
*
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Saturday, February 20, 1999
- *
- * Modifications:
+ * Purpose: This function closes the file specified by FILE_ID by
+ * flushing all data to storage, and terminating access to the
+ * file through FILE_ID. If objects (e.g., datasets, groups,
+ * etc.) are open in the file then the underlying storage is not
+ * closed until those objects are closed; however, all data for
+ * the file and the open objects is flushed.
*
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -752,7 +679,7 @@ H5Fclose(hid_t file_id)
{
H5F_t *f = NULL;
int nref;
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
@@ -788,29 +715,24 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Freopen
+ * Function: H5Freopen
*
- * Purpose: Reopen a file. The new file handle which is returned points
- * to the same file as the specified file handle. Both handles
- * share caches and other information. The only difference
- * between the handles is that the new handle is not mounted
- * anywhere and no files are mounted on it.
- *
- * Return: Success: New file ID
- *
- * Failure: FAIL
- *
- * Programmer: Robb Matzke
- * Friday, October 16, 1998
+ * Purpose: Reopen a file. The new file handle which is returned points
+ * to the same file as the specified file handle. Both handles
+ * share caches and other information. The only difference
+ * between the handles is that the new handle is not mounted
+ * anywhere and no files are mounted on it.
*
+ * Return: Success: New file ID
+ * Failure: FAIL
*-------------------------------------------------------------------------
*/
hid_t
H5Freopen(hid_t file_id)
{
- H5F_t *old_file = NULL;
- H5F_t *new_file = NULL;
- hid_t ret_value;
+ H5F_t *old_file = NULL;
+ H5F_t *new_file = NULL;
+ hid_t ret_value;
FUNC_ENTER_API(FAIL)
H5TRACE1("i", "i", file_id);
@@ -844,16 +766,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fget_intent
- *
- * Purpose: Public API to retrieve the file's 'intent' flags passed
- * during H5Fopen()
- *
- * Return: Non-negative on success/negative on failure
+ * Function: H5Fget_intent
*
- * Programmer: James Laird
- * August 23, 2006
+ * Purpose: Public API to retrieve the file's 'intent' flags passed
+ * during H5Fopen()
*
+ * Return: Non-negative on success/negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -866,7 +784,7 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags)
/* If no intent flags were passed in, exit quietly */
if(intent_flags) {
- H5F_t * file; /* Pointer to file structure */
+ H5F_t *file; /* Pointer to file structure */
/* Get the internal file structure */
if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
@@ -904,18 +822,13 @@ done:
*
* Return: Success: Amount of free space for type
* Failure: Negative
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Oct 6, 2003
- *
*-------------------------------------------------------------------------
*/
hssize_t
H5Fget_freespace(hid_t file_id)
{
H5F_t *file; /* File object for file ID */
- hsize_t tot_space; /* Amount of free space in the file */
+ hsize_t tot_space; /* Amount of free space in the file */
hssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -941,15 +854,10 @@ done:
*
* Purpose: Retrieves the file size of the HDF5 file. This function
* is called after an existing file is opened in order
- * to learn the true size of the underlying file.
+ * to learn the true size of the underlying file.
*
* Return: Success: Non-negative
* Failure: Negative
- *
- * Programmer: David Pitt
- * david.pitt@bigpond.com
- * Apr 27, 2004
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -988,42 +896,38 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Fget_file_image
*
- * Purpose: If a buffer is provided (via the buf_ptr argument) and is
- * big enough (size in buf_len argument), load *buf_ptr with
- * an image of the open file whose ID is provided in the
- * file_id parameter, and return the number of bytes copied
- * to the buffer.
+ * Purpose: If a buffer is provided (via the buf_ptr argument) and is
+ * big enough (size in buf_len argument), load *buf_ptr with
+ * an image of the open file whose ID is provided in the
+ * file_id parameter, and return the number of bytes copied
+ * to the buffer.
*
- * If the buffer exists, but is too small to contain an image
- * of the indicated file, return a negative number.
+ * If the buffer exists, but is too small to contain an image
+ * of the indicated file, return a negative number.
*
- * Finally, if no buffer is provided, return the size of the
- * buffer needed. This value is simply the eoa of the target
- * file.
+ * Finally, if no buffer is provided, return the size of the
+ * buffer needed. This value is simply the eoa of the target
+ * file.
*
- * Note that any user block is skipped.
+ * Note that any user block is skipped.
*
- * Also note that the function may not be used on files
- * opened with either the split/multi file driver or the
- * family file driver.
+ * Also note that the function may not be used on files
+ * opened with either the split/multi file driver or the
+ * family file driver.
*
- * In the former case, the sparse address space makes the
- * get file image operation impractical, due to the size of
- * the image typically required.
+ * In the former case, the sparse address space makes the
+ * get file image operation impractical, due to the size of
+ * the image typically required.
*
- * In the case of the family file driver, the problem is
- * the driver message in the super block, which will prevent
- * the image being opened with any driver other than the
- * family file driver -- which negates the purpose of the
- * operation. This can be fixed, but no resources for
- * this now.
+ * In the case of the family file driver, the problem is
+ * the driver message in the super block, which will prevent
+ * the image being opened with any driver other than the
+ * family file driver -- which negates the purpose of the
+ * operation. This can be fixed, but no resources for
+ * this now.
*
* Return: Success: Bytes copied / number of bytes needed.
* Failure: negative value
- *
- * Programmer: John Mainzer
- * 11/15/11
- *
*-------------------------------------------------------------------------
*/
ssize_t
@@ -1049,21 +953,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fget_mdc_config
+ * Function: H5Fget_mdc_config
*
- * Purpose: Retrieves the current automatic cache resize configuration
- * from the metadata cache, and return it in *config_ptr.
+ * Purpose: Retrieves the current automatic cache resize configuration
+ * from the metadata cache, and return it in *config_ptr.
*
- * Note that the version field of *config_Ptr must be correctly
- * filled in by the caller. This allows us to adapt for
- * obsolete versions of the structure.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: John Mainzer
- * 3/24/05
+ * Note that the version field of *config_Ptr must be correctly
+ * filled in by the caller. This allows us to adapt for
+ * obsolete versions of the structure.
*
+ * Return: Success: SUCCEED
+ * Failure: FAIL
*-------------------------------------------------------------------------
*/
herr_t
@@ -1094,15 +994,11 @@ done:
* Function: H5Fset_mdc_config
*
* Purpose: Sets the current metadata cache automatic resize
- * configuration, using the contents of the instance of
- * H5AC_cache_config_t pointed to by config_ptr.
+ * configuration, using the contents of the instance of
+ * H5AC_cache_config_t pointed to by config_ptr.
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: John Mainzer
- * 3/24/05
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1131,16 +1027,12 @@ done:
* Function: H5Fget_mdc_hit_rate
*
* Purpose: Retrieves the current hit rate from the metadata cache.
- * This rate is the overall hit rate since the last time
- * the hit rate statistics were reset either manually or
- * automatically.
+ * This rate is the overall hit rate since the last time
+ * the hit rate statistics were reset either manually or
+ * automatically.
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: John Mainzer
- * 3/24/05
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1172,17 +1064,13 @@ done:
* Function: H5Fget_mdc_size
*
* Purpose: Retrieves the maximum size, minimum clean size, current
- * size, and current number of entries from the metadata
- * cache associated with the specified file. If any of
- * the ptr parameters are NULL, the associated datum is
- * not returned.
+ * size, and current number of entries from the metadata
+ * cache associated with the specified file. If any of
+ * the ptr parameters are NULL, the associated datum is
+ * not returned.
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: John Mainzer
- * 3/24/05
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1218,20 +1106,16 @@ done:
* Function: H5Freset_mdc_hit_rate_stats
*
* Purpose: Reset the hit rate statistic whose current value can
- * be obtained via the H5Fget_mdc_hit_rate() call. Note
- * that this statistic will also be reset once per epoch
- * by the automatic cache resize code if it is enabled.
+ * be obtained via the H5Fget_mdc_hit_rate() call. Note
+ * that this statistic will also be reset once per epoch
+ * by the automatic cache resize code if it is enabled.
*
- * It is probably a bad idea to call this function unless
- * you are controlling cache size from your program instead
- * of using our cache size control code.
+ * It is probably a bad idea to call this function unless
+ * you are controlling cache size from your program instead
+ * of using our cache size control code.
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: John Mainzer
- * 3/24/05
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1267,15 +1151,11 @@ done:
* If an error occurs then the buffer pointed to by `name' (NULL or non-NULL)
* is unchanged and the function returns a negative value.
*
- * Note: This routine returns the name that was used to open the file,
- * not the actual name after resolving symlinks, etc.
+ * Note: This routine returns the name that was used to open the file,
+ * not the actual name after resolving symlinks, etc.
*
* Return: Success: The length of the file name
* Failure: Negative
- *
- * Programmer: Raymond Lu
- * June 29, 2004
- *
*-------------------------------------------------------------------------
*/
ssize_t
@@ -1325,17 +1205,13 @@ done:
* Function: H5Fget_info2
*
* Purpose: Gets general information about the file, including:
- * 1. Get storage size for superblock extension if there is one.
+ * 1. Get storage size for superblock extension if there is one.
* 2. Get the amount of btree and heap storage for entries
* in the SOHM table if there is one.
- * 3. The amount of free space tracked in the file.
+ * 3. The amount of free space tracked in the file.
*
* Return: Success: non-negative on success
* Failure: Negative
- *
- * Programmer: Vailin Choi
- * July 11, 2007
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1402,18 +1278,15 @@ done:
*
* Return: Success: non-negative on success
* Failure: Negative
- *
- * Programmer: Vailin Choi; October 2013
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info)
{
- H5F_t *file; /* File object for file ID */
- unsigned i, j; /* Local index variable */
- size_t tot_size; /* Size of each retries[i] */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t *file; /* File object for file ID */
+ unsigned i, j; /* Local index variable */
+ size_t tot_size; /* Size of each retries[i] */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*x", file_id, info);
@@ -1433,8 +1306,8 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info)
HDmemset(info->retries, 0, sizeof(info->retries));
/* Return if there are no bins -- no retries */
- if(!info->nbins)
- HGOTO_DONE(SUCCEED);
+ if(!info->nbins)
+ HGOTO_DONE(SUCCEED);
/* Calculate size for each retries[i] */
tot_size = info->nbins * sizeof(uint32_t);
@@ -1493,18 +1366,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fget_free_sections
- *
- * Purpose: To get free-space section information for free-space manager with
- * TYPE that is associated with file FILE_ID.
- * If SECT_INFO is null, this routine returns the total # of free-space
- * sections.
- *
- * Return: Success: non-negative, the total # of free space sections
- * Failure: negative
+ * Function: H5Fget_free_sections
*
- * Programmer: Vailin Choi; July 1st, 2009
+ * Purpose: To get free-space section information for free-space manager with
+ * TYPE that is associated with file FILE_ID.
+ * If SECT_INFO is null, this routine returns the total # of free-space
+ * sections.
*
+ * Return: Success: non-negative, the total # of free space sections
+ * Failure: negative
*-------------------------------------------------------------------------
*/
ssize_t
@@ -1541,9 +1411,6 @@ done:
*
* Return: Success: non-negative
* Failure: negative
- *
- * Programmer: Neil Fortner; December 30, 2010
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1570,37 +1437,33 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fstart_swmr_write
- *
- * Purpose: To enable SWMR writing mode for the file
- * 1) Refresh opened objects: part 1
- * 2) Flush & reset accumulator
- * 3) Mark the file in SWMR writing mode
- * 4) Set metadata read attempts and retries info
- * 5) Disable accumulator
- * 6) Evict all cache entries except the superblock
- * 7) Refresh opened objects (part 2)
- * 8) Unlock the file
- *
- * Pre-conditions:
- * 1) The file being opened has v3 superblock
- * 2) The file is opened with H5F_ACC_RDWR
- * 3) The file is not already marked for SWMR writing
- * 4) Current implementaion for opened objects:
- * --only allow datasets and groups without attributes
- * --disallow named datatype with/without attributes
- * --disallow opened attributes attached to objects
- * NOTE: Currently, only opened groups and datasets are allowed
- * when enabling SWMR via H5Fstart_swmr_write().
- * Will later implement a different approach--
- * set up flush dependency/proxy even for file opened without
- * SWMR to resolve issues with opened objects.
- *
- * Return: Non-negative on success/negative on failure
- *
- * Programmer:
- * Vailin Choi; Feb 2014
- *
+ * Function: H5Fstart_swmr_write
+ *
+ * Purpose: To enable SWMR writing mode for the file
+ * 1) Refresh opened objects: part 1
+ * 2) Flush & reset accumulator
+ * 3) Mark the file in SWMR writing mode
+ * 4) Set metadata read attempts and retries info
+ * 5) Disable accumulator
+ * 6) Evict all cache entries except the superblock
+ * 7) Refresh opened objects (part 2)
+ * 8) Unlock the file
+ *
+ * Pre-conditions:
+ * 1) The file being opened has v3 superblock
+ * 2) The file is opened with H5F_ACC_RDWR
+ * 3) The file is not already marked for SWMR writing
+ * 4) Current implementaion for opened objects:
+ * --only allow datasets and groups without attributes
+ * --disallow named datatype with/without attributes
+ * --disallow opened attributes attached to objects
+ * NOTE: Currently, only opened groups and datasets are allowed
+ * when enabling SWMR via H5Fstart_swmr_write().
+ * Will later implement a different approach--
+ * set up flush dependency/proxy even for file opened without
+ * SWMR to resolve issues with opened objects.
+ *
+ * Return: Non-negative on success/negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -1609,16 +1472,16 @@ H5Fstart_swmr_write(hid_t file_id)
hbool_t ci_load = FALSE; /* whether MDC ci load requested */
hbool_t ci_write = FALSE; /* whether MDC CI write requested */
H5F_t *file = NULL; /* File info */
- size_t grp_dset_count=0; /* # of open objects: groups & datasets */
- size_t nt_attr_count=0; /* # of opened named datatypes + opened attributes */
- hid_t *obj_ids=NULL; /* List of ids */
- H5G_loc_t *obj_glocs=NULL; /* Group location of the object */
- H5O_loc_t *obj_olocs=NULL; /* Object location */
- H5G_name_t *obj_paths=NULL; /* Group hierarchy path */
- size_t u; /* Local index variable */
- hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */
+ size_t grp_dset_count=0; /* # of open objects: groups & datasets */
+ size_t nt_attr_count=0; /* # of opened named datatypes + opened attributes */
+ hid_t *obj_ids=NULL; /* List of ids */
+ H5G_loc_t *obj_glocs=NULL; /* Group location of the object */
+ H5O_loc_t *obj_olocs=NULL; /* Object location */
+ H5G_name_t *obj_paths=NULL; /* Group hierarchy path */
+ size_t u; /* Local index variable */
+ hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */
H5F_io_info2_t fio_info; /* I/O info for operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
@@ -1648,7 +1511,7 @@ H5Fstart_swmr_write(hid_t file_id)
/* Flush the superblock extension */
if(H5F_flush_tagged_metadata(file, file->shared->sblock->ext_addr, H5AC_ind_read_dxpl_id) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, NULL, "unable to flush superblock extension")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush superblock extension")
/* Flush data buffers */
if(H5F__flush(file, H5AC_ind_read_dxpl_id, H5AC_rawdata_dxpl_id, FALSE) < 0)
@@ -1666,18 +1529,18 @@ H5Fstart_swmr_write(hid_t file_id)
if(grp_dset_count) {
/* Allocate space for group and object locations */
- if((obj_ids = (hid_t *) H5MM_malloc(grp_dset_count * sizeof(hid_t))) == NULL)
- HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for hid_t")
- if((obj_glocs = (H5G_loc_t *) H5MM_malloc(grp_dset_count * sizeof(H5G_loc_t))) == NULL)
- HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for H5G_loc_t")
- if((obj_olocs = (H5O_loc_t *) H5MM_malloc(grp_dset_count * sizeof(H5O_loc_t))) == NULL)
- HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for H5O_loc_t")
- if((obj_paths = (H5G_name_t *) H5MM_malloc(grp_dset_count * sizeof(H5G_name_t))) == NULL)
- HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for H5G_name_t")
+ if((obj_ids = (hid_t *) H5MM_malloc(grp_dset_count * sizeof(hid_t))) == NULL)
+ HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for hid_t")
+ if((obj_glocs = (H5G_loc_t *) H5MM_malloc(grp_dset_count * sizeof(H5G_loc_t))) == NULL)
+ HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for H5G_loc_t")
+ if((obj_olocs = (H5O_loc_t *) H5MM_malloc(grp_dset_count * sizeof(H5O_loc_t))) == NULL)
+ HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for H5O_loc_t")
+ if((obj_paths = (H5G_name_t *) H5MM_malloc(grp_dset_count * sizeof(H5G_name_t))) == NULL)
+ HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for H5G_name_t")
/* Get the list of opened object ids (groups & datasets) */
- if(H5F_get_obj_ids(file, H5F_OBJ_GROUP|H5F_OBJ_DATASET, grp_dset_count, obj_ids, FALSE, &grp_dset_count) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5F_get_obj_ids failed")
+ if(H5F_get_obj_ids(file, H5F_OBJ_GROUP|H5F_OBJ_DATASET, grp_dset_count, obj_ids, FALSE, &grp_dset_count) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5F_get_obj_ids failed")
/* Refresh opened objects (groups, datasets) in the file */
for(u = 0; u < grp_dset_count; u++) {
@@ -1805,14 +1668,13 @@ done:
* - Logging must have been set up via the fapl.
*
* Return: Non-negative on success/Negative on errors
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Fstart_mdc_logging(hid_t file_id)
{
- H5F_t *file; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t *file; /* File info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
@@ -1838,14 +1700,13 @@ done:
* - Logging must have been set up via the fapl.
*
* Return: Non-negative on success/Negative on errors
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Fstop_mdc_logging(hid_t file_id)
{
- H5F_t *file; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t *file; /* File info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
@@ -1871,15 +1732,14 @@ done:
* log messages are being recorded at this time.
*
* Return: Non-negative on success/Negative on errors
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled,
hbool_t *is_currently_logging)
{
- H5F_t *file; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t *file; /* File info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*b*b", file_id, is_enabled, is_currently_logging);
@@ -1903,9 +1763,6 @@ done:
* Purpose: Set .... the "latest format" flag while a file is open.
*
* Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Monday, September 21, 2015
*-------------------------------------------------------------------------
*/
herr_t
@@ -1934,17 +1791,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fformat_convert_super (Internal)
+ * Function: H5Fformat_convert_super (Internal)
*
- * Purpose: Downgrade the superblock version to v2 and
- * downgrade persistent file space to non-persistent
- * for 1.8 library.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Vailin Choi
- * Jan 2016
+ * Purpose: Downgrade the superblock version to v2 and
+ * downgrade persistent file space to non-persistent
+ * for 1.8 library.
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -1956,8 +1809,8 @@ H5Fformat_convert(hid_t fid)
H5TRACE1("e", "i", fid);
if(H5I_FILE == H5I_get_type(fid)) {
- H5F_t *f; /* File to flush */
- hbool_t mark_dirty = FALSE;
+ H5F_t *f; /* File to flush */
+ hbool_t mark_dirty = FALSE;
/* Get file object */
if(NULL == (f = (H5F_t *)H5I_object(fid)))
@@ -1971,9 +1824,9 @@ H5Fformat_convert(hid_t fid)
/* Check for persistent freespace manager, which needs to be downgraded */
if(!(f->shared->fs_strategy == H5F_FILE_SPACE_STRATEGY_DEF &&
- f->shared->fs_persist == H5F_FREE_SPACE_PERSIST_DEF &&
- f->shared->fs_threshold == H5F_FREE_SPACE_THRESHOLD_DEF &&
- f->shared->fs_page_size == H5F_FILE_SPACE_PAGE_SIZE_DEF)) {
+ f->shared->fs_persist == H5F_FREE_SPACE_PERSIST_DEF &&
+ f->shared->fs_threshold == H5F_FREE_SPACE_THRESHOLD_DEF &&
+ f->shared->fs_page_size == H5F_FILE_SPACE_PAGE_SIZE_DEF)) {
/* Check to remove free-space manager info message from superblock extension */
if(H5F_addr_defined(f->shared->sblock->ext_addr))
if(H5F_super_ext_remove_msg(f, H5AC_ind_read_dxpl_id, H5O_FSINFO_ID) < 0)
@@ -2014,9 +1867,6 @@ done:
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: Mohamad Chaarawi
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2050,9 +1900,6 @@ done:
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: Mohamad Chaarawi
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2094,9 +1941,6 @@ done:
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: Vailin Choi; March 2017
- *
*-------------------------------------------------------------------------
*/
herr_t
diff --git a/src/H5FSint.c b/src/H5FSint.c
index 4297291..264950d 100644
--- a/src/H5FSint.c
+++ b/src/H5FSint.c
@@ -96,10 +96,9 @@ H5FS_init(void)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI_NOERR
/* FUNC_ENTER() does all the work */
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FS_init() */
diff --git a/src/H5Fint.c b/src/H5Fint.c
index d145462..cf52288 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -21,20 +21,20 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Aprivate.h" /* Attributes */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5Gprivate.h" /* Groups */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5SMprivate.h" /* Shared Object Header Messages */
-#include "H5Tprivate.h" /* Datatypes */
+#include "H5private.h" /* Generic Functions */
+#include "H5Aprivate.h" /* Attributes */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* File access */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5SMprivate.h" /* Shared Object Header Messages */
+#include "H5Tprivate.h" /* Datatypes */
/****************/
@@ -100,26 +100,19 @@ H5FL_DEFINE(H5F_file_t);
/*-------------------------------------------------------------------------
- * Function: H5F_get_access_plist
+ * Function: H5F_get_access_plist
*
- * Purpose: Returns a copy of the file access property list of the
- * specified file.
+ * Purpose: Returns a copy of the file access property list of the
+ * specified file.
*
* NOTE: Make sure that, if you are going to overwrite
* information in the copied property list that was
* previously opened and assigned to the property list, then
* you must close it before overwriting the values.
*
- * Return: Success: Object ID for a copy of the file access
- * property list.
- *
- * Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * Wednesday, May 25, 2005
- *
- * Modifications:
- *
+ * Return: Success: Object ID for a copy of the file access
+ * property list.
+ * Failure: FAIL
*-------------------------------------------------------------------------
*/
hid_t
@@ -129,8 +122,9 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
H5P_genplist_t *old_plist; /* Old property list */
H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */
hbool_t driver_prop_copied = FALSE; /* Whether the driver property has been set up */
- unsigned efc_size = 0;
- hid_t ret_value = SUCCEED; /* Return value */
+ unsigned efc_size = 0;
+ hbool_t latest_format = FALSE; /* Always use the latest format? */
+ hid_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -141,7 +135,7 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
if((ret_value = H5P_copy_plist(old_plist, app_ref)) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy file access property list")
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy file access property list")
if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(ret_value)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
@@ -221,16 +215,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_get_obj_count
+ * Function: H5F_get_obj_count
*
- * Purpose: Private function return the number of opened object IDs
- * (files, datasets, groups, datatypes) in the same file.
+ * Purpose: Private function return the number of opened object IDs
+ * (files, datasets, groups, datatypes) in the same file.
*
* Return: SUCCEED on success, FAIL on failure.
- *
- * Programmer: Raymond Lu
- * Wednesday, Dec 5, 2001
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -258,10 +248,6 @@ done:
* Purpose: Private function to return a list of opened object IDs.
*
* Return: Non-negative on success; can't fail.
- *
- * Programmer: Raymond Lu
- * Wednesday, Dec 5, 2001
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -284,16 +270,13 @@ done:
/*---------------------------------------------------------------------------
- * Function: H5F_get_objects
+ * Function: H5F_get_objects
*
- * Purpose: This function is called by H5F_get_obj_count or
- * H5F_get_obj_ids to get number of object IDs and/or a
- * list of opened object IDs (in return value).
- * Return: Non-negative on success; Can't fail.
- *
- * Programmer: Raymond Lu
- * Wednesday, Dec 5, 2001
+ * Purpose: This function is called by H5F_get_obj_count or
+ * H5F_get_obj_ids to get number of object IDs and/or a
+ * list of opened object IDs (in return value).
*
+ * Return: Non-negative on success; Can't fail.
*---------------------------------------------------------------------------
*/
herr_t
@@ -312,7 +295,7 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_
olist.obj_id_list = (max_nobjs==0 ? NULL : obj_id_list);
olist.obj_id_count = &obj_id_count;
olist.list_index = 0;
- olist.max_nobjs = max_nobjs;
+ olist.max_nobjs = max_nobjs;
/* Determine if we are searching for local or global objects */
if(types & H5F_OBJ_LOCAL) {
@@ -336,37 +319,37 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_
* or the caller wants to get the list of IDs and the list isn't full,
* search through dataset IDs to count number of datasets, and put their
* IDs on the object list */
- if(!olist.max_nobjs || (olist.max_nobjs && olist.list_index<olist.max_nobjs)) {
+ if(!olist.max_nobjs || (olist.max_nobjs && olist.list_index<olist.max_nobjs)) {
if (types & H5F_OBJ_DATASET) {
olist.obj_type = H5I_DATASET;
if(H5I_iterate(H5I_DATASET, H5F_get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(2)")
} /* end if */
- }
+ }
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
* search through group IDs to count number of groups, and put their
* IDs on the object list */
- if(!olist.max_nobjs || (olist.max_nobjs && olist.list_index<olist.max_nobjs)) {
+ if(!olist.max_nobjs || (olist.max_nobjs && olist.list_index<olist.max_nobjs)) {
if(types & H5F_OBJ_GROUP) {
olist.obj_type = H5I_GROUP;
if(H5I_iterate(H5I_GROUP, H5F_get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(3)")
} /* end if */
- }
+ }
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
* search through datatype IDs to count number of named datatypes, and put their
* IDs on the object list */
- if(!olist.max_nobjs || (olist.max_nobjs && olist.list_index<olist.max_nobjs)) {
+ if(!olist.max_nobjs || (olist.max_nobjs && olist.list_index<olist.max_nobjs)) {
if(types & H5F_OBJ_DATATYPE) {
olist.obj_type = H5I_DATATYPE;
if(H5I_iterate(H5I_DATATYPE, H5F_get_objects_cb, &olist, app_ref) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(4)")
} /* end if */
- }
+ }
/* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero),
* or the caller wants to get the list of IDs and the list isn't full,
@@ -379,7 +362,7 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(5)")
} /* end if */
}
-
+
/* Set the number of objects currently open */
*obj_id_count_ptr = obj_id_count;
@@ -389,18 +372,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_get_objects_cb
- *
- * Purpose: H5F_get_objects' callback function. It verifies if an
- * object is in the file, and either count it or put its ID
- * on the list.
+ * Function: H5F_get_objects_cb
*
- * Return: H5_ITER_STOP if the array of object IDs is filled up.
- * H5_ITER_CONT otherwise.
- *
- * Programmer: Raymond Lu
- * Wednesday, Dec 5, 2001
+ * Purpose: H5F_get_objects' callback function. It verifies if an
+ * object is in the file, and either count it or put its ID
+ * on the list.
*
+ * Return: H5_ITER_STOP if the array of object IDs is filled up.
+ * H5_ITER_CONT otherwise.
*-------------------------------------------------------------------------
*/
static int
@@ -418,77 +397,79 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
/* Count file IDs */
if(olist->obj_type == H5I_FILE) {
if((olist->file_info.local &&
- (!olist->file_info.ptr.file || (olist->file_info.ptr.file && (H5F_t*)obj_ptr == olist->file_info.ptr.file) ))
- || (!olist->file_info.local &&
- ( !olist->file_info.ptr.shared || (olist->file_info.ptr.shared && ((H5F_t*)obj_ptr)->shared == olist->file_info.ptr.shared) ))) {
+ (!olist->file_info.ptr.file ||
+ (olist->file_info.ptr.file && (H5F_t*)obj_ptr == olist->file_info.ptr.file))) ||
+ (!olist->file_info.local &&
+ (!olist->file_info.ptr.shared ||
+ (olist->file_info.ptr.shared && ((H5F_t*)obj_ptr)->shared == olist->file_info.ptr.shared)))) {
add_obj = TRUE;
- } /* end if */
+ } /* end if */
} /* end if */
else { /* either count opened object IDs or put the IDs on the list */
H5O_loc_t *oloc; /* Group entry info for object */
- switch(olist->obj_type) {
- case H5I_ATTR:
- oloc = H5A_oloc((H5A_t *)obj_ptr);
- break;
-
- case H5I_GROUP:
- oloc = H5G_oloc((H5G_t *)obj_ptr);
- break;
-
- case H5I_DATASET:
- oloc = H5D_oloc((H5D_t *)obj_ptr);
- break;
-
- case H5I_DATATYPE:
- if(H5T_is_named((H5T_t*)obj_ptr)==TRUE)
- oloc = H5T_oloc((H5T_t*)obj_ptr);
- else
- oloc = NULL;
- break;
-
- case H5I_UNINIT:
- case H5I_BADID:
- case H5I_FILE:
- case H5I_DATASPACE:
- case H5I_REFERENCE:
- case H5I_VFL:
- case H5I_GENPROP_CLS:
- case H5I_GENPROP_LST:
- case H5I_ERROR_CLASS:
- case H5I_ERROR_MSG:
- case H5I_ERROR_STACK:
- case H5I_NTYPES:
+ switch(olist->obj_type) {
+ case H5I_ATTR:
+ oloc = H5A_oloc((H5A_t *)obj_ptr);
+ break;
+
+ case H5I_GROUP:
+ oloc = H5G_oloc((H5G_t *)obj_ptr);
+ break;
+
+ case H5I_DATASET:
+ oloc = H5D_oloc((H5D_t *)obj_ptr);
+ break;
+
+ case H5I_DATATYPE:
+ if(H5T_is_named((H5T_t*)obj_ptr)==TRUE)
+ oloc = H5T_oloc((H5T_t*)obj_ptr);
+ else
+ oloc = NULL;
+ break;
+
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_FILE:
+ case H5I_DATASPACE:
+ case H5I_REFERENCE:
+ case H5I_VFL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_NTYPES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "unknown data object")
- } /* end switch */
+ } /* end switch */
if((olist->file_info.local &&
- ( (!olist->file_info.ptr.file && olist->obj_type == H5I_DATATYPE && H5T_is_immutable((H5T_t *)obj_ptr) == FALSE)
- || (!olist->file_info.ptr.file && olist->obj_type != H5I_DATATYPE)
- || (oloc && oloc->file == olist->file_info.ptr.file)))
- || (!olist->file_info.local &&
- ((!olist->file_info.ptr.shared && olist->obj_type == H5I_DATATYPE && H5T_is_immutable((H5T_t *)obj_ptr) == FALSE)
- || (!olist->file_info.ptr.shared && olist->obj_type != H5I_DATATYPE)
- || (oloc && oloc->file && oloc->file->shared == olist->file_info.ptr.shared)))) {
+ ((!olist->file_info.ptr.file && olist->obj_type == H5I_DATATYPE && H5T_is_immutable((H5T_t *)obj_ptr) == FALSE) ||
+ (!olist->file_info.ptr.file && olist->obj_type != H5I_DATATYPE) ||
+ (oloc && oloc->file == olist->file_info.ptr.file))) ||
+ (!olist->file_info.local &&
+ ((!olist->file_info.ptr.shared && olist->obj_type == H5I_DATATYPE && H5T_is_immutable((H5T_t *)obj_ptr) == FALSE) ||
+ (!olist->file_info.ptr.shared && olist->obj_type != H5I_DATATYPE) ||
+ (oloc && oloc->file && oloc->file->shared == olist->file_info.ptr.shared)))) {
add_obj = TRUE;
- } /* end if */
+ } /* end if */
} /* end else */
if(add_obj) {
/* Add the object's ID to the ID list, if appropriate */
if(olist->obj_id_list) {
olist->obj_id_list[olist->list_index] = obj_id;
- olist->list_index++;
- } /* end if */
+ olist->list_index++;
+ } /* end if */
/* Increment the number of open objects */
- if(olist->obj_id_count)
+ if(olist->obj_id_count)
(*olist->obj_id_count)++;
/* Check if we've filled up the array. Return H5_ITER_STOP only if
* we have filled up the array. Otherwise return H5_ITER_CONT(RET_VALUE is
- * preset to H5_ITER_CONT) because H5I_iterate needs the return value of
+ * preset to H5_ITER_CONT) because H5I_iterate needs the return value of
* H5_ITER_CONT to continue the iteration. */
if(olist->max_nobjs > 0 && olist->list_index >= olist->max_nobjs)
HGOTO_DONE(H5_ITER_STOP) /* Indicate that the iterator should stop */
@@ -500,35 +481,31 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F__is_hdf5
- *
- * Purpose: Check the file signature to detect an HDF5 file.
- *
- * Bugs: This function is not robust: it only uses the default file
- * driver when attempting to open the file when in fact it
- * should use all known file drivers.
- *
- * Return: Success: TRUE/FALSE
+ * Function: H5F__is_hdf5
*
- * Failure: Negative
+ * Purpose: Check the file signature to detect an HDF5 file.
*
- * Programmer: Unknown
+ * Bugs: This function is not robust: it only uses the default file
+ * driver when attempting to open the file when in fact it
+ * should use all known file drivers.
*
+ * Return: Success: TRUE/FALSE
+ * * Failure: Negative
*-------------------------------------------------------------------------
*/
htri_t
H5F__is_hdf5(const char *name, hid_t meta_dxpl_id, hid_t raw_dxpl_id)
{
- H5FD_t *file = NULL; /* Low-level file struct */
- H5FD_io_info_t fdio_info; /* File driver I/O info */
- haddr_t sig_addr; /* Addess of hdf5 file signature */
- htri_t ret_value = FAIL; /* Return value */
+ H5FD_t *file = NULL; /* Low-level file struct */
+ H5FD_io_info_t fdio_info; /* File driver I/O info */
+ haddr_t sig_addr; /* Addess of hdf5 file signature */
+ htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Open the file at the virtual file layer */
if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, H5P_FILE_ACCESS_DEFAULT, HADDR_UNDEF)))
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file")
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file")
/* Set up the file driver info */
fdio_info.file = file;
@@ -553,31 +530,23 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_new
- *
- * Purpose: Creates a new file object and initializes it. The
- * H5Fopen and H5Fcreate functions then fill in various
- * fields. If SHARED is a non-null pointer then the shared info
- * to which it points has the reference count incremented.
- * Otherwise a new, empty shared info struct is created and
- * initialized with the specified file access property list.
- *
- * Errors:
- *
- * Return: Success: Ptr to a new file struct.
- *
- * Failure: NULL
+ * Function: H5F_new
*
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jul 18 1997
+ * Purpose: Creates a new file object and initializes it. The
+ * H5Fopen and H5Fcreate functions then fill in various fields.
+ * If SHARED is a non-null pointer then the shared info
+ * to which it points has the reference count incremented.
+ * Otherwise a new, empty shared info struct is created and
+ * initialized with the specified file access property list.
*
+ * Return: Success: Ptr to a new file struct.
+ * Failure: NULL
*-------------------------------------------------------------------------
*/
H5F_t *
H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
{
- H5F_t *f = NULL, *ret_value = NULL;
+ H5F_t *f = NULL, *ret_value = NULL;
FUNC_ENTER_NOAPI_NOINIT
@@ -591,7 +560,8 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t
} /* end if */
else {
H5P_genplist_t *plist; /* Property list */
- unsigned efc_size; /* External file cache size */
+ unsigned efc_size; /* External file cache size */
+ hbool_t latest_format; /* Always use the latest format? */
size_t u; /* Local index variable */
HDassert(lf != NULL);
@@ -648,7 +618,7 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file space page size")
HDassert(f->shared->fs_page_size >= H5F_FILE_SPACE_PAGE_SIZE_MIN);
- /* Temporary for multi/split drivers: fail file creation
+ /* Temporary for multi/split drivers: fail file creation
when persisting free-space or using paged aggregation strategy */
if(H5F_HAS_FEATURE(f, H5FD_FEAT_PAGED_AGGR))
if(f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE || f->shared->fs_persist)
@@ -701,6 +671,10 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t
if(H5P_get(plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, &(f->shared->mdc_initCacheImageCfg)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get initial metadata cache resize config")
+ /* File format version high bound does not allow the generation of metadata cache image */
+ if(f->shared->mdc_initCacheImageCfg.generate_image && f->shared->high_bound < H5F_LIBVER_V110)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "file format version out of bound for cache image")
+
/* Get the VFD values to cache */
f->shared->maxaddr = H5FD_get_maxaddr(lf);
if(!H5F_addr_defined(f->shared->maxaddr))
@@ -821,25 +795,20 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F__dest
- *
- * Purpose: Destroys a file structure. This function flushes the cache
- * but doesn't do any other cleanup other than freeing memory
- * for the file struct. The shared info for the file is freed
- * only when its reference count reaches zero.
+ * Function: H5F__dest
*
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jul 18 1997
+ * Purpose: Destroys a file structure. This function flushes the cache
+ * but doesn't do any other cleanup other than freeing memory
+ * for the file struct. The shared info for the file is freed
+ * only when its reference count reaches zero.
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -861,7 +830,7 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush)
HDONE_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cached data (phase 1)")
/* Notify the metadata cache that the file is about to be closed.
- * This allows the cache to set up for creating a metadata cache
+ * This allows the cache to set up for creating a metadata cache
* image if this has been requested.
*/
if(H5AC_prep_for_file_close(f, meta_dxpl_id) < 0)
@@ -878,7 +847,7 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush)
HDONE_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cached data (phase 2)")
/* With the shutdown modifications, the contents of the metadata cache
- * should be clean at this point, with the possible exception of the
+ * should be clean at this point, with the possible exception of the
* the superblock and superblock extension.
*
* Verify this.
@@ -904,10 +873,10 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush)
/* Release objects that depend on the superblock being initialized */
if(f->shared->sblock) {
/* Shutdown file free space manager(s) */
- /* (We should release the free space information now (before
- * truncating the file and before the metadata cache is shut
- * down) since the free space manager is holding some data
- * structures in memory and also because releasing free space
+ /* (We should release the free space information now (before
+ * truncating the file and before the metadata cache is shut
+ * down) since the free space manager is holding some data
+ * structures in memory and also because releasing free space
* can shrink the file's 'eoa' value)
*
* Update 11/1/16:
@@ -933,7 +902,7 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush)
* free space manager may dirty some data structures again.
*/
if(flush) {
- /* Clear status_flags */
+ /* Clear status_flags */
f->shared->sblock->status_flags &= (uint8_t)(~H5F_SUPER_WRITE_ACCESS);
f->shared->sblock->status_flags &= (uint8_t)(~H5F_SUPER_SWMR_WRITE_ACCESS);
@@ -942,8 +911,8 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty")
- /* Release any space allocated to space aggregators,
- * so that the eoa value corresponds to the end of the
+ /* Release any space allocated to space aggregators,
+ * so that the eoa value corresponds to the end of the
* space written to in the file.
*
* At most, this should change the superblock or the
@@ -962,11 +931,11 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush)
* extension should be dirty.
*/
HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM));
- } /* end if */
+ } /* end if */
} /* end if */
/* if it exists, unpin the driver information block cache entry,
- * since we're about to destroy the cache
+ * since we're about to destroy the cache
*/
if(f->shared->drvinfo)
if(H5AC_unpin_entry(f->shared->drvinfo) < 0)
@@ -986,7 +955,7 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush)
* Verify this.
*/
HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM));
-
+
/* Remove shared file struct from list of open files */
if(H5F_sfile_remove(f->shared) < 0)
/* Push error, but keep going*/
@@ -1062,7 +1031,8 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush)
/* Destroy shared file struct */
f->shared = (H5F_file_t *)H5FL_FREE(H5F_file_t, f->shared);
- } else if(f->shared->nrefs > 0) {
+ }
+ else if(f->shared->nrefs > 0) {
/*
* There are other references to the shared part of the file.
* Only decrement the reference count.
@@ -1084,42 +1054,42 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush)
/*-------------------------------------------------------------------------
- * Function: H5F_open
+ * Function: H5F_open
*
- * Purpose: Opens (or creates) a file. This function understands the
- * following flags which are similar in nature to the Posix
- * open(2) flags.
+ * Purpose: Opens (or creates) a file. This function understands the
+ * following flags which are similar in nature to the Posix
+ * open(2) flags.
*
- * H5F_ACC_RDWR: Open with read/write access. If the file is
- * currently open for read-only access then it
- * will be reopened. Absence of this flag
- * implies read-only access.
+ * H5F_ACC_RDWR: Open with read/write access. If the file is
+ * currently open for read-only access then it
+ * will be reopened. Absence of this flag
+ * implies read-only access.
*
- * H5F_ACC_CREAT: Create a new file if it doesn't exist yet.
- * The permissions are 0666 bit-wise AND with
- * the current umask. H5F_ACC_WRITE must also
- * be specified.
+ * H5F_ACC_CREAT: Create a new file if it doesn't exist yet.
+ * The permissions are 0666 bit-wise AND with
+ * the current umask. H5F_ACC_WRITE must also
+ * be specified.
*
- * H5F_ACC_EXCL: This flag causes H5F_open() to fail if the
- * file already exists.
+ * H5F_ACC_EXCL: This flag causes H5F_open() to fail if the
+ * file already exists.
*
- * H5F_ACC_TRUNC: The file is truncated and a new HDF5 superblock
- * is written. This operation will fail if the
- * file is already open.
+ * H5F_ACC_TRUNC: The file is truncated and a new HDF5 superblock
+ * is written. This operation will fail if the
+ * file is already open.
*
- * Unlinking the file name from the group directed graph while
- * the file is opened causes the file to continue to exist but
- * one will not be able to upgrade the file from read-only
- * access to read-write access by reopening it. Disk resources
- * for the file are released when all handles to the file are
- * closed. NOTE: This paragraph probably only applies to Unix;
- * deleting the file name in other OS's has undefined results.
+ * Unlinking the file name from the group directed graph while
+ * the file is opened causes the file to continue to exist but
+ * one will not be able to upgrade the file from read-only
+ * access to read-write access by reopening it. Disk resources
+ * for the file are released when all handles to the file are
+ * closed. NOTE: This paragraph probably only applies to Unix;
+ * deleting the file name in other OS's has undefined results.
*
- * The CREATE_PARMS argument is optional. A null pointer will
- * cause the default file creation parameters to be used.
+ * The CREATE_PARMS argument is optional. A null pointer will
+ * cause the default file creation parameters to be used.
*
- * The ACCESS_PARMS argument is optional. A null pointer will
- * cause the default file access parameters to be used.
+ * The ACCESS_PARMS argument is optional. A null pointer will
+ * cause the default file access parameters to be used.
*
* The following two tables show results of file opens for single and concurrent access:
*
@@ -1152,12 +1122,8 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush)
* s: the open succeeds with flags combination from both the first and second opens
*
*
- * Return: Success: A new file pointer.
- * Failure: NULL
- *
- * Programmer: Robb Matzke
- * Tuesday, September 23, 1997
- *
+ * Return: Success: A new file pointer.
+ * Failure: NULL
*-------------------------------------------------------------------------
*/
H5F_t *
@@ -1176,11 +1142,13 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
unsigned page_buf_min_meta_perc;
unsigned page_buf_min_raw_perc;
hbool_t set_flag = FALSE; /*set the status_flags in the superblock */
- hbool_t clear = FALSE; /*clear the status_flags */
+ hbool_t clear = FALSE; /*clear the status_flags */
hbool_t evict_on_close; /* evict on close value from plist */
H5F_t *ret_value = NULL; /*actual return value */
char *lock_env_var = NULL;/*env var pointer */
hbool_t use_file_locking; /*read from env var */
+ hbool_t ci_load = FALSE; /* whether MDC ci load requested */
+ hbool_t ci_write = FALSE; /* whether MDC CI write requested */
FUNC_ENTER_NOAPI(NULL)
@@ -1203,7 +1171,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
if(lock_env_var && !HDstrcmp(lock_env_var, "FALSE"))
use_file_locking = FALSE;
else
- use_file_locking = TRUE;
+ use_file_locking = TRUE;
/*
* Opening a file is a two step process. First we try to open the
@@ -1292,8 +1260,8 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
/* Place an advisory lock on the file */
if(use_file_locking)
if(H5FD_lock(lf, (hbool_t)((flags & H5F_ACC_RDWR) ? TRUE : FALSE)) < 0) {
- /* Locking failed - Closing will remove the lock */
- if(H5FD_close(lf) < 0)
+ /* Locking failed - Closing will remove the lock */
+ if(H5FD_close(lf) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info")
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to lock the file")
} /* end if */
@@ -1304,7 +1272,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
* returned is NULL, H5FD_close() will never be called via H5F_dest()
* so we have to close lf here before heading to the error handling.
*/
- if(H5FD_close(lf) < 0)
+ if(H5FD_close(lf) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info")
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to initialize file structure")
} /* end if */
@@ -1314,6 +1282,12 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
set_flag = TRUE;
} /* end else */
+ /* Check to see if both SWMR and cache image are requested. Fail if so */
+ if(H5C_cache_image_status(file, &ci_load, &ci_write) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get MDC cache image status")
+ if((ci_load || ci_write) && (flags & (H5F_ACC_SWMR_READ | H5F_ACC_SWMR_WRITE)))
+ HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, NULL, "can't have both SWMR and cache image")
+
/* Retain the name the file was opened with */
file->open_name = H5MM_xstrdup(name);
@@ -1462,7 +1436,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, NULL, "unable to flush superblock extension")
/* Remove the file lock for SWMR_WRITE */
- if(use_file_locking && (H5F_INTENT(file) & H5F_ACC_SWMR_WRITE)) {
+ if(use_file_locking && (H5F_INTENT(file) & H5F_ACC_SWMR_WRITE)) {
if(H5FD_unlock(file->shared->lf) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to unlock the file")
} /* end if */
@@ -1470,11 +1444,11 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
else { /* H5F_ACC_RDONLY: check consistency of status_flags */
/* Skip check of status_flags for file with < superblock version 3 */
if(file->shared->sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_3) {
- if(H5F_INTENT(file) & H5F_ACC_SWMR_READ) {
- if((file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS &&
+ if(H5F_INTENT(file) & H5F_ACC_SWMR_READ) {
+ if((file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS &&
!(file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS))
- ||
- (!(file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS) &&
+ ||
+ (!(file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS) &&
file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "file is not already open for SWMR writing")
} /* end if */
@@ -1492,21 +1466,17 @@ done:
if((NULL == ret_value) && file)
if(H5F__dest(file, meta_dxpl_id, raw_dxpl_id, FALSE) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_open() */
/*-------------------------------------------------------------------------
- * Function: H5F_flush_phase1
- *
- * Purpose: First phase of flushing cached data.
- *
- * Return: Non-negative on success/Negative on failure
+ * Function: H5F_flush_phase1
*
- * Programmer: Quincey Koziol
- * koziol@lbl.gov
- * Jan 1 2017
+ * Purpose: First phase of flushing cached data.
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1539,16 +1509,11 @@ H5F__flush_phase1(H5F_t *f, hid_t meta_dxpl_id)
/*-------------------------------------------------------------------------
- * Function: H5F__flush_phase2
+ * Function: H5F__flush_phase2
*
- * Purpose: Second phase of flushing cached data.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@lbl.gov
- * Jan 1 2017
+ * Purpose: Second phase of flushing cached data.
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1606,16 +1571,11 @@ H5F__flush_phase2(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t closi
/*-------------------------------------------------------------------------
- * Function: H5F__flush
- *
- * Purpose: Flushes cached data.
- *
- * Return: Non-negative on success/Negative on failure
+ * Function: H5F__flush
*
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Aug 29 1997
+ * Purpose: Flushes cached data.
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -1643,33 +1603,29 @@ H5F__flush(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t closing)
/*-------------------------------------------------------------------------
- * Function: H5F_close
- *
- * Purpose: Closes a file or causes the close operation to be pended.
- * This function is called two ways: from the API it gets called
- * by H5Fclose->H5I_dec_ref->H5F_close when H5I_dec_ref()
- * decrements the file ID reference count to zero. The file ID
- * is removed from the H5I_FILE group by H5I_dec_ref() just
- * before H5F_close() is called. If there are open object
- * headers then the close is pended by moving the file to the
- * H5I_FILE_CLOSING ID group (the f->closing contains the ID
- * assigned to file).
- *
- * This function is also called directly from H5O_close() when
- * the last object header is closed for the file and the file
- * has a pending close.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Tuesday, September 23, 1997
- *
+ * Function: H5F_close
+ *
+ * Purpose: Closes a file or causes the close operation to be pended.
+ * This function is called two ways: from the API it gets called
+ * by H5Fclose->H5I_dec_ref->H5F_close when H5I_dec_ref()
+ * decrements the file ID reference count to zero. The file ID
+ * is removed from the H5I_FILE group by H5I_dec_ref() just
+ * before H5F_close() is called. If there are open object
+ * headers then the close is pended by moving the file to the
+ * H5I_FILE_CLOSING ID group (the f->closing contains the ID
+ * assigned to file).
+ *
+ * This function is also called directly from H5O_close() when
+ * the last object header is closed for the file and the file
+ * has a pending close.
+ *
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
H5F_close(H5F_t *f)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1708,18 +1664,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_try_close
+ * Function: H5F_try_close
*
- * Purpose: Attempts to close a file due to one of several actions:
+ * Purpose: Attempts to close a file due to one of several actions:
* - The reference count on the file ID dropped to zero
* - The last open object was closed in the file
* - The file was unmounted
*
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Tuesday, July 19, 2005
- *
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -1727,7 +1679,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/)
{
unsigned nopen_files = 0; /* Number of open files in file/mount hierarchy */
unsigned nopen_objs = 0; /* Number of open objects in file/mount hierarchy */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1758,12 +1710,12 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/)
/*
* Close file according to close degree:
*
- * H5F_CLOSE_WEAK: if there are still objects open, wait until
- * they are all closed.
- * H5F_CLOSE_SEMI: if there are still objects open, return fail;
- * otherwise, close file.
- * H5F_CLOSE_STRONG: if there are still objects open, close them
- * first, then close file.
+ * H5F_CLOSE_WEAK: if there are still objects open, wait until
+ * they are all closed.
+ * H5F_CLOSE_SEMI: if there are still objects open, return fail;
+ * otherwise, close file.
+ * H5F_CLOSE_STRONG: if there are still objects open, close them
+ * first, then close file.
*/
switch(f->shared->fc_degree) {
case H5F_CLOSE_WEAK:
@@ -1885,16 +1837,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_get_id
+ * Function: H5F_get_id
*
- * Purpose: Get the file ID, incrementing it, or "resurrecting" it as
- * appropriate.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Raymond Lu
- * Oct 29, 2003
+ * Purpose: Get the file ID, incrementing it, or "resurrecting" it as
+ * appropriate.
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
hid_t
@@ -1909,8 +1857,9 @@ H5F_get_id(H5F_t *file, hbool_t app_ref)
if(file->file_id == -1) {
/* Get an atom for the file */
if((file->file_id = H5I_register(H5I_FILE, file, app_ref)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file")
- } else {
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file")
+ }
+ else {
/* Increment reference count on atom. */
if(H5I_inc_ref(file->file_id, app_ref) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed")
@@ -1924,18 +1873,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_incr_nopen_objs
+ * Function: H5F_incr_nopen_objs
*
- * Purpose: Increment the number of open objects for a file.
- *
- * Return: Success: The number of open objects, after the increment
- *
- * Failure: (can't happen)
- *
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Mar 6 2007
+ * Purpose: Increment the number of open objects for a file.
*
+ * Return: Success: The number of open objects, after the increment
+ * Failure: (can't happen)
*-------------------------------------------------------------------------
*/
unsigned
@@ -1951,18 +1894,12 @@ H5F_incr_nopen_objs(H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_decr_nopen_objs
- *
- * Purpose: Decrement the number of open objects for a file.
+ * Function: H5F_decr_nopen_objs
*
- * Return: Success: The number of open objects, after the decrement
- *
- * Failure: (can't happen)
- *
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Mar 6 2007
+ * Purpose: Decrement the number of open objects for a file.
*
+ * Return: Success: The number of open objects, after the decrement
+ * Failure: (can't happen)
*-------------------------------------------------------------------------
*/
unsigned
@@ -1978,18 +1915,14 @@ H5F_decr_nopen_objs(H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_build_actual_name
- *
- * Purpose: Retrieve the name of a file, after following symlinks, etc.
+ * Function: H5F_build_actual_name
*
- * Note: Currently only working for "POSIX I/O compatible" VFDs
+ * Purpose: Retrieve the name of a file, after following symlinks, etc.
*
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Quincey Koziol
- * November 25, 2009
+ * Note: Currently only working for "POSIX I/O compatible" VFDs
*
+ * Return: Success: 0
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2104,17 +2037,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_addr_encode_len
- *
- * Purpose: Encodes an address into the buffer pointed to by *PP and
- * then increments the pointer to the first byte after the
- * address. An undefined value is stored as all 1's.
+ * Function: H5F_addr_encode_len
*
- * Return: void
- *
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
+ * Purpose: Encodes an address into the buffer pointed to by *PP and
+ * then increments the pointer to the first byte after the
+ * address. An undefined value is stored as all 1's.
*
+ * Return: void
*-------------------------------------------------------------------------
*/
void
@@ -2129,15 +2058,15 @@ H5F_addr_encode_len(size_t addr_len, uint8_t **pp/*in,out*/, haddr_t addr)
HDassert(pp && *pp);
if(H5F_addr_defined(addr)) {
- for(u = 0; u < addr_len; u++) {
- *(*pp)++ = (uint8_t)(addr & 0xff);
- addr >>= 8;
- } /* end for */
- HDassert("overflow" && 0 == addr);
+ for(u = 0; u < addr_len; u++) {
+ *(*pp)++ = (uint8_t)(addr & 0xff);
+ addr >>= 8;
+ } /* end for */
+ HDassert("overflow" && 0 == addr);
} /* end if */
else {
- for(u = 0; u < addr_len; u++)
- *(*pp)++ = 0xff;
+ for(u = 0; u < addr_len; u++)
+ *(*pp)++ = 0xff;
} /* end else */
FUNC_LEAVE_NOAPI_VOID
@@ -2145,17 +2074,13 @@ H5F_addr_encode_len(size_t addr_len, uint8_t **pp/*in,out*/, haddr_t addr)
/*-------------------------------------------------------------------------
- * Function: H5F_addr_encode
+ * Function: H5F_addr_encode
*
- * Purpose: Encodes an address into the buffer pointed to by *PP and
- * then increments the pointer to the first byte after the
- * address. An undefined value is stored as all 1's.
- *
- * Return: void
- *
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
+ * Purpose: Encodes an address into the buffer pointed to by *PP and
+ * then increments the pointer to the first byte after the
+ * address. An undefined value is stored as all 1's.
*
+ * Return: void
*-------------------------------------------------------------------------
*/
void
@@ -2173,27 +2098,23 @@ H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr)
/*-------------------------------------------------------------------------
- * Function: H5F_addr_decode_len
- *
- * Purpose: Decodes an address from the buffer pointed to by *PP and
- * updates the pointer to point to the next byte after the
- * address.
+ * Function: H5F_addr_decode_len
*
- * If the value read is all 1's then the address is returned
- * with an undefined value.
+ * Purpose: Decodes an address from the buffer pointed to by *PP and
+ * updates the pointer to point to the next byte after the
+ * address.
*
- * Return: void
- *
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
+ * If the value read is all 1's then the address is returned
+ * with an undefined value.
*
+ * Return: void
*-------------------------------------------------------------------------
*/
void
H5F_addr_decode_len(size_t addr_len, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*out*/)
{
- hbool_t all_zero = TRUE; /* True if address was all zeroes */
- unsigned u; /* Local index variable */
+ hbool_t all_zero = TRUE; /* True if address was all zeroes */
+ unsigned u; /* Local index variable */
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -2207,27 +2128,27 @@ H5F_addr_decode_len(size_t addr_len, const uint8_t **pp/*in,out*/, haddr_t *addr
/* Decode bytes from address */
for(u = 0; u < addr_len; u++) {
- uint8_t c; /* Local decoded byte */
+ uint8_t c; /* Local decoded byte */
/* Get decoded byte (and advance pointer) */
- c = *(*pp)++;
+ c = *(*pp)++;
/* Check for non-undefined address byte value */
- if(c != 0xff)
+ if(c != 0xff)
all_zero = FALSE;
- if(u < sizeof(*addr_p)) {
- haddr_t tmp = c; /* Local copy of address, for casting */
+ if(u < sizeof(*addr_p)) {
+ haddr_t tmp = c; /* Local copy of address, for casting */
/* Shift decoded byte to correct position */
- tmp <<= (u * 8); /*use tmp to get casting right */
+ tmp <<= (u * 8); /*use tmp to get casting right */
/* Merge into already decoded bytes */
- *addr_p |= tmp;
- } /* end if */
+ *addr_p |= tmp;
+ } /* end if */
else
if(!all_zero)
- HDassert(0 == **pp); /*overflow */
+ HDassert(0 == **pp); /*overflow */
} /* end for */
/* If 'all_zero' is still TRUE, the address was entirely composed of '0xff'
@@ -2241,20 +2162,16 @@ H5F_addr_decode_len(size_t addr_len, const uint8_t **pp/*in,out*/, haddr_t *addr
/*-------------------------------------------------------------------------
- * Function: H5F_addr_decode
- *
- * Purpose: Decodes an address from the buffer pointed to by *PP and
- * updates the pointer to point to the next byte after the
- * address.
- *
- * If the value read is all 1's then the address is returned
- * with an undefined value.
+ * Function: H5F_addr_decode
*
- * Return: void
+ * Purpose: Decodes an address from the buffer pointed to by *PP and
+ * updates the pointer to point to the next byte after the
+ * address.
*
- * Programmer: Robb Matzke
- * Friday, November 7, 1997
+ * If the value read is all 1's then the address is returned
+ * with an undefined value.
*
+ * Return: void
*-------------------------------------------------------------------------
*/
void
@@ -2278,10 +2195,6 @@ H5F_addr_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*o
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * 7/19/11
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2308,10 +2221,6 @@ H5F_set_grp_btree_shared(H5F_t *f, H5UC_t *rc)
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * 7/20/11
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2337,10 +2246,6 @@ H5F_set_sohm_addr(H5F_t *f, haddr_t addr)
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * 7/20/11
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2366,10 +2271,6 @@ H5F_set_sohm_vers(H5F_t *f, unsigned vers)
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * 7/20/11
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2395,10 +2296,6 @@ H5F_set_sohm_nindexes(H5F_t *f, unsigned nindexes)
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * 7/20/11
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2424,10 +2321,6 @@ H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag)
*
* Return: Success: Bytes copied / number of bytes needed.
* Failure: negative value
- *
- * Programmer: John Mainzer
- * 11/15/11
- *
*-------------------------------------------------------------------------
*/
ssize_t
@@ -2468,20 +2361,20 @@ H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len, hid_t meta_dxpl_i
if(HDstrcmp(fd_ptr->cls->name, "multi") == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not supported for multi file driver.")
- /* While the family file driver is conceptually fully compatible
+ /* While the family file driver is conceptually fully compatible
* with the get file image operation, it sets a file driver message
* in the super block that prevents the image being opened with any
* driver other than the family file driver. Needless to say, this
* rather defeats the purpose of the get file image operation.
*
- * While this problem is quire solvable, the required time and
+ * While this problem is quire solvable, the required time and
* resources are lacking at present. Hence, for now, we don't
- * allow the get file image operation to be perfomed on files
+ * allow the get file image operation to be perfomed on files
* opened with the family file driver.
*
- * Observe that the following test only looks at the top level
+ * Observe that the following test only looks at the top level
* driver, and fails if there is some other driver sitting on to
- * of the family file driver.
+ * of the family file driver.
*
* I don't think this can happen at present, but that may change
* in the future.
@@ -2500,7 +2393,7 @@ H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len, hid_t meta_dxpl_i
/* test to see if a buffer was provided -- if not, we are done */
if(buf_ptr != NULL) {
H5FD_io_info_t fdio_info; /* File driver I/O info */
- size_t space_needed; /* size of file image */
+ size_t space_needed; /* size of file image */
hsize_t tmp;
size_t tmp_size;
@@ -2531,34 +2424,31 @@ H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len, hid_t meta_dxpl_i
HDmemset((uint8_t *)(buf_ptr) + tmp, 0, tmp_size);
} /* end if */
-
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5F_get_file_image() */
/*-------------------------------------------------------------------------
- * Function: H5F_track_metadata_read_retries
- *
- * Purpose: To track the # of a "retries" (log10) for a metadata item.
- * This routine should be used only when:
- * "retries" > 0
- * f->shared->read_attempts > 1 (does not have retry when 1)
- * f->shared->retries_nbins > 0 (calculated based on f->shared->read_attempts)
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Function: H5F_track_metadata_read_retries
*
- * Programmer: Vailin Choi; October 2013
+ * Purpose: To track the # of a "retries" (log10) for a metadata item.
+ * This routine should be used only when:
+ * "retries" > 0
+ * f->shared->read_attempts > 1 (does not have retry when 1)
+ * f->shared->retries_nbins > 0 (calculated based on f->shared->read_attempts)
*
+ * Return: Success: SUCCEED
+ * Failure: FAIL
*-------------------------------------------------------------------------
*/
herr_t
H5F_track_metadata_read_retries(H5F_t *f, unsigned actype, unsigned retries)
{
- unsigned log_ind; /* Index to the array of retries based on log10 of retries */
- double tmp; /* Temporary value, to keep compiler quiet */
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned log_ind; /* Index to the array of retries based on log10 of retries */
+ double tmp; /* Temporary value, to keep compiler quiet */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2589,23 +2479,20 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_set_retries
+ * Function: H5F_set_retries
*
- * Purpose: To initialize data structures for read retries:
- * --zero out "retries"
- * --set up "retries_nbins" based on read_attempts
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Vailin Choi; November 2013
+ * Purpose: To initialize data structures for read retries:
+ * --zero out "retries"
+ * --set up "retries_nbins" based on read_attempts
*
+ * Return: Success: SUCCEED
+ * Failure: FAIL
*-------------------------------------------------------------------------
*/
herr_t
H5F_set_retries(H5F_t *f)
{
- double tmp; /* Temporary variable */
+ double tmp; /* Temporary variable */
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -2635,9 +2522,6 @@ H5F_set_retries(H5F_t *f)
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: Vailin Choi; October 2013
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2661,15 +2545,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F__set_base_addr
- *
- * Purpose: Quick and dirty routine to set the file's 'base_addr' value
+ * Function: H5F__set_base_addr
*
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
- * July 19, 2013
+ * Purpose: Quick and dirty routine to set the file's 'base_addr' value
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -2684,7 +2564,7 @@ H5F__set_base_addr(const H5F_t *f, haddr_t addr)
/* Dispatch to driver */
if(H5FD_set_base_addr(f->shared->lf, addr) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_base_addr request failed")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_base_addr request failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2692,15 +2572,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F__set_eoa
- *
- * Purpose: Quick and dirty routine to set the file's 'eoa' value
+ * Function: H5F__set_eoa
*
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
- * July 19, 2013
+ * Purpose: Quick and dirty routine to set the file's 'eoa' value
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -2715,7 +2591,7 @@ H5F__set_eoa(const H5F_t *f, H5F_mem_t type, haddr_t addr)
/* Dispatch to driver */
if(H5FD_set_eoa(f->shared->lf, type, addr) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2723,15 +2599,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F__set_paged_aggr
- *
- * Purpose: Quick and dirty routine to set the file's paged_aggr mode
+ * Function: H5F__set_paged_aggr
*
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
- * June 19, 2015
+ * Purpose: Quick and dirty routine to set the file's paged_aggr mode
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -2762,10 +2634,6 @@ done:
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * 2/10/16
- *
*-------------------------------------------------------------------------
*/
void
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 3f03a96..2ec071f 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -310,14 +310,12 @@
#define H5F_RDCC_W0(F) ((F)->shared->rdcc_w0)
#define H5F_SIEVE_BUF_SIZE(F) ((F)->shared->sieve_buf_size)
#define H5F_GC_REF(F) ((F)->shared->gc_ref)
-#define H5F_USE_LATEST_FLAGS(F,FL) ((F)->shared->latest_flags & (FL))
#define H5F_STORE_MSG_CRT_IDX(F) ((F)->shared->store_msg_crt_idx)
#define H5F_SET_STORE_MSG_CRT_IDX(F, FL) ((F)->shared->store_msg_crt_idx = (FL))
#define H5F_GRP_BTREE_SHARED(F) ((F)->shared->grp_btree_shared)
#define H5F_SET_GRP_BTREE_SHARED(F, RC) (((F)->shared->grp_btree_shared = (RC)) ? SUCCEED : FAIL)
#define H5F_USE_TMP_SPACE(F) ((F)->shared->fs.use_tmp_space)
#define H5F_IS_TMP_ADDR(F, ADDR) (H5F_addr_le((F)->shared->fs.tmp_addr, (ADDR)))
-#define H5F_SET_LATEST_FLAGS(F, FL) ((F)->shared->latest_flags = (FL))
#ifdef H5_HAVE_PARALLEL
#define H5F_COLL_MD_READ(F) ((F)->coll_md_read)
#endif /* H5_HAVE_PARALLEL */
@@ -369,7 +367,6 @@
#define H5F_RDCC_W0(F) (H5F_rdcc_w0(F))
#define H5F_SIEVE_BUF_SIZE(F) (H5F_sieve_buf_size(F))
#define H5F_GC_REF(F) (H5F_gc_ref(F))
-#define H5F_USE_LATEST_FLAGS(F,FL) (H5F_use_latest_flags(F,FL))
#define H5F_STORE_MSG_CRT_IDX(F) (H5F_store_msg_crt_idx(F))
#define H5F_SET_STORE_MSG_CRT_IDX(F, FL) (H5F_set_store_msg_crt_idx((F), (FL)))
#define H5F_GRP_BTREE_SHARED(F) (H5F_grp_btree_shared(F))
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index 4ba19b0..580b062 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -26,16 +26,16 @@
/* Module Setup */
/****************/
-#include "H5Fmodule.h" /* This source code file is part of the H5F module */
+#include "H5Fmodule.h" /* This source code file is part of the H5F module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
-#include "H5FDprivate.h" /* File drivers */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* File access */
+#include "H5FDprivate.h" /* File drivers */
/****************/
@@ -75,17 +75,13 @@
/*-------------------------------------------------------------------------
- * Function: H5F_get_intent
+ * Function: H5F_get_intent
*
- * Purpose: Quick and dirty routine to retrieve the file's 'intent' flags
- * (Mainly added to stop non-file routines from poking about in the
- * H5F_t data structure)
- *
- * Return: 'intent' on success/abort on failure (shouldn't fail)
- *
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
- * September 29, 2000
+ * Purpose: Quick and dirty routine to retrieve the file's 'intent' flags
+ * (Mainly added to stop non-file routines from poking about in the
+ * H5F_t data structure)
*
+ * Return: 'intent' on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
*/
unsigned
@@ -101,15 +97,15 @@ H5F_get_intent(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_low_bound
+ * Function: H5F_get_low_bound
*
- * Purpose: Quick and dirty routine to retrieve the file's low_bound.
+ * Purpose: Quick and dirty routine to retrieve the file's low_bound.
* (Mainly added to stop non-file routines from poking about in the
* H5F_t data structure)
*
- * Return: low_bound on success/abort on failure (shouldn't fail)
+ * Return: low_bound on success/abort on failure (shouldn't fail)
*
- * Programmer: Vailin Choi; June 2016
+ * Programmer: Vailin Choi; June 2016
*
*-------------------------------------------------------------------------
*/
@@ -126,15 +122,15 @@ H5F_get_low_bound(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_high_bound
+ * Function: H5F_get_high_bound
*
- * Purpose: Quick and dirty routine to retrieve the file's high_bound.
+ * Purpose: Quick and dirty routine to retrieve the file's high_bound.
* (Mainly added to stop non-file routines from poking about in the
* H5F_t data structure)
*
- * Return: high_bound on success/abort on failure (shouldn't fail)
+ * Return: high_bound on success/abort on failure (shouldn't fail)
*
- * Programmer: Vailin Choi; June 2016
+ * Programmer: Vailin Choi; June 2016
*
*-------------------------------------------------------------------------
*/
@@ -151,16 +147,12 @@ H5F_get_high_bound(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_open_name
+ * Function: H5F_get_open_name
*
- * Purpose: Retrieve the name used to open a file.
- *
- * Return: Success: The name of the file.
- * Failure: ? (should not happen)
- *
- * Programmer: Neil Fortner
- * December 15 2008
+ * Purpose: Retrieve the name used to open a file.
*
+ * Return: Success: The name of the file.
+ * Failure: ? (should not happen)
*-------------------------------------------------------------------------
*/
char *
@@ -177,16 +169,12 @@ H5F_get_open_name(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_actual_name
- *
- * Purpose: Retrieve the actual name of a file, after resolving symlinks, etc.
- *
- * Return: Success: The name of the file.
- * Failure: ? (should not happen)
+ * Function: H5F_get_actual_name
*
- * Programmer: Quincey Koziol
- * November 25 2009
+ * Purpose: Retrieve the actual name of a file, after resolving symlinks, etc.
*
+ * Return: Success: The name of the file.
+ * Failure: ? (should not happen)
*-------------------------------------------------------------------------
*/
char *
@@ -203,16 +191,13 @@ H5F_get_actual_name(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_extpath
+ * Function: H5F_get_extpath
*
- * Purpose: Retrieve the file's 'extpath' flags
- * This is used by H5L_extern_traverse() and H5D_build_extfile_prefix() to retrieve the main file's location
- * when searching the target file.
- *
- * Return: 'extpath' on success/abort on failure (shouldn't fail)
- *
- * Programmer: Vailin Choi, April 2, 2008
+ * Purpose: Retrieve the file's 'extpath' flags
+ * This is used by H5L_extern_traverse() and H5D_build_extfile_prefix() to retrieve the main file's location
+ * when searching the target file.
*
+ * Return: 'extpath' on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
*/
char *
@@ -229,14 +214,11 @@ H5F_get_extpath(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_shared
- *
- * Purpose: Retrieve the file's 'shared' pointer
- *
- * Return: 'shared' on success/abort on failure (shouldn't fail)
+ * Function: H5F_get_shared
*
- * Programmer: Quincey Koziol, July 20, 2011
+ * Purpose: Retrieve the file's 'shared' pointer
*
+ * Return: 'shared' on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
*/
H5F_file_t *
@@ -252,14 +234,11 @@ H5F_get_shared(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_same_shared
+ * Function: H5F_same_shared
*
- * Purpose: Determine if two files have the same shared file pointer
- *
- * Return: TRUE/FALSE on success/abort on failure (shouldn't fail)
- *
- * Programmer: Quincey Koziol, July 19, 2011
+ * Purpose: Determine if two files have the same shared file pointer
*
+ * Return: TRUE/FALSE on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
*/
hbool_t
@@ -278,14 +257,11 @@ H5F_same_shared(const H5F_t *f1, const H5F_t *f2)
/*-------------------------------------------------------------------------
- * Function: H5F_get_nopen_objs
- *
- * Purpose: Retrieve the file's 'nopen_objs' value
- *
- * Return: 'nopen_objs' on success/abort on failure (shouldn't fail)
+ * Function: H5F_get_nopen_objs
*
- * Programmer: Quincey Koziol, July 20, 2011
+ * Purpose: Retrieve the file's 'nopen_objs' value
*
+ * Return: 'nopen_objs' on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
*/
unsigned
@@ -301,14 +277,11 @@ H5F_get_nopen_objs(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_file_id
+ * Function: H5F_get_file_id
*
- * Purpose: Retrieve the file's 'file_id' value
- *
- * Return: 'file_id' on success/abort on failure (shouldn't fail)
- *
- * Programmer: Quincey Koziol, July 20, 2011
+ * Purpose: Retrieve the file's 'file_id' value
*
+ * Return: 'file_id' on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
*/
hid_t
@@ -324,14 +297,11 @@ H5F_get_file_id(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_parent
- *
- * Purpose: Retrieve the file's 'parent' pointer
- *
- * Return: 'parent' on success/abort on failure (shouldn't fail)
+ * Function: H5F_get_parent
*
- * Programmer: Quincey Koziol, July 19, 2011
+ * Purpose: Retrieve the file's 'parent' pointer
*
+ * Return: 'parent' on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
*/
H5F_t *
@@ -347,14 +317,11 @@ H5F_get_parent(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_nmounts
+ * Function: H5F_get_nmounts
*
- * Purpose: Retrieve the file's 'nmounts' value
- *
- * Return: 'nmounts' on success/abort on failure (shouldn't fail)
- *
- * Programmer: Quincey Koziol, July 20, 2011
+ * Purpose: Retrieve the file's 'nmounts' value
*
+ * Return: 'nmounts' on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
*/
unsigned
@@ -370,14 +337,11 @@ H5F_get_nmounts(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_read_attempts
- *
- * Purpose: Retrieve the file's 'read_attempts' value
- *
- * Return: '# of read attempts' on success/abort on failure (shouldn't fail)
+ * Function: H5F_get_read_attempts
*
- * Programmer: Vaili Choi; Sept 2013
+ * Purpose: Retrieve the file's 'read_attempts' value
*
+ * Return: '# of read attempts' on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
*/
unsigned
@@ -393,18 +357,12 @@ H5F_get_read_attempts(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_fcpl
+ * Function: H5F_get_fcpl
*
- * Purpose: Retrieve the value of a file's FCPL.
- *
- * Return: Success: The FCPL for the file.
- *
- * Failure: ? (should not happen)
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * May 25 2005
+ * Purpose: Retrieve the value of a file's FCPL.
*
+ * Return: Success: The FCPL for the file.
+ * Failure: ? (should not happen)
*-------------------------------------------------------------------------
*/
hid_t
@@ -421,17 +379,13 @@ H5F_get_fcpl(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_sizeof_addr
- *
- * Purpose: Quick and dirty routine to retrieve the size of the file's size_t
- * (Mainly added to stop non-file routines from poking about in the
- * H5F_t data structure)
+ * Function: H5F_sizeof_addr
*
- * Return: 'sizeof_addr' on success/abort on failure (shouldn't fail)
- *
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
- * September 29, 2000
+ * Purpose: Quick and dirty routine to retrieve the size of the file's size_t
+ * (Mainly added to stop non-file routines from poking about in the
+ * H5F_t data structure)
*
+ * Return: 'sizeof_addr' on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
*/
uint8_t
@@ -448,17 +402,13 @@ H5F_sizeof_addr(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_sizeof_size
- *
- * Purpose: Quick and dirty routine to retrieve the size of the file's off_t
- * (Mainly added to stop non-file routines from poking about in the
- * H5F_t data structure)
+ * Function: H5F_sizeof_size
*
- * Return: 'sizeof_size' on success/abort on failure (shouldn't fail)
- *
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
- * September 29, 2000
+ * Purpose: Quick and dirty routine to retrieve the size of the file's off_t
+ * (Mainly added to stop non-file routines from poking about in the
+ * H5F_t data structure)
*
+ * Return: 'sizeof_size' on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
*/
uint8_t
@@ -475,14 +425,11 @@ H5F_sizeof_size(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_sohm_addr
- *
- * Purpose: Retrieve the file's 'sohm_addr' value
+ * Function: H5F_get_sohm_addr
*
- * Return: 'sohm_addr' on success/abort on failure (shouldn't fail)
- *
- * Programmer: Quincey Koziol, July 20, 2011
+ * Purpose: Retrieve the file's 'sohm_addr' value
*
+ * Return: 'sohm_addr' on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
*/
haddr_t
@@ -499,14 +446,11 @@ H5F_get_sohm_addr(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_sohm_vers
- *
- * Purpose: Retrieve the file's 'sohm_vers' value
+ * Function: H5F_get_sohm_vers
*
- * Return: 'sohm_vers' on success/abort on failure (shouldn't fail)
- *
- * Programmer: Quincey Koziol, July 20, 2011
+ * Purpose: Retrieve the file's 'sohm_vers' value
*
+ * Return: 'sohm_vers' on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
*/
unsigned
@@ -523,14 +467,11 @@ H5F_get_sohm_vers(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_sohm_nindexes
- *
- * Purpose: Retrieve the file's 'sohm_nindexes' value
+ * Function: H5F_get_sohm_nindexes
*
- * Return: 'sohm_nindexes' on success/abort on failure (shouldn't fail)
- *
- * Programmer: Quincey Koziol, July 20, 2011
+ * Purpose: Retrieve the file's 'sohm_nindexes' value
*
+ * Return: 'sohm_nindexes' on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
*/
unsigned
@@ -547,21 +488,15 @@ H5F_get_sohm_nindexes(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_sym_leaf_k
+ * Function: H5F_sym_leaf_k
*
- * Purpose: Replaced a macro to retrieve the symbol table leaf size,
- * now that the generic properties are being used to store
- * the values.
+ * Purpose: Replaced a macro to retrieve the symbol table leaf size,
+ * now that the generic properties are being used to store
+ * the values.
*
- * Return: Success: Non-negative, and the symbol table leaf size is
+ * Return: Success: Non-negative, and the symbol table leaf size is
* returned.
- *
- * Failure: Negative (should not happen)
- *
- * Programmer: Raymond Lu
- * slu@ncsa.uiuc.edu
- * Oct 14 2001
- *
+ * Failure: Negative (should not happen)
*-------------------------------------------------------------------------
*/
unsigned
@@ -579,21 +514,15 @@ H5F_sym_leaf_k(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_Kvalue
+ * Function: H5F_Kvalue
*
- * Purpose: Replaced a macro to retrieve a B-tree key value for a certain
- * type, now that the generic properties are being used to store
- * the B-tree values.
+ * Purpose: Replaced a macro to retrieve a B-tree key value for a certain
+ * type, now that the generic properties are being used to store
+ * the B-tree values.
*
- * Return: Success: Non-negative, and the B-tree key value is
+ * Return: Success: Non-negative, and the B-tree key value is
* returned.
- *
- * Failure: Negative (should not happen)
- *
- * Programmer: Raymond Lu
- * slu@ncsa.uiuc.edu
- * Oct 14 2001
- *
+ * Failure: Negative (should not happen)
*-------------------------------------------------------------------------
*/
unsigned
@@ -612,14 +541,11 @@ H5F_Kvalue(const H5F_t *f, const H5B_class_t *type)
/*-------------------------------------------------------------------------
- * Function: H5F_get_nrefs
- *
- * Purpose: Retrieve the file's 'nrefs' value
+ * Function: H5F_get_nrefs
*
- * Return: 'nrefs' on success/abort on failure (shouldn't fail)
- *
- * Programmer: Quincey Koziol, July 20, 2011
+ * Purpose: Retrieve the file's 'nrefs' value
*
+ * Return: 'nrefs' on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
*/
unsigned
@@ -636,21 +562,15 @@ H5F_get_nrefs(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_rdcc_nslots
+ * Function: H5F_rdcc_nslots
*
- * Purpose: Replaced a macro to retrieve the raw data cache number of slots,
- * now that the generic properties are being used to store
- * the values.
+ * Purpose: Replaced a macro to retrieve the raw data cache number of slots,
+ * now that the generic properties are being used to store
+ * the values.
*
- * Return: Success: Non-negative, and the raw data cache number of
+ * Return: Success: Non-negative, and the raw data cache number of
* of slots is returned.
- *
- * Failure: Negative (should not happen)
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Jun 1 2004
- *
+ * Failure: Negative (should not happen)
*-------------------------------------------------------------------------
*/
size_t
@@ -667,21 +587,15 @@ H5F_rdcc_nslots(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_rdcc_nbytes
+ * Function: H5F_rdcc_nbytes
*
- * Purpose: Replaced a macro to retrieve the raw data cache number of bytes,
- * now that the generic properties are being used to store
- * the values.
+ * Purpose: Replaced a macro to retrieve the raw data cache number of bytes,
+ * now that the generic properties are being used to store
+ * the values.
*
- * Return: Success: Non-negative, and the raw data cache number of
+ * Return: Success: Non-negative, and the raw data cache number of
* of bytes is returned.
- *
- * Failure: Negative (should not happen)
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Jun 1 2004
- *
+ * Failure: Negative (should not happen)
*-------------------------------------------------------------------------
*/
size_t
@@ -698,21 +612,15 @@ H5F_rdcc_nbytes(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_rdcc_w0
+ * Function: H5F_rdcc_w0
*
- * Purpose: Replaced a macro to retrieve the raw data cache 'w0' value
- * now that the generic properties are being used to store
- * the values.
+ * Purpose: Replaced a macro to retrieve the raw data cache 'w0' value
+ * now that the generic properties are being used to store
+ * the values.
*
- * Return: Success: Non-negative, and the raw data cache 'w0' value
+ * Return: Success: Non-negative, and the raw data cache 'w0' value
* is returned.
- *
- * Failure: Negative (should not happen)
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Jun 2 2004
- *
+ * Failure: Negative (should not happen)
*-------------------------------------------------------------------------
*/
double
@@ -729,17 +637,13 @@ H5F_rdcc_w0(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_base_addr
- *
- * Purpose: Quick and dirty routine to retrieve the file's 'base_addr' value
- * (Mainly added to stop non-file routines from poking about in the
- * H5F_t data structure)
- *
- * Return: Non-negative on success/Negative on failure
+ * Function: H5F_get_base_addr
*
- * Programmer: Raymond Lu <slu@ncsa.uiuc.edu>
- * December 20, 2002
+ * Purpose: Quick and dirty routine to retrieve the file's 'base_addr' value
+ * (Mainly added to stop non-file routines from poking about in the
+ * H5F_t data structure)
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
haddr_t
@@ -757,21 +661,15 @@ H5F_get_base_addr(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_grp_btree_shared
+ * Function: H5F_grp_btree_shared
*
- * Purpose: Replaced a macro to retrieve the shared B-tree node info
- * now that the generic properties are being used to store
- * the values.
+ * Purpose: Replaced a macro to retrieve the shared B-tree node info
+ * now that the generic properties are being used to store
+ * the values.
*
- * Return: Success: Non-void, and the shared B-tree node info
+ * Return: Success: Non-void, and the shared B-tree node info
* is returned.
- *
- * Failure: void (should not happen)
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Jul 5 2004
- *
+ * Failure: void (should not happen)
*-------------------------------------------------------------------------
*/
H5UC_t *
@@ -788,21 +686,15 @@ H5F_grp_btree_shared(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_sieve_buf_size
+ * Function: H5F_sieve_buf_size
*
- * Purpose: Replaced a macro to retrieve the dataset sieve buffer size
- * now that the generic properties are being used to store
- * the values.
+ * Purpose: Replaced a macro to retrieve the dataset sieve buffer size
+ * now that the generic properties are being used to store
+ * the values.
*
- * Return: Success: Non-void, and the dataset sieve buffer size
+ * Return: Success: Non-void, and the dataset sieve buffer size
* is returned.
- *
- * Failure: void (should not happen)
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Jul 8 2005
- *
+ * Failure: void (should not happen)
*-------------------------------------------------------------------------
*/
size_t
@@ -819,21 +711,14 @@ H5F_sieve_buf_size(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_gc_ref
+ * Function: H5F_gc_ref
*
- * Purpose: Replaced a macro to retrieve the "garbage collect
- * references flag" now that the generic properties are being used
- * to store the values.
- *
- * Return: Success: The "garbage collect references flag"
+ * Purpose: Replaced a macro to retrieve the "garbage collect
+ * references flag" now that the generic properties are being used
+ * to store the values.
+ e
* is returned.
- *
- * Failure: (should not happen)
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Jul 8 2005
- *
+ * Failure: (should not happen)
*-------------------------------------------------------------------------
*/
unsigned
@@ -850,18 +735,12 @@ H5F_gc_ref(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_fc_degree
+ * Function: H5F_get_fc_degree
*
- * Purpose: Retrieve the 'file close degree' for the file.
- *
- * Return: Success: Non-negative, the 'file close degree'
- *
- * Failure: (can't happen)
- *
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Mar 5 2007
+ * Purpose: Retrieve the 'file close degree' for the file.
*
+ * Return: Success: Non-negative, the 'file close degree'
+ * Failure: (can't happen)
*-------------------------------------------------------------------------
*/
H5F_close_degree_t
@@ -886,10 +765,6 @@ H5F_get_fc_degree(const H5F_t *f)
* Return: Success: Flag indicating whether the evict-on-close
* property was set for the file.
* Failure: (can't happen)
- *
- * Programmer: Dana Robinson
- * Spring 2016
- *
*-------------------------------------------------------------------------
*/
hbool_t
@@ -906,18 +781,12 @@ H5F_get_evict_on_close(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_store_msg_crt_idx
- *
- * Purpose: Retrieve the 'store message creation index' flag for the file.
- *
- * Return: Success: Non-negative, the 'store message creation index' flag
- *
- * Failure: (can't happen)
+ * Function: H5F_store_msg_crt_idx
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Mar 6 2007
+ * Purpose: Retrieve the 'store message creation index' flag for the file.
*
+ * Return: Success: Non-negative, the 'store message creation index' flag
+ * Failure: (can't happen)
*-------------------------------------------------------------------------
*/
hbool_t
@@ -934,17 +803,12 @@ H5F_store_msg_crt_idx(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_has_feature
+ * Function: H5F_has_feature
*
- * Purpose: Check if a file has a particular feature enabled
- *
- * Return: Success: Non-negative - TRUE or FALSE
- * Failure: Negative (should not happen)
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * May 31 2004
+ * Purpose: Check if a file has a particular feature enabled
*
+ * Return: Success: Non-negative - TRUE or FALSE
+ * Failure: Negative (should not happen)
*-------------------------------------------------------------------------
*/
hbool_t
@@ -961,17 +825,13 @@ H5F_has_feature(const H5F_t *f, unsigned feature)
/*-------------------------------------------------------------------------
- * Function: H5F_get_driver_id
- *
- * Purpose: Quick and dirty routine to retrieve the file's 'driver_id' value
- * (Mainly added to stop non-file routines from poking about in the
- * H5F_t data structure)
- *
- * Return: 'driver_id' on success/abort on failure (shouldn't fail)
+ * Function: H5F_get_driver_id
*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
- * October 10, 2000
+ * Purpose: Quick and dirty routine to retrieve the file's 'driver_id' value
+ * (Mainly added to stop non-file routines from poking about in the
+ * H5F_t data structure)
*
+ * Return: 'driver_id' on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
*/
hid_t
@@ -989,23 +849,19 @@ H5F_get_driver_id(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_fileno
- *
- * Purpose: Quick and dirty routine to retrieve the file's 'fileno' value
- * (Mainly added to stop non-file routines from poking about in the
- * H5F_t data structure)
- *
- * Return: Non-negative on success/Negative on failure
+ * Function: H5F_get_fileno
*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
- * March 27, 2002
+ * Purpose: Quick and dirty routine to retrieve the file's 'fileno' value
+ * (Mainly added to stop non-file routines from poking about in the
+ * H5F_t data structure)
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
H5F_get_fileno(const H5F_t *f, unsigned long *filenum)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
@@ -1016,7 +872,7 @@ H5F_get_fileno(const H5F_t *f, unsigned long *filenum)
/* Retrieve the file's serial number */
if(H5FD_get_fileno(f->shared->lf, filenum) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "can't retrieve fileno")
+ HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "can't retrieve fileno")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1024,21 +880,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_get_eoa
- *
- * Purpose: Quick and dirty routine to retrieve the file's 'eoa' value
- *
- * Return: Non-negative on success/Negative on failure
+ * Function: H5F_get_eoa
*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
- * June 1, 2004
+ * Purpose: Quick and dirty routine to retrieve the file's 'eoa' value
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
haddr_t
H5F_get_eoa(const H5F_t *f, H5FD_mem_t type)
{
- haddr_t ret_value = HADDR_UNDEF; /* Return value */
+ haddr_t ret_value = HADDR_UNDEF; /* Return value */
FUNC_ENTER_NOAPI(HADDR_UNDEF)
@@ -1047,7 +899,7 @@ H5F_get_eoa(const H5F_t *f, H5FD_mem_t type)
/* Dispatch to driver */
if(HADDR_UNDEF == (ret_value = H5FD_get_eoa(f->shared->lf, type)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1062,10 +914,6 @@ done:
*
* Return: Success: Non-negative.
* Failure: negative.
- *
- * Programmer: Raymond Lu
- * Sep. 16, 2002
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1089,18 +937,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_is_tmp_addr
- *
- * Purpose: Quick and dirty routine to determine if an address is in
- * the 'temporary' file space.
- * (Mainly added to stop non-file routines from poking about in the
- * H5F_t data structure)
- *
- * Return: TRUE/FALSE on success/abort on failure (shouldn't fail)
+ * Function: H5F_is_tmp_addr
*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
- * June 11, 2009
+ * Purpose: Quick and dirty routine to determine if an address is in
+ * the 'temporary' file space.
+ * (Mainly added to stop non-file routines from poking about in the
+ * H5F_t data structure)
*
+ * Return: TRUE/FALSE on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
*/
hbool_t
@@ -1117,18 +961,14 @@ H5F_is_tmp_addr(const H5F_t *f, haddr_t addr)
/*-------------------------------------------------------------------------
- * Function: H5F_use_tmp_space
- *
- * Purpose: Quick and dirty routine to determine if using temporary
- * file space is allowed for this file.
- * (Mainly added to stop non-file routines from poking about in the
- * H5F_t data structure)
- *
- * Return: TRUE/FALSE on success/abort on failure (shouldn't fail)
+ * Function: H5F_use_tmp_space
*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
- * July 1, 2009
+ * Purpose: Quick and dirty routine to determine if using temporary
+ * file space is allowed for this file.
+ * (Mainly added to stop non-file routines from poking about in the
+ * H5F_t data structure)
*
+ * Return: TRUE/FALSE on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
*/
hbool_t
@@ -1146,17 +986,12 @@ H5F_use_tmp_space(const H5F_t *f)
#ifdef H5_HAVE_PARALLEL
/*-------------------------------------------------------------------------
- * Function: H5F_coll_md_read
- *
- * Purpose: Retrieve the 'collective metadata reads' flag for the file.
- *
- * Return: Success: Non-negative, the 'collective metadata reads' flag
- * Failure: (can't happen)
+ * Function: H5F_coll_md_read
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Feb 10 2016
+ * Purpose: Retrieve the 'collective metadata reads' flag for the file.
*
+ * Return: Success: Non-negative, the 'collective metadata reads' flag
+ * Failure: (can't happen)
*-------------------------------------------------------------------------
*/
H5P_coll_md_read_flag_t
@@ -1173,18 +1008,14 @@ H5F_coll_md_read(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_use_mdc_logging
+ * Function: H5F_use_mdc_logging
*
- * Purpose: Quick and dirty routine to determine if using MDC logging
- * is enabled for this file.
- * (Mainly added to stop non-file routines from poking about in the
- * H5F_t data structure)
- *
- * Return: TRUE/FALSE on success/abort on failure (shouldn't fail)
- *
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
- * June 5, 2016
+ * Purpose: Quick and dirty routine to determine if using MDC logging
+ * is enabled for this file.
+ * (Mainly added to stop non-file routines from poking about in the
+ * H5F_t data structure)
*
+ * Return: TRUE/FALSE on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
*/
hbool_t
@@ -1201,18 +1032,14 @@ H5F_use_mdc_logging(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_start_mdc_log_on_access
- *
- * Purpose: Quick and dirty routine to determine if we should start MDC
- * logging on access for this file.
- * (Mainly added to stop non-file routines from poking about in the
- * H5F_t data structure)
- *
- * Return: TRUE/FALSE on success/abort on failure (shouldn't fail)
+ * Function: H5F_start_mdc_log_on_access
*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
- * June 5, 2016
+ * Purpose: Quick and dirty routine to determine if we should start MDC
+ * logging on access for this file.
+ * (Mainly added to stop non-file routines from poking about in the
+ * H5F_t data structure)
*
+ * Return: TRUE/FALSE on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
*/
hbool_t
@@ -1229,18 +1056,14 @@ H5F_start_mdc_log_on_access(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_mdc_log_location
+ * Function: H5F_mdc_log_location
*
- * Purpose: Quick and dirty routine to retrieve the MDC log location
- * for this file.
- * (Mainly added to stop non-file routines from poking about in the
- * H5F_t data structure)
- *
- * Return: TRUE/FALSE on success/abort on failure (shouldn't fail)
- *
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
- * June 5, 2016
+ * Purpose: Quick and dirty routine to retrieve the MDC log location
+ * for this file.
+ * (Mainly added to stop non-file routines from poking about in the
+ * H5F_t data structure)
*
+ * Return: TRUE/FALSE on success/abort on failure (shouldn't fail)
*-------------------------------------------------------------------------
*/
char *
@@ -1257,16 +1080,12 @@ H5F_mdc_log_location(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_alignment
+ * Function: H5F_get_alignment
*
- * Purpose: Retrieve the 'alignment' for the file.
- *
- * Return: Success: Non-negative, the 'alignment'
- *
- * Failure: (can't happen)
- *
- * Programmer: Vailin Choi; Dec 2012
+ * Purpose: Retrieve the 'alignment' for the file.
*
+ * Return: Success: Non-negative, the 'alignment'
+ * Failure: (can't happen)
*-------------------------------------------------------------------------
*/
hsize_t
@@ -1283,16 +1102,12 @@ H5F_get_alignment(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_threshold
- *
- * Purpose: Retrieve the 'threshold' for alignment in the file.
+ * Function: H5F_get_threshold
*
- * Return: Success: Non-negative, the 'threshold'
- *
- * Failure: (can't happen)
- *
- * Programmer: Vailin Choi; Dec 2012
+ * Purpose: Retrieve the 'threshold' for alignment in the file.
*
+ * Return: Success: Non-negative, the 'threshold'
+ * Failure: (can't happen)
*-------------------------------------------------------------------------
*/
hsize_t
@@ -1309,16 +1124,12 @@ H5F_get_threshold(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_pgend_meta_thres
- *
- * Purpose: Retrieve the 'page end meta threshold size' for the file.
- *
- * Return: Success: Non-negative, the 'pgend_meta_thres'
+ * Function: H5F_get_pgend_meta_thres
*
- * Failure: (can't happen)
- *
- * Programmer: Vailin Choi; Dec 2012
+ * Purpose: Retrieve the 'page end meta threshold size' for the file.
*
+ * Return: Success: Non-negative, the 'pgend_meta_thres'
+ * Failure: (can't happen)
*-------------------------------------------------------------------------
*/
hsize_t
@@ -1335,13 +1146,12 @@ H5F_get_pgend_meta_thres(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_point_of_no_return
- *
- * Purpose: Retrieve the 'point of no return' value for the file.
+ * Function: H5F_get_point_of_no_return
*
- * Return: Success: Non-negative, the 'point_of_no_return'
- * Failure: (can't happen)
+ * Purpose: Retrieve the 'point of no return' value for the file.
*
+ * Return: Success: Non-negative, the 'point_of_no_return'
+ * Failure: (can't happen)
*-------------------------------------------------------------------------
*/
hbool_t
@@ -1358,13 +1168,12 @@ H5F_get_point_of_no_return(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_first_alloc_dealloc
+ * Function: H5F_get_first_alloc_dealloc
*
- * Purpose: Retrieve the 'first alloc / dealloc' value for the file.
- *
- * Return: Success: Non-negative, the 'first_alloc_dealloc'
- * Failure: (can't happen)
+ * Purpose: Retrieve the 'first alloc / dealloc' value for the file.
*
+ * Return: Success: Non-negative, the 'first_alloc_dealloc'
+ * Failure: (can't happen)
*-------------------------------------------------------------------------
*/
hbool_t
@@ -1381,13 +1190,12 @@ H5F_get_first_alloc_dealloc(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_eoa_pre_fsm_fsalloc
- *
- * Purpose: Retrieve the 'EOA pre-FSM fsalloc' value for the file.
+ * Function: H5F_get_eoa_pre_fsm_fsalloc
*
- * Return: Success: Non-negative, the 'EOA pre-FSM fsalloc'
- * Failure: (can't happen)
+ * Purpose: Retrieve the 'EOA pre-FSM fsalloc' value for the file.
*
+ * Return: Success: Non-negative, the 'EOA pre-FSM fsalloc'
+ * Failure: (can't happen)
*-------------------------------------------------------------------------
*/
hbool_t
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index d6ca323..4c12cb9 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -833,6 +833,10 @@ H5F__super_read(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t initial
hbool_t rw = ((rw_flags & H5AC__READ_ONLY_FLAG) == 0);
H5O_mdci_t mdci_msg;
+ /* Message exists but file format version high bound does not allow it */
+ if(f->shared->high_bound < H5F_LIBVER_V110)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file format version out of bound for metadata cache image")
+
/* if the metadata cache image superblock extension message exists,
* read its contents and pass the data on to the metadata cache.
* Given this data, the cache will load and decode the metadata
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 76e2c4b..b335624 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -640,7 +640,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr,
while(lt < rt) {
idx = (int)((lt + rt) / 2);
if((s = (const char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)) == NULL)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get symbol table name")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get symbol table name")
/* Check if symbol is already present */
if(0 == (cmp = HDstrcmp(udata->common.name, s)))
@@ -802,8 +802,8 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
const char *s; /* Pointer to string in local heap */
idx = (lt + rt) / 2;
- if((s = H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)) == NULL)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get symbol table name")
+ if((s = (const char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)) == NULL)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get symbol table name")
cmp = HDstrcmp(udata->common.name, s);
if(cmp < 0)
rt = idx;
diff --git a/src/H5MM.c b/src/H5MM.c
index ee3b28f..866dfbe 100644
--- a/src/H5MM.c
+++ b/src/H5MM.c
@@ -268,8 +268,6 @@ H5MM_malloc(size_t size)
{
void *ret_value = NULL;
- HDassert(size);
-
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -357,8 +355,6 @@ H5MM_calloc(size_t size)
{
void *ret_value = NULL;
- HDassert(size);
-
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -407,8 +403,6 @@ H5MM_realloc(void *mem, size_t size)
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
- HDassert(mem || size);
-
if(NULL == mem && 0 == size)
/* Not defined in the standard, return NULL */
ret_value = NULL;
@@ -454,7 +448,7 @@ H5MM_realloc(void *mem, size_t size)
* NULL is an acceptable value for the input string.
*
* Return: Success: Pointer to a new string (NULL if s is NULL).
- * Failure: abort()
+ * Failure: NULL
*
* Programmer: Robb Matzke
* Jul 10 1997
diff --git a/src/H5O.c b/src/H5O.c
index ab5d07b..109bf99 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -13,11 +13,9 @@
/*-------------------------------------------------------------------------
*
- * Created: H5O.c
- * Aug 5 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Created: H5O.c
*
- * Purpose: Object header routines.
+ * Purpose: Public object header routines
*
*-------------------------------------------------------------------------
*/
@@ -32,19 +30,12 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* File access */
-#include "H5FLprivate.h" /* Free lists */
-#include "H5FOprivate.h" /* File objects */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Lprivate.h" /* Links */
-#include "H5MFprivate.h" /* File memory management */
-#ifdef H5O_ENABLE_BOGUS
-#include "H5MMprivate.h" /* Memory management */
-#endif /* H5O_ENABLE_BOGUS */
-#include "H5Opkg.h" /* Object headers */
-#include "H5SMprivate.h" /* Shared object header messages */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
+#include "H5Opkg.h" /* Object headers */
/****************/
@@ -56,17 +47,6 @@
/* Local Typedefs */
/******************/
-/* User data for recursive traversal over objects from a group */
-typedef struct {
- hid_t obj_id; /* The ID for the starting group */
- H5G_loc_t *start_loc; /* Location of starting group */
- hid_t lapl_id; /* LAPL for walking across links */
- hid_t dxpl_id; /* DXPL for operations */
- H5SL_t *visited; /* Skip list for tracking visited nodes */
- H5O_iterate_t op; /* Application callback */
- void *op_data; /* Application's op data */
-} H5O_iter_visit_ud_t;
-
/********************/
/* Package Typedefs */
@@ -77,144 +57,21 @@ typedef struct {
/* Local Prototypes */
/********************/
-static herr_t H5O_delete_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh);
-static herr_t H5O_obj_type_real(H5O_t *oh, H5O_type_t *obj_type);
-static herr_t H5O_visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
- H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id,
- hid_t dxpl_id);
-static herr_t H5O_get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr);
-static const H5O_obj_class_t *H5O_obj_class_real(H5O_t *oh);
-
/*********************/
/* Package Variables */
/*********************/
-/* Package initialization variable */
-hbool_t H5_PKG_INIT_VAR = FALSE;
-
-/* Header message ID to class mapping */
-
-/* Remember to increment H5O_MSG_TYPES in H5Opkg.h when adding a new
- * message.
- */
-
-const H5O_msg_class_t *const H5O_msg_class_g[] = {
- H5O_MSG_NULL, /*0x0000 Null */
- H5O_MSG_SDSPACE, /*0x0001 Dataspace */
- H5O_MSG_LINFO, /*0x0002 Link information */
- H5O_MSG_DTYPE, /*0x0003 Datatype */
- H5O_MSG_FILL, /*0x0004 Old data storage -- fill value */
- H5O_MSG_FILL_NEW, /*0x0005 New data storage -- fill value */
- H5O_MSG_LINK, /*0x0006 Link */
- H5O_MSG_EFL, /*0x0007 Data storage -- external data files */
- H5O_MSG_LAYOUT, /*0x0008 Data Layout */
-#ifdef H5O_ENABLE_BOGUS
- H5O_MSG_BOGUS_VALID, /*0x0009 "Bogus valid" (for testing) */
-#else /* H5O_ENABLE_BOGUS */
- NULL, /*0x0009 "Bogus valid" (for testing) */
-#endif /* H5O_ENABLE_BOGUS */
- H5O_MSG_GINFO, /*0x000A Group information */
- H5O_MSG_PLINE, /*0x000B Data storage -- filter pipeline */
- H5O_MSG_ATTR, /*0x000C Attribute */
- H5O_MSG_NAME, /*0x000D Object name */
- H5O_MSG_MTIME, /*0x000E Object modification date and time */
- H5O_MSG_SHMESG, /*0x000F File-wide shared message table */
- H5O_MSG_CONT, /*0x0010 Object header continuation */
- H5O_MSG_STAB, /*0x0011 Symbol table */
- H5O_MSG_MTIME_NEW, /*0x0012 New Object modification date and time */
- H5O_MSG_BTREEK, /*0x0013 Non-default v1 B-tree 'K' values */
- H5O_MSG_DRVINFO, /*0x0014 Driver info settings */
- H5O_MSG_AINFO, /*0x0015 Attribute information */
- H5O_MSG_REFCOUNT, /*0x0016 Object's ref. count */
- H5O_MSG_FSINFO, /*0x0017 Free-space manager info */
- H5O_MSG_MDCI, /*0x0018 Metadata cache image */
- H5O_MSG_UNKNOWN, /*0x0019 Placeholder for unknown message */
-#ifdef H5O_ENABLE_BOGUS
- H5O_MSG_BOGUS_INVALID, /*0x001A "Bogus invalid" (for testing) */
-#else /* H5O_ENABLE_BOGUS */
- NULL, /*0x001A "Bogus invalid" (for testing) */
-#endif /* H5O_ENABLE_BOGUS */
-};
-
-
-/* Declare a free list to manage the H5O_t struct */
-H5FL_DEFINE(H5O_t);
-
-/* Declare a free list to manage the H5O_mesg_t sequence information */
-H5FL_SEQ_DEFINE(H5O_mesg_t);
-
-/* Declare a free list to manage the H5O_chunk_t sequence information */
-H5FL_SEQ_DEFINE(H5O_chunk_t);
-
-/* Declare a free list to manage the chunk image information */
-H5FL_BLK_DEFINE(chunk_image);
-
-/* Declare external the free list for H5O_cont_t sequences */
-H5FL_SEQ_EXTERN(H5O_cont_t);
-
/*****************************/
/* Library Private Variables */
/*****************************/
-/* Declare external the free list for time_t's */
-H5FL_EXTERN(time_t);
-
-/* Declare external the free list for H5_obj_t's */
-H5FL_EXTERN(H5_obj_t);
-
/*******************/
/* Local Variables */
/*******************/
-/* Header object ID to class mapping */
-/*
- * Initialize the object class info table. Begin with the most general types
- * and end with the most specific. For instance, any object that has a
- * datatype message is a datatype but only some of them are datasets.
- */
-static const H5O_obj_class_t *const H5O_obj_class_g[] = {
- H5O_OBJ_DATATYPE, /* Datatype object (H5O_TYPE_NAMED_DATATYPE - 2) */
- H5O_OBJ_DATASET, /* Dataset object (H5O_TYPE_DATASET - 1) */
- H5O_OBJ_GROUP, /* Group object (H5O_TYPE_GROUP - 0) */
-};
-
-/* Format version bounds for object header */
-static const unsigned H5O_obj_ver_bounds[] = {
- H5O_VERSION_1, /* H5F_LIBVER_EARLIEST */
- H5O_VERSION_2, /* H5F_LIBVER_V18 */
- H5O_VERSION_LATEST /* H5F_LIBVER_LATEST */
-};
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O__init_package
- *
- * Purpose: Initialize information specific to H5O interface.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Thursday, January 18, 2007
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O__init_package(void)
-{
- FUNC_ENTER_PACKAGE_NOERR
-
- /* H5O interface sanity checks */
- HDcompile_assert(H5O_MSG_TYPES == NELMTS(H5O_msg_class_g));
- HDcompile_assert(sizeof(H5O_fheap_id_t) == H5O_FHEAP_ID_LEN);
-
- HDcompile_assert(H5O_UNKNOWN_ID < H5O_MSG_TYPES);
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O__init_package() */
-
/*-------------------------------------------------------------------------
* Function: H5Oopen
@@ -309,11 +166,11 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
/* Verify access property list and get correct dxpl */
if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0)
@@ -717,11 +574,11 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!group_name || !*group_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(!oinfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
@@ -965,15 +822,15 @@ H5Ovisit(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
/* Check args */
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(!op)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
/* Call internal object visitation routine */
if((ret_value = H5O_visit(obj_id, ".", idx_type, order, op, op_data, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_read_dxpl_id)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -1027,9 +884,9 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
if(!obj_name || !*obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
if(!op)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
@@ -1039,7 +896,7 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* Call internal object visitation routine */
if((ret_value = H5O_visit(loc_id, obj_name, idx_type, order, op, op_data, lapl_id, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -1219,2559 +1076,3 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Oare_mdc_flushes_disabled() */
-
-/*-------------------------------------------------------------------------
- * Function: H5O_set_version
- *
- * Purpose: Sets the correct version to encode the object header.
- * Chooses the oldest version possible, unless the file's
- * low bound indicates otherwise.
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Jul 17 2007
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_set_version(H5F_t *f, H5O_t *oh, uint8_t oh_flags, hbool_t store_msg_crt_idx)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* check arguments */
- HDassert(f);
- HDassert(oh);
-
- /* Set the correct version to encode object header with */
- if(store_msg_crt_idx || (oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED))
- oh->version = H5O_VERSION_2;
- else
- oh->version = H5O_VERSION_1;
-
- /* Upgrade to the version indicated by the file's low bound if higher */
- oh->version = MAX(oh->version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]);
-
- /* File bound check */
- if(oh->version > H5O_obj_ver_bounds[H5F_HIGH_BOUND(f)])
- HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "object header version out of bounds")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_set_version() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_create
- *
- * Purpose: Creates a new object header. Allocates space for it and
- * then calls an initialization function. The object header
- * is opened for write access and should eventually be
- * closed by calling H5O_close().
- *
- * Return: Success: Non-negative, the ENT argument contains
- * information about the object header,
- * including its address.
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Aug 5 1997
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, size_t initial_rc,
- hid_t ocpl_id, H5O_loc_t *loc/*out*/)
-{
- H5P_genplist_t *oc_plist; /* Object creation property list */
- H5O_t *oh = NULL; /* Object header created */
- haddr_t oh_addr; /* Address of initial object header */
- size_t oh_size; /* Size of initial object header */
- hbool_t store_msg_crt_idx; /* Whether to always store message creation indices for this file */
- uint8_t oh_flags; /* Object header's initial status flags */
- unsigned insert_flags = H5AC__NO_FLAGS_SET; /* Flags for inserting object header into cache */
- herr_t ret_value = SUCCEED; /* return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* check args */
- HDassert(f);
- HDassert(loc);
- HDassert(TRUE == H5P_isa_class(ocpl_id, H5P_OBJECT_CREATE));
-
- /* Check for invalid access request */
- if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR))
- HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "no write intent on file")
-
- /* Make certain we allocate at least a reasonable size for the object header */
- size_hint = H5O_ALIGN_F(f, MAX(H5O_MIN_SIZE, size_hint));
-
- /* Get the property list */
- if(NULL == (oc_plist = (H5P_genplist_t *)H5I_object(ocpl_id)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property list")
-
- /* Get any object header status flags set by properties */
- if(H5P_get(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &oh_flags) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object header flags")
-
- /* Allocate the object header and zero out header fields */
- if(NULL == (oh = H5FL_CALLOC(H5O_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
-
- /* Initialize file-specific information for object header */
- store_msg_crt_idx = H5F_STORE_MSG_CRT_IDX(f);
-
- if(H5O_set_version(f, oh, oh_flags, store_msg_crt_idx) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set version of objecdt header")
-
- oh->sizeof_size = H5F_SIZEOF_SIZE(f);
- oh->sizeof_addr = H5F_SIZEOF_ADDR(f);
- oh->swmr_write = !!(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE);
-#ifdef H5O_ENABLE_BAD_MESG_COUNT
- /* Check whether the "bad message count" property is set */
- if(H5P_exist_plist(oc_plist, H5O_BAD_MESG_COUNT_NAME) > 0) {
- /* Retrieve bad message count flag */
- if(H5P_get(oc_plist, H5O_BAD_MESG_COUNT_NAME, &oh->store_bad_mesg_count) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get bad message count flag")
- } /* end if */
-#endif /* H5O_ENABLE_BAD_MESG_COUNT */
-
- /* Create object header proxy if doing SWMR writes */
- if(oh->swmr_write) {
- /* Create virtual entry, for use as proxy */
- if(NULL == (oh->proxy = H5AC_proxy_entry_create()))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create object header proxy")
- } /* end if */
- else
- oh->proxy = NULL;
-
- /* Set initial status flags */
- oh->flags = oh_flags;
-
- /* Initialize version-specific fields */
- if(oh->version > H5O_VERSION_1) {
- /* Initialize all time fields with current time, if we are storing them */
- if(oh->flags & H5O_HDR_STORE_TIMES)
- oh->atime = oh->mtime = oh->ctime = oh->btime = H5_now();
- else
- oh->atime = oh->mtime = oh->ctime = oh->btime = 0;
-
- /* Make certain attribute creation order tracking is enabled if
- * attributes can be shared in this file.
- */
- if(store_msg_crt_idx)
- oh->flags |= H5O_HDR_ATTR_CRT_ORDER_TRACKED;
-
- /* Retrieve attribute storage phase change values from property list */
- if(H5P_get(oc_plist, H5O_CRT_ATTR_MAX_COMPACT_NAME, &oh->max_compact) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get max. # of compact attributes")
- if(H5P_get(oc_plist, H5O_CRT_ATTR_MIN_DENSE_NAME, &oh->min_dense) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get min. # of dense attributes")
-
- /* Check for non-default attribute storage phase change values */
- if(oh->max_compact != H5O_CRT_ATTR_MAX_COMPACT_DEF || oh->min_dense != H5O_CRT_ATTR_MIN_DENSE_DEF)
- oh->flags |= H5O_HDR_ATTR_STORE_PHASE_CHANGE;
-
- /* Determine correct value for chunk #0 size bits */
-/* Avoid compiler warning on 32-bit machines */
-#if H5_SIZEOF_SIZE_T > H5_SIZEOF_INT32_T
- if(size_hint > 4294967295UL)
- oh->flags |= H5O_HDR_CHUNK0_8;
- else
-#endif /* H5_SIZEOF_SIZE_T > H5_SIZEOF_INT32_T */
- if(size_hint > 65535)
- oh->flags |= H5O_HDR_CHUNK0_4;
- else if(size_hint > 255)
- oh->flags |= H5O_HDR_CHUNK0_2;
- } /* end if */
- else {
- /* Reset unused time fields */
- oh->atime = oh->mtime = oh->ctime = oh->btime = 0;
- } /* end else */
-
- /* Compute total size of initial object header */
- /* (i.e. object header prefix and first chunk) */
- oh_size = (size_t)H5O_SIZEOF_HDR(oh) + size_hint;
-
- /* Allocate disk space for header and first chunk */
- if(HADDR_UNDEF == (oh_addr = H5MF_alloc(f, H5FD_MEM_OHDR, dxpl_id, (hsize_t)oh_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for object header")
-
- /* Create the chunk list */
- oh->nchunks = oh->alloc_nchunks = 1;
- if(NULL == (oh->chunk = H5FL_SEQ_MALLOC(H5O_chunk_t, (size_t)oh->alloc_nchunks)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
-
- /* Initialize the first chunk */
- oh->chunk[0].addr = oh_addr;
- oh->chunk[0].size = oh_size;
- oh->chunk[0].gap = 0;
-
- /* Allocate enough space for the first chunk */
- /* (including space for serializing the object header prefix */
- if(NULL == (oh->chunk[0].image = H5FL_BLK_CALLOC(chunk_image, oh_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- oh->chunk[0].chunk_proxy = NULL;
-
- /* Put magic # for object header in first chunk */
- if(oh->version > H5O_VERSION_1)
- HDmemcpy(oh->chunk[0].image, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
-
- /* Create the message list */
- oh->nmesgs = 1;
- oh->alloc_nmesgs = H5O_NMESGS;
- if(NULL == (oh->mesg = H5FL_SEQ_CALLOC(H5O_mesg_t, oh->alloc_nmesgs)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
-
- /* Initialize the initial "null" message, covering the entire first chunk */
- oh->mesg[0].type = H5O_MSG_NULL;
- oh->mesg[0].dirty = TRUE;
- oh->mesg[0].native = NULL;
- oh->mesg[0].raw = oh->chunk[0].image + (H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh)) + H5O_SIZEOF_MSGHDR_OH(oh);
- oh->mesg[0].raw_size = size_hint - (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
- oh->mesg[0].chunkno = 0;
-
- /* Check for non-zero initial refcount on the object header */
- if(initial_rc > 0) {
- /* Set the initial refcount & pin the header when its inserted */
- oh->rc = initial_rc;
- insert_flags |= H5AC__PIN_ENTRY_FLAG;
- } /* end if */
-
- /* Set metadata tag in dxpl_id */
- H5_BEGIN_TAG(dxpl_id, oh_addr, FAIL);
-
- /* Cache object header */
- if(H5AC_insert_entry(f, dxpl_id, H5AC_OHDR, oh_addr, oh, insert_flags) < 0)
- HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header")
-
- /* Reset object header pointer, now that it's been inserted into the cache */
- oh = NULL;
-
- /* Reset metadata tag in dxpl_id */
- H5_END_TAG(FAIL);
-
- /* Set up object location */
- loc->file = f;
- loc->addr = oh_addr;
-
- /* Open it */
- if(H5O_open(loc) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object header")
-
-done:
- if(ret_value < 0 && oh)
- if(H5O__free(oh) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_open
- *
- * Purpose: Opens an object header which is described by the symbol table
- * entry OBJ_ENT.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Monday, January 5, 1998
- *
- * Modification:
- * Raymond Lu
- * 5 November 2007
- * Turn off the holding file variable if it's on. When it's
- * needed, the caller will turn it on again.
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_open(H5O_loc_t *loc)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check args */
- HDassert(loc);
- HDassert(loc->file);
-
-#ifdef H5O_DEBUG
- if(H5DEBUG(O))
- HDfprintf(H5DEBUG(O), "> %a\n", loc->addr);
-#endif
-
- /* Turn off the variable for holding file or increment open-lock counters */
- if(loc->holding_file)
- loc->holding_file = FALSE;
- else
- H5F_INCR_NOPEN_OBJS(loc->file);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_open() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_open_name
- *
- * Purpose: Opens an object within an HDF5 file.
- *
- * Return: Success: An open object identifier
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * March 5 2007
- *
- *-------------------------------------------------------------------------
- */
-hid_t
-H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id, hbool_t app_ref)
-{
- H5G_loc_t obj_loc; /* Location used to open group */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
- hbool_t loc_found = FALSE; /* Entry at 'name' found */
- hid_t ret_value = FAIL;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check args */
- HDassert(loc);
- HDassert(name && *name);
-
- /* Set up opened group location to fill in */
- obj_loc.oloc = &obj_oloc;
- obj_loc.path = &obj_path;
- H5G_loc_reset(&obj_loc);
-
- /* Find the object's location */
- if(H5G_loc_find(loc, name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
- loc_found = TRUE;
-
- /* Open the object */
- if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, dxpl_id, app_ref)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
-
-done:
- if(ret_value < 0 && loc_found)
- if(H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_open_name() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_open_by_loc
- *
- * Purpose: Opens an object and returns an ID given its group loction.
- *
- * Return: Success: Open object identifier
- * Failure: Negative
- *
- * Programmer: James Laird
- * July 25 2006
- *
- *-------------------------------------------------------------------------
- */
-hid_t
-H5O_open_by_loc(const H5G_loc_t *obj_loc, hid_t lapl_id, hid_t dxpl_id, hbool_t app_ref)
-{
- const H5O_obj_class_t *obj_class; /* Class of object for location */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- HDassert(obj_loc);
-
- /* Get the object class for this location */
- if(NULL == (obj_class = H5O_obj_class(obj_loc->oloc, dxpl_id)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine object class")
-
- /* Call the object class's 'open' routine */
- HDassert(obj_class->open);
- if((ret_value = obj_class->open(obj_loc, lapl_id, dxpl_id, app_ref)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_open_by_loc() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_close
- *
- * Purpose: Closes an object header that was previously open.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Monday, January 5, 1998
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_close(H5O_loc_t *loc, hbool_t *file_closed /*out*/)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check args */
- HDassert(loc);
- HDassert(loc->file);
- HDassert(H5F_NOPEN_OBJS(loc->file) > 0);
-
- /* Set the file_closed flag to the default value.
- * This flag lets downstream code know if the file struct is
- * still accessible and/or likely to contain useful data.
- * It's needed by the evict-on-close code. Clients can ignore
- * this value by passing in NULL.
- */
- if(file_closed)
- *file_closed = FALSE;
-
- /* Decrement open-lock counters */
- H5F_DECR_NOPEN_OBJS(loc->file);
-
-#ifdef H5O_DEBUG
- if(H5DEBUG(O)) {
- if(H5F_FILE_ID(loc->file)< 0 && 1 == H5F_NREFS(loc->file))
- HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n",
- loc->addr,
- (unsigned long)H5F_NOPEN_OBJS(loc->file));
- else
- HDfprintf(H5DEBUG(O), "< %a\n", loc->addr);
- } /* end if */
-#endif
-
- /*
- * If the file open object count has reached the number of open mount points
- * (each of which has a group open in the file) attempt to close the file.
- */
- if(H5F_NOPEN_OBJS(loc->file) == H5F_NMOUNTS(loc->file))
- /* Attempt to close down the file hierarchy */
- if(H5F_try_close(loc->file, file_closed) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "problem attempting file close")
-
- /* Release location information */
- if(H5O_loc_free(loc) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "problem attempting to free location")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_close() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_link_oh
- *
- * Purpose: Adjust the link count for an open object header by adding
- * ADJUST to the link count.
- *
- * Return: Success: New link count
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Aug 5 1997
- *
- *-------------------------------------------------------------------------
- */
-int
-H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, hbool_t *deleted)
-{
- haddr_t addr = H5O_OH_GET_ADDR(oh); /* Object header address */
- int ret_value = -1; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* check args */
- HDassert(f);
- HDassert(oh);
- HDassert(deleted);
-
- /* Check for adjusting link count */
- if(adjust) {
- if(adjust < 0) {
- /* Check for too large of an adjustment */
- if((unsigned)(-adjust) > oh->nlink)
- HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "link count would be negative")
-
- /* Adjust the link count for the object header */
- oh->nlink = (unsigned)((int)oh->nlink + adjust);
-
- /* Mark object header as dirty in cache */
- if(H5AC_mark_entry_dirty(oh) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
-
- /* Check if the object should be deleted */
- if(oh->nlink == 0) {
- /* Check if the object is still open by the user */
- if(H5FO_opened(f, addr) != NULL) {
- /* Flag the object to be deleted when it's closed */
- if(H5FO_mark(f, addr, TRUE) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't mark object for deletion")
- } /* end if */
- else {
- /* Mark the object header for deletion */
- *deleted = TRUE;
- } /* end else */
- } /* end if */
- } /* end if */
- else {
- /* A new object, or one that will be deleted */
- if(0 == oh->nlink) {
- /* Check if the object is currently open, but marked for deletion */
- if(H5FO_marked(f, addr)) {
- /* Remove "delete me" flag on the object */
- if(H5FO_mark(f, addr, FALSE) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't mark object for deletion")
- } /* end if */
- } /* end if */
-
- /* Adjust the link count for the object header */
- oh->nlink = (unsigned)((int)oh->nlink + adjust);
-
- /* Mark object header as dirty in cache */
- if(H5AC_mark_entry_dirty(oh) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
- } /* end if */
-
- /* Check for operations on refcount message */
- if(oh->version > H5O_VERSION_1) {
- /* Check if the object has a refcount message already */
- if(oh->has_refcount_msg) {
- /* Check for removing refcount message */
- if(oh->nlink <= 1) {
- if(H5O_msg_remove_real(f, oh, H5O_MSG_REFCOUNT, H5O_ALL, NULL, NULL, TRUE, dxpl_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete refcount message")
- oh->has_refcount_msg = FALSE;
- } /* end if */
- /* Update refcount message with new link count */
- else {
- H5O_refcount_t refcount = oh->nlink;
-
- if(H5O_msg_write_real(f, dxpl_id, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update refcount message")
- } /* end else */
- } /* end if */
- else {
- /* Check for adding refcount message to object */
- if(oh->nlink > 1) {
- H5O_refcount_t refcount = oh->nlink;
-
- if(H5O_msg_append_real(f, dxpl_id, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to create new refcount message")
- oh->has_refcount_msg = TRUE;
- } /* end if */
- } /* end else */
- } /* end if */
- } /* end if */
-
- /* Set return value */
- ret_value = (int)oh->nlink;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_link_oh() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_link
- *
- * Purpose: Adjust the link count for an object header by adding
- * ADJUST to the link count.
- *
- * Return: Success: New link count
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Aug 5 1997
- *
- *-------------------------------------------------------------------------
- */
-int
-H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id)
-{
- H5O_t *oh = NULL;
- hbool_t deleted = FALSE; /* Whether the object was deleted */
- int ret_value = -1; /* Return value */
-
- FUNC_ENTER_NOAPI_TAG(dxpl_id, loc->addr, FAIL)
-
- /* check args */
- HDassert(loc);
- HDassert(loc->file);
- HDassert(H5F_addr_defined(loc->addr));
-
- /* Pin the object header */
- if(NULL == (oh = H5O_pin(loc, dxpl_id)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
-
- /* Call the "real" link routine */
- if((ret_value = H5O_link_oh(loc->file, adjust, dxpl_id, oh, &deleted)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust object link count")
-
-done:
- if(oh && H5O_unpin(oh) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
- if(ret_value >= 0 && deleted && H5O_delete(loc->file, dxpl_id, loc->addr) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file")
-
- FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
-} /* end H5O_link() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_protect
- *
- * Purpose: Wrapper around H5AC_protect for use during a H5O_protect->
- * H5O_msg_append->...->H5O_msg_append->H5O_unprotect sequence of calls
- * during an object's creation.
- *
- * Return: Success: Pointer to the object header structure for the
- * object.
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Dec 31 2002
- *
- *-------------------------------------------------------------------------
- */
-H5O_t *
-H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, unsigned prot_flags,
- hbool_t pin_all_chunks)
-{
- H5O_t *oh = NULL; /* Object header protected */
- H5O_cache_ud_t udata; /* User data for protecting object header */
- H5O_cont_msgs_t cont_msg_info; /* Continuation message info */
- unsigned file_intent; /* R/W intent on file */
- H5O_t *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI_TAG(dxpl_id, loc->addr, NULL)
-
- /* check args */
- HDassert(loc);
- HDassert(loc->file);
-
- /* prot_flags may only contain the H5AC__READ_ONLY_FLAG */
- HDassert((prot_flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0);
-
- /* Check for valid address */
- if(!H5F_addr_defined(loc->addr))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "address undefined")
-
- /* Check for write access on the file */
- file_intent = H5F_INTENT(loc->file);
- if((0 == (prot_flags & H5AC__READ_ONLY_FLAG)) && (0 == (file_intent & H5F_ACC_RDWR)))
- HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "no write intent on file")
-
- /* Construct the user data for protect callback */
- udata.made_attempt = FALSE;
- udata.v1_pfx_nmesgs = 0;
- udata.chunk0_size = 0;
- udata.oh = NULL;
- udata.common.f = loc->file;
- udata.common.dxpl_id = dxpl_id;
- udata.common.file_intent = file_intent;
- udata.common.merged_null_msgs = 0;
- HDmemset(&cont_msg_info, 0, sizeof(cont_msg_info));
- udata.common.cont_msg_info = &cont_msg_info;
- udata.common.addr = loc->addr;
-
- /* Lock the object header into the cache */
- if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, &udata, prot_flags)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header")
-
- /* Check if there are any continuation messages to process */
- if(cont_msg_info.nmsgs > 0) {
- size_t curr_msg; /* Current continuation message to process */
- H5O_chk_cache_ud_t chk_udata; /* User data for loading chunk */
-
- /* Sanity check - we should only have continuation messages to process
- * when the object header is actually loaded from the file.
- */
- HDassert(udata.made_attempt == TRUE);
- HDassert(cont_msg_info.msgs);
-
- /* Construct the user data for protecting chunks */
- chk_udata.decoding = TRUE;
- chk_udata.oh = oh;
- chk_udata.chunkno = UINT_MAX; /* Set to invalid value, for better error detection */
- chk_udata.common.f = loc->file;
- chk_udata.common.dxpl_id = dxpl_id;
- chk_udata.common.file_intent = file_intent;
- chk_udata.common.merged_null_msgs = udata.common.merged_null_msgs;
- chk_udata.common.cont_msg_info = &cont_msg_info;
-
- /* Read in continuation messages, until there are no more */
- /* (Note that loading chunks could increase the # of continuation
- * messages if new ones are found - QAK, 19/11/2016)
- */
- curr_msg = 0;
- while(curr_msg < cont_msg_info.nmsgs) {
- H5O_chunk_proxy_t *chk_proxy; /* Proxy for chunk, to bring it into memory */
-#ifndef NDEBUG
- size_t chkcnt = oh->nchunks; /* Count of chunks (for sanity checking) */
-#endif /* NDEBUG */
-
- /* Bring the chunk into the cache */
- /* (which adds to the object header) */
- chk_udata.common.addr = cont_msg_info.msgs[curr_msg].addr;
- chk_udata.size = cont_msg_info.msgs[curr_msg].size;
- if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR_CHK, cont_msg_info.msgs[curr_msg].addr, &chk_udata, prot_flags)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header chunk")
-
- /* Sanity check */
- HDassert(chk_proxy->oh == oh);
- HDassert(chk_proxy->chunkno == chkcnt);
- HDassert(oh->nchunks == (chkcnt + 1));
-
- /* Release the chunk from the cache */
- if(H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR_CHK, cont_msg_info.msgs[curr_msg].addr, chk_proxy, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header chunk")
-
- /* Advance to next continuation message */
- curr_msg++;
- } /* end while */
-
- /* Release any continuation messages built up */
- cont_msg_info.msgs = (H5O_cont_t *)H5FL_SEQ_FREE(H5O_cont_t, cont_msg_info.msgs);
-
- /* Pass back out some of the chunk's user data */
- udata.common.merged_null_msgs = chk_udata.common.merged_null_msgs;
- } /* end if */
-
- /* Check for incorrect # of object header messages, if we've just loaded
- * this object header from the file
- */
- if(udata.made_attempt) {
-/* Don't enforce the error on an incorrect # of object header messages bug
- * unless strict format checking is enabled. This allows for older
- * files, created with a version of the library that had a bug in tracking
- * the correct # of header messages to be read in without the library
- * erroring out here. -QAK
- */
-#ifdef H5_STRICT_FORMAT_CHECKS
- /* Check for incorrect # of messages in v1 object header */
- if(oh->version == H5O_VERSION_1 &&
- (oh->nmesgs + udata.common.merged_null_msgs) != udata.v1_pfx_nmesgs)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "corrupt object header - incorrect # of messages")
-#endif /* H5_STRICT_FORMAT_CHECKS */
- } /* end if */
-
-#ifdef H5O_DEBUG
-H5O_assert(oh);
-#endif /* H5O_DEBUG */
-
- /* Pin the other chunks also when requested, so that the object header
- * proxy can be set up.
- */
- if(pin_all_chunks && oh->nchunks > 1) {
- unsigned u; /* Local index variable */
-
- /* Sanity check */
- HDassert(oh->swmr_write);
-
- /* Iterate over chunks > 0 */
- for(u = 1; u < oh->nchunks; u++) {
- H5O_chunk_proxy_t *chk_proxy; /* Chunk proxy */
-
- /* Protect chunk */
- if(NULL == (chk_proxy = H5O_chunk_protect(loc->file, dxpl_id, oh, u)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header chunk")
-
- /* Pin chunk proxy*/
- if(H5AC_pin_protected_entry(chk_proxy) < 0 )
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, NULL, "unable to pin object header chunk")
-
- /* Unprotect chunk */
- if(H5O_chunk_unprotect(loc->file, dxpl_id, chk_proxy, FALSE) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to unprotect object header chunk")
-
- /* Preserve chunk proxy pointer for later */
- oh->chunk[u].chunk_proxy = chk_proxy;
- } /* end for */
-
- /* Set the flag for the unprotect */
- oh->chunks_pinned = TRUE;
- } /* end if */
-
- /* Set return value */
- ret_value = oh;
-
-done:
- if(ret_value == NULL && oh)
- if(H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
-
- FUNC_LEAVE_NOAPI_TAG(ret_value, NULL)
-} /* end H5O_protect() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_pin
- *
- * Purpose: Pin an object header down for use during a sequence of message
- * operations, which prevents the object header from being
- * evicted from the cache.
- *
- * Return: Success: Pointer to the object header structure for the
- * object.
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Jul 13 2008
- *
- *-------------------------------------------------------------------------
- */
-H5O_t *
-H5O_pin(const H5O_loc_t *loc, hid_t dxpl_id)
-{
- H5O_t *oh = NULL; /* Object header */
- H5O_t *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- /* check args */
- HDassert(loc);
-
- /* Get header */
- if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__NO_FLAGS_SET, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header")
-
- /* Increment the reference count on the object header */
- /* (which will pin it, if appropriate) */
- if(H5O_inc_rc(oh) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, NULL, "unable to increment reference count on object header")
-
- /* Set the return value */
- ret_value = oh;
-
-done:
- /* Release the object header from the cache */
- if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_pin() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_unpin
- *
- * Purpose: Unpin an object header, allowing it to be evicted from the
- * metadata cache.
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Jul 13 2008
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_unpin(H5O_t *oh)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* check args */
- HDassert(oh);
-
- /* Decrement the reference count on the object header */
- /* (which will unpin it, if appropriate) */
- if(H5O_dec_rc(oh) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement reference count on object header")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_unpin() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_unprotect
- *
- * Purpose: Wrapper around H5AC_unprotect for use during a H5O_protect->
- * H5O_msg_append->...->H5O_msg_append->H5O_unprotect sequence of calls
- * during an object's creation.
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Dec 31 2002
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_unprotect(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, unsigned oh_flags)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* check args */
- HDassert(loc);
- HDassert(oh);
-
- /* Unpin the other chunks */
- if(oh->chunks_pinned && oh->nchunks > 1) {
- unsigned u; /* Local index variable */
-
- /* Sanity check */
- HDassert(oh->swmr_write);
-
- /* Iterate over chunks > 0 */
- for(u = 1; u < oh->nchunks; u++) {
- if(NULL != oh->chunk[u].chunk_proxy) {
- /* Release chunk proxy */
- if(H5AC_unpin_entry(oh->chunk[u].chunk_proxy) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header chunk")
- oh->chunk[u].chunk_proxy = NULL;
- } /* end if */
- } /* end for */
-
- /* Reet the flag from the unprotect */
- oh->chunks_pinned = FALSE;
- } /* end if */
-
- /* Unprotect the object header */
- if(H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, oh->chunk[0].addr, oh, oh_flags) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_unprotect() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_touch_oh
- *
- * Purpose: If FORCE is non-zero then create a modification time message
- * unless one already exists. Then update any existing
- * modification time message with the current time.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Monday, July 27, 1998
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force)
-{
- H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
- hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */
- time_t now; /* Current time */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- HDassert(f);
- HDassert(oh);
-
- /* Check if this object header is tracking times */
- if(oh->flags & H5O_HDR_STORE_TIMES) {
- /* Get current time */
- now = H5_now();
-
- /* Check version, to determine how to store time information */
- if(oh->version == H5O_VERSION_1) {
- size_t idx; /* Index of modification time message to update */
-
- /* Look for existing message */
- for(idx = 0; idx < oh->nmesgs; idx++)
- if(H5O_MSG_MTIME == oh->mesg[idx].type || H5O_MSG_MTIME_NEW == oh->mesg[idx].type)
- break;
-
- /* Create a new message, if necessary */
- if(idx == oh->nmesgs) {
- unsigned mesg_flags = 0; /* Flags for message in object header */
-
- /* If we would have to create a new message, but we aren't 'forcing' it, get out now */
- if(!force)
- HGOTO_DONE(SUCCEED); /*nothing to do*/
-
- /* Allocate space for the modification time message */
- if(H5O_msg_alloc(f, dxpl_id, oh, H5O_MSG_MTIME_NEW, &mesg_flags, &now, &idx) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for modification time message")
-
- /* Set the message's flags if appropriate */
- oh->mesg[idx].flags = (uint8_t)mesg_flags;
- } /* end if */
-
- /* Protect chunk */
- if(NULL == (chk_proxy = H5O_chunk_protect(f, dxpl_id, oh, oh->mesg[idx].chunkno)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk")
-
- /* Allocate 'native' space, if necessary */
- if(NULL == oh->mesg[idx].native) {
- if(NULL == (oh->mesg[idx].native = H5FL_MALLOC(time_t)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for modification time message")
- } /* end if */
-
- /* Update the message */
- *((time_t *)(oh->mesg[idx].native)) = now;
-
- /* Mark the message as dirty */
- oh->mesg[idx].dirty = TRUE;
- chk_dirtied = TRUE;
- } /* end if */
- else {
- /* XXX: For now, update access time & change fields in the object header */
- /* (will need to add some code to update modification time appropriately) */
- oh->atime = oh->ctime = now;
-
- /* Mark object header as dirty in cache */
- if(H5AC_mark_entry_dirty(oh) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
- } /* end else */
- } /* end if */
-
-done:
- /* Release chunk */
- if(chk_proxy && H5O_chunk_unprotect(f, dxpl_id, chk_proxy, chk_dirtied) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_touch_oh() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_touch
- *
- * Purpose: Touch an object by setting the modification time to the
- * current time and marking the object as dirty. Unless FORCE
- * is non-zero, nothing happens if there is no MTIME message in
- * the object header.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Monday, July 27, 1998
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_touch(const H5O_loc_t *loc, hbool_t force, hid_t dxpl_id)
-{
- H5O_t *oh = NULL; /* Object header to modify */
- unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting object header */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* check args */
- HDassert(loc);
-
- /* Get the object header */
- if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__NO_FLAGS_SET, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
-
- /* Create/Update the modification time message */
- if(H5O_touch_oh(loc->file, dxpl_id, oh, force) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to update object modificaton time")
-
- /* Mark object header as changed */
- oh_flags |= H5AC__DIRTIED_FLAG;
-
-done:
- if(oh && H5O_unprotect(loc, dxpl_id, oh, oh_flags) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_touch() */
-
-#ifdef H5O_ENABLE_BOGUS
-
-/*-------------------------------------------------------------------------
- * Function: H5O_bogus_oh
- *
- * Purpose: Create a "bogus" message unless one already exists.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * <koziol@ncsa.uiuc.edu>
- * Tuesday, January 21, 2003
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned bogus_id, unsigned mesg_flags)
-{
- size_t idx; /* Local index variable */
- H5O_msg_class_t *type; /* Message class type */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- HDassert(f);
- HDassert(oh);
-
- /* Look for existing message */
- for(idx = 0; idx < oh->nmesgs; idx++)
- if(H5O_MSG_BOGUS_VALID == oh->mesg[idx].type ||
- H5O_MSG_BOGUS_INVALID == oh->mesg[idx].type)
- break;
-
- /* Create a new message */
- if(idx == oh->nmesgs) {
- H5O_bogus_t *bogus; /* Pointer to the bogus information */
-
- /* Allocate the native message in memory */
- if(NULL == (bogus = H5MM_malloc(sizeof(H5O_bogus_t))))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for 'bogus' message")
-
- /* Update the native value */
- bogus->u = H5O_BOGUS_VALUE;
-
- if(bogus_id == H5O_BOGUS_VALID_ID)
- type = H5O_MSG_BOGUS_VALID;
- else if(bogus_id == H5O_BOGUS_INVALID_ID)
- type = H5O_MSG_BOGUS_INVALID;
- else
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID for 'bogus' message")
-
- /* Allocate space in the object header for bogus message */
- if(H5O_msg_alloc(f, dxpl_id, oh, type, &mesg_flags, bogus, &idx) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message")
-
- /* Point to "bogus" information (take it over) */
- oh->mesg[idx].native = bogus;
-
- /* Set the appropriate flags for the message */
- oh->mesg[idx].flags = mesg_flags;
-
- /* Mark the message and object header as dirty */
- oh->mesg[idx].dirty = TRUE;
- oh->cache_info.is_dirty = TRUE;
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_bogus_oh() */
-#endif /* H5O_ENABLE_BOGUS */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_delete
- *
- * Purpose: Delete an object header from a file. This frees the file
- * space used for the object header (and it's continuation blocks)
- * and also walks through each header message and asks it to
- * remove all the pieces of the file referenced by the header.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 19 2003
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr)
-{
- H5O_t *oh = NULL; /* Object header information */
- H5O_loc_t loc; /* Object location for object to delete */
- unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting object header */
- hbool_t corked;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_TAG(dxpl_id, addr, FAIL)
-
- /* Check args */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
-
- /* Set up the object location */
- loc.file = f;
- loc.addr = addr;
- loc.holding_file = FALSE;
-
- /* Get the object header information */
- if(NULL == (oh = H5O_protect(&loc, dxpl_id, H5AC__NO_FLAGS_SET, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
-
- /* Delete object */
- if(H5O_delete_oh(f, dxpl_id, oh) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file")
-
- /* Uncork cache entries with tag: addr */
- if(H5AC_cork(f, addr, H5AC__GET_CORKED, &corked) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status")
- if(corked)
- if(H5AC_cork(f, addr, H5AC__UNCORK, NULL) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork an object")
-
- /* Mark object header as deleted */
- oh_flags = H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
-
-done:
- if(oh && H5O_unprotect(&loc, dxpl_id, oh, oh_flags) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
-
- FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
-} /* end H5O_delete() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_delete_oh
- *
- * Purpose: Internal function to:
- * Delete an object header from a file. This frees the file
- * space used for the object header (and it's continuation blocks)
- * and also walks through each header message and asks it to
- * remove all the pieces of the file referenced by the header.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 19 2003
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_delete_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
-{
- H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */
- unsigned u;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check args */
- HDassert(f);
- HDassert(oh);
-
- /* Walk through the list of object header messages, asking each one to
- * delete any file space used
- */
- for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) {
- /* Free any space referred to in the file from this message */
- if(H5O_delete_mesg(f, dxpl_id, oh, curr_msg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete file space for object header message")
- } /* end for */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_delete_oh() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_obj_type
- *
- * Purpose: Retrieves the type of object pointed to by `loc'.
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Wednesday, November 4, 1998
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type, hid_t dxpl_id)
-{
- H5O_t *oh = NULL; /* Object header for location */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_TAG(dxpl_id, loc->addr, FAIL)
-
- /* Load the object header */
- if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
-
- /* Retrieve the type of the object */
- if(H5O_obj_type_real(oh, obj_type) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type")
-
-done:
- if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
-
- FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
-} /* end H5O_obj_type() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_obj_type_real
- *
- * Purpose: Returns the type of object pointed to by `oh'.
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * Monday, November 21, 2005
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_obj_type_real(H5O_t *oh, H5O_type_t *obj_type)
-{
- const H5O_obj_class_t *obj_class; /* Class of object for header */
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* Sanity check */
- HDassert(oh);
- HDassert(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);
-
- /* Set type to "unknown" */
- *obj_type = H5O_TYPE_UNKNOWN;
- } /* end if */
- else {
- /* Set object type */
- *obj_type = obj_class->type;
- } /* end else */
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_obj_type_real() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_obj_class
- *
- * Purpose: Returns the class of object pointed to by `loc'.
- *
- * Return: Success: An object class
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * Monday, November 6, 2006
- *
- *-------------------------------------------------------------------------
- */
-const H5O_obj_class_t *
-H5O_obj_class(const H5O_loc_t *loc, hid_t dxpl_id)
-{
- H5O_t *oh = NULL; /* Object header for location */
- const H5O_obj_class_t *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, loc->addr, NULL)
-
- /* Load the object header */
- if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header")
-
- /* Test whether entry qualifies as a particular type of object */
- if(NULL == (ret_value = H5O_obj_class_real(oh)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to determine object type")
-
-done:
- if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
-
- FUNC_LEAVE_NOAPI_TAG(ret_value, NULL)
-} /* end H5O_obj_class() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_obj_class_real
- *
- * Purpose: Returns the class of object pointed to by `oh'.
- *
- * Return: Success: An object class
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * Monday, November 21, 2005
- *
- *-------------------------------------------------------------------------
- */
-static const H5O_obj_class_t *
-H5O_obj_class_real(H5O_t *oh)
-{
- size_t i; /* Local index variable */
- const H5O_obj_class_t *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- /* Sanity check */
- HDassert(oh);
-
- /* Test whether entry qualifies as a particular type of object */
- /* (Note: loop is in reverse order, to test specific objects first) */
- for(i = NELMTS(H5O_obj_class_g); i > 0; --i) {
- htri_t isa; /* Is entry a particular type? */
-
- if((isa = (H5O_obj_class_g[i - 1]->isa)(oh)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type")
- else if(isa)
- HGOTO_DONE(H5O_obj_class_g[i - 1])
- } /* end for */
-
- if(0 == i)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_obj_class_real() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_get_loc
- *
- * Purpose: Gets the object location for an object given its ID.
- *
- * Return: Success: Pointer to H5O_loc_t
- * Failure: NULL
- *
- * Programmer: James Laird
- * July 25 2006
- *
- *-------------------------------------------------------------------------
- */
-H5O_loc_t *
-H5O_get_loc(hid_t object_id)
-{
- H5O_loc_t *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- switch(H5I_get_type(object_id)) {
- case H5I_GROUP:
- if(NULL == (ret_value = H5O_OBJ_GROUP->get_oloc(object_id)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from group ID")
- break;
-
- case H5I_DATASET:
- if(NULL == (ret_value = H5O_OBJ_DATASET->get_oloc(object_id)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from dataset ID")
- break;
-
- case H5I_DATATYPE:
- if(NULL == (ret_value = H5O_OBJ_DATATYPE->get_oloc(object_id)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from datatype ID")
- break;
-
- case H5I_UNINIT:
- case H5I_BADID:
- case H5I_FILE:
- case H5I_DATASPACE:
- case H5I_ATTR:
- case H5I_REFERENCE:
- case H5I_VFL:
- case H5I_GENPROP_CLS:
- case H5I_GENPROP_LST:
- case H5I_ERROR_CLASS:
- case H5I_ERROR_MSG:
- case H5I_ERROR_STACK:
- case H5I_NTYPES:
- default:
- HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, NULL, "invalid object type")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_get_loc() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_loc_reset
- *
- * Purpose: Reset a object location to an empty state
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * Monday, September 19, 2005
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_loc_reset(H5O_loc_t *loc)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* Check arguments */
- HDassert(loc);
-
- /* Clear the object location to an empty state */
- HDmemset(loc, 0, sizeof(H5O_loc_t));
- loc->addr = HADDR_UNDEF;
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_loc_reset() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_loc_copy
- *
- * Purpose: Copy object location information
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Monday, September 19, 2005
- *
- * Notes: 'depth' parameter determines how much of the group entry
- * structure we want to copy. The values are:
- * H5_COPY_SHALLOW - Copy all the field values from the source
- * to the destination, but not copying objects pointed to.
- * (Destination "takes ownership" of objects pointed to)
- * H5_COPY_DEEP - Copy all the fields from the source to
- * the destination, deep copying objects pointed to.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_loc_copy(H5O_loc_t *dst, H5O_loc_t *src, H5_copy_depth_t depth)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* Check arguments */
- HDassert(src);
- HDassert(dst);
- HDassert(depth == H5_COPY_SHALLOW || depth == H5_COPY_DEEP);
-
- /* Copy the top level information */
- HDmemcpy(dst, src, sizeof(H5O_loc_t));
-
- /* Deep copy the names */
- if(depth == H5_COPY_DEEP) {
- /* If the original entry was holding open the file, this one should
- * hold it open, too.
- */
- if(src->holding_file)
- H5F_INCR_NOPEN_OBJS(dst->file);
- } else if(depth == H5_COPY_SHALLOW) {
- H5O_loc_reset(src);
- } /* end if */
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_loc_copy() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_loc_hold_file
- *
- * Purpose: Have this object header hold a file open until it is
- * released.
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: James Laird
- * Wednesday, August 16, 2006
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_loc_hold_file(H5O_loc_t *loc)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* Check arguments */
- HDassert(loc);
- HDassert(loc->file);
-
- /* If this location is not already holding its file open, do so. */
- if(!loc->holding_file) {
- H5F_INCR_NOPEN_OBJS(loc->file);
- loc->holding_file = TRUE;
- } /* end if */
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_loc_hold_file() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_loc_free
- *
- * Purpose: Release resources used by this object header location.
- * Not to be confused with H5O_close; this is used on
- * locations that don't correspond to open objects.
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: James Laird
- * Wednesday, August 16, 2006
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_loc_free(H5O_loc_t *loc)
-{
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check arguments */
- HDassert(loc);
-
- /* If this location is holding its file open try to close the file. */
- if(loc->holding_file) {
- H5F_DECR_NOPEN_OBJS(loc->file);
- loc->holding_file = FALSE;
- if(H5F_NOPEN_OBJS(loc->file) <= 0) {
- if(H5F_try_close(loc->file, NULL) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file")
- } /* end if */
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_loc_free() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_get_hdr_info
- *
- * Purpose: Retrieve the object header information for an object
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * September 22 2009
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_get_hdr_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_hdr_info_t *hdr)
-{
- H5O_t *oh = NULL; /* Object header */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check args */
- HDassert(loc);
- HDassert(hdr);
-
- /* Reset the object header info structure */
- HDmemset(hdr, 0, sizeof(*hdr));
-
- /* Get the object header */
- if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
-
- /* Get the information for the object header */
- if(H5O_get_hdr_info_real(oh, hdr) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info")
-
-done:
- if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_get_hdr_info() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_get_hdr_info_real
- *
- * Purpose: Internal routine to retrieve the object header information for an object
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * September 22 2009
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr)
-{
- const H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */
- const H5O_chunk_t *curr_chunk; /* Pointer to current message being operated on */
- unsigned u; /* Local index variable */
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* Check args */
- HDassert(oh);
- HDassert(hdr);
-
- /* Set the version for the object header */
- hdr->version = oh->version;
-
- /* Set the number of messages & chunks */
- H5_CHECKED_ASSIGN(hdr->nmesgs, unsigned, oh->nmesgs, size_t);
- H5_CHECKED_ASSIGN(hdr->nchunks, unsigned, oh->nchunks, size_t);
-
- /* Set the status flags */
- hdr->flags = oh->flags;
-
- /* Iterate over all the messages, accumulating message size & type information */
- hdr->space.meta = (hsize_t)H5O_SIZEOF_HDR(oh) + (hsize_t)(H5O_SIZEOF_CHKHDR_OH(oh) * (oh->nchunks - 1));
- hdr->space.mesg = 0;
- hdr->space.free = 0;
- hdr->mesg.present = 0;
- hdr->mesg.shared = 0;
- for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) {
- uint64_t type_flag; /* Flag for message type */
-
- /* Accumulate space usage information, based on the type of message */
- if(H5O_NULL_ID == curr_msg->type->id)
- hdr->space.free += (hsize_t)((size_t)H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size);
- else if(H5O_CONT_ID == curr_msg->type->id)
- hdr->space.meta += (hsize_t)((size_t)H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size);
- else {
- hdr->space.meta += (hsize_t)H5O_SIZEOF_MSGHDR_OH(oh);
- hdr->space.mesg += curr_msg->raw_size;
- } /* end else */
-
- /* Set flag to indicate presence of message type */
- type_flag = ((uint64_t)1) << curr_msg->type->id;
- hdr->mesg.present |= type_flag;
-
- /* Set flag if the message is shared in some way */
- if(curr_msg->flags & H5O_MSG_FLAG_SHARED) \
- hdr->mesg.shared |= type_flag;
- } /* end for */
-
- /* Iterate over all the chunks, adding any gaps to the free space */
- hdr->space.total = 0;
- for(u = 0, curr_chunk = &oh->chunk[0]; u < oh->nchunks; u++, curr_chunk++) {
- /* Accumulate the size of the header on disk */
- hdr->space.total += curr_chunk->size;
-
- /* If the chunk has a gap, add it to the free space */
- hdr->space.free += curr_chunk->gap;
- } /* end for */
-
- /* Sanity check that all the bytes are accounted for */
- HDassert(hdr->space.total == (hdr->space.free + hdr->space.meta + hdr->space.mesg));
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_get_hdr_info_real() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_get_info
- *
- * Purpose: Retrieve the information for an object
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * November 21 2006
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_get_info(const H5O_loc_t *loc, hid_t dxpl_id, hbool_t want_ih_info,
- H5O_info_t *oinfo)
-{
- const H5O_obj_class_t *obj_class; /* Class of object for header */
- H5O_t *oh = NULL; /* Object header */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_TAG(dxpl_id, loc->addr, FAIL)
-
- /* Check args */
- HDassert(loc);
- HDassert(oinfo);
-
- /* Get the object header */
- if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
-
- /* Reset the object info structure */
- HDmemset(oinfo, 0, sizeof(*oinfo));
-
- /* Retrieve the file's fileno */
- H5F_GET_FILENO(loc->file, oinfo->fileno);
-
- /* Set the object's address */
- oinfo->addr = loc->addr;
-
- /* Get class for object */
- if(NULL == (obj_class = H5O_obj_class_real(oh)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine object class")
-
- /* Retrieve the type of the object */
- oinfo->type = obj_class->type;
-
- /* Set the object's reference count */
- oinfo->rc = oh->nlink;
-
- /* Get modification time for object */
- if(oh->version > H5O_VERSION_1) {
- oinfo->atime = oh->atime;
- oinfo->mtime = oh->mtime;
- oinfo->ctime = oh->ctime;
- oinfo->btime = oh->btime;
- } /* end if */
- else {
- htri_t exists; /* Flag if header message of interest exists */
-
- /* No information for access & modification fields */
- /* (we stopped updating the "modification time" header message for
- * raw data changes, so the "modification time" header message
- * is closest to the 'change time', in POSIX terms - QAK)
- */
- oinfo->atime = 0;
- oinfo->mtime = 0;
- oinfo->btime = 0;
-
- /* Might be information for modification time */
- if((exists = H5O_msg_exists_oh(oh, H5O_MTIME_ID)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME message")
- if(exists > 0) {
- /* Get "old style" modification time info */
- if(NULL == H5O_msg_read_oh(loc->file, dxpl_id, oh, H5O_MTIME_ID, &oinfo->ctime))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME message")
- } /* end if */
- else {
- /* Check for "new style" modification time info */
- if((exists = H5O_msg_exists_oh(oh, H5O_MTIME_NEW_ID)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME_NEW message")
- if(exists > 0) {
- /* Get "new style" modification time info */
- if(NULL == H5O_msg_read_oh(loc->file, dxpl_id, oh, H5O_MTIME_NEW_ID, &oinfo->ctime))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME_NEW message")
- } /* end if */
- else
- oinfo->ctime = 0;
- } /* end else */
- } /* end else */
-
- /* Get the information for the object header */
- if(H5O_get_hdr_info_real(oh, &oinfo->hdr) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info")
-
- /* Retrieve # of attributes */
- if(H5O_attr_count_real(loc->file, dxpl_id, oh, &oinfo->num_attrs) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute count")
-
- /* Get B-tree & heap metadata storage size, if requested */
- if(want_ih_info) {
- /* Check for 'bh_info' callback for this type of object */
- if(obj_class->bh_info) {
- /* Call the object's class 'bh_info' routine */
- if((obj_class->bh_info)(loc, dxpl_id, oh, &oinfo->meta_size.obj) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object's btree & heap info")
- } /* end if */
-
- /* Get B-tree & heap info for any attributes */
- if(oinfo->num_attrs > 0) {
- if(H5O_attr_bh_info(loc->file, dxpl_id, oh, &oinfo->meta_size.attr) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute btree & heap info")
- } /* end if */
- } /* end if */
-
-done:
- if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
-
- FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
-} /* end H5O_get_info() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_get_create_plist
- *
- * Purpose: Retrieve the object creation properties for an object
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * November 28 2006
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_get_create_plist(const H5O_loc_t *loc, hid_t dxpl_id, H5P_genplist_t *oc_plist)
-{
- H5O_t *oh = NULL; /* Object header */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check args */
- HDassert(loc);
- HDassert(oc_plist);
-
- /* Get the object header */
- if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
-
- /* Set property values, if they were used for the object */
- if(oh->version > H5O_VERSION_1) {
- uint8_t ohdr_flags; /* "User-visible" object header status flags */
-
- /* Set attribute storage values */
- if(H5P_set(oc_plist, H5O_CRT_ATTR_MAX_COMPACT_NAME, &oh->max_compact) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set max. # of compact attributes in property list")
- if(H5P_set(oc_plist, H5O_CRT_ATTR_MIN_DENSE_NAME, &oh->min_dense) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set min. # of dense attributes in property list")
-
- /* Mask off non-"user visible" flags */
- ohdr_flags = oh->flags & (H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED | H5O_HDR_STORE_TIMES);
-
- /* Set object header flags */
- if(H5P_set(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set object header flags")
- } /* end if */
-
-done:
- if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_get_create_plist() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_get_nlinks
- *
- * Purpose: Retrieve the number of link messages read in from the file
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * March 11 2007
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_get_nlinks(const H5O_loc_t *loc, hid_t dxpl_id, hsize_t *nlinks)
-{
- H5O_t *oh = NULL; /* Object header */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check args */
- HDassert(loc);
- HDassert(nlinks);
-
- /* Get the object header */
- if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
-
- /* Retrieve the # of link messages seen when the object header was loaded */
- *nlinks = oh->link_msgs_seen;
-
-done:
- if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_get_nlinks() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_obj_create
- *
- * Purpose: Creates an object, in an abstract manner.
- *
- * Return: Success: Pointer to object opened
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * April 9 2007
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5O_obj_create(H5F_t *f, H5O_type_t obj_type, void *crt_info, H5G_loc_t *obj_loc,
- hid_t dxpl_id)
-{
- size_t u; /* Local index variable */
- void *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- /* Sanity checks */
- HDassert(f);
- HDassert(obj_type >= H5O_TYPE_GROUP && obj_type <= H5O_TYPE_NAMED_DATATYPE);
- HDassert(crt_info);
- HDassert(obj_loc);
-
- /* Iterate through the object classes */
- for(u = 0; u < NELMTS(H5O_obj_class_g); u++) {
- /* Check for correct type of object to create */
- if(H5O_obj_class_g[u]->type == obj_type) {
- /* Call the object class's 'create' routine */
- HDassert(H5O_obj_class_g[u]->create);
- if(NULL == (ret_value = H5O_obj_class_g[u]->create(f, crt_info, obj_loc, dxpl_id)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object")
-
- /* Break out of loop */
- break;
- } /* end if */
- } /* end for */
- HDassert(ret_value);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_obj_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_get_oh_addr
- *
- * Purpose: Retrieve the address of the object header
- *
- * Note: This routine participates in the "Inlining C struct access"
- * pattern, don't call it directly, use the appropriate macro
- * defined in H5Oprivate.h.
- *
- * Return: Success: Valid haddr_t
- * Failure: HADDR_UNDEF
- *
- * Programmer: Quincey Koziol
- * March 15 2007
- *
- *-------------------------------------------------------------------------
- */
-haddr_t
-H5O_get_oh_addr(const H5O_t *oh)
-{
- /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- HDassert(oh);
- HDassert(oh->chunk);
-
- FUNC_LEAVE_NOAPI(oh->chunk[0].addr)
-} /* end H5O_get_oh_addr() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_get_rc_and_type
- *
- * Purpose: Retrieve an object's reference count and type
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * November 4 2007
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_get_rc_and_type(const H5O_loc_t *loc, hid_t dxpl_id, unsigned *rc, H5O_type_t *otype)
-{
- H5O_t *oh = NULL; /* Object header */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check args */
- HDassert(loc);
-
- /* Get the object header */
- if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
-
- /* Set the object's reference count */
- if(rc)
- *rc = oh->nlink;
-
- /* Retrieve the type of the object */
- if(otype)
- if(H5O_obj_type_real(oh, otype) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type")
-
-done:
- if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_get_rc_and_type() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_free_visit_visited
- *
- * Purpose: Free the key for an object visited during a group traversal
- *
- * Return: Non-negative on success, negative on failure
- *
- * Programmer: Quincey Koziol
- * Nov 25, 2007
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_free_visit_visited(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *operator_data/*in,out*/)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- item = H5FL_FREE(H5_obj_t, item);
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_free_visit_visited() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_visit_cb
- *
- * Purpose: Callback function for recursively visiting objects from a group
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * Nov 25, 2007
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t *linfo,
- void *_udata)
-{
- H5O_iter_visit_ud_t *udata = (H5O_iter_visit_ud_t *)_udata; /* User data for callback */
- H5G_loc_t obj_loc; /* Location of object */
- H5G_name_t obj_path; /* Object's group hier. path */
- H5O_loc_t obj_oloc; /* Object's object location */
- hbool_t obj_found = FALSE; /* Object at 'name' found */
- herr_t ret_value = H5_ITER_CONT; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Sanity check */
- HDassert(name);
- HDassert(linfo);
- HDassert(udata);
-
- /* Check if this is a hard link */
- if(linfo->type == H5L_TYPE_HARD) {
- H5_obj_t obj_pos; /* Object "position" for this object */
-
- /* Set up opened group location to fill in */
- obj_loc.oloc = &obj_oloc;
- obj_loc.path = &obj_path;
- H5G_loc_reset(&obj_loc);
-
- /* Find the object using the LAPL passed in */
- /* (Correctly handles mounted files) */
- if(H5G_loc_find(udata->start_loc, name, &obj_loc/*out*/, udata->lapl_id, udata->dxpl_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, H5_ITER_ERROR, "object not found")
- obj_found = TRUE;
-
- /* Construct unique "position" for this object */
- H5F_GET_FILENO(obj_oloc.file, obj_pos.fileno);
- obj_pos.addr = obj_oloc.addr;
-
- /* Check if we've seen the object the link references before */
- if(NULL == H5SL_search(udata->visited, &obj_pos)) {
- H5O_info_t oinfo; /* Object info */
-
- /* Get the object's info */
- if(H5O_get_info(&obj_oloc, udata->dxpl_id, TRUE, &oinfo) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get object info")
-
- /* Make the application callback */
- ret_value = (udata->op)(udata->obj_id, name, &oinfo, udata->op_data);
-
- /* Check for continuing to visit objects */
- if(ret_value == H5_ITER_CONT) {
- /* If its ref count is > 1, we add it to the list of visited objects */
- /* (because it could come up again during traversal) */
- if(oinfo.rc > 1) {
- H5_obj_t *new_node; /* New object node for visited list */
-
- /* Allocate new object "position" node */
- if((new_node = H5FL_MALLOC(H5_obj_t)) == NULL)
- HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, H5_ITER_ERROR, "can't allocate object node")
-
- /* Set node information */
- *new_node = obj_pos;
-
- /* Add to list of visited objects */
- if(H5SL_insert(udata->visited, new_node, new_node) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, H5_ITER_ERROR, "can't insert object node into visited list")
- } /* end if */
- } /* end if */
- } /* end if */
- } /* end if */
-
-done:
- /* Release resources */
- if(obj_found && H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5_ITER_ERROR, "can't free location")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_visit_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_visit
- *
- * Purpose: Recursively visit an object and all the objects reachable
- * from it. If the starting object is a group, all the objects
- * linked to from that group will be visited. Links within
- * each group are visited according to the order within the
- * specified index (unless the specified index does not exist for
- * a particular group, then the "name" index is used).
- *
- * NOTE: Soft links and user-defined links are ignored during
- * this operation.
- *
- * NOTE: Each _object_ reachable from the initial group will only
- * be visited once. If multiple hard links point to the same
- * object, the first link to the object's path (according to the
- * iteration index and iteration order given) will be used to in
- * the callback about the object.
- *
- * Return: Success: The return value of the first operator that
- * returns non-zero, or zero if all members were
- * processed with no operator returning non-zero.
- *
- * Failure: Negative if something goes wrong within the
- * library, or the negative value returned by one
- * of the operators.
- *
- * Programmer: Quincey Koziol
- * November 24 2007
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
- H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id,
- hid_t dxpl_id)
-{
- H5O_iter_visit_ud_t udata; /* User data for callback */
- H5G_loc_t loc; /* Location of reference object */
- H5G_loc_t obj_loc; /* Location used to open object */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
- hbool_t loc_found = FALSE; /* Entry at 'name' found */
- H5O_info_t oinfo; /* Object info struct */
- hid_t obj_id = (-1); /* ID of object */
- herr_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Portably initialize user data struct to zeros */
- HDmemset(&udata, 0, sizeof(udata));
-
- /* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
-
- /* Set up opened group location to fill in */
- obj_loc.oloc = &obj_oloc;
- obj_loc.path = &obj_path;
- H5G_loc_reset(&obj_loc);
-
- /* Find the object's location */
- if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
- loc_found = TRUE;
-
- /* Get the object's info */
- if(H5O_get_info(&obj_oloc, dxpl_id, TRUE, &oinfo) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info")
-
- /* Open the object */
- /* (Takes ownership of the obj_loc information) */
- if((obj_id = H5O_open_by_loc(&obj_loc, lapl_id, dxpl_id, TRUE)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
-
- /* Make callback for starting object */
- if((ret_value = op(obj_id, ".", &oinfo, op_data)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "can't visit objects")
-
- /* Check return value of first callback */
- if(ret_value != H5_ITER_CONT)
- HGOTO_DONE(ret_value);
-
- /* Check for object being a group */
- if(oinfo.type == H5O_TYPE_GROUP) {
- H5G_loc_t start_loc; /* Location of starting group */
-
- /* Get the location of the starting group */
- if(H5G_loc(obj_id, &start_loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
-
- /* Set up user data for visiting links */
- udata.obj_id = obj_id;
- udata.start_loc = &start_loc;
- udata.lapl_id = lapl_id;
- udata.dxpl_id = dxpl_id;
- udata.op = op;
- udata.op_data = op_data;
-
- /* Create skip list to store visited object information */
- if((udata.visited = H5SL_create(H5SL_TYPE_OBJ, NULL)) == NULL)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create skip list for visited objects")
-
- /* If its ref count is > 1, we add it to the list of visited objects */
- /* (because it could come up again during traversal) */
- if(oinfo.rc > 1) {
- H5_obj_t *obj_pos; /* New object node for visited list */
-
- /* Allocate new object "position" node */
- if((obj_pos = H5FL_MALLOC(H5_obj_t)) == NULL)
- HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "can't allocate object node")
-
- /* Construct unique "position" for this object */
- obj_pos->fileno = oinfo.fileno;
- obj_pos->addr = oinfo.addr;
-
- /* Add to list of visited objects */
- if(H5SL_insert(udata.visited, obj_pos, obj_pos) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object node into visited list")
- } /* end if */
-
- /* Call internal group visitation routine */
- if((ret_value = H5G_visit(obj_id, ".", idx_type, order, H5O_visit_cb, &udata, lapl_id, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
- } /* end if */
-
-done:
- if(obj_id > 0) {
- if(H5I_dec_app_ref(obj_id) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object")
- } /* end if */
- else if(loc_found && H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
- if(udata.visited)
- H5SL_destroy(udata.visited, H5O_free_visit_visited, NULL);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_visit() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_inc_rc
- *
- * Purpose: Increments the reference count on an object header
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Jul 13 2008
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_inc_rc(H5O_t *oh)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* check args */
- HDassert(oh);
-
- /* Pin the object header when the reference count goes above 0 */
- if(oh->rc == 0)
- if(H5AC_pin_protected_entry(oh) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
-
- /* Increment reference count */
- oh->rc++;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_inc_rc() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_dec_rc
- *
- * Purpose: Decrements the reference count on an object header
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Jul 13 2008
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_dec_rc(H5O_t *oh)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* check args */
- HDassert(oh);
-
- /* Decrement reference count */
- oh->rc--;
-
- /* Unpin the object header when the reference count goes back to 0 */
- if(oh->rc == 0)
- if(H5AC_unpin_entry(oh) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_dec_rc() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_dec_rc_by_loc
- *
- * Purpose: Decrement the refcount of an object header, using its
- * object location information.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Oct 08 2010
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_dec_rc_by_loc(const H5O_loc_t *loc, hid_t dxpl_id)
-{
- H5O_t *oh = NULL; /* Object header */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* check args */
- HDassert(loc);
-
- /* Get header */
- if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header")
-
- /* Decrement the reference count on the object header */
- /* (which will unpin it, if appropriate) */
- if(H5O_dec_rc(oh) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement reference count on object header")
-
-done:
- /* Release the object header from the cache */
- if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_dec_rc_by_loc() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_get_proxy
- *
- * Purpose: Retrieve the proxy for the object header.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * July 24 2016
- *
- *-------------------------------------------------------------------------
- */
-H5AC_proxy_entry_t *
-H5O_get_proxy(const H5O_t *oh)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* Check args */
- HDassert(oh);
-
- FUNC_LEAVE_NOAPI(oh->proxy)
-} /* end H5O_get_proxy() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O__free
- *
- * Purpose: Destroys an object header.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Jan 15 2003
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O__free(H5O_t *oh)
-{
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /* check args */
- HDassert(oh);
- HDassert(0 == oh->rc);
-
- /* Destroy chunks */
- if(oh->chunk) {
- for(u = 0; u < oh->nchunks; u++)
- oh->chunk[u].image = H5FL_BLK_FREE(chunk_image, oh->chunk[u].image);
-
- oh->chunk = (H5O_chunk_t *)H5FL_SEQ_FREE(H5O_chunk_t, oh->chunk);
- } /* end if */
-
- /* Destroy messages */
- if(oh->mesg) {
- for(u = 0; u < oh->nmesgs; u++) {
-#ifndef NDEBUG
- /* Verify that message is clean, unless it could have been marked
- * dirty by decoding */
- if(oh->ndecode_dirtied && oh->mesg[u].dirty)
- oh->ndecode_dirtied--;
- else
- HDassert(oh->mesg[u].dirty == 0);
-#endif /* NDEBUG */
-
- H5O_msg_free_mesg(&oh->mesg[u]);
- } /* end for */
-
- /* Make sure we accounted for all the messages dirtied by decoding */
- HDassert(!oh->ndecode_dirtied);
-
- oh->mesg = (H5O_mesg_t *)H5FL_SEQ_FREE(H5O_mesg_t, oh->mesg);
- } /* end if */
-
- /* Destroy the proxy */
- if(oh->proxy)
- if(H5AC_proxy_entry_dest(oh->proxy) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy virtual entry used for proxy")
-
- /* destroy object header */
- oh = H5FL_FREE(H5O_t, oh);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O__free() */
-
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index 3512d3e..478d950 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -2434,16 +2434,17 @@ H5O_alloc_shrink_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno)
oh->nmesgs++;
/* Initialize new null message to make the chunk large enough */
- oh->mesg[oh->nmesgs].type = H5O_MSG_NULL;
- oh->mesg[oh->nmesgs].dirty = TRUE;
- oh->mesg[oh->nmesgs].native = NULL;
- oh->mesg[oh->nmesgs].raw = old_image + new_size + sizeof_msghdr - sizeof_chksum;
- oh->mesg[oh->nmesgs].raw_size = MAX(H5O_ALIGN_OH(oh, min_chunk_size - total_msg_size),
+ curr_msg = &oh->mesg[oh->nmesgs - 1];
+ curr_msg->type = H5O_MSG_NULL;
+ curr_msg->dirty = TRUE;
+ curr_msg->native = NULL;
+ curr_msg->raw = old_image + new_size + sizeof_msghdr - sizeof_chksum;
+ curr_msg->raw_size = MAX(H5O_ALIGN_OH(oh, min_chunk_size - total_msg_size),
sizeof_msghdr) - sizeof_msghdr;
- oh->mesg[oh->nmesgs].chunkno = chunkno;
+ curr_msg->chunkno = chunkno;
/* update the new chunk size */
- new_size += oh->mesg[oh->nmesgs].raw_size + sizeof_msghdr;
+ new_size += curr_msg->raw_size + sizeof_msghdr;
} /* end if */
/* Check for changing the chunk #0 data size enough to need adjusting the flags */
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index cb802ea..5c45e82 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -622,14 +622,21 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED *native_src,
+H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *native_src,
hbool_t *deleted, const H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ const H5A_t *attr_src = (const H5A_t *)native_src; /* Source attribute */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
/* check args */
HDassert(deleted);
HDassert(cpy_info);
+ HDassert(cpy_info->file_dst);
+
+ if(attr_src->shared->version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "attribute message version out of bounds")
/* If we are not copying attributes into the destination file, indicate
* that this message should be deleted.
@@ -637,7 +644,8 @@ H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED
if(cpy_info->copy_without_attr)
*deleted = TRUE;
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_pre_copy_file() */
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index aa2a9e0..aa26f05 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -415,6 +415,10 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
/* Initialize header information */
oh_dst->version = oh_src->version;
+
+ if(oh_dst->version > H5O_obj_ver_bounds[H5F_HIGH_BOUND(oloc_dst->file)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "destination object header version out of bounds")
+
oh_dst->flags = oh_src->flags;
oh_dst->link_msgs_seen = oh_src->link_msgs_seen;
oh_dst->attr_msgs_seen = oh_src->attr_msgs_seen;
@@ -490,6 +494,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
/* Decode the message if necessary. */
H5O_LOAD_NATIVE(oloc_src->file, dxpl_id, 0, oh_src, mesg_src, FAIL)
+ cpy_info->file_dst = oloc_dst->file;
/* Perform "pre copy" operation on message */
if((copy_type->pre_copy_file)(oloc_src->file, mesg_src->native,
&(deleted[mesgno]), cpy_info, cpy_udata) < 0)
@@ -871,12 +876,19 @@ done:
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
/* Free destination object header on failure */
- if(ret_value < 0 && oh_dst && !inserted) {
- if(H5O__free(oh_dst) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
- if(H5O_loc_reset(oloc_dst) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
- } /* end if */
+ if(ret_value < 0) {
+ if(oh_dst && !inserted) {
+ if(H5O__free(oh_dst) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
+ if(H5O_loc_reset(oloc_dst) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
+ } /* end if */
+
+ if(addr_map == NULL && cpy_udata) {
+ if(obj_class && obj_class->free_copy_file_udata)
+ obj_class->free_copy_file_udata(cpy_udata);
+ } /* end if */
+ }
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
} /* end H5O_copy_header_real() */
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index a1c24b6..f6331df 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -15,16 +15,16 @@
#define H5T_FRIEND /*prevent warning from including H5Tpkg */
-#include "H5private.h" /* Generic Functions */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Gprivate.h" /* Groups */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Opkg.h" /* Object headers */
-#include "H5Tpkg.h" /* Datatypes */
-#include "H5VMprivate.h" /* Vectors and arrays */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Gprivate.h" /* Groups */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Opkg.h" /* Object headers */
+#include "H5Tpkg.h" /* Datatypes */
+#include "H5VMprivate.h" /* Vectors and arrays */
/* PRIVATE PROTOTYPES */
@@ -1516,7 +1516,7 @@ done:
*/
static herr_t
H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src,
- hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t H5_ATTR_UNUSED *cpy_info,
+ hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info,
void *_udata)
{
const H5T_t *dt_src = (const H5T_t *)mesg_src; /* Source datatype */
@@ -1528,6 +1528,11 @@ H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src,
/* check args */
HDassert(file_src);
HDassert(dt_src);
+ HDassert(cpy_info);
+ HDassert(cpy_info->file_dst);
+
+ if(dt_src->shared->version > H5O_dtype_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "datatype message version out of bounds")
/* If the user data is non-NULL, assume we are copying a dataset
* and check if we need to make a copy of the datatype for later in
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index 613b521..cf64594 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -21,15 +21,15 @@
#include "H5Omodule.h" /* This source code file is part of the H5O module */
-#include "H5private.h" /* Generic Functions */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Opkg.h" /* Object headers */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5Sprivate.h" /* Dataspaces */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Opkg.h" /* Object headers */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5Sprivate.h" /* Dataspaces */
static void *H5O_fill_old_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
@@ -43,6 +43,8 @@ static size_t H5O_fill_new_size(const H5F_t *f, const void *_mesg);
static void *H5O_fill_copy(const void *_mesg, void *_dest);
static herr_t H5O_fill_reset(void *_mesg);
static herr_t H5O_fill_free(void *_mesg);
+static herr_t H5O_fill_pre_copy_file(H5F_t *file_src, const void *mesg_src,
+ hbool_t *deleted, const H5O_copy_t *cpy_info, void *udata);
static herr_t H5O_fill_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream,
int indent, int fwidth);
@@ -105,55 +107,55 @@ static herr_t H5O_fill_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *s
/* This message derives from H5O message class, for old fill value before version 1.5 */
const H5O_msg_class_t H5O_MSG_FILL[1] = {{
- H5O_FILL_ID, /*message id number */
- "fill", /*message name for debugging */
- sizeof(H5O_fill_t), /*native message size */
- H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */
- H5O_fill_shared_decode, /*decode message */
- H5O_fill_shared_encode, /*encode message */
- H5O_fill_copy, /*copy the native value */
- H5O_fill_shared_size, /*raw message size */
- H5O_fill_reset, /*free internal memory */
- H5O_fill_free, /* free method */
- H5O_fill_shared_delete, /* file delete method */
- H5O_fill_shared_link, /* link method */
- NULL, /* set share method */
- NULL, /*can share method */
- NULL, /* pre copy native value to file */
- H5O_fill_shared_copy_file, /* copy native value to file */
- H5O_fill_shared_post_copy_file, /* post copy native value to file */
- NULL, /* get creation index */
- NULL, /* set creation index */
- H5O_fill_shared_debug /*debug the message */
+ H5O_FILL_ID, /*message id number */
+ "fill", /*message name for debugging */
+ sizeof(H5O_fill_t), /*native message size */
+ H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */
+ H5O_fill_shared_decode, /*decode message */
+ H5O_fill_shared_encode, /*encode message */
+ H5O_fill_copy, /*copy the native value */
+ H5O_fill_shared_size, /*raw message size */
+ H5O_fill_reset, /*free internal memory */
+ H5O_fill_free, /* free method */
+ H5O_fill_shared_delete, /* file delete method */
+ H5O_fill_shared_link, /* link method */
+ NULL, /* set share method */
+ NULL, /*can share method */
+ H5O_fill_pre_copy_file, /* pre copy native value to file */
+ H5O_fill_shared_copy_file, /* copy native value to file */
+ H5O_fill_shared_post_copy_file, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
+ H5O_fill_shared_debug /*debug the message */
}};
/* This message derives from H5O message class, for new fill value after version 1.4 */
const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{
- H5O_FILL_NEW_ID, /*message id number */
- "fill_new", /*message name for debugging */
- sizeof(H5O_fill_t), /*native message size */
- H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */
- H5O_fill_new_shared_decode, /*decode message */
- H5O_fill_new_shared_encode, /*encode message */
- H5O_fill_copy, /*copy the native value */
- H5O_fill_new_shared_size, /*raw message size */
- H5O_fill_reset, /*free internal memory */
- H5O_fill_free, /* free method */
- H5O_fill_new_shared_delete, /* file delete method */
- H5O_fill_new_shared_link, /* link method */
- NULL, /* set share method */
- NULL, /*can share method */
- NULL, /* pre copy native value to file */
- H5O_fill_new_shared_copy_file, /* copy native value to file */
- H5O_fill_new_shared_post_copy_file, /* post copy native value to file */
- NULL, /* get creation index */
- NULL, /* set creation index */
- H5O_fill_new_shared_debug /*debug the message */
+ H5O_FILL_NEW_ID, /*message id number */
+ "fill_new", /*message name for debugging */
+ sizeof(H5O_fill_t), /*native message size */
+ H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */
+ H5O_fill_new_shared_decode, /*decode message */
+ H5O_fill_new_shared_encode, /*encode message */
+ H5O_fill_copy, /*copy the native value */
+ H5O_fill_new_shared_size, /*raw message size */
+ H5O_fill_reset, /*free internal memory */
+ H5O_fill_free, /* free method */
+ H5O_fill_new_shared_delete, /* file delete method */
+ H5O_fill_new_shared_link, /* link method */
+ NULL, /* set share method */
+ NULL, /*can share method */
+ H5O_fill_pre_copy_file, /* pre copy native value to file */
+ H5O_fill_new_shared_copy_file, /* copy native value to file */
+ H5O_fill_new_shared_post_copy_file, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
+ H5O_fill_new_shared_debug /*debug the message */
}};
/* Format version bounds for fill value */
-static const unsigned H5O_fill_ver_bounds[] = {
- H5O_FILL_VERSION_1, /* H5F_LIBVER_EARLIEST */
+const unsigned H5O_fill_ver_bounds[] = {
+ H5O_FILL_VERSION_1, /* H5F_LIBVER_EARLIEST */
H5O_FILL_VERSION_3, /* H5F_LIBVER_V18 */
H5O_FILL_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
@@ -178,11 +180,11 @@ H5FL_BLK_EXTERN(type_conv);
* Function: H5O_fill_new_decode
*
* Purpose: Decode a new fill value message. The new fill value
- * message is fill value plus space allocation time and
- * fill value writing time and whether fill value is defined.
+ * message is fill value plus space allocation time and
+ * fill value writing time and whether fill value is defined.
*
- * Return: Success: Ptr to new message in native struct.
- * Failure: NULL
+ * Return: Success: Ptr to new message in native struct.
+ * Failure: NULL
*
* Programmer: Raymond Lu
* Feb 26, 2002
@@ -202,7 +204,7 @@ H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t
HDassert(p);
if(NULL == (fill = H5FL_CALLOC(H5O_fill_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message")
/* Version */
fill->version = *p++;
@@ -283,7 +285,7 @@ done:
if(!ret_value && fill) {
if(fill->buf)
H5MM_xfree(fill->buf);
- fill = H5FL_FREE(H5O_fill_t, fill);
+ fill = H5FL_FREE(H5O_fill_t, fill);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -343,7 +345,7 @@ done:
if(!ret_value && fill) {
if(fill->buf)
H5MM_xfree(fill->buf);
- fill = H5FL_FREE(H5O_fill_t, fill);
+ fill = H5FL_FREE(H5O_fill_t, fill);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -354,8 +356,8 @@ done:
* Function: H5O_fill_new_encode
*
* Purpose: Encode a new fill value message. The new fill value
- * message is fill value plus space allocation time and
- * fill value writing time and whether fill value is defined.
+ * message is fill value plus space allocation time and
+ * fill value writing time and whether fill value is defined.
*
* Return: Non-negative on success/Negative on failure
*
@@ -488,7 +490,7 @@ H5O_fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill)
* whether fill value is defined.
*
* Return: Success: Ptr to _DEST
- * Failure: NULL
+ * Failure: NULL
*
* Programmer: Raymond Lu
* Feb 26, 2002
@@ -498,16 +500,16 @@ H5O_fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill)
static void *
H5O_fill_copy(const void *_src, void *_dst)
{
- const H5O_fill_t *src = (const H5O_fill_t *)_src;
- H5O_fill_t *dst = (H5O_fill_t *)_dst;
- void *ret_value = NULL; /* Return value */
+ const H5O_fill_t *src = (const H5O_fill_t *)_src;
+ H5O_fill_t *dst = (H5O_fill_t *)_dst;
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
HDassert(src);
if(!dst && NULL == (dst = H5FL_MALLOC(H5O_fill_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill message")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill message")
/* Shallow copy basic fields */
*dst = *src;
@@ -523,9 +525,9 @@ H5O_fill_copy(const void *_src, void *_dst)
/* Copy fill value and its size */
if(src->buf) {
H5_CHECK_OVERFLOW(src->size, ssize_t, size_t);
- if(NULL == (dst->buf = H5MM_malloc((size_t)src->size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
- HDmemcpy(dst->buf, src->buf, (size_t)src->size);
+ if(NULL == (dst->buf = H5MM_malloc((size_t)src->size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
+ HDmemcpy(dst->buf, src->buf, (size_t)src->size);
/* Check for needing to convert/copy fill value */
if(src->type) {
@@ -586,9 +588,9 @@ done:
if(!ret_value && dst) {
if(dst->buf)
H5MM_xfree(dst->buf);
- if(dst->type)
+ if(dst->type)
H5T_close(dst->type);
- if(!_dst)
+ if(!_dst)
dst = H5FL_FREE(H5O_fill_t, dst);
} /* end if */
@@ -600,13 +602,13 @@ done:
* Function: H5O_fill_new_size
*
* Purpose: Returns the size of the raw message in bytes not counting the
- * message type or size fields, but only the data fields. This
- * function doesn't take into account alignment. The new fill
- * value message is fill value plus space allocation time and
- * fill value writing time and whether fill value is defined.
+ * message type or size fields, but only the data fields. This
+ * function doesn't take into account alignment. The new fill
+ * value message is fill value plus space allocation time and
+ * fill value writing time and whether fill value is defined.
*
* Return: Success: Message data size in bytes w/o alignment.
- * Failure: 0
+ * Failure: 0
*
* Programmer: Raymond Lu
* Feb 26, 2002
@@ -616,8 +618,8 @@ done:
static size_t
H5O_fill_new_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill)
{
- const H5O_fill_t *fill = (const H5O_fill_t *)_fill;
- size_t ret_value = 0; /* Return value */
+ const H5O_fill_t *fill = (const H5O_fill_t *)_fill;
+ size_t ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -728,8 +730,8 @@ H5O_fill_reset_dyn(H5O_fill_t *fill)
} /* end if */
fill->size = 0;
if(fill->type) {
- H5T_close(fill->type);
- fill->type = NULL;
+ H5T_close(fill->type);
+ fill->type = NULL;
} /* end if */
done:
@@ -799,6 +801,41 @@ H5O_fill_free(void *fill)
/*-------------------------------------------------------------------------
+ * Function: H5O_fill_pre_copy_file
+ *
+ * Purpose: Perform any necessary actions before copying message between
+ * files.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, March 9, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_fill_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
+ hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata)
+{
+ const H5O_fill_t *fill_src = (const H5O_fill_t *)mesg_src; /* Source fill value */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* check args */
+ HDassert(cpy_info);
+ HDassert(cpy_info->file_dst);
+
+ if(fill_src->version > H5O_fill_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "fill value message version out of bounds")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_fill_pre_copy_file() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_fill_debug
*
* Purpose: Prints debugging info for the message.
@@ -890,11 +927,11 @@ H5O_fill_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void
"Size:", fill->size);
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Data type:");
if(fill->type) {
- H5T_debug(fill->type, stream);
- fprintf(stream, "\n");
+ H5T_debug(fill->type, stream);
+ fprintf(stream, "\n");
} /* end if */
else
- fprintf(stream, "<dataset type>\n");
+ fprintf(stream, "<dataset type>\n");
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_fill_debug() */
@@ -904,9 +941,9 @@ H5O_fill_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void
* Function: H5O_fill_convert
*
* Purpose: Convert a fill value from whatever data type it currently has
- * to the specified dataset type. The `type' field of the fill
- * value struct will be set to NULL to indicate that it has the
- * same type as the dataset.
+ * to the specified dataset type. The `type' field of the fill
+ * value struct will be set to NULL to indicate that it has the
+ * same type as the dataset.
*
* Return: Non-negative on success/Negative on failure
*
@@ -932,21 +969,21 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed, hid_
/* No-op cases */
if(!fill->buf || !fill->type || 0 == H5T_cmp(fill->type, dset_type, FALSE)) {
/* Don't need datatype for fill value */
- if(fill->type)
+ if(fill->type)
H5T_close(fill->type);
- fill->type = NULL;
+ fill->type = NULL;
/* Note that the fill value info has changed */
*fill_changed = TRUE;
- HGOTO_DONE(SUCCEED);
+ HGOTO_DONE(SUCCEED);
} /* end if */
/*
* Can we convert between source and destination data types?
*/
if(NULL == (tpath = H5T_path_find(fill->type, dset_type, NULL, NULL, dxpl_id, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes")
/* Don't bother doing anything if there will be no actual conversion */
if(!H5T_path_noop(tpath)) {
diff --git a/src/H5Oint.c b/src/H5Oint.c
new file mode 100644
index 0000000..0df7467
--- /dev/null
+++ b/src/H5Oint.c
@@ -0,0 +1,2765 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*-------------------------------------------------------------------------
+ *
+ * Created: H5O.c
+ *
+ * Purpose: Internal object header routines
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5Omodule.h" /* This source code file is part of the H5O module */
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5FOprivate.h" /* File objects */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
+#include "H5MFprivate.h" /* File memory management */
+#ifdef H5O_ENABLE_BOGUS
+#include "H5MMprivate.h" /* Memory management */
+#endif /* H5O_ENABLE_BOGUS */
+#include "H5Opkg.h" /* Object headers */
+#include "H5SMprivate.h" /* Shared object header messages */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/* User data for recursive traversal over objects from a group */
+typedef struct {
+ hid_t obj_id; /* The ID for the starting group */
+ H5G_loc_t *start_loc; /* Location of starting group */
+ hid_t lapl_id; /* LAPL for walking across links */
+ hid_t dxpl_id; /* DXPL for operations */
+ H5SL_t *visited; /* Skip list for tracking visited nodes */
+ H5O_iterate_t op; /* Application callback */
+ void *op_data; /* Application's op data */
+} H5O_iter_visit_ud_t;
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+static herr_t H5O_delete_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh);
+static herr_t H5O_obj_type_real(H5O_t *oh, H5O_type_t *obj_type);
+static herr_t H5O_get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr);
+static const H5O_obj_class_t *H5O_obj_class_real(H5O_t *oh);
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/* Package initialization variable */
+hbool_t H5_PKG_INIT_VAR = FALSE;
+
+/* Header message ID to class mapping
+ *
+ * Remember to increment H5O_MSG_TYPES in H5Opkg.h when adding a new
+ * message.
+ */
+const H5O_msg_class_t *const H5O_msg_class_g[] = {
+ H5O_MSG_NULL, /*0x0000 Null */
+ H5O_MSG_SDSPACE, /*0x0001 Dataspace */
+ H5O_MSG_LINFO, /*0x0002 Link information */
+ H5O_MSG_DTYPE, /*0x0003 Datatype */
+ H5O_MSG_FILL, /*0x0004 Old data storage -- fill value */
+ H5O_MSG_FILL_NEW, /*0x0005 New data storage -- fill value */
+ H5O_MSG_LINK, /*0x0006 Link */
+ H5O_MSG_EFL, /*0x0007 Data storage -- external data files */
+ H5O_MSG_LAYOUT, /*0x0008 Data Layout */
+#ifdef H5O_ENABLE_BOGUS
+ H5O_MSG_BOGUS_VALID, /*0x0009 "Bogus valid" (for testing) */
+#else /* H5O_ENABLE_BOGUS */
+ NULL, /*0x0009 "Bogus valid" (for testing) */
+#endif /* H5O_ENABLE_BOGUS */
+ H5O_MSG_GINFO, /*0x000A Group information */
+ H5O_MSG_PLINE, /*0x000B Data storage -- filter pipeline */
+ H5O_MSG_ATTR, /*0x000C Attribute */
+ H5O_MSG_NAME, /*0x000D Object name */
+ H5O_MSG_MTIME, /*0x000E Object modification date and time */
+ H5O_MSG_SHMESG, /*0x000F File-wide shared message table */
+ H5O_MSG_CONT, /*0x0010 Object header continuation */
+ H5O_MSG_STAB, /*0x0011 Symbol table */
+ H5O_MSG_MTIME_NEW, /*0x0012 New Object modification date and time */
+ H5O_MSG_BTREEK, /*0x0013 Non-default v1 B-tree 'K' values */
+ H5O_MSG_DRVINFO, /*0x0014 Driver info settings */
+ H5O_MSG_AINFO, /*0x0015 Attribute information */
+ H5O_MSG_REFCOUNT, /*0x0016 Object's ref. count */
+ H5O_MSG_FSINFO, /*0x0017 Free-space manager info */
+ H5O_MSG_MDCI, /*0x0018 Metadata cache image */
+ H5O_MSG_UNKNOWN, /*0x0019 Placeholder for unknown message */
+#ifdef H5O_ENABLE_BOGUS
+ H5O_MSG_BOGUS_INVALID, /*0x001A "Bogus invalid" (for testing) */
+#else /* H5O_ENABLE_BOGUS */
+ NULL, /*0x001A "Bogus invalid" (for testing) */
+#endif /* H5O_ENABLE_BOGUS */
+};
+
+/* Format version bounds for object header */
+const unsigned H5O_obj_ver_bounds[] = {
+ H5O_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5O_VERSION_2, /* H5F_LIBVER_V18 */
+ H5O_VERSION_LATEST /* H5F_LIBVER_LATEST */
+};
+
+/* Declare a free list to manage the H5O_t struct */
+H5FL_DEFINE(H5O_t);
+
+/* Declare a free list to manage the H5O_mesg_t sequence information */
+H5FL_SEQ_DEFINE(H5O_mesg_t);
+
+/* Declare a free list to manage the H5O_chunk_t sequence information */
+H5FL_SEQ_DEFINE(H5O_chunk_t);
+
+/* Declare a free list to manage the chunk image information */
+H5FL_BLK_DEFINE(chunk_image);
+
+/* Declare external the free list for H5O_cont_t sequences */
+H5FL_SEQ_EXTERN(H5O_cont_t);
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/* Declare external the free list for time_t's */
+H5FL_EXTERN(time_t);
+
+/* Declare external the free list for H5_obj_t's */
+H5FL_EXTERN(H5_obj_t);
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Header object ID to class mapping */
+/*
+ * Initialize the object class info table. Begin with the most general types
+ * and end with the most specific. For instance, any object that has a
+ * datatype message is a datatype but only some of them are datasets.
+ */
+static const H5O_obj_class_t *const H5O_obj_class_g[] = {
+ H5O_OBJ_DATATYPE, /* Datatype object (H5O_TYPE_NAMED_DATATYPE - 2) */
+ H5O_OBJ_DATASET, /* Dataset object (H5O_TYPE_DATASET - 1) */
+ H5O_OBJ_GROUP, /* Group object (H5O_TYPE_GROUP - 0) */
+};
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O__init_package
+ *
+ * Purpose: Initialize information specific to H5O interface.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 18, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O__init_package(void)
+{
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* H5O interface sanity checks */
+ HDcompile_assert(H5O_MSG_TYPES == NELMTS(H5O_msg_class_g));
+ HDcompile_assert(sizeof(H5O_fheap_id_t) == H5O_FHEAP_ID_LEN);
+
+ HDcompile_assert(H5O_UNKNOWN_ID < H5O_MSG_TYPES);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O__init_package() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_set_version
+ *
+ * Purpose: Sets the correct version to encode the object header.
+ * Chooses the oldest version possible, unless the file's
+ * low bound indicates otherwise.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Jul 17 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_set_version(H5F_t *f, H5O_t *oh, uint8_t oh_flags, hbool_t store_msg_crt_idx)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* check arguments */
+ HDassert(f);
+ HDassert(oh);
+
+ /* Set the correct version to encode object header with */
+ if(store_msg_crt_idx || (oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED))
+ oh->version = H5O_VERSION_2;
+ else
+ oh->version = H5O_VERSION_1;
+
+ /* Upgrade to the version indicated by the file's low bound if higher */
+ oh->version = MAX(oh->version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]);
+
+ /* File bound check */
+ if(oh->version > H5O_obj_ver_bounds[H5F_HIGH_BOUND(f)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "object header version out of bounds")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_set_version() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_create
+ *
+ * Purpose: Creates a new object header. Allocates space for it and
+ * then calls an initialization function. The object header
+ * is opened for write access and should eventually be
+ * closed by calling H5O_close().
+ *
+ * Return: Success: Non-negative, the ENT argument contains
+ * information about the object header,
+ * including its address.
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * matzke@llnl.gov
+ * Aug 5 1997
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, size_t initial_rc,
+ hid_t ocpl_id, H5O_loc_t *loc/*out*/)
+{
+ H5P_genplist_t *oc_plist; /* Object creation property list */
+ H5O_t *oh = NULL; /* Object header created */
+ haddr_t oh_addr; /* Address of initial object header */
+ size_t oh_size; /* Size of initial object header */
+ uint8_t oh_flags; /* Object header's initial status flags */
+ unsigned insert_flags = H5AC__NO_FLAGS_SET; /* Flags for inserting object header into cache */
+ hbool_t store_msg_crt_idx; /* Whether to always store message creation indices for this file */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* check args */
+ HDassert(f);
+ HDassert(loc);
+ HDassert(TRUE == H5P_isa_class(ocpl_id, H5P_OBJECT_CREATE));
+
+ /* Check for invalid access request */
+ if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR))
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "no write intent on file")
+
+ /* Make certain we allocate at least a reasonable size for the object header */
+ size_hint = H5O_ALIGN_F(f, MAX(H5O_MIN_SIZE, size_hint));
+
+ /* Get the property list */
+ if(NULL == (oc_plist = (H5P_genplist_t *)H5I_object(ocpl_id)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property list")
+
+ /* Get any object header status flags set by properties */
+ if(H5P_get(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &oh_flags) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object header flags")
+
+ /* Allocate the object header and zero out header fields */
+ if(NULL == (oh = H5FL_CALLOC(H5O_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+
+ /* Initialize file-specific information for object header */
+ store_msg_crt_idx = H5F_STORE_MSG_CRT_IDX(f);
+
+ if(H5O_set_version(f, oh, oh_flags, store_msg_crt_idx) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set version of objecdt header")
+
+ oh->sizeof_size = H5F_SIZEOF_SIZE(f);
+ oh->sizeof_addr = H5F_SIZEOF_ADDR(f);
+ oh->swmr_write = !!(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE);
+#ifdef H5O_ENABLE_BAD_MESG_COUNT
+ /* Check whether the "bad message count" property is set */
+ if(H5P_exist_plist(oc_plist, H5O_BAD_MESG_COUNT_NAME) > 0) {
+ /* Retrieve bad message count flag */
+ if(H5P_get(oc_plist, H5O_BAD_MESG_COUNT_NAME, &oh->store_bad_mesg_count) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get bad message count flag")
+ }
+#endif /* H5O_ENABLE_BAD_MESG_COUNT */
+
+ /* Create object header proxy if doing SWMR writes */
+ if(oh->swmr_write) {
+ /* Create virtual entry, for use as proxy */
+ if(NULL == (oh->proxy = H5AC_proxy_entry_create()))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create object header proxy")
+ }
+ else
+ oh->proxy = NULL;
+
+ /* Set initial status flags */
+ oh->flags = oh_flags;
+
+ /* Initialize version-specific fields */
+ if(oh->version > H5O_VERSION_1) {
+ /* Initialize all time fields with current time, if we are storing them */
+ if(oh->flags & H5O_HDR_STORE_TIMES)
+ oh->atime = oh->mtime = oh->ctime = oh->btime = H5_now();
+ else
+ oh->atime = oh->mtime = oh->ctime = oh->btime = 0;
+
+ /* Make certain attribute creation order tracking is enabled if
+ * attributes can be shared in this file.
+ */
+ if(store_msg_crt_idx)
+ oh->flags |= H5O_HDR_ATTR_CRT_ORDER_TRACKED;
+
+ /* Retrieve attribute storage phase change values from property list */
+ if(H5P_get(oc_plist, H5O_CRT_ATTR_MAX_COMPACT_NAME, &oh->max_compact) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get max. # of compact attributes")
+ if(H5P_get(oc_plist, H5O_CRT_ATTR_MIN_DENSE_NAME, &oh->min_dense) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get min. # of dense attributes")
+
+ /* Check for non-default attribute storage phase change values */
+ if(oh->max_compact != H5O_CRT_ATTR_MAX_COMPACT_DEF || oh->min_dense != H5O_CRT_ATTR_MIN_DENSE_DEF)
+ oh->flags |= H5O_HDR_ATTR_STORE_PHASE_CHANGE;
+
+ /* Determine correct value for chunk #0 size bits */
+/* Avoid compiler warning on 32-bit machines */
+#if H5_SIZEOF_SIZE_T > H5_SIZEOF_INT32_T
+ if(size_hint > 4294967295UL)
+ oh->flags |= H5O_HDR_CHUNK0_8;
+ else
+#endif /* H5_SIZEOF_SIZE_T > H5_SIZEOF_INT32_T */
+ if(size_hint > 65535)
+ oh->flags |= H5O_HDR_CHUNK0_4;
+ else if(size_hint > 255)
+ oh->flags |= H5O_HDR_CHUNK0_2;
+ } /* end if */
+ else {
+ /* Reset unused time fields */
+ oh->atime = oh->mtime = oh->ctime = oh->btime = 0;
+ } /* end else */
+
+ /* Compute total size of initial object header */
+ /* (i.e. object header prefix and first chunk) */
+ oh_size = (size_t)H5O_SIZEOF_HDR(oh) + size_hint;
+
+ /* Allocate disk space for header and first chunk */
+ if(HADDR_UNDEF == (oh_addr = H5MF_alloc(f, H5FD_MEM_OHDR, dxpl_id, (hsize_t)oh_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for object header")
+
+ /* Create the chunk list */
+ oh->nchunks = oh->alloc_nchunks = 1;
+ if(NULL == (oh->chunk = H5FL_SEQ_MALLOC(H5O_chunk_t, (size_t)oh->alloc_nchunks)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+
+ /* Initialize the first chunk */
+ oh->chunk[0].addr = oh_addr;
+ oh->chunk[0].size = oh_size;
+ oh->chunk[0].gap = 0;
+
+ /* Allocate enough space for the first chunk */
+ /* (including space for serializing the object header prefix */
+ if(NULL == (oh->chunk[0].image = H5FL_BLK_CALLOC(chunk_image, oh_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ oh->chunk[0].chunk_proxy = NULL;
+
+ /* Put magic # for object header in first chunk */
+ if(oh->version > H5O_VERSION_1)
+ HDmemcpy(oh->chunk[0].image, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+
+ /* Create the message list */
+ oh->nmesgs = 1;
+ oh->alloc_nmesgs = H5O_NMESGS;
+ if(NULL == (oh->mesg = H5FL_SEQ_CALLOC(H5O_mesg_t, oh->alloc_nmesgs)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+
+ /* Initialize the initial "null" message, covering the entire first chunk */
+ oh->mesg[0].type = H5O_MSG_NULL;
+ oh->mesg[0].dirty = TRUE;
+ oh->mesg[0].native = NULL;
+ oh->mesg[0].raw = oh->chunk[0].image + (H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh)) + H5O_SIZEOF_MSGHDR_OH(oh);
+ oh->mesg[0].raw_size = size_hint - (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
+ oh->mesg[0].chunkno = 0;
+
+ /* Check for non-zero initial refcount on the object header */
+ if(initial_rc > 0) {
+ /* Set the initial refcount & pin the header when its inserted */
+ oh->rc = initial_rc;
+ insert_flags |= H5AC__PIN_ENTRY_FLAG;
+ }
+
+ /* Set metadata tag in dxpl_id */
+ H5_BEGIN_TAG(dxpl_id, oh_addr, FAIL);
+
+ /* Cache object header */
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_OHDR, oh_addr, oh, insert_flags) < 0)
+ HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header")
+
+ /* Reset object header pointer, now that it's been inserted into the cache */
+ oh = NULL;
+
+ /* Reset metadata tag in dxpl_id */
+ H5_END_TAG(FAIL);
+
+ /* Set up object location */
+ loc->file = f;
+ loc->addr = oh_addr;
+
+ /* Open it */
+ if(H5O_open(loc) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object header")
+
+done:
+ if(ret_value < 0 && oh)
+ if(H5O__free(oh) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_open
+ *
+ * Purpose: Opens an object header which is described by the symbol table
+ * entry OBJ_ENT.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Monday, January 5, 1998
+ *
+ * Modification:
+ * Raymond Lu
+ * 5 November 2007
+ * Turn off the holding file variable if it's on. When it's
+ * needed, the caller will turn it on again.
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_open(H5O_loc_t *loc)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check args */
+ HDassert(loc);
+ HDassert(loc->file);
+
+#ifdef H5O_DEBUG
+ if(H5DEBUG(O))
+ HDfprintf(H5DEBUG(O), "> %a\n", loc->addr);
+#endif
+
+ /* Turn off the variable for holding file or increment open-lock counters */
+ if(loc->holding_file)
+ loc->holding_file = FALSE;
+ else
+ H5F_INCR_NOPEN_OBJS(loc->file);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_open_name
+ *
+ * Purpose: Opens an object within an HDF5 file.
+ *
+ * Return: Success: An open object identifier
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * March 5 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id, hbool_t app_ref)
+{
+ H5G_loc_t obj_loc; /* Location used to open group */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
+ hbool_t loc_found = FALSE; /* Entry at 'name' found */
+ hid_t ret_value = FAIL;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check args */
+ HDassert(loc);
+ HDassert(name && *name);
+
+ /* Set up opened group location to fill in */
+ obj_loc.oloc = &obj_oloc;
+ obj_loc.path = &obj_path;
+ H5G_loc_reset(&obj_loc);
+
+ /* Find the object's location */
+ if(H5G_loc_find(loc, name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
+ loc_found = TRUE;
+
+ /* Open the object */
+ if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, dxpl_id, app_ref)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
+
+done:
+ if(ret_value < 0 && loc_found)
+ if(H5G_loc_free(&obj_loc) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_open_name() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_open_by_loc
+ *
+ * Purpose: Opens an object and returns an ID given its group loction.
+ *
+ * Return: Success: Open object identifier
+ * Failure: Negative
+ *
+ * Programmer: James Laird
+ * July 25 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5O_open_by_loc(const H5G_loc_t *obj_loc, hid_t lapl_id, hid_t dxpl_id, hbool_t app_ref)
+{
+ const H5O_obj_class_t *obj_class; /* Class of object for location */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ HDassert(obj_loc);
+
+ /* Get the object class for this location */
+ if(NULL == (obj_class = H5O_obj_class(obj_loc->oloc, dxpl_id)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine object class")
+
+ /* Call the object class's 'open' routine */
+ HDassert(obj_class->open);
+ if((ret_value = obj_class->open(obj_loc, lapl_id, dxpl_id, app_ref)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_open_by_loc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_close
+ *
+ * Purpose: Closes an object header that was previously open.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Monday, January 5, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_close(H5O_loc_t *loc, hbool_t *file_closed /*out*/)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check args */
+ HDassert(loc);
+ HDassert(loc->file);
+ HDassert(H5F_NOPEN_OBJS(loc->file) > 0);
+
+ /* Set the file_closed flag to the default value.
+ * This flag lets downstream code know if the file struct is
+ * still accessible and/or likely to contain useful data.
+ * It's needed by the evict-on-close code. Clients can ignore
+ * this value by passing in NULL.
+ */
+ if(file_closed)
+ *file_closed = FALSE;
+
+ /* Decrement open-lock counters */
+ H5F_DECR_NOPEN_OBJS(loc->file);
+
+#ifdef H5O_DEBUG
+ if(H5DEBUG(O)) {
+ if(H5F_FILE_ID(loc->file)< 0 && 1 == H5F_NREFS(loc->file))
+ HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n",
+ loc->addr, (unsigned long)H5F_NOPEN_OBJS(loc->file));
+ else
+ HDfprintf(H5DEBUG(O), "< %a\n", loc->addr);
+ }
+#endif
+
+ /*
+ * If the file open object count has reached the number of open mount points
+ * (each of which has a group open in the file) attempt to close the file.
+ */
+ if(H5F_NOPEN_OBJS(loc->file) == H5F_NMOUNTS(loc->file))
+ /* Attempt to close down the file hierarchy */
+ if(H5F_try_close(loc->file, file_closed) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "problem attempting file close")
+
+ /* Release location information */
+ if(H5O_loc_free(loc) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "problem attempting to free location")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_link_oh
+ *
+ * Purpose: Adjust the link count for an open object header by adding
+ * ADJUST to the link count.
+ *
+ * Return: Success: New link count
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * matzke@llnl.gov
+ * Aug 5 1997
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, hbool_t *deleted)
+{
+ haddr_t addr = H5O_OH_GET_ADDR(oh); /* Object header address */
+ int ret_value = -1; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* check args */
+ HDassert(f);
+ HDassert(oh);
+ HDassert(deleted);
+
+ /* Check for adjusting link count */
+ if(adjust) {
+ if(adjust < 0) {
+ /* Check for too large of an adjustment */
+ if((unsigned)(-adjust) > oh->nlink)
+ HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "link count would be negative")
+
+ /* Adjust the link count for the object header */
+ oh->nlink = (unsigned)((int)oh->nlink + adjust);
+
+ /* Mark object header as dirty in cache */
+ if(H5AC_mark_entry_dirty(oh) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
+
+ /* Check if the object should be deleted */
+ if(oh->nlink == 0) {
+ /* Check if the object is still open by the user */
+ if(H5FO_opened(f, addr) != NULL) {
+ /* Flag the object to be deleted when it's closed */
+ if(H5FO_mark(f, addr, TRUE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't mark object for deletion")
+ } /* end if */
+ else {
+ /* Mark the object header for deletion */
+ *deleted = TRUE;
+ } /* end else */
+ } /* end if */
+ } /* end if */
+ else {
+ /* A new object, or one that will be deleted */
+ if(0 == oh->nlink) {
+ /* Check if the object is currently open, but marked for deletion */
+ if(H5FO_marked(f, addr)) {
+ /* Remove "delete me" flag on the object */
+ if(H5FO_mark(f, addr, FALSE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't mark object for deletion")
+ } /* end if */
+ } /* end if */
+
+ /* Adjust the link count for the object header */
+ oh->nlink = (unsigned)((int)oh->nlink + adjust);
+
+ /* Mark object header as dirty in cache */
+ if(H5AC_mark_entry_dirty(oh) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
+ } /* end if */
+
+ /* Check for operations on refcount message */
+ if(oh->version > H5O_VERSION_1) {
+ /* Check if the object has a refcount message already */
+ if(oh->has_refcount_msg) {
+ /* Check for removing refcount message */
+ if(oh->nlink <= 1) {
+ if(H5O_msg_remove_real(f, oh, H5O_MSG_REFCOUNT, H5O_ALL, NULL, NULL, TRUE, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete refcount message")
+ oh->has_refcount_msg = FALSE;
+ } /* end if */
+ /* Update refcount message with new link count */
+ else {
+ H5O_refcount_t refcount = oh->nlink;
+
+ if(H5O_msg_write_real(f, dxpl_id, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update refcount message")
+ } /* end else */
+ } /* end if */
+ else {
+ /* Check for adding refcount message to object */
+ if(oh->nlink > 1) {
+ H5O_refcount_t refcount = oh->nlink;
+
+ if(H5O_msg_append_real(f, dxpl_id, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to create new refcount message")
+ oh->has_refcount_msg = TRUE;
+ } /* end if */
+ } /* end else */
+ } /* end if */
+ } /* end if */
+
+ /* Set return value */
+ ret_value = (int)oh->nlink;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_link_oh() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_link
+ *
+ * Purpose: Adjust the link count for an object header by adding
+ * ADJUST to the link count.
+ *
+ * Return: Success: New link count
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * matzke@llnl.gov
+ * Aug 5 1997
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id)
+{
+ H5O_t *oh = NULL;
+ hbool_t deleted = FALSE; /* Whether the object was deleted */
+ int ret_value = -1; /* Return value */
+
+ FUNC_ENTER_NOAPI_TAG(dxpl_id, loc->addr, FAIL)
+
+ /* check args */
+ HDassert(loc);
+ HDassert(loc->file);
+ HDassert(H5F_addr_defined(loc->addr));
+
+ /* Pin the object header */
+ if(NULL == (oh = H5O_pin(loc, dxpl_id)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
+
+ /* Call the "real" link routine */
+ if((ret_value = H5O_link_oh(loc->file, adjust, dxpl_id, oh, &deleted)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust object link count")
+
+done:
+ if(oh && H5O_unpin(oh) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
+ if(ret_value >= 0 && deleted && H5O_delete(loc->file, dxpl_id, loc->addr) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file")
+
+ FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
+} /* end H5O_link() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_protect
+ *
+ * Purpose: Wrapper around H5AC_protect for use during a H5O_protect->
+ * H5O_msg_append->...->H5O_msg_append->H5O_unprotect sequence of calls
+ * during an object's creation.
+ *
+ * Return: Success: Pointer to the object header structure for the
+ * object.
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Dec 31 2002
+ *
+ *-------------------------------------------------------------------------
+ */
+H5O_t *
+H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, unsigned prot_flags,
+ hbool_t pin_all_chunks)
+{
+ H5O_t *oh = NULL; /* Object header protected */
+ H5O_cache_ud_t udata; /* User data for protecting object header */
+ H5O_cont_msgs_t cont_msg_info; /* Continuation message info */
+ unsigned file_intent; /* R/W intent on file */
+ H5O_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI_TAG(dxpl_id, loc->addr, NULL)
+
+ /* check args */
+ HDassert(loc);
+ HDassert(loc->file);
+
+ /* prot_flags may only contain the H5AC__READ_ONLY_FLAG */
+ HDassert((prot_flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0);
+
+ /* Check for valid address */
+ if(!H5F_addr_defined(loc->addr))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "address undefined")
+
+ /* Check for write access on the file */
+ file_intent = H5F_INTENT(loc->file);
+ if((0 == (prot_flags & H5AC__READ_ONLY_FLAG)) && (0 == (file_intent & H5F_ACC_RDWR)))
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "no write intent on file")
+
+ /* Construct the user data for protect callback */
+ udata.made_attempt = FALSE;
+ udata.v1_pfx_nmesgs = 0;
+ udata.chunk0_size = 0;
+ udata.oh = NULL;
+ udata.common.f = loc->file;
+ udata.common.dxpl_id = dxpl_id;
+ udata.common.file_intent = file_intent;
+ udata.common.merged_null_msgs = 0;
+ HDmemset(&cont_msg_info, 0, sizeof(cont_msg_info));
+ udata.common.cont_msg_info = &cont_msg_info;
+ udata.common.addr = loc->addr;
+
+ /* Lock the object header into the cache */
+ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, &udata, prot_flags)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header")
+
+ /* Check if there are any continuation messages to process */
+ if(cont_msg_info.nmsgs > 0) {
+ size_t curr_msg; /* Current continuation message to process */
+ H5O_chk_cache_ud_t chk_udata; /* User data for loading chunk */
+
+ /* Sanity check - we should only have continuation messages to process
+ * when the object header is actually loaded from the file.
+ */
+ HDassert(udata.made_attempt == TRUE);
+ HDassert(cont_msg_info.msgs);
+
+ /* Construct the user data for protecting chunks */
+ chk_udata.decoding = TRUE;
+ chk_udata.oh = oh;
+ chk_udata.chunkno = UINT_MAX; /* Set to invalid value, for better error detection */
+ chk_udata.common.f = loc->file;
+ chk_udata.common.dxpl_id = dxpl_id;
+ chk_udata.common.file_intent = file_intent;
+ chk_udata.common.merged_null_msgs = udata.common.merged_null_msgs;
+ chk_udata.common.cont_msg_info = &cont_msg_info;
+
+ /* Read in continuation messages, until there are no more */
+ /* (Note that loading chunks could increase the # of continuation
+ * messages if new ones are found - QAK, 19/11/2016)
+ */
+ curr_msg = 0;
+ while(curr_msg < cont_msg_info.nmsgs) {
+ H5O_chunk_proxy_t *chk_proxy; /* Proxy for chunk, to bring it into memory */
+#ifndef NDEBUG
+ size_t chkcnt = oh->nchunks; /* Count of chunks (for sanity checking) */
+#endif /* NDEBUG */
+
+ /* Bring the chunk into the cache */
+ /* (which adds to the object header) */
+ chk_udata.common.addr = cont_msg_info.msgs[curr_msg].addr;
+ chk_udata.size = cont_msg_info.msgs[curr_msg].size;
+ if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR_CHK, cont_msg_info.msgs[curr_msg].addr, &chk_udata, prot_flags)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header chunk")
+
+ /* Sanity check */
+ HDassert(chk_proxy->oh == oh);
+ HDassert(chk_proxy->chunkno == chkcnt);
+ HDassert(oh->nchunks == (chkcnt + 1));
+
+ /* Release the chunk from the cache */
+ if(H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR_CHK, cont_msg_info.msgs[curr_msg].addr, chk_proxy, H5AC__NO_FLAGS_SET) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header chunk")
+
+ /* Advance to next continuation message */
+ curr_msg++;
+ } /* end while */
+
+ /* Release any continuation messages built up */
+ cont_msg_info.msgs = (H5O_cont_t *)H5FL_SEQ_FREE(H5O_cont_t, cont_msg_info.msgs);
+
+ /* Pass back out some of the chunk's user data */
+ udata.common.merged_null_msgs = chk_udata.common.merged_null_msgs;
+ } /* end if */
+
+ /* Check for incorrect # of object header messages, if we've just loaded
+ * this object header from the file
+ */
+ if(udata.made_attempt) {
+/* Don't enforce the error on an incorrect # of object header messages bug
+ * unless strict format checking is enabled. This allows for older
+ * files, created with a version of the library that had a bug in tracking
+ * the correct # of header messages to be read in without the library
+ * erroring out here. -QAK
+ */
+#ifdef H5_STRICT_FORMAT_CHECKS
+ /* Check for incorrect # of messages in v1 object header */
+ if(oh->version == H5O_VERSION_1 &&
+ (oh->nmesgs + udata.common.merged_null_msgs) != udata.v1_pfx_nmesgs)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "corrupt object header - incorrect # of messages")
+#endif /* H5_STRICT_FORMAT_CHECKS */
+ } /* end if */
+
+#ifdef H5O_DEBUG
+H5O_assert(oh);
+#endif /* H5O_DEBUG */
+
+ /* Pin the other chunks also when requested, so that the object header
+ * proxy can be set up.
+ */
+ if(pin_all_chunks && oh->nchunks > 1) {
+ unsigned u; /* Local index variable */
+
+ /* Sanity check */
+ HDassert(oh->swmr_write);
+
+ /* Iterate over chunks > 0 */
+ for(u = 1; u < oh->nchunks; u++) {
+ H5O_chunk_proxy_t *chk_proxy; /* Chunk proxy */
+
+ /* Protect chunk */
+ if(NULL == (chk_proxy = H5O_chunk_protect(loc->file, dxpl_id, oh, u)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header chunk")
+
+ /* Pin chunk proxy*/
+ if(H5AC_pin_protected_entry(chk_proxy) < 0 )
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, NULL, "unable to pin object header chunk")
+
+ /* Unprotect chunk */
+ if(H5O_chunk_unprotect(loc->file, dxpl_id, chk_proxy, FALSE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to unprotect object header chunk")
+
+ /* Preserve chunk proxy pointer for later */
+ oh->chunk[u].chunk_proxy = chk_proxy;
+ } /* end for */
+
+ /* Set the flag for the unprotect */
+ oh->chunks_pinned = TRUE;
+ } /* end if */
+
+ /* Set return value */
+ ret_value = oh;
+
+done:
+ if(ret_value == NULL && oh)
+ if(H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
+
+ FUNC_LEAVE_NOAPI_TAG(ret_value, NULL)
+} /* end H5O_protect() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_pin
+ *
+ * Purpose: Pin an object header down for use during a sequence of message
+ * operations, which prevents the object header from being
+ * evicted from the cache.
+ *
+ * Return: Success: Pointer to the object header structure for the
+ * object.
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Jul 13 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+H5O_t *
+H5O_pin(const H5O_loc_t *loc, hid_t dxpl_id)
+{
+ H5O_t *oh = NULL; /* Object header */
+ H5O_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* check args */
+ HDassert(loc);
+
+ /* Get header */
+ if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__NO_FLAGS_SET, FALSE)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header")
+
+ /* Increment the reference count on the object header */
+ /* (which will pin it, if appropriate) */
+ if(H5O_inc_rc(oh) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, NULL, "unable to increment reference count on object header")
+
+ /* Set the return value */
+ ret_value = oh;
+
+done:
+ /* Release the object header from the cache */
+ if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_pin() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_unpin
+ *
+ * Purpose: Unpin an object header, allowing it to be evicted from the
+ * metadata cache.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Jul 13 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_unpin(H5O_t *oh)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* check args */
+ HDassert(oh);
+
+ /* Decrement the reference count on the object header */
+ /* (which will unpin it, if appropriate) */
+ if(H5O_dec_rc(oh) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement reference count on object header")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_unpin() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_unprotect
+ *
+ * Purpose: Wrapper around H5AC_unprotect for use during a H5O_protect->
+ * H5O_msg_append->...->H5O_msg_append->H5O_unprotect sequence of calls
+ * during an object's creation.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Dec 31 2002
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_unprotect(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, unsigned oh_flags)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* check args */
+ HDassert(loc);
+ HDassert(oh);
+
+ /* Unpin the other chunks */
+ if(oh->chunks_pinned && oh->nchunks > 1) {
+ unsigned u; /* Local index variable */
+
+ /* Sanity check */
+ HDassert(oh->swmr_write);
+
+ /* Iterate over chunks > 0 */
+ for(u = 1; u < oh->nchunks; u++) {
+ if(NULL != oh->chunk[u].chunk_proxy) {
+ /* Release chunk proxy */
+ if(H5AC_unpin_entry(oh->chunk[u].chunk_proxy) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header chunk")
+ oh->chunk[u].chunk_proxy = NULL;
+ } /* end if */
+ } /* end for */
+
+ /* Reet the flag from the unprotect */
+ oh->chunks_pinned = FALSE;
+ } /* end if */
+
+ /* Unprotect the object header */
+ if(H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, oh->chunk[0].addr, oh, oh_flags) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_unprotect() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_touch_oh
+ *
+ * Purpose: If FORCE is non-zero then create a modification time message
+ * unless one already exists. Then update any existing
+ * modification time message with the current time.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Monday, July 27, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force)
+{
+ H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
+ hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */
+ time_t now; /* Current time */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ HDassert(f);
+ HDassert(oh);
+
+ /* Check if this object header is tracking times */
+ if(oh->flags & H5O_HDR_STORE_TIMES) {
+ /* Get current time */
+ now = H5_now();
+
+ /* Check version, to determine how to store time information */
+ if(oh->version == H5O_VERSION_1) {
+ size_t idx; /* Index of modification time message to update */
+
+ /* Look for existing message */
+ for(idx = 0; idx < oh->nmesgs; idx++)
+ if(H5O_MSG_MTIME == oh->mesg[idx].type || H5O_MSG_MTIME_NEW == oh->mesg[idx].type)
+ break;
+
+ /* Create a new message, if necessary */
+ if(idx == oh->nmesgs) {
+ unsigned mesg_flags = 0; /* Flags for message in object header */
+
+ /* If we would have to create a new message, but we aren't 'forcing' it, get out now */
+ if(!force)
+ HGOTO_DONE(SUCCEED); /*nothing to do*/
+
+ /* Allocate space for the modification time message */
+ if(H5O_msg_alloc(f, dxpl_id, oh, H5O_MSG_MTIME_NEW, &mesg_flags, &now, &idx) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for modification time message")
+
+ /* Set the message's flags if appropriate */
+ oh->mesg[idx].flags = (uint8_t)mesg_flags;
+ } /* end if */
+
+ /* Protect chunk */
+ if(NULL == (chk_proxy = H5O_chunk_protect(f, dxpl_id, oh, oh->mesg[idx].chunkno)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk")
+
+ /* Allocate 'native' space, if necessary */
+ if(NULL == oh->mesg[idx].native) {
+ if(NULL == (oh->mesg[idx].native = H5FL_MALLOC(time_t)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for modification time message")
+ } /* end if */
+
+ /* Update the message */
+ *((time_t *)(oh->mesg[idx].native)) = now;
+
+ /* Mark the message as dirty */
+ oh->mesg[idx].dirty = TRUE;
+ chk_dirtied = TRUE;
+ } /* end if */
+ else {
+ /* XXX: For now, update access time & change fields in the object header */
+ /* (will need to add some code to update modification time appropriately) */
+ oh->atime = oh->ctime = now;
+
+ /* Mark object header as dirty in cache */
+ if(H5AC_mark_entry_dirty(oh) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
+ } /* end else */
+ } /* end if */
+
+done:
+ /* Release chunk */
+ if(chk_proxy && H5O_chunk_unprotect(f, dxpl_id, chk_proxy, chk_dirtied) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_touch_oh() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_touch
+ *
+ * Purpose: Touch an object by setting the modification time to the
+ * current time and marking the object as dirty. Unless FORCE
+ * is non-zero, nothing happens if there is no MTIME message in
+ * the object header.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Monday, July 27, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_touch(const H5O_loc_t *loc, hbool_t force, hid_t dxpl_id)
+{
+ H5O_t *oh = NULL; /* Object header to modify */
+ unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting object header */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* check args */
+ HDassert(loc);
+
+ /* Get the object header */
+ if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__NO_FLAGS_SET, FALSE)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+
+ /* Create/Update the modification time message */
+ if(H5O_touch_oh(loc->file, dxpl_id, oh, force) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to update object modificaton time")
+
+ /* Mark object header as changed */
+ oh_flags |= H5AC__DIRTIED_FLAG;
+
+done:
+ if(oh && H5O_unprotect(loc, dxpl_id, oh, oh_flags) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_touch() */
+
+#ifdef H5O_ENABLE_BOGUS
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_bogus_oh
+ *
+ * Purpose: Create a "bogus" message unless one already exists.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * <koziol@ncsa.uiuc.edu>
+ * Tuesday, January 21, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned bogus_id, unsigned mesg_flags)
+{
+ size_t idx; /* Local index variable */
+ H5O_msg_class_t *type; /* Message class type */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ HDassert(f);
+ HDassert(oh);
+
+ /* Look for existing message */
+ for(idx = 0; idx < oh->nmesgs; idx++)
+ if(H5O_MSG_BOGUS_VALID == oh->mesg[idx].type || H5O_MSG_BOGUS_INVALID == oh->mesg[idx].type)
+ break;
+
+ /* Create a new message */
+ if(idx == oh->nmesgs) {
+ H5O_bogus_t *bogus; /* Pointer to the bogus information */
+
+ /* Allocate the native message in memory */
+ if(NULL == (bogus = H5MM_malloc(sizeof(H5O_bogus_t))))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for 'bogus' message")
+
+ /* Update the native value */
+ bogus->u = H5O_BOGUS_VALUE;
+
+ if(bogus_id == H5O_BOGUS_VALID_ID)
+ type = H5O_MSG_BOGUS_VALID;
+ else if(bogus_id == H5O_BOGUS_INVALID_ID)
+ type = H5O_MSG_BOGUS_INVALID;
+ else
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID for 'bogus' message")
+
+ /* Allocate space in the object header for bogus message */
+ if(H5O_msg_alloc(f, dxpl_id, oh, type, &mesg_flags, bogus, &idx) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message")
+
+ /* Point to "bogus" information (take it over) */
+ oh->mesg[idx].native = bogus;
+
+ /* Set the appropriate flags for the message */
+ oh->mesg[idx].flags = mesg_flags;
+
+ /* Mark the message and object header as dirty */
+ oh->mesg[idx].dirty = TRUE;
+ oh->cache_info.is_dirty = TRUE;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_bogus_oh() */
+#endif /* H5O_ENABLE_BOGUS */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_delete
+ *
+ * Purpose: Delete an object header from a file. This frees the file
+ * space used for the object header (and it's continuation blocks)
+ * and also walks through each header message and asks it to
+ * remove all the pieces of the file referenced by the header.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Mar 19 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr)
+{
+ H5O_t *oh = NULL; /* Object header information */
+ H5O_loc_t loc; /* Object location for object to delete */
+ unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting object header */
+ hbool_t corked;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_TAG(dxpl_id, addr, FAIL)
+
+ /* Check args */
+ HDassert(f);
+ HDassert(H5F_addr_defined(addr));
+
+ /* Set up the object location */
+ loc.file = f;
+ loc.addr = addr;
+ loc.holding_file = FALSE;
+
+ /* Get the object header information */
+ if(NULL == (oh = H5O_protect(&loc, dxpl_id, H5AC__NO_FLAGS_SET, FALSE)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+
+ /* Delete object */
+ if(H5O_delete_oh(f, dxpl_id, oh) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file")
+
+ /* Uncork cache entries with tag: addr */
+ if(H5AC_cork(f, addr, H5AC__GET_CORKED, &corked) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status")
+ if(corked)
+ if(H5AC_cork(f, addr, H5AC__UNCORK, NULL) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork an object")
+
+ /* Mark object header as deleted */
+ oh_flags = H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
+
+done:
+ if(oh && H5O_unprotect(&loc, dxpl_id, oh, oh_flags) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+
+ FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
+} /* end H5O_delete() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_delete_oh
+ *
+ * Purpose: Internal function to:
+ * Delete an object header from a file. This frees the file
+ * space used for the object header (and it's continuation blocks)
+ * and also walks through each header message and asks it to
+ * remove all the pieces of the file referenced by the header.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Mar 19 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_delete_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
+{
+ H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */
+ unsigned u;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Check args */
+ HDassert(f);
+ HDassert(oh);
+
+ /* Walk through the list of object header messages, asking each one to
+ * delete any file space used
+ */
+ for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) {
+ /* Free any space referred to in the file from this message */
+ if(H5O_delete_mesg(f, dxpl_id, oh, curr_msg) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete file space for object header message")
+ } /* end for */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_delete_oh() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_obj_type
+ *
+ * Purpose: Retrieves the type of object pointed to by `loc'.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, November 4, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type, hid_t dxpl_id)
+{
+ H5O_t *oh = NULL; /* Object header for location */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_TAG(dxpl_id, loc->addr, FAIL)
+
+ /* Load the object header */
+ if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+
+ /* Retrieve the type of the object */
+ if(H5O_obj_type_real(oh, obj_type) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type")
+
+done:
+ if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+
+ FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
+} /* end H5O_obj_type() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_obj_type_real
+ *
+ * Purpose: Returns the type of object pointed to by `oh'.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Monday, November 21, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_obj_type_real(H5O_t *oh, H5O_type_t *obj_type)
+{
+ const H5O_obj_class_t *obj_class; /* Class of object for header */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Sanity check */
+ HDassert(oh);
+ HDassert(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);
+
+ /* Set type to "unknown" */
+ *obj_type = H5O_TYPE_UNKNOWN;
+ }
+ else {
+ /* Set object type */
+ *obj_type = obj_class->type;
+ }
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_obj_type_real() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_obj_class
+ *
+ * Purpose: Returns the class of object pointed to by `loc'.
+ *
+ * Return: Success: An object class
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * Monday, November 6, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+const H5O_obj_class_t *
+H5O_obj_class(const H5O_loc_t *loc, hid_t dxpl_id)
+{
+ H5O_t *oh = NULL; /* Object header for location */
+ const H5O_obj_class_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, loc->addr, NULL)
+
+ /* Load the object header */
+ if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header")
+
+ /* Test whether entry qualifies as a particular type of object */
+ if(NULL == (ret_value = H5O_obj_class_real(oh)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to determine object type")
+
+done:
+ if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
+
+ FUNC_LEAVE_NOAPI_TAG(ret_value, NULL)
+} /* end H5O_obj_class() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_obj_class_real
+ *
+ * Purpose: Returns the class of object pointed to by `oh'.
+ *
+ * Return: Success: An object class
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * Monday, November 21, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+static const H5O_obj_class_t *
+H5O_obj_class_real(H5O_t *oh)
+{
+ size_t i; /* Local index variable */
+ const H5O_obj_class_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Sanity check */
+ HDassert(oh);
+
+ /* Test whether entry qualifies as a particular type of object */
+ /* (Note: loop is in reverse order, to test specific objects first) */
+ for(i = NELMTS(H5O_obj_class_g); i > 0; --i) {
+ htri_t isa; /* Is entry a particular type? */
+
+ if((isa = (H5O_obj_class_g[i - 1]->isa)(oh)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type")
+ else if(isa)
+ HGOTO_DONE(H5O_obj_class_g[i - 1])
+ }
+
+ if(0 == i)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_obj_class_real() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_get_loc
+ *
+ * Purpose: Gets the object location for an object given its ID.
+ *
+ * Return: Success: Pointer to H5O_loc_t
+ * Failure: NULL
+ *
+ * Programmer: James Laird
+ * July 25 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+H5O_loc_t *
+H5O_get_loc(hid_t object_id)
+{
+ H5O_loc_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ switch(H5I_get_type(object_id)) {
+ case H5I_GROUP:
+ if(NULL == (ret_value = H5O_OBJ_GROUP->get_oloc(object_id)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from group ID")
+ break;
+
+ case H5I_DATASET:
+ if(NULL == (ret_value = H5O_OBJ_DATASET->get_oloc(object_id)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from dataset ID")
+ break;
+
+ case H5I_DATATYPE:
+ if(NULL == (ret_value = H5O_OBJ_DATATYPE->get_oloc(object_id)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from datatype ID")
+ break;
+
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_FILE:
+ case H5I_DATASPACE:
+ case H5I_ATTR:
+ case H5I_REFERENCE:
+ case H5I_VFL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_NTYPES:
+ default:
+ HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, NULL, "invalid object type")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_get_loc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_loc_reset
+ *
+ * Purpose: Reset a object location to an empty state
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Monday, September 19, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_loc_reset(H5O_loc_t *loc)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Check arguments */
+ HDassert(loc);
+
+ /* Clear the object location to an empty state */
+ HDmemset(loc, 0, sizeof(H5O_loc_t));
+ loc->addr = HADDR_UNDEF;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_loc_reset() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_loc_copy
+ *
+ * Purpose: Copy object location information
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Monday, September 19, 2005
+ *
+ * Notes: 'depth' parameter determines how much of the group entry
+ * structure we want to copy. The values are:
+ * H5_COPY_SHALLOW - Copy all the field values from the source
+ * to the destination, but not copying objects pointed to.
+ * (Destination "takes ownership" of objects pointed to)
+ * H5_COPY_DEEP - Copy all the fields from the source to
+ * the destination, deep copying objects pointed to.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_loc_copy(H5O_loc_t *dst, H5O_loc_t *src, H5_copy_depth_t depth)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Check arguments */
+ HDassert(src);
+ HDassert(dst);
+ HDassert(depth == H5_COPY_SHALLOW || depth == H5_COPY_DEEP);
+
+ /* Copy the top level information */
+ HDmemcpy(dst, src, sizeof(H5O_loc_t));
+
+ /* Deep copy the names */
+ if(depth == H5_COPY_DEEP) {
+ /* If the original entry was holding open the file, this one should
+ * hold it open, too.
+ */
+ if(src->holding_file)
+ H5F_INCR_NOPEN_OBJS(dst->file);
+ }
+ else if(depth == H5_COPY_SHALLOW) {
+ H5O_loc_reset(src);
+ }
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_loc_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_loc_hold_file
+ *
+ * Purpose: Have this object header hold a file open until it is
+ * released.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: James Laird
+ * Wednesday, August 16, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_loc_hold_file(H5O_loc_t *loc)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Check arguments */
+ HDassert(loc);
+ HDassert(loc->file);
+
+ /* If this location is not already holding its file open, do so. */
+ if(!loc->holding_file) {
+ H5F_INCR_NOPEN_OBJS(loc->file);
+ loc->holding_file = TRUE;
+ }
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_loc_hold_file() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_loc_free
+ *
+ * Purpose: Release resources used by this object header location.
+ * Not to be confused with H5O_close; this is used on
+ * locations that don't correspond to open objects.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: James Laird
+ * Wednesday, August 16, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_loc_free(H5O_loc_t *loc)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Check arguments */
+ HDassert(loc);
+
+ /* If this location is holding its file open try to close the file. */
+ if(loc->holding_file) {
+ H5F_DECR_NOPEN_OBJS(loc->file);
+ loc->holding_file = FALSE;
+ if(H5F_NOPEN_OBJS(loc->file) <= 0) {
+ if(H5F_try_close(loc->file, NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file")
+ }
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_loc_free() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_get_hdr_info
+ *
+ * Purpose: Retrieve the object header information for an object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * September 22 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_get_hdr_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_hdr_info_t *hdr)
+{
+ H5O_t *oh = NULL; /* Object header */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check args */
+ HDassert(loc);
+ HDassert(hdr);
+
+ /* Reset the object header info structure */
+ HDmemset(hdr, 0, sizeof(*hdr));
+
+ /* Get the object header */
+ if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+
+ /* Get the information for the object header */
+ if(H5O_get_hdr_info_real(oh, hdr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info")
+
+done:
+ if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_get_hdr_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_get_hdr_info_real
+ *
+ * Purpose: Internal routine to retrieve the object header information for an object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * September 22 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr)
+{
+ const H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */
+ const H5O_chunk_t *curr_chunk; /* Pointer to current message being operated on */
+ unsigned u; /* Local index variable */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Check args */
+ HDassert(oh);
+ HDassert(hdr);
+
+ /* Set the version for the object header */
+ hdr->version = oh->version;
+
+ /* Set the number of messages & chunks */
+ H5_CHECKED_ASSIGN(hdr->nmesgs, unsigned, oh->nmesgs, size_t);
+ H5_CHECKED_ASSIGN(hdr->nchunks, unsigned, oh->nchunks, size_t);
+
+ /* Set the status flags */
+ hdr->flags = oh->flags;
+
+ /* Iterate over all the messages, accumulating message size & type information */
+ hdr->space.meta = (hsize_t)H5O_SIZEOF_HDR(oh) + (hsize_t)(H5O_SIZEOF_CHKHDR_OH(oh) * (oh->nchunks - 1));
+ hdr->space.mesg = 0;
+ hdr->space.free = 0;
+ hdr->mesg.present = 0;
+ hdr->mesg.shared = 0;
+ for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) {
+ uint64_t type_flag; /* Flag for message type */
+
+ /* Accumulate space usage information, based on the type of message */
+ if(H5O_NULL_ID == curr_msg->type->id)
+ hdr->space.free += (hsize_t)((size_t)H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size);
+ else if(H5O_CONT_ID == curr_msg->type->id)
+ hdr->space.meta += (hsize_t)((size_t)H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size);
+ else {
+ hdr->space.meta += (hsize_t)H5O_SIZEOF_MSGHDR_OH(oh);
+ hdr->space.mesg += curr_msg->raw_size;
+ } /* end else */
+
+ /* Set flag to indicate presence of message type */
+ type_flag = ((uint64_t)1) << curr_msg->type->id;
+ hdr->mesg.present |= type_flag;
+
+ /* Set flag if the message is shared in some way */
+ if(curr_msg->flags & H5O_MSG_FLAG_SHARED) \
+ hdr->mesg.shared |= type_flag;
+ } /* end for */
+
+ /* Iterate over all the chunks, adding any gaps to the free space */
+ hdr->space.total = 0;
+ for(u = 0, curr_chunk = &oh->chunk[0]; u < oh->nchunks; u++, curr_chunk++) {
+ /* Accumulate the size of the header on disk */
+ hdr->space.total += curr_chunk->size;
+
+ /* If the chunk has a gap, add it to the free space */
+ hdr->space.free += curr_chunk->gap;
+ } /* end for */
+
+ /* Sanity check that all the bytes are accounted for */
+ HDassert(hdr->space.total == (hdr->space.free + hdr->space.meta + hdr->space.mesg));
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_get_hdr_info_real() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_get_info
+ *
+ * Purpose: Retrieve the information for an object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * November 21 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_get_info(const H5O_loc_t *loc, hid_t dxpl_id, hbool_t want_ih_info,
+ H5O_info_t *oinfo)
+{
+ const H5O_obj_class_t *obj_class; /* Class of object for header */
+ H5O_t *oh = NULL; /* Object header */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_TAG(dxpl_id, loc->addr, FAIL)
+
+ /* Check args */
+ HDassert(loc);
+ HDassert(oinfo);
+
+ /* Get the object header */
+ if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+
+ /* Reset the object info structure */
+ HDmemset(oinfo, 0, sizeof(*oinfo));
+
+ /* Retrieve the file's fileno */
+ H5F_GET_FILENO(loc->file, oinfo->fileno);
+
+ /* Set the object's address */
+ oinfo->addr = loc->addr;
+
+ /* Get class for object */
+ if(NULL == (obj_class = H5O_obj_class_real(oh)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine object class")
+
+ /* Retrieve the type of the object */
+ oinfo->type = obj_class->type;
+
+ /* Set the object's reference count */
+ oinfo->rc = oh->nlink;
+
+ /* Get modification time for object */
+ if(oh->version > H5O_VERSION_1) {
+ oinfo->atime = oh->atime;
+ oinfo->mtime = oh->mtime;
+ oinfo->ctime = oh->ctime;
+ oinfo->btime = oh->btime;
+ } /* end if */
+ else {
+ htri_t exists; /* Flag if header message of interest exists */
+
+ /* No information for access & modification fields */
+ /* (we stopped updating the "modification time" header message for
+ * raw data changes, so the "modification time" header message
+ * is closest to the 'change time', in POSIX terms - QAK)
+ */
+ oinfo->atime = 0;
+ oinfo->mtime = 0;
+ oinfo->btime = 0;
+
+ /* Might be information for modification time */
+ if((exists = H5O_msg_exists_oh(oh, H5O_MTIME_ID)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME message")
+ if(exists > 0) {
+ /* Get "old style" modification time info */
+ if(NULL == H5O_msg_read_oh(loc->file, dxpl_id, oh, H5O_MTIME_ID, &oinfo->ctime))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME message")
+ } /* end if */
+ else {
+ /* Check for "new style" modification time info */
+ if((exists = H5O_msg_exists_oh(oh, H5O_MTIME_NEW_ID)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME_NEW message")
+ if(exists > 0) {
+ /* Get "new style" modification time info */
+ if(NULL == H5O_msg_read_oh(loc->file, dxpl_id, oh, H5O_MTIME_NEW_ID, &oinfo->ctime))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME_NEW message")
+ } /* end if */
+ else
+ oinfo->ctime = 0;
+ } /* end else */
+ } /* end else */
+
+ /* Get the information for the object header */
+ if(H5O_get_hdr_info_real(oh, &oinfo->hdr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info")
+
+ /* Retrieve # of attributes */
+ if(H5O_attr_count_real(loc->file, dxpl_id, oh, &oinfo->num_attrs) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute count")
+
+ /* Get B-tree & heap metadata storage size, if requested */
+ if(want_ih_info) {
+ /* Check for 'bh_info' callback for this type of object */
+ if(obj_class->bh_info) {
+ /* Call the object's class 'bh_info' routine */
+ if((obj_class->bh_info)(loc, dxpl_id, oh, &oinfo->meta_size.obj) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object's btree & heap info")
+ } /* end if */
+
+ /* Get B-tree & heap info for any attributes */
+ if(oinfo->num_attrs > 0) {
+ if(H5O_attr_bh_info(loc->file, dxpl_id, oh, &oinfo->meta_size.attr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute btree & heap info")
+ } /* end if */
+ } /* end if */
+
+done:
+ if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+
+ FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
+} /* end H5O_get_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_get_create_plist
+ *
+ * Purpose: Retrieve the object creation properties for an object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * November 28 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_get_create_plist(const H5O_loc_t *loc, hid_t dxpl_id, H5P_genplist_t *oc_plist)
+{
+ H5O_t *oh = NULL; /* Object header */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check args */
+ HDassert(loc);
+ HDassert(oc_plist);
+
+ /* Get the object header */
+ if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+
+ /* Set property values, if they were used for the object */
+ if(oh->version > H5O_VERSION_1) {
+ uint8_t ohdr_flags; /* "User-visible" object header status flags */
+
+ /* Set attribute storage values */
+ if(H5P_set(oc_plist, H5O_CRT_ATTR_MAX_COMPACT_NAME, &oh->max_compact) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set max. # of compact attributes in property list")
+ if(H5P_set(oc_plist, H5O_CRT_ATTR_MIN_DENSE_NAME, &oh->min_dense) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set min. # of dense attributes in property list")
+
+ /* Mask off non-"user visible" flags */
+ ohdr_flags = oh->flags & (H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED | H5O_HDR_STORE_TIMES);
+
+ /* Set object header flags */
+ if(H5P_set(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set object header flags")
+ } /* end if */
+
+done:
+ if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_get_create_plist() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_get_nlinks
+ *
+ * Purpose: Retrieve the number of link messages read in from the file
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * March 11 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_get_nlinks(const H5O_loc_t *loc, hid_t dxpl_id, hsize_t *nlinks)
+{
+ H5O_t *oh = NULL; /* Object header */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check args */
+ HDassert(loc);
+ HDassert(nlinks);
+
+ /* Get the object header */
+ if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+
+ /* Retrieve the # of link messages seen when the object header was loaded */
+ *nlinks = oh->link_msgs_seen;
+
+done:
+ if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_get_nlinks() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_obj_create
+ *
+ * Purpose: Creates an object, in an abstract manner.
+ *
+ * Return: Success: Pointer to object opened
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * April 9 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5O_obj_create(H5F_t *f, H5O_type_t obj_type, void *crt_info, H5G_loc_t *obj_loc,
+ hid_t dxpl_id)
+{
+ size_t u; /* Local index variable */
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Sanity checks */
+ HDassert(f);
+ HDassert(obj_type >= H5O_TYPE_GROUP && obj_type <= H5O_TYPE_NAMED_DATATYPE);
+ HDassert(crt_info);
+ HDassert(obj_loc);
+
+ /* Iterate through the object classes */
+ for(u = 0; u < NELMTS(H5O_obj_class_g); u++) {
+ /* Check for correct type of object to create */
+ if(H5O_obj_class_g[u]->type == obj_type) {
+ /* Call the object class's 'create' routine */
+ HDassert(H5O_obj_class_g[u]->create);
+ if(NULL == (ret_value = H5O_obj_class_g[u]->create(f, crt_info, obj_loc, dxpl_id)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object")
+
+ /* Break out of loop */
+ break;
+ } /* end if */
+ } /* end for */
+ HDassert(ret_value);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_obj_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_get_oh_addr
+ *
+ * Purpose: Retrieve the address of the object header
+ *
+ * Note: This routine participates in the "Inlining C struct access"
+ * pattern, don't call it directly, use the appropriate macro
+ * defined in H5Oprivate.h.
+ *
+ * Return: Success: Valid haddr_t
+ * Failure: HADDR_UNDEF
+ *
+ * Programmer: Quincey Koziol
+ * March 15 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+haddr_t
+H5O_get_oh_addr(const H5O_t *oh)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(oh);
+ HDassert(oh->chunk);
+
+ FUNC_LEAVE_NOAPI(oh->chunk[0].addr)
+} /* end H5O_get_oh_addr() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_get_rc_and_type
+ *
+ * Purpose: Retrieve an object's reference count and type
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * November 4 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_get_rc_and_type(const H5O_loc_t *loc, hid_t dxpl_id, unsigned *rc, H5O_type_t *otype)
+{
+ H5O_t *oh = NULL; /* Object header */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check args */
+ HDassert(loc);
+
+ /* Get the object header */
+ if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
+
+ /* Set the object's reference count */
+ if(rc)
+ *rc = oh->nlink;
+
+ /* Retrieve the type of the object */
+ if(otype)
+ if(H5O_obj_type_real(oh, otype) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type")
+
+done:
+ if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_get_rc_and_type() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_free_visit_visited
+ *
+ * Purpose: Free the key for an object visited during a group traversal
+ *
+ * Return: Non-negative on success, negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Nov 25, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_free_visit_visited(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *operator_data/*in,out*/)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ item = H5FL_FREE(H5_obj_t, item);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_free_visit_visited() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_visit_cb
+ *
+ * Purpose: Callback function for recursively visiting objects from a group
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Nov 25, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t *linfo,
+ void *_udata)
+{
+ H5O_iter_visit_ud_t *udata = (H5O_iter_visit_ud_t *)_udata; /* User data for callback */
+ H5G_loc_t obj_loc; /* Location of object */
+ H5G_name_t obj_path; /* Object's group hier. path */
+ H5O_loc_t obj_oloc; /* Object's object location */
+ hbool_t obj_found = FALSE; /* Object at 'name' found */
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Sanity check */
+ HDassert(name);
+ HDassert(linfo);
+ HDassert(udata);
+
+ /* Check if this is a hard link */
+ if(linfo->type == H5L_TYPE_HARD) {
+ H5_obj_t obj_pos; /* Object "position" for this object */
+
+ /* Set up opened group location to fill in */
+ obj_loc.oloc = &obj_oloc;
+ obj_loc.path = &obj_path;
+ H5G_loc_reset(&obj_loc);
+
+ /* Find the object using the LAPL passed in */
+ /* (Correctly handles mounted files) */
+ if(H5G_loc_find(udata->start_loc, name, &obj_loc/*out*/, udata->lapl_id, udata->dxpl_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, H5_ITER_ERROR, "object not found")
+ obj_found = TRUE;
+
+ /* Construct unique "position" for this object */
+ H5F_GET_FILENO(obj_oloc.file, obj_pos.fileno);
+ obj_pos.addr = obj_oloc.addr;
+
+ /* Check if we've seen the object the link references before */
+ if(NULL == H5SL_search(udata->visited, &obj_pos)) {
+ H5O_info_t oinfo; /* Object info */
+
+ /* Get the object's info */
+ if(H5O_get_info(&obj_oloc, udata->dxpl_id, TRUE, &oinfo) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get object info")
+
+ /* Make the application callback */
+ ret_value = (udata->op)(udata->obj_id, name, &oinfo, udata->op_data);
+
+ /* Check for continuing to visit objects */
+ if(ret_value == H5_ITER_CONT) {
+ /* If its ref count is > 1, we add it to the list of visited objects */
+ /* (because it could come up again during traversal) */
+ if(oinfo.rc > 1) {
+ H5_obj_t *new_node; /* New object node for visited list */
+
+ /* Allocate new object "position" node */
+ if((new_node = H5FL_MALLOC(H5_obj_t)) == NULL)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, H5_ITER_ERROR, "can't allocate object node")
+
+ /* Set node information */
+ *new_node = obj_pos;
+
+ /* Add to list of visited objects */
+ if(H5SL_insert(udata->visited, new_node, new_node) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, H5_ITER_ERROR, "can't insert object node into visited list")
+ } /* end if */
+ } /* end if */
+ } /* end if */
+ } /* end if */
+
+done:
+ /* Release resources */
+ if(obj_found && H5G_loc_free(&obj_loc) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5_ITER_ERROR, "can't free location")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_visit_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_visit
+ *
+ * Purpose: Recursively visit an object and all the objects reachable
+ * from it. If the starting object is a group, all the objects
+ * linked to from that group will be visited. Links within
+ * each group are visited according to the order within the
+ * specified index (unless the specified index does not exist for
+ * a particular group, then the "name" index is used).
+ *
+ * NOTE: Soft links and user-defined links are ignored during
+ * this operation.
+ *
+ * NOTE: Each _object_ reachable from the initial group will only
+ * be visited once. If multiple hard links point to the same
+ * object, the first link to the object's path (according to the
+ * iteration index and iteration order given) will be used to in
+ * the callback about the object.
+ *
+ * Return: Success: The return value of the first operator that
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
+ *
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
+ *
+ * Programmer: Quincey Koziol
+ * November 24 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
+ H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id,
+ hid_t dxpl_id)
+{
+ H5O_iter_visit_ud_t udata; /* User data for callback */
+ H5G_loc_t loc; /* Location of reference object */
+ H5G_loc_t obj_loc; /* Location used to open object */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
+ hbool_t loc_found = FALSE; /* Entry at 'name' found */
+ H5O_info_t oinfo; /* Object info struct */
+ hid_t obj_id = (-1); /* ID of object */
+ herr_t ret_value = FAIL; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Portably initialize user data struct to zeros */
+ HDmemset(&udata, 0, sizeof(udata));
+
+ /* Check args */
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+
+ /* Set up opened group location to fill in */
+ obj_loc.oloc = &obj_oloc;
+ obj_loc.path = &obj_path;
+ H5G_loc_reset(&obj_loc);
+
+ /* Find the object's location */
+ if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
+ loc_found = TRUE;
+
+ /* Get the object's info */
+ if(H5O_get_info(&obj_oloc, dxpl_id, TRUE, &oinfo) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info")
+
+ /* Open the object */
+ /* (Takes ownership of the obj_loc information) */
+ if((obj_id = H5O_open_by_loc(&obj_loc, lapl_id, dxpl_id, TRUE)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
+
+ /* Make callback for starting object */
+ if((ret_value = op(obj_id, ".", &oinfo, op_data)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "can't visit objects")
+
+ /* Check return value of first callback */
+ if(ret_value != H5_ITER_CONT)
+ HGOTO_DONE(ret_value);
+
+ /* Check for object being a group */
+ if(oinfo.type == H5O_TYPE_GROUP) {
+ H5G_loc_t start_loc; /* Location of starting group */
+
+ /* Get the location of the starting group */
+ if(H5G_loc(obj_id, &start_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+
+ /* Set up user data for visiting links */
+ udata.obj_id = obj_id;
+ udata.start_loc = &start_loc;
+ udata.lapl_id = lapl_id;
+ udata.dxpl_id = dxpl_id;
+ udata.op = op;
+ udata.op_data = op_data;
+
+ /* Create skip list to store visited object information */
+ if((udata.visited = H5SL_create(H5SL_TYPE_OBJ, NULL)) == NULL)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create skip list for visited objects")
+
+ /* If its ref count is > 1, we add it to the list of visited objects */
+ /* (because it could come up again during traversal) */
+ if(oinfo.rc > 1) {
+ H5_obj_t *obj_pos; /* New object node for visited list */
+
+ /* Allocate new object "position" node */
+ if((obj_pos = H5FL_MALLOC(H5_obj_t)) == NULL)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "can't allocate object node")
+
+ /* Construct unique "position" for this object */
+ obj_pos->fileno = oinfo.fileno;
+ obj_pos->addr = oinfo.addr;
+
+ /* Add to list of visited objects */
+ if(H5SL_insert(udata.visited, obj_pos, obj_pos) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object node into visited list")
+ } /* end if */
+
+ /* Call internal group visitation routine */
+ if((ret_value = H5G_visit(obj_id, ".", idx_type, order, H5O_visit_cb, &udata, lapl_id, dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
+ } /* end if */
+
+done:
+ if(obj_id > 0) {
+ if(H5I_dec_app_ref(obj_id) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object")
+ } /* end if */
+ else if(loc_found && H5G_loc_free(&obj_loc) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
+ if(udata.visited)
+ H5SL_destroy(udata.visited, H5O_free_visit_visited, NULL);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_visit() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_inc_rc
+ *
+ * Purpose: Increments the reference count on an object header
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Jul 13 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_inc_rc(H5O_t *oh)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* check args */
+ HDassert(oh);
+
+ /* Pin the object header when the reference count goes above 0 */
+ if(oh->rc == 0)
+ if(H5AC_pin_protected_entry(oh) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
+
+ /* Increment reference count */
+ oh->rc++;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_inc_rc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_dec_rc
+ *
+ * Purpose: Decrements the reference count on an object header
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Jul 13 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_dec_rc(H5O_t *oh)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* check args */
+ HDassert(oh);
+
+ /* Decrement reference count */
+ oh->rc--;
+
+ /* Unpin the object header when the reference count goes back to 0 */
+ if(oh->rc == 0)
+ if(H5AC_unpin_entry(oh) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_dec_rc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_dec_rc_by_loc
+ *
+ * Purpose: Decrement the refcount of an object header, using its
+ * object location information.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 08 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_dec_rc_by_loc(const H5O_loc_t *loc, hid_t dxpl_id)
+{
+ H5O_t *oh = NULL; /* Object header */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* check args */
+ HDassert(loc);
+
+ /* Get header */
+ if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG, FALSE)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header")
+
+ /* Decrement the reference count on the object header */
+ /* (which will unpin it, if appropriate) */
+ if(H5O_dec_rc(oh) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement reference count on object header")
+
+done:
+ /* Release the object header from the cache */
+ if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_dec_rc_by_loc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_get_proxy
+ *
+ * Purpose: Retrieve the proxy for the object header.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * July 24 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+H5AC_proxy_entry_t *
+H5O_get_proxy(const H5O_t *oh)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Check args */
+ HDassert(oh);
+
+ FUNC_LEAVE_NOAPI(oh->proxy)
+} /* end H5O_get_proxy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O__free
+ *
+ * Purpose: Destroys an object header.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Jan 15 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O__free(H5O_t *oh)
+{
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* check args */
+ HDassert(oh);
+ HDassert(0 == oh->rc);
+
+ /* Destroy chunks */
+ if(oh->chunk) {
+ for(u = 0; u < oh->nchunks; u++)
+ oh->chunk[u].image = H5FL_BLK_FREE(chunk_image, oh->chunk[u].image);
+
+ oh->chunk = (H5O_chunk_t *)H5FL_SEQ_FREE(H5O_chunk_t, oh->chunk);
+ } /* end if */
+
+ /* Destroy messages */
+ if(oh->mesg) {
+ for(u = 0; u < oh->nmesgs; u++) {
+#ifndef NDEBUG
+ /* Verify that message is clean, unless it could have been marked
+ * dirty by decoding */
+ if(oh->ndecode_dirtied && oh->mesg[u].dirty)
+ oh->ndecode_dirtied--;
+ else
+ HDassert(oh->mesg[u].dirty == 0);
+#endif /* NDEBUG */
+
+ H5O_msg_free_mesg(&oh->mesg[u]);
+ } /* end for */
+
+ /* Make sure we accounted for all the messages dirtied by decoding */
+ HDassert(!oh->ndecode_dirtied);
+
+ oh->mesg = (H5O_mesg_t *)H5FL_SEQ_FREE(H5O_mesg_t, oh->mesg);
+ } /* end if */
+
+ /* Destroy the proxy */
+ if(oh->proxy)
+ if(H5AC_proxy_entry_dest(oh->proxy) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy virtual entry used for proxy")
+
+ /* destroy object header */
+ oh = H5FL_FREE(H5O_t, oh);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O__free() */
+
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 838a80f..3745f6d 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -47,6 +47,8 @@ static herr_t H5O__layout_reset(void *_mesg);
static herr_t H5O__layout_free(void *_mesg);
static herr_t H5O__layout_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
void *_mesg);
+static herr_t H5O__layout_pre_copy_file(H5F_t *file_src, const void *mesg_src,
+ hbool_t *deleted, const H5O_copy_t *cpy_info, void *udata);
static void *H5O__layout_copy_file(H5F_t *file_src, void *mesg_src,
H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags,
H5O_copy_t *cpy_info, void *udata, hid_t dxpl_id);
@@ -69,7 +71,7 @@ const H5O_msg_class_t H5O_MSG_LAYOUT[1] = {{
NULL, /* link method */
NULL, /* set share method */
NULL, /* can share method */
- NULL, /* pre copy native value to file */
+ H5O__layout_pre_copy_file, /* pre copy native value to file */
H5O__layout_copy_file, /* copy native value to file */
NULL, /* post copy native value to file */
NULL, /* get creation index */
@@ -1045,6 +1047,41 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5O__layout_pre_copy_file
+ *
+ * Purpose: Perform any necessary actions before copying message between
+ * files.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, March 9, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O__layout_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
+ hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata)
+{
+ const H5O_layout_t *layout_src = (const H5O_layout_t *)mesg_src; /* Source layout */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* check args */
+ HDassert(cpy_info);
+ HDassert(cpy_info->file_dst);
+
+ if(layout_src->version > H5O_layout_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "layout message version out of bounds")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O__layout_pre_copy_file() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O__layout_copy_file
*
* Purpose: Copies a message from _MESG to _DEST in file
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 77d2130..9c482b0 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -641,6 +641,14 @@ H5_DLL herr_t H5O_attr_link(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg
H5_DLL herr_t H5O_attr_count_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
hsize_t *nattrs);
+H5_DLLVAR const unsigned H5O_obj_ver_bounds[H5F_LIBVER_NBOUNDS];
+H5_DLLVAR const unsigned H5O_layout_ver_bounds[H5F_LIBVER_NBOUNDS];
+H5_DLLVAR const unsigned H5O_attr_ver_bounds[H5F_LIBVER_NBOUNDS];
+H5_DLLVAR const unsigned H5O_dtype_ver_bounds[H5F_LIBVER_NBOUNDS];
+H5_DLLVAR const unsigned H5O_fill_ver_bounds[H5F_LIBVER_NBOUNDS];
+H5_DLLVAR const unsigned H5O_pline_ver_bounds[H5F_LIBVER_NBOUNDS];
+H5_DLLVAR const unsigned H5O_sdspace_ver_bounds[H5F_LIBVER_NBOUNDS];
+
/* Testing functions */
#ifdef H5O_TESTING
H5_DLL htri_t H5O_is_attr_empty_test(hid_t oid);
diff --git a/src/H5Opline.c b/src/H5Opline.c
index c1ff183..ea913da 100644
--- a/src/H5Opline.c
+++ b/src/H5Opline.c
@@ -90,7 +90,7 @@ const H5O_msg_class_t H5O_MSG_PLINE[1] = {{
}};
/* Format version bounds for filter pipleline */
-static const unsigned H5O_pline_ver_bounds[] = {
+const unsigned H5O_pline_ver_bounds[] = {
H5O_PLINE_VERSION_1, /* H5F_LIBVER_EARLIEST */
H5O_PLINE_VERSION_2, /* H5F_LIBVER_V18 */
H5O_PLINE_VERSION_LATEST /* H5F_LIBVER_LATEST */
@@ -572,9 +572,9 @@ H5O_pline_free(void *mesg)
*/
static herr_t
H5O_pline_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
- hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t H5_ATTR_UNUSED *cpy_info, void *_udata)
+ hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void *_udata)
{
- const H5O_pline_t *pline_src = (const H5O_pline_t *)mesg_src; /* Source datatype */
+ const H5O_pline_t *pline_src = (const H5O_pline_t *)mesg_src; /* Source pline */
H5O_copy_file_ud_common_t *udata = (H5O_copy_file_ud_common_t *)_udata; /* Object copying user data */
herr_t ret_value = SUCCEED; /* Return value */
@@ -582,6 +582,11 @@ H5O_pline_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
/* check args */
HDassert(pline_src);
+ HDassert(cpy_info);
+ HDassert(cpy_info->file_dst);
+
+ if(pline_src->version > H5O_pline_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "pline message version out of bounds")
/* If the user data is non-NULL, assume we are copying a dataset or group
* and make a copy of the filter pipeline for later in
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 4d48205..9382cd5 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -24,6 +24,9 @@
#ifndef _H5Oprivate_H
#define _H5Oprivate_H
+/* Early typedefs to avoid circular dependencies */
+typedef struct H5O_t H5O_t;
+
/* Include the public header file for this API */
#include "H5Opublic.h" /* Object header functions */
@@ -44,7 +47,6 @@
/* Forward references of package typedefs */
typedef struct H5O_msg_class_t H5O_msg_class_t;
typedef struct H5O_mesg_t H5O_mesg_t;
-typedef struct H5O_t H5O_t;
/* Values used to create the shared message & attribute heaps */
/* (Note that these parameters have been tuned so that the resulting heap ID
@@ -174,6 +176,7 @@ typedef struct H5O_copy_t {
H5SL_t *dst_dt_list; /* Skip list to hold committed datatypes in dest file */
hbool_t dst_dt_list_complete; /* Whether the destination datatype list is complete (i.e. not only populated with "suggestions" from H5Padd_merge_committed_dtype_path) */
H5O_t *oh_dst; /* The destination object header */
+ H5F_t *file_dst; /* The destination file pointer */
void *shared_fo; /* The shared pointer for the object */
H5O_mcdt_search_cb_t mcdt_cb; /* The callback to invoke before searching the global list of committed datatypes at destination */
void *mcdt_ud; /* User data passed to callback */
@@ -881,6 +884,9 @@ H5_DLL void *H5O_obj_create(H5F_t *f, H5O_type_t obj_type, void *crt_info, H5G_l
H5_DLL haddr_t H5O_get_oh_addr(const H5O_t *oh);
H5_DLL herr_t H5O_get_rc_and_type(const H5O_loc_t *oloc, hid_t dxpl_id, unsigned *rc, H5O_type_t *otype);
H5_DLL H5AC_proxy_entry_t *H5O_get_proxy(const H5O_t *oh);
+H5_DLL herr_t H5O_visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
+ H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id,
+ hid_t dxpl_id);
/* Object header message routines */
H5_DLL herr_t H5O_msg_create(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags,
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index 3fe5652..9a9d020 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -441,7 +441,7 @@ H5O_sdspace_free(void *mesg)
*/
static herr_t
H5O_sdspace_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
- hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t H5_ATTR_UNUSED *cpy_info, void *_udata)
+ hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void *_udata)
{
const H5S_extent_t *src_space_extent = (const H5S_extent_t *)mesg_src; /* Source dataspace extent */
H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */
@@ -452,6 +452,11 @@ H5O_sdspace_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
/* check args */
HDassert(file_src);
HDassert(src_space_extent);
+ HDassert(cpy_info);
+ HDassert(cpy_info->file_dst);
+
+ if(src_space_extent->version > H5O_sdspace_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "dataspace message version out of bounds")
/* If the user data is non-NULL, assume we are copying a dataset
* and make a copy of the dataspace extent for later in the object copying
diff --git a/src/H5PLplugin_cache.c b/src/H5PLplugin_cache.c
index d826ba0..e483e01 100644
--- a/src/H5PLplugin_cache.c
+++ b/src/H5PLplugin_cache.c
@@ -283,11 +283,11 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f
/* Get the "get plugin info" function from the plugin. */
if (NULL == (get_plugin_info_function = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC((H5PL_cache_g[u]).handle, "H5PLget_plugin_info")))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info")
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info")
/* Call the "get plugin info" function */
if (NULL == (filter_info = (const H5Z_class2_t *)(*get_plugin_info_function)()))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get plugin info")
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get plugin info")
/* Set output parameters */
*found = TRUE;
diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c
index 3b0a8c5..494de3e 100644
--- a/src/H5Pdapl.c
+++ b/src/H5Pdapl.c
@@ -13,11 +13,11 @@
/*-------------------------------------------------------------------------
*
- * Created: H5Pdapl.c
+ * Created: H5Pdapl.c
* October 27, 2008
* Neil Fortner <nfortne2@hdfgroup.org>
*
- * Purpose: Dataset access property list class routines
+ * Purpose: Dataset access property list class routines
*
*-------------------------------------------------------------------------
*/
@@ -32,13 +32,13 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Ppkg.h" /* Property lists */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Ppkg.h" /* Property lists */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -72,8 +72,8 @@
#define H5D_ACS_VDS_PRINTF_GAP_ENC H5P__encode_hsize_t
#define H5D_ACS_VDS_PRINTF_GAP_DEC H5P__decode_hsize_t
/* Definition for append flush */
-#define H5D_ACS_APPEND_FLUSH_SIZE sizeof(H5D_append_flush_t)
-#define H5D_ACS_APPEND_FLUSH_DEF {0,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},NULL,NULL}
+#define H5D_ACS_APPEND_FLUSH_SIZE sizeof(H5D_append_flush_t)
+#define H5D_ACS_APPEND_FLUSH_DEF {0,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},NULL,NULL}
/* Definitions for external file prefix */
#define H5D_ACS_EFILE_PREFIX_SIZE sizeof(char *)
#define H5D_ACS_EFILE_PREFIX_DEF NULL /*default is no prefix */
@@ -130,21 +130,21 @@ static herr_t H5P__dapl_efile_pref_close(const char* name, size_t size, void* va
/* Dataset access property list class library initialization object */
const H5P_libclass_t H5P_CLS_DACC[1] = {{
- "dataset access", /* Class name for debugging */
+ "dataset access", /* Class name for debugging */
H5P_TYPE_DATASET_ACCESS, /* Class type */
- &H5P_CLS_LINK_ACCESS_g, /* Parent class */
- &H5P_CLS_DATASET_ACCESS_g, /* Pointer to class */
- &H5P_CLS_DATASET_ACCESS_ID_g, /* Pointer to class ID */
- &H5P_LST_DATASET_ACCESS_ID_g, /* Pointer to default property list ID */
- H5P__dacc_reg_prop, /* Default property registration routine */
-
- NULL, /* Class creation callback */
- NULL, /* Class creation callback info */
- NULL, /* Class copy callback */
- NULL, /* Class copy callback info */
- NULL, /* Class close callback */
- NULL /* Class close callback info */
+ &H5P_CLS_LINK_ACCESS_g, /* Parent class */
+ &H5P_CLS_DATASET_ACCESS_g, /* Pointer to class */
+ &H5P_CLS_DATASET_ACCESS_ID_g, /* Pointer to class ID */
+ &H5P_LST_DATASET_ACCESS_ID_g, /* Pointer to default property list ID */
+ H5P__dacc_reg_prop, /* Default property registration routine */
+
+ NULL, /* Class creation callback */
+ NULL, /* Class creation callback info */
+ NULL, /* Class copy callback */
+ NULL, /* Class copy callback info */
+ NULL, /* Class close callback */
+ NULL /* Class close callback info */
}};
@@ -158,8 +158,8 @@ const H5P_libclass_t H5P_CLS_DACC[1] = {{
/*******************/
/* Property value defaults */
-static const H5D_append_flush_t H5D_def_append_flush_g = H5D_ACS_APPEND_FLUSH_DEF; /* Default setting for append flush */
-static const char *H5D_def_efile_prefix_g = H5D_ACS_EFILE_PREFIX_DEF; /* Default external file prefix string */
+static const H5D_append_flush_t H5D_def_append_flush_g = H5D_ACS_APPEND_FLUSH_DEF; /* Default setting for append flush */
+static const char *H5D_def_efile_prefix_g = H5D_ACS_EFILE_PREFIX_DEF; /* Default external file prefix string */
/*-------------------------------------------------------------------------
@@ -169,9 +169,6 @@ static const char *H5D_def_efile_prefix_g = H5D_ACS_EFILE_PREFIX_DEF; /* Default
* properties
*
* Return: Non-negative on success/Negative on failure
- *
- * Programmer: Neil Fortner
- * October 27, 2008
*-------------------------------------------------------------------------
*/
static herr_t
@@ -187,17 +184,17 @@ H5P__dacc_reg_prop(H5P_genclass_t *pclass)
FUNC_ENTER_STATIC
/* Register the size of raw data chunk cache (elements) */
- if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots,
+ if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots,
NULL, NULL, NULL, H5D_ACS_DATA_CACHE_NUM_SLOTS_ENC, H5D_ACS_DATA_CACHE_NUM_SLOTS_DEC, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the size of raw data chunk cache(bytes) */
- if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes,
+ if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes,
NULL, NULL, NULL, H5D_ACS_DATA_CACHE_BYTE_SIZE_ENC, H5D_ACS_DATA_CACHE_BYTE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the preemption for reading chunks */
- if(H5P_register_real(pclass, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, H5D_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0,
+ if(H5P_register_real(pclass, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, H5D_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0,
NULL, NULL, NULL, H5D_ACS_PREEMPT_READ_CHUNKS_ENC, H5D_ACS_PREEMPT_READ_CHUNKS_DEC, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
@@ -215,12 +212,12 @@ H5P__dacc_reg_prop(H5P_genclass_t *pclass)
/* Register info for append flush */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5D_ACS_APPEND_FLUSH_NAME, H5D_ACS_APPEND_FLUSH_SIZE, &H5D_def_append_flush_g,
+ if(H5P_register_real(pclass, H5D_ACS_APPEND_FLUSH_NAME, H5D_ACS_APPEND_FLUSH_SIZE, &H5D_def_append_flush_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register property for external file prefix */
- if(H5P_register_real(pclass, H5D_ACS_EFILE_PREFIX_NAME, H5D_ACS_EFILE_PREFIX_SIZE, &H5D_def_efile_prefix_g,
+ if(H5P_register_real(pclass, H5D_ACS_EFILE_PREFIX_NAME, H5D_ACS_EFILE_PREFIX_SIZE, &H5D_def_efile_prefix_g,
NULL, H5D_ACS_EFILE_PREFIX_SET, H5D_ACS_EFILE_PREFIX_GET, H5D_ACS_EFILE_PREFIX_ENC, H5D_ACS_EFILE_PREFIX_DEC,
H5D_ACS_EFILE_PREFIX_DEL, H5D_ACS_EFILE_PREFIX_COPY, H5D_ACS_EFILE_PREFIX_CMP, H5D_ACS_EFILE_PREFIX_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
@@ -237,7 +234,6 @@ done:
* for a property list
*
* Return: SUCCEED/FAIL
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -263,7 +259,6 @@ H5P__dapl_efile_pref_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED
* from a property list
*
* Return: SUCCEED/FAIL
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -290,7 +285,6 @@ H5P__dapl_efile_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED
* encoded.
*
* Return: SUCCEED/FAIL
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -341,8 +335,7 @@ H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size)
* property in the dataset access property list is
* decoded.
*
- * Return: SUCCEED/FAIL
- *
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
static herr_t
@@ -393,7 +386,6 @@ done:
* Purpose: Frees memory used to store the external file prefix string
*
* Return: SUCCEED (Can't fail)
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -416,7 +408,6 @@ H5P__dapl_efile_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED
* Purpose: Creates a copy of the external file prefix string
*
* Return: SUCCEED/FAIL
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -440,7 +431,6 @@ H5P__dapl_efile_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED
* compared.
*
* Return: zero if VALUE1 and VALUE2 are equal, non zero otherwise.
- *
*-------------------------------------------------------------------------
*/
static int
@@ -470,7 +460,6 @@ done:
* Purpose: Frees memory used to store the external file prefix string
*
* Return: SUCCEED/FAIL
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -487,33 +476,27 @@ H5P__dapl_efile_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSE
/*-------------------------------------------------------------------------
- * Function: H5Pset_chunk_cache
- *
- * Purpose: Set the number of objects in the meta data cache and the
- * maximum number of chunks and bytes in the raw data chunk cache.
- * Once set, these values will override the values in the file access
- * property list. Each of thhese values can be individually unset
- * (or not set at all) by passing the macros:
- * H5D_CHUNK_CACHE_NCHUNKS_DEFAULT,
- * H5D_CHUNK_CACHE_NSLOTS_DEFAULT, and/or
- * H5D_CHUNK_CACHE_W0_DEFAULT
- * as appropriate.
- *
- * The RDCC_W0 value should be between 0 and 1 inclusive and
- * indicates how much chunks that have been fully read or fully
- * written are favored for preemption. A value of zero means
- * fully read or written chunks are treated no differently than
- * other chunks (the preemption is strictly LRU) while a value
- * of one means fully read chunks are always preempted before
- * other chunks.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Neil Fortner
- * Monday, October 27, 2008
- *
- * Modifications:
- *
+ * Function: H5Pset_chunk_cache
+ *
+ * Purpose: Set the number of objects in the meta data cache and the
+ * maximum number of chunks and bytes in the raw data chunk cache.
+ * Once set, these values will override the values in the file access
+ * property list. Each of thhese values can be individually unset
+ * (or not set at all) by passing the macros:
+ * H5D_CHUNK_CACHE_NCHUNKS_DEFAULT,
+ * H5D_CHUNK_CACHE_NSLOTS_DEFAULT, and/or
+ * H5D_CHUNK_CACHE_W0_DEFAULT
+ * as appropriate.
+ *
+ * The RDCC_W0 value should be between 0 and 1 inclusive and
+ * indicates how much chunks that have been fully read or fully
+ * written are favored for preemption. A value of zero means
+ * fully read or written chunks are treated no differently than
+ * other chunks (the preemption is strictly LRU) while a value
+ * of one means fully read chunks are always preempted before
+ * other chunks.
+ *
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -548,23 +531,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Pget_chunk_cache
- *
- * Purpose: Retrieves the maximum possible number of elements in the meta
- * data cache and the maximum possible number of elements and
- * bytes and the RDCC_W0 value in the raw data chunk cache. Any
- * (or all) arguments may be null pointers in which case the
- * corresponding datum is not returned. If these properties have
- * not been set on this property list, the default values for a
- * file access property list are returned.
- *
- * Return: Non-negative on success/Negative on failure
+ * Function: H5Pget_chunk_cache
*
- * Programmer: Neil Fortner
- * Monday, October 27, 2008
- *
- * Modifications:
+ * Purpose: Retrieves the maximum possible number of elements in the meta
+ * data cache and the maximum possible number of elements and
+ * bytes and the RDCC_W0 value in the raw data chunk cache. Any
+ * (or all) arguments may be null pointers in which case the
+ * corresponding datum is not returned. If these properties have
+ * not been set on this property list, the default values for a
+ * file access property list are returned.
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -625,10 +602,6 @@ done:
*
* Return: Success: Non-negative
* Failure: Negative
- *
- * Programmer: Neil Fortner
- * Wednesday, January 23, 2013
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -684,10 +657,6 @@ H5P__encode_chunk_cache_nslots(const void *value, void **_pp, size_t *size)
*
* Return: Success: Non-negative
* Failure: Negative
- *
- * Programmer: Neil Fortner
- * Wednesday, January 23, 2013
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -735,10 +704,6 @@ H5P__decode_chunk_cache_nslots(const void **_pp, void *_value)
*
* Return: Success: Non-negative
* Failure: Negative
- *
- * Programmer: Neil Fortner
- * Wednesday, January 23, 2013
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -794,10 +759,6 @@ H5P__encode_chunk_cache_nbytes(const void *value, void **_pp, size_t *size)
*
* Return: Success: Non-negative
* Failure: Negative
- *
- * Programmer: Neil Fortner
- * Wednesday, January 23, 2013
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -849,10 +810,6 @@ H5P__decode_chunk_cache_nbytes(const void **_pp, void *_value)
* view defines the extent.
*
* Return: Non-negative on success/Negative on failure
- *
- * Programmer: Neil Fortner
- * May 4, 2015
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -887,13 +844,9 @@ done:
* Purpose: Takes the access property list for the virtual dataset,
* dapl_id, and gets the flag, view, set by the
* H5Pset_virtual_view call. The possible values of view are
- * H5D_VDS_FIRST_MISSING or H5D_VDS_LAST_AVAIALBLE.
+ * H5D_VDS_FIRST_MISSING or H5D_VDS_LAST_AVAIALBLE.
*
* Return: Non-negative on success/Negative on failure
- *
- * Programmer: Neil Fortner
- * May 4, 2015
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -927,10 +880,6 @@ done:
*
* Return: Success: Non-negative
* Failure: Negative
- *
- * Programmer: Neil Fortner
- * Tuesday, May 5, 2015
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -964,10 +913,6 @@ H5P__dacc_vds_view_enc(const void *value, void **_pp, size_t *size)
*
* Return: Success: Non-negative
* Failure: Negative
- *
- * Programmer: Neil Fortner
- * Tuesday, May 5, 2015
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1011,10 +956,6 @@ H5P__dacc_vds_view_dec(const void **_pp, void *_value)
* the VDS fill value setting.
*
* Return: Non-negative on success/Negative on failure
- *
- * Programmer: Neil Fortner
- * May 21, 2015
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1053,10 +994,6 @@ done:
* value for gap_size is 0.
*
* Return: Non-negative on success/Negative on failure
- *
- * Programmer: Neil Fortner
- * May 21, 2015
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1083,30 +1020,27 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Pset_append_flush
- *
- * Purpose: Sets the boundary, callback function, and user data in the
- * property list.
- * "ndims": number of array elements for boundary
- * "boundary": used to determine whether the current dimension hits
- * a boundary; if so, invoke the callback function and
- * flush the dataset.
- * "func": the callback function to invoke when the boundary is hit
- * "udata": the user data to pass as parameter with the callback function
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Vailin Choi; Dec 2013
- *
+ * Function: H5Pset_append_flush
+ *
+ * Purpose: Sets the boundary, callback function, and user data in the
+ * property list.
+ * "ndims": number of array elements for boundary
+ * "boundary": used to determine whether the current dimension hits
+ * a boundary; if so, invoke the callback function and
+ * flush the dataset.
+ * "func": the callback function to invoke when the boundary is hit
+ * "udata": the user data to pass as parameter with the callback function
+ *
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_append_flush(hid_t plist_id, unsigned ndims, const hsize_t *boundary, H5D_append_cb_t func, void *udata)
{
- H5P_genplist_t *plist; /* Property list pointer */
- H5D_append_flush_t info; /* Property for append flush parameters */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5D_append_flush_t info; /* Property for append flush parameters */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "iIu*hx*x", plist_id, ndims, boundary, func, udata);
@@ -1123,7 +1057,7 @@ H5Pset_append_flush(hid_t plist_id, unsigned ndims, const hsize_t *boundary, H5D
* This is almost certainly an error as the user data will not be used. */
if(!func && udata)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback is NULL while user data is not")
-
+
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
@@ -1151,18 +1085,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Pget_append_flush()
- *
- * Purpose: Retrieves the boundary, callback function and user data set in
- * property list.
- * Note that the # of boundary sizes to retrieve will not exceed
- * the parameter "ndims" and the ndims set previously via
- * H5Pset_append_flush().
- *
- * Return: Non-negative on success/Negative on failure
+ * Function: H5Pget_append_flush()
*
- * Programmer: Vailin Choi; Dec 2013
+ * Purpose: Retrieves the boundary, callback function and user data set in
+ * property list.
+ * Note that the # of boundary sizes to retrieve will not exceed
+ * the parameter "ndims" and the ndims set previously via
+ * H5Pset_append_flush().
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -1170,7 +1101,7 @@ H5Pget_append_flush(hid_t plist_id, unsigned ndims, hsize_t boundary[], H5D_appe
{
H5P_genplist_t *plist; /* property list pointer */
H5D_append_flush_t info;
- unsigned u; /* local index variable */
+ unsigned u; /* local index variable */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
@@ -1186,15 +1117,15 @@ H5Pget_append_flush(hid_t plist_id, unsigned ndims, hsize_t boundary[], H5D_appe
/* Assign return values */
if(boundary) {
- HDmemset(boundary, 0, ndims * sizeof(hsize_t));
- if(info.ndims > 0)
- for(u = 0; u < info.ndims && u < ndims; u++)
- boundary[u] = info.boundary[u];
+ HDmemset(boundary, 0, ndims * sizeof(hsize_t));
+ if(info.ndims > 0)
+ for(u = 0; u < info.ndims && u < ndims; u++)
+ boundary[u] = info.boundary[u];
} /* end if */
if(func)
- *func = info.func;
+ *func = info.func;
if(udata)
- *udata = info.udata;
+ *udata = info.udata;
done:
FUNC_LEAVE_API(ret_value)
@@ -1215,8 +1146,7 @@ done:
* This property can be overwritten by the environment variable
* HDF5_EXTFILE_PREFIX.
*
- * Return: Non-negative on success/Negative on failure
- *
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -1242,24 +1172,22 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Pget_efile_prefix
- *
- * Purpose: Gets the prefix to be used for any external files.
- *
- * If the pointer is not NULL, it points to a user-allocated
- * buffer.
+ * Function: H5Pget_efile_prefix
*
- * Return: Non-negative on success/Negative on failure
+ * Purpose: Gets the prefix to be used for any external files.
+ * If the pointer is not NULL, it points to a user-allocated
+ * buffer.
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
ssize_t
H5Pget_efile_prefix(hid_t plist_id, char *prefix, size_t size)
{
H5P_genplist_t *plist; /* Property list pointer */
- char *my_prefix; /* Library's copy of the prefix */
- size_t len; /* Length of prefix string */
- ssize_t ret_value; /* Return value */
+ char *my_prefix; /* Library's copy of the prefix */
+ size_t len; /* Length of prefix string */
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("Zs", "i*sz", plist_id, prefix, size);
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 854b1ef..493a322 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -50,43 +50,43 @@
* The library's property list classes
*/
-#define H5P_ROOT (H5OPEN H5P_CLS_ROOT_ID_g)
-#define H5P_OBJECT_CREATE (H5OPEN H5P_CLS_OBJECT_CREATE_ID_g)
-#define H5P_FILE_CREATE (H5OPEN H5P_CLS_FILE_CREATE_ID_g)
-#define H5P_FILE_ACCESS (H5OPEN H5P_CLS_FILE_ACCESS_ID_g)
-#define H5P_DATASET_CREATE (H5OPEN H5P_CLS_DATASET_CREATE_ID_g)
-#define H5P_DATASET_ACCESS (H5OPEN H5P_CLS_DATASET_ACCESS_ID_g)
-#define H5P_DATASET_XFER (H5OPEN H5P_CLS_DATASET_XFER_ID_g)
-#define H5P_FILE_MOUNT (H5OPEN H5P_CLS_FILE_MOUNT_ID_g)
-#define H5P_GROUP_CREATE (H5OPEN H5P_CLS_GROUP_CREATE_ID_g)
-#define H5P_GROUP_ACCESS (H5OPEN H5P_CLS_GROUP_ACCESS_ID_g)
-#define H5P_DATATYPE_CREATE (H5OPEN H5P_CLS_DATATYPE_CREATE_ID_g)
-#define H5P_DATATYPE_ACCESS (H5OPEN H5P_CLS_DATATYPE_ACCESS_ID_g)
-#define H5P_STRING_CREATE (H5OPEN H5P_CLS_STRING_CREATE_ID_g)
-#define H5P_ATTRIBUTE_CREATE (H5OPEN H5P_CLS_ATTRIBUTE_CREATE_ID_g)
-#define H5P_ATTRIBUTE_ACCESS (H5OPEN H5P_CLS_ATTRIBUTE_ACCESS_ID_g)
-#define H5P_OBJECT_COPY (H5OPEN H5P_CLS_OBJECT_COPY_ID_g)
-#define H5P_LINK_CREATE (H5OPEN H5P_CLS_LINK_CREATE_ID_g)
-#define H5P_LINK_ACCESS (H5OPEN H5P_CLS_LINK_ACCESS_ID_g)
+#define H5P_ROOT (H5OPEN H5P_CLS_ROOT_ID_g)
+#define H5P_OBJECT_CREATE (H5OPEN H5P_CLS_OBJECT_CREATE_ID_g)
+#define H5P_FILE_CREATE (H5OPEN H5P_CLS_FILE_CREATE_ID_g)
+#define H5P_FILE_ACCESS (H5OPEN H5P_CLS_FILE_ACCESS_ID_g)
+#define H5P_DATASET_CREATE (H5OPEN H5P_CLS_DATASET_CREATE_ID_g)
+#define H5P_DATASET_ACCESS (H5OPEN H5P_CLS_DATASET_ACCESS_ID_g)
+#define H5P_DATASET_XFER (H5OPEN H5P_CLS_DATASET_XFER_ID_g)
+#define H5P_FILE_MOUNT (H5OPEN H5P_CLS_FILE_MOUNT_ID_g)
+#define H5P_GROUP_CREATE (H5OPEN H5P_CLS_GROUP_CREATE_ID_g)
+#define H5P_GROUP_ACCESS (H5OPEN H5P_CLS_GROUP_ACCESS_ID_g)
+#define H5P_DATATYPE_CREATE (H5OPEN H5P_CLS_DATATYPE_CREATE_ID_g)
+#define H5P_DATATYPE_ACCESS (H5OPEN H5P_CLS_DATATYPE_ACCESS_ID_g)
+#define H5P_STRING_CREATE (H5OPEN H5P_CLS_STRING_CREATE_ID_g)
+#define H5P_ATTRIBUTE_CREATE (H5OPEN H5P_CLS_ATTRIBUTE_CREATE_ID_g)
+#define H5P_ATTRIBUTE_ACCESS (H5OPEN H5P_CLS_ATTRIBUTE_ACCESS_ID_g)
+#define H5P_OBJECT_COPY (H5OPEN H5P_CLS_OBJECT_COPY_ID_g)
+#define H5P_LINK_CREATE (H5OPEN H5P_CLS_LINK_CREATE_ID_g)
+#define H5P_LINK_ACCESS (H5OPEN H5P_CLS_LINK_ACCESS_ID_g)
/*
* The library's default property lists
*/
-#define H5P_FILE_CREATE_DEFAULT (H5OPEN H5P_LST_FILE_CREATE_ID_g)
-#define H5P_FILE_ACCESS_DEFAULT (H5OPEN H5P_LST_FILE_ACCESS_ID_g)
-#define H5P_DATASET_CREATE_DEFAULT (H5OPEN H5P_LST_DATASET_CREATE_ID_g)
-#define H5P_DATASET_ACCESS_DEFAULT (H5OPEN H5P_LST_DATASET_ACCESS_ID_g)
-#define H5P_DATASET_XFER_DEFAULT (H5OPEN H5P_LST_DATASET_XFER_ID_g)
-#define H5P_FILE_MOUNT_DEFAULT (H5OPEN H5P_LST_FILE_MOUNT_ID_g)
-#define H5P_GROUP_CREATE_DEFAULT (H5OPEN H5P_LST_GROUP_CREATE_ID_g)
-#define H5P_GROUP_ACCESS_DEFAULT (H5OPEN H5P_LST_GROUP_ACCESS_ID_g)
-#define H5P_DATATYPE_CREATE_DEFAULT (H5OPEN H5P_LST_DATATYPE_CREATE_ID_g)
-#define H5P_DATATYPE_ACCESS_DEFAULT (H5OPEN H5P_LST_DATATYPE_ACCESS_ID_g)
-#define H5P_ATTRIBUTE_CREATE_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_CREATE_ID_g)
-#define H5P_ATTRIBUTE_ACCESS_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_ACCESS_ID_g)
-#define H5P_OBJECT_COPY_DEFAULT (H5OPEN H5P_LST_OBJECT_COPY_ID_g)
-#define H5P_LINK_CREATE_DEFAULT (H5OPEN H5P_LST_LINK_CREATE_ID_g)
-#define H5P_LINK_ACCESS_DEFAULT (H5OPEN H5P_LST_LINK_ACCESS_ID_g)
+#define H5P_FILE_CREATE_DEFAULT (H5OPEN H5P_LST_FILE_CREATE_ID_g)
+#define H5P_FILE_ACCESS_DEFAULT (H5OPEN H5P_LST_FILE_ACCESS_ID_g)
+#define H5P_DATASET_CREATE_DEFAULT (H5OPEN H5P_LST_DATASET_CREATE_ID_g)
+#define H5P_DATASET_ACCESS_DEFAULT (H5OPEN H5P_LST_DATASET_ACCESS_ID_g)
+#define H5P_DATASET_XFER_DEFAULT (H5OPEN H5P_LST_DATASET_XFER_ID_g)
+#define H5P_FILE_MOUNT_DEFAULT (H5OPEN H5P_LST_FILE_MOUNT_ID_g)
+#define H5P_GROUP_CREATE_DEFAULT (H5OPEN H5P_LST_GROUP_CREATE_ID_g)
+#define H5P_GROUP_ACCESS_DEFAULT (H5OPEN H5P_LST_GROUP_ACCESS_ID_g)
+#define H5P_DATATYPE_CREATE_DEFAULT (H5OPEN H5P_LST_DATATYPE_CREATE_ID_g)
+#define H5P_DATATYPE_ACCESS_DEFAULT (H5OPEN H5P_LST_DATATYPE_ACCESS_ID_g)
+#define H5P_ATTRIBUTE_CREATE_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_CREATE_ID_g)
+#define H5P_ATTRIBUTE_ACCESS_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_ACCESS_ID_g)
+#define H5P_OBJECT_COPY_DEFAULT (H5OPEN H5P_LST_OBJECT_COPY_ID_g)
+#define H5P_LINK_CREATE_DEFAULT (H5OPEN H5P_LST_LINK_CREATE_ID_g)
+#define H5P_LINK_ACCESS_DEFAULT (H5OPEN H5P_LST_LINK_ACCESS_ID_g)
/* Common creation order flags (for links in groups and attributes on objects) */
#define H5P_CRT_ORDER_TRACKED 0x0001
@@ -140,9 +140,9 @@ typedef enum H5D_mpio_actual_chunk_opt_mode_t {
typedef enum H5D_mpio_actual_io_mode_t {
/* The following four values are conveniently defined as a bit field so that
* we can switch from the default to indpendent or collective and then to
- * mixed without having to check the original value.
- *
- * NO_COLLECTIVE means that either collective I/O wasn't requested or that
+ * mixed without having to check the original value.
+ *
+ * NO_COLLECTIVE means that either collective I/O wasn't requested or that
* no I/O took place.
*
* CHUNK_INDEPENDENT means that collective I/O was requested, but the
@@ -155,7 +155,7 @@ typedef enum H5D_mpio_actual_io_mode_t {
/* The contiguous case is separate from the bit field. */
H5D_MPIO_CONTIGUOUS_COLLECTIVE = 0x4
-} H5D_mpio_actual_io_mode_t;
+} H5D_mpio_actual_io_mode_t;
/* Broken collective IO property */
typedef enum H5D_mpio_no_collective_cause_t {
@@ -326,7 +326,7 @@ H5_DLL herr_t H5Pget_cache(hid_t plist_id,
H5_DLL herr_t H5Pset_mdc_config(hid_t plist_id,
H5AC_cache_config_t * config_ptr);
H5_DLL herr_t H5Pget_mdc_config(hid_t plist_id,
- H5AC_cache_config_t * config_ptr); /* out */
+ H5AC_cache_config_t * config_ptr); /* out */
H5_DLL herr_t H5Pset_gc_references(hid_t fapl_id, unsigned gc_ref);
H5_DLL herr_t H5Pget_gc_references(hid_t fapl_id, unsigned *gc_ref/*out*/);
H5_DLL herr_t H5Pset_fclose_degree(hid_t fapl_id, H5F_close_degree_t degree);
@@ -402,12 +402,12 @@ H5_DLL herr_t H5Pget_fill_value(hid_t plist_id, hid_t type_id,
void *value/*out*/);
H5_DLL herr_t H5Pfill_value_defined(hid_t plist, H5D_fill_value_t *status);
H5_DLL herr_t H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t
- alloc_time);
+ alloc_time);
H5_DLL herr_t H5Pget_alloc_time(hid_t plist_id, H5D_alloc_time_t
- *alloc_time/*out*/);
+ *alloc_time/*out*/);
H5_DLL herr_t H5Pset_fill_time(hid_t plist_id, H5D_fill_time_t fill_time);
H5_DLL herr_t H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t
- *fill_time/*out*/);
+ *fill_time/*out*/);
/* Dataset access property list (DAPL) routines */
H5_DLL herr_t H5Pset_chunk_cache(hid_t dapl_id, size_t rdcc_nslots,
diff --git a/src/H5R.c b/src/H5R.c
index b000183..8b42b35 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -21,16 +21,13 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Gprivate.h" /* Groups */
-#include "H5HGprivate.h" /* Global Heaps */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Rpkg.h" /* References */
-#include "H5Sprivate.h" /* Dataspaces */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Rpkg.h" /* References */
+#include "H5Sprivate.h" /* Dataspaces */
/****************/
@@ -47,20 +44,11 @@
/* Local Prototypes */
/********************/
-static herr_t H5R_create(void *ref, H5G_loc_t *loc, const char *name,
- H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id);
-static H5S_t * H5R_get_region(H5F_t *file, hid_t dxpl_id, const void *_ref);
-static ssize_t H5R_get_name(H5F_t *file, hid_t lapl_id, hid_t dxpl_id, hid_t id,
- H5R_type_t ref_type, const void *_ref, char *name, size_t size);
-
/*********************/
/* Package Variables */
/*********************/
-/* Package initialization variable */
-hbool_t H5_PKG_INIT_VAR = FALSE;
-
/*****************************/
/* Library Private Variables */
@@ -71,274 +59,6 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* Local Variables */
/*******************/
-/* Reference ID class */
-static const H5I_class_t H5I_REFERENCE_CLS[1] = {{
- H5I_REFERENCE, /* ID class value */
- 0, /* Class flags */
- 0, /* # of reserved IDs for class */
- NULL /* Callback routine for closing objects of this class */
-}};
-
-/* Flag indicating "top" of interface has been initialized */
-static hbool_t H5R_top_package_initialize_s = FALSE;
-
-
-
-/*--------------------------------------------------------------------------
-NAME
- H5R__init_package -- Initialize interface-specific information
-USAGE
- herr_t H5R__init_package()
-
-RETURNS
- Non-negative on success/Negative on failure
-DESCRIPTION
- Initializes any interface-specific data or routines.
-
---------------------------------------------------------------------------*/
-herr_t
-H5R__init_package(void)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Initialize the atom group for the file IDs */
- if(H5I_register_type(H5I_REFERENCE_CLS) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to initialize interface")
-
- /* Mark "top" of interface as initialized, too */
- H5R_top_package_initialize_s = TRUE;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5R__init_package() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5R_top_term_package
- PURPOSE
- Terminate various H5R objects
- USAGE
- void H5R_top_term_package()
- RETURNS
- void
- DESCRIPTION
- Release IDs for the atom group, deferring full interface shutdown
- until later (in H5R_term_package).
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- Can't report errors...
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-int
-H5R_top_term_package(void)
-{
- int n = 0;
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- if(H5R_top_package_initialize_s) {
- if(H5I_nmembers(H5I_REFERENCE) > 0) {
- (void)H5I_clear_type(H5I_REFERENCE, FALSE, FALSE);
- n++; /*H5I*/
- } /* end if */
-
- /* Mark closed */
- if(0 == n)
- H5R_top_package_initialize_s = FALSE;
- } /* end if */
-
- FUNC_LEAVE_NOAPI(n)
-} /* end H5R_top_term_package() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5R_term_package
- PURPOSE
- Terminate various H5R objects
- USAGE
- void H5R_term_package()
- RETURNS
- void
- DESCRIPTION
- Release the atom group and any other resources allocated.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- Can't report errors...
-
- Finishes shutting down the interface, after H5R_top_term_package()
- is called
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-int
-H5R_term_package(void)
-{
- int n = 0;
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- if(H5_PKG_INIT_VAR) {
- /* Sanity checks */
- HDassert(0 == H5I_nmembers(H5I_REFERENCE));
- HDassert(FALSE == H5R_top_package_initialize_s);
-
- /* Destroy the reference id group */
- n += (H5I_dec_type_ref(H5I_REFERENCE) > 0);
-
- /* Mark closed */
- if(0 == n)
- H5_PKG_INIT_VAR = FALSE;
- } /* end if */
-
- FUNC_LEAVE_NOAPI(n)
-} /* end H5R_term_package() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5R_create
- PURPOSE
- Creates a particular kind of reference for the user
- USAGE
- herr_t H5R_create(ref, loc, name, ref_type, space)
- void *ref; OUT: Reference created
- H5G_loc_t *loc; IN: File location used to locate object pointed to
- const char *name; IN: Name of object at location LOC_ID of object
- pointed to
- H5R_type_t ref_type; IN: Type of reference to create
- H5S_t *space; IN: Dataspace ID with selection, used for Dataset
- Region references.
-
- RETURNS
- Non-negative on success/Negative on failure
- DESCRIPTION
- Creates a particular type of reference specified with REF_TYPE, in the
- space pointed to by REF. The LOC_ID and NAME are used to locate the object
- pointed to and the SPACE_ID is used to choose the region pointed to (for
- Dataset Region references).
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id)
-{
- H5G_loc_t obj_loc; /* Group hier. location of object */
- H5G_name_t path; /* Object group hier. path */
- H5O_loc_t oloc; /* Object object location */
- hbool_t obj_found = FALSE; /* Object location found */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- HDassert(_ref);
- HDassert(loc);
- HDassert(name);
- HDassert(ref_type > H5R_BADTYPE && ref_type < H5R_MAXTYPE);
-
- /* Set up object location to fill in */
- obj_loc.oloc = &oloc;
- obj_loc.path = &path;
- H5G_loc_reset(&obj_loc);
-
- /* Find the object */
- if(H5G_loc_find(loc, name, &obj_loc, H5P_DEFAULT, dxpl_id) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_NOTFOUND, FAIL, "object not found")
- obj_found = TRUE;
-
- switch(ref_type) {
- case H5R_OBJECT:
- {
- hobj_ref_t *ref = (hobj_ref_t *)_ref; /* Get pointer to correct type of reference struct */
-
- *ref = obj_loc.oloc->addr;
- break;
- }
-
- case H5R_DATASET_REGION:
- {
- H5HG_t hobjid; /* Heap object ID */
- hdset_reg_ref_t *ref = (hdset_reg_ref_t *)_ref; /* Get pointer to correct type of reference struct */
- hssize_t buf_size; /* Size of buffer needed to serialize selection */
- uint8_t *p; /* Pointer to OID to store */
- uint8_t *buf; /* Buffer to store serialized selection in */
- unsigned heapid_found; /* Flag for non-zero heap ID found */
- unsigned u; /* local index */
-
- /* Set up information for dataset region */
-
- /* Return any previous heap block to the free list if we are garbage collecting */
- if(H5F_GC_REF(loc->oloc->file)) {
- /* Check for an existing heap ID in the reference */
- for(u = 0, heapid_found = 0, p = (uint8_t *)ref; u < H5R_DSET_REG_REF_BUF_SIZE; u++)
- if(p[u] != 0) {
- heapid_found = 1;
- break;
- } /* end if */
-
- if(heapid_found != 0) {
-/* Return heap block to free list */
- } /* end if */
- } /* end if */
-
- /* Zero the heap ID out, may leak heap space if user is re-using reference and doesn't have garbage collection on */
- HDmemset(ref, 0, H5R_DSET_REG_REF_BUF_SIZE);
-
- /* Get the amount of space required to serialize the selection */
- if((buf_size = H5S_SELECT_SERIAL_SIZE(space)) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "Invalid amount of space for serializing selection")
-
- /* Increase buffer size to allow for the dataset OID */
- buf_size += (hssize_t)sizeof(haddr_t);
-
- /* Allocate the space to store the serialized information */
- H5_CHECK_OVERFLOW(buf_size, hssize_t, size_t);
- if(NULL == (buf = (uint8_t *)H5MM_malloc((size_t)buf_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
-
- /* Serialize information for dataset OID into heap buffer */
- p = (uint8_t *)buf;
- H5F_addr_encode(loc->oloc->file, &p, obj_loc.oloc->addr);
-
- /* Serialize the selection into heap buffer */
- if(H5S_SELECT_SERIALIZE(space, &p) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Unable to serialize selection")
-
- /* Save the serialized buffer for later */
- H5_CHECK_OVERFLOW(buf_size, hssize_t, size_t);
- if(H5HG_insert(loc->oloc->file, dxpl_id, (size_t)buf_size, buf, &hobjid) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_WRITEERROR, FAIL, "Unable to serialize selection")
-
- /* Serialize the heap ID and index for storage in the file */
- p = (uint8_t *)ref;
- H5F_addr_encode(loc->oloc->file, &p, hobjid.addr);
- UINT32ENCODE(p, hobjid.idx);
-
- /* Free the buffer we serialized data in */
- H5MM_xfree(buf);
- break;
- }
-
- case H5R_BADTYPE:
- case H5R_MAXTYPE:
- default:
- HDassert("unknown reference type" && 0);
- HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)")
- } /* end switch */
-
-done:
- if(obj_found)
- H5G_loc_free(&obj_loc);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5R_create() */
-
/*--------------------------------------------------------------------------
NAME
@@ -378,23 +98,23 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t
H5TRACE5("e", "*xi*sRti", ref, loc_id, name, ref_type, space_id);
/* Check args */
- if(ref == NULL)
+ if (ref == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
- if(H5G_loc(loc_id, &loc) < 0)
+ if (H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
+ if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
- if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
+ if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
- if(ref_type != H5R_OBJECT && ref_type != H5R_DATASET_REGION)
+ if (ref_type != H5R_OBJECT && ref_type != H5R_DATASET_REGION)
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "reference type not supported")
- if(space_id == (-1) && ref_type == H5R_DATASET_REGION)
+ if (space_id == (-1) && ref_type == H5R_DATASET_REGION)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid")
- if(space_id != (-1) && (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))))
+ if (space_id != (-1) && (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
/* Create reference */
- if((ret_value = H5R_create(ref, &loc, name, ref_type, space, H5AC_ind_read_dxpl_id)) < 0)
+ if ((ret_value = H5R_create(ref, &loc, name, ref_type, space, H5AC_ind_read_dxpl_id)) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to create reference")
done:
@@ -404,166 +124,6 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5R_dereference
- PURPOSE
- Opens the HDF5 object referenced.
- USAGE
- hid_t H5R_dereference(ref)
- H5F_t *file; IN: File the object being dereferenced is within
- H5R_type_t ref_type; IN: Type of reference
- void *ref; IN: Reference to open.
-
- RETURNS
- Valid ID on success, Negative on failure
- DESCRIPTION
- Given a reference to some object, open that object and return an ID for
- that object.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- Currently only set up to work with references to datasets
- EXAMPLES
- REVISION LOG
- Raymond Lu
- 13 July 2011
- I added the OAPL_ID parameter for the object being referenced. It only
- supports dataset access property list currently.
-
- M. Scot Breitenfeld
- 3 March 2015
- Added a check for undefined reference pointer.
---------------------------------------------------------------------------*/
-hid_t
-H5R_dereference(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref, hbool_t app_ref)
-{
- H5O_loc_t oloc; /* Object location */
- H5G_name_t path; /* Path of object */
- H5G_loc_t loc; /* Group location */
- unsigned rc; /* Reference count of object */
- H5O_type_t obj_type; /* Type of object */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- HDassert(_ref);
- HDassert(ref_type > H5R_BADTYPE && ref_type < H5R_MAXTYPE);
- HDassert(file);
-
- /* Initialize the object location */
- H5O_loc_reset(&oloc);
- oloc.file = file;
-
- switch(ref_type) {
- case H5R_OBJECT:
- oloc.addr = *(const hobj_ref_t *)_ref; /* Only object references currently supported */
- if(!H5F_addr_defined(oloc.addr) || oloc.addr == 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Undefined reference pointer")
- break;
-
- case H5R_DATASET_REGION:
- {
- H5HG_t hobjid; /* Heap object ID */
- uint8_t *buf; /* Buffer to store serialized selection in */
- const uint8_t *p; /* Pointer to OID to store */
-
- /* Get the heap ID for the dataset region */
- p = (const uint8_t *)_ref;
- H5F_addr_decode(oloc.file, &p, &(hobjid.addr));
- UINT32DECODE(p, hobjid.idx);
-
- if(!H5F_addr_defined(hobjid.addr) || hobjid.addr == 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Undefined reference pointer")
-
- /* Get the dataset region from the heap (allocate inside routine) */
- if(NULL == (buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)))
- HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information")
-
- /* Get the object oid for the dataset */
- p = buf;
- H5F_addr_decode(oloc.file, &p, &(oloc.addr));
-
- /* Free the buffer allocated in H5HG_read() */
- H5MM_xfree(buf);
- } /* end case */
- break;
-
- case H5R_BADTYPE:
- case H5R_MAXTYPE:
- default:
- HDassert("unknown reference type" && 0);
- HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)")
- } /* end switch */
-
- /* Get the # of links for object, and its type */
- /* (To check to make certain that this object hasn't been deleted since the reference was created) */
- if(H5O_get_rc_and_type(&oloc, dxpl_id, &rc, &obj_type) < 0 || 0 == rc)
- HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object")
-
- /* Construct a group location for opening the object */
- H5G_name_reset(&path);
- loc.oloc = &oloc;
- loc.path = &path;
-
- /* Open the object */
- switch(obj_type) {
- case H5O_TYPE_GROUP:
- {
- H5G_t *group; /* Pointer to group to open */
-
- if(NULL == (group = H5G_open(&loc, dxpl_id)))
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found")
-
- /* Create an atom for the group */
- if((ret_value = H5I_register(H5I_GROUP, group, app_ref)) < 0) {
- H5G_close(group);
- HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "can't register group")
- } /* end if */
- } /* end case */
- break;
-
- case H5O_TYPE_NAMED_DATATYPE:
- {
- H5T_t *type; /* Pointer to datatype to open */
-
- if(NULL == (type = H5T_open(&loc, dxpl_id)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "not found")
-
- /* Create an atom for the datatype */
- if((ret_value = H5I_register(H5I_DATATYPE, type, app_ref)) < 0) {
- H5T_close(type);
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "can't register datatype")
- } /* end if */
- } /* end case */
- break;
-
- case H5O_TYPE_DATASET:
- {
- H5D_t *dset; /* Pointer to dataset to open */
-
- /* Open the dataset */
- if(NULL == (dset = H5D_open(&loc, oapl_id, dxpl_id)))
- HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found")
-
- /* Create an atom for the dataset */
- if((ret_value = H5I_register(H5I_DATASET, dset, app_ref)) < 0) {
- H5D_close(dset);
- HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register dataset")
- } /* end if */
- } /* end case */
- break;
-
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- HGOTO_ERROR(H5E_REFERENCE, H5E_BADTYPE, FAIL, "can't identify type of object referenced")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5R_dereference() */
-
-
-/*--------------------------------------------------------------------------
- NAME
H5Rdereference2
PURPOSE
Opens the HDF5 object referenced.
@@ -601,24 +161,24 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r
H5TRACE4("i", "iiRt*x", obj_id, oapl_id, ref_type, _ref);
/* Check args */
- if(H5G_loc(obj_id, &loc) < 0)
+ if (H5G_loc(obj_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(oapl_id < 0)
+ if (oapl_id < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
- if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
+ if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
- if(_ref == NULL)
+ if (_ref == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
/* Verify access property list and get correct dxpl */
- if(H5P_verify_apl_and_dxpl(&oapl_id, H5P_CLS_DACC, &dxpl_id, obj_id, FALSE) < 0)
+ if (H5P_verify_apl_and_dxpl(&oapl_id, H5P_CLS_DACC, &dxpl_id, obj_id, FALSE) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access and transfer property lists")
/* Get the file pointer from the entry */
file = loc.oloc->file;
/* Create reference */
- if((ret_value = H5R_dereference(file, oapl_id, dxpl_id, ref_type, _ref, TRUE)) < 0)
+ if ((ret_value = H5R_dereference(file, oapl_id, dxpl_id, ref_type, _ref, TRUE)) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to dereference object")
done:
@@ -628,75 +188,6 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5R_get_region
- PURPOSE
- Retrieves a dataspace with the region pointed to selected.
- USAGE
- H5S_t *H5R_get_region(file, ref_type, ref)
- H5F_t *file; IN: File the object being dereferenced is within
- void *ref; IN: Reference to open.
-
- RETURNS
- Pointer to the dataspace on success, NULL on failure
- DESCRIPTION
- Given a reference to some object, creates a copy of the dataset pointed
- to's dataspace and defines a selection in the copy which is the region
- pointed to.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static H5S_t *
-H5R_get_region(H5F_t *file, hid_t dxpl_id, const void *_ref)
-{
- H5O_loc_t oloc; /* Object location */
- const uint8_t *p; /* Pointer to OID to store */
- H5HG_t hobjid; /* Heap object ID */
- uint8_t *buf = NULL; /* Buffer to store serialized selection in */
- H5S_t *ret_value;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- HDassert(_ref);
- HDassert(file);
-
- /* Initialize the object location */
- H5O_loc_reset(&oloc);
- oloc.file = file;
-
- /* Get the heap ID for the dataset region */
- p = (const uint8_t *)_ref;
- H5F_addr_decode(oloc.file, &p, &(hobjid.addr));
- UINT32DECODE(p, hobjid.idx);
-
- /* Get the dataset region from the heap (allocate inside routine) */
- if((buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL)
- HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, NULL, "Unable to read dataset region information")
-
- /* Get the object oid for the dataset */
- p = buf;
- H5F_addr_decode(oloc.file, &p, &(oloc.addr));
-
- /* Open and copy the dataset's dataspace */
- if((ret_value = H5S_read(&oloc, dxpl_id)) == NULL)
- HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, NULL, "not found")
-
- /* Unserialize the selection */
- if(H5S_SELECT_DESERIALIZE(&ret_value, &p) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, NULL, "can't deserialize selection")
-
-done:
- /* Free the buffer allocated in H5HG_read() */
- if(buf)
- H5MM_xfree(buf);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5R_get_region() */
-
-
-/*--------------------------------------------------------------------------
- NAME
H5Rget_region
PURPOSE
Retrieves a dataspace with the region pointed to selected.
@@ -729,19 +220,19 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref)
H5TRACE3("i", "iRt*x", id, ref_type, ref);
/* Check args */
- if(H5G_loc(id, &loc) < 0)
+ if (H5G_loc(id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(ref_type != H5R_DATASET_REGION)
+ if (ref_type != H5R_DATASET_REGION)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
- if(ref == NULL)
+ if (ref == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
/* Get the dataspace with the correct region selected */
- if((space = H5R_get_region(loc.oloc->file, H5AC_ind_read_dxpl_id, ref)) == NULL)
+ if ((space = H5R_get_region(loc.oloc->file, H5AC_ind_read_dxpl_id, ref)) == NULL)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create dataspace")
/* Atomize */
- if((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0)
+ if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
done:
@@ -751,92 +242,6 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5R_get_obj_type
- PURPOSE
- Retrieves the type of object that an object reference points to
- USAGE
- H5O_type_t H5R_get_obj_type(file, ref_type, ref)
- H5F_t *file; IN: File the object being dereferenced is within
- H5R_type_t ref_type; IN: Type of reference to query
- void *ref; IN: Reference to query.
-
- RETURNS
- Success: An object type defined in H5Gpublic.h
- Failure: H5G_UNKNOWN
- DESCRIPTION
- Given a reference to some object, this function returns the type of object
- pointed to.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type,
- const void *_ref, H5O_type_t *obj_type)
-{
- H5O_loc_t oloc; /* Object location */
- unsigned rc; /* Reference count of object */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- HDassert(file);
- HDassert(_ref);
-
- /* Initialize the symbol table entry */
- H5O_loc_reset(&oloc);
- oloc.file = file;
-
- switch(ref_type) {
- case H5R_OBJECT:
- /* Get the object oid */
- oloc.addr = *(const hobj_ref_t *)_ref; /* Only object references currently supported */
- break;
-
- case H5R_DATASET_REGION:
- {
- H5HG_t hobjid; /* Heap object ID */
- const uint8_t *p; /* Pointer to reference to decode */
- uint8_t *buf; /* Buffer to store serialized selection in */
-
- /* Get the heap ID for the dataset region */
- p = (const uint8_t *)_ref;
- H5F_addr_decode(oloc.file, &p, &(hobjid.addr));
- UINT32DECODE(p, hobjid.idx);
-
- /* Get the dataset region from the heap (allocate inside routine) */
- if((buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL)
- HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information")
-
- /* Get the object oid for the dataset */
- p = buf;
- H5F_addr_decode(oloc.file, &p, &(oloc.addr));
-
- /* Free the buffer allocated in H5HG_read() */
- H5MM_xfree(buf);
- } /* end case */
- break;
-
- case H5R_BADTYPE:
- case H5R_MAXTYPE:
- default:
- HDassert("unknown reference type" && 0);
- HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)")
- } /* end switch */
-
- /* Get the # of links for object, and its type */
- /* (To check to make certain that this object hasn't been deleted since the reference was created) */
- if(H5O_get_rc_and_type(&oloc, dxpl_id, &rc, obj_type) < 0 || 0 == rc)
- HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5R_get_obj_type() */
-
-
-/*--------------------------------------------------------------------------
- NAME
H5Rget_obj_type2
PURPOSE
Retrieves the type of object that an object reference points to
@@ -869,16 +274,16 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref,
H5TRACE4("e", "iRt*x*Ot", id, ref_type, ref, obj_type);
/* Check args */
- if(H5G_loc(id, &loc) < 0)
+ if (H5G_loc(id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
+ if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
- if(ref == NULL)
+ if (ref == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
/* Get the object information */
- if(H5R_get_obj_type(loc.oloc->file, H5AC_ind_read_dxpl_id, ref_type, ref, obj_type) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to determine object type")
+ if (H5R_get_obj_type(loc.oloc->file, H5AC_ind_read_dxpl_id, ref_type, ref, obj_type) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to determine object type")
done:
FUNC_LEAVE_API(ret_value)
@@ -887,106 +292,6 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5R_get_name
- PURPOSE
- Internal routine to determine a name for the object referenced
- USAGE
- ssize_t H5R_get_name(f, dxpl_id, ref_type, ref, name, size)
- H5F_t *f; IN: Pointer to the file that the reference is pointing
- into
- hid_t lapl_id; IN: LAPL to use for operation
- hid_t dxpl_id; IN: DXPL to use for operation
- hid_t id; IN: Location ID given for reference
- H5R_type_t ref_type; IN: Type of reference
- void *ref; IN: Reference to query.
- char *name; OUT: Buffer to place name of object referenced
- size_t size; IN: Size of name buffer
-
- RETURNS
- Non-negative length of the path on success, Negative on failure
- DESCRIPTION
- Given a reference to some object, determine a path to the object
- referenced in the file.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- This may not be the only path to that object.
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static ssize_t
-H5R_get_name(H5F_t *f, hid_t lapl_id, hid_t dxpl_id, hid_t id, H5R_type_t ref_type,
- const void *_ref, char *name, size_t size)
-{
- hid_t file_id = H5I_INVALID_HID; /* ID for file that the reference is in */
- H5O_loc_t oloc; /* Object location describing object for reference */
- ssize_t ret_value = -1; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check args */
- HDassert(f);
- HDassert(_ref);
-
- /* Initialize the object location */
- H5O_loc_reset(&oloc);
- oloc.file = f;
-
- /* Get address for reference */
- switch(ref_type) {
- case H5R_OBJECT:
- oloc.addr = *(const hobj_ref_t *)_ref;
- break;
-
- case H5R_DATASET_REGION:
- {
- H5HG_t hobjid; /* Heap object ID */
- uint8_t *buf; /* Buffer to store serialized selection in */
- const uint8_t *p; /* Pointer to OID to store */
-
- /* Get the heap ID for the dataset region */
- p = (const uint8_t *)_ref;
- H5F_addr_decode(oloc.file, &p, &(hobjid.addr));
- UINT32DECODE(p, hobjid.idx);
-
- /* Get the dataset region from the heap (allocate inside routine) */
- if((buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL)
- HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information")
-
- /* Get the object oid for the dataset */
- p = buf;
- H5F_addr_decode(oloc.file, &p, &(oloc.addr));
-
- /* Free the buffer allocated in H5HG_read() */
- H5MM_xfree(buf);
- } /* end case */
- break;
-
- case H5R_BADTYPE:
- case H5R_MAXTYPE:
- default:
- HDassert("unknown reference type" && 0);
- HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)")
- } /* end switch */
-
- /* Retrieve file ID for name search */
- if((file_id = H5I_get_file_id(id, FALSE)) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve file ID")
-
- /* Get name, length, etc. */
- if((ret_value = H5G_get_name_by_addr(file_id, lapl_id, dxpl_id, &oloc, name, size)) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't determine name")
-
-done:
- /* Close file ID used for search */
- if(file_id > 0 && H5I_dec_ref(file_id) < 0)
- HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "can't decrement ref count of temp ID")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5R_get_name() */
-
-
-/*--------------------------------------------------------------------------
- NAME
H5Rget_name
PURPOSE
Determines a name for the object referenced
@@ -1030,18 +335,18 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name,
H5TRACE5("Zs", "iRt*x*sz", id, ref_type, _ref, name, size);
/* Check args */
- if(H5G_loc(id, &loc) < 0)
+ if (H5G_loc(id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
+ if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
- if(_ref == NULL)
+ if (_ref == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
/* Get the file pointer from the entry */
file = loc.oloc->file;
/* Get name */
- if((ret_value = H5R_get_name(file, H5P_DEFAULT, H5AC_ind_read_dxpl_id, id, ref_type, _ref, name, size)) < 0)
+ if ((ret_value = H5R_get_name(file, H5P_DEFAULT, H5AC_ind_read_dxpl_id, id, ref_type, _ref, name, size)) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to determine object path")
done:
diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c
index 109bbb4..699f8df 100644
--- a/src/H5Rdeprec.c
+++ b/src/H5Rdeprec.c
@@ -13,11 +13,9 @@
/*-------------------------------------------------------------------------
*
- * Created: H5Rdeprec.c
- * September 13 2007
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Created: H5Rdeprec.c
*
- * Purpose: Deprecated functions from the H5R interface. These
+ * Purpose: Deprecated functions from the H5R interface. These
* functions are here for compatibility purposes and may be
* removed in the future. Applications should switch to the
* newer APIs.
@@ -35,13 +33,16 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Gprivate.h" /* Groups */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Rpkg.h" /* References */
-#include "H5Ppublic.h" /* for using H5P_DATASET_ACCESS_DEFAULT */
+/* Public headers needed by this file */
+#include "H5Ppublic.h" /* Property lists */
+
+/* Private headers needed by this file */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Rpkg.h" /* References */
/****************/
@@ -81,29 +82,22 @@
#ifndef H5_NO_DEPRECATED_SYMBOLS
-/*--------------------------------------------------------------------------
- NAME
- H5Rget_obj_type1
- PURPOSE
- Retrieves the type of object that an object reference points to
- USAGE
- H5G_obj_t H5Rget_obj_type1(id, ref_type, ref)
- hid_t id; IN: Dataset reference object is in or location ID of
- object that the dataset is located within.
- H5R_type_t ref_type; IN: Type of reference to query
- void *ref; IN: Reference to query.
-
- RETURNS
- Success: An object type defined in H5Gpublic.h
- Failure: H5G_UNKNOWN
- DESCRIPTION
- Given a reference to some object, this function returns the type of object
- pointed to.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------
+ * Function: H5Rget_obj_type1
+ *
+ * Purpose: Retrieves the type of the object that an object points to.
+ *
+ * Parameters:
+ * id IN: Dataset reference object is in or location ID of
+ * object that the dataset is located within
+ * ref_type IN: Type of reference to query
+ * ref IN: Reference to query
+ *
+ * Return: Success: An object type (as defined in H5Gpublic.h)
+ * Failure: H5G_UNKNOWN
+ *
+ *-------------------------------------------------------------------------
+ */
H5G_obj_t
H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref)
{
@@ -115,16 +109,16 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref)
H5TRACE3("Go", "iRt*x", id, ref_type, ref);
/* Check args */
- if(H5G_loc(id, &loc) < 0)
+ if (H5G_loc(id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location")
- if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
+ if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference type")
- if(ref == NULL)
+ if (ref == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference pointer")
/* Get the object information */
- if(H5R_get_obj_type(loc.oloc->file, H5AC_ind_read_dxpl_id, ref_type, ref, &obj_type) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type")
+ if (H5R_get_obj_type(loc.oloc->file, H5AC_ind_read_dxpl_id, ref_type, ref, &obj_type) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type")
/* Set return value */
ret_value = H5G_map_obj_type(obj_type);
@@ -134,28 +128,22 @@ done:
} /* end H5Rget_obj_type1() */
-/*--------------------------------------------------------------------------
- NAME
- H5Rdereference1
- PURPOSE
- Opens the HDF5 object referenced.
- USAGE
- hid_t H5Rdereference1(ref)
- hid_t id; IN: Dataset reference object is in or location ID of
- object that the dataset is located within.
- H5R_type_t ref_type; IN: Type of reference to create
- void *ref; IN: Reference to open.
-
- RETURNS
- Valid ID on success, Negative on failure
- DESCRIPTION
- Given a reference to some object, open that object and return an ID for
- that object.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------
+ * Function: H5Rdereference1
+ *
+ * Purpose: Opens the HDF5 object referenced.
+ *
+ * Parameters:
+ * id IN: Dataset reference object is in or location ID of
+ * object that the dataset is located within
+ * ref_type IN: Type of reference to create
+ * ref IN: Reference to open
+ *
+ * Return: Success: Valid HDF5 ID
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
hid_t
H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref)
{
@@ -167,18 +155,18 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref)
H5TRACE3("i", "iRt*x", obj_id, ref_type, _ref);
/* Check args */
- if(H5G_loc(obj_id, &loc) < 0)
+ if (H5G_loc(obj_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
+ if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
- if(_ref == NULL)
+ if (_ref == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
/* Get the file pointer from the entry */
file = loc.oloc->file;
/* Create reference */
- if((ret_value = H5R_dereference(file, H5P_DATASET_ACCESS_DEFAULT, H5AC_ind_read_dxpl_id, ref_type, _ref, TRUE)) < 0)
+ if ((ret_value = H5R_dereference(file, H5P_DATASET_ACCESS_DEFAULT, H5AC_ind_read_dxpl_id, ref_type, _ref, TRUE)) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable dereference object")
done:
diff --git a/src/H5Rint.c b/src/H5Rint.c
new file mode 100644
index 0000000..716a573
--- /dev/null
+++ b/src/H5Rint.c
@@ -0,0 +1,767 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5Rmodule.h" /* This source code file is part of the H5R module */
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Gprivate.h" /* Groups */
+#include "H5HGprivate.h" /* Global Heaps */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Rpkg.h" /* References */
+#include "H5Sprivate.h" /* Dataspaces */
+#include "H5Tprivate.h" /* Datatypes */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/* Package initialization variable */
+hbool_t H5_PKG_INIT_VAR = FALSE;
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Reference ID class
+ *
+ * NOTE: H5I_REFERENCE is not used by the library and has been deprecated
+ * with a tentative removal version of 1.12.0. (DER, July 2017)
+ */
+static const H5I_class_t H5I_REFERENCE_CLS[1] = {{
+ H5I_REFERENCE, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
+ NULL /* Callback routine for closing objects of this class */
+}};
+
+/* Flag indicating "top" of interface has been initialized */
+static hbool_t H5R_top_package_initialize_s = FALSE;
+
+
+/*--------------------------------------------------------------------------
+NAME
+ H5R__init_package -- Initialize interface-specific information
+USAGE
+ herr_t H5R__init_package()
+
+RETURNS
+ Non-negative on success/Negative on failure
+DESCRIPTION
+ Initializes any interface-specific data or routines.
+
+--------------------------------------------------------------------------*/
+herr_t
+H5R__init_package(void)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Initialize the atom group for the file IDs */
+ if (H5I_register_type(H5I_REFERENCE_CLS) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to initialize interface")
+
+ /* Mark "top" of interface as initialized, too */
+ H5R_top_package_initialize_s = TRUE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R__init_package() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5R_top_term_package
+ PURPOSE
+ Terminate various H5R objects
+ USAGE
+ void H5R_top_term_package()
+ RETURNS
+ void
+ DESCRIPTION
+ Release IDs for the atom group, deferring full interface shutdown
+ until later (in H5R_term_package).
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ Can't report errors...
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int
+H5R_top_term_package(void)
+{
+ int n = 0;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ if (H5R_top_package_initialize_s) {
+ if (H5I_nmembers(H5I_REFERENCE) > 0) {
+ (void)H5I_clear_type(H5I_REFERENCE, FALSE, FALSE);
+ n++;
+ }
+
+ /* Mark closed */
+ if (0 == n)
+ H5R_top_package_initialize_s = FALSE;
+ }
+
+ FUNC_LEAVE_NOAPI(n)
+} /* end H5R_top_term_package() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5R_term_package
+ PURPOSE
+ Terminate various H5R objects
+ USAGE
+ void H5R_term_package()
+ RETURNS
+ void
+ DESCRIPTION
+ Release the atom group and any other resources allocated.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ Can't report errors...
+
+ Finishes shutting down the interface, after H5R_top_term_package()
+ is called
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int
+H5R_term_package(void)
+{
+ int n = 0;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ if (H5_PKG_INIT_VAR) {
+ /* Sanity checks */
+ HDassert(0 == H5I_nmembers(H5I_REFERENCE));
+ HDassert(FALSE == H5R_top_package_initialize_s);
+
+ /* Destroy the reference id group */
+ n += (H5I_dec_type_ref(H5I_REFERENCE) > 0);
+
+ /* Mark closed */
+ if (0 == n)
+ H5_PKG_INIT_VAR = FALSE;
+ }
+
+ FUNC_LEAVE_NOAPI(n)
+} /* end H5R_term_package() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5R_create
+ PURPOSE
+ Creates a particular kind of reference for the user
+ USAGE
+ herr_t H5R_create(ref, loc, name, ref_type, space)
+ void *ref; OUT: Reference created
+ H5G_loc_t *loc; IN: File location used to locate object pointed to
+ const char *name; IN: Name of object at location LOC_ID of object
+ pointed to
+ H5R_type_t ref_type; IN: Type of reference to create
+ H5S_t *space; IN: Dataspace ID with selection, used for Dataset
+ Region references.
+
+ RETURNS
+ Non-negative on success/Negative on failure
+ DESCRIPTION
+ Creates a particular type of reference specified with REF_TYPE, in the
+ space pointed to by REF. The LOC_ID and NAME are used to locate the object
+ pointed to and the SPACE_ID is used to choose the region pointed to (for
+ Dataset Region references).
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id)
+{
+ H5G_loc_t obj_loc; /* Group hier. location of object */
+ H5G_name_t path; /* Object group hier. path */
+ H5O_loc_t oloc; /* Object object location */
+ hbool_t obj_found = FALSE; /* Object location found */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ HDassert(_ref);
+ HDassert(loc);
+ HDassert(name);
+ HDassert(ref_type > H5R_BADTYPE && ref_type < H5R_MAXTYPE);
+
+ /* Set up object location to fill in */
+ obj_loc.oloc = &oloc;
+ obj_loc.path = &path;
+ H5G_loc_reset(&obj_loc);
+
+ /* Find the object */
+ if (H5G_loc_find(loc, name, &obj_loc, H5P_DEFAULT, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_NOTFOUND, FAIL, "object not found")
+ obj_found = TRUE;
+
+ switch (ref_type) {
+ case H5R_OBJECT:
+ {
+ hobj_ref_t *ref = (hobj_ref_t *)_ref; /* Get pointer to correct type of reference struct */
+
+ *ref = obj_loc.oloc->addr;
+ break;
+ }
+
+ case H5R_DATASET_REGION:
+ {
+ H5HG_t hobjid; /* Heap object ID */
+ hdset_reg_ref_t *ref = (hdset_reg_ref_t *)_ref; /* Get pointer to correct type of reference struct */
+ hssize_t buf_size; /* Size of buffer needed to serialize selection */
+ uint8_t *p; /* Pointer to OID to store */
+ uint8_t *buf; /* Buffer to store serialized selection in */
+ unsigned heapid_found; /* Flag for non-zero heap ID found */
+ unsigned u; /* local index */
+
+ /* Set up information for dataset region */
+
+ /* Return any previous heap block to the free list if we are
+ * garbage collecting
+ */
+ if (H5F_GC_REF(loc->oloc->file)) {
+ /* Check for an existing heap ID in the reference */
+ for (u = 0, heapid_found = 0, p = (uint8_t *)ref; u < H5R_DSET_REG_REF_BUF_SIZE; u++)
+ if (p[u] != 0) {
+ heapid_found = 1;
+ break;
+ }
+
+ if (heapid_found != 0) {
+ /* Return heap block to free list */
+ }
+ }
+
+ /* Zero the heap ID out, may leak heap space if user is re-using
+ * reference and doesn't have garbage collection turned on
+ */
+ HDmemset(ref, 0, H5R_DSET_REG_REF_BUF_SIZE);
+
+ /* Get the amount of space required to serialize the selection */
+ if ((buf_size = H5S_SELECT_SERIAL_SIZE(space)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "Invalid amount of space for serializing selection")
+
+ /* Increase buffer size to allow for the dataset OID */
+ buf_size += (hssize_t)sizeof(haddr_t);
+
+ /* Allocate the space to store the serialized information */
+ H5_CHECK_OVERFLOW(buf_size, hssize_t, size_t);
+ if (NULL == (buf = (uint8_t *)H5MM_malloc((size_t)buf_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+
+ /* Serialize information for dataset OID into heap buffer */
+ p = (uint8_t *)buf;
+ H5F_addr_encode(loc->oloc->file, &p, obj_loc.oloc->addr);
+
+ /* Serialize the selection into heap buffer */
+ if (H5S_SELECT_SERIALIZE(space, &p) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Unable to serialize selection")
+
+ /* Save the serialized buffer for later */
+ H5_CHECK_OVERFLOW(buf_size, hssize_t, size_t);
+ if (H5HG_insert(loc->oloc->file, dxpl_id, (size_t)buf_size, buf, &hobjid) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_WRITEERROR, FAIL, "Unable to serialize selection")
+
+ /* Serialize the heap ID and index for storage in the file */
+ p = (uint8_t *)ref;
+ H5F_addr_encode(loc->oloc->file, &p, hobjid.addr);
+ UINT32ENCODE(p, hobjid.idx);
+
+ /* Free the buffer we serialized data in */
+ H5MM_xfree(buf);
+ break;
+ } /* end case H5R_DATASET_REGION */
+
+ case H5R_BADTYPE:
+ case H5R_MAXTYPE:
+ default:
+ HDassert("unknown reference type" && 0);
+ HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)")
+ } /* end switch */
+
+done:
+ if (obj_found)
+ H5G_loc_free(&obj_loc);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R_create() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5R_dereference
+ PURPOSE
+ Opens the HDF5 object referenced.
+ USAGE
+ hid_t H5R_dereference(ref)
+ H5F_t *file; IN: File the object being dereferenced is within
+ H5R_type_t ref_type; IN: Type of reference
+ void *ref; IN: Reference to open.
+
+ RETURNS
+ Valid ID on success, Negative on failure
+ DESCRIPTION
+ Given a reference to some object, open that object and return an ID for
+ that object.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ Currently only set up to work with references to datasets
+ EXAMPLES
+ REVISION LOG
+ Raymond Lu
+ 13 July 2011
+ I added the OAPL_ID parameter for the object being referenced. It only
+ supports dataset access property list currently.
+
+ M. Scot Breitenfeld
+ 3 March 2015
+ Added a check for undefined reference pointer.
+--------------------------------------------------------------------------*/
+hid_t
+H5R_dereference(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref, hbool_t app_ref)
+{
+ H5O_loc_t oloc; /* Object location */
+ H5G_name_t path; /* Path of object */
+ H5G_loc_t loc; /* Group location */
+ unsigned rc; /* Reference count of object */
+ H5O_type_t obj_type; /* Type of object */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ HDassert(_ref);
+ HDassert(ref_type > H5R_BADTYPE && ref_type < H5R_MAXTYPE);
+ HDassert(file);
+
+ /* Initialize the object location */
+ H5O_loc_reset(&oloc);
+ oloc.file = file;
+
+ switch (ref_type) {
+ case H5R_OBJECT:
+ {
+ oloc.addr = *(const hobj_ref_t *)_ref; /* Only object references currently supported */
+ if (!H5F_addr_defined(oloc.addr) || oloc.addr == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Undefined reference pointer")
+ break;
+ }
+
+ case H5R_DATASET_REGION:
+ {
+ H5HG_t hobjid; /* Heap object ID */
+ uint8_t *buf; /* Buffer to store serialized selection in */
+ const uint8_t *p; /* Pointer to OID to store */
+
+ /* Get the heap ID for the dataset region */
+ p = (const uint8_t *)_ref;
+ H5F_addr_decode(oloc.file, &p, &(hobjid.addr));
+ UINT32DECODE(p, hobjid.idx);
+
+ if (!H5F_addr_defined(hobjid.addr) || hobjid.addr == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Undefined reference pointer")
+
+ /* Get the dataset region from the heap (allocate inside routine) */
+ if (NULL == (buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information")
+
+ /* Get the object oid for the dataset */
+ p = buf;
+ H5F_addr_decode(oloc.file, &p, &(oloc.addr));
+
+ /* Free the buffer allocated in H5HG_read() */
+ H5MM_xfree(buf);
+ break;
+ } /* end case H5R_DATASET_REGION */
+
+ case H5R_BADTYPE:
+ case H5R_MAXTYPE:
+ default:
+ HDassert("unknown reference type" && 0);
+ HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)")
+ } /* end switch */
+
+ /* Get the # of links for object, and its type
+ * (To check to make certain that this object hasn't been deleted
+ * since the reference was created)
+ */
+ if (H5O_get_rc_and_type(&oloc, dxpl_id, &rc, &obj_type) < 0 || 0 == rc)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object")
+
+ /* Construct a group location for opening the object */
+ H5G_name_reset(&path);
+ loc.oloc = &oloc;
+ loc.path = &path;
+
+ /* Open the object */
+ switch (obj_type) {
+ case H5O_TYPE_GROUP:
+ {
+ H5G_t *group; /* Pointer to group to open */
+
+ if (NULL == (group = H5G_open(&loc, dxpl_id)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found")
+
+ /* Create an atom for the group */
+ if ((ret_value = H5I_register(H5I_GROUP, group, app_ref)) < 0) {
+ H5G_close(group);
+ HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "can't register group")
+ }
+
+ break;
+ }
+
+ case H5O_TYPE_NAMED_DATATYPE:
+ {
+ H5T_t *type; /* Pointer to datatype to open */
+
+ if (NULL == (type = H5T_open(&loc, dxpl_id)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "not found")
+
+ /* Create an atom for the datatype */
+ if ((ret_value = H5I_register(H5I_DATATYPE, type, app_ref)) < 0) {
+ H5T_close(type);
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "can't register datatype")
+ }
+
+ break;
+ }
+
+ case H5O_TYPE_DATASET:
+ {
+ H5D_t *dset; /* Pointer to dataset to open */
+
+ /* Open the dataset */
+ if (NULL == (dset = H5D_open(&loc, oapl_id, dxpl_id)))
+ HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found")
+
+ /* Create an atom for the dataset */
+ if ((ret_value = H5I_register(H5I_DATASET, dset, app_ref)) < 0) {
+ H5D_close(dset);
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register dataset")
+ }
+
+ break;
+ }
+
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ HGOTO_ERROR(H5E_REFERENCE, H5E_BADTYPE, FAIL, "can't identify type of object referenced")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R_dereference() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5R_get_region
+ PURPOSE
+ Retrieves a dataspace with the region pointed to selected.
+ USAGE
+ H5S_t *H5R_get_region(file, ref_type, ref)
+ H5F_t *file; IN: File the object being dereferenced is within
+ void *ref; IN: Reference to open.
+
+ RETURNS
+ Pointer to the dataspace on success, NULL on failure
+ DESCRIPTION
+ Given a reference to some object, creates a copy of the dataset pointed
+ to's dataspace and defines a selection in the copy which is the region
+ pointed to.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+H5S_t *
+H5R_get_region(H5F_t *file, hid_t dxpl_id, const void *_ref)
+{
+ H5O_loc_t oloc; /* Object location */
+ const uint8_t *p; /* Pointer to OID to store */
+ H5HG_t hobjid; /* Heap object ID */
+ uint8_t *buf = NULL; /* Buffer to store serialized selection in */
+ H5S_t *ret_value;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ HDassert(_ref);
+ HDassert(file);
+
+ /* Initialize the object location */
+ H5O_loc_reset(&oloc);
+ oloc.file = file;
+
+ /* Get the heap ID for the dataset region */
+ p = (const uint8_t *)_ref;
+ H5F_addr_decode(oloc.file, &p, &(hobjid.addr));
+ UINT32DECODE(p, hobjid.idx);
+
+ /* Get the dataset region from the heap (allocate inside routine) */
+ if ((buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, NULL, "Unable to read dataset region information")
+
+ /* Get the object oid for the dataset */
+ p = buf;
+ H5F_addr_decode(oloc.file, &p, &(oloc.addr));
+
+ /* Open and copy the dataset's dataspace */
+ if ((ret_value = H5S_read(&oloc, dxpl_id)) == NULL)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, NULL, "not found")
+
+ /* Unserialize the selection */
+ if (H5S_SELECT_DESERIALIZE(&ret_value, &p) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, NULL, "can't deserialize selection")
+
+done:
+ /* Free the buffer allocated in H5HG_read() */
+ if (buf)
+ H5MM_xfree(buf);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R_get_region() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5R_get_obj_type
+ PURPOSE
+ Retrieves the type of object that an object reference points to
+ USAGE
+ H5O_type_t H5R_get_obj_type(file, ref_type, ref)
+ H5F_t *file; IN: File the object being dereferenced is within
+ H5R_type_t ref_type; IN: Type of reference to query
+ void *ref; IN: Reference to query.
+
+ RETURNS
+ Success: An object type defined in H5Gpublic.h
+ Failure: H5G_UNKNOWN
+ DESCRIPTION
+ Given a reference to some object, this function returns the type of object
+ pointed to.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type,
+ const void *_ref, H5O_type_t *obj_type)
+{
+ H5O_loc_t oloc; /* Object location */
+ unsigned rc; /* Reference count of object */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ HDassert(file);
+ HDassert(_ref);
+
+ /* Initialize the symbol table entry */
+ H5O_loc_reset(&oloc);
+ oloc.file = file;
+
+ switch (ref_type) {
+ case H5R_OBJECT:
+ {
+ /* Get the object oid */
+ oloc.addr = *(const hobj_ref_t *)_ref; /* Only object references currently supported */
+ break;
+ }
+
+ case H5R_DATASET_REGION:
+ {
+ H5HG_t hobjid; /* Heap object ID */
+ const uint8_t *p; /* Pointer to reference to decode */
+ uint8_t *buf; /* Buffer to store serialized selection in */
+
+ /* Get the heap ID for the dataset region */
+ p = (const uint8_t *)_ref;
+ H5F_addr_decode(oloc.file, &p, &(hobjid.addr));
+ UINT32DECODE(p, hobjid.idx);
+
+ /* Get the dataset region from the heap (allocate inside routine) */
+ if ((buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information")
+
+ /* Get the object oid for the dataset */
+ p = buf;
+ H5F_addr_decode(oloc.file, &p, &(oloc.addr));
+
+ /* Free the buffer allocated in H5HG_read() */
+ H5MM_xfree(buf);
+
+ break;
+ }
+
+ case H5R_BADTYPE:
+ case H5R_MAXTYPE:
+ default:
+ HDassert("unknown reference type" && 0);
+ HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)")
+ } /* end switch */
+
+ /* Get the # of links for object, and its type */
+ /* (To check to make certain that this object hasn't been deleted since the reference was created) */
+ if (H5O_get_rc_and_type(&oloc, dxpl_id, &rc, obj_type) < 0 || 0 == rc)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R_get_obj_type() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5R_get_name
+ PURPOSE
+ Internal routine to determine a name for the object referenced
+ USAGE
+ ssize_t H5R_get_name(f, dxpl_id, ref_type, ref, name, size)
+ H5F_t *f; IN: Pointer to the file that the reference is pointing
+ into
+ hid_t lapl_id; IN: LAPL to use for operation
+ hid_t dxpl_id; IN: DXPL to use for operation
+ hid_t id; IN: Location ID given for reference
+ H5R_type_t ref_type; IN: Type of reference
+ void *ref; IN: Reference to query.
+ char *name; OUT: Buffer to place name of object referenced
+ size_t size; IN: Size of name buffer
+
+ RETURNS
+ Non-negative length of the path on success, Negative on failure
+ DESCRIPTION
+ Given a reference to some object, determine a path to the object
+ referenced in the file.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ This may not be the only path to that object.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+ssize_t
+H5R_get_name(H5F_t *f, hid_t lapl_id, hid_t dxpl_id, hid_t id, H5R_type_t ref_type,
+ const void *_ref, char *name, size_t size)
+{
+ hid_t file_id = H5I_INVALID_HID; /* ID for file that the reference is in */
+ H5O_loc_t oloc; /* Object location describing object for reference */
+ ssize_t ret_value = -1; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Check args */
+ HDassert(f);
+ HDassert(_ref);
+
+ /* Initialize the object location */
+ H5O_loc_reset(&oloc);
+ oloc.file = f;
+
+ /* Get address for reference */
+ switch (ref_type) {
+ case H5R_OBJECT:
+ {
+ oloc.addr = *(const hobj_ref_t *)_ref;
+ break;
+ }
+
+ case H5R_DATASET_REGION:
+ {
+ H5HG_t hobjid; /* Heap object ID */
+ uint8_t *buf; /* Buffer to store serialized selection in */
+ const uint8_t *p; /* Pointer to OID to store */
+
+ /* Get the heap ID for the dataset region */
+ p = (const uint8_t *)_ref;
+ H5F_addr_decode(oloc.file, &p, &(hobjid.addr));
+ UINT32DECODE(p, hobjid.idx);
+
+ /* Get the dataset region from the heap (allocate inside routine) */
+ if ((buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information")
+
+ /* Get the object oid for the dataset */
+ p = buf;
+ H5F_addr_decode(oloc.file, &p, &(oloc.addr));
+
+ /* Free the buffer allocated in H5HG_read() */
+ H5MM_xfree(buf);
+
+ break;
+ }
+
+ case H5R_BADTYPE:
+ case H5R_MAXTYPE:
+ default:
+ HDassert("unknown reference type" && 0);
+ HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)")
+ } /* end switch */
+
+ /* Retrieve file ID for name search */
+ if ((file_id = H5I_get_file_id(id, FALSE)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve file ID")
+
+ /* Get name, length, etc. */
+ if ((ret_value = H5G_get_name_by_addr(file_id, lapl_id, dxpl_id, &oloc, name, size)) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't determine name")
+
+done:
+ /* Close file ID used for search */
+ if (file_id > 0 && H5I_dec_ref(file_id) < 0)
+ HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "can't decrement ref count of temp ID")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5R_get_name() */
+
diff --git a/src/H5Rmodule.h b/src/H5Rmodule.h
index 2eaf050..678a668 100644
--- a/src/H5Rmodule.h
+++ b/src/H5Rmodule.h
@@ -10,13 +10,9 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
- * Saturday, September 12, 2015
- *
- * Purpose: This file contains declarations which define macros for the
- * H5R package. Including this header means that the source file
- * is part of the H5R package.
+/* Purpose: This file contains declarations which define macros for the
+ * H5R package. Including this header means that the source file
+ * is part of the H5R package.
*/
#ifndef _H5Rmodule_H
#define _H5Rmodule_H
@@ -31,4 +27,3 @@
#endif /* _H5Rmodule_H */
-
diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h
index 6d5036b..129f944 100644
--- a/src/H5Rpkg.h
+++ b/src/H5Rpkg.h
@@ -11,11 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
- * Thursday, September 13, 2007
- *
- * Purpose: This file contains declarations which are visible
+/* Purpose: This file contains declarations which are visible
* only within the H5R package. Source files outside the
* H5R package should include H5Rprivate.h instead.
*/
@@ -30,7 +26,6 @@
#include "H5Rprivate.h"
/* Other private headers needed by this file */
-#include "H5Fprivate.h" /* File access */
/**************************/
/* Package Private Macros */
@@ -51,12 +46,5 @@
/* Package Private Prototypes */
/******************************/
-/* General functions */
-H5_DLL herr_t H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type,
- const void *_ref, H5O_type_t *obj_type);
-H5_DLL hid_t H5R_dereference(H5F_t *file, hid_t dapl_id, hid_t dxpl_id, H5R_type_t ref_type,
- const void *_ref, hbool_t app_ref);
-
-
#endif /* _H5Rpkg_H */
diff --git a/src/H5Rprivate.h b/src/H5Rprivate.h
index 7efa225..35e63d2 100644
--- a/src/H5Rprivate.h
+++ b/src/H5Rprivate.h
@@ -20,10 +20,40 @@
#include "H5Rpublic.h"
/* Private headers needed by this file */
+#include "H5Fprivate.h" /* Files */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Sprivate.h" /* Dataspaces */
-/* Internal data structures */
-/* Private functions */
+/**************************/
+/* Library Private Macros */
+/**************************/
+
+
+/****************************/
+/* Library Private Typedefs */
+/****************************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/******************************/
+/* Library Private Prototypes */
+/******************************/
+
+H5_DLL herr_t H5R_create(void *ref, H5G_loc_t *loc, const char *name,
+ H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id);
+H5_DLL H5S_t * H5R_get_region(H5F_t *file, hid_t dxpl_id, const void *_ref);
+H5_DLL ssize_t H5R_get_name(H5F_t *file, hid_t lapl_id, hid_t dxpl_id, hid_t id,
+ H5R_type_t ref_type, const void *_ref, char *name, size_t size);
+H5_DLL herr_t H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type,
+ const void *_ref, H5O_type_t *obj_type);
+H5_DLL hid_t H5R_dereference(H5F_t *file, hid_t dapl_id, hid_t dxpl_id, H5R_type_t ref_type,
+ const void *_ref, hbool_t app_ref);
#endif /* _H5Rprivate_H */
diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h
index 446b7cd..598bafd 100644
--- a/src/H5Rpublic.h
+++ b/src/H5Rpublic.h
@@ -22,40 +22,59 @@
#include "H5Gpublic.h"
#include "H5Ipublic.h"
-/*
- * Reference types allowed.
- */
-typedef enum {
- H5R_BADTYPE = (-1), /*invalid Reference Type */
- H5R_OBJECT, /*Object reference */
- H5R_DATASET_REGION, /*Dataset Region Reference */
- H5R_MAXTYPE /*highest type (Invalid as true type) */
-} H5R_type_t;
+/*****************/
+/* Public Macros */
+/*****************/
/* Note! Be careful with the sizes of the references because they should really
* depend on the run-time values in the file. Unfortunately, the arrays need
- * to be defined at compile-time, so we have to go with the worst case sizes for
- * them. -QAK
+ * to be defined at compile-time, so we have to go with the worst case sizes
+ * for them. -QAK
+ */
+#define H5R_OBJ_REF_BUF_SIZE sizeof(haddr_t)
+
+/* 4 is used instead of sizeof(int) to permit portability between the Crays
+ * and other machines (the heap ID is always encoded as an int32 anyway).
+ */
+#define H5R_DSET_REG_REF_BUF_SIZE (sizeof(haddr_t) + 4)
+
+/*******************/
+/* Public Typedefs */
+/*******************/
+
+/* Reference types */
+typedef enum H5R_type_t {
+ H5R_BADTYPE = (-1), /* Invalid Reference Type */
+ H5R_OBJECT, /* Object reference */
+ H5R_DATASET_REGION, /* Dataset Region Reference */
+ H5R_MAXTYPE /* Highest type (Invalid as true type) */
+} H5R_type_t;
+
+/* Object reference structure for user's code
+ * This needs to be large enough to store largest haddr_t on a worst case
+ * machine (8 bytes currently).
+ */
+typedef haddr_t hobj_ref_t;
+
+/* Dataset Region reference structure for user's code
+ * (Buffer to store heap ID and index)
+ * This needs to be large enough to store largest haddr_t in a worst case
+ * machine (8 bytes currently) plus an int
*/
-#define H5R_OBJ_REF_BUF_SIZE sizeof(haddr_t)
-/* Object reference structure for user's code */
-typedef haddr_t hobj_ref_t; /* Needs to be large enough to store largest haddr_t in a worst case machine (ie. 8 bytes currently) */
+typedef unsigned char hdset_reg_ref_t[H5R_DSET_REG_REF_BUF_SIZE];
-#define H5R_DSET_REG_REF_BUF_SIZE (sizeof(haddr_t)+4)
-/* 4 is used instead of sizeof(int) to permit portability between
- the Crays and other machines (the heap ID is always encoded as an int32 anyway)
-*/
-/* Dataset Region reference structure for user's code */
-typedef unsigned char hdset_reg_ref_t[H5R_DSET_REG_REF_BUF_SIZE];/* Buffer to store heap ID and index */
-/* Needs to be large enough to store largest haddr_t in a worst case machine (ie. 8 bytes currently) plus an int */
+/********************/
+/* Public Variables */
+/********************/
-/* Publicly visible data structures */
+/*********************/
+/* Public Prototypes */
+/*********************/
#ifdef __cplusplus
extern "C" {
#endif
-/* Functions in H5R.c */
H5_DLL herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name,
H5R_type_t ref_type, hid_t space_id);
H5_DLL hid_t H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *ref);
@@ -63,7 +82,7 @@ H5_DLL hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, const void *ref);
H5_DLL herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *_ref,
H5O_type_t *obj_type);
H5_DLL ssize_t H5Rget_name(hid_t loc_id, H5R_type_t ref_type, const void *ref,
- char *name/*out*/, size_t size);
+ char *name /*out*/, size_t size);
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
@@ -71,12 +90,6 @@ H5_DLL ssize_t H5Rget_name(hid_t loc_id, H5R_type_t ref_type, const void *ref,
*/
#ifndef H5_NO_DEPRECATED_SYMBOLS
-/* Macros */
-
-
-/* Typedefs */
-
-
/* Function prototypes */
H5_DLL H5G_obj_t H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *_ref);
H5_DLL hid_t H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref);
diff --git a/src/H5S.c b/src/H5S.c
index 01cacf0..8046357 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -57,6 +57,12 @@ static htri_t H5S_is_simple(const H5S_t *sdim);
/* Package initialization variable */
hbool_t H5_PKG_INIT_VAR = FALSE;
+/* Format version bounds for dataspace */
+const unsigned H5O_sdspace_ver_bounds[] = {
+ H5O_SDSPACE_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5O_SDSPACE_VERSION_2, /* H5F_LIBVER_V18 */
+ H5O_SDSPACE_VERSION_LATEST /* H5F_LIBVER_LATEST */
+};
/*****************************/
/* Library Private Variables */
@@ -84,12 +90,6 @@ static const H5I_class_t H5I_DATASPACE_CLS[1] = {{
(H5I_free_t)H5S_close /* Callback routine for closing objects of this class */
}};
-/* Format version bounds for dataspace */
-static const unsigned H5O_sdspace_ver_bounds[] = {
- H5O_SDSPACE_VERSION_1, /* H5F_LIBVER_EARLIEST */
- H5O_SDSPACE_VERSION_2, /* H5F_LIBVER_V18 */
- H5O_SDSPACE_VERSION_LATEST /* H5F_LIBVER_LATEST */
-};
/* Flag indicating "top" of interface has been initialized */
static hbool_t H5S_top_package_initialize_s = FALSE;
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index 7483690..bb84ebd 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -17,6 +17,9 @@
#ifndef _H5Sprivate_H
#define _H5Sprivate_H
+/* Early typedefs to avoid circular dependencies */
+typedef struct H5S_t H5S_t;
+
/* Include package's public header */
#include "H5Spublic.h"
@@ -44,7 +47,6 @@
#define H5S_GET_SEQ_LIST_SORTED 0x0001
/* Forward references of package typedefs */
-typedef struct H5S_t H5S_t;
typedef struct H5S_extent_t H5S_extent_t;
typedef struct H5S_pnt_node_t H5S_pnt_node_t;
typedef struct H5S_hyper_span_t H5S_hyper_span_t;
@@ -311,6 +313,7 @@ H5_DLL herr_t H5S_select_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
H5_DLL herr_t H5S_select_iter_release(H5S_sel_iter_t *sel_iter);
#ifdef H5_HAVE_PARALLEL
+H5_DLL hsize_t H5S_mpio_set_bigio_count(hsize_t new_count);
H5_DLL herr_t H5S_mpio_space_type(const H5S_t *space, size_t elmt_size,
/* out: */ MPI_Datatype *new_type,
int *count,
diff --git a/src/H5T.c b/src/H5T.c
index 23685b7..aa61358 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -510,6 +510,12 @@ double H5T_NATIVE_DOUBLE_NEG_INF_g = (double)0.0f;
H5FL_DEFINE(H5T_t);
H5FL_DEFINE(H5T_shared_t);
+/* Format version bounds for datatype */
+const unsigned H5O_dtype_ver_bounds[] = {
+ H5O_DTYPE_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V18 */
+ H5O_DTYPE_VERSION_LATEST /* H5F_LIBVER_LATEST */
+};
/*******************/
/* Local Variables */
@@ -539,12 +545,6 @@ static const H5I_class_t H5I_DATATYPE_CLS[1] = {{
(H5I_free_t)H5T_close /* Callback routine for closing objects of this class */
}};
-/* Format version bounds for datatype */
-static const unsigned H5O_dtype_ver_bounds[] = {
- H5O_DTYPE_VERSION_1, /* H5F_LIBVER_EARLIEST */
- H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V18 */
- H5O_DTYPE_VERSION_LATEST /* H5F_LIBVER_LATEST */
-};
/* Flag indicating "top" of interface has been initialized */
static hbool_t H5T_top_package_initialize_s = FALSE;
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 2a47df3..42acd8d 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -17,6 +17,9 @@
#ifndef _H5Tprivate_H
#define _H5Tprivate_H
+/* Early typedefs to avoid circular dependencies */
+typedef struct H5T_t H5T_t;
+
/* Get package's public header */
#include "H5Tpublic.h"
@@ -45,7 +48,6 @@
#endif /* H5T_MODULE */
/* Forward references of package typedefs (declared in H5Tpkg.h) */
-typedef struct H5T_t H5T_t;
typedef struct H5T_stats_t H5T_stats_t;
typedef struct H5T_path_t H5T_path_t;
diff --git a/src/H5Z.c b/src/H5Z.c
index 1d023b5..a9f7336 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -34,15 +34,15 @@
#ifdef H5Z_DEBUG
typedef struct H5Z_stats_t {
struct {
- hsize_t total; /*total number of bytes processed */
- hsize_t errors; /*bytes of total attributable to errors */
- H5_timer_t timer; /*execution time including errors */
- } stats[2]; /*0=output, 1=input */
+ hsize_t total; /* total number of bytes processed */
+ hsize_t errors; /* bytes of total attributable to errors */
+ H5_timer_t timer; /* execution time including errors */
+ } stats[2]; /* 0=output, 1=input */
} H5Z_stats_t;
#endif /* H5Z_DEBUG */
typedef struct H5Z_object_t {
- H5Z_filter_t filter_id; /* ID of the filter we're looking for */
+ H5Z_filter_t filter_id; /* ID of the filter we're looking for */
htri_t found; /* Whether we find an object using the filter */
} H5Z_object_t;
@@ -86,23 +86,23 @@ H5Z__init_package(void)
FUNC_ENTER_PACKAGE
/* Internal filters */
- if(H5Z_register(H5Z_SHUFFLE) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register shuffle filter")
- if(H5Z_register(H5Z_FLETCHER32) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register fletcher32 filter")
- if(H5Z_register(H5Z_NBIT) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register nbit filter")
- if(H5Z_register(H5Z_SCALEOFFSET) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register scaleoffset filter")
+ if (H5Z_register (H5Z_SHUFFLE) < 0)
+ HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register shuffle filter")
+ if (H5Z_register (H5Z_FLETCHER32) < 0)
+ HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register fletcher32 filter")
+ if (H5Z_register (H5Z_NBIT) < 0)
+ HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register nbit filter")
+ if (H5Z_register (H5Z_SCALEOFFSET) < 0)
+ HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register scaleoffset filter")
/* External filters */
#ifdef H5_HAVE_FILTER_DEFLATE
- if(H5Z_register(H5Z_DEFLATE) < 0)
+ if (H5Z_register (H5Z_DEFLATE) < 0)
HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register deflate filter")
#endif /* H5_HAVE_FILTER_DEFLATE */
#ifdef H5_HAVE_FILTER_SZIP
H5Z_SZIP->encoder_present = SZ_encoder_enabled();
- if(H5Z_register(H5Z_SZIP) < 0)
+ if (H5Z_register (H5Z_SZIP) < 0)
HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register szip filter")
#endif /* H5_HAVE_FILTER_SZIP */
@@ -211,8 +211,8 @@ herr_t
H5Zregister(const void *cls)
{
const H5Z_class2_t *cls_real = (const H5Z_class2_t *) cls; /* "Real" class pointer */
- H5Z_class2_t cls_new; /* Translated class struct */
- herr_t ret_value=SUCCEED; /* Return value */
+ H5Z_class2_t cls_new; /* Translated class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "*x", cls);
@@ -231,7 +231,7 @@ H5Zregister(const void *cls)
* at least 256, there should be no overlap and the version of the struct
* can be determined by the value of the first field.
*/
- if(cls_real->version != H5Z_CLASS_T_VERS) {
+ if (cls_real->version != H5Z_CLASS_T_VERS) {
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Assume it is an old "H5Z_class1_t" instead */
const H5Z_class1_t *cls_old = (const H5Z_class1_t *) cls;
@@ -251,19 +251,19 @@ H5Zregister(const void *cls)
#else /* H5_NO_DEPRECATED_SYMBOLS */
/* Deprecated symbols not allowed, throw an error */
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5Z_class_t version number");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5Z_class_t version number");
#endif /* H5_NO_DEPRECATED_SYMBOLS */
} /* end if */
- if (cls_real->id<0 || cls_real->id>H5Z_FILTER_MAX)
+ if (cls_real->id < 0 || cls_real->id > H5Z_FILTER_MAX)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number")
- if (cls_real->id<H5Z_FILTER_RESERVED)
+ if (cls_real->id < H5Z_FILTER_RESERVED)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "unable to modify predefined filters")
- if (cls_real->filter==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no filter function specified")
+ if (cls_real->filter == NULL)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no filter function specified")
/* Do it */
- if (H5Z_register (cls_real)<0)
+ if (H5Z_register (cls_real) < 0)
HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter")
done:
@@ -277,39 +277,40 @@ done:
* Purpose: Same as the public version except this one allows filters
* to be set for predefined method numbers <H5Z_FILTER_RESERVED
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success
+ * Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
H5Z_register (const H5Z_class2_t *cls)
{
- size_t i;
- herr_t ret_value = SUCCEED; /* Return value */
+ size_t i;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- HDassert(cls);
- HDassert(cls->id >= 0 && cls->id <= H5Z_FILTER_MAX);
+ HDassert (cls);
+ HDassert (cls->id >= 0 && cls->id <= H5Z_FILTER_MAX);
/* Is the filter already registered? */
- for(i = 0; i < H5Z_table_used_g; i++)
- if(H5Z_table_g[i].id == cls->id)
+ for (i = 0; i < H5Z_table_used_g; i++)
+ if (H5Z_table_g[i].id == cls->id)
break;
/* Filter not already registered */
- if(i >= H5Z_table_used_g) {
- if(H5Z_table_used_g >= H5Z_table_alloc_g) {
- size_t n = MAX(H5Z_MAX_NFILTERS, 2*H5Z_table_alloc_g);
+ if (i >= H5Z_table_used_g) {
+ if (H5Z_table_used_g >= H5Z_table_alloc_g) {
+ size_t n = MAX(H5Z_MAX_NFILTERS, 2 * H5Z_table_alloc_g);
H5Z_class2_t *table = (H5Z_class2_t *)H5MM_realloc(H5Z_table_g, n * sizeof(H5Z_class2_t));
#ifdef H5Z_DEBUG
H5Z_stats_t *stat_table = (H5Z_stats_t *)H5MM_realloc(H5Z_stat_table_g, n * sizeof(H5Z_stats_t));
#endif /* H5Z_DEBUG */
- if(!table)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend filter table")
+ if (!table)
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend filter table")
H5Z_table_g = table;
#ifdef H5Z_DEBUG
- if(!stat_table)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend filter statistics table")
+ if (!stat_table)
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend filter statistics table")
H5Z_stat_table_g = stat_table;
#endif /* H5Z_DEBUG */
H5Z_table_alloc_g = n;
@@ -317,15 +318,15 @@ H5Z_register (const H5Z_class2_t *cls)
/* Initialize */
i = H5Z_table_used_g++;
- HDmemcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t));
+ HDmemcpy (H5Z_table_g+i, cls, sizeof(H5Z_class2_t));
#ifdef H5Z_DEBUG
- HDmemset(H5Z_stat_table_g+i, 0, sizeof(H5Z_stats_t));
+ HDmemset (H5Z_stat_table_g+i, 0, sizeof(H5Z_stats_t));
#endif /* H5Z_DEBUG */
} /* end if */
/* Filter already registered */
else {
/* Replace old contents */
- HDmemcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t));
+ HDmemcpy (H5Z_table_g+i, cls, sizeof(H5Z_class2_t));
} /* end else */
done:
@@ -338,25 +339,26 @@ done:
*
* Purpose: This function unregisters a filter.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success
+ * Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
H5Zunregister(H5Z_filter_t id)
{
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "Zf", id);
/* Check args */
- if(id < 0 || id > H5Z_FILTER_MAX)
+ if (id < 0 || id > H5Z_FILTER_MAX)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number")
- if(id < H5Z_FILTER_RESERVED)
+ if (id < H5Z_FILTER_RESERVED)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to modify predefined filters")
/* Do it */
- if(H5Z_unregister(id) < 0)
+ if (H5Z_unregister(id) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to unregister filter")
done:
@@ -370,27 +372,28 @@ done:
* Purpose: Same as the public version except this one allows filters
* to be unset for predefined method numbers <H5Z_FILTER_RESERVED
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success
+ * Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
H5Z_unregister(H5Z_filter_t filter_id)
{
- size_t filter_index; /* Local index variable for filter */
+ size_t filter_index; /* Local index variable for filter */
H5Z_object_t object;
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
HDassert(filter_id>=0 && filter_id<=H5Z_FILTER_MAX);
/* Is the filter already registered? */
- for (filter_index=0; filter_index<H5Z_table_used_g; filter_index++)
- if (H5Z_table_g[filter_index].id==filter_id)
+ for (filter_index = 0; filter_index < H5Z_table_used_g; filter_index++)
+ if (H5Z_table_g[filter_index].id == filter_id)
break;
/* Fail if filter not found */
- if (filter_index>=H5Z_table_used_g)
+ if (filter_index >= H5Z_table_used_g)
HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter is not registered")
/* Initialize the structure object for iteration */
@@ -398,28 +401,28 @@ H5Z_unregister(H5Z_filter_t filter_id)
object.found = FALSE;
/* Iterate through all opened datasets, returns a failure if any of them uses the filter */
- if(H5I_iterate(H5I_DATASET, H5Z__check_unregister_dset_cb, &object, FALSE) < 0)
+ if (H5I_iterate(H5I_DATASET, H5Z__check_unregister_dset_cb, &object, FALSE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed")
- if(object.found)
+ if (object.found)
HGOTO_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "can't unregister filter because a dataset is still using it")
/* Iterate through all opened groups, returns a failure if any of them uses the filter */
- if(H5I_iterate(H5I_GROUP, H5Z__check_unregister_group_cb, &object, FALSE) < 0)
+ if (H5I_iterate(H5I_GROUP, H5Z__check_unregister_group_cb, &object, FALSE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed")
- if(object.found)
+ if (object.found)
HGOTO_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "can't unregister filter because a group is still using it")
/* Iterate through all opened files and flush them */
- if(H5I_iterate(H5I_FILE, H5Z__flush_file_cb, NULL, FALSE) < 0)
+ if (H5I_iterate(H5I_FILE, H5Z__flush_file_cb, NULL, FALSE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed")
/* Remove filter from table */
/* Don't worry about shrinking table size (for now) */
- HDmemmove(&H5Z_table_g[filter_index],&H5Z_table_g[filter_index+1],sizeof(H5Z_class2_t)*((H5Z_table_used_g-1)-filter_index));
+ HDmemmove (&H5Z_table_g[filter_index], &H5Z_table_g[filter_index+1], sizeof(H5Z_class2_t)*((H5Z_table_used_g-1)-filter_index));
#ifdef H5Z_DEBUG
- HDmemmove(&H5Z_stat_table_g[filter_index],&H5Z_stat_table_g[filter_index+1],sizeof(H5Z_stats_t)*((H5Z_table_used_g-1)-filter_index));
+ HDmemmove (&H5Z_stat_table_g[filter_index], &H5Z_stat_table_g[filter_index+1], sizeof(H5Z_stats_t)*((H5Z_table_used_g-1)-filter_index));
#endif /* H5Z_DEBUG */
H5Z_table_used_g--;
@@ -431,10 +434,10 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Z__check_unregister
*
- * Purpose: Check if an object uses the filter to be unregistered.
+ * Purpose: Check if an object uses the filter to be unregistered.
*
- * Return: TRUE if the object uses the filter.
- * FALSE if not, NEGATIVE on error.
+ * Return: TRUE if the object uses the filter.
+ * FALSE if not, NEGATIVE on error.
*-------------------------------------------------------------------------
*/
static htri_t
@@ -446,12 +449,12 @@ H5Z__check_unregister(hid_t ocpl_id, H5Z_filter_t filter_id)
FUNC_ENTER_STATIC
/* Get the plist structure of object creation */
- if(NULL == (plist = H5P_object_verify(ocpl_id, H5P_OBJECT_CREATE)))
- HGOTO_ERROR(H5E_PLINE, H5E_BADATOM, FAIL, "can't find object for ID")
+ if (NULL == (plist = H5P_object_verify(ocpl_id, H5P_OBJECT_CREATE)))
+ HGOTO_ERROR (H5E_PLINE, H5E_BADATOM, FAIL, "can't find object for ID")
/* Check if the object creation property list uses the filter */
- if((ret_value = H5P_filter_in_pline(plist, filter_id)) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline")
+ if ((ret_value = H5P_filter_in_pline(plist, filter_id)) < 0)
+ HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -483,25 +486,25 @@ H5Z__check_unregister_group_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void
HDassert(obj_ptr);
/* Get the group creation property */
- if((ocpl_id = H5G_get_create_plist((H5G_t *)obj_ptr)) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get group creation property list")
+ if ((ocpl_id = H5G_get_create_plist((H5G_t *)obj_ptr)) < 0)
+ HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "can't get group creation property list")
/* Check if the filter is in the group creation property list */
- if((filter_in_pline = H5Z__check_unregister(ocpl_id, object->filter_id)) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline")
+ if ((filter_in_pline = H5Z__check_unregister(ocpl_id, object->filter_id)) < 0)
+ HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline")
/* H5I_iterate expects TRUE to stop the loop over objects. Stop the loop and
* let H5Z_unregister return failure.
*/
- if(filter_in_pline) {
+ if (filter_in_pline) {
object->found = TRUE;
ret_value = TRUE;
} /* end if */
done:
- if(ocpl_id > 0)
- if(H5I_dec_app_ref(ocpl_id) < 0)
- HDONE_ERROR(H5E_PLINE, H5E_CANTDEC, FAIL, "can't release plist")
+ if (ocpl_id > 0)
+ if (H5I_dec_app_ref(ocpl_id) < 0)
+ HDONE_ERROR (H5E_PLINE, H5E_CANTDEC, FAIL, "can't release plist")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z__check_unregister_group_cb() */
@@ -510,13 +513,13 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Z__check_unregister_dset_cb
*
- * Purpose: The callback function for H5Z_unregister. It iterates
- * through all opened objects. If the object is a dataset
- * or a group and it uses the filter to be unregistered, the
- * function returns TRUE.
+ * Purpose: The callback function for H5Z_unregister. It iterates
+ * through all opened objects. If the object is a dataset
+ * or a group and it uses the filter to be unregistered, the
+ * function returns TRUE.
*
- * Return: TRUE if the object uses the filter.
- * FALSE otherwise.
+ * Return: TRUE if the object uses the filter.
+ * FALSE otherwise.
*-------------------------------------------------------------------------
*/
static int
@@ -529,28 +532,28 @@ H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *
FUNC_ENTER_STATIC
- HDassert(obj_ptr);
+ HDassert (obj_ptr);
/* Get the dataset creation property */
- if((ocpl_id = H5D_get_create_plist((H5D_t *)obj_ptr)) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get dataset creation property list")
+ if ((ocpl_id = H5D_get_create_plist((H5D_t *)obj_ptr)) < 0)
+ HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "can't get dataset creation property list")
/* Check if the filter is in the dataset creation property list */
- if((filter_in_pline = H5Z__check_unregister(ocpl_id, object->filter_id)) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline")
+ if ((filter_in_pline = H5Z__check_unregister(ocpl_id, object->filter_id)) < 0)
+ HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline")
/* H5I_iterate expects TRUE to stop the loop over objects. Stop the loop and
* let H5Z_unregister return failure.
*/
- if(filter_in_pline) {
+ if (filter_in_pline) {
object->found = TRUE;
ret_value = TRUE;
} /* end if */
done:
- if(ocpl_id > 0)
- if(H5I_dec_app_ref(ocpl_id) < 0)
- HDONE_ERROR(H5E_PLINE, H5E_CANTDEC, FAIL, "can't release plist")
+ if (ocpl_id > 0)
+ if (H5I_dec_app_ref(ocpl_id) < 0)
+ HDONE_ERROR (H5E_PLINE, H5E_CANTDEC, FAIL, "can't release plist")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z__check_unregister_dset_cb() */
@@ -569,17 +572,17 @@ done:
static int
H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void H5_ATTR_UNUSED *key)
{
- int ret_value = FALSE; /* Return value */
+ int ret_value = FALSE; /* Return value */
FUNC_ENTER_STATIC
- HDassert(obj_ptr);
+ HDassert (obj_ptr);
/* Call the flush routine for mounted file hierarchies. Do a global flush
* if the file is opened for write */
- if(H5F_ACC_RDWR & H5F_INTENT((H5F_t *)obj_ptr)) {
- if(H5F_flush_mounts((H5F_t *)obj_ptr, H5AC_ind_read_dxpl_id, H5AC_rawdata_dxpl_id) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTFLUSH, FAIL, "unable to flush file hierarchy")
+ if (H5F_ACC_RDWR & H5F_INTENT((H5F_t *)obj_ptr)) {
+ if (H5F_flush_mounts((H5F_t *)obj_ptr, H5AC_ind_read_dxpl_id, H5AC_rawdata_dxpl_id) < 0)
+ HGOTO_ERROR (H5E_PLINE, H5E_CANTFLUSH, FAIL, "unable to flush file hierarchy")
} /* end if */
done:
@@ -598,17 +601,17 @@ done:
htri_t
H5Zfilter_avail(H5Z_filter_t id)
{
- htri_t ret_value=FALSE; /* Return value */
+ htri_t ret_value = FALSE; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("t", "Zf", id);
/* Check args */
- if(id<0 || id>H5Z_FILTER_MAX)
+ if (id < 0 || id > H5Z_FILTER_MAX)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number")
- if((ret_value = H5Z_filter_avail(id)) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "unable to check the availability of the filter")
+ if ((ret_value = H5Z_filter_avail(id)) < 0)
+ HGOTO_ERROR (H5E_PLINE, H5E_NOTFOUND, FAIL, "unable to check the availability of the filter")
done:
FUNC_LEAVE_API(ret_value)
@@ -626,21 +629,21 @@ done:
htri_t
H5Z_filter_avail(H5Z_filter_t id)
{
- size_t i; /* Local index variable */
- const H5Z_class2_t *filter_info;
- htri_t ret_value = FALSE; /* Return value */
+ size_t i; /* Local index variable */
+ H5Z_class2_t *filter_info;
+ htri_t ret_value = FALSE; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Is the filter already registered? */
- for(i = 0; i < H5Z_table_used_g; i++)
- if(H5Z_table_g[i].id == id)
- HGOTO_DONE(TRUE)
-
- if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)id))) {
- if(H5Z_register(filter_info) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register loaded filter")
- HGOTO_DONE(TRUE)
+ for (i = 0; i < H5Z_table_used_g; i++)
+ if (H5Z_table_g[i].id == id)
+ HGOTO_DONE (TRUE)
+
+ if (NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)id))) {
+ if (H5Z_register (filter_info) < 0)
+ HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register loaded filter")
+ HGOTO_DONE (TRUE)
}
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -666,59 +669,59 @@ H5Z_prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id,
{
H5Z_class2_t *fclass; /* Individual filter information */
size_t u; /* Local index variable */
- htri_t ret_value = TRUE; /* Return value */
+ htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
HDassert(pline->nused > 0);
/* Iterate over filters */
- for(u = 0; u < pline->nused; u++) {
+ for (u = 0; u < pline->nused; u++) {
/* Get filter information */
- if(NULL == (fclass = H5Z_find(pline->filter[u].id))) {
+ 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);
+ if (pline->filter[u].flags & H5Z_FLAG_OPTIONAL)
+ H5E_clear_stack (NULL);
else
- HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "required filter was not located")
+ HGOTO_ERROR (H5E_PLINE, H5E_NOTFOUND, FAIL, "required filter was not located")
} /* end if */
else {
/* Make correct callback */
- switch(prelude_type) {
+ switch (prelude_type) {
case H5Z_PRELUDE_CAN_APPLY:
/* Check if filter is configured to be able to encode */
- if(!fclass->encoder_present)
- HGOTO_ERROR(H5E_PLINE, H5E_NOENCODER, FAIL, "Filter present but encoding is disabled.");
+ if (!fclass->encoder_present)
+ HGOTO_ERROR (H5E_PLINE, H5E_NOENCODER, FAIL, "Filter present but encoding is disabled.");
/* Check if there is a "can apply" callback */
- if(fclass->can_apply) {
+ if (fclass->can_apply) {
/* Make callback to filter's "can apply" function */
htri_t status = (fclass->can_apply)(dcpl_id, type_id, space_id);
/* Indicate error during filter callback */
- if(status < 0)
+ if (status < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "error during user callback")
/* Indicate filter can't apply to this combination of parameters.
* If the filter is NOT optional, returns failure. */
- if(status == FALSE && !(pline->filter[u].flags & H5Z_FLAG_OPTIONAL))
+ if (status == FALSE && !(pline->filter[u].flags & H5Z_FLAG_OPTIONAL))
HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "filter parameters not appropriate")
} /* end if */
break;
case H5Z_PRELUDE_SET_LOCAL:
/* Check if there is a "set local" callback */
- if(fclass->set_local) {
+ if (fclass->set_local) {
/* Make callback to filter's "set local" function */
- if((fclass->set_local)(dcpl_id, type_id, space_id) < 0)
+ if ((fclass->set_local)(dcpl_id, type_id, space_id) < 0)
/* Indicate error during filter callback */
- HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "error during user callback")
+ HGOTO_ERROR (H5E_PLINE, H5E_SETLOCAL, FAIL, "error during user callback")
} /* end if */
break;
default:
- HDassert("invalid prelude type" && 0);
+ HDassert ("invalid prelude type" && 0);
} /* end switch */
} /* end else */
} /* end for */
@@ -745,62 +748,62 @@ done:
static herr_t
H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_type)
{
- hid_t space_id = -1; /* ID for dataspace describing chunk */
- herr_t ret_value = SUCCEED; /* Return value */
+ hid_t space_id = -1; /* ID for dataspace describing chunk */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
- HDassert(H5I_GENPROP_LST == H5I_get_type(dcpl_id));
- HDassert(H5I_DATATYPE == H5I_get_type(type_id));
+ HDassert (H5I_GENPROP_LST == H5I_get_type(dcpl_id));
+ HDassert (H5I_DATATYPE == H5I_get_type(type_id));
/* Check if the property list is non-default */
- if(dcpl_id != H5P_DATASET_CREATE_DEFAULT) {
- H5P_genplist_t *dc_plist; /* Dataset creation property list object */
- H5O_layout_t dcpl_layout; /* Dataset's layout information */
+ if (dcpl_id != H5P_DATASET_CREATE_DEFAULT) {
+ H5P_genplist_t *dc_plist; /* Dataset creation property list object */
+ H5O_layout_t dcpl_layout; /* Dataset's layout information */
/* Get dataset creation property list object */
- if(NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list")
+ if (NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list")
/* Peek at the layout information */
- if(H5P_peek(dc_plist, H5D_CRT_LAYOUT_NAME, &dcpl_layout) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout")
+ if (H5P_peek(dc_plist, H5D_CRT_LAYOUT_NAME, &dcpl_layout) < 0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout")
/* Check if the dataset is chunked */
- if(H5D_CHUNKED == dcpl_layout.type) {
+ if (H5D_CHUNKED == dcpl_layout.type) {
H5O_pline_t dcpl_pline; /* Object's I/O pipeline information */
/* Get I/O pipeline information */
- if(H5P_peek(dc_plist, H5O_CRT_PIPELINE_NAME, &dcpl_pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter")
+ if (H5P_peek(dc_plist, H5O_CRT_PIPELINE_NAME, &dcpl_pline) < 0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter")
/* Check if the chunks have filters */
- if(dcpl_pline.nused > 0) {
+ if (dcpl_pline.nused > 0) {
hsize_t chunk_dims[H5O_LAYOUT_NDIMS]; /* Size of chunk dimensions */
- H5S_t *space; /* Dataspace describing chunk */
- size_t u; /* Local index variable */
+ H5S_t *space; /* Dataspace describing chunk */
+ size_t u; /* Local index variable */
- /* Create a data space for a chunk & set the extent */
- for(u = 0; u < dcpl_layout.u.chunk.ndims; u++)
+ /* Create a dataspace for a chunk & set the extent */
+ for (u = 0; u < dcpl_layout.u.chunk.ndims; u++)
chunk_dims[u] = dcpl_layout.u.chunk.dim[u];
- if(NULL == (space = H5S_create_simple(dcpl_layout.u.chunk.ndims, chunk_dims, NULL)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
+ if (NULL == (space = H5S_create_simple(dcpl_layout.u.chunk.ndims, chunk_dims, NULL)))
+ HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
/* Get ID for dataspace to pass to filter routines */
- if((space_id = H5I_register(H5I_DATASPACE, space, FALSE)) < 0) {
- (void)H5S_close(space);
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
+ if ((space_id = H5I_register(H5I_DATASPACE, space, FALSE)) < 0) {
+ (void)H5S_close (space);
+ HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
} /* end if */
/* Make the callbacks */
- if(H5Z_prelude_callback(&dcpl_pline, dcpl_id, type_id, space_id, prelude_type) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter")
+ if (H5Z_prelude_callback(&dcpl_pline, dcpl_id, type_id, space_id, prelude_type) < 0)
+ HGOTO_ERROR (H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter")
} /* end if */
} /* end if */
} /* end if */
done:
- if(space_id > 0 && H5I_dec_ref(space_id) < 0)
+ if (space_id > 0 && H5I_dec_ref(space_id) < 0)
HDONE_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace")
FUNC_LEAVE_NOAPI(ret_value)
@@ -814,7 +817,8 @@ done:
* property list can be applied to a particular combination of
* datatype and dataspace for a dataset.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success
+ * Negative on failure
*
* Notes: The chunk dimensions are used to create a dataspace, instead
* of passing in the dataset's dataspace, since the chunk
@@ -829,8 +833,8 @@ H5Z_can_apply(hid_t dcpl_id, hid_t type_id)
FUNC_ENTER_NOAPI(FAIL)
/* Make "can apply" callbacks for filters in pipeline */
- if(H5Z_prepare_prelude_callback_dcpl(dcpl_id, type_id, H5Z_PRELUDE_CAN_APPLY) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter")
+ if (H5Z_prepare_prelude_callback_dcpl(dcpl_id, type_id, H5Z_PRELUDE_CAN_APPLY) < 0)
+ HGOTO_ERROR (H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -844,7 +848,8 @@ done:
* settings for filters on a new dataset, based on the datatype
* and dataspace of that dataset (chunk).
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success
+ * Negative on failure
*
* Notes: The chunk dimensions are used to create a dataspace, instead
* of passing in the dataset's dataspace, since the chunk
@@ -859,8 +864,8 @@ H5Z_set_local(hid_t dcpl_id, hid_t type_id)
FUNC_ENTER_NOAPI(FAIL)
/* Make "set local" callbacks for filters in pipeline */
- if(H5Z_prepare_prelude_callback_dcpl(dcpl_id, type_id, H5Z_PRELUDE_SET_LOCAL) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set")
+ if (H5Z_prepare_prelude_callback_dcpl(dcpl_id, type_id, H5Z_PRELUDE_SET_LOCAL) < 0)
+ HGOTO_ERROR (H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -874,7 +879,8 @@ done:
* applied to an opaque byte stream (currently only a group).
* The pipeline is assumed to have at least one filter.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success
+ * Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -884,11 +890,11 @@ H5Z_can_apply_direct(const H5O_pline_t *pline)
FUNC_ENTER_NOAPI(FAIL)
- HDassert(pline->nused > 0);
+ HDassert (pline->nused > 0);
/* Make "can apply" callbacks for filters in pipeline */
- if(H5Z_prelude_callback(pline, (hid_t)-1, (hid_t)-1, (hid_t)-1, H5Z_PRELUDE_CAN_APPLY) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter")
+ if (H5Z_prelude_callback(pline, (hid_t)-1, (hid_t)-1, (hid_t)-1, H5Z_PRELUDE_CAN_APPLY) < 0)
+ HGOTO_ERROR (H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -902,7 +908,8 @@ done:
* new opaque object. The pipeline is assumed to have at
* least one filter.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success
+ * Negative on failure
*
* Notes: This callback will almost certainly not do anything
* useful, other than to make certain that the filter will
@@ -916,11 +923,11 @@ H5Z_set_local_direct(const H5O_pline_t *pline)
FUNC_ENTER_NOAPI(FAIL)
- HDassert(pline->nused > 0);
+ HDassert (pline->nused > 0);
/* Make "set local" callbacks for filters in pipeline */
- if(H5Z_prelude_callback(pline, (hid_t)-1, (hid_t)-1, (hid_t)-1, H5Z_PRELUDE_SET_LOCAL) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set")
+ if (H5Z_prelude_callback(pline, (hid_t)-1, (hid_t)-1, (hid_t)-1, H5Z_PRELUDE_SET_LOCAL) < 0)
+ HGOTO_ERROR (H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -930,58 +937,59 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Z_modify
*
- * Purpose: Modify filter parameters for specified pipeline.
+ * Purpose: Modify filter parameters for specified pipeline.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success
+ * Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
H5Z_modify(const H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags,
size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/])
{
- size_t idx; /* Index of filter in pipeline */
- herr_t ret_value = SUCCEED; /* Return value */
+ size_t idx; /* Index of filter in pipeline */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- HDassert(pline);
- HDassert(filter >= 0 && filter <= H5Z_FILTER_MAX);
- HDassert(0 == (flags & ~((unsigned)H5Z_FLAG_DEFMASK)));
- HDassert(0 == cd_nelmts || cd_values);
+ HDassert (pline);
+ HDassert (filter >= 0 && filter <= H5Z_FILTER_MAX);
+ HDassert (0 == (flags & ~((unsigned)H5Z_FLAG_DEFMASK)));
+ HDassert (0 == cd_nelmts || cd_values);
/* Locate the filter in the pipeline */
- for(idx = 0; idx < pline->nused; idx++)
- if(pline->filter[idx].id == filter)
+ for (idx = 0; idx < pline->nused; idx++)
+ if (pline->filter[idx].id == filter)
break;
/* Check if the filter was not already in the pipeline */
- if(idx > pline->nused)
- HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline")
+ if (idx > pline->nused)
+ HGOTO_ERROR (H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline")
/* Change parameters for filter */
pline->filter[idx].flags = flags;
pline->filter[idx].cd_nelmts = cd_nelmts;
/* Free any existing parameters */
- if(pline->filter[idx].cd_values != NULL && pline->filter[idx].cd_values != pline->filter[idx]._cd_values)
+ if (pline->filter[idx].cd_values != NULL && pline->filter[idx].cd_values != pline->filter[idx]._cd_values)
H5MM_xfree(pline->filter[idx].cd_values);
/* Set parameters */
- if(cd_nelmts > 0) {
- size_t i; /* Local index variable */
+ if (cd_nelmts > 0) {
+ size_t i; /* Local index variable */
/* Allocate memory or point at internal buffer */
- if(cd_nelmts > H5Z_COMMON_CD_VALUES) {
+ if (cd_nelmts > H5Z_COMMON_CD_VALUES) {
pline->filter[idx].cd_values = (unsigned *)H5MM_malloc(cd_nelmts * sizeof(unsigned));
- if(NULL == pline->filter[idx].cd_values)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter parameters")
+ if (NULL == pline->filter[idx].cd_values)
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter parameters")
} /* end if */
else
pline->filter[idx].cd_values = pline->filter[idx]._cd_values;
/* Copy client data values */
- for(i = 0; i < cd_nelmts; i++)
- pline->filter[idx].cd_values[i] = cd_values[i];
+ for (i = 0; i < cd_nelmts; i++)
+ pline->filter[idx].cd_values[i] = cd_values[i];
} /* end if */
else
pline->filter[idx].cd_values = NULL;
@@ -996,36 +1004,37 @@ done:
*
* Purpose: Append another filter to the specified pipeline.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success
+ * Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags,
size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/])
{
- size_t idx;
- herr_t ret_value = SUCCEED; /* Return value */
+ size_t idx;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- HDassert(pline);
- HDassert(filter >= 0 && filter <= H5Z_FILTER_MAX);
- HDassert(0 == (flags & ~((unsigned)H5Z_FLAG_DEFMASK)));
- HDassert(0 == cd_nelmts || cd_values);
+ HDassert (pline);
+ HDassert (filter >= 0 && filter <= H5Z_FILTER_MAX);
+ HDassert (0 == (flags & ~((unsigned)H5Z_FLAG_DEFMASK)));
+ HDassert (0 == cd_nelmts || cd_values);
/*
* Check filter limit. We do it here for early warnings although we may
* decide to relax this restriction in the future.
*/
- if(pline->nused >= H5Z_MAX_NFILTERS)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "too many filters in pipeline")
+ if (pline->nused >= H5Z_MAX_NFILTERS)
+ HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "too many filters in pipeline")
/* Check for freshly allocated filter pipeline */
- if(pline->version == 0)
+ if (pline->version == 0)
pline->version = H5O_PLINE_VERSION_1;
/* Allocate additional space in the pipeline if it's full */
- if(pline->nused >= pline->nalloc) {
+ if (pline->nused >= pline->nalloc) {
H5O_pline_t x;
size_t n;
@@ -1036,14 +1045,14 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags,
* filter struct is reallocated. Set these pointers to ~NULL
* so that we can reset them after reallocating the filters array.
*/
- for(n = 0; n < pline->nalloc; ++n)
- if(pline->filter[n].cd_values == pline->filter[n]._cd_values)
+ for (n = 0; n < pline->nalloc; ++n)
+ if (pline->filter[n].cd_values == pline->filter[n]._cd_values)
pline->filter[n].cd_values = (unsigned *)((void *) ~((size_t)NULL));
x.nalloc = MAX(H5Z_MAX_NFILTERS, 2 * pline->nalloc);
x.filter = (H5Z_filter_info_t *)H5MM_realloc(pline->filter, x.nalloc * sizeof(x.filter[0]));
- if(NULL == x.filter)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter pipeline")
+ if (NULL == x.filter)
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter pipeline")
/* Fix pointers in previous filters that need to point to their own
* internal data.
@@ -1061,22 +1070,22 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags,
idx = pline->nused;
pline->filter[idx].id = filter;
pline->filter[idx].flags = flags;
- pline->filter[idx].name = NULL; /* we'll pick it up later*/
+ pline->filter[idx].name = NULL; /*we'll pick it up later*/
pline->filter[idx].cd_nelmts = cd_nelmts;
- if(cd_nelmts > 0) {
- size_t i; /* Local index variable */
+ if (cd_nelmts > 0) {
+ size_t i; /* Local index variable */
/* Allocate memory or point at internal buffer */
- if(cd_nelmts > H5Z_COMMON_CD_VALUES) {
+ if (cd_nelmts > H5Z_COMMON_CD_VALUES) {
pline->filter[idx].cd_values = (unsigned *)H5MM_malloc(cd_nelmts * sizeof(unsigned));
- if(NULL == pline->filter[idx].cd_values)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter")
+ if (NULL == pline->filter[idx].cd_values)
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter")
} /* end if */
else
pline->filter[idx].cd_values = pline->filter[idx]._cd_values;
/* Copy client data values */
- for(i = 0; i < cd_nelmts; i++)
+ for (i = 0; i < cd_nelmts; i++)
pline->filter[idx].cd_values[i] = cd_values[i];
} /* end if */
else
@@ -1095,8 +1104,8 @@ done:
* Purpose: Given a filter ID return the offset in the global array
* that holds all the registered filters.
*
- * Return: Success: Non-negative index of entry in global filter table.
- * Failure: Negative
+ * Return: Success: Non-negative index of entry in global filter table.
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
static int
@@ -1107,9 +1116,9 @@ H5Z_find_idx(H5Z_filter_t id)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- for (i=0; i<H5Z_table_used_g; i++)
+ for (i = 0; i < H5Z_table_used_g; i++)
if (H5Z_table_g[i].id == id)
- HGOTO_DONE((int)i)
+ HGOTO_DONE ((int)i)
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1122,24 +1131,24 @@ done:
* Purpose: Given a filter ID return a pointer to a global struct that
* defines the filter.
*
- * Return: Success: Ptr to entry in global filter table.
- * Failure: NULL
+ * Return: Success: Ptr to entry in global filter table.
+ * Failure: NULL
*-------------------------------------------------------------------------
*/
H5Z_class2_t *
H5Z_find(H5Z_filter_t id)
{
- int idx; /* Filter index in global table */
- H5Z_class2_t *ret_value=NULL; /* Return value */
+ int idx; /* Filter index in global table */
+ H5Z_class2_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
/* Get the index in the global table */
- if((idx=H5Z_find_idx(id))<0)
- HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, NULL, "required filter %d is not registered", id)
+ if ((idx = H5Z_find_idx(id)) < 0)
+ HGOTO_ERROR (H5E_PLINE, H5E_NOTFOUND, NULL, "required filter %d is not registered", id)
/* Set return value */
- ret_value=H5Z_table_g+idx;
+ ret_value = H5Z_table_g+idx;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1149,23 +1158,24 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Z_pipeline
*
- * Purpose: Process data through the filter pipeline. The FLAGS argument
- * is the filter invocation flags (definition flags come from
- * the PLINE->filter[].flags). The filters are processed in
- * definition order unless the H5Z_FLAG_REVERSE is set. The
- * FILTER_MASK is a bit-mask to indicate which filters to skip
- * and on exit will indicate which filters failed. Each
- * filter has an index number in the pipeline and that index
- * number is the filter's bit in the FILTER_MASK. NBYTES is the
- * number of bytes of data to filter and on exit should be the
- * number of resulting bytes while BUF_SIZE holds the total
- * allocated size of the buffer, which is pointed to BUF.
- *
- * If the buffer must grow during processing of the pipeline
- * then the pipeline function should free the original buffer
- * and return a fresh buffer, adjusting BUF_SIZE accordingly.
- *
- * Return: Non-negative on success/Negative on failure
+ * Purpose: Process data through the filter pipeline. The FLAGS argument
+ * is the filter invocation flags (definition flags come from
+ * the PLINE->filter[].flags). The filters are processed in
+ * definition order unless the H5Z_FLAG_REVERSE is set. The
+ * FILTER_MASK is a bit-mask to indicate which filters to skip
+ * and on exit will indicate which filters failed. Each
+ * filter has an index number in the pipeline and that index
+ * number is the filter's bit in the FILTER_MASK. NBYTES is the
+ * number of bytes of data to filter and on exit should be the
+ * number of resulting bytes while BUF_SIZE holds the total
+ * allocated size of the buffer, which is pointed to BUF.
+ *
+ * If the buffer must grow during processing of the pipeline
+ * then the pipeline function should free the original buffer
+ * and return a fresh buffer, adjusting BUF_SIZE accordingly.
+ *
+ * Return: Non-negative on success
+ * Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -1174,61 +1184,61 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags,
H5Z_cb_t cb_struct, size_t *nbytes/*in,out*/,
size_t *buf_size/*in,out*/, void **buf/*in,out*/)
{
- size_t i, idx, new_nbytes;
- int fclass_idx; /* Index of filter class in global table */
- H5Z_class2_t *fclass = NULL; /* Filter class pointer */
+ size_t i, idx, new_nbytes;
+ int fclass_idx; /* Index of filter class in global table */
+ H5Z_class2_t *fclass=NULL; /* Filter class pointer */
#ifdef H5Z_DEBUG
- H5Z_stats_t *fstats = NULL; /* Filter stats pointer */
+ H5Z_stats_t *fstats=NULL; /* Filter stats pointer */
H5_timer_t timer;
#endif
- unsigned failed = 0;
- unsigned tmp_flags;
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned failed = 0;
+ unsigned tmp_flags;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- HDassert(0 == (flags & ~((unsigned)H5Z_FLAG_INVMASK)));
- HDassert(filter_mask);
- HDassert(nbytes && *nbytes > 0);
- HDassert(buf_size && *buf_size > 0);
- HDassert(buf && *buf);
- HDassert(!pline || pline->nused < H5Z_MAX_NFILTERS);
+ HDassert (0 == (flags & ~((unsigned)H5Z_FLAG_INVMASK)));
+ HDassert (filter_mask);
+ HDassert (nbytes && *nbytes>0);
+ HDassert (buf_size && *buf_size>0);
+ HDassert (buf && *buf);
+ HDassert (!pline || pline->nused<H5Z_MAX_NFILTERS);
if (pline && (flags & H5Z_FLAG_REVERSE)) { /* Read */
for (i = pline->nused; i > 0; --i) {
- idx = i - 1;
+ idx = i-1;
if (*filter_mask & ((unsigned)1 << idx)) {
failed |= (unsigned)1 << idx;
- continue;/*filter excluded*/
+ continue; /* filter excluded */
}
/* If the filter isn't registered and the application doesn't
- * indicate no plugin through HDF5_PRELOAD_PLUG (using the symbol "::"),
- * try to load it dynamically and register it. Otherwise, return failure
- */
- if((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) {
+ * indicate no plugin through HDF5_PRELOAD_PLUG (using the symbol "::"),
+ * try to load it dynamically and register it. Otherwise, return failure
+ */
+ if ((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) {
hbool_t issue_error = FALSE;
const H5Z_class2_t *filter_info;
/* Try loading the filter */
- if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)(pline->filter[idx].id)))) {
+ if (NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)(pline->filter[idx].id)))) {
/* Register the filter we loaded */
- if(H5Z_register(filter_info) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter")
+ if (H5Z_register(filter_info) < 0)
+ HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter")
/* Search in the table of registered filters again to find the dynamic filter just loaded and registered */
- if((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0)
+ if ((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0)
issue_error = TRUE;
} /* end if */
else
issue_error = TRUE;
/* Check for error */
- if(issue_error) {
+ if (issue_error) {
/* Print out the filter name to give more info. But the name is optional for
- * the filter */
- if(pline->filter[idx].name)
+ * the filter */
+ if (pline->filter[idx].name)
HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "required filter '%s' is not registered", pline->filter[idx].name)
else
HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "required filter (name unavailable) is not registered")
@@ -1238,30 +1248,29 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags,
fclass = &H5Z_table_g[fclass_idx];
#ifdef H5Z_DEBUG
fstats = &H5Z_stat_table_g[fclass_idx];
- H5_timer_begin(&timer);
+ H5_timer_begin (&timer);
#endif
- tmp_flags = flags|(pline->filter[idx].flags);
+ tmp_flags = flags | (pline->filter[idx].flags);
tmp_flags |= (edc_read== H5Z_DISABLE_EDC) ? H5Z_FLAG_SKIP_EDC : 0;
new_nbytes = (fclass->filter)(tmp_flags, pline->filter[idx].cd_nelmts,
- pline->filter[idx].cd_values, *nbytes, buf_size, buf);
+ pline->filter[idx].cd_values, *nbytes, buf_size, buf);
#ifdef H5Z_DEBUG
- H5_timer_end(&(fstats->stats[1].timer), &timer);
+ H5_timer_end (&(fstats->stats[1].timer), &timer);
fstats->stats[1].total += MAX(*nbytes, new_nbytes);
if (0 == new_nbytes) fstats->stats[1].errors += *nbytes;
#endif
- if(0==new_nbytes) {
- if((cb_struct.func && (H5Z_CB_FAIL == cb_struct.func(pline->filter[idx].id, *buf, *buf_size, cb_struct.op_data))) || !cb_struct.func)
- HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "filter returned failure during read")
+ if (0 == new_nbytes) {
+ if ((cb_struct.func && (H5Z_CB_FAIL == cb_struct.func (pline->filter[idx].id, *buf, *buf_size, cb_struct.op_data))) || !cb_struct.func)
+ HGOTO_ERROR (H5E_PLINE, H5E_READERROR, FAIL, "filter returned failure during read")
*nbytes = *buf_size;
failed |= (unsigned)1 << idx;
- H5E_clear_stack(NULL);
+ H5E_clear_stack (NULL);
}
- else {
+ else
*nbytes = new_nbytes;
- }
}
}
else if (pline) { /* Write */
@@ -1276,35 +1285,34 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags,
HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "required filter is not registered")
failed |= (unsigned)1 << idx;
- H5E_clear_stack(NULL);
+ H5E_clear_stack (NULL);
continue; /*filter excluded*/
}
fclass = &H5Z_table_g[fclass_idx];
#ifdef H5Z_DEBUG
fstats = &H5Z_stat_table_g[fclass_idx];
- H5_timer_begin(&timer);
+ H5_timer_begin (&timer);
#endif
- new_nbytes = (fclass->filter)(flags|(pline->filter[idx].flags), pline->filter[idx].cd_nelmts,
- pline->filter[idx].cd_values, *nbytes, buf_size, buf);
+ new_nbytes = (fclass->filter)(flags | (pline->filter[idx].flags), pline->filter[idx].cd_nelmts,
+ pline->filter[idx].cd_values, *nbytes, buf_size, buf);
#ifdef H5Z_DEBUG
- H5_timer_end(&(fstats->stats[0].timer), &timer);
+ H5_timer_end (&(fstats->stats[0].timer), &timer);
fstats->stats[0].total += MAX(*nbytes, new_nbytes);
if (0 == new_nbytes) fstats->stats[0].errors += *nbytes;
#endif
- if(0 == new_nbytes) {
+ if (0 == new_nbytes) {
if (0 == (pline->filter[idx].flags & H5Z_FLAG_OPTIONAL)) {
- if((cb_struct.func && (H5Z_CB_FAIL == cb_struct.func(pline->filter[idx].id, *buf, *nbytes, cb_struct.op_data))) || !cb_struct.func)
- HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "filter returned failure")
+ if ((cb_struct.func && (H5Z_CB_FAIL == cb_struct.func (pline->filter[idx].id, *buf, *nbytes, cb_struct.op_data))) || !cb_struct.func)
+ HGOTO_ERROR (H5E_PLINE, H5E_WRITEERROR, FAIL, "filter returned failure")
*nbytes = *buf_size;
}
failed |= (unsigned)1 << idx;
- H5E_clear_stack(NULL);
+ H5E_clear_stack (NULL);
}
- else {
+ else
*nbytes = new_nbytes;
- }
}
}
@@ -1320,7 +1328,8 @@ done:
*
* Purpose: Get pointer to filter info for pipeline
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success
+ * Negative on failure
*-------------------------------------------------------------------------
*/
H5Z_filter_info_t *
@@ -1331,17 +1340,17 @@ H5Z_filter_info(const H5O_pline_t *pline, H5Z_filter_t filter)
FUNC_ENTER_NOAPI(NULL)
- HDassert(pline);
- HDassert(filter >= 0 && filter <= H5Z_FILTER_MAX);
+ HDassert (pline);
+ HDassert (filter >= 0 && filter <= H5Z_FILTER_MAX);
/* Locate the filter in the pipeline */
- for(idx = 0; idx < pline->nused; idx++)
- if(pline->filter[idx].id == filter)
+ for (idx = 0; idx < pline->nused; idx++)
+ if (pline->filter[idx].id == filter)
break;
/* Check if the filter was not already in the pipeline */
- if(idx >= pline->nused)
- HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, NULL, "filter not in pipeline")
+ if (idx >= pline->nused)
+ HGOTO_ERROR (H5E_PLINE, H5E_NOTFOUND, NULL, "filter not in pipeline")
/* Set return value */
ret_value = &pline->filter[idx];
@@ -1365,21 +1374,21 @@ done:
htri_t
H5Z_filter_in_pline(const H5O_pline_t *pline, H5Z_filter_t filter)
{
- size_t idx; /* Index of filter in pipeline */
- htri_t ret_value = TRUE; /* Return value */
+ size_t idx; /* Index of filter in pipeline */
+ htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- HDassert(pline);
- HDassert(filter >= 0 && filter <= H5Z_FILTER_MAX);
+ HDassert (pline);
+ HDassert (filter >= 0 && filter <= H5Z_FILTER_MAX);
/* Locate the filter in the pipeline */
- for(idx = 0; idx < pline->nused; idx++)
- if(pline->filter[idx].id == filter)
+ for (idx = 0; idx < pline->nused; idx++)
+ if (pline->filter[idx].id == filter)
break;
/* Check if the filter was not already in the pipeline */
- if(idx >= pline->nused)
+ if (idx >= pline->nused)
ret_value = FALSE;
done:
@@ -1394,30 +1403,31 @@ done:
* Purpose: Verify that all the filters in a pipeline are currently
* available (i.e. registered)
*
- * Return: Non-negative (TRUE/FALSE) on success/Negative on failure
+ * Return: Non-negative (TRUE/FALSE) on success
+ * Negative on failure
*-------------------------------------------------------------------------
*/
htri_t
H5Z_all_filters_avail(const H5O_pline_t *pline)
{
- size_t i,j; /* Local index variable */
- htri_t ret_value=TRUE; /* Return value */
+ size_t i, j; /* Local index variable */
+ htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
- HDassert(pline);
+ HDassert (pline);
/* Iterate through all the filters in pipeline */
- for(i = 0; i < pline->nused; i++) {
+ for (i = 0; i < pline->nused; i++) {
/* Look for each filter in the list of registered filters */
- for(j = 0; j < H5Z_table_used_g; j++)
- if(H5Z_table_g[j].id == pline->filter[i].id)
+ for (j = 0; j < H5Z_table_used_g; j++)
+ if (H5Z_table_g[j].id == pline->filter[i].id)
break;
/* Check if we didn't find the filter */
- if(j == H5Z_table_used_g)
- HGOTO_DONE(FALSE)
+ if (j == H5Z_table_used_g)
+ HGOTO_DONE (FALSE)
} /* end for */
done:
@@ -1432,7 +1442,8 @@ done:
* Purpose: Delete filter FILTER from pipeline PLINE;
* deletes all filters if FILTER is H5Z_FILTER_NONE
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success
+ * Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -1443,52 +1454,52 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter)
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
- HDassert(pline);
- HDassert(filter >= 0 && filter <= H5Z_FILTER_MAX);
+ HDassert (pline);
+ HDassert (filter >= 0 && filter <= H5Z_FILTER_MAX);
/* if the pipeline has no filters, just return */
- if(pline->nused == 0)
- HGOTO_DONE(SUCCEED)
+ if (pline->nused == 0)
+ HGOTO_DONE (SUCCEED)
/* Delete all filters */
- if(H5Z_FILTER_ALL == filter) {
- if(H5O_msg_reset(H5O_PLINE_ID, pline) < 0)
+ if (H5Z_FILTER_ALL == filter) {
+ if (H5O_msg_reset(H5O_PLINE_ID, pline) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTFREE, FAIL, "can't release pipeline info")
} /* end if */
/* Delete filter */
else {
- size_t idx; /* Index of filter in pipeline */
- hbool_t found = FALSE; /* Indicate filter was found in pipeline */
+ size_t idx; /* Index of filter in pipeline */
+ hbool_t found = FALSE; /* Indicate filter was found in pipeline */
/* Locate the filter in the pipeline */
- for(idx = 0; idx < pline->nused; idx++)
- if(pline->filter[idx].id == filter) {
+ for (idx = 0; idx < pline->nused; idx++)
+ if (pline->filter[idx].id == filter) {
found = TRUE;
break;
} /* end if */
/* filter was not found in the pipeline */
- if(!found)
- HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline")
+ if (!found)
+ HGOTO_ERROR (H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline")
/* Free information for deleted filter */
- if(pline->filter[idx].name && pline->filter[idx].name != pline->filter[idx]._name)
- HDassert((HDstrlen(pline->filter[idx].name) + 1) > H5Z_COMMON_NAME_LEN);
- if(pline->filter[idx].name != pline->filter[idx]._name)
+ if (pline->filter[idx].name && pline->filter[idx].name != pline->filter[idx]._name)
+ HDassert ((HDstrlen(pline->filter[idx].name) + 1) > H5Z_COMMON_NAME_LEN);
+ if (pline->filter[idx].name != pline->filter[idx]._name)
pline->filter[idx].name = (char *)H5MM_xfree(pline->filter[idx].name);
- if(pline->filter[idx].cd_values && pline->filter[idx].cd_values != pline->filter[idx]._cd_values)
- HDassert(pline->filter[idx].cd_nelmts > H5Z_COMMON_CD_VALUES);
- if(pline->filter[idx].cd_values != pline->filter[idx]._cd_values)
+ if (pline->filter[idx].cd_values && pline->filter[idx].cd_values != pline->filter[idx]._cd_values)
+ HDassert (pline->filter[idx].cd_nelmts > H5Z_COMMON_CD_VALUES);
+ if (pline->filter[idx].cd_values != pline->filter[idx]._cd_values)
pline->filter[idx].cd_values = (unsigned *)H5MM_xfree(pline->filter[idx].cd_values);
/* Remove filter from pipeline array */
- if((idx + 1) < pline->nused) {
+ if ((idx + 1) < pline->nused) {
/* Copy filters down & fix up any client data value arrays using internal storage */
- for(; (idx + 1) < pline->nused; idx++) {
+ for (; (idx + 1) < pline->nused; idx++) {
pline->filter[idx] = pline->filter[idx + 1];
- if(pline->filter[idx].name && (HDstrlen(pline->filter[idx].name) + 1) <= H5Z_COMMON_NAME_LEN)
+ if (pline->filter[idx].name && (HDstrlen(pline->filter[idx].name) + 1) <= H5Z_COMMON_NAME_LEN)
pline->filter[idx].name = pline->filter[idx]._name;
- if(pline->filter[idx].cd_nelmts <= H5Z_COMMON_CD_VALUES)
+ if (pline->filter[idx].cd_nelmts <= H5Z_COMMON_CD_VALUES)
pline->filter[idx].cd_values = pline->filter[idx]._cd_values;
} /* end for */
} /* end if */
@@ -1497,7 +1508,7 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter)
pline->nused--;
/* Reset information for previous last filter in pipeline */
- HDmemset(&pline->filter[pline->nused], 0, sizeof(H5Z_filter_info_t));
+ HDmemset (&pline->filter[pline->nused], 0, sizeof(H5Z_filter_info_t));
} /* end else */
done:
@@ -1510,6 +1521,9 @@ done:
*
* Purpose: Gets information about a pipeline data filter and stores it
* in filter_config_flags.
+ *
+ * Return: zero on success
+ * negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -1521,8 +1535,8 @@ H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags)
H5TRACE2("e", "Zf*Iu", filter, filter_config_flags);
/* Get the filter info */
- if(H5Z_get_filter_info(filter, filter_config_flags) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "Filter info not retrieved")
+ if (H5Z_get_filter_info(filter, filter_config_flags) < 0)
+ HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "Filter info not retrieved")
done:
FUNC_LEAVE_API(ret_value)
@@ -1534,6 +1548,9 @@ done:
*
* Purpose: Gets information about a pipeline data filter and stores it
* in filter_config_flags.
+ *
+ * Return: zero on success
+ * negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -1545,16 +1562,16 @@ H5Z_get_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags)
FUNC_ENTER_NOAPI(FAIL)
/* Look up the filter class info */
- if(NULL == (fclass = H5Z_find(filter)))
- HGOTO_ERROR(H5E_PLINE, H5E_BADVALUE, FAIL, "Filter not defined")
+ if (NULL == (fclass = H5Z_find(filter)))
+ HGOTO_ERROR (H5E_PLINE, H5E_BADVALUE, FAIL, "Filter not defined")
/* Set the filter config flags for the application */
- if(filter_config_flags != NULL) {
+ if (filter_config_flags != NULL) {
*filter_config_flags = 0;
- if(fclass->encoder_present)
+ if (fclass->encoder_present)
*filter_config_flags |= H5Z_FILTER_CONFIG_ENCODE_ENABLED;
- if(fclass->decoder_present)
+ if (fclass->decoder_present)
*filter_config_flags |= H5Z_FILTER_CONFIG_DECODE_ENABLED;
} /* end if */
diff --git a/src/H5Zprivate.h b/src/H5Zprivate.h
index fe182ad..26e35a7 100644
--- a/src/H5Zprivate.h
+++ b/src/H5Zprivate.h
@@ -18,6 +18,9 @@
#ifndef _H5Zprivate_H
#define _H5Zprivate_H
+/* Early typedefs to avoid circular dependencies */
+typedef struct H5Z_filter_info_t H5Z_filter_info_t;
+
/* Include package's public header */
#include "H5Zpublic.h"
@@ -49,7 +52,7 @@
/****************************/
/* Structure to store information about each filter's parameters */
-typedef struct H5Z_filter_info_t {
+struct H5Z_filter_info_t {
H5Z_filter_t id; /*filter identification number */
unsigned flags; /*defn and invocation flags */
char _name[H5Z_COMMON_NAME_LEN]; /*internal filter name */
@@ -57,7 +60,7 @@ typedef struct H5Z_filter_info_t {
size_t cd_nelmts; /*number of elements in cd_values[] */
unsigned _cd_values[H5Z_COMMON_CD_VALUES]; /*internal client data values */
unsigned *cd_values; /*client data values */
-} H5Z_filter_info_t;
+};
/*****************************/
/* Library-private Variables */
diff --git a/src/H5Zszip.c b/src/H5Zszip.c
index 769011c..0c60239 100644
--- a/src/H5Zszip.c
+++ b/src/H5Zszip.c
@@ -70,8 +70,6 @@ H5Z_class2_t H5Z_SZIP[1] = {{
* Programmer: Quincey Koziol
* Monday, April 7, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static htri_t
@@ -86,24 +84,24 @@ H5Z_can_apply_szip(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ATTR_UN
/* Get datatype */
if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
/* Get datatype's size, for checking the "bits-per-pixel" */
if((dtype_size = (8 * H5T_get_size(type))) == 0)
- HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size")
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size")
/* Range check datatype's size */
if(dtype_size > 32 && dtype_size != 64)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid datatype size")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid datatype size")
/* Get datatype's endianness order */
if((dtype_order = H5T_get_order(type)) == H5T_ORDER_ERROR)
- HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "can't retrieve datatype endianness order")
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "can't retrieve datatype endianness order")
/* Range check datatype's endianness order */
/* (Note: this may not handle non-atomic datatypes well) */
if(dtype_order != H5T_ORDER_LE && dtype_order != H5T_ORDER_BE)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid datatype endianness order")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid datatype endianness order")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -157,19 +155,19 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id)
/* Get datatype */
if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
/* Get the filter's current parameters */
if(H5P_get_filter_by_id(dcpl_plist, H5Z_FILTER_SZIP, &flags, &cd_nelmts, cd_values, 0, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get szip parameters")
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get szip parameters")
/* Get datatype's size, for checking the "bits-per-pixel" */
if((dtype_size = (8 * H5T_get_size(type))) == 0)
- HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size");
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size");
/* Get datatype's precision, in case is less than full bits */
if((dtype_precision = H5T_get_precision(type)) == 0)
- HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype precision");
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype precision");
if(dtype_precision < dtype_size) {
dtype_offset = H5T_get_offset(type);
@@ -177,9 +175,9 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id)
dtype_precision = dtype_size;
} /* end if */
if(dtype_precision > 24) {
- if(dtype_precision <= 32)
+ if(dtype_precision <= 32)
dtype_precision = 32;
- else if(dtype_precision <= 64)
+ else if(dtype_precision <= 64)
dtype_precision = 64;
} /* end if */
@@ -227,7 +225,7 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id)
/* Get datatype's endianness order */
if((dtype_order = H5T_get_order(type)) == H5T_ORDER_ERROR)
- HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order")
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order")
/* Set the correct endianness flag for szip */
/* (Note: this may not handle non-atomic datatypes well) */
@@ -241,13 +239,17 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id)
cd_values[H5Z_SZIP_PARM_MASK] |= SZ_MSB_OPTION_MASK;
break;
+ case H5T_ORDER_ERROR:
+ case H5T_ORDER_VAX:
+ case H5T_ORDER_MIXED:
+ case H5T_ORDER_NONE:
default:
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order")
} /* end switch */
/* Modify the filter's parameters for this dataset */
if(H5P_modify_filter(dcpl_plist, H5Z_FILTER_SZIP, flags, H5Z_SZIP_TOTAL_NPARMS, cd_values) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local szip parameters")
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local szip parameters")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -266,10 +268,6 @@ done:
* Programmer: Kent Yang
* Tuesday, April 1, 2003
*
- * Modifications:
- * Quincey Koziol, April 2, 2003
- * Cleaned up code.
- *
*-------------------------------------------------------------------------
*/
static size_t
@@ -296,7 +294,7 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
/* Check arguments */
if (cd_nelmts!=4)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid number of filter parameters")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid number of filter parameters")
/* Copy the filter parameters into the szip parameter block */
H5_CHECKED_ASSIGN(sz_param.options_mask, int, cd_values[H5Z_SZIP_PARM_MASK], unsigned);
@@ -310,12 +308,12 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
size_t nalloc; /* Number of bytes the compressed block will expand into */
/* Get the size of the uncompressed buffer */
- newbuf = *buf;
+ newbuf = (unsigned char *)(*buf);
UINT32DECODE(newbuf,stored_nalloc);
H5_CHECKED_ASSIGN(nalloc, size_t, stored_nalloc, uint32_t);
/* Allocate space for the uncompressed buffer */
- if(NULL==(outbuf = H5MM_malloc(nalloc)))
+ if(NULL == (outbuf = (unsigned char *)H5MM_malloc(nalloc)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for szip decompression")
/* Decompress the buffer */
@@ -338,7 +336,7 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
unsigned char *dst = NULL; /* Temporary pointer to new output buffer */
/* Allocate space for the compressed buffer & header (assume data won't get bigger) */
- if(NULL==(dst=outbuf = H5MM_malloc(nbytes+4)))
+ if(NULL == (dst=outbuf = (unsigned char *)H5MM_malloc(nbytes+4)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate szip destination buffer")
/* Encode the uncompressed length */
@@ -348,7 +346,7 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
/* Compress the buffer */
size_out = nbytes;
if(SZ_OK!= SZ_BufftoBuffCompress(dst, &size_out, *buf, nbytes, &sz_param))
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "overflow")
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "overflow")
HDassert(size_out<=nbytes);
/* Free the input buffer */
diff --git a/src/Makefile.am b/src/Makefile.am
index 9a64717..d8d2cc2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -84,7 +84,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5Ochunk.c \
H5Ocont.c H5Ocopy.c H5Odbg.c H5Odrvinfo.c H5Odtype.c H5Oefl.c \
H5Ofill.c H5Oflush.c H5Ofsinfo.c H5Oginfo.c \
- H5Olayout.c \
+ H5Oint.c H5Olayout.c \
H5Olinfo.c H5Olink.c H5Omessage.c H5Omtime.c \
H5Oname.c H5Onull.c H5Opline.c H5Orefcount.c \
H5Osdspace.c H5Oshared.c \
@@ -98,7 +98,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5Plapl.c H5Plcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c H5Ptest.c \
H5PB.c \
H5PL.c H5PLint.c H5PLpath.c H5PLplugin_cache.c \
- H5R.c H5Rdeprec.c \
+ H5R.c H5Rint.c H5Rdeprec.c \
H5UC.c \
H5RS.c \
H5S.c H5Sall.c H5Sdbg.c H5Shyper.c H5Snone.c H5Spoint.c \
diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in
index 8017594..51b24dc 100644
--- a/src/libhdf5.settings.in
+++ b/src/libhdf5.settings.in
@@ -28,6 +28,7 @@ Linking Options:
AM_LDFLAGS: @AM_LDFLAGS@
Extra libraries: @LIBS@
Archiver: @AR@
+ AR_FLAGS: @AR_FLAGS@
Ranlib: @RANLIB@
Languages:
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 8522c1d..fca864b 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -37,7 +37,7 @@ endif ()
if (MINGW)
target_link_libraries (${HDF5_TEST_LIB_TARGET} "wsock32.lib")
endif ()
-target_link_libraries (${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
+target_link_libraries (${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_LIBS})
H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} STATIC)
set_target_properties (${HDF5_TEST_LIB_TARGET} PROPERTIES
FOLDER libraries/test
@@ -53,7 +53,7 @@ if (BUILD_SHARED_LIBS)
if (MINGW)
target_link_libraries (${HDF5_TEST_LIBSH_TARGET} "wsock32.lib")
endif ()
- target_link_libraries (${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ target_link_libraries (${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${LINK_LIBS})
H5_SET_LIB_OPTIONS (${HDF5_TEST_LIBSH_TARGET} ${HDF5_TEST_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION})
set_target_properties (${HDF5_TEST_LIBSH_TARGET} PROPERTIES
FOLDER libraries/test
@@ -70,73 +70,73 @@ if (BUILD_SHARED_LIBS)
endif ()
#-----------------------------------------------------------------------------
-# If plugin library tests can be tested
+# If filter plugin tests can be tested
#-----------------------------------------------------------------------------
# make plugins dir
- file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/testdir1")
- file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/testdir2")
+ file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/filter_plugin_dir1")
+ file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/filter_plugin_dir2")
#-----------------------------------------------------------------------------
- # Define Plugin Test Sources
+ # Define Filter Plugin Test Sources
#-----------------------------------------------------------------------------
- set (TEST_PLUGIN_LIBS
- dynlib1
- dynlib3
+ set (FILTER_PLUGINS_FOR_DIR1
+ filter_plugin1_dsets
+ filter_plugin3_dsets
)
- set (TEST2_PLUGIN_LIBS
- dynlib2
- dynlib4
+ set (FILTER_PLUGINS_FOR_DIR2
+ filter_plugin2_dsets
+ filter_plugin4_groups
)
- foreach (test_lib ${TEST_PLUGIN_LIBS})
- set (HDF5_TEST_PLUGIN_LIB_CORENAME "${test_lib}")
- set (HDF5_TEST_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_LIB_CORENAME}")
- set (HDF5_TEST_PLUGIN_LIB_TARGET ${HDF5_TEST_PLUGIN_LIB_CORENAME})
+ foreach (plugin_name ${FILTER_PLUGINS_FOR_DIR1})
+ set (HDF5_TEST_PLUGIN_CORENAME "${plugin_name}")
+ set (HDF5_TEST_PLUGIN_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_CORENAME}")
+ set (HDF5_TEST_PLUGIN_TARGET ${HDF5_TEST_PLUGIN_CORENAME})
add_definitions (${HDF_EXTRA_C_FLAGS})
INCLUDE_DIRECTORIES (${HDF5_SRC_DIR})
- add_library (${HDF5_TEST_PLUGIN_LIB_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${test_lib}.c)
- TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_LIB_TARGET} SHARED " " " ")
- target_link_libraries (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
- H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_PLUGIN_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION})
- set_target_properties (${HDF5_TEST_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN)
+ add_library (${HDF5_TEST_PLUGIN_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${plugin_name}.c)
+ TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_TARGET} SHARED " " " ")
+ target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_LIB_TARGET})
+ H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_PLUGIN_NAME} SHARED ${HDF5_PACKAGE_SOVERSION})
+ set_target_properties (${HDF5_TEST_PLUGIN_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN)
#-----------------------------------------------------------------------------
- # Copy plugin library to a plugins folder
+ # Copy the filter plugin to a plugins folder
#-----------------------------------------------------------------------------
add_custom_command (
- TARGET ${HDF5_TEST_PLUGIN_LIB_TARGET}
+ TARGET ${HDF5_TEST_PLUGIN_TARGET}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different
- "$<TARGET_FILE:${HDF5_TEST_PLUGIN_LIB_TARGET}>"
- "${CMAKE_BINARY_DIR}/testdir1/$<TARGET_FILE_NAME:${HDF5_TEST_PLUGIN_LIB_TARGET}>"
+ "$<TARGET_FILE:${HDF5_TEST_PLUGIN_TARGET}>"
+ "${CMAKE_BINARY_DIR}/filter_plugin_dir1/$<TARGET_FILE_NAME:${HDF5_TEST_PLUGIN_TARGET}>"
)
endforeach ()
- foreach (test_lib ${TEST2_PLUGIN_LIBS})
- set (HDF5_TEST_PLUGIN_LIB_CORENAME "${test_lib}")
- set (HDF5_TEST_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_LIB_CORENAME}")
- set (HDF5_TEST_PLUGIN_LIB_TARGET ${HDF5_TEST_PLUGIN_LIB_CORENAME})
+ foreach ( plugin_name ${FILTER_PLUGINS_FOR_DIR2})
+ set (HDF5_TEST_PLUGIN_CORENAME "${plugin_name}")
+ set (HDF5_TEST_PLUGIN_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_CORENAME}")
+ set (HDF5_TEST_PLUGIN_TARGET ${HDF5_TEST_PLUGIN_CORENAME})
add_definitions (${HDF_EXTRA_C_FLAGS})
INCLUDE_DIRECTORIES (${HDF5_SRC_DIR})
- add_library (${HDF5_TEST_PLUGIN_LIB_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${test_lib}.c)
- TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_LIB_TARGET} SHARED " " " ")
- target_link_libraries (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
- H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_PLUGIN_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION})
- set_target_properties (${HDF5_TEST_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN)
+ add_library (${HDF5_TEST_PLUGIN_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${plugin_name}.c)
+ TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_TARGET} SHARED " " " ")
+ target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_LIB_TARGET})
+ H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_PLUGIN_NAME} SHARED ${HDF5_PACKAGE_SOVERSION})
+ set_target_properties (${HDF5_TEST_PLUGIN_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN)
#-----------------------------------------------------------------------------
- # Copy plugin library to a plugins folder
+ # Copy the filter plugin to a plugins folder
#-----------------------------------------------------------------------------
add_custom_command (
- TARGET ${HDF5_TEST_PLUGIN_LIB_TARGET}
+ TARGET ${HDF5_TEST_PLUGIN_TARGET}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different
- "$<TARGET_FILE:${HDF5_TEST_PLUGIN_LIB_TARGET}>"
- "${CMAKE_BINARY_DIR}/testdir2/$<TARGET_FILE_NAME:${HDF5_TEST_PLUGIN_LIB_TARGET}>"
+ "$<TARGET_FILE:${HDF5_TEST_PLUGIN_TARGET}>"
+ "${CMAKE_BINARY_DIR}/filter_plugin_dir2/$<TARGET_FILE_NAME:${HDF5_TEST_PLUGIN_TARGET}>"
)
endforeach ()
@@ -411,17 +411,17 @@ endif ()
### P L U G I N T E S T S
##############################################################################
if (BUILD_SHARED_LIBS)
- add_executable (plugin ${HDF5_TEST_SOURCE_DIR}/plugin.c)
- TARGET_NAMING (plugin SHARED)
- TARGET_C_PROPERTIES (plugin SHARED " " " ")
- target_link_libraries (plugin ${HDF5_TEST_LIB_TARGET})
- set_target_properties (plugin PROPERTIES FOLDER test)
+ add_executable (filter_plugin ${HDF5_TEST_SOURCE_DIR}/filter_plugin.c)
+ TARGET_NAMING (filter_plugin SHARED)
+ TARGET_C_PROPERTIES (filter_plugin SHARED " " " ")
+ target_link_libraries (filter_plugin ${HDF5_TEST_LIB_TARGET})
+ set_target_properties (filter_plugin PROPERTIES FOLDER test)
else ()
- add_executable (plugin ${HDF5_TEST_SOURCE_DIR}/plugin.c)
- TARGET_NAMING (plugin STATIC)
- TARGET_C_PROPERTIES (plugin STATIC " " " ")
- target_link_libraries (plugin ${HDF5_TEST_LIB_TARGET})
- set_target_properties (plugin PROPERTIES FOLDER test)
+ add_executable (filter_plugin ${HDF5_TEST_SOURCE_DIR}/filter_plugin.c)
+ TARGET_NAMING (filter_plugin STATIC)
+ TARGET_C_PROPERTIES (filter_plugin STATIC " " " ")
+ target_link_libraries (filter_plugin ${HDF5_TEST_LIB_TARGET})
+ set_target_properties (filter_plugin PROPERTIES FOLDER test)
endif ()
##############################################################################
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake
index 61ac3d2..973d389 100644
--- a/test/CMakeTests.cmake
+++ b/test/CMakeTests.cmake
@@ -1,4 +1,4 @@
-#
+
# Copyright by The HDF Group.
# All rights reserved.
#
@@ -520,7 +520,7 @@ set (test_CLEANFILES
multi_file-r.h5
multi_file-s.h5
core_file
- plugin.h5
+ filter_plugin.h5
new_move_a.h5
new_move_b.h5
ntypes.h5
@@ -1013,7 +1013,7 @@ if (BUILD_SHARED_LIBS)
endif ()
##############################################################################
-### P L U G I N T E S T S
+### F I L T E R P L U G I N T E S T S
##############################################################################
if (WIN32)
set (CMAKE_SEP "\;")
@@ -1023,9 +1023,9 @@ else ()
set (BIN_REL_PATH "../")
endif ()
-add_test (NAME H5PLUGIN-plugin COMMAND $<TARGET_FILE:plugin>)
-set_tests_properties (H5PLUGIN-plugin PROPERTIES
- ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/testdir1${CMAKE_SEP}${CMAKE_BINARY_DIR}/testdir2;srcdir=${HDF5_TEST_BINARY_DIR}"
+add_test (NAME H5PLUGIN-filter_plugin COMMAND $<TARGET_FILE:filter_plugin>)
+set_tests_properties (H5PLUGIN-filter_plugin PROPERTIES
+ ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/filter_plugin_dir1${CMAKE_SEP}${CMAKE_BINARY_DIR}/filter_plugin_dir2;srcdir=${HDF5_TEST_BINARY_DIR}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}
)
diff --git a/test/Makefile.am b/test/Makefile.am
index ba2d79b..efdc1ca 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -26,11 +26,12 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_builddir)/src
# testlibinfo.sh:
# testcheck_version.sh: tcheck_version
# testlinks_env.sh: links_env
-# test_filenotclosed.sh: filenotclosed.c
# testflushrefresh.sh: flushrefresh
-# test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes
# testswmr.sh: swmr*
# testvdsswmr.sh: vds_swmr*
+# test_filenotclosed.sh: filenotclosed.c
+# test_filter_plugin.sh: filter_plugin.c
+# test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes
TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_filenotclosed.sh\
testswmr.sh testvdsswmr.sh testflushrefresh.sh test_usecases.sh
SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) test_filenotclosed$(EXEEXT) \
@@ -40,8 +41,8 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) test_
swmr_sparse_reader$(EXEEXT) swmr_sparse_writer$(EXEEXT) swmr_start_write$(EXEEXT) \
vds_swmr_gen$(EXEEXT) vds_swmr_reader$(EXEEXT) vds_swmr_writer$(EXEEXT)
if HAVE_SHARED_CONDITIONAL
- TEST_SCRIPT += test_plugin.sh
- SCRIPT_DEPEND += plugin$(EXEEXT)
+ TEST_SCRIPT += test_filter_plugin.sh
+ SCRIPT_DEPEND += filter_plugin$(EXEEXT)
endif
check_SCRIPTS = $(TEST_SCRIPT)
@@ -81,7 +82,7 @@ check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version \
swmr_remove_writer swmr_addrem_writer swmr_sparse_reader swmr_sparse_writer \
swmr_check_compat_vfd vds_swmr_gen vds_swmr_reader vds_swmr_writer
if HAVE_SHARED_CONDITIONAL
- check_PROGRAMS+= plugin
+ check_PROGRAMS+= filter_plugin
endif
# These programs generate test files for the tests. They don't need to be
@@ -102,29 +103,17 @@ endif
if HAVE_SHARED_CONDITIONAL
# The libh5test library provides common support code for the tests.
- # The libdynlib1, libdynlib2, libdynlib3, and libdynlib4 library for testing plugin module plugin.c.
- # Build them as shared libraries if configure is enabled for shared library.
- noinst_LTLIBRARIES=libh5test.la libdynlib1.la libdynlib2.la libdynlib3.la libdynlib4.la
- libdynlib1_la_SOURCES=dynlib1.c
- libdynlib2_la_SOURCES=dynlib2.c
- libdynlib3_la_SOURCES=dynlib3.c
- libdynlib4_la_SOURCES=dynlib4.c
- libdynlib1_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
- libdynlib2_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
- libdynlib3_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
- libdynlib4_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
-
- libdynlib1.la: $(libdynlib1_la_OBJECTS) $(libdynlib1_la_DEPENDENCIES) $(EXTRA_libdynlib1_la_DEPENDENCIES)
- $(AM_V_CCLD)$(libdynlib1_la_LINK) $(am_libdynlib1_la_rpath) $(libdynlib1_la_OBJECTS) $(libdynlib1_la_LIBADD)
-
- libdynlib2.la: $(libdynlib2_la_OBJECTS) $(libdynlib2_la_DEPENDENCIES) $(EXTRA_libdynlib2_la_DEPENDENCIES)
- $(AM_V_CCLD)$(libdynlib2_la_LINK) $(am_libdynlib2_la_rpath) $(libdynlib2_la_OBJECTS) $(libdynlib2_la_LIBADD)
-
- libdynlib3.la: $(libdynlib3_la_OBJECTS) $(libdynlib3_la_DEPENDENCIES) $(EXTRA_libdynlib3_la_DEPENDENCIES)
- $(AM_V_CCLD)$(libdynlib3_la_LINK) $(am_libdynlib3_la_rpath) $(libdynlib3_la_OBJECTS) $(libdynlib3_la_LIBADD)
-
- libdynlib4.la: $(libdynlib4_la_OBJECTS) $(libdynlib4_la_DEPENDENCIES) $(EXTRA_libdynlib4_la_DEPENDENCIES)
- $(AM_V_CCLD)$(libdynlib4_la_LINK) $(am_libdynlib4_la_rpath) $(libdynlib4_la_OBJECTS) $(libdynlib4_la_LIBADD)
+ # The filter_plugin* libraries are for use in filter_plugin.c.
+ # Build them as shared libraries if that option was enabled in configure.
+ noinst_LTLIBRARIES=libh5test.la libfilter_plugin1_dsets.la libfilter_plugin2_dsets.la libfilter_plugin3_dsets.la libfilter_plugin4_groups.la
+ libfilter_plugin1_dsets_la_SOURCES=filter_plugin1_dsets.c
+ libfilter_plugin2_dsets_la_SOURCES=filter_plugin2_dsets.c
+ libfilter_plugin3_dsets_la_SOURCES=filter_plugin3_dsets.c
+ libfilter_plugin4_groups_la_SOURCES=filter_plugin4_groups.c
+ libfilter_plugin1_dsets_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere
+ libfilter_plugin2_dsets_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere
+ libfilter_plugin3_dsets_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere
+ libfilter_plugin4_groups_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere
else
# The libh5test library provides common support code for the tests.
noinst_LTLIBRARIES=libh5test.la
@@ -185,7 +174,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse
tmisc[0-9]*.h5 set_extent[1-5].h5 ext[12].bin \
getname.h5 getname[1-3].h5 sec2_file.h5 direct_file.h5 \
family_file000[0-3][0-9].h5 new_family_v16_000[0-3][0-9].h5 \
- multi_file-[rs].h5 core_file plugin.h5 \
+ multi_file-[rs].h5 core_file filter_plugin.h5 \
new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 err_compat.h5 \
dtransform.h5 test_filters.h5 get_file_name.h5 tstint[1-2].h5 \
unlink_chunked.h5 btree2.h5 btree2_tmp.h5 objcopy_src.h5 objcopy_dst.h5 \
@@ -215,7 +204,7 @@ use_append_mchunks_SOURCES=use_append_mchunks.c use_common.c
use_disable_mdc_flushes_SOURCES=use_disable_mdc_flushes.c
# Temporary files.
-DISTCLEANFILES=testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_plugin.sh \
+DISTCLEANFILES=testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_filter_plugin.sh \
testswmr.sh testvdsswmr.sh test_usecases.sh testflushrefresh.sh test_filenotclosed.sh
include $(top_srcdir)/config/conclude.am
diff --git a/test/cross_read.c b/test/cross_read.c
index 5d5ef07..2219151 100644
--- a/test/cross_read.c
+++ b/test/cross_read.c
@@ -226,7 +226,9 @@ check_file(char *filename)
const char *pathname = H5_get_srcdir_filename(filename); /* Corrected test file name */
hid_t fid = -1; /* file ID */
int nerrors = 0; /* # of datasets with errors */
+#if !defined(H5_HAVE_FILTER_DEFLATE) || !defined(H5_HAVE_FILTER_SZIP)
const char *not_supported= " filter is not enabled."; /* no filter message */
+#endif
/* Open the file. */
if((fid = H5Fopen(pathname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
diff --git a/test/dsets.c b/test/dsets.c
index 4088304..0fff2d1 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -2087,7 +2087,7 @@ test_get_filter_info(void)
#ifdef H5_HAVE_FILTER_SZIP
if(H5Zget_filter_info(H5Z_FILTER_SZIP, &flags) < 0) TEST_ERROR
- if(SZ_encoder_enabled()) {
+ if(H5Z_SZIP->encoder_present) {
if(((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) ||
((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0))
TEST_ERROR
diff --git a/test/dynlib1.c b/test/dynlib1.c
deleted file mode 100644
index e9137fb..0000000
--- a/test/dynlib1.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
- * If you do not have access to either file, you may request a copy from *
- * help@hdfgroup.org. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/*
- * Programmer: Raymond Lu
- * 13 February 2013
- *
- * Purpose: Tests the plugin module (H5PL)
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "H5PLextern.h"
-
-#define H5Z_FILTER_DYNLIB1 257
-
-static size_t H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
-
-/* This message derives from H5Z */
-const H5Z_class2_t H5Z_DYNLIB1[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_DYNLIB1, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "dynlib1", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)H5Z_filter_dynlib1, /* The actual filter function */
-}};
-
-H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
-const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB1;}
-
-/*-------------------------------------------------------------------------
- * Function: H5Z_filter_dynlib1
- *
- * Purpose: A dynlib1 filter method that adds on and subtract from
- * the original value with another value. It will be built
- * as a shared library. plugin.c test will load and use
- * this filter library.
- *
- * Return: Success: Data chunk size
- *
- * Failure: 0
- *
- * Programmer: Raymond Lu
- * 29 March 2013
- *
- *-------------------------------------------------------------------------
- */
-static size_t
-H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
-{
- int *int_ptr = (int *)*buf; /* Pointer to the data values */
- size_t buf_left = *buf_size; /* Amount of data buffer left to process */
- int add_on = 0;
-
- /* Check for the correct number of parameters */
- if(cd_nelmts == 0)
- return(0);
-
- /* Check that permanent parameters are set correctly */
- if(cd_values[0] > 9)
- return(0);
-
- add_on = (int)cd_values[0];
-
- if(flags & H5Z_FLAG_REVERSE) { /*read*/
- /* Substract the "add on" value to all the data values */
- while(buf_left > 0) {
- *int_ptr++ -= add_on;
- buf_left -= sizeof(int);
- } /* end while */
- } /* end if */
- else { /*write*/
- /* Add the "add on" value to all the data values */
- while(buf_left > 0) {
- *int_ptr++ += add_on;
- buf_left -= sizeof(int);
- } /* end while */
- } /* end else */
-
- return nbytes;
-} /* end H5Z_filter_dynlib1() */
-
diff --git a/test/dynlib3.c b/test/dynlib3.c
deleted file mode 100644
index 8871321..0000000
--- a/test/dynlib3.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
- * If you do not have access to either file, you may request a copy from *
- * help@hdfgroup.org. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/*
- * Programmer: Raymond Lu
- * 1 April 2013
- *
- * Purpose: Tests the plugin module (H5PL)
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include "H5PLextern.h"
-
-#define H5Z_FILTER_DYNLIB3 259
-#define SUFFIX_LEN 8
-#define GROUP_SUFFIX ".h5group"
-
-static size_t H5Z_filter_dynlib3(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
-
-/* This message derives from H5Z */
-const H5Z_class2_t H5Z_DYNLIB3[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_DYNLIB3, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "dynlib3", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)H5Z_filter_dynlib3, /* The actual filter function */
-}};
-
-H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
-const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB3;}
-
-/*-------------------------------------------------------------------------
- * Function: H5Z_filter_dynlib3
- *
- * Purpose: A dynlib3 filter method that is used to test groups. It
- * appends the suffix ".h5group" to each group name during
- * write and takes it out during read.
- *
- * Return: Success: Data chunk size
- *
- * Failure: 0
- *
- * Programmer: Raymond Lu
- * 1 April 2013
- *
- *-------------------------------------------------------------------------
- */
-static size_t
-H5Z_filter_dynlib3(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
-{
- size_t ret_value; /* Return value */
-
- /* Check for the correct number of parameters */
- if(cd_nelmts > 0)
- return(0);
-
- /* Assignment to eliminate unused parameter warning. */
- cd_values = cd_values;
-
- if(flags & H5Z_FLAG_REVERSE) { /*read*/
- ret_value = *buf_size = nbytes - SUFFIX_LEN;
- } /* end if */
- else { /*write*/
- void *outbuf = NULL; /* Pointer to new buffer */
- unsigned char *dst; /* Temporary pointer to destination buffer */
-
- dst = (unsigned char *)(outbuf = H5allocate_memory(nbytes + SUFFIX_LEN, 0));
-
- /* Copy raw data */
- memcpy((void*)dst, (void*)(*buf), nbytes);
-
- /* Append suffix to raw data for storage */
- dst += nbytes;
- memcpy(dst, (void*)GROUP_SUFFIX, SUFFIX_LEN);
-
- /* Free input buffer */
- H5free_memory(*buf);
-
- /* Set return values */
- *buf_size = nbytes + SUFFIX_LEN;
- *buf = outbuf;
- outbuf = NULL;
- ret_value = *buf_size;
- } /* end else */
-
- return ret_value;
-} /* H5Z_filter_dynlib3() */
-
diff --git a/test/dynlib4.c b/test/dynlib4.c
deleted file mode 100644
index 06d90ff..0000000
--- a/test/dynlib4.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
- * If you do not have access to either file, you may request a copy from *
- * help@hdfgroup.org. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/*
- * Purpose: Tests the plugin module (H5PL)
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "H5PLextern.h"
-
-#define H5Z_FILTER_DYNLIB4 260
-
-#define PUSH_ERR(func, minor, str) H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, H5E_ERR_CLS, H5E_PLUGIN, minor, str)
-
-static size_t H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
-
-/* This message derives from H5Z */
-const H5Z_class2_t H5Z_DYNLIB4[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_DYNLIB4, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "dynlib4", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)H5Z_filter_dynlib4, /* The actual filter function */
-}};
-
-H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
-const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB4;}
-
-/*-------------------------------------------------------------------------
- * Function: H5Z_filter_dynlib4
- *
- * Purpose: A dynlib4 filter method that adds on and subtract from
- * the original value with another value. It will be built
- * as a shared library. plugin.c test will load and use
- * this filter library. Designed to call a HDF function.
- *
- * Return: Success: Data chunk size
- *
- * Failure: 0
- *
- *-------------------------------------------------------------------------
- */
-static size_t
-H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
-{
- int *int_ptr = (int *)*buf; /* Pointer to the data values */
- size_t buf_left = *buf_size; /* Amount of data buffer left to process */
- int add_on = 0;
- unsigned ver_info[3];
-
- /* Check for the library version */
- if(H5get_libversion(&ver_info[0], &ver_info[1], &ver_info[2]) < 0) {
- PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion");
- return(0);
- }
- /* Check for the correct number of parameters */
- if(cd_nelmts == 0)
- return(0);
-
- /* Check that permanent parameters are set correctly */
- if(cd_values[0] > 9)
- return(0);
-
- if(ver_info[0] != cd_values[1] || ver_info[1] != cd_values[2]) {
- PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion does not match");
- return(0);
- }
-
- add_on = (int)cd_values[0];
-
- if(flags & H5Z_FLAG_REVERSE) { /*read*/
- /* Substract the "add on" value to all the data values */
- while(buf_left > 0) {
- *int_ptr++ -= add_on;
- buf_left -= sizeof(int);
- } /* end while */
- } /* end if */
- else { /*write*/
- /* Add the "add on" value to all the data values */
- while(buf_left > 0) {
- *int_ptr++ += add_on;
- buf_left -= sizeof(int);
- } /* end while */
- } /* end else */
-
- return nbytes;
-} /* end H5Z_filter_dynlib4() */
-
diff --git a/test/filenotclosed.c b/test/filenotclosed.c
index d1f468a..2c5c8dc 100644
--- a/test/filenotclosed.c
+++ b/test/filenotclosed.c
@@ -19,8 +19,8 @@
#include "h5test.h"
-#define FILENAME "filenotclosed"
-#define DATASET "dset"
+#define FILENAME "filenotclosed"
+#define DATASET_NAME "dset"
/*-------------------------------------------------------------------------
* Function: catch_signal
@@ -114,7 +114,7 @@ main(void)
TEST_ERROR
/* Create the dataset */
- if((did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if((did = H5Dcreate2(fid, DATASET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Write to the dataset */
diff --git a/test/filter_plugin.c b/test/filter_plugin.c
new file mode 100644
index 0000000..8b7e0e4
--- /dev/null
+++ b/test/filter_plugin.c
@@ -0,0 +1,1511 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/*
+ * Purpose: Tests the plugin module (H5PL)
+ */
+
+#include "h5test.h"
+#include "H5srcdir.h"
+
+/*
+ * This file needs to access private datatypes from the H5Z and H5PL package.
+ */
+#define H5PL_FRIEND
+#include "H5PLpkg.h"
+#define H5Z_FRIEND
+#include "H5Zpkg.h"
+
+/* Filters IDs for test filter plugins */
+#define FILTER1_ID 257
+#define FILTER2_ID 258
+#define FILTER3_ID 259
+#define FILTER4_ID 260
+
+const char *FILENAME[] = {
+ "filter_plugin",
+ NULL
+};
+#define FILENAME_BUF_SIZE 1024
+
+/* Dataset names */
+#define DSET_DEFLATE_NAME "deflate dset"
+#define DSET_FILTER1_NAME "filter 1 dset"
+#define DSET_FILTER2_NAME "filter 2 dset"
+#define DSET_FILTER3_NAME "filter 3 dset"
+
+/* Array sizes used throughout the test */
+#define DSET_DIM1 100
+#define DSET_DIM2 200
+#define CHUNK_DIM1 2
+#define CHUNK_DIM2 25
+#define HYPERSLAB_OFFSET1 7
+#define HYPERSLAB_OFFSET2 30
+#define HYPERSLAB_SIZE1 4
+#define HYPERSLAB_SIZE2 50
+
+/* Global size arrays */
+const hsize_t sizes_g[2] = {DSET_DIM1, DSET_DIM2}; /* Dataset dimensions */
+const hsize_t hs_sizes_g[2] = {HYPERSLAB_SIZE1, HYPERSLAB_SIZE2}; /* Hyperslab sizes */
+const hsize_t hs_offsets_g[2] = {HYPERSLAB_OFFSET1, HYPERSLAB_OFFSET2}; /* Hyperslab offsets */
+const hsize_t chunk_sizes_g[2] = {CHUNK_DIM1, CHUNK_DIM2}; /* Chunk dimensions */
+
+/* Limit random number within 20000 */
+#define RANDOM_LIMIT 20000
+
+/* Things used in the groups + filter plugins test */
+#define N_SUBGROUPS 1000
+#define SUBGROUP_PREFIX "subgroup_"
+#define TOP_LEVEL_GROUP_NAME "top-level group"
+
+/* Global arrays in which to save data */
+int **orig_deflate_g = NULL;
+int **orig_dynlib1_g = NULL;
+int **orig_dynlib2_g = NULL;
+int **orig_dynlib4_g = NULL;
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: free_2D_array
+ *
+ * Purpose: Free up a dynamic 2D pseudo array and set the pointer to NULL
+ * Designed to be callable in error conditions so NULLs are okay
+ *
+ * Return: SUCCEED (always)
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+free_2D_array(int ***arr) {
+
+ if (arr && *arr && (*arr)[0])
+ HDfree((*arr)[0]);
+ if (arr && *arr)
+ HDfree(*arr);
+ *arr = NULL;
+
+ return SUCCEED;
+} /* end free_2D_array() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: allocate_and_init_2D_array
+ *
+ * Purpose: Initialize an array as a pseudo 2D array and copy in some
+ * initial values.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+allocate_and_init_2D_array(int ***arr, const hsize_t *sizes, int **initial_values) {
+
+ size_t r, c; /* Data rows and columns */
+ size_t i; /* Iterator */
+ size_t n_bytes; /* # of bytes to copy */
+
+ r = (size_t)sizes[0];
+ c = (size_t)sizes[1];
+
+ /* Allocate and set up pseudo-2D array */
+ if (NULL == (*arr = (int **)HDcalloc(r, sizeof(int *))))
+ TEST_ERROR;
+ if (NULL == ((*arr)[0] = (int *)HDcalloc(r * c, sizeof(int))))
+ TEST_ERROR;
+ for (i = 0; i < r; i++)
+ (*arr)[i] = (**arr + c * i);
+
+ /* Copy over the data elements */
+ if (initial_values) {
+ n_bytes = r * c * sizeof(int);
+ HDmemcpy((*arr)[0], initial_values[0], n_bytes);
+ }
+
+ return SUCCEED;
+error:
+ free_2D_array(arr);
+
+ return FAIL;
+} /* end allocate_and_init_2D_array() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: compare_2D_arrays
+ *
+ * Purpose: Compare two pseudo 2D arrays
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+compare_2D_arrays(int **dset1, int **dset2, const hsize_t *sizes, /*OUT*/ hbool_t *are_same) {
+ hsize_t i, j; /* index variables */
+
+ *are_same = TRUE;
+
+ /* Check all the array values. This could optionally emit any
+ * bad data, but it's not clear how that would help debugging.
+ */
+ for (i = 0; i < sizes[0]; i++)
+ for (j = 0; j < sizes[1]; j++)
+ if (dset1[i][j] != dset2[i][j]) {
+ *are_same = FALSE;
+ return SUCCEED;
+ }
+
+ return SUCCEED;
+
+} /* end compare_2D_arrays() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: ensure_filter_works
+ *
+ * Purpose: Tests writing entire data and partial data with filters
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+ensure_filter_works(hid_t fid, const char *name, hid_t dcpl_id)
+{
+ hid_t did = -1; /* Dataset ID */
+ hid_t dxpl_id = -1; /* Dataset xfer property list ID */
+ hid_t write_dxpl_id = -1; /* Dataset xfer property list ID for writing */
+ hid_t sid = -1; /* Dataspace ID */
+ void *tconv_buf = NULL; /* Temporary conversion buffer */
+ int **orig = NULL; /* Data written to the dataset */
+ int **read = NULL; /* Data read from the dataset */
+ size_t r, c; /* Data rows and columns */
+ size_t hs_r, hs_c, hs_offr, hs_offc; /* Hypserslab sizes and offsets */
+ size_t i, j; /* Local index variables */
+ int n = 0; /* Value written to point array */
+ hbool_t are_same; /* Output from dataset compare function */
+ int ***save_array = NULL; /* (Global) array where the final data go */
+
+ /* initialize */
+ r = (size_t)sizes_g[0];
+ c = (size_t)sizes_g[1];
+
+ /* Create the data space */
+ if ((sid = H5Screate_simple(2, sizes_g, NULL)) < 0)
+ TEST_ERROR;
+
+ /* Allocate memory for the data buffers
+ * We're using the hacky way of doing 2D arrays that uses a
+ * single data buffer but which allows normal 2D access.
+ */
+ if (allocate_and_init_2D_array(&orig, sizes_g, NULL) < 0)
+ TEST_ERROR;
+ if (allocate_and_init_2D_array(&read, sizes_g, NULL) < 0)
+ TEST_ERROR;
+
+ /* Create a small conversion buffer to test strip mining. We
+ * might as well test all we can!
+ */
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR;
+ if (NULL == (tconv_buf = HDcalloc((size_t)1000, sizeof(char))))
+ TEST_ERROR;
+ if (H5Pset_buffer(dxpl_id, (size_t)1000, tconv_buf, NULL) < 0)
+ TEST_ERROR;
+ if ((write_dxpl_id = H5Pcopy(dxpl_id)) < 0)
+ TEST_ERROR;
+
+ TESTING(" filters (setup)");
+
+ /* Check if all the filters are available */
+ if (H5Pall_filters_avail(dcpl_id) != TRUE)
+ TEST_ERROR;
+
+ /* Create the dataset */
+ if ((did = H5Dcreate2(fid, name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ PASSED();
+
+ /*----------------------------------------------------------------------
+ * STEP 1: Read uninitialized data. It should be zero.
+ *----------------------------------------------------------------------
+ */
+ TESTING(" filters (uninitialized read)");
+
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, *read) < 0)
+ TEST_ERROR;
+
+ /* The input buffer was calloc'd and has not been initialized yet */
+ if (compare_2D_arrays(orig, read, sizes_g, &are_same) < 0)
+ TEST_ERROR;
+ if (FALSE == are_same)
+ TEST_ERROR;
+
+ PASSED();
+
+ /*----------------------------------------------------------------------
+ * STEP 2: Test filters by setting up a chunked dataset and writing
+ * to it.
+ *----------------------------------------------------------------------
+ */
+ TESTING(" filters (write)");
+
+ n = 0;
+ for (i = 0; i < r; i++)
+ for (j = 0; j < c; j++)
+ orig[i][j] = n++;
+
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl_id, *orig) < 0)
+ TEST_ERROR;
+
+ PASSED();
+
+ /*----------------------------------------------------------------------
+ * STEP 3: Try to read the data we just wrote.
+ *----------------------------------------------------------------------
+ */
+ TESTING(" filters (read)");
+
+ /* Read the dataset back */
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, *read) < 0)
+ TEST_ERROR;
+
+ /* Check that the values read are the same as the values written */
+ if (compare_2D_arrays(orig, read, sizes_g, &are_same) < 0)
+ TEST_ERROR;
+ if (FALSE == are_same)
+ TEST_ERROR;
+
+ PASSED();
+
+ /*----------------------------------------------------------------------
+ * STEP 4: Write new data over the top of the old data. The new data is
+ * random thus not very compressible, and will cause the chunks to move
+ * around as they grow. We only change values for the left half of the
+ * dataset although we rewrite the whole thing.
+ *----------------------------------------------------------------------
+ */
+ TESTING(" filters (modify)");
+
+ for (i = 0; i < r; i++)
+ for (j = 0; j < c / 2; j++)
+ orig[i][j] = (int)HDrandom() % RANDOM_LIMIT;
+
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl_id, *orig) < 0)
+ TEST_ERROR;
+
+ /* Read the dataset back and check it */
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, *read) < 0)
+ TEST_ERROR;
+
+ /* Check that the values read are the same as the values written */
+ if (compare_2D_arrays(orig, read, sizes_g, &are_same) < 0)
+ TEST_ERROR;
+ if (FALSE == are_same)
+ TEST_ERROR;
+
+ PASSED();
+
+ /*----------------------------------------------------------------------
+ * STEP 5: Close the dataset and then open it and read it again. This
+ * insures that the filters message is picked up properly from the
+ * object header.
+ *----------------------------------------------------------------------
+ */
+ TESTING(" filters (re-open)");
+
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+ if ((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, *read) < 0)
+ TEST_ERROR;
+
+ /* Check that the values read are the same as the values written */
+ if (compare_2D_arrays(orig, read, sizes_g, &are_same) < 0)
+ TEST_ERROR;
+ if (FALSE == are_same)
+ TEST_ERROR;
+
+ PASSED();
+
+ /*----------------------------------------------------------------------
+ * STEP 6: Test partial I/O by writing to and then reading from a
+ * hyperslab of the dataset. The hyperslab does not line up on chunk
+ * boundaries (we know that case already works from above tests).
+ *----------------------------------------------------------------------
+ */
+ TESTING(" filters (partial I/O)");
+
+ hs_r = (size_t)hs_sizes_g[0];
+ hs_c = (size_t)hs_sizes_g[1];
+ hs_offr = (size_t)hs_offsets_g[0];
+ hs_offc = (size_t)hs_offsets_g[1];
+ for (i = 0; i < hs_r; i++)
+ for (j = 0; j < hs_c; j++)
+ orig[hs_offr + i][hs_offc + j] = (int)HDrandom() % RANDOM_LIMIT;
+
+ if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offsets_g, NULL, hs_sizes_g, NULL) < 0)
+ TEST_ERROR;
+
+ /* Use the "read" DXPL because partial I/O on corrupted data test
+ * needs to ignore errors during writing
+ */
+ if (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, dxpl_id, *orig) < 0)
+ TEST_ERROR;
+
+ if (H5Dread(did, H5T_NATIVE_INT, sid, sid, dxpl_id, *read) < 0)
+ TEST_ERROR;
+
+ /* Check that the values read are the same as the values written */
+ if (compare_2D_arrays(orig, read, sizes_g, &are_same) < 0)
+ TEST_ERROR;
+ if (FALSE == are_same)
+ TEST_ERROR;
+
+ PASSED();
+
+ /* Save the data written to the file for later comparison when the file
+ * is reopened for read test.
+ */
+ if (!HDstrcmp(name, DSET_DEFLATE_NAME))
+ save_array = &orig_deflate_g;
+ else if (!HDstrcmp(name, DSET_FILTER1_NAME))
+ save_array = &orig_dynlib1_g;
+ else if (!HDstrcmp(name, DSET_FILTER2_NAME))
+ save_array = &orig_dynlib2_g;
+ else if (!HDstrcmp(name, DSET_FILTER3_NAME))
+ save_array = &orig_dynlib4_g;
+ else
+ TEST_ERROR;
+ if (allocate_and_init_2D_array(save_array, sizes_g, orig) < 0)
+ TEST_ERROR;
+
+ /* Clean up and exit */
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+ if (H5Sclose(sid) < 0)
+ TEST_ERROR;
+ if (H5Pclose(dxpl_id) < 0)
+ TEST_ERROR;
+ if (H5Pclose(write_dxpl_id) < 0)
+ TEST_ERROR;
+
+ free_2D_array(&orig);
+ free_2D_array(&read);
+
+ HDfree(tconv_buf);
+
+ return SUCCEED;
+
+error:
+ /* Clean up objects used for this test */
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Pclose(dxpl_id);
+ H5Pclose(write_dxpl_id);
+ } H5E_END_TRY
+
+ /* NULLs are okay here */
+ free_2D_array(&orig);
+ free_2D_array(&read);
+
+ if (tconv_buf)
+ HDfree(tconv_buf);
+
+ return FAIL;
+} /* end ensure_filter_works() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_dataset_write_with_filters
+ *
+ * Purpose: Tests creating datasets and writing data with dynamically loaded filters
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_dataset_write_with_filters(hid_t fid)
+{
+ hid_t dcpl_id = -1; /* Dataset creation property list ID */
+ unsigned int compress_level; /* Deflate compression level */
+ unsigned int filter1_data; /* Data used by filter 1 */
+ unsigned int libver_values[4]; /* Used w/ the filter that makes HDF5 calls */
+
+ /*----------------------------------------------------------
+ * STEP 1: Test deflation by itself.
+ *----------------------------------------------------------
+ */
+ HDputs("Testing dataset writes with deflate filter");
+#ifdef H5_HAVE_FILTER_DEFLATE
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR;
+ if (H5Pset_chunk(dcpl_id, 2, chunk_sizes_g) < 0)
+ TEST_ERROR;
+ compress_level = 6;
+ if (H5Pset_deflate(dcpl_id, compress_level) < 0)
+ TEST_ERROR;
+
+ /* Ensure the filter works */
+ if (ensure_filter_works(fid, DSET_DEFLATE_NAME, dcpl_id) < 0)
+ TEST_ERROR;
+
+ /* Clean up objects used for this test */
+ if (H5Pclose(dcpl_id) < 0)
+ TEST_ERROR;
+#else /* H5_HAVE_FILTER_DEFLATE */
+ SKIPPED();
+ HDputs(" Deflate filter not enabled");
+#endif /* H5_HAVE_FILTER_DEFLATE */
+
+ /*----------------------------------------------------------
+ * STEP 2: Test filter plugin 1 by itself.
+ *----------------------------------------------------------
+ */
+ HDputs(" dataset writes with filter plugin 1");
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR;
+ if (H5Pset_chunk(dcpl_id, 2, chunk_sizes_g) < 0)
+ TEST_ERROR;
+
+ /* Set up the filter, passing in the amount the filter will add and subtract
+ * from each data element. Note that this value has an arbitrary max of 9.
+ */
+ filter1_data = 9;
+ if (H5Pset_filter(dcpl_id, FILTER1_ID, H5Z_FLAG_MANDATORY, (size_t)1, &filter1_data) < 0)
+ TEST_ERROR;
+
+ /* Ensure the filter works */
+ if (ensure_filter_works(fid, DSET_FILTER1_NAME, dcpl_id) < 0)
+ TEST_ERROR;
+
+ /* Clean up objects used for this test */
+ if (H5Pclose(dcpl_id) < 0)
+ TEST_ERROR;
+
+ /* Unregister the dynamic filter for testing purpose. The next time when this test is run for
+ * the new file format, the library's H5PL code has to search in the table of loaded plugin libraries
+ * for this filter.
+ */
+ if (H5Zunregister(FILTER1_ID) < 0)
+ TEST_ERROR;
+
+ /*----------------------------------------------------------
+ * STEP 3: Test filter plugin 2 by itself.
+ *----------------------------------------------------------
+ */
+ HDputs(" dataset writes with filter plugin 2");
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR;
+ if (H5Pset_chunk(dcpl_id, 2, chunk_sizes_g) < 0)
+ TEST_ERROR;
+ if (H5Pset_filter(dcpl_id, FILTER2_ID, H5Z_FLAG_MANDATORY, 0, NULL) < 0)
+ TEST_ERROR;
+
+ /* Ensure the filter works */
+ if (ensure_filter_works(fid, DSET_FILTER2_NAME, dcpl_id) < 0)
+ TEST_ERROR;
+
+ /* Clean up objects used for this test */
+ if (H5Pclose(dcpl_id) < 0)
+ TEST_ERROR;
+
+ /* Unregister the dynamic filter for testing purpose. The next time when this test is run for
+ * the new file format, the library's H5PL code has to search in the table of loaded plugin libraries
+ * for this filter.
+ */
+ if (H5Zunregister(FILTER2_ID) < 0)
+ TEST_ERROR;
+
+ /*----------------------------------------------------------
+ * STEP 4: Test filter plugin 3 by itself.
+ * (This filter plugin makes HDF5 API calls)
+ *----------------------------------------------------------
+ */
+ HDputs(" dataset writes with filter plugin 3");
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR;
+ if (H5Pset_chunk(dcpl_id, 2, chunk_sizes_g) < 0)
+ TEST_ERROR;
+
+ /* Set the add/subtract value for the filter */
+ libver_values[0] = 9;
+
+ /* Get the library bounds and add to the filter data */
+ if (H5get_libversion(&libver_values[1], &libver_values[2], &libver_values[3]) < 0)
+ TEST_ERROR;
+ if (H5Pset_filter(dcpl_id, FILTER3_ID, H5Z_FLAG_MANDATORY, (size_t)4, libver_values) < 0)
+ TEST_ERROR;
+
+ /* Ensure the filter works */
+ if (ensure_filter_works(fid, DSET_FILTER3_NAME, dcpl_id) < 0)
+ TEST_ERROR;
+
+ /* Clean up objects used for this test */
+ if (H5Pclose(dcpl_id) < 0)
+ TEST_ERROR;
+
+ /* Unregister the dynamic filter for testing purpose. The next time when this test is run for
+ * the new file format, the library's H5PL code has to search in the table of loaded plugin libraries
+ * for this filter.
+ */
+ if (H5Zunregister(FILTER3_ID) < 0)
+ TEST_ERROR;
+
+ return SUCCEED;
+
+error:
+ /* Clean up objects used for this test */
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl_id);
+ } H5E_END_TRY
+
+ return FAIL;
+} /* end test_dataset_write_with_filters() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_read_data
+ *
+ * Purpose: Tests reading data and compares values
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_read_data(hid_t did, int *origin_data)
+{
+ int **check = NULL;
+ int *data_p = origin_data;
+ size_t i, j; /* Local index variables */
+
+ if (allocate_and_init_2D_array(&check, sizes_g, NULL) < 0)
+ TEST_ERROR;
+
+ /* Read the dataset back */
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, *check) < 0)
+ TEST_ERROR;
+
+ /* Check that the values read are the same as the values written */
+ for(i = 0; i < sizes_g[0]; i++)
+ for(j = 0; j < sizes_g[1]; j++) {
+ if(*data_p != check[i][j])
+ TEST_ERROR
+ data_p++;
+ }
+
+ free_2D_array(&check);
+
+ PASSED();
+
+ return SUCCEED;
+
+error:
+ free_2D_array(&check);
+
+ return FAIL;
+} /* end test_read_data() */
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_dataset_read_with_filters
+ *
+ * Purpose: Tests reading datasets created with dynamically-loaded
+ * filter plugins.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_dataset_read_with_filters(hid_t fid)
+{
+ hid_t did = -1; /* Dataset ID */
+
+ /*----------------------------------------------------------
+ * STEP 1: Test deflation by itself.
+ *----------------------------------------------------------
+ */
+ TESTING("dataset read I/O with deflate filter");
+
+#ifdef H5_HAVE_FILTER_DEFLATE
+ if (H5Zfilter_avail(H5Z_FILTER_DEFLATE) != TRUE)
+ TEST_ERROR;
+
+ if ((did = H5Dopen2(fid, DSET_DEFLATE_NAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ if (test_read_data(did, orig_deflate_g[0]) < 0)
+ TEST_ERROR;
+
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+
+#else /* H5_HAVE_FILTER_DEFLATE */
+ SKIPPED();
+ HDputs(" Deflate filter not enabled");
+#endif /* H5_HAVE_FILTER_DEFLATE */
+
+ /*----------------------------------------------------------
+ * STEP 2: Test filter plugin 1 by itself.
+ *----------------------------------------------------------
+ */
+ TESTING(" dataset reads with filter plugin 1");
+
+ if ((did = H5Dopen2(fid, DSET_FILTER1_NAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ if (test_read_data(did, orig_dynlib1_g[0]) < 0)
+ TEST_ERROR;
+
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+
+ /*----------------------------------------------------------
+ * STEP 3: Test filter plugin 2 by itself.
+ *----------------------------------------------------------
+ */
+ TESTING(" dataset reads with filter plugin 2");
+
+ if ((did = H5Dopen2(fid, DSET_FILTER2_NAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ if (test_read_data(did, orig_dynlib2_g[0]) < 0)
+ TEST_ERROR;
+
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+
+ /*----------------------------------------------------------
+ * STEP 4: Test filter plugin 3 by itself.
+ *----------------------------------------------------------
+ */
+ TESTING(" dataset reads with filter plugin 3");
+
+ if ((did = H5Dopen2(fid, DSET_FILTER3_NAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ if (test_read_data(did, orig_dynlib4_g[0]) < 0)
+ TEST_ERROR;
+
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+
+ return SUCCEED;
+
+error:
+ /* Clean up objects used for this test */
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ } H5E_END_TRY
+
+ return FAIL;
+} /* end test_dataset_read_with_filters() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: ensure_data_read_fails
+ *
+ * Purpose: Tests not reading data
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+ensure_data_read_fails(hid_t did)
+{
+ int **check = NULL;
+ herr_t ret = FAIL;
+
+ if (allocate_and_init_2D_array(&check, sizes_g, NULL) < 0)
+ TEST_ERROR;
+
+ /* Read the dataset back (should fail) */
+ H5E_BEGIN_TRY {
+ ret = H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, *check);
+ } H5E_END_TRY
+ if(ret >= 0)
+ TEST_ERROR;
+
+ free_2D_array(&check);
+
+ PASSED();
+
+ return SUCCEED;
+
+error:
+ free_2D_array(&check);
+ return FAIL;
+} /* end ensure_data_read_fails() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_no_read_when_plugins_disabled
+ *
+ * Purpose: Ensures we can't read data from a dataset that requires a
+ * filter located in a plugin.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_no_read_when_plugins_disabled(hid_t fid)
+{
+ hid_t did = -1; /* Dataset ID */
+ unsigned plugin_flags; /* Plugin access flags */
+
+ TESTING("filter plugin 1 with filter plugins disabled");
+
+ /* Get the existing plugin flags */
+ if (H5PLget_loading_state(&plugin_flags) < 0)
+ TEST_ERROR;
+
+ /* Disable filter plugins and use the new flags */
+ plugin_flags &= (unsigned)(~H5PL_FILTER_PLUGIN);
+ if (H5PLset_loading_state(plugin_flags) < 0)
+ TEST_ERROR;
+
+ /* Open a dataset that requires a filter plugin to read the data */
+ if ((did = H5Dopen2(fid, DSET_FILTER1_NAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ /* Make sure we can't read the data */
+ if (ensure_data_read_fails(did) < 0)
+ TEST_ERROR;
+
+ /* Close down */
+ if (H5Dclose(did) < 0)
+ TEST_ERROR;
+
+ /* Re-enable filter plugins */
+ plugin_flags |= (unsigned)H5PL_FILTER_PLUGIN;
+ if (H5PLset_loading_state(plugin_flags) < 0)
+ TEST_ERROR;
+
+ return SUCCEED;
+
+error:
+ /* Clean up objects used for this test */
+ H5E_BEGIN_TRY {
+ plugin_flags |= (unsigned)H5PL_FILTER_PLUGIN;
+ H5PLset_loading_state(plugin_flags);
+ H5Dclose(did);
+ } H5E_END_TRY
+
+ return FAIL;
+} /* end test_no_read_when_plugins_disabled() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_creating_groups_using_plugins
+ *
+ * Purpose: Tests creating group with dynamically loaded filters
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_creating_groups_using_plugins(hid_t fid)
+{
+ hid_t gcpl_id = -1;
+ hid_t gid = -1;
+ hid_t sub_gid = -1;
+ int i;
+ char subgroup_name[256];
+
+ TESTING("creating groups with filter plugin 4");
+
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ TEST_ERROR;
+
+ /* Use a filter plugin for creating groups */
+ if (H5Pset_filter(gcpl_id, FILTER4_ID, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0)
+ TEST_ERROR;
+
+ /* Create a group using this filter */
+ if ((gid = H5Gcreate2(fid, TOP_LEVEL_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ /* Create multiple groups under the top-level group */
+ for (i = 0; i < N_SUBGROUPS; i++) {
+ char *sp = subgroup_name;
+
+ sp += HDsprintf(subgroup_name, SUBGROUP_PREFIX);
+ HDsprintf(sp, "%d", i);
+
+ if ((sub_gid = H5Gcreate2(gid, subgroup_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Gclose(sub_gid) < 0)
+ TEST_ERROR;
+ }
+
+ /* Close everything */
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
+ if (H5Pclose(gcpl_id) < 0)
+ TEST_ERROR;
+
+ PASSED();
+
+ return SUCCEED;
+
+error:
+ /* Clean up objects used for this test */
+ H5E_BEGIN_TRY {
+ H5Gclose(sub_gid);
+ H5Gclose(gid);
+ H5Pclose(gcpl_id);
+ } H5E_END_TRY
+
+ return FAIL;
+} /* end test_creating_groups_using_plugins() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_opening_groups_using_plugins
+ *
+ * Purpose: Tests opening group with dynamically loaded filters
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_opening_groups_using_plugins(hid_t fid)
+{
+ hid_t gid = -1;
+ hid_t sub_gid = -1;
+ int i;
+ char subgroup_name[256];
+
+ TESTING("opening groups with filter plugin 4");
+
+ /* Open the top group */
+ if ((gid = H5Gopen2(fid, TOP_LEVEL_GROUP_NAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ /* Open all the sub-groups under the top-level group */
+ for (i = 0; i < N_SUBGROUPS; i++) {
+ char *sp = subgroup_name;
+
+ sp += HDsprintf(subgroup_name, SUBGROUP_PREFIX);
+ HDsprintf(sp, "%d", i);
+
+ if ((sub_gid = H5Gopen2(gid, subgroup_name, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ if (H5Gclose(sub_gid) < 0)
+ TEST_ERROR;
+ }
+
+ /* Close the top-level group */
+ if (H5Gclose(gid) < 0)
+ TEST_ERROR;
+
+ PASSED();
+
+ return SUCCEED;
+
+error:
+ /* Clean up objects used for this test */
+ H5E_BEGIN_TRY {
+ H5Gclose(gid);
+ H5Gclose(sub_gid);
+ } H5E_END_TRY
+
+ return FAIL;
+} /* end test_opening_groups_using_plugins() */
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_path_api_calls
+ *
+ * Purpose: Tests the H5PL API calls that manipulate the plugin search
+ * paths.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_path_api_calls(void)
+{
+ unsigned int n_starting_paths;
+ unsigned int u;
+ unsigned int n_paths;
+ herr_t ret;
+ ssize_t path_len = -1;
+ char path[256];
+ char temp_name[256];
+
+ HDputs("Testing access to the filter path table");
+
+ if (H5Zfilter_avail(FILTER1_ID) != TRUE)
+ TEST_ERROR;
+
+ /* Set the number of paths to create for this test.
+ *
+ * This should be set high enough to ensure that at least one array
+ * expansion will take place. See H5PLpath.c for details.
+ */
+ n_starting_paths = 42;
+
+ /* Check that initialization is correct */
+ TESTING(" initialize");
+
+ if (H5PLsize(&n_paths) < 0)
+ TEST_ERROR;
+ if (n_paths != 2)
+ TEST_ERROR;
+
+ PASSED();
+
+ /****************/
+ /* H5PLremove() */
+ /****************/
+
+ /* Remove all the current paths */
+ TESTING(" remove");
+
+ /* Get the current size */
+ if (H5PLsize(&n_paths) < 0)
+ TEST_ERROR;
+
+ /* Remove all existing paths */
+ for (u = n_paths; u > 0; u--)
+ if (H5PLremove(u-1) < 0) {
+ HDfprintf(stderr," at %u: %s\n", u, path);
+ TEST_ERROR;
+ }
+
+ /* Verify the table is empty */
+ if (H5PLsize(&n_paths) < 0)
+ TEST_ERROR;
+ if (n_paths > 0)
+ TEST_ERROR;
+
+ PASSED();
+
+
+ TESTING(" remove (index 0 in empty table)");
+
+ /* Try to remove index zero in an empty list (SHOULD FAIL) */
+ H5E_BEGIN_TRY {
+ ret = H5PLremove(0);
+ } H5E_END_TRY
+ if (ret >= 0)
+ TEST_ERROR;
+
+ PASSED();
+
+
+ /****************/
+ /* H5PLappend() */
+ /****************/
+
+ TESTING(" append");
+
+ /* Add a bunch of paths to the path table */
+ for (u = 0; u < n_starting_paths; u++) {
+ HDsprintf(path, "a_path_%u", u);
+ if (H5PLappend(path) < 0) {
+ HDfprintf(stderr," at %u: %s\n", u, path);
+ TEST_ERROR;
+ }
+ }
+
+ PASSED();
+
+
+ /**********************/
+ /* H5PLremove() again */
+ /**********************/
+
+ TESTING(" remove (index too high)");
+
+ /* Try to remove a path where the index is beyond the table capacity (SHOULD FAIL) */
+ H5E_BEGIN_TRY {
+ ret = H5PLremove(n_starting_paths);
+ } H5E_END_TRY
+
+ if (ret >= 0)
+ TEST_ERROR
+
+ PASSED();
+
+
+ /*************/
+ /* H5PLget() */
+ /*************/
+
+ TESTING(" get (path name)");
+
+ /* Get the path length by passing in NULL */
+ if ((path_len = H5PLget(0, NULL, 0)) <= 0) {
+ HDfprintf(stderr," get path 0 length failed\n");
+ TEST_ERROR;
+ }
+ if (path_len != 8)
+ TEST_ERROR;
+
+ /* Get the path */
+ if ((path_len = H5PLget(0, path, 256)) <= 0) {
+ HDfprintf(stderr," get 0 len: %u : %s\n", path_len, path);
+ TEST_ERROR;
+ }
+ if (HDstrcmp(path, "a_path_0") != 0) {
+ HDfprintf(stderr," get 0: %s\n", path);
+ TEST_ERROR;
+ }
+
+ PASSED();
+
+
+ TESTING(" get (high and low indices)");
+
+ /* Get path at index 1 */
+ if ((path_len = H5PLget(1, path, 256)) <= 0)
+ TEST_ERROR;
+ if (HDstrcmp(path, "a_path_1") != 0) {
+ HDfprintf(stderr," get 1: %s\n", path);
+ TEST_ERROR;
+ }
+
+ /* Get path at the last index */
+ if ((path_len = H5PLget(n_starting_paths - 1, path, 256)) <= 0)
+ TEST_ERROR;
+ HDsprintf(temp_name, "a_path_%u", n_starting_paths - 1);
+ if (HDstrcmp(path, temp_name) != 0) {
+ HDfprintf(stderr," get %u: %s\n", n_starting_paths - 1, path);
+ TEST_ERROR;
+ }
+
+ PASSED();
+
+
+ TESTING(" get (index too high)");
+
+ /* Get path at the last + 1 index (SHOULD FAIL) */
+ H5E_BEGIN_TRY {
+ path_len = H5PLget(n_starting_paths, NULL, 0);
+ } H5E_END_TRY
+ if (path_len > 0)
+ TEST_ERROR;
+
+ PASSED();
+
+
+ /*****************/
+ /* H5PLprepend() */
+ /*****************/
+
+ /* We'll remove a path at an arbitrary index and then
+ * prepend a new path.
+ */
+
+ TESTING(" remove (arbitrary index 1)");
+
+ /* Remove one path */
+ if (H5PLremove(8) < 0)
+ TEST_ERROR;
+
+ /* Verify that the entries were moved */
+ if ((path_len = H5PLget(8, path, 256)) <= 0)
+ TEST_ERROR;
+ if (HDstrcmp(path, "a_path_9") != 0) {
+ HDfprintf(stderr," get 8: %s\n", path);
+ TEST_ERROR;
+ }
+
+ /* Verify the table shrank */
+ if (H5PLsize(&n_paths) < 0)
+ TEST_ERROR;
+ if (n_paths != n_starting_paths - 1)
+ TEST_ERROR;
+
+ PASSED();
+
+
+ TESTING(" prepend");
+
+ /* Prepend one path */
+ HDsprintf(path, "a_path_%d", n_starting_paths + 1);
+ if (H5PLprepend(path) < 0) {
+ HDfprintf(stderr," prepend %u: %s\n", n_starting_paths + 1, path);
+ TEST_ERROR;
+ }
+
+ /* Verify the table increased */
+ if (H5PLsize(&n_paths) < 0)
+ TEST_ERROR;
+ if (n_paths != n_starting_paths)
+ TEST_ERROR;
+
+ /* Verify that the entries were moved */
+ if (H5PLget(8, path, 256) <= 0)
+ TEST_ERROR;
+ if (HDstrcmp(path, "a_path_7") != 0) {
+ HDfprintf(stderr," get 8: %s\n", path);
+ TEST_ERROR;
+ }
+
+ /* Verify that the path was inserted at index zero */
+ if (H5PLget(0, path, 256) <= 0)
+ TEST_ERROR;
+ HDsprintf(temp_name, "a_path_%d", n_starting_paths + 1);
+ if (HDstrcmp(path, temp_name) != 0) {
+ HDfprintf(stderr," get 0: %s\n", path);
+ TEST_ERROR;
+ }
+
+ PASSED();
+
+
+ /*****************/
+ /* H5PLreplace() */
+ /*****************/
+
+ TESTING(" replace");
+
+ /* Replace one path at index 1 */
+ HDsprintf(path, "a_path_%u", n_starting_paths + 4);
+ if (H5PLreplace(path, 1) < 0) {
+ HDfprintf(stderr," replace 1: %s\n", path);
+ TEST_ERROR;
+ }
+
+ /* Verify the table size remained the same */
+ if (H5PLsize(&n_paths) < 0)
+ TEST_ERROR;
+ if (n_paths != n_starting_paths)
+ TEST_ERROR;
+
+ /* Verify that the entries were not moved by
+ * inspecting the paths at indices +/- 1.
+ */
+
+ /* Check path at index 0 */
+ if (H5PLget(0, path, 256) <= 0)
+ TEST_ERROR;
+ HDsprintf(temp_name, "a_path_%u", n_starting_paths + 1);
+ if (HDstrcmp(path, temp_name) != 0) {
+ HDfprintf(stderr," get 0: %s\n", path);
+ TEST_ERROR;
+ }
+
+ /* Check path at index 2 */
+ if (H5PLget(2, path, 256) <= 0)
+ TEST_ERROR;
+ if (HDstrcmp(path, "a_path_1") != 0) {
+ HDfprintf(stderr," get 2: %s\n", path);
+ TEST_ERROR;
+ }
+
+ PASSED();
+
+
+ /****************/
+ /* H5PLinsert() */
+ /****************/
+
+ /* We'll remove a path at an arbitrary index and then
+ * insert a new path.
+ */
+
+ TESTING(" remove (arbitrary index 2)");
+
+ /* Remove one path */
+ if (H5PLremove(4) < 0)
+ TEST_ERROR;
+
+ /* Verify that the entries were moved */
+ if (H5PLget(4, path, 256) <= 0)
+ TEST_ERROR;
+ if (HDstrcmp(path, "a_path_4") != 0) {
+ HDfprintf(stderr," get 4: %s\n", path);
+ TEST_ERROR;
+ }
+
+ /* Verify the table size */
+ if (H5PLsize(&n_paths) < 0)
+ TEST_ERROR;
+ if (n_paths != n_starting_paths - 1)
+ TEST_ERROR;
+ PASSED();
+
+
+ TESTING(" insert");
+
+ /* Insert one path at index 3*/
+ HDsprintf(path, "a_path_%d", n_starting_paths + 5);
+ if (H5PLinsert(path, 3) < 0) {
+ HDfprintf(stderr," insert 3: %s\n", path);
+ TEST_ERROR;
+ }
+
+ /* Verify that the entries were moved */
+ if (H5PLget(4, path, 256) <= 0)
+ TEST_ERROR;
+ if (HDstrcmp(path, "a_path_2") != 0) {
+ HDfprintf(stderr," get 4: %s\n", path);
+ TEST_ERROR;
+ }
+
+ /* Verify the table size increased */
+ if (H5PLsize(&n_paths) < 0)
+ TEST_ERROR;
+ if (n_paths != n_starting_paths)
+ TEST_ERROR;
+
+ PASSED();
+
+
+ /****************/
+ /* H5PLremove() */
+ /****************/
+
+ /* Remove all the current paths */
+ TESTING(" remove (all)");
+
+ /* Get the current size */
+ if (H5PLsize(&n_paths) < 0)
+ TEST_ERROR;
+
+ /* Remove all existing paths */
+ for (u = n_paths; u > 0; u--)
+ if (H5PLremove(u-1) < 0) {
+ HDfprintf(stderr," at %u: %s\n", u, path);
+ TEST_ERROR;
+ }
+
+ /* Verify the table is empty */
+ if (H5PLsize(&n_paths) < 0)
+ TEST_ERROR;
+ if (n_paths > 0)
+ TEST_ERROR;
+
+ PASSED();
+
+
+ return SUCCEED;
+
+error:
+ return FAIL;
+} /* end test_path_api_calls() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: disable_chunk_cache
+ *
+ * Purpose: Turns the chunk cache off
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+disable_chunk_cache(hid_t fapl_id) {
+ int mdc_nelmts;
+ size_t rdcc_nelmts;
+ size_t rdcc_nbytes;
+ double rdcc_w0;
+
+ if (H5Pget_cache(fapl_id, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0)
+ TEST_ERROR;
+ rdcc_nbytes = 0;
+ if (H5Pset_cache(fapl_id, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0)
+ TEST_ERROR;
+
+ return SUCCEED;
+error:
+ return FAIL;
+} /* end disable_chunk_cache() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Tests the plugin module (H5PL)
+ *
+ * Return: EXIT_SUCCESS/EXIT_FAILURE
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
+{
+ char filename[FILENAME_BUF_SIZE];
+ hid_t fid = -1;
+ hid_t old_ff_fapl_id = -1;
+ hid_t new_ff_fapl_id = -1;
+ unsigned new_format;
+ int nerrors = 0;
+
+ /* Testing setup */
+ h5_reset();
+
+ /*******************************************************************/
+ /* ENSURE THAT WRITING TO DATASETS AND CREATING GROUPS WORKS */
+ /*******************************************************************/
+
+ /* Get a VFD-dependent filename */
+ if ((old_ff_fapl_id = h5_fileaccess()) < 0)
+ TEST_ERROR;
+
+ /* Turn off the chunk cache, so all the chunks are immediately written to disk */
+ if (disable_chunk_cache(old_ff_fapl_id) < 0)
+ TEST_ERROR;
+
+ /* Copy the file access property list and set the latest file format on it */
+ if ((new_ff_fapl_id = H5Pcopy(old_ff_fapl_id)) < 0)
+ TEST_ERROR;
+ if (H5Pset_libver_bounds(new_ff_fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR;
+
+ /* Fix up the filename for the VFD */
+ h5_fixname(FILENAME[0], old_ff_fapl_id, filename, sizeof(filename));
+
+ /* Test with old & new format groups */
+ for (new_format = FALSE; new_format <= TRUE; new_format++) {
+ hid_t my_fapl_id;
+
+ /* Set the FAPL for the type of format */
+ if (new_format) {
+ HDputs("\nTesting with new file format:");
+ my_fapl_id = new_ff_fapl_id;
+ }
+ else {
+ HDputs("Testing with old file format:");
+ my_fapl_id = old_ff_fapl_id;
+ }
+
+ /* Create the file for this test */
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl_id)) < 0)
+ TEST_ERROR;
+
+ /* Test creating datasets and writing to them using plugin filters */
+ nerrors += (test_dataset_write_with_filters(fid) < 0 ? 1 : 0);
+
+ /* Test creating groups using dynamically-loaded plugin filters */
+ nerrors += (test_creating_groups_using_plugins(fid) < 0 ? 1 : 0);
+
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+ } /* end for */
+
+ /* Close FAPLs */
+ if (H5Pclose(old_ff_fapl_id) < 0)
+ TEST_ERROR;
+ if (H5Pclose(new_ff_fapl_id) < 0)
+ TEST_ERROR;
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
+ /*******************************************************************/
+ /* ENSURE THAT READING FROM DATASETS AND OPENING GROUPS WORKS */
+ /*******************************************************************/
+
+ HDputs("\nTesting reading data with with dynamic plugin filters:");
+
+ /* Close the library so that all loaded plugin libraries are unloaded */
+ h5_reset();
+ if ((old_ff_fapl_id = h5_fileaccess()) < 0)
+ TEST_ERROR;
+
+ /* Reopen the file for testing data reading */
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, old_ff_fapl_id)) < 0)
+ TEST_ERROR;
+
+ /* Read the data with filters */
+ nerrors += (test_dataset_read_with_filters(fid) < 0 ? 1 : 0);
+
+ /* Test creating groups using dynamically-loaded plugin filters */
+ nerrors += (test_opening_groups_using_plugins(fid) < 0 ? 1 : 0);
+
+ /* Restore the default error handler (set in h5_reset()) */
+ h5_restore_err();
+
+ /*******************************************************************/
+ /* ENSURE THAT DISABLING FILTER PLUGINS VIA THE FILTER FLAGS WORKS */
+ /*******************************************************************/
+
+ /* Close the library so that all loaded plugin libraries are unloaded */
+ h5_reset();
+ if ((old_ff_fapl_id = h5_fileaccess()) < 0)
+ TEST_ERROR;
+
+ /* Reopen the file for testing data reading */
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, old_ff_fapl_id)) < 0)
+ TEST_ERROR;
+
+ /* When filters are disabled, make sure we can't read data from a
+ * dataset that requires a filter plugin.
+ */
+ nerrors += (test_no_read_when_plugins_disabled(fid) < 0 ? 1 : 0);
+
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+
+ /************************************/
+ /* TEST THE FILTER PLUGIN API CALLS */
+ /************************************/
+
+ /* Test the APIs for access to the filter plugin path table */
+ nerrors += (test_path_api_calls() < 0 ? 1 : 0);
+
+ /*********************/
+ /* CLEAN UP AND EXIT */
+ /*********************/
+
+ /* Free up saved arrays */
+ free_2D_array(&orig_deflate_g);
+ free_2D_array(&orig_dynlib1_g);
+ free_2D_array(&orig_dynlib2_g);
+ free_2D_array(&orig_dynlib4_g);
+
+ if (nerrors)
+ TEST_ERROR;
+
+ HDprintf("All plugin tests passed.\n");
+ h5_cleanup(FILENAME, old_ff_fapl_id);
+
+ HDexit(EXIT_SUCCESS);
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(fid);
+ H5Pclose(old_ff_fapl_id);
+ H5Pclose(new_ff_fapl_id);
+ } H5E_END_TRY
+
+ /* Free up saved arrays (NULLs okay) */
+ free_2D_array(&orig_deflate_g);
+ free_2D_array(&orig_dynlib1_g);
+ free_2D_array(&orig_dynlib2_g);
+ free_2D_array(&orig_dynlib4_g);
+
+ nerrors = MAX(1, nerrors);
+ HDprintf("***** %d PLUGIN TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
+ HDexit(EXIT_FAILURE);
+} /* end main() */
+
diff --git a/test/filter_plugin1_dsets.c b/test/filter_plugin1_dsets.c
new file mode 100644
index 0000000..b74e086
--- /dev/null
+++ b/test/filter_plugin1_dsets.c
@@ -0,0 +1,93 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: Test dataset filter plugin for the filter_pluging.c test.
+ */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "H5PLextern.h"
+
+#define FILTER1_ID 257
+
+static size_t add_sub_value(unsigned int flags, size_t cd_nelmts,
+ const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+
+/* Filter class struct */
+const H5Z_class2_t FILTER_INFO[1] = {{
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ FILTER1_ID, /* Filter ID number */
+ 1, /* Encoding enabled */
+ 1, /* Decoding enabled */
+ "test filter plugin 1", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ (H5Z_func_t)add_sub_value, /* The actual filter function */
+}};
+
+H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
+const void *H5PLget_plugin_info(void) {return FILTER_INFO;}
+
+
+/*-------------------------------------------------------------------------
+ * Function: add_sub_value
+ *
+ * Purpose: On write:
+ * Adds a caller-supplied value to the element
+ * On read:
+ * Subtracts a caller-supplied value from the element
+ *
+ * Return: Success: Data chunk size in bytes
+ * Failure: 0
+ *
+ *-------------------------------------------------------------------------
+ */
+static size_t
+add_sub_value(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf)
+{
+ int *int_ptr = (int *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+ int value = 0; /* Data value to add/subtract */
+
+ /* Check for the correct number of parameters */
+ if (0 == cd_nelmts)
+ return 0;
+
+ /* Check that permanent parameters are set correctly */
+ if (cd_values[0] > 9)
+ return 0;
+
+ value = (int)cd_values[0];
+
+ if (flags & H5Z_FLAG_REVERSE) {
+ /* READ - Substract the given value from all the data values */
+ while (buf_left > 0) {
+ *int_ptr++ -= value;
+ buf_left -= sizeof(int);
+ }
+ }
+ else {
+ /* WRITE - Add the given value to all the data values */
+ while (buf_left > 0) {
+ *int_ptr++ += value;
+ buf_left -= sizeof(int);
+ }
+ }
+
+ return nbytes;
+
+} /* end add_sub_value() */
+
diff --git a/test/filter_plugin2_dsets.c b/test/filter_plugin2_dsets.c
new file mode 100644
index 0000000..6a79148
--- /dev/null
+++ b/test/filter_plugin2_dsets.c
@@ -0,0 +1,88 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: Test dataset filter plugin for the filter_pluging.c test.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "H5PLextern.h"
+
+#define FILTER2_ID 258
+#define MULTIPLIER 3
+
+static size_t mult_div_value(unsigned int flags, size_t cd_nelmts,
+ const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+
+/* Filter class struct */
+const H5Z_class2_t FILTER_INFO[1] = {{
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ FILTER2_ID, /* Filter ID number */
+ 1, /* Encoding enabled */
+ 1, /* Decoding enabled */
+ "test filter plugin 2", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ (H5Z_func_t)mult_div_value, /* The actual filter function */
+}};
+
+H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
+const void *H5PLget_plugin_info(void) {return FILTER_INFO;}
+
+
+/*-------------------------------------------------------------------------
+ * Function: mult_div_value
+ *
+ * Purpose: On write:
+ * Multiplies an element by a constant value.
+ * On read:
+ * Divides an element by a constant value.
+ *
+ * Return: Success: Data chunk size in bytes
+ * Failure: 0
+ *
+ *-------------------------------------------------------------------------
+ */
+static size_t
+mult_div_value(unsigned int flags, size_t cd_nelmts,
+ const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf)
+{
+ int *int_ptr = (int *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+
+ /* Check for the correct number of parameters */
+ if (cd_nelmts > 0)
+ return 0;
+
+ /* Assignment to eliminate unused parameter warning */
+ cd_values = cd_values;
+
+ if (flags & H5Z_FLAG_REVERSE) {
+ /* READ - Divide the original value by MULTIPLIER */
+ while (buf_left > 0) {
+ *int_ptr++ /= MULTIPLIER;
+ buf_left -= sizeof(int);
+ }
+ }
+ else {
+ /* WRITE - Multiply the original value by MULTIPLIER */
+ while (buf_left > 0) {
+ *int_ptr++ *= MULTIPLIER;
+ buf_left -= sizeof(int);
+ }
+ }
+
+ return nbytes;
+} /* end mult_div_value() */
+
diff --git a/test/filter_plugin3_dsets.c b/test/filter_plugin3_dsets.c
new file mode 100644
index 0000000..b43020f
--- /dev/null
+++ b/test/filter_plugin3_dsets.c
@@ -0,0 +1,119 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: Test dataset filter plugin for the filter_pluging.c test.
+ * This filter makes an HDF5 API call to ensure that works correctly.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "H5PLextern.h"
+
+#define FILTER3_ID 259
+
+#define PUSH_ERR(func, minor, str) H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, H5E_ERR_CLS, H5E_PLUGIN, minor, str)
+
+static size_t add_sub_value_hdf5(unsigned int flags, size_t cd_nelmts,
+ const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+
+/* Filter class struct */
+const H5Z_class2_t FILTER_INFO[1] = {{
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ FILTER3_ID, /* Filter ID number */
+ 1, /* Encoding enabled */
+ 1, /* Decoding enabled */
+ "test filter plugin 3", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ (H5Z_func_t)add_sub_value_hdf5, /* The actual filter function */
+}};
+
+H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
+const void *H5PLget_plugin_info(void) {return FILTER_INFO;}
+
+
+/*-------------------------------------------------------------------------
+ * Function: add_sub_value_hdf5
+ *
+ * Purpose: On write:
+ * Adds a caller-supplied value to the element
+ * On read:
+ * Subtracts a caller-supplied value from the element
+ *
+ * NOTE: This filter is identical to filter #1 only it makes
+ * an HDF5 library call to ensure doing that doesn't
+ * cause problems.
+ *
+ * Return: Success: Data chunk size in bytes
+ * Failure: 0
+ *
+ *-------------------------------------------------------------------------
+ */
+static size_t
+add_sub_value_hdf5(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf)
+{
+ int *int_ptr = (int *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+ int value = 0; /* Data value to add/subtract */
+ unsigned majnum = 0; /* Output data from the HDF5 library call */
+ unsigned minnum = 0;
+ unsigned relnum = 0;
+
+ /* Check for the library version.
+ * We don't do anything with this information - it's just to ensure that
+ * HDF5 library calls work properly from inside filter plugins.
+ */
+ if (H5get_libversion(&majnum, &minnum, &relnum) < 0) {
+ PUSH_ERR("filter plugin 3", H5E_CALLBACK, "H5get_libversion");
+ return 0;
+ }
+
+ /* Check for the correct number of parameters */
+ if (cd_nelmts == 0)
+ return 0;
+
+ /* Check that permanent parameters are set correctly */
+ if (cd_values[0] > 9)
+ return 0;
+
+ /* Ensure that the version numbers match what was passed in.
+ * Again, this is trivial work, just to ensure that the library calls are
+ * working properly.
+ */
+ if (majnum != cd_values[1] || minnum != cd_values[2]) {
+ PUSH_ERR("filter plugin 3", H5E_CALLBACK, "library versions do not match");
+ return 0;
+ }
+
+ value = (int)cd_values[0];
+
+ if (flags & H5Z_FLAG_REVERSE) {
+ /* READ - Substract the given value from all the data values */
+ while (buf_left > 0) {
+ *int_ptr++ -= value;
+ buf_left -= sizeof(int);
+ }
+ }
+ else {
+ /* WRITE - Add the given value to all the data values */
+ while (buf_left > 0) {
+ *int_ptr++ += value;
+ buf_left -= sizeof(int);
+ }
+ }
+
+ return nbytes;
+} /* end add_sub_value_hdf5() */
+
diff --git a/test/filter_plugin4_groups.c b/test/filter_plugin4_groups.c
new file mode 100644
index 0000000..88ea20d
--- /dev/null
+++ b/test/filter_plugin4_groups.c
@@ -0,0 +1,106 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: Test group filter plugin for the filter_pluging.c test.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "H5PLextern.h"
+
+#define FILTER4_ID 260
+#define SUFFIX_LEN 8
+#define GROUP_SUFFIX ".h5group"
+
+static size_t append_to_group_name(unsigned int flags, size_t cd_nelmts,
+ const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+
+/* Filter class struct */
+const H5Z_class2_t FILTER_INFO[1] = {{
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ FILTER4_ID, /* Filter ID number */
+ 1, /* Encoding enabled */
+ 1, /* Decoding enabled */
+ "test filter plugin 4", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ (H5Z_func_t)append_to_group_name, /* The actual filter function */
+}};
+
+H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
+const void *H5PLget_plugin_info(void) {return FILTER_INFO;}
+
+
+/*-------------------------------------------------------------------------
+ * Function: append_to_group_name
+ *
+ * Purpose: On write:
+ * Appends the suffix ".h5group" to the group name
+ * On read:
+ * Removes the ".h5group" suffix from the group name
+ *
+ * Return: Success: Data size in bytes
+ * Failure: 0
+ *
+ *-------------------------------------------------------------------------
+ */
+static size_t
+append_to_group_name(unsigned int flags, size_t cd_nelmts,
+ const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf)
+{
+ size_t new_name_size = 0; /* Return value */
+
+ /* Check for the correct number of parameters */
+ if (cd_nelmts > 0)
+ return 0;
+
+ /* Assignment to eliminate unused parameter warning. */
+ cd_values = cd_values;
+
+ if (flags & H5Z_FLAG_REVERSE) {
+ /* READ - Remove the suffix from the group name */
+ new_name_size = *buf_size = nbytes - SUFFIX_LEN;
+ }
+ else {
+ /* WRITE - Append the suffix to the group name */
+ void *outbuf = NULL; /* Pointer to new buffer */
+ unsigned char *dst = NULL; /* Temporary pointer to destination buffer */
+
+ /* Get memory for the new, larger string buffer using the
+ * library's memory allocator.
+ */
+ if (NULL == (dst = (unsigned char *)(outbuf = H5allocate_memory(nbytes + SUFFIX_LEN, 0))))
+ return 0;
+
+ /* Copy raw data */
+ memcpy((void *)dst, (const void *)(*buf), nbytes);
+
+ /* Append suffix to raw data for storage */
+ dst += nbytes;
+ memcpy((void *)dst, (const void *)GROUP_SUFFIX, SUFFIX_LEN);
+
+ /* Free the passed-in buffer using the library's allocator */
+ H5free_memory(*buf);
+
+ /* Set return values */
+ *buf_size = nbytes + SUFFIX_LEN;
+ *buf = outbuf;
+ outbuf = NULL;
+ new_name_size = *buf_size;
+ }
+
+ return new_name_size;
+} /* append_to_group_name() */
+
diff --git a/test/plugin.c b/test/plugin.c
deleted file mode 100644
index ea199f6..0000000
--- a/test/plugin.c
+++ /dev/null
@@ -1,1217 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
- * If you do not have access to either file, you may request a copy from *
- * help@hdfgroup.org. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/*
- * Purpose: Tests the plugin module (H5PL)
- */
-
-#include "h5test.h"
-#include "H5srcdir.h"
-
-/*
- * This file needs to access private datatypes from the H5Z and H5PL package.
- */
-#define H5PL_FRIEND
-#include "H5PLpkg.h"
-#define H5Z_FRIEND
-#include "H5Zpkg.h"
-
-/* Filters for HDF5 internal test */
-#define H5Z_FILTER_DYNLIB1 257
-#define H5Z_FILTER_DYNLIB2 258
-#define H5Z_FILTER_DYNLIB3 259
-#define H5Z_FILTER_DYNLIB4 260
-
-const char *FILENAME[] = {
- "plugin",
- NULL
-};
-#define FILENAME_BUF_SIZE 1024
-
-/* Dataset names for testing filters */
-#define DSET_DEFLATE_NAME "deflate"
-#define DSET_DYNLIB1_NAME "dynlib1"
-#define DSET_DYNLIB2_NAME "dynlib2"
-#define DSET_DYNLIB4_NAME "dynlib4"
-
-/* Parameters for internal filter test */
-#define FILTER_CHUNK_DIM1 2
-#define FILTER_CHUNK_DIM2 25
-#define FILTER_HS_OFFSET1 7
-#define FILTER_HS_OFFSET2 30
-#define FILTER_HS_SIZE1 4
-#define FILTER_HS_SIZE2 50
-
-/* Shared global arrays */
-#define DSET_DIM1 100
-#define DSET_DIM2 200
-
-/* Limit random number within 20000 */
-#define RANDOM_LIMIT 20000
-
-#define GROUP_ITERATION 1000
-
-int points_deflate[DSET_DIM1][DSET_DIM2],
- points_dynlib1[DSET_DIM1][DSET_DIM2],
- points_dynlib2[DSET_DIM1][DSET_DIM2],
- points_dynlib4[DSET_DIM1][DSET_DIM2],
- points_bzip2[DSET_DIM1][DSET_DIM2];
-
-
-/*-------------------------------------------------------------------------
- * Function: test_filter_internal
- *
- * Purpose: Tests writing entire data and partial data with filters
- *
- * Return: Success: 0
- * Failure: -1
- *-------------------------------------------------------------------------
- */
-static herr_t
-test_filter_internal(hid_t fid, const char *name, hid_t dcpl)
-{
- herr_t ret_value = -1;
- hid_t dataset = -1; /* Dataset ID */
- hid_t dxpl = -1; /* Dataset xfer property list ID */
- hid_t write_dxpl = -1; /* Dataset xfer property list ID for writing */
- hid_t sid = -1; /* Dataspace ID */
- const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
- const hsize_t hs_offset[2] = {FILTER_HS_OFFSET1, FILTER_HS_OFFSET2}; /* Hyperslab offset */
- const hsize_t hs_size[2] = {FILTER_HS_SIZE1, FILTER_HS_SIZE2}; /* Hyperslab size */
- void *tconv_buf = NULL; /* Temporary conversion buffer */
- int points[DSET_DIM1][DSET_DIM2], check[DSET_DIM1][DSET_DIM2];
- size_t i, j; /* Local index variables */
- int n = 0;
-
- /* Create the data space */
- if((sid = H5Screate_simple(2, size, NULL)) < 0) TEST_ERROR
-
- /*
- * Create a small conversion buffer to test strip mining. We
- * might as well test all we can!
- */
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
- tconv_buf = HDmalloc((size_t)1000);
- if(H5Pset_buffer(dxpl, (size_t)1000, tconv_buf, NULL) < 0) TEST_ERROR
- if((write_dxpl = H5Pcopy(dxpl)) < 0) TEST_ERROR;
-
- TESTING(" filters (setup)");
-
- /* Check if all the filters are available */
- if(H5Pall_filters_avail(dcpl) != TRUE) {
- H5_FAILED();
- HDprintf(" Line %d: Incorrect filter availability\n", __LINE__);
- TEST_ERROR
- } /* end if */
-
- /* Create the dataset */
- if((dataset = H5Dcreate2(fid, name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR
-
- PASSED();
-
- /*----------------------------------------------------------------------
- * STEP 1: Read uninitialized data. It should be zero.
- *----------------------------------------------------------------------
- */
- TESTING(" filters (uninitialized read)");
-
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) TEST_ERROR;
-
- for(i=0; i<(size_t)size[0]; i++)
- for(j=0; j<(size_t)size[1]; j++)
- if(0 != check[i][j]) {
- H5_FAILED();
- HDprintf(" Read a non-zero value.\n");
- HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
- TEST_ERROR
- } /* end if */
- PASSED();
-
- /*----------------------------------------------------------------------
- * STEP 2: Test filters by setting up a chunked dataset and writing
- * to it.
- *----------------------------------------------------------------------
- */
- TESTING(" filters (write)");
-
- n = 0;
- for(i=0; i<size[0]; i++)
- for(j=0; j<size[1]; j++)
- points[i][j] = (int)(n++);
-
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points) < 0) TEST_ERROR;
-
- PASSED();
-
- /*----------------------------------------------------------------------
- * STEP 3: Try to read the data we just wrote.
- *----------------------------------------------------------------------
- */
- TESTING(" filters (read)");
-
- /* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) TEST_ERROR;
-
- /* Check that the values read are the same as the values written */
- for(i=0; i<size[0]; i++)
- for(j=0; j<size[1]; j++)
- if(points[i][j] != check[i][j]) {
- H5_FAILED();
- HDfprintf(stderr," Read different values than written.\n");
- HDfprintf(stderr," At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
- HDfprintf(stderr," At original: %d\n", (int)points[i][j]);
- HDfprintf(stderr," At returned: %d\n", (int)check[i][j]);
- TEST_ERROR
- } /* end if */
-
- PASSED();
-
- /*----------------------------------------------------------------------
- * STEP 4: Write new data over the top of the old data. The new data is
- * random thus not very compressible, and will cause the chunks to move
- * around as they grow. We only change values for the left half of the
- * dataset although we rewrite the whole thing.
- *----------------------------------------------------------------------
- */
- TESTING(" filters (modify)");
-
- for(i=0; i<size[0]; i++)
- for(j=0; j<size[1]/2; j++)
- points[i][j] = (int)HDrandom () % RANDOM_LIMIT;
-
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points) < 0) TEST_ERROR;
-
- /* Read the dataset back and check it */
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) TEST_ERROR;
-
- /* Check that the values read are the same as the values written */
- for(i=0; i<size[0]; i++)
- for(j=0; j<size[1]; j++)
- if(points[i][j] != check[i][j]) {
- H5_FAILED();
- HDprintf(" Read different values than written.\n");
- HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
- TEST_ERROR
- } /* end if */
-
- PASSED();
-
- /*----------------------------------------------------------------------
- * STEP 5: Close the dataset and then open it and read it again. This
- * insures that the filters message is picked up properly from the
- * object header.
- *----------------------------------------------------------------------
- */
- TESTING(" filters (re-open)");
-
- if(H5Dclose(dataset) < 0) TEST_ERROR;
- if((dataset = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) TEST_ERROR;
-
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) TEST_ERROR;
-
- /* Check that the values read are the same as the values written */
- for(i = 0; i < size[0]; i++)
- for(j = 0; j < size[1]; j++)
- if(points[i][j] != check[i][j]) {
- H5_FAILED();
- HDprintf(" Read different values than written.\n");
- HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
- TEST_ERROR
- } /* end if */
-
- PASSED();
-
- /*----------------------------------------------------------------------
- * STEP 6: Test partial I/O by writing to and then reading from a
- * hyperslab of the dataset. The hyperslab does not line up on chunk
- * boundaries (we know that case already works from above tests).
- *----------------------------------------------------------------------
- */
- TESTING(" filters (partial I/O)");
-
- for(i=0; i<(size_t)hs_size[0]; i++)
- for(j=0; j<(size_t)hs_size[1]; j++)
- points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j] = (int)HDrandom() % RANDOM_LIMIT;
-
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) TEST_ERROR;
- /* (Use the "read" DXPL because partial I/O on corrupted data test needs to ignore errors during writing) */
- if(H5Dwrite(dataset, H5T_NATIVE_INT, sid, sid, dxpl, points) < 0) TEST_ERROR;
-
- if(H5Dread(dataset, H5T_NATIVE_INT, sid, sid, dxpl, check) < 0) TEST_ERROR;
-
- /* Check that the values read are the same as the values written */
- for(i=0; i<(size_t)hs_size[0]; i++)
- for(j=0; j<(size_t)hs_size[1]; j++)
- if(points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j] != check[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]) {
- H5_FAILED();
- HDfprintf(stderr," Read different values than written.\n");
- HDfprintf(stderr," At index %lu,%lu\n", (unsigned long)((size_t)hs_offset[0]+i), (unsigned long)((size_t)hs_offset[1]+j));
- HDfprintf(stderr," At original: %d\n", (int)points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]);
- HDfprintf(stderr," At returned: %d\n", (int)check[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]);
- TEST_ERROR
- } /* end if */
-
- PASSED();
-
- /* Save the data written to the file for later comparison when the file
- * is reopened for read test */
- for(i=0; i<size[0]; i++)
- for(j=0; j<size[1]; j++)
- if(!HDstrcmp(name, DSET_DEFLATE_NAME))
- points_deflate[i][j] = points[i][j];
- else if(!HDstrcmp(name, DSET_DYNLIB1_NAME))
- points_dynlib1[i][j] = points[i][j];
- else if(!HDstrcmp(name, DSET_DYNLIB2_NAME))
- points_dynlib2[i][j] = points[i][j];
- else if(!HDstrcmp(name, DSET_DYNLIB4_NAME))
- points_dynlib4[i][j] = points[i][j];
-
- ret_value = 0;
-
-error:
- /* Clean up objects used for this test */
- H5E_BEGIN_TRY {
- H5Dclose(dataset);
- H5Sclose(sid);
- H5Pclose(dxpl);
- } H5E_END_TRY
-
- if(tconv_buf)
- HDfree(tconv_buf);
- return ret_value;
-}
-
-/*-------------------------------------------------------------------------
- * Function: test_filters_for_datasets
- *
- * Purpose: Tests creating datasets and writing data with dynamically loaded filters
- *
- * Return: Success: 0
- * Failure: -1
- *-------------------------------------------------------------------------
- */
-static herr_t
-test_filters_for_datasets(hid_t file)
-{
- herr_t ret_value = -1;
- hid_t dc = -1; /* Dataset creation property list ID */
- const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */
- unsigned int compress_level = 9;
- unsigned int dynlib4_values[4];
-
- /*----------------------------------------------------------
- * STEP 1: Test deflation by itself.
- *----------------------------------------------------------
- */
- HDputs("Testing deflate filter");
-#ifdef H5_HAVE_FILTER_DEFLATE
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) TEST_ERROR
- if(H5Pset_deflate(dc, 6) < 0) TEST_ERROR
-
- if(test_filter_internal(file, DSET_DEFLATE_NAME, dc) < 0) TEST_ERROR
- /* Clean up objects used for this test */
- if(H5Pclose(dc) < 0) TEST_ERROR
-#else /* H5_HAVE_FILTER_DEFLATE */
- SKIPPED();
- HDputs(" Deflate filter not enabled");
-#endif /* H5_HAVE_FILTER_DEFLATE */
-
- /*----------------------------------------------------------
- * STEP 2: Test DYNLIB1 by itself.
- *----------------------------------------------------------
- */
- HDputs(" DYNLIB1 filter");
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) TEST_ERROR
- if(H5Pset_filter(dc, H5Z_FILTER_DYNLIB1, H5Z_FLAG_MANDATORY, (size_t)1, &compress_level) < 0) TEST_ERROR
-
- if(test_filter_internal(file, DSET_DYNLIB1_NAME, dc) < 0) TEST_ERROR
-
- /* Clean up objects used for this test */
- if(H5Pclose(dc) < 0) TEST_ERROR
-
- /* Unregister the dynamic filter DYNLIB1 for testing purpose. The next time when this test is run for
- * the new file format, the library's H5PL code has to search in the table of loaded plugin libraries
- * for this filter. */
- if(H5Zunregister(H5Z_FILTER_DYNLIB1) < 0) TEST_ERROR
-
- /*----------------------------------------------------------
- * STEP 3: Test DYNLIB2 by itself.
- *----------------------------------------------------------
- */
- HDputs(" DYNLIB2 filter");
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) TEST_ERROR
- if(H5Pset_filter(dc, H5Z_FILTER_DYNLIB2, H5Z_FLAG_MANDATORY, 0, NULL) < 0) TEST_ERROR
-
- if(test_filter_internal(file,DSET_DYNLIB2_NAME,dc) < 0) TEST_ERROR
-
- /* Clean up objects used for this test */
- if(H5Pclose(dc) < 0) TEST_ERROR
-
- /* Unregister the dynamic filter DYNLIB2 for testing purpose. The next time when this test is run for
- * the new file format, the library's H5PL code has to search in the table of loaded plugin libraries
- * for this filter. */
- if(H5Zunregister(H5Z_FILTER_DYNLIB2) < 0) TEST_ERROR
-
- /*----------------------------------------------------------
- * STEP 4: Test DYNLIB4 by itself.
- *----------------------------------------------------------
- */
- HDputs(" DYNLIB4 filter");
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) TEST_ERROR
- dynlib4_values[0] = 9;
- if(H5get_libversion(&dynlib4_values[1], &dynlib4_values[2], &dynlib4_values[3]) < 0) TEST_ERROR
- if(H5Pset_filter(dc, H5Z_FILTER_DYNLIB4, H5Z_FLAG_MANDATORY, (size_t)4, dynlib4_values) < 0) TEST_ERROR
-
- if(test_filter_internal(file, DSET_DYNLIB4_NAME, dc) < 0) TEST_ERROR
-
- /* Clean up objects used for this test */
- if(H5Pclose(dc) < 0) TEST_ERROR
-
- /* Unregister the dynamic filter DYNLIB4 for testing purpose. The next time when this test is run for
- * the new file format, the library's H5PL code has to search in the table of loaded plugin libraries
- * for this filter. */
- if(H5Zunregister(H5Z_FILTER_DYNLIB4) < 0) TEST_ERROR
-
- ret_value = 0;
-
-error:
- /* Clean up objects used for this test */
- H5E_BEGIN_TRY {
- H5Pclose(dc);
- } H5E_END_TRY
-
- return ret_value;
-}
-
-/*-------------------------------------------------------------------------
- * Function: test_read_data
- *
- * Purpose: Tests reading data and compares values
- *
- * Return: Success: 0
- * Failure: -1
- *-------------------------------------------------------------------------
- */
-static herr_t
-test_read_data(hid_t dataset, int *origin_data)
-{
- herr_t ret_value = -1;
- int check[DSET_DIM1][DSET_DIM2];
- const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
- int *data_p = origin_data;
- size_t i, j; /* Local index variables */
-
- /* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) TEST_ERROR;
-
- /* Check that the values read are the same as the values written */
- for(i=0; i<size[0]; i++)
- for(j=0; j<size[1]; j++) {
- if(*data_p != check[i][j]) {
- H5_FAILED();
- HDfprintf(stderr," Read different values than written.\n");
- HDfprintf(stderr," At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
- HDfprintf(stderr," At original: %d\n", *data_p);
- HDfprintf(stderr," At returned: %d\n", (int)check[i][j]);
- TEST_ERROR
- } /* end if */
- data_p++;
- }
-
- PASSED();
- ret_value = 0;
-
-error:
- return ret_value;
-}
-
-/*-------------------------------------------------------------------------
- * Function: test_read_with_filters
- *
- * Purpose: Tests reading dataset created with dynamically loaded filters
- *
- * Return: Success: 0
- * Failure: -1
- *-------------------------------------------------------------------------
- */
-static herr_t
-test_read_with_filters(hid_t file)
-{
- herr_t ret_value = -1;
- hid_t dset = -1; /* Dataset ID */
-
- /*----------------------------------------------------------
- * STEP 1: Test deflation by itself.
- *----------------------------------------------------------
- */
- TESTING("deflate filter");
-
-#ifdef H5_HAVE_FILTER_DEFLATE
- if(H5Zfilter_avail(H5Z_FILTER_DEFLATE) != TRUE) TEST_ERROR
-
- if((dset = H5Dopen2(file,DSET_DEFLATE_NAME,H5P_DEFAULT)) < 0) TEST_ERROR
-
- if(test_read_data(dset, (int *)points_deflate) < 0) TEST_ERROR
-
- if(H5Dclose(dset) < 0) TEST_ERROR
-
- /* Clean up objects used for this test */
-#else /* H5_HAVE_FILTER_DEFLATE */
- SKIPPED();
- HDputs(" Deflate filter not enabled");
-#endif /* H5_HAVE_FILTER_DEFLATE */
-
- /*----------------------------------------------------------
- * STEP 2: Test DYNLIB1 by itself.
- *----------------------------------------------------------
- */
- TESTING(" DYNLIB1 filter");
-
- if((dset = H5Dopen2(file, DSET_DYNLIB1_NAME, H5P_DEFAULT)) < 0) TEST_ERROR
-
- if(test_read_data(dset, (int *)points_dynlib1) < 0) TEST_ERROR
-
- if(H5Dclose(dset) < 0) TEST_ERROR
-
- /*----------------------------------------------------------
- * STEP 3: Test Bogus2 by itself.
- *----------------------------------------------------------
- */
- TESTING(" DYNLIB2 filter");
-
- if((dset = H5Dopen2(file, DSET_DYNLIB2_NAME, H5P_DEFAULT)) < 0) TEST_ERROR
-
- if(test_read_data(dset, (int *)points_dynlib2) < 0) TEST_ERROR
-
- if(H5Dclose(dset) < 0) TEST_ERROR
-
- /*----------------------------------------------------------
- * STEP 4: Test DYNLIB4 by itself.
- *----------------------------------------------------------
- */
- TESTING(" DYNLIB4 filter");
-
- if((dset = H5Dopen2(file,DSET_DYNLIB4_NAME,H5P_DEFAULT)) < 0) TEST_ERROR
-
- if(test_read_data(dset, (int *)points_dynlib4) < 0) TEST_ERROR
-
- if(H5Dclose(dset) < 0) TEST_ERROR
-
- ret_value = 0;
-
-error:
- /* Clean up objects used for this test */
- H5E_BEGIN_TRY {
- H5Dclose(dset);
- } H5E_END_TRY
-
- return ret_value;
-}
-
-/*-------------------------------------------------------------------------
- * Function: test_noread_data
- *
- * Purpose: Tests not reading data
- *
- * Return: Success: 0
- * Failure: -1
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-test_noread_data(hid_t dataset)
-{
- herr_t ret_value = -1;
- int check[DSET_DIM1][DSET_DIM2];
- herr_t ret = -1;
-
- /* Read the dataset back */
- H5E_BEGIN_TRY {
- ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check);
- } H5E_END_TRY
- if(ret >= 0)
- TEST_ERROR
-
- PASSED();
- ret_value = 0;
-
-error:
- return ret_value;
-}
-
-/*-------------------------------------------------------------------------
- * Function: test_noread_with_filters
- *
- * Purpose: Tests reading dataset created with dynamically loaded filters disabled
- *
- * Return: Success: 0
- * Failure: -1
- *-------------------------------------------------------------------------
- */
-static herr_t
-test_noread_with_filters(hid_t file)
-{
- herr_t ret_value = -1;
- hid_t dset = -1; /* Dataset ID */
- unsigned plugin_state; /* status of plugins */
-
- TESTING("DYNLIB1 filter with plugins disabled");
-
- /* disable filter plugin */
- if(H5PLget_loading_state(&plugin_state) < 0) TEST_ERROR
-
- plugin_state = plugin_state & (unsigned)(~H5PL_FILTER_PLUGIN);
-
- if(H5PLset_loading_state(plugin_state) < 0) TEST_ERROR
-
- if((dset = H5Dopen2(file, DSET_DYNLIB1_NAME, H5P_DEFAULT)) < 0) TEST_ERROR
-
- if(test_noread_data(dset) < 0) TEST_ERROR
-
- if(H5Dclose(dset) < 0) TEST_ERROR
-
- ret_value = 0;
-
-error:
- /* re-enable filter plugin */
- plugin_state = plugin_state | H5PL_FILTER_PLUGIN;
- H5PLset_loading_state(plugin_state);
-
- /* Clean up objects used for this test */
- H5E_BEGIN_TRY {
- H5Dclose(dset);
- } H5E_END_TRY
-
- return ret_value;
-}
-
-/*-------------------------------------------------------------------------
- * Function: test_filters_for_groups
- *
- * Purpose: Tests creating group with dynamically loaded filters
- *
- * Return: Success: 0
- * Failure: -1
- *-------------------------------------------------------------------------
- */
-static herr_t
-test_filters_for_groups(hid_t file)
-{
- herr_t ret_value = -1;
- hid_t gcpl = -1;
- hid_t gid = -1;
- hid_t group = -1;
- int i;
- char gname[256];
-
- TESTING("DYNLIB3 filter for group");
-
- if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
-
- /* Use DYNLIB3 for creating groups */
- if(H5Pset_filter (gcpl, H5Z_FILTER_DYNLIB3, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0) TEST_ERROR
-
- /* Create a group using this filter */
- if((gid = H5Gcreate2(file, "group1", H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) TEST_ERROR
-
- /* Create multiple groups under "group1" */
- for(i=0; i < GROUP_ITERATION; i++) {
- HDsprintf(gname, "group_%d", i);
- if((group = H5Gcreate2(gid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group) < 0) TEST_ERROR
- }
-
- /* Close the group */
- if(H5Gclose(gid) < 0) TEST_ERROR
-
- /* Clean up objects used for this test */
- if(H5Pclose(gcpl) < 0) TEST_ERROR
-
- PASSED();
-
- ret_value = 0;
-
-error:
- /* Clean up objects used for this test */
- H5E_BEGIN_TRY {
- H5Gclose(group);
- H5Gclose(gid);
- H5Pclose(gcpl);
- } H5E_END_TRY
-
- return ret_value;
-}
-
-/*-------------------------------------------------------------------------
- * Function: test_groups_with_filters
- *
- * Purpose: Tests opening group with dynamically loaded filters
- *
- * Return: Success: 0
- * Failure: -1
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-test_groups_with_filters(hid_t file)
-{
- herr_t ret_value = -1;
- hid_t gid = -1;
- hid_t group = -1;
- int i;
- char gname[256];
-
- TESTING("opening groups with DYNLIB3 filter");
-
- /* Open the top group */
- if((gid = H5Gopen2(file, "group1", H5P_DEFAULT)) < 0) TEST_ERROR
-
- /* Create multiple groups under "group1" */
- for(i=0; i < GROUP_ITERATION; i++) {
- HDsprintf(gname, "group_%d", i);
- if((group = H5Gopen2(gid, gname, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group) < 0) TEST_ERROR
- }
-
- /* Close the group */
- if(H5Gclose(gid) < 0) TEST_ERROR
-
- PASSED();
-
- ret_value = 0;
-
-error:
- /* Clean up objects used for this test */
- H5E_BEGIN_TRY {
- H5Gclose(group);
- H5Gclose(gid);
- } H5E_END_TRY
-
- return ret_value;
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: test_path_api_calls
- *
- * Purpose: Tests the H5PL API calls that manipulate the plugin search
- * paths.
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-test_path_api_calls(void)
-{
- unsigned int n_starting_paths;
- unsigned int u;
- unsigned int n_paths;
- herr_t ret;
- ssize_t path_len = -1;
- char path[256];
- char temp_name[256];
-
- HDputs("Testing access to the filter path table");
-
- if(H5Zfilter_avail(H5Z_FILTER_DYNLIB1) != TRUE)
- TEST_ERROR
-
- /* Set the number of paths to create for this test.
- *
- * This should be set high enough to ensure that at least one array
- * expansion will take place. See H5PLpath.c for details.
- */
- n_starting_paths = 42;
-
- /* Check that initialization is correct */
- TESTING(" initialize");
-
- if(H5PLsize(&n_paths) < 0)
- TEST_ERROR
- if(n_paths != 2)
- TEST_ERROR
-
- PASSED();
-
- /****************/
- /* H5PLremove() */
- /****************/
-
- /* Remove all the current paths */
- TESTING(" remove");
-
- /* Get the current size */
- if(H5PLsize(&n_paths) < 0)
- TEST_ERROR
-
- /* Remove all existing paths */
- for(u = n_paths; u > 0; u--)
- if(H5PLremove(u-1) < 0) {
- HDfprintf(stderr," at %u: %s\n", u, path);
- TEST_ERROR
- }
-
- /* Verify the table is empty */
- if(H5PLsize(&n_paths) < 0)
- TEST_ERROR
- if(n_paths > 0)
- TEST_ERROR
-
- PASSED();
-
-
- TESTING(" remove (index 0 in empty table)");
-
- /* Try to remove index zero in an empty list (SHOULD FAIL) */
- H5E_BEGIN_TRY {
- ret = H5PLremove(0);
- } H5E_END_TRY
- if(ret >= 0)
- TEST_ERROR
-
- PASSED();
-
-
- /****************/
- /* H5PLappend() */
- /****************/
-
- TESTING(" append");
-
- /* Add a bunch of paths to the path table */
- for(u = 0; u < n_starting_paths; u++) {
- HDsprintf(path, "a_path_%u", u);
- if(H5PLappend(path) < 0) {
- HDfprintf(stderr," at %u: %s\n", u, path);
- TEST_ERROR
- }
- }
-
- PASSED();
-
-
- /**********************/
- /* H5PLremove() again */
- /**********************/
-
- TESTING(" remove (index too high)");
-
- /* Try to remove a path where the index is beyond the table capacity (SHOULD FAIL) */
- H5E_BEGIN_TRY {
- ret = H5PLremove(n_starting_paths);
- } H5E_END_TRY
-
- if(ret >= 0)
- TEST_ERROR
-
- PASSED();
-
-
- /*************/
- /* H5PLget() */
- /*************/
-
- TESTING(" get (path name)");
-
- /* Get the path length by passing in NULL */
- if((path_len = H5PLget(0, NULL, 0)) <= 0) {
- HDfprintf(stderr," get path 0 length failed\n");
- TEST_ERROR
- }
- if(path_len != 8)
- TEST_ERROR
-
- /* Get the path */
- if((path_len = H5PLget(0, path, 256)) <= 0) {
- HDfprintf(stderr," get 0 len: %u : %s\n", path_len, path);
- TEST_ERROR
- }
- if(HDstrcmp(path, "a_path_0") != 0) {
- HDfprintf(stderr," get 0: %s\n", path);
- TEST_ERROR
- }
-
- PASSED();
-
-
- TESTING(" get (high and low indices)");
-
- /* Get path at index 1 */
- if((path_len = H5PLget(1, path, 256)) <= 0)
- TEST_ERROR
- if(HDstrcmp(path, "a_path_1") != 0) {
- HDfprintf(stderr," get 1: %s\n", path);
- TEST_ERROR
- }
-
- /* Get path at the last index */
- if((path_len = H5PLget(n_starting_paths - 1, path, 256)) <= 0)
- TEST_ERROR
- HDsprintf(temp_name, "a_path_%u", n_starting_paths - 1);
- if(HDstrcmp(path, temp_name) != 0) {
- HDfprintf(stderr," get %u: %s\n", n_starting_paths - 1, path);
- TEST_ERROR
- }
-
- PASSED();
-
-
- TESTING(" get (index too high)");
-
- /* Get path at the last + 1 index (SHOULD FAIL) */
- H5E_BEGIN_TRY {
- path_len = H5PLget(n_starting_paths, NULL, 0);
- } H5E_END_TRY
- if(path_len > 0)
- TEST_ERROR
-
- PASSED();
-
-
- /*****************/
- /* H5PLprepend() */
- /*****************/
-
- /* We'll remove a path at an arbitrary index and then
- * prepend a new path.
- */
-
- TESTING(" remove (arbitrary index 1)");
-
- /* Remove one path */
- if(H5PLremove(8) < 0)
- TEST_ERROR
-
- /* Verify that the entries were moved */
- if((path_len = H5PLget(8, path, 256)) <= 0)
- TEST_ERROR
- if(HDstrcmp(path, "a_path_9") != 0) {
- HDfprintf(stderr," get 8: %s\n", path);
- TEST_ERROR
- }
-
- /* Verify the table shrank */
- if(H5PLsize(&n_paths) < 0)
- TEST_ERROR
- if(n_paths != n_starting_paths - 1)
- TEST_ERROR
-
- PASSED();
-
-
- TESTING(" prepend");
-
- /* Prepend one path */
- HDsprintf(path, "a_path_%d", n_starting_paths + 1);
- if(H5PLprepend(path) < 0) {
- HDfprintf(stderr," prepend %u: %s\n", n_starting_paths + 1, path);
- TEST_ERROR
- }
-
- /* Verify the table increased */
- if(H5PLsize(&n_paths) < 0)
- TEST_ERROR
- if(n_paths != n_starting_paths)
- TEST_ERROR
-
- /* Verify that the entries were moved */
- if(H5PLget(8, path, 256) <= 0)
- TEST_ERROR
- if(HDstrcmp(path, "a_path_7") != 0) {
- HDfprintf(stderr," get 8: %s\n", path);
- TEST_ERROR
- }
-
- /* Verify that the path was inserted at index zero */
- if(H5PLget(0, path, 256) <= 0)
- TEST_ERROR
- HDsprintf(temp_name, "a_path_%d", n_starting_paths + 1);
- if(HDstrcmp(path, temp_name) != 0) {
- HDfprintf(stderr," get 0: %s\n", path);
- TEST_ERROR
- }
-
- PASSED();
-
-
- /*****************/
- /* H5PLreplace() */
- /*****************/
-
- TESTING(" replace");
-
- /* Replace one path at index 1 */
- HDsprintf(path, "a_path_%u", n_starting_paths + 4);
- if(H5PLreplace(path, 1) < 0) {
- HDfprintf(stderr," replace 1: %s\n", path);
- TEST_ERROR
- }
-
- /* Verify the table size remained the same */
- if(H5PLsize(&n_paths) < 0)
- TEST_ERROR
- if(n_paths != n_starting_paths)
- TEST_ERROR
-
- /* Verify that the entries were not moved by
- * inspecting the paths at indices +/- 1.
- */
-
- /* Check path at index 0 */
- if(H5PLget(0, path, 256) <= 0)
- TEST_ERROR
- HDsprintf(temp_name, "a_path_%u", n_starting_paths + 1);
- if(HDstrcmp(path, temp_name) != 0) {
- HDfprintf(stderr," get 0: %s\n", path);
- TEST_ERROR
- }
-
- /* Check path at index 2 */
- if(H5PLget(2, path, 256) <= 0)
- TEST_ERROR
- if(HDstrcmp(path, "a_path_1") != 0) {
- HDfprintf(stderr," get 2: %s\n", path);
- TEST_ERROR
- }
-
- PASSED();
-
-
- /****************/
- /* H5PLinsert() */
- /****************/
-
- /* We'll remove a path at an arbitrary index and then
- * insert a new path.
- */
-
- TESTING(" remove (arbitrary index 2)");
-
- /* Remove one path */
- if(H5PLremove(4) < 0)
- TEST_ERROR
-
- /* Verify that the entries were moved */
- if(H5PLget(4, path, 256) <= 0)
- TEST_ERROR
- if(HDstrcmp(path, "a_path_4") != 0) {
- HDfprintf(stderr," get 4: %s\n", path);
- TEST_ERROR
- }
-
- /* Verify the table size */
- if(H5PLsize(&n_paths) < 0)
- TEST_ERROR
- if(n_paths != n_starting_paths - 1)
- TEST_ERROR
- PASSED();
-
-
- TESTING(" insert");
-
- /* Insert one path at index 3*/
- HDsprintf(path, "a_path_%d", n_starting_paths + 5);
- if(H5PLinsert(path, 3) < 0) {
- HDfprintf(stderr," insert 3: %s\n", path);
- TEST_ERROR
- }
-
- /* Verify that the entries were moved */
- if(H5PLget(4, path, 256) <= 0)
- TEST_ERROR
- if(HDstrcmp(path, "a_path_2") != 0) {
- HDfprintf(stderr," get 4: %s\n", path);
- TEST_ERROR
- }
-
- /* Verify the table size increased */
- if(H5PLsize(&n_paths) < 0)
- TEST_ERROR
- if(n_paths != n_starting_paths)
- TEST_ERROR
-
- PASSED();
-
-
- /****************/
- /* H5PLremove() */
- /****************/
-
- /* Remove all the current paths */
- TESTING(" remove (all)");
-
- /* Get the current size */
- if(H5PLsize(&n_paths) < 0)
- TEST_ERROR
-
- /* Remove all existing paths */
- for(u = n_paths; u > 0; u--)
- if(H5PLremove(u-1) < 0) {
- HDfprintf(stderr," at %u: %s\n", u, path);
- TEST_ERROR
- }
-
- /* Verify the table is empty */
- if(H5PLsize(&n_paths) < 0)
- TEST_ERROR
- if(n_paths > 0)
- TEST_ERROR
-
- PASSED();
-
-
- return SUCCEED;
-
-error:
- return FAIL;
-} /* end test_path_api_calls() */
-
-
-/*-------------------------------------------------------------------------
- * Function: main
- *
- * Purpose: Tests the plugin module (H5PL)
- *
- * Return: EXIT_SUCCESS/EXIT_FAILURE
- *
- *-------------------------------------------------------------------------
- */
-int
-main(void)
-{
- char filename[FILENAME_BUF_SIZE];
- hid_t file = -1;
- hid_t fapl = -1;
- hid_t fapl2 = -1;
- unsigned new_format;
- int mdc_nelmts;
- size_t rdcc_nelmts;
- size_t rdcc_nbytes;
- double rdcc_w0;
- int nerrors = 0;
-
- /* Testing setup */
- h5_reset();
-
- if ((fapl = h5_fileaccess()) < 0)
- TEST_ERROR
-
- /* Turn off the chunk cache, so all the chunks are immediately written to disk */
- if (H5Pget_cache(fapl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0)
- TEST_ERROR
- rdcc_nbytes = 0;
- if (H5Pset_cache(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0)
- TEST_ERROR
-
- /* Copy the file access property list */
- if ((fapl2 = H5Pcopy(fapl)) < 0)
- TEST_ERROR
-
- /* Set the "use the latest version of the format" bounds for creating objects in the file */
- if (H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- TEST_ERROR
-
- h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
-
- /* Test with old & new format groups */
- for (new_format = FALSE; new_format <= TRUE; new_format++) {
- hid_t my_fapl;
-
- /* Set the FAPL for the type of format */
- if (new_format) {
- HDputs("\nTesting with new file format:");
- my_fapl = fapl2;
- }
- else {
- HDputs("Testing with old file format:");
- my_fapl = fapl;
- }
-
- /* Create the file for this test */
- if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- TEST_ERROR
-
- /* Test dynamically loaded filters for chunked dataset */
- nerrors += (test_filters_for_datasets(file) < 0 ? 1 : 0);
-
- /* Test dynamically loaded filters for groups */
- nerrors += (test_filters_for_groups(file) < 0 ? 1 : 0);
-
- if (H5Fclose(file) < 0)
- TEST_ERROR
- } /* end for */
-
- /* Close FAPL */
- if (H5Pclose(fapl2) < 0)
- TEST_ERROR
- if (H5Pclose(fapl) < 0)
- TEST_ERROR
-
- /* Restore the default error handler (set in h5_reset()) */
- h5_restore_err();
-
- HDputs("\nTesting reading data with with dynamic plugin filters:");
-
- /* Close the library so that all loaded plugin libraries are unloaded */
- h5_reset();
- if ((fapl = h5_fileaccess()) < 0)
- TEST_ERROR
-
- /* Reopen the file for testing data reading */
- if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- TEST_ERROR
-
- /* Read the data with filters */
- nerrors += (test_read_with_filters(file) < 0 ? 1 : 0);
-
- /* Open the groups with filters */
- nerrors += (test_groups_with_filters(file) < 0 ? 1 : 0);
-
- /* Restore the default error handler (set in h5_reset()) */
- h5_restore_err();
-
- /* Close the library so that all loaded plugin libraries are unloaded */
- h5_reset();
- if ((fapl = h5_fileaccess()) < 0)
- TEST_ERROR
-
- /* Reopen the file for testing data reading */
- if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- TEST_ERROR
-
- /* Read the data with disabled filters */
- nerrors += (test_noread_with_filters(file) < 0 ? 1 : 0);
-
- if (H5Fclose(file) < 0)
- TEST_ERROR
-
- /* Test the APIs for access to the filter plugin path table */
- nerrors += (test_path_api_calls() < 0 ? 1 : 0);
-
- if (nerrors)
- TEST_ERROR
-
- HDprintf("All plugin tests passed.\n");
- h5_cleanup(FILENAME, fapl);
-
- HDexit(EXIT_SUCCESS);
-
-error:
- nerrors = MAX(1, nerrors);
- HDprintf("***** %d PLUGIN TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
- HDexit(EXIT_FAILURE);
-} /* end main() */
-
diff --git a/test/tattr.c b/test/tattr.c
index 3b0c90e..3786d0d 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -13,7 +13,7 @@
/***********************************************************
*
-* Test program: tattr
+* Test program: tattr
*
* Test the attribute functionality
*
@@ -27,25 +27,25 @@
* This file needs to access private information from the H5O package.
* This file also needs to access the object header testing code.
*/
-#define H5O_FRIEND /*suppress error about including H5Opkg */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
#define H5O_TESTING
-#include "H5Opkg.h" /* Object headers */
+#include "H5Opkg.h" /* Object headers */
/*
* This file needs to access private information from the H5A package.
* This file also needs to access the attribute testing code.
*/
-#define H5A_FRIEND /*suppress error about including H5Apkg */
+#define H5A_FRIEND /*suppress error about including H5Apkg */
#define H5A_TESTING
-#include "H5Apkg.h" /* Attributes */
+#include "H5Apkg.h" /* Attributes */
/*
* This file needs to access private information from the H5F package.
* This file also needs to access the file testing code.
*/
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
-#include "H5Fpkg.h" /* File access */
+#include "H5Fpkg.h" /* File access */
#define FILENAME "tattr.h5"
#define NAME_BUF_SIZE 1024
@@ -55,10 +55,10 @@
#define CORDER_ITER_STOP 3
/* 3-D dataset with fixed dimensions */
-#define SPACE1_RANK 3
-#define SPACE1_DIM1 3
-#define SPACE1_DIM2 15
-#define SPACE1_DIM3 13
+#define SPACE1_RANK 3
+#define SPACE1_DIM1 3
+#define SPACE1_DIM2 15
+#define SPACE1_DIM3 13
/* Dataset Information */
#define DSET1_NAME "Dataset1"
@@ -76,8 +76,8 @@
/* Attribute Rank & Dimensions */
#define ATTR1_NAME "Attr1"
-#define ATTR1_RANK 1
-#define ATTR1_DIM1 3
+#define ATTR1_RANK 1
+#define ATTR1_DIM1 3
int attr_data1[ATTR1_DIM1]={512,-234,98123}; /* Test data for 1st attribute */
/* rank & dimensions for another attribute */
@@ -85,25 +85,25 @@ int attr_data1[ATTR1_DIM1]={512,-234,98123}; /* Test data for 1st attribute */
int attr_data1a[ATTR1_DIM1]={256,11945,-22107};
#define ATTR2_NAME "Attr2"
-#define ATTR2_RANK 2
-#define ATTR2_DIM1 2
-#define ATTR2_DIM2 2
+#define ATTR2_RANK 2
+#define ATTR2_DIM1 2
+#define ATTR2_DIM2 2
int attr_data2[ATTR2_DIM1][ATTR2_DIM2]={{7614,-416},{197814,-3}}; /* Test data for 2nd attribute */
#define ATTR3_NAME "Attr3"
-#define ATTR3_RANK 3
-#define ATTR3_DIM1 2
-#define ATTR3_DIM2 2
-#define ATTR3_DIM3 2
+#define ATTR3_RANK 3
+#define ATTR3_DIM1 2
+#define ATTR3_DIM2 2
+#define ATTR3_DIM3 2
double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3]={{{2.3F,-26.1F}, {0.123F,-10.0F}},{{973.23F,-0.91827F},{2.0F,23.0F}}}; /* Test data for 3rd attribute */
#define ATTR4_NAME "Attr4"
-#define ATTR4_RANK 2
-#define ATTR4_DIM1 2
-#define ATTR4_DIM2 2
-#define ATTR4_FIELDNAME1 "i"
-#define ATTR4_FIELDNAME2 "d"
-#define ATTR4_FIELDNAME3 "c"
+#define ATTR4_RANK 2
+#define ATTR4_DIM1 2
+#define ATTR4_DIM2 2
+#define ATTR4_FIELDNAME1 "i"
+#define ATTR4_FIELDNAME2 "d"
+#define ATTR4_FIELDNAME3 "c"
size_t attr4_field1_off=0;
size_t attr4_field2_off=0;
size_t attr4_field3_off=0;
@@ -115,13 +115,13 @@ struct attr4_struct {
{{-23,981724.2F,'Q'},{0,2.0F,'\n'}}}; /* Test data for 4th attribute */
#define ATTR5_NAME "Attr5"
-#define ATTR5_RANK 0
+#define ATTR5_RANK 0
float attr_data5=-5.123F; /* Test data for 5th attribute */
-#define ATTR6_RANK 3
-#define ATTR6_DIM1 100
-#define ATTR6_DIM2 100
-#define ATTR6_DIM3 100
+#define ATTR6_RANK 3
+#define ATTR6_DIM1 100
+#define ATTR6_DIM2 100
+#define ATTR6_DIM3 100
#define ATTR7_NAME "attr 1 - 000000"
#define ATTR8_NAME "attr 2"
@@ -163,21 +163,21 @@ static herr_t attr_op1(hid_t loc_id, const char *name, const H5A_info_t *ainfo,
static void
test_attr_basic_write(hid_t fapl)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t group; /* Group ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hid_t attr, attr2; /* Attribute ID */
- hsize_t attr_size; /* storage size for attribute */
- ssize_t attr_name_size; /* size of attribute name */
- char *attr_name=NULL; /* name of attribute */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {ATTR1_DIM1};
- hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2};
- int read_data1[ATTR1_DIM1]={0}; /* Buffer for reading 1st attribute */
- int i;
- hid_t ret_id; /* Generic hid_t return value */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t group; /* Group ID */
+ hid_t sid1,sid2; /* Dataspace ID */
+ hid_t attr, attr2; /* Attribute ID */
+ hsize_t attr_size; /* storage size for attribute */
+ ssize_t attr_name_size; /* size of attribute name */
+ char *attr_name=NULL; /* name of attribute */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {ATTR1_DIM1};
+ hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2};
+ int read_data1[ATTR1_DIM1]={0}; /* Buffer for reading 1st attribute */
+ int i;
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Scalar Attribute Writing Functions\n"));
@@ -278,7 +278,7 @@ test_attr_basic_write(hid_t fapl)
if(attr_name_size > 0) {
attr_name = (char*)HDcalloc((size_t)(attr_name_size + 1), sizeof(char));
CHECK(attr_name, NULL, "HDcalloc");
-
+
if(attr_name) {
ret = (herr_t)H5Aget_name(attr, (size_t)(attr_name_size + 1), attr_name);
CHECK(ret, FAIL, "H5Aget_name");
@@ -314,7 +314,7 @@ test_attr_basic_write(hid_t fapl)
if(attr_name_size > 0) {
attr_name = (char*)HDcalloc((size_t)(attr_name_size+1), sizeof(char));
CHECK(attr_name, NULL, "HDcalloc");
-
+
if(attr_name) {
ret = (herr_t)H5Aget_name(attr2, (size_t)(attr_name_size + 1), attr_name);
CHECK(ret, FAIL, "H5Aget_name");
@@ -402,15 +402,15 @@ test_attr_basic_write(hid_t fapl)
static void
test_attr_basic_read(hid_t fapl)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t group; /* Group ID */
- hid_t attr; /* Attribute ID */
- H5O_info_t oinfo; /* Object info */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t group; /* Group ID */
+ hid_t attr; /* Attribute ID */
+ H5O_info_t oinfo; /* Object info */
int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */
int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */
- int i, j; /* Local index variables */
- herr_t ret; /* Generic return value */
+ int i, j; /* Local index variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Attribute Functions\n"));
@@ -500,7 +500,7 @@ test_attr_flush(hid_t fapl)
set; /* Dataset ID */
double wdata=3.14159F; /* Data to write */
double rdata; /* Data read in */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Attribute Flushing\n"));
@@ -560,15 +560,15 @@ test_attr_flush(hid_t fapl)
static void
test_attr_plist(hid_t fapl)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t plist; /* Property list ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {ATTR1_DIM1};
- H5T_cset_t cset; /* Character set for attributes */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1,sid2; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t plist; /* Property list ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {ATTR1_DIM1};
+ H5T_cset_t cset; /* Character set for attributes */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Attribute Property Lists\n"));
@@ -674,15 +674,15 @@ test_attr_plist(hid_t fapl)
static void
test_attr_compound_write(hid_t fapl)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t tid1; /* Attribute datatype ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {ATTR4_DIM1,ATTR4_DIM2};
- hid_t ret_id; /* Generic hid_t return value */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t tid1; /* Attribute datatype ID */
+ hid_t sid1,sid2; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {ATTR4_DIM1,ATTR4_DIM2};
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Multiple Attribute Functions\n"));
@@ -762,11 +762,11 @@ test_attr_compound_write(hid_t fapl)
static void
test_attr_compound_read(hid_t fapl)
{
- hid_t fid1; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
+ hid_t fid1; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
hid_t space; /* Attribute dataspace */
hid_t type; /* Attribute datatype */
- hid_t attr; /* Attribute ID */
+ hid_t attr; /* Attribute ID */
char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */
int rank; /* Attribute rank */
hsize_t dims[ATTR_MAX_DIMS]; /* Attribute dimensions */
@@ -781,7 +781,7 @@ test_attr_compound_read(hid_t fapl)
ssize_t name_len; /* Length of attribute name */
H5O_info_t oinfo; /* Object info */
int i, j; /* Local index variables */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Attribute Functions\n"));
@@ -830,7 +830,7 @@ test_attr_compound_read(hid_t fapl)
HDstrcmp(fieldname, ATTR4_FIELDNAME3)))
TestErrPrintf("invalid field name for field #%d: %s\n", i, fieldname);
H5free_memory(fieldname);
- } /* end for */
+ } /* end for */
offset = H5Tget_member_offset(type, 0);
VERIFY(offset, attr4_field1_off, "H5Tget_member_offset");
offset = H5Tget_member_offset(type, 1);
@@ -878,7 +878,7 @@ test_attr_compound_read(hid_t fapl)
printf("%d: attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].i=%d\n", __LINE__, i, j, attr_data4[i][j].i, i, j, read_data4[i][j].i);
printf("%d: attribute data different: attr_data4[%d][%d].d=%f, read_data4[%d][%d].d=%f\n", __LINE__, i, j, attr_data4[i][j].d, i, j, read_data4[i][j].d);
TestErrPrintf("%d: attribute data different: attr_data4[%d][%d].c=%c, read_data4[%d][%d].c=%c\n", __LINE__, i, j, attr_data4[i][j].c, i, j, read_data4[i][j].c);
- } /* end if */
+ } /* end if */
/* Verify Name */
name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name);
@@ -912,13 +912,13 @@ test_attr_compound_read(hid_t fapl)
static void
test_attr_scalar_write(hid_t fapl)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hid_t ret_id; /* Generic hid_t return value */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1,sid2; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Attribute Functions\n"));
@@ -978,14 +978,14 @@ test_attr_scalar_write(hid_t fapl)
static void
test_attr_scalar_read(hid_t fapl)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
H5S_class_t stype; /* Dataspace class */
- float rdata = 0.0F; /* Buffer for reading 1st attribute */
+ float rdata = 0.0F; /* Buffer for reading 1st attribute */
H5O_info_t oinfo; /* Object info */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Scalar Attribute Reading Functions\n"));
@@ -1013,8 +1013,8 @@ test_attr_scalar_read(hid_t fapl)
/* Verify the floating-poing value in this way to avoid compiler warning. */
if(!H5_FLT_ABS_EQUAL(rdata, attr_data5))
- printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n",
- "H5Aread", (double)attr_data5, (double)rdata, (int)__LINE__, __FILE__);
+ printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n",
+ "H5Aread", (double)attr_data5, (double)rdata, (int)__LINE__, __FILE__);
/* Get the attribute's dataspace */
sid = H5Aget_space(attr);
@@ -1050,16 +1050,16 @@ test_attr_scalar_read(hid_t fapl)
static void
test_attr_mult_write(hid_t fapl)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {ATTR1_DIM1};
- hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2};
- hsize_t dims4[] = {ATTR3_DIM1,ATTR3_DIM2,ATTR3_DIM3};
- hid_t ret_id; /* Generic hid_t return value */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1,sid2; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {ATTR1_DIM1};
+ hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2};
+ hsize_t dims4[] = {ATTR3_DIM1,ATTR3_DIM2,ATTR3_DIM3};
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Multiple Attribute Functions\n"));
@@ -1170,11 +1170,11 @@ test_attr_mult_write(hid_t fapl)
static void
test_attr_mult_read(hid_t fapl)
{
- hid_t fid1; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
+ hid_t fid1; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
hid_t space; /* Attribute dataspace */
hid_t type; /* Attribute datatype */
- hid_t attr; /* Attribute ID */
+ hid_t attr; /* Attribute ID */
char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */
char temp_name[ATTR_NAME_LEN]; /* Buffer for mangling attribute names */
int rank; /* Attribute rank */
@@ -1185,10 +1185,10 @@ test_attr_mult_read(hid_t fapl)
int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */
int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */
double read_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = {{{0}}}; /* Buffer for reading 3rd attribute */
- ssize_t name_len; /* Length of attribute name */
+ ssize_t name_len; /* Length of attribute name */
H5O_info_t oinfo; /* Object info */
int i, j, k; /* Local index values */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Attribute Functions\n"));
@@ -1432,12 +1432,12 @@ attr_op1(hid_t H5_ATTR_UNUSED loc_id, const char *name, const H5A_info_t H5_ATTR
static void
test_attr_iterate(hid_t fapl)
{
- hid_t file; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
+ hid_t file; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
int count; /* operator data for the iterator */
H5O_info_t oinfo; /* Object info */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Attribute Functions\n"));
@@ -1504,13 +1504,13 @@ test_attr_iterate(hid_t fapl)
static void
test_attr_delete(hid_t fapl)
{
- hid_t fid1; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t attr; /* Attribute ID */
+ hid_t fid1; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t attr; /* Attribute ID */
char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */
ssize_t name_len; /* Length of attribute name */
H5O_info_t oinfo; /* Object info */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Attribute Functions\n"));
@@ -1635,7 +1635,7 @@ test_attr_dtype_shared(hid_t fapl)
H5O_info_t oinfo; /* Object's information */
h5_stat_size_t empty_filesize; /* Size of empty file */
h5_stat_size_t filesize; /* Size of file after modifications */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Shared Datatypes with Attributes\n"));
@@ -1802,17 +1802,17 @@ test_attr_dtype_shared(hid_t fapl)
static void
test_attr_duplicate_ids(hid_t fapl)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t gid1, gid2; /* Group ID */
- hid_t sid1,sid2; /* Dataspace ID */
- hid_t attr, attr2; /* Attribute ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {ATTR1_DIM1};
- int read_data1[ATTR1_DIM1]={0}; /* Buffer for reading 1st attribute */
- int rewrite_data[ATTR1_DIM1]={1234, -423, 9907256}; /* Test data for rewrite */
- int i;
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t gid1, gid2; /* Group ID */
+ hid_t sid1,sid2; /* Dataspace ID */
+ hid_t attr, attr2; /* Attribute ID */
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {ATTR1_DIM1};
+ int read_data1[ATTR1_DIM1]={0}; /* Buffer for reading 1st attribute */
+ int rewrite_data[ATTR1_DIM1]={1234, -423, 9907256}; /* Test data for rewrite */
+ int i;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing operations with two ID handles\n"));
@@ -1830,7 +1830,7 @@ test_attr_duplicate_ids(hid_t fapl)
/* Create a dataset */
dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
+ H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Create dataspace for attribute */
@@ -2047,12 +2047,12 @@ test_attr_duplicate_ids(hid_t fapl)
static int
test_attr_dense_verify(hid_t loc_id, unsigned max_attr)
{
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- hid_t attr; /* Attribute ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ hid_t attr; /* Attribute ID */
unsigned value; /* Attribute value */
unsigned u; /* Local index variable */
int old_nerrs; /* Number of errors when entering this check */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Retrieve the current # of reported errors */
old_nerrs = GetTestNumErrs();
@@ -2117,19 +2117,19 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr)
static void
test_attr_dense_create(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
unsigned max_compact; /* Maximum # of attributes to store compactly */
unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_dense; /* Are attributes stored densely? */
unsigned u; /* Local index variable */
h5_stat_size_t empty_filesize; /* Size of empty file */
h5_stat_size_t filesize; /* Size of file after modifications */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Dense Attribute Storage Creation\n"));
@@ -2248,19 +2248,19 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl)
static void
test_attr_dense_open(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
unsigned max_compact; /* Maximum # of attributes to store compactly */
unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_dense; /* Are attributes stored densely? */
unsigned u; /* Local index variable */
h5_stat_size_t empty_filesize; /* Size of empty file */
h5_stat_size_t filesize; /* Size of file after modifications */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Opening Attributes in Dense Storage\n"));
@@ -2387,20 +2387,20 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl)
static void
test_attr_dense_delete(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
unsigned max_compact; /* Maximum # of attributes to store compactly */
unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_dense; /* Are attributes stored densely? */
unsigned u; /* Local index variable */
h5_stat_size_t empty_filesize; /* Size of empty file */
h5_stat_size_t filesize; /* Size of file after modifications */
H5O_info_t oinfo; /* Object info */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Deleting Attributes in Dense Storage\n"));
@@ -2565,21 +2565,21 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
static void
test_attr_dense_rename(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- char new_attrname[NAME_BUF_SIZE]; /* New name of attribute */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ char new_attrname[NAME_BUF_SIZE]; /* New name of attribute */
unsigned max_compact; /* Maximum # of attributes to store compactly */
unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_dense; /* Are attributes stored densely? */
h5_stat_size_t empty_filesize; /* Size of empty file */
h5_stat_size_t filesize; /* Size of file after modifications */
H5O_info_t oinfo; /* Object info */
unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Renaming Attributes in Dense Storage\n"));
@@ -2724,21 +2724,21 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
static void
test_attr_dense_unlink(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
unsigned max_compact; /* Maximum # of attributes to store compactly */
unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_dense; /* Are attributes stored densely? */
size_t mesg_count; /* # of shared messages */
h5_stat_size_t empty_filesize; /* Size of empty file */
h5_stat_size_t filesize; /* Size of file after modifications */
H5O_info_t oinfo; /* Object info */
unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Unlinking Object with Attributes in Dense Storage\n"));
@@ -2854,19 +2854,19 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl)
static void
test_attr_dense_limits(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
unsigned max_compact, rmax_compact; /* Maximum # of attributes to store compactly */
unsigned min_dense, rmin_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_dense; /* Are attributes stored densely? */
unsigned u; /* Local index variable */
h5_stat_size_t empty_filesize; /* Size of empty file */
h5_stat_size_t filesize; /* Size of file after modifications */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Phase Change Limits For Attributes in Dense Storage\n"));
@@ -3019,23 +3019,23 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl)
static void
test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t gid1, gid2; /* Group ID */
- hid_t sid, sid2; /* Dataspace ID */
- hid_t attr, attr2, add_attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
- hsize_t dims[] = {ATTR1_DIM1};
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t gid1, gid2; /* Group ID */
+ hid_t sid, sid2; /* Dataspace ID */
+ hid_t attr, attr2, add_attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ hsize_t dims[] = {ATTR1_DIM1};
int read_data1[ATTR1_DIM1]={0}; /* Buffer for reading attribute */
int rewrite_data[ATTR1_DIM1]={1234, -423, 9907256}; /* Test data for rewrite */
unsigned scalar_data = 1317; /* scalar data for attribute */
unsigned read_scalar; /* variable for reading attribute*/
unsigned max_compact; /* Maximum # of attributes to store compactly */
unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_dense; /* Are attributes stored densely? */
unsigned u, i; /* Local index variable */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing operations with two IDs for Dense Storage\n"));
@@ -3542,24 +3542,24 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
static void
test_attr_big(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t big_sid; /* "Big" dataspace ID */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t big_sid; /* "Big" dataspace ID */
hsize_t dims[ATTR6_RANK] = {ATTR6_DIM1, ATTR6_DIM2, ATTR6_DIM3}; /* Attribute dimensions */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
unsigned max_compact; /* Maximum # of attributes to store compactly */
unsigned min_dense; /* Minimum # of attributes to store "densely" */
unsigned nshared_indices; /* # of shared message indices */
H5F_libver_t low, high; /* File format bounds */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
unsigned u; /* Local index variable */
h5_stat_size_t empty_filesize; /* Size of empty file */
h5_stat_size_t filesize; /* Size of file after modifications */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Storing 'Big' Attributes in Dense Storage\n"));
@@ -3812,20 +3812,20 @@ test_attr_big(hid_t fcpl, hid_t fapl)
static void
test_attr_null_space(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t null_sid; /* "null" dataspace ID */
- hid_t attr_sid; /* Attribute's dataspace ID */
- hid_t attr; /* Attribute ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t null_sid; /* "null" dataspace ID */
+ hid_t attr_sid; /* Attribute's dataspace ID */
+ hid_t attr; /* Attribute ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
unsigned value; /* Attribute value */
htri_t cmp; /* Results of comparison */
hsize_t storage_size; /* Size of storage for attribute */
H5A_info_t ainfo; /* Attribute info */
h5_stat_size_t empty_filesize; /* Size of empty file */
h5_stat_size_t filesize; /* Size of file after modifications */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Storing Attributes with 'null' dataspace\n"));
@@ -4031,11 +4031,11 @@ static void
test_attr_deprec(hid_t fcpl, hid_t fapl)
{
#ifndef H5_NO_DEPRECATED_SYMBOLS
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Deprecated Attribute Routines\n"));
@@ -4139,15 +4139,15 @@ test_attr_deprec(hid_t fcpl, hid_t fapl)
static void
test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t gid; /* Group ID */
- hid_t sid; /* Dataspace ID */
- hid_t aid; /* Attribute ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ hid_t fid; /* HDF5 File ID */
+ hid_t gid; /* Group ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t aid; /* Attribute ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
unsigned nattr = (new_format ? NATTR_MANY_NEW : NATTR_MANY_OLD); /* Number of attributes */
htri_t exists; /* Whether the attribute exists or not */
unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Storing Many Attributes\n"));
@@ -4268,14 +4268,14 @@ test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl)
static void
test_attr_corder_create_basic(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t dcpl; /* Dataset creation property list ID */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t dcpl; /* Dataset creation property list ID */
unsigned crt_order_flags;/* Creation order flags */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
- herr_t ret; /* Generic return value */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Code for Attributes with Creation Order Info\n"));
@@ -4384,21 +4384,21 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl)
static void
test_attr_corder_create_compact(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dset1, dset2, dset3; /* Dataset IDs */
- hid_t my_dataset; /* Current dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dset1, dset2, dset3; /* Dataset IDs */
+ hid_t my_dataset; /* Current dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
hsize_t nattrs; /* Number of attributes on object */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
unsigned curr_dset; /* Current dataset to work on */
unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Compact Storage of Attributes with Creation Order Info\n"));
@@ -4582,23 +4582,23 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl)
static void
test_attr_corder_create_dense(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dset1, dset2, dset3; /* Dataset IDs */
- hid_t my_dataset; /* Current dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dset1, dset2, dset3; /* Dataset IDs */
+ hid_t my_dataset; /* Current dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
hsize_t nattrs; /* Number of attributes on object */
hsize_t name_count; /* # of records in name index */
hsize_t corder_count; /* # of records in creation order index */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
unsigned curr_dset; /* Current dataset to work on */
unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Dense Storage of Attributes with Creation Order Info\n"));
@@ -4816,7 +4816,7 @@ test_attr_corder_create_reopen(hid_t fcpl, hid_t fapl)
hid_t sid = -1; /* Dataspace ID */
hid_t aid = -1; /* Attribute ID */
int buf; /* Attribute data */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Creating Attributes w/New & Old Format\n"));
@@ -4917,23 +4917,23 @@ test_attr_corder_create_reopen(hid_t fcpl, hid_t fapl)
static void
test_attr_corder_transition(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dset1, dset2, dset3; /* Dataset IDs */
- hid_t my_dataset; /* Current dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dset1, dset2, dset3; /* Dataset IDs */
+ hid_t my_dataset; /* Current dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
hsize_t nattrs; /* Number of attributes on object */
hsize_t name_count; /* # of records in name index */
hsize_t corder_count; /* # of records in creation order index */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
unsigned curr_dset; /* Current dataset to work on */
unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Storage Transitions of Attributes with Creation Order Info\n"));
@@ -5323,28 +5323,28 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
static void
test_attr_corder_delete(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dset1, dset2, dset3; /* Dataset IDs */
- hid_t my_dataset; /* Current dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dset1, dset2, dset3; /* Dataset IDs */
+ hid_t my_dataset; /* Current dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
hsize_t nattrs; /* Number of attributes on object */
hsize_t name_count; /* # of records in name index */
hsize_t corder_count; /* # of records in creation order index */
unsigned reopen_file; /* Whether to re-open the file before deleting group */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
#ifdef LATER
h5_stat_size_t empty_size; /* Size of empty file */
h5_stat_size_t file_size; /* Size of file after operating on it */
#endif /* LATER */
unsigned curr_dset; /* Current dataset to work on */
unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Deleting Object w/Dense Attribute Storage and Creation Order Info\n"));
@@ -5521,7 +5521,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl)
* Purpose: Support routine for attr_info_by_idx, to verify the attribute
* info is correct for a attribute
*
- * Note: This routine assumes that the attributes have been added to the
+ * Note: This routine assumes that the attributes have been added to the
* object in alphabetical order.
*
* Return: Success: 0
@@ -5539,7 +5539,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n,
char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */
H5A_info_t ainfo; /* Attribute info struct */
int old_nerrs; /* Number of errors when entering this check */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Retrieve the current # of reported errors */
old_nerrs = GetTestNumErrs();
@@ -5671,26 +5671,26 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n,
static void
test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dset1, dset2, dset3; /* Dataset IDs */
- hid_t my_dataset; /* Current dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dset1, dset2, dset3; /* Dataset IDs */
+ hid_t my_dataset; /* Current dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
H5A_info_t ainfo; /* Attribute information */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
hsize_t nattrs; /* Number of attributes on object */
hsize_t name_count; /* # of records in name index */
hsize_t corder_count; /* # of records in creation order index */
unsigned use_index; /* Use index on creation order values */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */
unsigned curr_dset; /* Current dataset to work on */
unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Create dataspace for dataset & attributes */
sid = H5Screate(H5S_SCALAR);
@@ -5881,28 +5881,28 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
static void
test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dset1, dset2, dset3; /* Dataset IDs */
- hid_t my_dataset; /* Current dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dset1, dset2, dset3; /* Dataset IDs */
+ hid_t my_dataset; /* Current dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
H5A_info_t ainfo; /* Attribute information */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
hsize_t nattrs; /* Number of attributes on object */
hsize_t name_count; /* # of records in name index */
hsize_t corder_count; /* # of records in creation order index */
H5_index_t idx_type; /* Type of index to operate on */
H5_iter_order_t order; /* Order within in the index */
unsigned use_index; /* Use index on creation order values */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */
unsigned curr_dset; /* Current dataset to work on */
unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Create dataspace for dataset & attributes */
sid = H5Screate(H5S_SCALAR);
@@ -6822,16 +6822,16 @@ attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id,
static void
test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dset1, dset2, dset3; /* Dataset IDs */
- hid_t my_dataset; /* Current dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dset1, dset2, dset3; /* Dataset IDs */
+ hid_t my_dataset; /* Current dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
hsize_t nattrs; /* Number of attributes on object */
hsize_t name_count; /* # of records in name index */
hsize_t corder_count; /* # of records in creation order index */
@@ -6842,10 +6842,10 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
hsize_t idx; /* Start index for iteration */
unsigned use_index; /* Use index on creation order values */
const char *dsetname; /* Name of dataset for attributes */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
unsigned curr_dset; /* Current dataset to work on */
unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Create dataspace for dataset & attributes */
sid = H5Screate(H5S_SCALAR);
@@ -7138,7 +7138,7 @@ attr_open_by_idx_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
H5A_info_t ainfo; /* Attribute info */
int old_nerrs; /* Number of errors when entering this check */
unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Retrieve the current # of reported errors */
old_nerrs = GetTestNumErrs();
@@ -7186,27 +7186,27 @@ attr_open_by_idx_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
static void
test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dset1, dset2, dset3; /* Dataset IDs */
- hid_t my_dataset; /* Current dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dset1, dset2, dset3; /* Dataset IDs */
+ hid_t my_dataset; /* Current dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
hsize_t nattrs; /* Number of attributes on object */
hsize_t name_count; /* # of records in name index */
hsize_t corder_count; /* # of records in creation order index */
H5_index_t idx_type; /* Type of index to operate on */
H5_iter_order_t order; /* Order within in the index */
unsigned use_index; /* Use index on creation order values */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
unsigned curr_dset; /* Current dataset to work on */
unsigned u; /* Local index variable */
- hid_t ret_id; /* Generic hid_t return value */
- herr_t ret; /* Generic return value */
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
/* Create dataspace for dataset & attributes */
sid = H5Screate(H5S_SCALAR);
@@ -7458,10 +7458,10 @@ attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id,
{
hid_t attr_id; /* ID of attribute to test */
H5A_info_t ainfo; /* Attribute info */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
int old_nerrs; /* Number of errors when entering this check */
unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Retrieve the current # of reported errors */
old_nerrs = GetTestNumErrs();
@@ -7534,26 +7534,26 @@ attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id,
static void
test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dset1, dset2, dset3; /* Dataset IDs */
- hid_t my_dataset; /* Current dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dset1, dset2, dset3; /* Dataset IDs */
+ hid_t my_dataset; /* Current dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
hsize_t nattrs; /* Number of attributes on object */
hsize_t name_count; /* # of records in name index */
hsize_t corder_count; /* # of records in creation order index */
unsigned use_index; /* Use index on creation order values */
const char *dsetname; /* Name of dataset for attributes */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
unsigned curr_dset; /* Current dataset to work on */
unsigned u; /* Local index variable */
- hid_t ret_id; /* Generic hid_t return value */
- herr_t ret; /* Generic return value */
+ hid_t ret_id; /* Generic hid_t return value */
+ herr_t ret; /* Generic return value */
/* Create dataspace for dataset & attributes */
sid = H5Screate(H5S_SCALAR);
@@ -7789,25 +7789,25 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
static void
test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t dset1, dset2, dset3; /* Dataset IDs */
- hid_t my_dataset; /* Current dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
+ hid_t fid; /* HDF5 File ID */
+ hid_t dset1, dset2, dset3; /* Dataset IDs */
+ hid_t my_dataset; /* Current dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
- htri_t is_empty; /* Are there any attributes? */
- htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_empty; /* Are there any attributes? */
+ htri_t is_dense; /* Are attributes stored densely? */
hsize_t nattrs; /* Number of attributes on object */
hsize_t name_count; /* # of records in name index */
hsize_t corder_count; /* # of records in creation order index */
unsigned use_index; /* Use index on creation order values */
const char *dsetname; /* Name of dataset for attributes */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
unsigned curr_dset; /* Current dataset to work on */
unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Create dataspace for dataset & attributes */
sid = H5Screate(H5S_SCALAR);
@@ -8012,28 +8012,28 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
static void
test_attr_shared_write(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* File ID */
- hid_t my_fcpl; /* File creation property list ID */
- hid_t dataset, dataset2; /* Dataset IDs */
- hid_t attr_tid; /* Attribute's datatype ID */
- hid_t sid, big_sid; /* Dataspace IDs */
- hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute */
+ hid_t fid; /* File ID */
+ hid_t my_fcpl; /* File creation property list ID */
+ hid_t dataset, dataset2; /* Dataset IDs */
+ hid_t attr_tid; /* Attribute's datatype ID */
+ hid_t sid, big_sid; /* Dataspace IDs */
+ hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute */
unsigned max_compact; /* Maximum # of attributes to store compactly */
unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
- htri_t is_shared; /* Is attributes shared? */
+ htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_shared; /* Is attributes shared? */
hsize_t shared_refcount; /* Reference count of shared attribute */
unsigned attr_value; /* Attribute value */
- unsigned *big_value; /* Data for "big" attribute */
+ unsigned *big_value; /* Data for "big" attribute */
size_t mesg_count; /* # of shared messages */
unsigned test_shared; /* Index over shared component type */
unsigned u; /* Local index variable */
h5_stat_size_t empty_filesize; /* Size of empty file */
h5_stat_size_t filesize; /* Size of file after modifications */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Writing Shared & Unshared Attributes in Compact & Dense Storage\n"));
@@ -8342,29 +8342,29 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
static void
test_attr_shared_rename(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* HDF5 File ID */
- hid_t my_fcpl; /* File creation property list ID */
- hid_t dataset, dataset2; /* Dataset ID2 */
- hid_t attr_tid; /* Attribute's datatype ID */
- hid_t sid, big_sid; /* Dataspace IDs */
- hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute on first dataset */
- char attrname2[NAME_BUF_SIZE]; /* Name of attribute on second dataset */
+ hid_t fid; /* HDF5 File ID */
+ hid_t my_fcpl; /* File creation property list ID */
+ hid_t dataset, dataset2; /* Dataset ID2 */
+ hid_t attr_tid; /* Attribute's datatype ID */
+ hid_t sid, big_sid; /* Dataspace IDs */
+ hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute on first dataset */
+ char attrname2[NAME_BUF_SIZE]; /* Name of attribute on second dataset */
unsigned max_compact; /* Maximum # of attributes to store compactly */
unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
- htri_t is_shared; /* Is attributes shared? */
+ htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_shared; /* Is attributes shared? */
hsize_t shared_refcount; /* Reference count of shared attribute */
unsigned attr_value; /* Attribute value */
- unsigned *big_value; /* Data for "big" attribute */
+ unsigned *big_value; /* Data for "big" attribute */
size_t mesg_count; /* # of shared messages */
unsigned test_shared; /* Index over shared component type */
unsigned u; /* Local index variable */
h5_stat_size_t empty_filesize; /* Size of empty file */
h5_stat_size_t filesize; /* Size of file after modifications */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Renaming Shared & Unshared Attributes in Compact & Dense Storage\n"));
@@ -8789,28 +8789,28 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
static void
test_attr_shared_delete(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* File ID */
- hid_t my_fcpl; /* File creation property list ID */
- hid_t dataset, dataset2; /* Dataset IDs */
- hid_t attr_tid; /* Attribute's datatype ID */
- hid_t sid, big_sid; /* Dataspace IDs */
- hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute on first dataset */
+ hid_t fid; /* File ID */
+ hid_t my_fcpl; /* File creation property list ID */
+ hid_t dataset, dataset2; /* Dataset IDs */
+ hid_t attr_tid; /* Attribute's datatype ID */
+ hid_t sid, big_sid; /* Dataspace IDs */
+ hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute on first dataset */
unsigned max_compact; /* Maximum # of attributes to store compactly */
unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
- htri_t is_shared; /* Is attributes shared? */
+ htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_shared; /* Is attributes shared? */
hsize_t shared_refcount; /* Reference count of shared attribute */
unsigned attr_value; /* Attribute value */
- unsigned *big_value; /* Data for "big" attribute */
+ unsigned *big_value; /* Data for "big" attribute */
size_t mesg_count; /* # of shared messages */
unsigned test_shared; /* Index over shared component type */
unsigned u; /* Local index variable */
h5_stat_size_t empty_filesize; /* Size of empty file */
h5_stat_size_t filesize; /* Size of file after modifications */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Deleting Shared & Unshared Attributes in Compact & Dense Storage\n"));
@@ -9158,28 +9158,28 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
static void
test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
{
- hid_t fid; /* File ID */
- hid_t my_fcpl; /* File creation property list ID */
- hid_t dataset, dataset2; /* Dataset IDs */
- hid_t attr_tid; /* Attribute's datatype ID */
- hid_t sid, big_sid; /* Dataspace IDs */
- hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */
- hid_t attr; /* Attribute ID */
- hid_t dcpl; /* Dataset creation property list ID */
- char attrname[NAME_BUF_SIZE]; /* Name of attribute on first dataset */
+ hid_t fid; /* File ID */
+ hid_t my_fcpl; /* File creation property list ID */
+ hid_t dataset, dataset2; /* Dataset IDs */
+ hid_t attr_tid; /* Attribute's datatype ID */
+ hid_t sid, big_sid; /* Dataspace IDs */
+ hsize_t big_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; /* Dimensions for "big" attribute */
+ hid_t attr; /* Attribute ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ char attrname[NAME_BUF_SIZE]; /* Name of attribute on first dataset */
unsigned max_compact; /* Maximum # of attributes to store compactly */
unsigned min_dense; /* Minimum # of attributes to store "densely" */
- htri_t is_dense; /* Are attributes stored densely? */
- htri_t is_shared; /* Is attributes shared? */
+ htri_t is_dense; /* Are attributes stored densely? */
+ htri_t is_shared; /* Is attributes shared? */
hsize_t shared_refcount; /* Reference count of shared attribute */
unsigned attr_value; /* Attribute value */
- unsigned *big_value; /* Data for "big" attribute */
+ unsigned *big_value; /* Data for "big" attribute */
size_t mesg_count; /* # of shared messages */
unsigned test_shared; /* Index over shared component type */
unsigned u; /* Local index variable */
h5_stat_size_t empty_filesize; /* Size of empty file */
h5_stat_size_t filesize; /* Size of file after modifications */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Unlinking Object with Shared Attributes in Compact & Dense Storage\n"));
@@ -10578,14 +10578,110 @@ test_attr_bug8(hid_t fcpl, hid_t fapl)
/****************************************************************
**
+** test_attr_bug9(): Test basic H5A (attribute) code.
+** (Really tests object header code).
+** Tests adding several large attributes to an object until
+** they convert to dense storage. The total size of all
+** attributes is larger than 64K, causing the internal
+** object header code to, after merging the deleted
+** messages in to a NULL message, shrink the object header
+** chunk. Do this twice: once with only attributes in the
+** object header chunk and once with a (small) soft link in
+** the chunk as well. In both cases, the shrunk chunk will
+** initally be too small and a new NULL message must be
+** created.
+**
+****************************************************************/
+static void
+test_attr_bug9(hid_t fcpl, hid_t fapl)
+{
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hsize_t dims[1] = {32768}; /* Attribute dimensions */
+ int create_link; /* Whether to create a soft link */
+ unsigned max_compact; /* Setting from fcpl */
+ unsigned min_dense; /* Setting from fcpl */
+ char aname[11]; /* Attribute name */
+ unsigned i; /* Local index variable */
+ herr_t ret; /* Generic return status */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing that attributes can always be added to named datatypes\n"));
+
+ /* Create dataspace */
+ sid = H5Screate_simple(1, dims, NULL);
+ CHECK(sid, FAIL, "H5Screate_simple");
+
+ /* Obtain attribute phase change settings */
+ ret = H5Pget_attr_phase_change(fcpl, &max_compact, &min_dense);
+ CHECK(ret, FAIL, "H5Pget_attr_phase_change");
+
+ /* Run with and without the soft link */
+ for(create_link = 0; create_link < 2; create_link++) {
+ /* Create file */
+ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ /* Create second group */
+ gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(gid, FAIL, "H5Gcreate2");
+
+ /* Close second group */
+ ret = H5Gclose(gid);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Open root group */
+ gid = H5Gopen2(fid, "/", H5P_DEFAULT);
+ CHECK(gid, FAIL, "H5Gopen2");
+
+ /* Create enough attributes to cause a change to dense storage */
+ for(i = 0; i < max_compact + 1; i++) {
+ /* Create attribute */
+ HDsnprintf(aname, sizeof(aname), "%u", i);
+ aid = H5Acreate2(gid, aname, H5T_NATIVE_CHAR, sid, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(aid, FAIL, "H5Acreate2");
+
+ /* Close attribute */
+ ret = H5Aclose(aid);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ /* Create enough soft links that exactly one goes into chunk 1 if
+ * requested */
+ if(i == 0 && create_link) {
+ ret = H5Lcreate_soft("b", gid, "a", H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Lcreate_soft");
+ ret = H5Lcreate_soft("d", gid, "c", H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Lcreate_soft");
+ ret = H5Lcreate_soft("f", gid, "e", H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Lcreate_soft");
+ } /* end if */
+ } /* end for */
+
+ /* Close IDs */
+ ret = H5Gclose(gid);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+ } /* end for */
+
+ /* Close dataspace */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+} /* test_attr_bug9() */
+
+/****************************************************************
+**
** test_attr(): Main H5A (attribute) testing routine.
**
****************************************************************/
void
test_attr(void)
{
- hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */
- hid_t fcpl = (-1), fcpl2 = (-1); /* File creation property lists */
+ hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */
+ hid_t fcpl = (-1), fcpl2 = (-1); /* File creation property lists */
unsigned new_format; /* Whether to use the new format or not */
unsigned use_shared; /* Whether to use shared attributes or not */
herr_t ret; /* Generic return value */
@@ -10724,6 +10820,7 @@ test_attr(void)
test_attr_bug6(my_fcpl, my_fapl); /* Test reading empty attribute */
test_attr_bug7(my_fcpl, my_fapl); /* Test creating and deleting large attributes in ohdr chunk 0 */
test_attr_bug8(my_fcpl, my_fapl); /* Test attribute expanding object header with undecoded messages */
+ test_attr_bug9(my_fcpl, my_fapl); /* Test large attributes converting to dense storage */
} /* end for */
} /* end if */
else {
@@ -10752,6 +10849,7 @@ test_attr(void)
* header format and in fact fails if used with the old format, due
* to the attributes being larger than 64K */
test_attr_bug8(fcpl, my_fapl); /* Test attribute expanding object header with undecoded messages */
+ test_attr_bug9(fcpl, my_fapl); /* Test large attributes converting to dense storage */
} /* end else */
} /* end for */
@@ -10770,13 +10868,13 @@ test_attr(void)
/*-------------------------------------------------------------------------
- * Function: cleanup_attr
+ * Function: cleanup_attr
*
- * Purpose: Cleanup temporary test files
+ * Purpose: Cleanup temporary test files
*
- * Return: none
+ * Return: none
*
- * Programmer: Albert Cheng
+ * Programmer: Albert Cheng
* July 2, 1998
*
* Modifications:
diff --git a/test/tcoords.c b/test/tcoords.c
index d729d4b..f639d4b 100644
--- a/test/tcoords.c
+++ b/test/tcoords.c
@@ -669,22 +669,22 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
void test_coords(void)
{
hid_t fid;
+ hbool_t is_chunk[2] = {TRUE, FALSE};
int i;
- hbool_t is_chunk;
herr_t ret; /* Generic error return */
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fcreate");
- for(i=0, is_chunk=FALSE; i<2; i++, is_chunk++) {
+ for (i = 0; i < 2; i++) {
/* Test H5Sselect_elements with selection of one block of data */
- test_singleEnd_selElements(fid, is_chunk);
+ test_singleEnd_selElements(fid, is_chunk[i]);
/* Test H5Sselect_hyperslab with selection of one block of data */
- test_singleEnd_selHyperslab(fid, is_chunk);
+ test_singleEnd_selHyperslab(fid, is_chunk[i]);
/* Test H5Sselect_hyperslab with selection of multiple blocks of data */
- test_multiple_ends(fid, is_chunk);
+ test_multiple_ends(fid, is_chunk[i]);
}
ret = H5Fclose(fid);
diff --git a/test/test_plugin.sh.in b/test/test_filter_plugin.sh.in
index c90a978..0a45c0f 100644
--- a/test/test_plugin.sh.in
+++ b/test/test_filter_plugin.sh.in
@@ -13,7 +13,7 @@
srcdir=@srcdir@
TOP_BUILDDIR=@top_builddir@
-# Determine backward compatibility options enabled
+# Determine if backward compatibility options enabled
DEPRECATED_SYMBOLS="@DEPRECATED_SYMBOLS@"
EXIT_SUCCESS=0
@@ -23,21 +23,21 @@ nerrors=0
verbose=yes
exit_code=$EXIT_SUCCESS
-TEST_NAME=plugin
+TEST_NAME=filter_plugin
TEST_BIN=`pwd`/$TEST_NAME
FROM_DIR=`pwd`/.libs
case $(uname) in
CYGWIN* )
- PLUGIN_LIB1="$FROM_DIR/cygdynlib1* $FROM_DIR/cygdynlib3*"
- PLUGIN_LIB2="$FROM_DIR/cygdynlib2* $FROM_DIR/cygdynlib4*"
+ PLUGINS_FOR_DIR1="$FROM_DIR/cygfilter_plugin1* $FROM_DIR/cygfilter_plugin3*"
+ PLUGINS_FOR_DIR2="$FROM_DIR/cygfilter_plugin2* $FROM_DIR/cygfilter_plugin4*"
;;
*)
- PLUGIN_LIB1="$FROM_DIR/libdynlib1.* $FROM_DIR/libdynlib3.*"
- PLUGIN_LIB2="$FROM_DIR/libdynlib2.* $FROM_DIR/libdynlib4.*"
+ PLUGINS_FOR_DIR1="$FROM_DIR/libfilter_plugin1* $FROM_DIR/libfilter_plugin3*"
+ PLUGINS_FOR_DIR2="$FROM_DIR/libfilter_plugin2* $FROM_DIR/libfilter_plugin4*"
;;
esac
-PLUGIN_LIBDIR1=testdir1
-PLUGIN_LIBDIR2=testdir2
+PLUGIN_DIR1=filter_plugin_dir1
+PLUGIN_DIR2=filter_plugin_dir2
CP="cp -p" # Use -p to preserve mode,ownership,timestamps
RM="rm -rf"
@@ -50,34 +50,34 @@ TESTING() {
}
# Main Body
-# Create test directories if not exists yet.
-test -d $PLUGIN_LIBDIR1 || mkdir -p $PLUGIN_LIBDIR1
+# Create test directories if necessary.
+test -d $PLUGIN_DIR1 || mkdir -p $PLUGIN_DIR1
if [ $? != 0 ]; then
- echo "Failed to create test directory($PLUGIN_LIBDIR1)"
+ echo "Failed to create filter plugin test directory ($PLUGIN_DIR1)"
exit $EXIT_FAILURE
fi
-test -d $PLUGIN_LIBDIR2 || mkdir -p $PLUGIN_LIBDIR2
+test -d $PLUGIN_DIR2 || mkdir -p $PLUGIN_DIR2
if [ $? != 0 ]; then
- echo "Failed to create test directory($PLUGIN_LIBDIR2)"
+ echo "Failed to create filter plugin test directory ($PLUGIN_DIR2)"
exit $EXIT_FAILURE
fi
-# copy plugin library for test
-$CP $PLUGIN_LIB1 $PLUGIN_LIBDIR1
+# Copy plugins for the tests.
+$CP $PLUGINS_FOR_DIR1 $PLUGIN_DIR1
if [ $? != 0 ]; then
- echo "Failed to copy plugin library ($PLUGIN_LIB1) for test."
+ echo "Failed to copy filter plugins ($PLUGINS_FOR_DIR1) to test directory."
exit $EXIT_FAILURE
fi
-$CP $PLUGIN_LIB2 $PLUGIN_LIBDIR2
+$CP $PLUGINS_FOR_DIR2 $PLUGIN_DIR2
if [ $? != 0 ]; then
- echo "Failed to copy plugin library ($PLUGIN_LIB2) for test."
+ echo "Failed to copy filter plugins ($PLUGINS_FOR_DIR2) to test directory."
exit $EXIT_FAILURE
fi
# setup plugin path
-ENVCMD="env HDF5_PLUGIN_PATH=${PLUGIN_LIBDIR1}:${PLUGIN_LIBDIR2}"
+ENVCMD="env HDF5_PLUGIN_PATH=${PLUGIN_DIR1}:${PLUGIN_DIR2}"
# Run the test
$ENVCMD $TEST_BIN
@@ -87,9 +87,9 @@ fi
############################################
# HDFFV-9655 test for relative path disabled
-# setup plugin path relative to test
+# setup filter plugin path relative to test
# actual executable is in the .libs folder
-#ENVCMD="env HDF5_PLUGIN_PATH=@/../${PLUGIN_LIBDIR1}:@/../${PLUGIN_LIBDIR2}"
+#ENVCMD="env HDF5_PLUGIN_PATH=@/../${PLUGIN_DIR1}:@/../${PLUGIN_DIR2}"
#
# Run the test
#$ENVCMD $TEST_BIN
@@ -103,11 +103,11 @@ if test $nerrors -ne 0 ; then
echo "$nerrors errors encountered"
exit_code=$EXIT_FAILURE
else
- echo "All Plugin API tests passed."
+ echo "All filter plugin tests passed."
exit_code=$EXIT_SUCCESS
fi
# Clean up temporary files/directories and leave
-$RM $PLUGIN_LIBDIR1 $PLUGIN_LIBDIR2
+$RM $PLUGIN_DIR1 $PLUGIN_DIR2
exit $exit_code
diff --git a/test/tfile.c b/test/tfile.c
index d0b1369..41c920f 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -175,39 +175,28 @@ const char *FILESPACE_NAME[] = {
*/
#define FILE8 "tfile8.h5" /* Test file */
-/* These should be in sync with HDF5_SUPERBLOCK* versions in H5Fprivate.h */
-#define SUPERBLOCK_VERSION_DEF 0
-#define SUPERBLOCK_VERSION_1 1
-#define SUPERBLOCK_VERSION_2 2
+/* See HDF5_SUPERBLOCK* versions in H5Fprivate.h */
#define SUPERBLOCK_VERSION_3 3
-#define SUPERBLOCK_VERSION_LATEST SUPERBLOCK_VERSION_3
-/* These should be in sync with HDF5_superblock_ver_bounds[] in H5Fsuper.c */
-const unsigned superblock_ver_bounds[] = {
- SUPERBLOCK_VERSION_DEF, /* H5F_LIBVER_EARLIEST */
- SUPERBLOCK_VERSION_2, /* H5F_LIBVER_V18 */
- SUPERBLOCK_VERSION_LATEST /* H5F_LIBVER_LATEST */
-};
-
-/* These should be in sync with H5O* versions in H5Opkg.h */
+/* See H5O* versions in H5Opkg.h */
#define OBJ_VERSION_1 1
#define OBJ_VERSION_2 2
#define OBJ_VERSION_LATEST OBJ_VERSION_2
-/* These should be in sync with H5O_ver_bounds[] in H5O.c */
+/* These should be in sync with H5O_obj_ver_bounds[] in H5O.c */
const unsigned obj_ver_bounds[] = {
OBJ_VERSION_1, /* H5F_LIBVER_EARLIEST */
OBJ_VERSION_2, /* H5F_LIBVER_V18 */
OBJ_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
-/* These should be in sync with H5O_LAYOUT* versions in H5Oprivate.h */
+/* See H5O_LAYOUT* versions in H5Oprivate.h */
+/* The library defines LAYOUT_VERSION_3 as the default--see H5Pdcpl.c */
#define LAYOUT_VERSION_1 1
-#define LAYOUT_VERSION_2 2
#define LAYOUT_VERSION_3 3
#define LAYOUT_VERSION_4 4
-#define LAYOUT_VERSION_DEFAULT LAYOUT_VERSION_3 /* The library defines the default + H5Pdcpl.c */
-#define LAYOUT_VERSION_LATEST LAYOUT_VERSION_4
+#define LAYOUT_VERSION_DEFAULT LAYOUT_VERSION_3
+#define LAYOUT_VERSION_LATEST LAYOUT_VERSION_4
/* These should be in sync with H5O_layout_ver_bounds[] in H5Dlayout.c */
const unsigned layout_ver_bounds[] = {
@@ -216,23 +205,24 @@ const unsigned layout_ver_bounds[] = {
LAYOUT_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
-/* These should be in sync with H5O_PLINE* versions in H5Oprivate.h */
+/* See H5O_PLINE* versions in H5Oprivate.h */
#define PLINE_VERSION_1 1
#define PLINE_VERSION_2 2
#define PLINE_VERSION_LATEST H5O_PLINE_VERSION_2
/* These should be in sync with H5O_pline_ver_bounds[] in H5Opline.c */
const unsigned pline_ver_bounds[] = {
- PLINE_VERSION_1, /* H5F_LIBVER_EARLIEST */
- PLINE_VERSION_2, /* H5F_LIBVER_V18 */
- PLINE_VERSION_LATEST /* H5F_LIBVER_LATEST */
+ PLINE_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ PLINE_VERSION_2, /* H5F_LIBVER_V18 */
+ PLINE_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
-/* These should be in sync with H5O_FILL* versions in H5Oprivate.h */
+/* See H5O_FILL* versions in H5Oprivate.h */
+/* FILL_VERSION_2 is the default--see H5Pdcpl.c */
#define FILL_VERSION_1 1
#define FILL_VERSION_2 2
#define FILL_VERSION_3 3
-#define FILL_VERSION_DEFAULT FILL_VERSION_2 /* I define it but it is the default in H5Pdcpl.c */
+#define FILL_VERSION_DEFAULT FILL_VERSION_2
#define FILL_VERSION_LATEST H5O_FILL_VERSION_3
/* These should be in sync with H5O_fill_ver_bounds[] in H5Ofill.c */
@@ -248,7 +238,7 @@ const unsigned fill_ver_bounds[] = {
#define DSETB "DSETB"
#define DSETC "DSETC"
-/* These should be in sync with H5O_SDSPACE* versions in H5Spkg.h */
+/* See H5O_SDSPACE* versions in H5Spkg.h */
#define SDSPACE_VERSION_1 1
#define SDSPACE_VERSION_2 2
#define SDSPACE_VERSION_LATEST SDSPACE_VERSION_2
@@ -260,7 +250,7 @@ const unsigned sdspace_ver_bounds[] = {
SDSPACE_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
-/* These should be in sync with H5O_DTYPE* versions in H5Tpkg.h */
+/* See H5O_DTYPE* versions in H5Tpkg.h */
#define DTYPE_VERSION_1 1
#define DTYPE_VERSION_2 2
#define DTYPE_VERSION_3 3
@@ -273,7 +263,7 @@ const unsigned dtype_ver_bounds[] = {
DTYPE_VERSION_LATEST /* H5F_LIBVER_LATEST */
};
-/* These should be in sync with H5O_ATTR* versions in H5Apkg.h */
+/* See H5O_ATTR* versions in H5Apkg.h */
#define ATTR_VERSION_1 1
#define ATTR_VERSION_2 2
#define ATTR_VERSION_3 3
@@ -5130,7 +5120,7 @@ test_libver_bounds_attributes(hid_t fapl)
if(low == H5F_LIBVER_EARLIEST)
VERIFY(attr->shared->version, ATTR_VERSION_2, "attr_ver_bounds");
else
- VERIFY(attr->shared->version, attr_ver_bounds[low], "dtype_ver_bounds");
+ VERIFY(attr->shared->version, attr_ver_bounds[low], "attr_ver_bounds");
/* Close the attribute */
ret = H5Aclose(aid);
@@ -5145,7 +5135,7 @@ test_libver_bounds_attributes(hid_t fapl)
CHECK(attr, NULL, "H5I_object");
/* Verify attribute version */
- VERIFY(attr->shared->version, attr_ver_bounds[low], "dtype_ver_bounds");
+ VERIFY(attr->shared->version, attr_ver_bounds[low], "attr_ver_bounds");
/* Close the attribute */
ret = H5Aclose(aid);
@@ -5169,12 +5159,16 @@ test_libver_bounds_attributes(hid_t fapl)
if(low == H5F_LIBVER_EARLIEST)
VERIFY(attr->shared->version, ATTR_VERSION_3, "attr_ver_bounds");
else
- VERIFY(attr->shared->version, attr_ver_bounds[low], "dtype_ver_bounds");
+ VERIFY(attr->shared->version, attr_ver_bounds[low], "attr_ver_bounds");
/* Close the attribute */
ret = H5Aclose(aid);
CHECK(ret, FAIL, "H5Aclose");
+ /* Close the attribute creation property list */
+ ret = H5Pclose(attr_cpl);
+ CHECK(ret, FAIL, "H5Pclose");
+
/* Close the group */
ret = H5Gclose(gid);
CHECK(ret, FAIL, "H5Gclose");
@@ -5185,7 +5179,7 @@ test_libver_bounds_attributes(hid_t fapl)
/* Close the datatype */
ret = H5Tclose(tid);
- CHECK(ret, FAIL, "H5Sclose");
+ CHECK(ret, FAIL, "H5Tclose");
/* Close the file */
ret = H5Fclose(fid);
@@ -5229,7 +5223,7 @@ test_libver_bounds_attributes(hid_t fapl)
if(low == H5F_LIBVER_EARLIEST)
VERIFY(attr->shared->version, ATTR_VERSION_2, "attr_ver_bounds");
else
- VERIFY(attr->shared->version, attr_ver_bounds[low], "dtype_ver_bounds");
+ VERIFY(attr->shared->version, attr_ver_bounds[low], "attr_ver_bounds");
/* Close the attribute */
ret = H5Aclose(aid);
@@ -5245,13 +5239,13 @@ test_libver_bounds_attributes(hid_t fapl)
/* Close the datatype */
ret = H5Tclose(tid);
- CHECK(ret, FAIL, "H5Sclose");
+ CHECK(ret, FAIL, "H5Tclose");
/* Close the file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
- /* Create a copy of the file pccess roperty list */
+ /* Create a copy of the file access property list */
new_fapl = H5Pcreate(H5P_FILE_ACCESS);
CHECK(new_fapl, FAIL, "H5Pcreate");
@@ -5284,7 +5278,7 @@ test_libver_bounds_attributes(hid_t fapl)
/* Open the group */
gid = H5Gopen2(fid, GRP_NAME, H5P_DEFAULT);
- CHECK(did, FAIL, "H5Dcreate2");
+ CHECK(gid, FAIL, "H5Dcreate2");
/* Create an attribute to the group */
aid = H5Acreate2(gid, "attr1", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -5610,7 +5604,7 @@ test_libver_bounds_dataspace(hid_t fapl)
hid_t did, did_null, did_compact, did_contig; /* Dataset IDs */
hid_t sid, sid_null, sid_compact, sid_contig; /* Dataspace IDs */
hid_t dcpl, dcpl_compact, dcpl_contig; /* Dataset creation property lists */
- H5S_t *space, *space_null, *space_compact, *space_contig; /* Internal dataspace pointers */
+ H5S_t *space, *space_null; /* Internal dataspace pointers */
H5F_t *f; /* Internal file pointer */
H5F_libver_t low, high; /* File format bounds */
hsize_t dims[1] = {1}; /* Dimension sizes */
@@ -5713,6 +5707,9 @@ test_libver_bounds_dataspace(hid_t fapl)
/* Verify the dataspace version for the three datasets */
for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ hid_t tmp_sid, tmp_sid_compact, tmp_sid_contig; /* Dataspace IDs */
+ H5S_t *tmp_space, *tmp_space_compact, *tmp_space_contig; /* Internal dataspace pointers */
+
H5E_BEGIN_TRY {
ret = H5Pset_libver_bounds(new_fapl, low, high);
} H5E_END_TRY;
@@ -5736,34 +5733,34 @@ test_libver_bounds_dataspace(hid_t fapl)
CHECK(did, FAIL, "H5Dcreate2");
/* Get the internal dataspace pointer for the chunked dataset */
- sid = H5Dget_space(did);
- CHECK(sid, FAIL, "H5Dget_space");
- space = (H5S_t *)H5I_object(sid);
- CHECK(space, NULL, "H5I_object");
+ tmp_sid = H5Dget_space(did);
+ CHECK(tmp_sid, FAIL, "H5Dget_space");
+ tmp_space = (H5S_t *)H5I_object(tmp_sid);
+ CHECK(tmp_space, NULL, "H5I_object");
/* Create the compact dataset */
did_compact = H5Dcreate2(fid, DSETB, H5T_NATIVE_INT, sid_compact, H5P_DEFAULT, dcpl_compact, H5P_DEFAULT);
CHECK(did_compact, FAIL, "H5Dcreate2");
/* Get the internal dataspace pointer for the compact dataset */
- sid_compact = H5Dget_space(did_compact);
- CHECK(sid_compact, FAIL, "H5Dget_space");
- space_compact = (H5S_t *)H5I_object(sid_compact);
- CHECK(space_compact, NULL, "H5I_object");
+ tmp_sid_compact = H5Dget_space(did_compact);
+ CHECK(tmp_sid_compact, FAIL, "H5Dget_space");
+ tmp_space_compact = (H5S_t *)H5I_object(tmp_sid_compact);
+ CHECK(tmp_space_compact, NULL, "H5I_object");
/* Create the contiguous dataset */
did_contig = H5Dcreate2(fid, DSETC, H5T_NATIVE_INT, sid_contig, H5P_DEFAULT, dcpl_contig, H5P_DEFAULT);
CHECK(did_contig, FAIL, "H5Dcreate2");
/* Get the internal dataspace pointer for the contiguous dataset */
- sid_contig = H5Dget_space(did_contig);
- CHECK(sid_contig, FAIL, "H5Dget_space");
- space_contig = (H5S_t *)H5I_object(sid_contig);
- CHECK(space_contig, NULL, "H5I_object");
+ tmp_sid_contig = H5Dget_space(did_contig);
+ CHECK(tmp_sid_contig, FAIL, "H5Dget_space");
+ tmp_space_contig = (H5S_t *)H5I_object(tmp_sid_contig);
+ CHECK(tmp_space_contig, NULL, "H5I_object");
- VERIFY(space->extent.version, sdspace_ver_bounds[f->shared->low_bound], "sdspace_ver_bounds");
- VERIFY(space_compact->extent.version, sdspace_ver_bounds[f->shared->low_bound], "sdspace_ver_bounds");
- VERIFY(space_contig->extent.version, sdspace_ver_bounds[f->shared->low_bound], "sdspace_ver_bounds");
+ VERIFY(tmp_space->extent.version, sdspace_ver_bounds[f->shared->low_bound], "sdspace_ver_bounds");
+ VERIFY(tmp_space_compact->extent.version, sdspace_ver_bounds[f->shared->low_bound], "sdspace_ver_bounds");
+ VERIFY(tmp_space_contig->extent.version, sdspace_ver_bounds[f->shared->low_bound], "sdspace_ver_bounds");
/* Close the three datasets */
ret = H5Dclose(did);
@@ -5773,6 +5770,13 @@ test_libver_bounds_dataspace(hid_t fapl)
ret = H5Dclose(did_contig);
CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(tmp_sid_compact);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(tmp_sid_contig);
+ CHECK(ret, FAIL, "H5Sclose");
+
/* Delete the three datasets */
ret = H5Ldelete(fid, DSETA, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Ldelete");
@@ -5853,7 +5857,7 @@ test_libver_bounds_dataset(hid_t fapl)
did = H5Dcreate2(fid, DSETA, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(did, FAIL, "H5Dcreate");
- /* Get the internal file pionter */
+ /* Get the internal dataset pointer */
dset = (H5D_t *)H5I_object(did);
CHECK(dset, NULL, "H5I_object");
@@ -5885,7 +5889,7 @@ test_libver_bounds_dataset(hid_t fapl)
ret = H5Pset_chunk(dcpl, 2, fix_chunks2);
CHECK(ret, FAIL, "H5Pset_chunk");
ret = H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS);
- CHECK(ret, FAIL, "H5Pset_chunk");
+ CHECK(ret, FAIL, "H5Pset_chunk_opts");
H5E_BEGIN_TRY {
did = H5Dcreate2(fid, DSETB, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
@@ -5991,15 +5995,15 @@ test_libver_bounds_dataset(hid_t fapl)
} /* end for */
} /* end for */
- /* CLose the file access property list */
+ /* Close the file access property list */
ret = H5Pclose(new_fapl);
CHECK(ret, FAIL, "H5Pclose");
- /* CLose the dataspace */
+ /* Close the dataspace */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
- /* CLose the dataset creation property list */
+ /* Close the dataset creation property list */
ret = H5Pclose(dcpl);
CHECK(ret, FAIL, "H5Pclose");
@@ -6067,7 +6071,7 @@ test_libver_bounds_obj(hid_t fapl)
CHECK(ret, FAIL, "H5Oget_info");
/* Verify object header version */
- VERIFY(oinfo.hdr.version, obj_ver_bounds[low], "H5Oget_info");
+ VERIFY(oinfo.hdr.version, obj_ver_bounds[low], "obj_ver_bounds");
/* Close the file */
ret = H5Fclose(fid);
@@ -6118,7 +6122,7 @@ test_libver_bounds_obj(hid_t fapl)
CHECK(ret, FAIL, "H5Oget_info");
/* Verify object header version */
- VERIFY(oinfo.hdr.version, obj_ver_bounds[f->shared->low_bound], "H5Oget_info_by_name");
+ VERIFY(oinfo.hdr.version, obj_ver_bounds[f->shared->low_bound], "obj_ver_bounds");
/* Close the group */
ret = H5Gclose(gid);
@@ -6354,6 +6358,10 @@ test_libver_bounds_super(hid_t fapl)
test_libver_bounds_super_open(fapl, fcpl, TRUE);
test_libver_bounds_super_open(fapl, fcpl, FALSE);
+ /* Close fcpl */
+ ret = H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+
/* Create fcpl with non-default v1-btree K value enabled */
fcpl = H5Pcreate(H5P_FILE_CREATE);
CHECK(fcpl, FAIL, "H5Pcreate");
@@ -6369,6 +6377,7 @@ test_libver_bounds_super(hid_t fapl)
test_libver_bounds_super_open(fapl, fcpl, TRUE);
test_libver_bounds_super_open(fapl, fcpl, FALSE);
+ /* Close fcpl */
ret = H5Pclose(fcpl);
CHECK(ret, FAIL, "H5Pclose");
@@ -6388,6 +6397,7 @@ test_libver_bounds_super(hid_t fapl)
test_libver_bounds_super_open(fapl, fcpl, TRUE);
test_libver_bounds_super_open(fapl, fcpl, FALSE);
+ /* Close fcpl */
ret = H5Pclose(fcpl);
CHECK(ret, FAIL, "H5Pclose");
@@ -6405,6 +6415,7 @@ test_libver_bounds_super(hid_t fapl)
test_libver_bounds_super_open(fapl, fcpl, TRUE);
test_libver_bounds_super_open(fapl, fcpl, FALSE);
+ /* Close fcpl */
ret = H5Pclose(fcpl);
CHECK(ret, FAIL, "H5Pclose");
diff --git a/test/tmisc.c b/test/tmisc.c
index 102325a..6da4589 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -30,6 +30,7 @@
#include "testhdf5.h"
#include "H5srcdir.h"
#include "H5Dpkg.h" /* Datasets */
+#include "H5MMprivate.h" /* Memory */
/* Definitions for misc. test #1 */
#define MISC1_FILE "tmisc1.h5"
@@ -5526,6 +5527,64 @@ test_misc33(void)
} /* end test_misc33() */
+/****************************************************************
+**
+** test_misc34(): Ensure zero-size memory allocations work
+**
+****************************************************************/
+static void
+test_misc34(void)
+{
+ void *mem = NULL; /* allocated buffer */
+ char *dup = NULL; /* 'duplicated' string */
+ size_t sz = 0; /* buffer size */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing O and NULL behavior in H5MM API calls"));
+
+ /* H5MM_xfree(): Ensure that passing NULL is allowed and returns NULL */
+ mem = H5MM_xfree(mem);
+ CHECK_PTR_NULL(mem, "H5MM_xfree");
+
+ /* H5MM_malloc(): Ensure that size 0 returns NULL */
+ mem = H5MM_malloc(sz);
+ CHECK_PTR_NULL(mem, "H5MM_malloc");
+ mem = H5MM_xfree(mem);
+
+ /* H5MM_calloc(): Ensure that size 0 returns NULL */
+ mem = H5MM_calloc(sz);
+ CHECK_PTR_NULL(mem, "H5MM_calloc");
+ mem = H5MM_xfree(mem);
+
+ /* H5MM_realloc(): Check behavior:
+ *
+ * H5MM_realloc(NULL, size) <==> H5MM_malloc(size)
+ * H5MM_realloc(ptr, 0) <==> H5MM_xfree(ptr)
+ * H5MM_realloc(NULL, 0) <==> NULL
+ */
+ mem = H5MM_xfree(mem);
+
+ sz = 1024;
+ mem = H5MM_realloc(mem, sz);
+ CHECK_PTR(mem, "H5MM_realloc (case 1)");
+ /* Don't free mem here! */
+
+ sz = 0;
+ mem = H5MM_realloc(mem, sz);
+ CHECK_PTR_NULL(mem, "H5MM_realloc (case 2)");
+ mem = H5MM_xfree(mem);
+
+ mem = H5MM_realloc(mem, sz);
+ CHECK_PTR_NULL(mem, "H5MM_realloc (case 3)");
+ mem = H5MM_xfree(mem);
+
+ /* H5MM_xstrdup(): Ensure NULL returns NULL */
+ dup = H5MM_xstrdup((const char *)mem);
+ CHECK_PTR_NULL(dup, "H5MM_xstrdup");
+ dup = (char *)H5MM_xfree((void *)dup);
+
+} /* end test_misc34() */
+
/****************************************************************
**
@@ -5575,6 +5634,7 @@ test_misc(void)
test_misc31(); /* Test Reentering library through deprecated routines after H5close() */
test_misc32(); /* Test filter memory allocation functions */
test_misc33(); /* Test to verify that H5HL_offset_into() returns error if offset exceeds heap block */
+ test_misc34(); /* Test behavior of 0 and NULL in H5MM API calls */
} /* test_misc() */
@@ -5632,5 +5692,5 @@ cleanup_misc(void)
HDremove(MISC29_COPY_FILE);
HDremove(MISC30_FILE);
HDremove(MISC31_FILE);
-}
+} /* end cleanup_misc() */
diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt
index 0c9f70e..b116d66 100644
--- a/testpar/CMakeLists.txt
+++ b/testpar/CMakeLists.txt
@@ -30,14 +30,14 @@ set (testphdf5_SOURCES
add_executable (testphdf5 ${testphdf5_SOURCES})
TARGET_NAMING (testphdf5 STATIC)
TARGET_C_PROPERTIES (testphdf5 STATIC " " " ")
-target_link_libraries (testphdf5 ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_LIBS})
+target_link_libraries (testphdf5 ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (testphdf5 PROPERTIES FOLDER test/par)
MACRO (ADD_H5P_EXE file)
add_executable (${file} ${HDF5_TEST_PAR_SOURCE_DIR}/${file}.c)
TARGET_NAMING (${file} STATIC)
TARGET_C_PROPERTIES (${file} STATIC " " " ")
- target_link_libraries (${file} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_LIBS})
+ target_link_libraries (${file} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (${file} PROPERTIES FOLDER test/par)
ENDMACRO (ADD_H5P_EXE file)
diff --git a/testpar/CMakeTests.cmake b/testpar/CMakeTests.cmake
index 6e2b05e..87470f3 100644
--- a/testpar/CMakeTests.cmake
+++ b/testpar/CMakeTests.cmake
@@ -16,10 +16,10 @@
##############################################################################
##############################################################################
-add_test (NAME TEST_PAR_testphdf5 COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:testphdf5>)
+add_test (NAME TEST_PAR_testphdf5 COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:testphdf5> ${MPIEXEC_POSTFLAGS})
foreach (testp ${H5P_TESTS})
- add_test (NAME TEST_PAR_${testp} COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:${testp}>)
+ add_test (NAME TEST_PAR_${testp} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:${testp}> ${MPIEXEC_POSTFLAGS})
endforeach ()
# The following will only be correct on windows shared
diff --git a/testpar/t_pread.c b/testpar/t_pread.c
index 7f23b9b..a527503 100644
--- a/testpar/t_pread.c
+++ b/testpar/t_pread.c
@@ -55,6 +55,9 @@ fools.\n";
static int generate_test_file(MPI_Comm comm, int mpi_rank, int group);
static int test_parallel_read(MPI_Comm comm, int mpi_rank, int group);
+static char *test_argv0 = NULL;
+extern char *dirname(char *path); /* Avoids additional includes */
+
/*-------------------------------------------------------------------------
* Function: generate_test_file
@@ -99,11 +102,11 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id )
FILE *header = NULL;
const char *fcn_name = "generate_test_file()";
const char *failure_mssg = NULL;
- const char *group_filename = NULL;
+ char *group_filename = NULL;
char data_filename[FILENAME_BUF_SIZE];
char reloc_data_filename[FILENAME_BUF_SIZE];
char prolog_filename[FILENAME_BUF_SIZE];
- int file_index;
+ int file_index = 0;
int group_size;
int group_rank;
int local_failure = 0;
@@ -162,7 +165,8 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id )
* is used to call into the h5_fixname function. No
* need to worry that we reassign it for each file!
*/
- HDassert((group_filename = FILENAMES[file_index]));
+ group_filename = FILENAMES[file_index];
+ HDassert( group_filename );
/* Assign the 'data_filename' */
if ( h5_fixname(group_filename, H5P_DEFAULT, data_filename,
@@ -174,7 +178,8 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id )
if ( pass ) {
- HDassert( (group_filename = FILENAMES[file_index+1]) );
+ group_filename = FILENAMES[file_index+1];
+ HDassert( group_filename );
/* Assign the 'reloc_data_filename' */
if ( h5_fixname(group_filename, H5P_DEFAULT, reloc_data_filename,
@@ -186,8 +191,8 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id )
}
if ( pass ) {
-
- HDassert( (group_filename = FILENAMES[file_index+2]) );
+ group_filename = FILENAMES[file_index+2];
+ HDassert( group_filename );
/* Assign the 'prolog_filename' */
if ( h5_fixname(group_filename, H5P_DEFAULT, prolog_filename,
@@ -390,9 +395,29 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id )
if ( pass ) {
char cmd[256];
-
- HDsprintf(cmd, "../tools/src/h5jam/h5jam -i %s -u %s -o %s",
- data_filename, prolog_filename, reloc_data_filename);
+ char exe_path[256];
+ char *relative_path = "../tools/src/h5jam";
+ char *exe_dirname = relative_path;
+
+ /* We're checking for the existance of the h5jam utility
+ * With Cmake testing, all binaries are in the same directory
+ * e.g. the same location where this executable is found.
+ * We've copied the argv[0] argument and check to see
+ * if h5jam is co-located here. Otherwise, the autotools
+ * put things into directories, hence the relative path.
+ */
+ if (test_argv0 != NULL) {
+ HDstrncpy(exe_path, test_argv0, sizeof(exe_path));
+ if ( (exe_dirname = (char *)dirname(exe_path)) != NULL) {
+ HDsprintf(cmd, "%s/h5jam", exe_dirname);
+ if ( HDaccess(cmd, F_OK) != 0)
+ exe_dirname = relative_path;
+ }
+ }
+ HDsprintf(cmd, "%s/h5jam -i %s -u %s -o %s",
+ exe_dirname,
+ data_filename,
+ prolog_filename, reloc_data_filename);
if ( system(cmd) != 0 ) {
pass = FALSE;
@@ -678,7 +703,7 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int group_id)
}
/* collect results from other processes.
- * Only overwrite the failure message if no preveious error
+ * Only overwrite the failure message if no previous error
* has been detected
*/
local_failure = ( pass ? 0 : 1 );
@@ -759,6 +784,17 @@ main( int argc, char **argv)
int split_size;
MPI_Comm group_comm = MPI_COMM_WORLD;
+ /* I don't believe that argv[0] can ever be NULL.
+ * It should thus be safe to dup and save as a check
+ * for cmake testing. Note that in our Cmake builds,
+ * all executables are located in the same directory.
+ * We assume (but we'll check) that the h5jam utility
+ * is in the directory as this executable. If that
+ * isn't true, then we can use a relative path that
+ * should be valid for the autotools environment.
+ */
+ test_argv0 = HDstrdup(argv[0]);
+
if ( (MPI_Init(&argc, &argv)) != MPI_SUCCESS) {
HDfprintf(stderr, "FATAL: Unable to initialize MPI\n");
HDexit(EXIT_FAILURE);
@@ -783,11 +819,11 @@ main( int argc, char **argv)
HDfprintf(stdout, "========================================\n");
}
- if ( mpi_size < 4 ) {
+ if ( mpi_size < 3 ) {
if ( mpi_rank == 0 ) {
- HDprintf(" Need at least 4 processes. Exiting.\n");
+ HDprintf(" Need at least 3 processes. Exiting.\n");
}
goto finish;
}
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 0be6f5c..94cca58 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -21,25 +21,25 @@
/*-------------------------------------------------------------------------
* Function: print_objname
*
- * Purpose: check if object name is to be printed, only when:
- * 1) verbose mode
- * 2) when diff was found (normal mode)
+ * Purpose: check if object name is to be printed, only when:
+ * 1) verbose mode
+ * 2) when diff was found (normal mode)
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE int
-print_objname (diff_opt_t * options, hsize_t nfound)
+print_objname (diff_opt_t * opts, hsize_t nfound)
{
- return ((options->m_verbose || nfound) && !options->m_quiet) ? 1 : 0;
+ return ((opts->m_verbose || nfound) && !opts->m_quiet) ? 1 : 0;
}
/*-------------------------------------------------------------------------
* Function: do_print_objname
*
- * Purpose: print object name
- *
+ * Purpose: print object name
*-------------------------------------------------------------------------
*/
-void do_print_objname (const char *OBJ, const char *path1, const char *path2, diff_opt_t * opts)
+void
+do_print_objname (const char *OBJ, const char *path1, const char *path2, diff_opt_t * opts)
{
/* if verbose level is higher than 0, put space line before
* displaying any object or symbolic links. This improves
@@ -53,8 +53,7 @@ void do_print_objname (const char *OBJ, const char *path1, const char *path2, di
/*-------------------------------------------------------------------------
* Function: do_print_attrname
*
- * Purpose: print attribute name
- *
+ * Purpose: print attribute name
*-------------------------------------------------------------------------
*/
void
@@ -66,17 +65,16 @@ do_print_attrname (const char *attr, const char *path1, const char *path2)
/*-------------------------------------------------------------------------
* Function: print_warn
*
- * Purpose: check print warning condition.
+ * Purpose: check print warning condition.
* Return:
- * 1 if verbose mode
- * 0 if not verbos mode
- * Programmer: Jonathan Kim
- * Date: Feb 4, 2010
+ * 1 if verbose mode
+ * 0 if not verbos mode
*-------------------------------------------------------------------------
*/
-static int print_warn(diff_opt_t *options)
+static int
+print_warn(diff_opt_t *opts)
{
- return ((options->m_verbose))?1:0;
+ return ((opts->m_verbose)) ? 1: 0;
}
@@ -84,20 +82,16 @@ static int print_warn(diff_opt_t *options)
/*-------------------------------------------------------------------------
* Function: phdiff_dismiss_workers
*
- * Purpose: tell all workers to end.
- *
- * Return: none
- *
- * Programmer: Albert Cheng
- *
- * Date: Feb 6, 2005
+ * Purpose: tell all workers to end.
*
+ * Return: none
*-------------------------------------------------------------------------
*/
-void phdiff_dismiss_workers(void)
+void
+phdiff_dismiss_workers(void)
{
int i;
- for(i=1; i<g_nTasks; i++)
+ for (i = 1; i < g_nTasks; i++)
MPI_Send(NULL, 0, MPI_BYTE, i, MPI_TAG_END, MPI_COMM_WORLD);
}
@@ -105,29 +99,23 @@ void phdiff_dismiss_workers(void)
/*-------------------------------------------------------------------------
* Function: print_incoming_data
*
- * Purpose: special function that prints any output that has been sent to the manager
- * and is currently sitting in the incoming message queue
- *
- * Return: none
- *
- * Programmer: Leon Arber
- *
- * Date: March 7, 2005
+ * Purpose: special function that prints any output that has been sent to the manager
+ * and is currently sitting in the incoming message queue
*
+ * Return: none
*-------------------------------------------------------------------------
*/
-static void print_incoming_data(void)
+static void
+print_incoming_data(void)
{
- char data[PRINT_DATA_MAX_SIZE+1];
+ char data[PRINT_DATA_MAX_SIZE + 1];
int incomingMessage;
MPI_Status Status;
- do
- {
+ do {
MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &incomingMessage, &Status);
- if(incomingMessage)
- {
+ if(incomingMessage) {
HDmemset(data, 0, PRINT_DATA_MAX_SIZE+1);
MPI_Recv(data, PRINT_DATA_MAX_SIZE, MPI_CHAR, Status.MPI_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &Status);
@@ -140,81 +128,68 @@ static void print_incoming_data(void)
/*-------------------------------------------------------------------------
* Function: is_valid_options
*
- * Purpose: check if options are valid
+ * Purpose: check if options are valid
*
* Return:
- * 1 : Valid
- * 0 : Not valid
- *
- * Programmer: Jonathan Kim
- *
- * Date: Feb 17, 2010
- *
+ * 1 : Valid
+ * 0 : Not valid
*------------------------------------------------------------------------*/
-static int is_valid_options(diff_opt_t *options)
+static int
+is_valid_options(diff_opt_t *opts)
{
- int ret=1; /* init to valid */
+ int ret_value = 1; /* init to valid */
/*-----------------------------------------------
* no -q(quiet) with -v (verbose) or -r (report) */
- if(options->m_quiet && (options->m_verbose || options->m_report))
- {
+ if(opts->m_quiet && (opts->m_verbose || opts->m_report)) {
parallel_print("Error: -q (quiet mode) cannot be added to verbose or report modes\n");
- options->err_stat=1;
- ret = 0;
- goto out;
+ opts->err_stat = 1;
+ HGOTO_DONE(0);
}
/* -------------------------------------------------------
* only allow --no-dangling-links along with --follow-symlinks */
- if(options->no_dangle_links && !options->follow_links)
- {
+ if(opts->no_dangle_links && !opts->follow_links) {
parallel_print("Error: --no-dangling-links must be used along with --follow-symlinks option.\n");
- options->err_stat=1;
- ret = 0;
- goto out;
+ opts->err_stat = 1;
+ HGOTO_DONE(0);
}
-out:
+done:
- return ret;
+ return ret_value;
}
/*-------------------------------------------------------------------------
* Function: is_exclude_path
*
- * Purpose: check if 'paths' are part of exclude path list
+ * Purpose: check if 'paths' are part of exclude path list
*
* Return:
- * 1 - excluded path
- * 0 - not excluded path
- *
- * Programmer: Jonathan Kim
- * Date: Aug 23, 2010
+ * 1 - excluded path
+ * 0 - not excluded path
*------------------------------------------------------------------------*/
-static int is_exclude_path (char * path, h5trav_type_t type, diff_opt_t *options)
+static int
+is_exclude_path (char * path, h5trav_type_t type, diff_opt_t *opts)
{
struct exclude_path_list * exclude_path_ptr;
- int ret_cmp;
- int ret = 0;
+ int ret_cmp;
+ int ret_value = 0;
/* check if exclude path option is given */
- if (!options->exclude_path)
- goto out;
+ if (!opts->exclude_path)
+ HGOTO_DONE(0);
/* assign to local exclude list pointer */
- exclude_path_ptr = options->exclude;
+ exclude_path_ptr = opts->exclude;
/* search objects in exclude list */
- while (NULL != exclude_path_ptr)
- {
+ while (NULL != exclude_path_ptr) {
/* if exclude path is is group, exclude its members as well */
- if (exclude_path_ptr->obj_type == H5TRAV_TYPE_GROUP)
- {
+ if (exclude_path_ptr->obj_type == H5TRAV_TYPE_GROUP) {
ret_cmp = HDstrncmp(exclude_path_ptr->obj_path, path,
HDstrlen(exclude_path_ptr->obj_path));
- if (ret_cmp == 0) /* found matching members */
- {
+ if (ret_cmp == 0) { /* found matching members */
size_t len_grp;
/* check if given path belong to an excluding group, if so
@@ -223,22 +198,19 @@ static int is_exclude_path (char * path, h5trav_type_t type, diff_opt_t *options
* not under “/grp1xxx/” group.
*/
len_grp = HDstrlen(exclude_path_ptr->obj_path);
- if (path[len_grp] == '/')
- {
+ if (path[len_grp] == '/') {
/* belong to excluded group! */
- ret = 1;
+ ret_value = 1;
break; /* while */
}
}
}
/* exclude target is not group, just exclude the object */
- else
- {
+ else {
ret_cmp = HDstrcmp(exclude_path_ptr->obj_path, path);
- if (ret_cmp == 0) /* found matching object */
- {
+ if (ret_cmp == 0) { /* found matching object */
/* excluded non-group object */
- ret = 1;
+ ret_value = 1;
/* remember the type of this maching object.
* if it's group, it can be used for excluding its member
* objects in this while() loop */
@@ -249,26 +221,23 @@ static int is_exclude_path (char * path, h5trav_type_t type, diff_opt_t *options
exclude_path_ptr = exclude_path_ptr->next;
}
-out:
- return ret;
+done:
+ return ret_value;
}
/*-------------------------------------------------------------------------
* Function: free_exclude_path_list
*
- * Purpose: free exclud object list from diff options
- *
- * Programmer: Jonathan Kim
- * Date: Aug 23, 2010
+ * Purpose: free exclude object list from diff options
*------------------------------------------------------------------------*/
-static void free_exclude_path_list(diff_opt_t *options)
+static void
+free_exclude_path_list(diff_opt_t *opts)
{
- struct exclude_path_list * curr = options->exclude;
- struct exclude_path_list * next;
+ struct exclude_path_list *curr = opts->exclude;
+ struct exclude_path_list *next;
- while (NULL != curr)
- {
+ while (NULL != curr) {
next = curr->next;
HDfree(curr);
curr = next;
@@ -278,44 +247,43 @@ static void free_exclude_path_list(diff_opt_t *options)
/*-------------------------------------------------------------------------
* Function: build_match_list
*
- * Purpose: get list of matching path_name from info1 and info2
+ * Purpose: get list of matching path_name from info1 and info2
*
* Note:
- * Find common objects; the algorithm used for this search is the
- * cosequential match algorithm and is described in
- * Folk, Michael; Zoellick, Bill. (1992). File Structures. Addison-Wesley.
- * Moved out from diff_match() to make code more flexible.
+ * Find common objects; the algorithm used for this search is the
+ * cosequential match algorithm and is described in
+ * Folk, Michael; Zoellick, Bill. (1992). File Structures. Addison-Wesley.
+ * Moved out from diff_match() to make code more flexible.
*
* Parameter:
- * table_out [OUT] : return the list
- *
- * Programmer: Jonathan Kim
- *
- * Date: Aug 18, 2010
+ * table_out [OUT] : return the list
*------------------------------------------------------------------------*/
-static void build_match_list (const char *objname1, trav_info_t *info1, const char *objname2, trav_info_t *info2, trav_table_t ** table_out, diff_opt_t *options)
+static void
+build_match_list (const char *objname1, trav_info_t *info1, const char *objname2, trav_info_t *info2,
+ trav_table_t ** table_out, diff_opt_t *opts)
{
- size_t curr1 = 0;
- size_t curr2 = 0;
+ size_t curr1 = 0;
+ size_t curr2 = 0;
unsigned infile[2];
- char * path1_lp;
- char * path2_lp;
+ char *path1_lp = NULL;
+ char *path2_lp = NULL;
h5trav_type_t type1_l;
h5trav_type_t type2_l;
- size_t path1_offset = 0;
- size_t path2_offset = 0;
- int cmp;
- trav_table_t *table;
- size_t idx;
+ size_t path1_offset = 0;
+ size_t path2_offset = 0;
+ int cmp;
+ trav_table_t *table = NULL;
+ size_t idx;
h5difftrace("build_match_list start\n");
/* init */
- trav_table_init( &table );
-
+ trav_table_init(&table);
+ if (table == NULL)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "Cannot create tarverse table");
/*
* This is necessary for the case that given objects are group and
* have different names (ex: obj1 is /grp1 and obj2 is /grp5).
- * All the objects belong to given groups are the cadidates.
+ * All the objects belong to given groups are the candidates.
* So prepare to compare paths without the group names.
*/
@@ -329,8 +297,7 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch
/*--------------------------------------------------
* build the list
*/
- while(curr1 < info1->nused && curr2 < info2->nused)
- {
+ while(curr1 < info1->nused && curr2 < info2->nused) {
path1_lp = (info1->paths[curr1].path) + path1_offset;
path2_lp = (info2->paths[curr2].path) + path2_offset;
type1_l = info1->paths[curr1].type;
@@ -338,19 +305,15 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch
/* criteria is string compare */
cmp = HDstrcmp(path1_lp, path2_lp);
-
- if(cmp == 0)
- {
- if(!is_exclude_path(path1_lp, type1_l, options))
- {
+ if(cmp == 0) {
+ if(!is_exclude_path(path1_lp, type1_l, opts)) {
infile[0] = 1;
infile[1] = 1;
trav_table_addflags(infile, path1_lp, info1->paths[curr1].type, table);
/* if the two point to the same target object,
* mark that in table */
if (info1->paths[curr1].fileno == info2->paths[curr2].fileno &&
- info1->paths[curr1].objno == info2->paths[curr2].objno )
- {
+ info1->paths[curr1].objno == info2->paths[curr2].objno) {
idx = table->nobjs - 1;
table->objs[idx].is_same_trgobj = 1;
}
@@ -358,20 +321,16 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch
curr1++;
curr2++;
} /* end if */
- else if(cmp < 0)
- {
- if(!is_exclude_path(path1_lp, type1_l, options))
- {
+ else if(cmp < 0) {
+ if(!is_exclude_path(path1_lp, type1_l, opts)) {
infile[0] = 1;
infile[1] = 0;
trav_table_addflags(infile, path1_lp, info1->paths[curr1].type, table);
}
curr1++;
} /* end else-if */
- else
- {
- if (!is_exclude_path(path2_lp, type2_l, options))
- {
+ else {
+ if (!is_exclude_path(path2_lp, type2_l, opts)) {
infile[0] = 0;
infile[1] = 1;
trav_table_addflags(infile, path2_lp, info2->paths[curr2].type, table);
@@ -383,13 +342,11 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch
/* list1 did not end */
infile[0] = 1;
infile[1] = 0;
- while(curr1 < info1->nused)
- {
+ while(curr1 < info1->nused) {
path1_lp = (info1->paths[curr1].path) + path1_offset;
type1_l = info1->paths[curr1].type;
- if(!is_exclude_path(path1_lp, type1_l, options))
- {
+ if(!is_exclude_path(path1_lp, type1_l, opts)) {
trav_table_addflags(infile, path1_lp, info1->paths[curr1].type, table);
}
curr1++;
@@ -398,19 +355,17 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch
/* list2 did not end */
infile[0] = 0;
infile[1] = 1;
- while(curr2 < info2->nused)
- {
+ while(curr2 < info2->nused) {
path2_lp = (info2->paths[curr2].path) + path2_offset;
type2_l = info2->paths[curr2].type;
- if (!is_exclude_path(path2_lp, type2_l, options))
- {
+ if (!is_exclude_path(path2_lp, type2_l, opts)) {
trav_table_addflags(infile, path2_lp, info2->paths[curr2].type, table);
}
curr2++;
} /* end while */
- free_exclude_path_list (options);
+ free_exclude_path_list (opts);
*table_out = table;
h5difftrace("build_match_list finish\n");
@@ -420,15 +375,11 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch
/*-------------------------------------------------------------------------
* Function: trav_grp_objs
*
- * Purpose:
- * Call back function from h5trav_visit().
- *
- * Programmer: Jonathan Kim
- *
- * Date: Aug 16, 2010
+ * Purpose: Call back function from h5trav_visit().
*------------------------------------------------------------------------*/
-static herr_t trav_grp_objs(const char *path, const H5O_info_t *oinfo,
- const char *already_visited, void *udata)
+static herr_t
+trav_grp_objs(const char *path, const H5O_info_t *oinfo,
+ const char *already_visited, void *udata)
{
trav_info_visit_obj(path, oinfo, already_visited, udata);
@@ -438,18 +389,13 @@ static herr_t trav_grp_objs(const char *path, const H5O_info_t *oinfo,
/*-------------------------------------------------------------------------
* Function: trav_grp_symlinks
*
- * Purpose:
- * Call back function from h5trav_visit().
- * Track and extra checkings while visiting all symbolic-links.
- *
- * Programmer: Jonathan Kim
- *
- * Date: Aug 16, 2010
+ * Purpose: Call back function from h5trav_visit().
+ * Track and extra checkings while visiting all symbolic-links.
*------------------------------------------------------------------------*/
-static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo,
- void *udata)
+static herr_t
+trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata)
{
- int ret_value = 0;
+ herr_t ret_value = 0;
trav_info_t *tinfo = (trav_info_t *)udata;
diff_opt_t *opts = (diff_opt_t *)tinfo->opts;
h5tool_link_info_t lnk_info;
@@ -461,66 +407,68 @@ static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo,
if (!opts->follow_links) {
trav_info_visit_lnk(path, linfo, tinfo);
- goto done;
+ HGOTO_DONE(0);
}
switch(linfo->type) {
case H5L_TYPE_SOFT:
- if((ret_value = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links)) < 0)
- goto done;
- /* no dangling link option given and detect dangling link */
+ if((ret_value = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links)) < 0) {
+ HGOTO_DONE(FAIL);
+ }
else if (ret_value == 0) {
- tinfo->symlink_visited.dangle_link = TRUE;
+ /* no dangling link option given and detect dangling link */
+ tinfo->symlink_visited.dangle_link = TRUE;
trav_info_visit_lnk(path, linfo, tinfo);
if (opts->no_dangle_links)
opts->err_stat = 1; /* make dangling link is error */
- goto done;
+ HGOTO_DONE(0);
}
/* check if already visit the target object */
if(symlink_is_visited( &(tinfo->symlink_visited), linfo->type, NULL, lnk_info.trg_path))
- goto done;
+ HGOTO_DONE(0);
/* add this link as visited link */
if(symlink_visit_add( &(tinfo->symlink_visited), linfo->type, NULL, lnk_info.trg_path) < 0)
- goto done;
+ HGOTO_DONE(0);
if(h5trav_visit(tinfo->fid, path, TRUE, TRUE,
trav_grp_objs,trav_grp_symlinks, tinfo) < 0) {
parallel_print("Error: Could not get file contents\n");
opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Error: Could not get file contents");
}
break;
case H5L_TYPE_EXTERNAL:
- if ((ret_value = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links)) < 0)
- goto done;
- /* no dangling link option given and detect dangling link */
+ if ((ret_value = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links)) < 0) {
+ HGOTO_DONE(FAIL);
+ }
else if (ret_value == 0) {
+ /* no dangling link option given and detect dangling link */
tinfo->symlink_visited.dangle_link = TRUE;
trav_info_visit_lnk(path, linfo, tinfo);
if (opts->no_dangle_links)
opts->err_stat = 1; /* make dangling link is error */
- goto done;
+ HGOTO_DONE(0);
}
if(H5Lunpack_elink_val(lnk_info.trg_path, linfo->u.val_size, NULL, &ext_fname, &ext_path) < 0)
- goto done;
+ HGOTO_DONE(0);
/* check if already visit the target object */
if(symlink_is_visited( &(tinfo->symlink_visited), linfo->type, ext_fname, ext_path))
- goto done;
+ HGOTO_DONE(0);
/* add this link as visited link */
if(symlink_visit_add( &(tinfo->symlink_visited), linfo->type, ext_fname, ext_path) < 0)
- goto done;
+ HGOTO_DONE(0);
if(h5trav_visit(tinfo->fid, path, TRUE, TRUE,
trav_grp_objs,trav_grp_symlinks, tinfo) < 0) {
parallel_print("Error: Could not get file contents\n");
opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Error: Could not get file contents\n");
}
break;
@@ -530,52 +478,48 @@ static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo,
default:
parallel_print("Error: Invalid link type\n");
opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Invalid link type");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Error: Invalid link type");
break;
} /* end of switch */
done:
if (lnk_info.trg_path)
HDfree(lnk_info.trg_path);
- return 0;
+ return ret_value;
}
/*-------------------------------------------------------------------------
* Function: h5diff
*
- * Purpose: public function, can be called in an application program.
- * return differences between 2 HDF5 files
- *
- * Return: Number of differences found.
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: October 22, 2003
+ * Purpose: public function, can be called in an application program.
+ * return differences between 2 HDF5 files
*
+ * Return: Number of differences found.
*-------------------------------------------------------------------------
*/
-hsize_t h5diff(const char *fname1,
+hsize_t
+h5diff(const char *fname1,
const char *fname2,
const char *objname1,
const char *objname2,
diff_opt_t *opts)
{
- int ret_value = 0;
- hid_t file1_id = (-1);
- hid_t file2_id = (-1);
- char filenames[2][MAX_FILENAME];
- hsize_t nfound = 0;
- int l_ret1 = -1;
- int l_ret2 = -1;
- char * obj1fullname = NULL;
- char * obj2fullname = NULL;
- int both_objs_grp = 0;
+ int ret_value = 0;
+ hid_t file1_id = -1;
+ hid_t file2_id = -1;
+ char filenames[2][MAX_FILENAME];
+ hsize_t nfound = 0;
+ int l_ret1 = -1;
+ int l_ret2 = -1;
+ char *obj1fullname = NULL;
+ char *obj2fullname = NULL;
+ int both_objs_grp = 0;
/* init to group type */
h5trav_type_t obj1type = H5TRAV_TYPE_GROUP;
h5trav_type_t obj2type = H5TRAV_TYPE_GROUP;
/* for single object */
- H5O_info_t oinfo1, oinfo2; /* object info */
+ H5O_info_t oinfo1, oinfo2; /* object info */
trav_info_t *info1_obj = NULL;
trav_info_t *info2_obj = NULL;
/* for group object */
@@ -585,8 +529,8 @@ hsize_t h5diff(const char *fname1,
trav_info_t *info1_lp = NULL;
trav_info_t *info2_lp = NULL;
/* link info from specified object */
- H5L_info_t src_linfo1;
- H5L_info_t src_linfo2;
+ H5L_info_t src_linfo1;
+ H5L_info_t src_linfo2;
/* link info from member object */
h5tool_link_info_t trg_linfo1;
h5tool_link_info_t trg_linfo2;
@@ -604,34 +548,27 @@ hsize_t h5diff(const char *fname1,
* check invalid combination of options
*-----------------------------------------------------------------------*/
if(!is_valid_options(opts))
- goto done;
+ HGOTO_DONE(0);
opts->cmn_objs = 1; /* eliminate warning */
+ opts->err_stat = 0; /* initialize error status */
/*-------------------------------------------------------------------------
* open the files first; if they are not valid, no point in continuing
*-------------------------------------------------------------------------
*/
-
- /* disable error reporting */
- H5E_BEGIN_TRY
- {
- /* open file 1 */
- if((file1_id = h5tools_fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) {
- parallel_print("h5diff: <%s>: unable to open file\n", fname1);
- opts->err_stat = 1;
- goto done;
- } /* end if */
+ /* open file 1 */
+ if((file1_id = h5tools_fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) {
+ parallel_print("h5diff: <%s>: unable to open file\n", fname1);
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "<%s>: unable to open file\n", fname1);
+ } /* end if */
- /* open file 2 */
- if((file2_id = h5tools_fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) {
- parallel_print("h5diff: <%s>: unable to open file\n", fname2);
- opts->err_stat = 1;
- goto done;
- } /* end if */
- /* enable error reporting */
- } H5E_END_TRY;
+ /* open file 2 */
+ if((file2_id = h5tools_fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) {
+ parallel_print("h5diff: <%s>: unable to open file\n", fname2);
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "<%s>: unable to open file\n", fname2);
+ } /* end if */
/*-------------------------------------------------------------------------
* Initialize the info structs
@@ -648,10 +585,12 @@ hsize_t h5diff(const char *fname1,
#ifdef H5_HAVE_ASPRINTF
/* Use the asprintf() routine, since it does what we're trying to do below */
if(HDasprintf(&obj1fullname, "/%s", objname1) < 0)
- goto done;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed");
#else /* H5_HAVE_ASPRINTF */
/* (malloc 2 more for "/" and end-of-line) */
- obj1fullname = (char*)HDmalloc(HDstrlen(objname1) + 2);
+ if ((obj1fullname = (char*)HDmalloc(HDstrlen(objname1) + 2)) == NULL)
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed");
+
HDstrcpy(obj1fullname, "/");
HDstrcat(obj1fullname, objname1);
#endif /* H5_HAVE_ASPRINTF */
@@ -664,10 +603,11 @@ hsize_t h5diff(const char *fname1,
#ifdef H5_HAVE_ASPRINTF
/* Use the asprintf() routine, since it does what we're trying to do below */
if(HDasprintf(&obj2fullname, "/%s", objname2) < 0)
- goto done;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed");
#else /* H5_HAVE_ASPRINTF */
/* (malloc 2 more for "/" and end-of-line) */
- obj2fullname = (char*)HDmalloc(HDstrlen(objname2) + 2);
+ if ((obj2fullname = (char*)HDmalloc(HDstrlen(objname2) + 2)) == NULL)
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed");
HDstrcpy(obj2fullname, "/");
HDstrcat(obj2fullname, objname2);
#endif /* H5_HAVE_ASPRINTF */
@@ -686,14 +626,12 @@ hsize_t h5diff(const char *fname1,
/* check if link itself exist */
if(H5Lexists(file1_id, obj1fullname, H5P_DEFAULT) <= 0) {
parallel_print ("Object <%s> could not be found in <%s>\n", obj1fullname, fname1);
- opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Object could not be found");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Error: Object could not be found");
}
/* get info from link */
if(H5Lget_info(file1_id, obj1fullname, &src_linfo1, H5P_DEFAULT) < 0) {
parallel_print("Unable to get link info from <%s>\n", obj1fullname);
- H5TOOLS_INFO(H5E_tools_min_id_g, "Unable to get link info\n");
- goto done;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Lget_info failed");
}
info1_lp = info1_obj;
@@ -709,8 +647,7 @@ hsize_t h5diff(const char *fname1,
if(H5Oget_info_by_name(file1_id, obj1fullname, &oinfo1, H5P_DEFAULT) < 0) {
parallel_print("Error: Could not get file contents\n");
- opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Error: Could not get file contents");
}
obj1type = (h5trav_type_t)oinfo1.type;
trav_info_add(info1_obj, obj1fullname, obj1type);
@@ -739,13 +676,12 @@ hsize_t h5diff(const char *fname1,
/* check if link itself exist */
if(H5Lexists(file2_id, obj2fullname, H5P_DEFAULT) <= 0) {
parallel_print ("Object <%s> could not be found in <%s>\n", obj2fullname, fname2);
- opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Object could not be found");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Error: Object could not be found");
}
/* get info from link */
if(H5Lget_info(file2_id, obj2fullname, &src_linfo2, H5P_DEFAULT) < 0) {
parallel_print("Unable to get link info from <%s>\n", obj2fullname);
- goto done;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Lget_info failed");
}
info2_lp = info2_obj;
@@ -761,8 +697,7 @@ hsize_t h5diff(const char *fname1,
if(H5Oget_info_by_name(file2_id, obj2fullname, &oinfo2, H5P_DEFAULT) < 0) {
parallel_print("Error: Could not get file contents\n");
- opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Error: Could not get file contents");
}
obj2type = (h5trav_type_t)oinfo2.type;
trav_info_add(info2_obj, obj2fullname, obj2type);
@@ -790,7 +725,7 @@ hsize_t h5diff(const char *fname1,
obj2type = H5TRAV_TYPE_GROUP;
}
-
+ h5diffdebug2("get any symbolic links info - errstat:%d\n", opts->err_stat);
/* get any symbolic links info */
l_ret1 = H5tools_get_symlink_info(file1_id, obj1fullname, &trg_linfo1, opts->follow_links);
l_ret2 = H5tools_get_symlink_info(file2_id, obj2fullname, &trg_linfo2, opts->follow_links);
@@ -814,8 +749,7 @@ hsize_t h5diff(const char *fname1,
/* treat dangling link as error */
if(opts->m_verbose)
parallel_print("Warning: <%s> is a dangling link.\n", obj1fullname);
- opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: treat dangling link as error");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "treat dangling link as error");
}
else {
if(opts->m_verbose)
@@ -823,14 +757,13 @@ hsize_t h5diff(const char *fname1,
if (l_ret1 != 0 || l_ret2 != 0) {
nfound++;
print_found(nfound);
- goto done;
+ HGOTO_DONE(0);
}
}
}
else if(l_ret1 < 0) { /* fail */
parallel_print ("Object <%s> could not be found in <%s>\n", obj1fullname, fname1);
- opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Object could not be found");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Object could not be found");
}
else if(l_ret1 != 2) { /* symbolic link */
obj1type = (h5trav_type_t)trg_linfo1.trg_type;
@@ -857,23 +790,21 @@ hsize_t h5diff(const char *fname1,
/* treat dangling link as error */
if(opts->m_verbose)
parallel_print("Warning: <%s> is a dangling link.\n", obj2fullname);
- opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: treat dangling link as error");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "treat dangling link as error");
}
else {
if(opts->m_verbose)
parallel_print("obj2 <%s> is a dangling link.\n", obj2fullname);
- if (l_ret1 != 0 || l_ret2 != 0) {
+ if (l_ret1 != 0 || l_ret2 != 0) {
nfound++;
print_found(nfound);
- goto done;
+ HGOTO_DONE(0);
}
}
}
else if(l_ret2 < 0) { /* fail */
parallel_print ("Object <%s> could not be found in <%s>\n", obj2fullname, fname2);
- opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Object could not be found");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Object could not be found");
}
else if(l_ret2 != 2) { /* symbolic link */
obj2type = (h5trav_type_t)trg_linfo2.trg_type;
@@ -899,9 +830,9 @@ hsize_t h5diff(const char *fname1,
if(!(opts->m_verbose || opts->m_report)) {
h5difftrace("h5diff NOT (opts->m_verbose || opts->m_report)\n");
/* if no danglink links */
- if ( l_ret1 > 0 && l_ret2 > 0 )
- if (h5tools_is_obj_same(file1_id, obj1fullname, file2_id, obj2fullname)!=0)
- goto done;
+ if (l_ret1 > 0 && l_ret2 > 0)
+ if (h5tools_is_obj_same(file1_id, obj1fullname, file2_id, obj2fullname) != 0)
+ HGOTO_DONE(0);
}
both_objs_grp = (obj1type == H5TRAV_TYPE_GROUP && obj2type == H5TRAV_TYPE_GROUP);
@@ -917,8 +848,7 @@ hsize_t h5diff(const char *fname1,
if(h5trav_visit(file1_id, obj1fullname, TRUE, TRUE,
trav_grp_objs, trav_grp_symlinks, info1_grp) < 0) {
parallel_print("Error: Could not get file contents\n");
- opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Could not get file contents");
}
info1_lp = info1_grp;
@@ -932,11 +862,11 @@ hsize_t h5diff(const char *fname1,
if(h5trav_visit(file2_id, obj2fullname, TRUE, TRUE,
trav_grp_objs, trav_grp_symlinks, info2_grp) < 0) {
parallel_print("Error: Could not get file contents\n");
- opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Could not get file contents");
} /* end if */
info2_lp = info2_grp;
}
+ h5diffdebug2("groups traversed - errstat:%d\n", opts->err_stat);
#ifdef H5_HAVE_PARALLEL
if(g_Parallel) {
@@ -957,14 +887,12 @@ hsize_t h5diff(const char *fname1,
#endif
/* process the objects */
- build_match_list (obj1fullname, info1_lp, obj2fullname, info2_lp,
- &match_list, opts);
+ build_match_list (obj1fullname, info1_lp, obj2fullname, info2_lp, &match_list, opts);
if (both_objs_grp) {
/*------------------------------------------------------
* print the list
*/
- if(opts->m_verbose)
- {
+ if(opts->m_verbose) {
unsigned u;
parallel_print("\n");
@@ -988,6 +916,8 @@ hsize_t h5diff(const char *fname1,
match_list, opts);
done:
+ opts->err_stat = opts->err_stat | ret_value;
+
#ifdef H5_HAVE_PARALLEL
if(g_Parallel)
/* All done at this point, let tasks know that they won't be needed */
@@ -1022,6 +952,7 @@ done:
H5Fclose(file1_id);
H5Fclose(file2_id);
} H5E_END_TRY;
+
h5difftrace("h5diff finish\n");
return nfound;
@@ -1032,43 +963,34 @@ done:
/*-------------------------------------------------------------------------
* Function: diff_match
*
- * Purpose:
- * Compare common objects in given groups according to table structure.
- * The table structure has flags which can be used to find common objects
- * and will be compared.
- * Common object means same name (absolute path) objects in both location.
- *
- * Return: Number of differences found
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Purpose: Compare common objects in given groups according to table structure.
+ * The table structure has flags which can be used to find common objects
+ * and will be compared.
+ * Common object means same name (absolute path) objects in both location.
*
- * Date: May 9, 2003
+ * Return: Number of differences found
*
- * Modifications: Jan 2005 Leon Arber, larber@uiuc.edu
- * Added support for parallel diffing
- *
- * Pedro Vicente, pvn@hdfgroup.org, Nov 4, 2008
- * Compare the graph and make h5diff return 1 for difference if
- * 1) the number of objects in file1 is not the same as in file2
- * 2) the graph does not match, i.e same names (absolute path)
- * 3) objects with the same name are not of the same type
+ * Modifications: Compare the graph and make h5diff return 1 for difference if
+ * 1) the number of objects in file1 is not the same as in file2
+ * 2) the graph does not match, i.e same names (absolute path)
+ * 3) objects with the same name are not of the same type
*-------------------------------------------------------------------------
*/
-hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
+hsize_t
+diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
hid_t file2_id, const char *grp2, trav_info_t *info2,
- trav_table_t *table, diff_opt_t *options)
+ trav_table_t *table, diff_opt_t *opts)
{
hsize_t nfound = 0;
unsigned i;
-
- const char * grp1_path = "";
- const char * grp2_path = "";
- char * obj1_fullpath = NULL;
- char * obj2_fullpath = NULL;
- diff_args_t argdata;
- size_t idx1 = 0;
- size_t idx2 = 0;
-
+ int ret_value = opts->err_stat;
+ const char *grp1_path = "";
+ const char *grp2_path = "";
+ char *obj1_fullpath = NULL;
+ char *obj2_fullpath = NULL;
+ diff_args_t argdata;
+ size_t idx1 = 0;
+ size_t idx2 = 0;
h5difftrace("diff_match start\n");
/*
@@ -1081,85 +1003,89 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
grp2_path = grp2;
/*-------------------------------------------------------------------------
- * regarding the return value of h5diff (0, no difference in files, 1 difference )
- * 1) the number of objects in file1 must be the same as in file2
- * 2) the graph must match, i.e same names (absolute path)
- * 3) objects with the same name must be of the same type
- *-------------------------------------------------------------------------
- */
+ * regarding the return value of h5diff (0, no difference in files, 1 difference )
+ * 1) the number of objects in file1 must be the same as in file2
+ * 2) the graph must match, i.e same names (absolute path)
+ * 3) objects with the same name must be of the same type
+ *-------------------------------------------------------------------------
+ */
/* not valid compare used when --exclude-path option is used */
- if (!options->exclude_path)
- {
+ if (!opts->exclude_path) {
/* number of different objects */
- if ( info1->nused != info2->nused )
- {
- options->contents = 0;
+ if (info1->nused != info2->nused) {
+ opts->contents = 0;
}
}
/* objects in one file and not the other */
- for( i = 0; i < table->nobjs; i++)
- {
- if( table->objs[i].flags[0] != table->objs[i].flags[1] )
- {
- options->contents = 0;
+ for(i = 0; i < table->nobjs; i++) {
+ if(table->objs[i].flags[0] != table->objs[i].flags[1]) {
+ opts->contents = 0;
break;
}
}
-
/*-------------------------------------------------------------------------
- * do the diff for common objects
- *-------------------------------------------------------------------------
- */
+ * do the diff for common objects
+ *-------------------------------------------------------------------------
+ */
#ifdef H5_HAVE_PARALLEL
{
- char *workerTasks = (char*)HDmalloc((g_nTasks - 1) * sizeof(char));
- int n;
- int busyTasks = 0;
- struct diffs_found nFoundbyWorker;
- struct diff_mpi_args args;
- int havePrintToken = 1;
- MPI_Status Status;
-
- /*set all tasks as free */
- HDmemset(workerTasks, 1, (g_nTasks - 1));
+ char *workerTasks = (char*)HDmalloc((g_nTasks - 1) * sizeof(char));
+ int n;
+ int busyTasks = 0;
+ struct diffs_found nFoundbyWorker;
+ struct diff_mpi_args args;
+ int havePrintToken = 1;
+ MPI_Status Status;
+
+ /*set all tasks as free */
+ HDmemset(workerTasks, 1, (g_nTasks - 1));
#endif
- for(i = 0; i < table->nobjs; i++)
- {
- if( table->objs[i].flags[0] && table->objs[i].flags[1])
- {
+ for(i = 0; i < table->nobjs; i++) {
+ h5diffdebug3("diff for common objects[%d] - errstat:%d\n", i, opts->err_stat);
+ if(table->objs[i].flags[0] && table->objs[i].flags[1]) {
/* make full path for obj1 */
#ifdef H5_HAVE_ASPRINTF
/* Use the asprintf() routine, since it does what we're trying to do below */
- if(HDasprintf(&obj1_fullpath, "%s%s", grp1_path, table->objs[i].name) < 0)
- goto out;
+ if(HDasprintf(&obj1_fullpath, "%s%s", grp1_path, table->objs[i].name) < 0) {
+ HERROR(1, H5E_tools_min_id_g, "name buffer allocation failed");
+ }
#else /* H5_HAVE_ASPRINTF */
- obj1_fullpath = (char*)HDmalloc(HDstrlen(grp1_path) + HDstrlen(table->objs[i].name) + 1);
- HDstrcpy(obj1_fullpath, grp1_path);
- HDstrcat(obj1_fullpath, table->objs[i].name);
+ if((obj1_fullpath = (char*)HDmalloc(HDstrlen(grp1_path) + HDstrlen(table->objs[i].name) + 1)) == NULL) {
+ HERROR(1, H5E_tools_min_id_g, "name buffer allocation failed");
+ }
+ else {
+ HDstrcpy(obj1_fullpath, grp1_path);
+ HDstrcat(obj1_fullpath, table->objs[i].name);
+ }
#endif /* H5_HAVE_ASPRINTF */
+ h5diffdebug2("diff_match path1 - %s\n", obj1_fullpath);
/* make full path for obj2 */
#ifdef H5_HAVE_ASPRINTF
/* Use the asprintf() routine, since it does what we're trying to do below */
- if(HDasprintf(&obj2_fullpath, "%s%s", grp2_path, table->objs[i].name) < 0)
- goto out;
+ if(HDasprintf(&obj2_fullpath, "%s%s", grp2_path, table->objs[i].name) < 0) {
+ HERROR(1, H5E_tools_min_id_g, "name buffer allocation failed");
+ }
#else /* H5_HAVE_ASPRINTF */
- obj2_fullpath = (char*)HDmalloc(HDstrlen(grp2_path) + HDstrlen(table->objs[i].name) + 1);
- HDstrcpy(obj2_fullpath, grp2_path);
- HDstrcat(obj2_fullpath, table->objs[i].name);
+ if((obj2_fullpath = (char*)HDmalloc(HDstrlen(grp2_path) + HDstrlen(table->objs[i].name) + 1)) == NULL) {
+ HERROR(1, H5E_tools_min_id_g, "name buffer allocation failed");
+ }
+ else {
+ HDstrcpy(obj2_fullpath, grp2_path);
+ HDstrcat(obj2_fullpath, table->objs[i].name);
+ }
#endif /* H5_HAVE_ASPRINTF */
+ h5diffdebug2("diff_match path2 - %s\n", obj2_fullpath);
/* get index to figure out type of the object in file1 */
- while(info1->paths[idx1].path &&
- (HDstrcmp(obj1_fullpath, info1->paths[idx1].path) != 0))
+ while(info1->paths[idx1].path && (HDstrcmp(obj1_fullpath, info1->paths[idx1].path) != 0))
idx1++;
/* get index to figure out type of the object in file2 */
- while(info2->paths[idx2].path &&
- (HDstrcmp(obj2_fullpath, info2->paths[idx2].path) != 0))
+ while(info2->paths[idx2].path && (HDstrcmp(obj2_fullpath, info2->paths[idx2].path) != 0))
idx2++;
/* Set argdata to pass other args into diff() */
@@ -1167,16 +1093,14 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
argdata.type[1] = info2->paths[idx2].type;
argdata.is_same_trgobj = table->objs[i].is_same_trgobj;
- options->cmn_objs = 1;
- if(!g_Parallel)
- {
+ opts->cmn_objs = 1;
+ if(!g_Parallel) {
nfound += diff(file1_id, obj1_fullpath,
file2_id, obj2_fullpath,
- options, &argdata);
+ opts, &argdata);
} /* end if */
#ifdef H5_HAVE_PARALLEL
- else
- {
+ else {
int workerFound = 0;
h5difftrace("Beginning of big else block\n");
@@ -1190,8 +1114,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
/*Set up args to pass to worker task. */
if(HDstrlen(obj1_fullpath) > 255 ||
- HDstrlen(obj2_fullpath) > 255)
- {
+ HDstrlen(obj2_fullpath) > 255) {
printf("The parallel diff only supports object names up to 255 characters\n");
MPI_Abort(MPI_COMM_WORLD, 0);
} /* end if */
@@ -1199,32 +1122,29 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
/* set args struct to pass */
HDstrcpy(args.name1, obj1_fullpath);
HDstrcpy(args.name2, obj2_fullpath);
- args.options = *options;
+ args.opts = *opts;
args.argdata.type[0] = info1->paths[idx1].type;
args.argdata.type[1] = info2->paths[idx2].type;
args.argdata.is_same_trgobj = table->objs[i].is_same_trgobj;
/* if there are any outstanding print requests, let's handle one. */
- if(busyTasks > 0)
- {
+ if(busyTasks > 0) {
int incomingMessage;
/* check if any tasks freed up, and didn't need to print. */
MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &incomingMessage, &Status);
/* first block*/
- if(incomingMessage)
- {
+ if(incomingMessage) {
workerTasks[Status.MPI_SOURCE - 1] = 1;
MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
busyTasks--;
} /* end if */
/* check to see if the print token was returned. */
- if(!havePrintToken)
- {
+ if(!havePrintToken) {
/* If we don't have the token, someone is probably sending us output */
print_incoming_data();
@@ -1236,19 +1156,17 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
workerTasks[Status.MPI_SOURCE - 1] = 1;
MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
busyTasks--;
havePrintToken = 1;
} /* end if */
} /* end if */
/* check to see if anyone needs the print token. */
- if(havePrintToken)
- {
+ if(havePrintToken) {
/* check incoming queue for print token requests */
MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &incomingMessage, &Status);
- if(incomingMessage)
- {
+ if(incomingMessage) {
MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status);
MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
havePrintToken = 0;
@@ -1259,10 +1177,8 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
/* check array of tasks to see which ones are free.
* Manager task never does work, so freeTasks[0] is really
* worker task 0. */
- for(n = 1; (n < g_nTasks) && !workerFound; n++)
- {
- if(workerTasks[n-1])
- {
+ for(n = 1; (n < g_nTasks) && !workerFound; n++) {
+ if(workerTasks[n-1]) {
/* send file id's and names to first free worker */
MPI_Send(&args, sizeof(args), MPI_BYTE, n, MPI_TAG_ARGS, MPI_COMM_WORLD);
@@ -1275,55 +1191,47 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
} /* end if */
} /* end for */
- if(!workerFound)
- {
+ if(!workerFound) {
/* if they were all busy, we've got to wait for one free up
* before we can move on. If we don't have the token, some
* task is currently printing so we'll wait for that task to
* return it.
*/
- if(!havePrintToken)
- {
- while(!havePrintToken)
- {
+ if(!havePrintToken) {
+ while(!havePrintToken) {
int incomingMessage;
print_incoming_data();
MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
- if(incomingMessage)
- {
+ if(incomingMessage) {
MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
havePrintToken = 1;
nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
/* send this task the work unit. */
MPI_Send(&args, sizeof(args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD);
} /* end if */
} /* end while */
} /* end if */
/* if we do have the token, check for task to free up, or wait for a task to request it */
- else
- {
+ else {
/* But first print all the data in our incoming queue */
print_incoming_data();
MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
- if(Status.MPI_TAG == MPI_TAG_DONE)
- {
+ if(Status.MPI_TAG == MPI_TAG_DONE) {
MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
MPI_Send(&args, sizeof(args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD);
} /* end if */
- else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST)
- {
+ else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST) {
int incomingMessage;
MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status);
MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
- do
- {
+ do {
MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
print_incoming_data();
@@ -1331,11 +1239,10 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
MPI_Send(&args, sizeof(args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD);
} /* end else-if */
- else
- {
+ else {
printf("ERROR: Invalid tag (%d) received \n", Status.MPI_TAG);
MPI_Abort(MPI_COMM_WORLD, 0);
MPI_Finalize();
@@ -1350,27 +1257,22 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
HDfree(obj2_fullpath);
} /* end if */
} /* end for */
- h5difftrace("done with for loop\n");
+ h5diffdebug2("done with for loop - errstat:%d\n", opts->err_stat);
#ifdef H5_HAVE_PARALLEL
- if(g_Parallel)
- {
+ if(g_Parallel) {
/* make sure all tasks are done */
- while(busyTasks > 0)
- {
+ while(busyTasks > 0) {
MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
- if(Status.MPI_TAG == MPI_TAG_DONE)
- {
+ if(Status.MPI_TAG == MPI_TAG_DONE) {
MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
busyTasks--;
} /* end if */
- else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST)
- {
+ else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST) {
MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status);
- if(havePrintToken)
- {
+ if(havePrintToken) {
int incomingMessage;
MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
@@ -1383,17 +1285,15 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
busyTasks--;
} /* end if */
/* someone else must have it...wait for them to return it, then give it to the task that just asked for it. */
- else
- {
+ else {
int source = Status.MPI_SOURCE;
int incomingMessage;
- do
- {
+ do {
MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
print_incoming_data();
@@ -1402,21 +1302,19 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
busyTasks--;
MPI_Send(NULL, 0, MPI_BYTE, source, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
} /* end else */
} /* end else-if */
- else if(Status.MPI_TAG == MPI_TAG_TOK_RETURN)
- {
+ else if(Status.MPI_TAG == MPI_TAG_TOK_RETURN) {
MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
busyTasks--;
havePrintToken = 1;
} /* end else-if */
- else if(Status.MPI_TAG == MPI_TAG_PRINT_DATA)
- {
+ else if(Status.MPI_TAG == MPI_TAG_PRINT_DATA) {
char data[PRINT_DATA_MAX_SIZE + 1];
HDmemset(data, 0, PRINT_DATA_MAX_SIZE + 1);
@@ -1424,8 +1322,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
printf("%s", data);
} /* end else-if */
- else
- {
+ else {
printf("ph5diff-manager: ERROR!! Invalid tag (%d) received \n", Status.MPI_TAG);
MPI_Abort(MPI_COMM_WORLD, 0);
} /* end else */
@@ -1444,10 +1341,12 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
#endif /* H5_HAVE_PARALLEL */
out:
- /* free table */
+ opts->err_stat = opts->err_stat | ret_value;
+
+/* free table */
if (table)
trav_table_free(table);
- h5difftrace("diff_match finish\n");
+ h5diffdebug2("diff_match finish:%d\n", nfound);
return nfound;
}
@@ -1456,47 +1355,36 @@ out:
/*-------------------------------------------------------------------------
* Function: diff
*
- * Purpose: switch between types and choose the diff function
- * TYPE is either
- * H5G_GROUP Object is a group
- * H5G_DATASET Object is a dataset
- * H5G_TYPE Object is a named data type
- * H5G_LINK Object is a symbolic link
- *
- * Return: Number of differences found
+ * Purpose: switch between types and choose the diff function
+ * TYPE is either
+ * H5G_GROUP Object is a group
+ * H5G_DATASET Object is a dataset
+ * H5G_TYPE Object is a named data type
+ * H5G_LINK Object is a symbolic link
*
- * Programmer: Jonathan Kim
- * - Move follow symlinks code toward top. (March 2812)
- * - Add following symlinks feature (Feb 11,2010)
- * - Change to use diff_args_t to pass the rest of args.
- * Passing through it instead of individual args provides smoother
- * extensibility through its members along with MPI code update for ph5diff
- * as it doesn't require interface change.
- * (May 6,2011)
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- * Date: May 9, 2003
+ * Return: Number of differences found
*-------------------------------------------------------------------------
*/
-
-hsize_t diff(hid_t file1_id,
+hsize_t
+diff(hid_t file1_id,
const char *path1,
hid_t file2_id,
const char *path2,
- diff_opt_t * options,
+ diff_opt_t * opts,
diff_args_t *argdata)
{
- hid_t dset1_id = (-1);
- hid_t dset2_id = (-1);
- hid_t type1_id = (-1);
- hid_t type2_id = (-1);
- hid_t grp1_id = (-1);
- hid_t grp2_id = (-1);
- int ret;
- hbool_t is_dangle_link1 = FALSE;
- hbool_t is_dangle_link2 = FALSE;
- hbool_t is_hard_link = FALSE;
- hsize_t nfound = 0;
+ int ret_value = opts->err_stat;
+ int status = -1;
+ hid_t dset1_id = -1;
+ hid_t dset2_id = -1;
+ hid_t type1_id = -1;
+ hid_t type2_id = -1;
+ hid_t grp1_id = -1;
+ hid_t grp2_id = -1;
+ hbool_t is_dangle_link1 = FALSE;
+ hbool_t is_dangle_link2 = FALSE;
+ hbool_t is_hard_link = FALSE;
+ hsize_t nfound = 0;
h5trav_type_t object_type;
/* to get link info */
@@ -1506,11 +1394,11 @@ hsize_t diff(hid_t file1_id,
h5difftrace("diff start\n");
/*init link info struct */
- HDmemset(&linkinfo1,0,sizeof(h5tool_link_info_t));
- HDmemset(&linkinfo2,0,sizeof(h5tool_link_info_t));
+ HDmemset(&linkinfo1, 0, sizeof(h5tool_link_info_t));
+ HDmemset(&linkinfo2, 0, sizeof(h5tool_link_info_t));
/* pass how to handle printing warnings to linkinfo option */
- if(print_warn(options))
+ if(print_warn(opts))
linkinfo1.opt.msg_mode = linkinfo2.opt.msg_mode = 1;
/* for symbolic links, take care follow symlink and no dangling link
@@ -1518,78 +1406,69 @@ hsize_t diff(hid_t file1_id,
if (argdata->type[0] == H5TRAV_TYPE_LINK ||
argdata->type[0] == H5TRAV_TYPE_UDLINK ||
argdata->type[1] == H5TRAV_TYPE_LINK ||
- argdata->type[1] == H5TRAV_TYPE_UDLINK )
- {
+ argdata->type[1] == H5TRAV_TYPE_UDLINK) {
/*
* check dangling links for path1 and path2
*/
/* target object1 - get type and name */
- ret = H5tools_get_symlink_info(file1_id, path1, &linkinfo1, options->follow_links);
+ if ((status = H5tools_get_symlink_info(file1_id, path1, &linkinfo1, opts->follow_links)) < 0)
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5tools_get_symlink_info failed");
+
/* dangling link */
- if (ret == 0)
- {
- if (options->no_dangle_links)
- {
+ if (status == 0) {
+ if (opts->no_dangle_links) {
/* dangling link is error */
- if(options->m_verbose)
+ if(opts->m_verbose)
parallel_print("Warning: <%s> is a dangling link.\n", path1);
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "dangling link is error");
}
else
is_dangle_link1 = TRUE;
}
- else if (ret < 0)
- goto out;
/* target object2 - get type and name */
- ret = H5tools_get_symlink_info(file2_id, path2, &linkinfo2, options->follow_links );
+ if ((status = H5tools_get_symlink_info(file2_id, path2, &linkinfo2, opts->follow_links)) < 0)
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5tools_get_symlink_info failed");
/* dangling link */
- if (ret == 0)
- {
- if (options->no_dangle_links)
- {
+ if (status == 0) {
+ if (opts->no_dangle_links) {
/* dangling link is error */
- if(options->m_verbose)
+ if(opts->m_verbose)
parallel_print("Warning: <%s> is a dangling link.\n", path2);
- goto out;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "dangling link is error");
}
else
is_dangle_link2 = TRUE;
}
- else if (ret < 0)
- goto out;
/* found dangling link */
- if (is_dangle_link1 || is_dangle_link2)
- goto out2;
+ if (is_dangle_link1 || is_dangle_link2) {
+ HGOTO_DONE(0);
+ }
/* follow symbolic link option */
- if (options->follow_links)
- {
+ if (opts->follow_links) {
if (linkinfo1.linfo.type == H5L_TYPE_SOFT ||
linkinfo1.linfo.type == H5L_TYPE_EXTERNAL)
argdata->type[0] = (h5trav_type_t)linkinfo1.trg_type;
- if (linkinfo2.linfo.type == H5L_TYPE_SOFT ||
- linkinfo2.linfo.type == H5L_TYPE_EXTERNAL)
+ if (linkinfo2.linfo.type == H5L_TYPE_SOFT || linkinfo2.linfo.type == H5L_TYPE_EXTERNAL)
argdata->type[1] = (h5trav_type_t)linkinfo2.trg_type;
}
}
/* if objects are not the same type */
- if (argdata->type[0] != argdata->type[1])
- {
- if (options->m_verbose||options->m_list_not_cmp)
- {
+ if (argdata->type[0] != argdata->type[1]) {
+ if (opts->m_verbose||opts->m_list_not_cmp) {
parallel_print("Not comparable: <%s> is of type %s and <%s> is of type %s\n",
path1, get_type(argdata->type[0]),
path2, get_type(argdata->type[1]));
}
- options->not_cmp=1;
+ opts->not_cmp = 1;
/* TODO: will need to update non-comparable is different
- * options->contents = 0;
+ * opts->contents = 0;
*/
- goto out2;
+ HGOTO_DONE(0);
}
else /* now both object types are same */
object_type = argdata->type[0];
@@ -1602,88 +1481,79 @@ hsize_t diff(hid_t file1_id,
*
* Perform this to match the outputs as bypassing.
*/
- if (argdata->is_same_trgobj)
- {
+ if (argdata->is_same_trgobj) {
h5difftrace("argdata->is_same_trgobj\n");
is_hard_link = (object_type == H5TRAV_TYPE_DATASET ||
object_type == H5TRAV_TYPE_NAMED_DATATYPE ||
object_type == H5TRAV_TYPE_GROUP);
- if (options->follow_links || is_hard_link)
- {
+ if (opts->follow_links || is_hard_link) {
/* print information is only verbose option is used */
- if(options->m_verbose || options->m_report)
- {
- switch(object_type)
- {
+ if(opts->m_verbose || opts->m_report) {
+ switch(object_type) {
case H5TRAV_TYPE_DATASET:
- do_print_objname("dataset", path1, path2, options);
+ do_print_objname("dataset", path1, path2, opts);
break;
case H5TRAV_TYPE_NAMED_DATATYPE:
- do_print_objname("datatype", path1, path2, options);
+ do_print_objname("datatype", path1, path2, opts);
break;
case H5TRAV_TYPE_GROUP:
- do_print_objname("group", path1, path2, options);
+ do_print_objname("group", path1, path2, opts);
break;
case H5TRAV_TYPE_LINK:
- do_print_objname("link", path1, path2, options);
+ do_print_objname("link", path1, path2, opts);
break;
case H5TRAV_TYPE_UDLINK:
if(linkinfo1.linfo.type == H5L_TYPE_EXTERNAL && linkinfo2.linfo.type == H5L_TYPE_EXTERNAL)
- do_print_objname("external link", path1, path2, options);
+ do_print_objname("external link", path1, path2, opts);
else
- do_print_objname ("user defined link", path1, path2, options);
+ do_print_objname ("user defined link", path1, path2, opts);
break;
case H5TRAV_TYPE_UNKNOWN:
default:
parallel_print("Comparison not supported: <%s> and <%s> are of type %s\n",
path1, path2, get_type(object_type) );
- options->not_cmp = 1;
+ opts->not_cmp = 1;
break;
} /* switch(type)*/
print_found(nfound);
- } /* if(options->m_verbose || options->m_report) */
+ } /* if(opts->m_verbose || opts->m_report) */
/* exact same, so comparison is done */
- goto out2;
+ HGOTO_DONE(0);
}
}
- switch(object_type)
- {
+ switch(object_type) {
/*----------------------------------------------------------------------
* H5TRAV_TYPE_DATASET
*----------------------------------------------------------------------
*/
case H5TRAV_TYPE_DATASET:
if((dset1_id = H5Dopen2(file1_id, path1, H5P_DEFAULT)) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dopen2 failed");
if((dset2_id = H5Dopen2(file2_id, path2, H5P_DEFAULT)) < 0)
- goto out;
- /* verbose (-v) and report (-r) mode */
- if(options->m_verbose || options->m_report)
- {
- do_print_objname("dataset", path1, path2, options);
- nfound = diff_dataset(file1_id, file2_id, path1, path2, options);
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dopen2 failed");
+ /* verbose (-v) and report (-r) mode */
+ if(opts->m_verbose || opts->m_report) {
+ do_print_objname("dataset", path1, path2, opts);
+ nfound = diff_dataset(file1_id, file2_id, path1, path2, opts);
print_found(nfound);
}
/* quiet mode (-q), just count differences */
- else if(options->m_quiet)
- {
- nfound = diff_dataset(file1_id, file2_id, path1, path2, options);
+ else if(opts->m_quiet) {
+ nfound = diff_dataset(file1_id, file2_id, path1, path2, opts);
}
- /* the rest (-c, none, ...) */
- else
- {
- nfound = diff_dataset(file1_id, file2_id, path1, path2, options);
+ /* the rest (-c, none, ...) */
+ else {
+ nfound = diff_dataset(file1_id, file2_id, path1, path2, opts);
/* print info if difference found */
- if (nfound)
- {
- do_print_objname("dataset", path1, path2, options);
+ if (nfound) {
+ do_print_objname("dataset", path1, path2, opts);
print_found(nfound);
}
}
-
+ h5diffdebug2("diff after dataset:%d\n", nfound);
/*---------------------------------------------------------
* compare attributes
@@ -1692,13 +1562,13 @@ hsize_t diff(hid_t file1_id,
*---------------------------------------------------------
*/
if(path1)
- nfound += diff_attr(dset1_id, dset2_id, path1, path2, options);
+ nfound += diff_attr(dset1_id, dset2_id, path1, path2, opts);
if(H5Dclose(dset1_id) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dclose failed");
if(H5Dclose(dset2_id) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dclose failed");
break;
/*----------------------------------------------------------------------
@@ -1707,21 +1577,21 @@ hsize_t diff(hid_t file1_id,
*/
case H5TRAV_TYPE_NAMED_DATATYPE:
if((type1_id = H5Topen2(file1_id, path1, H5P_DEFAULT)) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Topen2 failed");
if((type2_id = H5Topen2(file2_id, path2, H5P_DEFAULT)) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Topen2 failed");
- if((ret = H5Tequal(type1_id, type2_id)) < 0)
- goto out;
+ if((status = H5Tequal(type1_id, type2_id)) < 0)
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tequal failed");
/* if H5Tequal is > 0 then the datatypes refer to the same datatype */
- nfound = (ret > 0) ? 0 : 1;
+ nfound = (status > 0) ? 0 : 1;
- if(print_objname(options,nfound))
- do_print_objname("datatype", path1, path2, options);
+ if(print_objname(opts, nfound))
+ do_print_objname("datatype", path1, path2, opts);
/* always print the number of differences found in verbose mode */
- if(options->m_verbose)
+ if(opts->m_verbose)
print_found(nfound);
/*-----------------------------------------------------------------
@@ -1731,12 +1601,12 @@ hsize_t diff(hid_t file1_id,
*-----------------------------------------------------------------
*/
if(path1)
- nfound += diff_attr(type1_id, type2_id, path1, path2, options);
+ nfound += diff_attr(type1_id, type2_id, path1, path2, opts);
if(H5Tclose(type1_id) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose failed");
if(H5Tclose(type2_id) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose failed");
break;
/*----------------------------------------------------------------------
@@ -1744,17 +1614,17 @@ hsize_t diff(hid_t file1_id,
*----------------------------------------------------------------------
*/
case H5TRAV_TYPE_GROUP:
- if(print_objname(options, nfound))
- do_print_objname("group", path1, path2, options);
+ if(print_objname(opts, nfound))
+ do_print_objname("group", path1, path2, opts);
/* always print the number of differences found in verbose mode */
- if(options->m_verbose)
+ if(opts->m_verbose)
print_found(nfound);
if((grp1_id = H5Gopen2(file1_id, path1, H5P_DEFAULT)) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed");
if((grp2_id = H5Gopen2(file2_id, path2, H5P_DEFAULT)) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed");
/*-----------------------------------------------------------------
* compare attributes
@@ -1763,12 +1633,12 @@ hsize_t diff(hid_t file1_id,
*-----------------------------------------------------------------
*/
if(path1)
- nfound += diff_attr(grp1_id, grp2_id, path1, path2, options);
+ nfound += diff_attr(grp1_id, grp2_id, path1, path2, opts);
if(H5Gclose(grp1_id) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed");
if(H5Gclose(grp2_id) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed");
break;
@@ -1778,19 +1648,19 @@ hsize_t diff(hid_t file1_id,
*/
case H5TRAV_TYPE_LINK:
{
- ret = HDstrcmp(linkinfo1.trg_path, linkinfo2.trg_path);
+ status = HDstrcmp(linkinfo1.trg_path, linkinfo2.trg_path);
- /* if the target link name is not same then the links are "different" */
- nfound = (ret != 0) ? 1 : 0;
+ /* if the target link name is not same then the links are "different" */
+ nfound = (status != 0) ? 1 : 0;
- if(print_objname(options, nfound))
- do_print_objname("link", path1, path2, options);
+ if(print_objname(opts, nfound))
+ do_print_objname("link", path1, path2, opts);
- /* always print the number of differences found in verbose mode */
- if(options->m_verbose)
- print_found(nfound);
+ /* always print the number of differences found in verbose mode */
+ if(opts->m_verbose)
+ print_found(nfound);
- }
+ }
break;
/*----------------------------------------------------------------------
@@ -1799,101 +1669,85 @@ hsize_t diff(hid_t file1_id,
*/
case H5TRAV_TYPE_UDLINK:
{
- /* Only external links will have a query function registered */
- if(linkinfo1.linfo.type == H5L_TYPE_EXTERNAL && linkinfo2.linfo.type == H5L_TYPE_EXTERNAL)
- {
- /* If the buffers are the same size, compare them */
- if(linkinfo1.linfo.u.val_size == linkinfo2.linfo.u.val_size)
- {
- ret = HDmemcmp(linkinfo1.trg_path, linkinfo2.trg_path, linkinfo1.linfo.u.val_size);
- }
- else
- ret = 1;
+ /* Only external links will have a query function registered */
+ if(linkinfo1.linfo.type == H5L_TYPE_EXTERNAL && linkinfo2.linfo.type == H5L_TYPE_EXTERNAL) {
+ /* If the buffers are the same size, compare them */
+ if(linkinfo1.linfo.u.val_size == linkinfo2.linfo.u.val_size) {
+ status = HDmemcmp(linkinfo1.trg_path, linkinfo2.trg_path, linkinfo1.linfo.u.val_size);
+ }
+ else
+ status = 1;
- /* if "linkinfo1.trg_path" != "linkinfo2.trg_path" then the links
- * are "different" extlinkinfo#.path is combination string of
- * file_name and obj_name
- */
- nfound = (ret != 0) ? 1 : 0;
+ /* if "linkinfo1.trg_path" != "linkinfo2.trg_path" then the links
+ * are "different" extlinkinfo#.path is combination string of
+ * file_name and obj_name
+ */
+ nfound = (status != 0) ? 1 : 0;
- if(print_objname(options, nfound))
- do_print_objname("external link", path1, path2, options);
+ if(print_objname(opts, nfound))
+ do_print_objname("external link", path1, path2, opts);
- } /* end if */
- else
- {
- /* If one or both of these links isn't an external link, we can only
- * compare information from H5Lget_info since we don't have a query
- * function registered for them.
- *
- * If the link classes or the buffer length are not the
- * same, the links are "different"
- */
- if((linkinfo1.linfo.type != linkinfo2.linfo.type) ||
- (linkinfo1.linfo.u.val_size != linkinfo2.linfo.u.val_size))
- nfound = 1;
- else
- nfound = 0;
-
- if (print_objname (options, nfound))
- do_print_objname ("user defined link", path1, path2, options);
- } /* end else */
+ } /* end if */
+ else {
+ /* If one or both of these links isn't an external link, we can only
+ * compare information from H5Lget_info since we don't have a query
+ * function registered for them.
+ *
+ * If the link classes or the buffer length are not the
+ * same, the links are "different"
+ */
+ if((linkinfo1.linfo.type != linkinfo2.linfo.type) ||
+ (linkinfo1.linfo.u.val_size != linkinfo2.linfo.u.val_size))
+ nfound = 1;
+ else
+ nfound = 0;
- /* always print the number of differences found in verbose mode */
- if(options->m_verbose)
- print_found(nfound);
+ if (print_objname (opts, nfound))
+ do_print_objname ("user defined link", path1, path2, opts);
+ } /* end else */
+
+ /* always print the number of differences found in verbose mode */
+ if(opts->m_verbose)
+ print_found(nfound);
}
break;
case H5TRAV_TYPE_UNKNOWN:
default:
- if(options->m_verbose)
+ if(opts->m_verbose)
parallel_print("Comparison not supported: <%s> and <%s> are of type %s\n",
path1, path2, get_type(object_type) );
- options->not_cmp = 1;
+ opts->not_cmp = 1;
break;
}
- /* free link info buffer */
- if (linkinfo1.trg_path)
- HDfree(linkinfo1.trg_path);
- if (linkinfo2.trg_path)
- HDfree(linkinfo2.trg_path);
-
- return nfound;
-
-out:
- options->err_stat = 1;
+done:
+ opts->err_stat = opts->err_stat | ret_value;
-out2:
/*-----------------------------------
* handle dangling link(s)
*/
/* both path1 and path2 are dangling links */
- if(is_dangle_link1 && is_dangle_link2)
- {
- if(print_objname(options, nfound))
- {
- do_print_objname("dangling link", path1, path2, options);
+ if(is_dangle_link1 && is_dangle_link2) {
+ if(print_objname(opts, nfound)) {
+ do_print_objname("dangling link", path1, path2, opts);
print_found(nfound);
}
}
/* path1 is dangling link */
- else if (is_dangle_link1)
- {
- if(options->m_verbose)
+ else if (is_dangle_link1) {
+ if(opts->m_verbose)
parallel_print("obj1 <%s> is a dangling link.\n", path1);
nfound++;
- if(print_objname(options, nfound))
+ if(print_objname(opts, nfound))
print_found(nfound);
}
/* path2 is dangling link */
- else if (is_dangle_link2)
- {
- if(options->m_verbose)
+ else if (is_dangle_link2) {
+ if(opts->m_verbose)
parallel_print("obj2 <%s> is a dangling link.\n", path2);
nfound++;
- if(print_objname(options, nfound))
+ if(print_objname(opts, nfound))
print_found(nfound);
}
@@ -1906,13 +1760,16 @@ out2:
/* close */
/* disable error reporting */
H5E_BEGIN_TRY {
+ H5Dclose(dset1_id);
+ H5Dclose(dset2_id);
H5Tclose(type1_id);
H5Tclose(type2_id);
H5Gclose(grp1_id);
- H5Tclose(grp2_id);
+ H5Gclose(grp2_id);
/* enable error reporting */
} H5E_END_TRY;
- h5difftrace("diff finish\n");
+
+ h5diffdebug3("diff finish:%d - errstat:%d\n", nfound, opts->err_stat);
return nfound;
}
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index 0226e83..26bcd95 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -38,7 +38,7 @@
/*-------------------------------------------------------------------------
* This is used to pass multiple args into diff().
- * Passing this instead of several each arg provides smoother extensibility
+ * Passing this instead of several each arg provides smoother extensibility
* through its members along with MPI code for ph5diff
* as it doesn't require interface change.
*------------------------------------------------------------------------*/
@@ -95,13 +95,13 @@ H5TOOLS_DLL hsize_t h5diff(const char *fname1,
const char *fname2,
const char *objname1,
const char *objname2,
- diff_opt_t *options);
+ diff_opt_t *opts);
H5TOOLS_DLL hsize_t diff( hid_t file1_id,
const char *path1,
hid_t file2_id,
const char *path2,
- diff_opt_t *options,
+ diff_opt_t *opts,
diff_args_t *argdata);
#ifdef H5_HAVE_PARALLEL
@@ -125,18 +125,18 @@ hsize_t diff_dataset( hid_t file1_id,
hid_t file2_id,
const char *obj1_name,
const char *obj2_name,
- diff_opt_t *options);
+ diff_opt_t *opts);
hsize_t diff_datasetid( hid_t dset1_id,
hid_t dset2_id,
const char *obj1_name,
const char *obj2_name,
- diff_opt_t *options);
+ diff_opt_t *opts);
hsize_t diff_match( hid_t file1_id, const char *grp1, trav_info_t *info1,
hid_t file2_id, const char *grp2, trav_info_t *info2,
- trav_table_t *table, diff_opt_t *options );
+ trav_table_t *table, diff_opt_t *opts );
hsize_t diff_array( void *_mem1,
void *_mem2,
@@ -144,7 +144,7 @@ hsize_t diff_array( void *_mem1,
hsize_t hyper_start,
int rank,
hsize_t *dims,
- diff_opt_t *options,
+ diff_opt_t *opts,
const char *name1,
const char *name2,
hid_t m_type,
@@ -162,7 +162,7 @@ int diff_can_type( hid_t f_type1, /* file data type */
hsize_t *maxdim2,
const char *obj1_name,
const char *obj2_name,
- diff_opt_t *options,
+ diff_opt_t *opts,
int is_compound);
@@ -170,7 +170,7 @@ hsize_t diff_attr(hid_t loc1_id,
hid_t loc2_id,
const char *path1,
const char *path2,
- diff_opt_t *options);
+ diff_opt_t *opts);
/*-------------------------------------------------------------------------
@@ -187,10 +187,10 @@ const char* get_class(H5T_class_t tclass);
const char* get_sign(H5T_sign_t sign);
void print_dimensions (int rank, hsize_t *dims);
herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id,
- hid_t *m_tid1, hid_t *m_tid2,
+ hid_t *m_tid1, hid_t *m_tid2,
size_t *m_size1, size_t *m_size2);
/* in h5diff.c */
-int print_objname(diff_opt_t *options, hsize_t nfound);
+int print_objname(diff_opt_t *opts, hsize_t nfound);
void do_print_objname (const char *OBJ, const char *path1, const char *path2, diff_opt_t * opts);
void do_print_attrname (const char *attr, const char *path1, const char *path2);
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 09894e6..11f5e41 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -131,21 +131,21 @@ typedef struct mcomp_t {
*-------------------------------------------------------------------------
*/
static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id,
- hid_t region2_id, diff_opt_t *options);
+ hid_t region2_id, diff_opt_t *opts);
static hbool_t all_zero(const void *_mem, size_t size);
static int ull2float(unsigned long long ull_value, float *f_value);
static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u,
int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos,
- diff_opt_t *options, const char *obj1, const char *obj2, int *ph);
+ diff_opt_t *opts, const char *obj1, const char *obj2, int *ph);
static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
hsize_t i, int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos,
- diff_opt_t *options, const char *obj1, const char *obj2, int *ph);
-static hbool_t equal_float(float value, float expected, diff_opt_t *options);
-static hbool_t equal_double(double value, double expected, diff_opt_t *options);
+ diff_opt_t *opts, const char *obj1, const char *obj2, int *ph);
+static hbool_t equal_float(float value, float expected, diff_opt_t *opts);
+static hbool_t equal_double(double value, double expected, diff_opt_t *opts);
#if H5_SIZEOF_LONG_DOUBLE !=0
-static hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *options);
+static hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts);
#endif
-static int print_data(diff_opt_t *options);
+static int print_data(diff_opt_t *opts);
static void print_pos(int *ph, int pp, hsize_t curr_pos, hsize_t *acc,
hsize_t *pos, int rank, hsize_t *dims, const char *obj1,
const char *obj2);
@@ -155,17 +155,17 @@ static void print_char_pos(int *ph, int pp, hsize_t curr_pos, size_t u,
static void h5diff_print_char(char ch);
static hsize_t diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t index,
int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos,
- diff_opt_t *options, const char *obj1, const char *obj2,
+ diff_opt_t *opts, const char *obj1, const char *obj2,
hid_t container1_id, hid_t container2_id, /*where the reference came from*/
int *ph, /*print header */
mcomp_t *members); /*compound members */
static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
#if H5_SIZEOF_LONG_DOUBLE !=0
static hsize_t diff_ldouble(unsigned char *mem1,
@@ -176,50 +176,50 @@ static hsize_t diff_ldouble(unsigned char *mem1,
hsize_t *dims,
hsize_t *acc,
hsize_t *pos,
- diff_opt_t *options,
+ diff_opt_t *opts,
const char *obj1,
const char *obj2,
int *ph);
#endif
static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
/*-------------------------------------------------------------------------
@@ -256,11 +256,6 @@ static void close_member_types(mcomp_t *members);
* Purpose: compare two memory buffers;
*
* Return: number of differences found
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: November 12, 2003
- *
*-------------------------------------------------------------------------
*/
@@ -271,7 +266,7 @@ hsize_t diff_array(
hsize_t hyper_start,
int rank,
hsize_t *dims,
- diff_opt_t *options,
+ diff_opt_t *opts,
const char *name1,
const char *name2,
hid_t m_type,
@@ -290,7 +285,7 @@ hsize_t diff_array(
mcomp_t members;
H5T_class_t type_class;
- h5difftrace("diff_array start\n");
+ h5diffdebug2("diff_array start - errstat:%d\n", opts->err_stat);
/* get the size. */
size = H5Tget_size(m_type);
type_class = H5Tget_class(m_type);
@@ -329,36 +324,36 @@ hsize_t diff_array(
*/
case H5T_FLOAT:
if (H5Tequal(m_type, H5T_NATIVE_FLOAT))
- nfound = diff_float(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_float(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE))
- nfound = diff_double(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_double(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
#if H5_SIZEOF_LONG_DOUBLE != 0
else if (H5Tequal(m_type, H5T_NATIVE_LDOUBLE))
- nfound = diff_ldouble(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_ldouble(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
#endif
break;
case H5T_INTEGER:
if (H5Tequal(m_type, H5T_NATIVE_SCHAR))
- nfound = diff_schar(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_schar(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_UCHAR))
- nfound = diff_uchar(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_uchar(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_SHORT))
- nfound = diff_short(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_short(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_USHORT))
- nfound = diff_ushort(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_ushort(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_INT))
- nfound = diff_int(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_int(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_UINT))
- nfound = diff_uint(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_uint(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_LONG))
- nfound = diff_long(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_long(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_ULONG))
- nfound = diff_ulong(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_ulong(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_LLONG))
- nfound = diff_llong(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_llong(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_ULLONG))
- nfound = diff_ullong(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_ullong(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
break;
/*-------------------------------------------------------------------------
@@ -376,16 +371,14 @@ hsize_t diff_array(
HDmemset(&members, 0, sizeof(mcomp_t));
get_member_types(m_type, &members);
for (i = 0; i < nelmts; i++) {
- nfound += diff_datum(mem1 + i * size, mem2 + i * size, m_type, i, rank, dims, acc, pos, options,
+ nfound += diff_datum(mem1 + i * size, mem2 + i * size, m_type, i, rank, dims, acc, pos, opts,
name1, name2, container1_id, container2_id, &ph, &members);
- if (options->n && nfound >= options->count) {
- close_member_types(&members);
- return nfound;
- }
+ if (opts->n && nfound >= opts->count)
+ break;
} /* i */
close_member_types(&members);
} /* switch */
- h5difftrace("diff_array finish\n");
+ h5diffdebug3("diff_array finish:%d - errstat:%d\n", nfound, opts->err_stat);
return nfound;
}
@@ -397,10 +390,6 @@ hsize_t diff_array(
*
* Return: number of differences found
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: October 29, 2003
- *
* The comparison of the 2 buffers read from the files is made datum by datum.
*
* H5T_INTEGER and H5T_FLOAT
@@ -436,18 +425,17 @@ static hsize_t diff_datum(
hsize_t *dims,
hsize_t *acc,
hsize_t *pos,
- diff_opt_t *options,
+ diff_opt_t *opts,
const char *obj1,
const char *obj2,
hid_t container1_id,
hid_t container2_id, /*where the reference came from*/
- int *ph, /*print header */
- mcomp_t *members) /*compound members */
+ int *ph, /*print header */
+ mcomp_t *members) /*compound members */
{
unsigned char *mem1 = (unsigned char*) _mem1;
unsigned char *mem2 = (unsigned char*) _mem2;
size_t u;
- hid_t memb_type;
size_t type_size;
H5T_sign_t type_sign;
H5T_class_t type_class;
@@ -458,14 +446,13 @@ static hsize_t diff_datum(
size_t size = 0;
hbool_t iszero1;
hbool_t iszero2;
- hid_t obj1_id;
- hid_t obj2_id;
- hsize_t nfound = 0; /* differences found */
- int ret = 0; /* check return error */
+ hsize_t nfound = 0; /* differences found */
+ hsize_t ret_value = opts->err_stat;
double per;
hbool_t both_zero;
h5difftrace("diff_datum start\n");
+
type_size = H5Tget_size(m_type);
type_class = H5Tget_class(m_type);
@@ -478,14 +465,14 @@ static hsize_t diff_datum(
type_class != H5T_STRING &&
type_class != H5T_VLEN &&
HDmemcmp(mem1, mem2, type_size) == 0)
- return 0;
+ HGOTO_DONE(opts->err_stat);
switch (H5Tget_class(m_type)) {
case H5T_NO_CLASS:
case H5T_TIME:
case H5T_NCLASSES:
default:
- HDassert(0);
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Invalid type class");
break;
/*-------------------------------------------------------------------------
@@ -494,15 +481,17 @@ static hsize_t diff_datum(
*/
case H5T_COMPOUND:
h5difftrace("diff_datum H5T_COMPOUND\n");
+ {
+ hid_t memb_type = -1;
+ nmembs = members->n;
- nmembs = members->n;
-
- for (j = 0; j < nmembs; j++) {
- offset = members->offsets[j];
- memb_type = members->ids[j];
+ for (j = 0; j < nmembs; j++) {
+ offset = members->offsets[j];
+ memb_type = members->ids[j];
- nfound += diff_datum(mem1 + offset, mem2 + offset, memb_type, index,
- rank, dims, acc, pos, options, obj1, obj2, container1_id, container2_id, ph, members->m[j]);
+ nfound += diff_datum(mem1 + offset, mem2 + offset, memb_type, index,
+ rank, dims, acc, pos, opts, obj1, obj2, container1_id, container2_id, ph, members->m[j]);
+ }
}
break;
@@ -532,6 +521,7 @@ static hsize_t diff_datum(
size1 = HDstrlen(s1);
else
size1 = 0;
+
/* Get pointer to second string */
s2 = *(char**) mem2;
if (s2)
@@ -547,14 +537,17 @@ static hsize_t diff_datum(
size1 = HDstrlen(s1);
else
size1 = 0;
+
if (size1 > size_mtype)
size1 = size_mtype;
+
/* Get pointer to second string */
s2 = (char*) mem2;
if (s2)
size2 = HDstrlen(s2);
else
size2 = 0;
+
if (size2 > size_mtype)
size2 = size_mtype;
}
@@ -562,6 +555,7 @@ static hsize_t diff_datum(
/* Get pointer to first string */
s1 = (char *) mem1;
size1 = size_mtype;
+
/* Get pointer to second string */
s2 = (char *) mem2;
size2 = size_mtype;
@@ -573,8 +567,8 @@ static hsize_t diff_datum(
* of length of strings.
* For now mimic the previous way.
*/
- h5diffdebug2("diff_datum string size:%d\n",size1);
- h5diffdebug2("diff_datum string size:%d\n",size2);
+ h5diffdebug2("diff_datum string size:%d\n", size1);
+ h5diffdebug2("diff_datum string size:%d\n", size2);
if (size1 != size2) {
h5difftrace("diff_datum string sizes\n");
nfound++;
@@ -595,15 +589,15 @@ static hsize_t diff_datum(
/* check for NULL pointer for string */
if (s != NULL) {
/* try fast compare first */
- if (HDmemcmp(s1, s2, size) == 0) {
+ if (HDmemcmp(s, sx, size) == 0) {
if (size1 != size2)
- if (print_data(options))
+ if (print_data(opts))
for (u = size; u < sizex; u++)
- character_compare(s1 + u, s2 + u, index, u, rank, dims, acc, pos, options, obj1, obj2, ph);
+ character_compare(s + u, sx + u, index, u, rank, dims, acc, pos, opts, obj1, obj2, ph);
}
else
for (u = 0; u < size; u++)
- nfound += character_compare(s1 + u, s2 + u, index, u, rank, dims, acc, pos, options, obj1, obj2, ph);
+ nfound += character_compare(s + u, sx + u, index, u, rank, dims, acc, pos, opts, obj1, obj2, ph);
} /* end check for NULL pointer for string */
}
break;
@@ -616,7 +610,7 @@ static hsize_t diff_datum(
h5difftrace("diff_datum H5T_BITFIELD\n");
/* byte-by-byte comparison */
for (u = 0; u < type_size; u++)
- nfound += character_compare_opt(mem1 + u, mem2 + u, index, rank, dims, acc, pos, options, obj1, obj2, ph);
+ nfound += character_compare_opt(mem1 + u, mem2 + u, index, rank, dims, acc, pos, opts, obj1, obj2, ph);
break;
/*-------------------------------------------------------------------------
@@ -627,7 +621,7 @@ static hsize_t diff_datum(
h5difftrace("diff_datum H5T_OPAQUE\n");
/* byte-by-byte comparison */
for (u = 0; u < type_size; u++)
- nfound += character_compare_opt(mem1 + u, mem2 + u, index, rank, dims, acc, pos, options, obj1, obj2, ph);
+ nfound += character_compare_opt(mem1 + u, mem2 + u, index, rank, dims, acc, pos, opts, obj1, obj2, ph);
break;
/*-------------------------------------------------------------------------
@@ -667,7 +661,7 @@ static hsize_t diff_datum(
* don't attempt to convert them - just report errors.
*/
nfound += 1;
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(S_FORMAT, enum_name1, enum_name2);
@@ -677,7 +671,7 @@ static hsize_t diff_datum(
/* Both enum values were valid */
if (HDstrcmp(enum_name1, enum_name2) != 0) {
nfound = 1;
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(S_FORMAT, enum_name1, enum_name2);
@@ -685,7 +679,7 @@ static hsize_t diff_datum(
}
else {
for (u = 0; u < type_size; u++)
- nfound += character_compare_opt(mem1 + u, mem2 + u, index, rank, dims, acc, pos, options, obj1, obj2, ph);
+ nfound += character_compare_opt(mem1 + u, mem2 + u, index, rank, dims, acc, pos, opts, obj1, obj2, ph);
}
}
/* enable error reporting */
@@ -699,8 +693,9 @@ static hsize_t diff_datum(
*/
case H5T_ARRAY:
{
+ hid_t memb_type = -1;
hsize_t adims[H5S_MAX_RANK];
- int ndims;
+ int ndims;
/* get the array's base datatype for each element */
memb_type = H5Tget_super(m_type);
@@ -714,7 +709,7 @@ static hsize_t diff_datum(
nelmts *= adims[u];
for (u = 0; u < nelmts; u++) {
nfound += diff_datum(mem1 + u * size, mem2 + u * size, memb_type, index,
- rank, dims, acc, pos, options, obj1, obj2, container1_id, container2_id, ph, members);
+ rank, dims, acc, pos, opts, obj1, obj2, container1_id, container2_id, ph, members);
}
H5Tclose(memb_type);
}
@@ -728,7 +723,8 @@ static hsize_t diff_datum(
iszero1 = all_zero(_mem1, H5Tget_size(m_type));
iszero2 = all_zero(_mem2, H5Tget_size(m_type));
if (iszero1 != iszero2) {
- return 1;
+ nfound++;
+ HGOTO_DONE (opts->err_stat);
}
else if (!iszero1 && !iszero2) {
/*-------------------------------------------------------------------------
@@ -736,25 +732,32 @@ static hsize_t diff_datum(
* Dataset region reference
*-------------------------------------------------------------------------
*/
- if (type_size == H5R_DSET_REG_REF_BUF_SIZE) {
- hid_t region1_id;
- hid_t region2_id;
+ hid_t obj1_id = -1;
+ hid_t obj2_id = -1;
- if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem1)) < 0)
- ret = -1;
- if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem2)) < 0)
- ret = -1;
- if ((region1_id = H5Rget_region(container1_id, H5R_DATASET_REGION, _mem1)) < 0)
- ret = -1;
- if ((region2_id = H5Rget_region(container2_id, H5R_DATASET_REGION, _mem2)) < 0)
- ret = -1;
+ if (type_size == H5R_DSET_REG_REF_BUF_SIZE) {
+ hid_t region1_id = -1;
+ hid_t region2_id = -1;
- if (ret == -1) {
- options->err_stat = 1;
- return 0;
+ if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem1)) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference2 object 1 failed");
+ }
+ if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem2)) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference2 object 2 failed");
+ }
+ if ((region1_id = H5Rget_region(container1_id, H5R_DATASET_REGION, _mem1)) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_region object 1 failed");
}
+ if ((region2_id = H5Rget_region(container2_id, H5R_DATASET_REGION, _mem2)) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_region object 2 failed");
+ }
+
+ nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, opts);
- nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, options);
H5Oclose(obj1_id);
H5Oclose(obj2_id);
H5Sclose(region1_id);
@@ -770,41 +773,41 @@ static hsize_t diff_datum(
H5O_type_t obj1_type;
H5O_type_t obj2_type;
- if (H5Rget_obj_type2(container1_id, H5R_OBJECT, _mem1, &obj1_type) < 0)
- ret = -1;
- if (H5Rget_obj_type2(container2_id, H5R_OBJECT, _mem2, &obj2_type) < 0)
- ret = -1;
- if (ret == -1) {
- options->err_stat = 1;
- return 0;
- } /* end if */
+ if (H5Rget_obj_type2(container1_id, H5R_OBJECT, _mem1, &obj1_type) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_obj_type2 object 1 failed");
+ }
+ if (H5Rget_obj_type2(container2_id, H5R_OBJECT, _mem2, &obj2_type) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_obj_type2 object 2 failed");
+ }
/* check object type */
- if (obj1_type != obj2_type) {
- parallel_print(
- "Different object types referenced: <%s> and <%s>", obj1, obj2);
- options->not_cmp = 1;
- return 0;
- }
+ if (ret_value >= 0)
+ if (obj1_type != obj2_type) {
+ parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2);
+ opts->not_cmp = 1;
+ HGOTO_DONE (opts->err_stat);
+ }
- if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_OBJECT, _mem1)) < 0)
- ret = -1;
- if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_OBJECT, _mem2)) < 0)
- ret = -1;
- if (ret == -1) {
- options->err_stat = 1;
- return 0;
+ if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_OBJECT, _mem1)) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference2 object 1 failed");
+ }
+ if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_OBJECT, _mem2)) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference2 object 2 failed");
}
/* compare */
if (obj1_type == H5O_TYPE_DATASET)
- nfound = diff_datasetid(obj1_id, obj2_id, NULL, NULL, options);
+ nfound = diff_datasetid(obj1_id, obj2_id, NULL, NULL, opts);
else {
- if (options->m_verbose)
+ if (opts->m_verbose)
parallel_print(
"Warning: Comparison not possible of object types referenced: <%s> and <%s>\n",
obj1, obj2);
- options->not_cmp = 1;
+ opts->not_cmp = 1;
}
H5Oclose(obj1_id);
@@ -818,18 +821,22 @@ static hsize_t diff_datum(
*-------------------------------------------------------------------------
*/
case H5T_VLEN:
- /* get the VL sequences's base datatype for each element */
- memb_type = H5Tget_super(m_type);
- size = H5Tget_size(memb_type);
+ {
+ hid_t memb_type = -1;
- /* get the number of sequence elements */
- nelmts = ((hvl_t *) mem1)->len;
+ /* get the VL sequences's base datatype for each element */
+ memb_type = H5Tget_super(m_type);
+ size = H5Tget_size(memb_type);
- for (j = 0; j < nelmts; j++)
- nfound += diff_datum(((char *) (((hvl_t *) mem1)->p)) + j * size, ((char *) (((hvl_t *) mem2)->p)) + j * size, memb_type, index,
- rank, dims, acc, pos, options, obj1, obj2, container1_id, container2_id, ph, members);
+ /* get the number of sequence elements */
+ nelmts = ((hvl_t *) mem1)->len;
- H5Tclose(memb_type);
+ for (j = 0; j < nelmts; j++)
+ nfound += diff_datum(((char *) (((hvl_t *) mem1)->p)) + j * size, ((char *) (((hvl_t *) mem2)->p)) + j * size, memb_type, index,
+ rank, dims, acc, pos, opts, obj1, obj2, container1_id, container2_id, ph, members);
+
+ H5Tclose(memb_type);
+ }
break;
/*-------------------------------------------------------------------------
@@ -845,13 +852,15 @@ static hsize_t diff_datum(
if (type_size == 1 && type_sign != H5T_SGN_NONE) {
char temp1_char;
char temp2_char;
- HDassert(type_size == sizeof(char));
+
+ if(type_size != sizeof(char))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not char size");
HDmemcpy(&temp1_char, mem1, sizeof(char));
HDmemcpy(&temp2_char, mem2, sizeof(char));
/* -d and !-p */
- if (options->d && !options->p) {
- if (ABS(temp1_char-temp2_char) > options->delta) {
- if (print_data(options)) {
+ if (opts->d && !opts->p) {
+ if (ABS(temp1_char-temp2_char) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
@@ -860,19 +869,19 @@ static hsize_t diff_datum(
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
PER(temp1_char, temp2_char);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per);
@@ -881,19 +890,19 @@ static hsize_t diff_datum(
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
PER(temp1_char, temp2_char);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_char - temp2_char) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_char - temp2_char) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per);
@@ -902,7 +911,7 @@ static hsize_t diff_datum(
}
}
else if (temp1_char != temp2_char) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
@@ -918,14 +927,16 @@ static hsize_t diff_datum(
else if (type_size == 1 && type_sign == H5T_SGN_NONE) {
unsigned char temp1_uchar;
unsigned char temp2_uchar;
- HDassert(type_size == sizeof(unsigned char));
+
+ if(type_size != sizeof(unsigned char))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not unsigned char size");
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
/* -d and !-p */
- if (options->d && !options->p) {
- if (PDIFF(temp1_uchar, temp2_uchar) > options->delta) {
- if (print_data(options)) {
+ if (opts->d && !opts->p) {
+ if (PDIFF(temp1_uchar, temp2_uchar) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
@@ -934,19 +945,19 @@ static hsize_t diff_datum(
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
@@ -955,19 +966,19 @@ static hsize_t diff_datum(
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
}
- else if (per > options->percent && PDIFF(temp1_uchar, temp2_uchar) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && PDIFF(temp1_uchar, temp2_uchar) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
@@ -976,7 +987,7 @@ static hsize_t diff_datum(
}
}
else if (temp1_uchar != temp2_uchar) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
@@ -992,14 +1003,16 @@ static hsize_t diff_datum(
else if (type_size == 2 && type_sign != H5T_SGN_NONE) {
short temp1_short;
short temp2_short;
- HDassert(type_size == sizeof(short));
+
+ if(type_size != sizeof(short))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not short size");
HDmemcpy(&temp1_short, mem1, sizeof(short));
HDmemcpy(&temp2_short, mem2, sizeof(short));
/* -d and !-p */
- if (options->d && !options->p) {
- if (ABS(temp1_short - temp2_short) > options->delta) {
- if (print_data(options)) {
+ if (opts->d && !opts->p) {
+ if (ABS(temp1_short - temp2_short) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
@@ -1008,19 +1021,19 @@ static hsize_t diff_datum(
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
PER(temp1_short, temp2_short);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per);
@@ -1029,19 +1042,19 @@ static hsize_t diff_datum(
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
PER(temp1_short, temp2_short);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_short - temp2_short) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_short - temp2_short) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per);
@@ -1050,7 +1063,7 @@ static hsize_t diff_datum(
}
}
else if (temp1_short != temp2_short) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
@@ -1066,14 +1079,16 @@ static hsize_t diff_datum(
else if (type_size == 2 && type_sign == H5T_SGN_NONE) {
unsigned short temp1_ushort;
unsigned short temp2_ushort;
- HDassert(type_size == sizeof(short));
+
+ if(type_size != sizeof(unsigned short))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not unsigned short size");
HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
/* -d and !-p */
- if (options->d && !options->p) {
- if (PDIFF(temp1_ushort, temp2_ushort) > options->delta) {
- if (print_data(options)) {
+ if (opts->d && !opts->p) {
+ if (PDIFF(temp1_ushort, temp2_ushort) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
@@ -1082,19 +1097,19 @@ static hsize_t diff_datum(
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
PER_UNSIGN(signed short, temp1_ushort, temp2_ushort);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per);
@@ -1103,19 +1118,19 @@ static hsize_t diff_datum(
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
PER_UNSIGN(signed short, temp1_ushort, temp2_ushort);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
}
nfound++;
}
- else if (per > options->percent && PDIFF(temp1_ushort, temp2_ushort) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && PDIFF(temp1_ushort, temp2_ushort) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per);
@@ -1124,7 +1139,7 @@ static hsize_t diff_datum(
}
}
else if (temp1_ushort != temp2_ushort) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
@@ -1140,14 +1155,16 @@ static hsize_t diff_datum(
else if (type_size == 4 && type_sign != H5T_SGN_NONE) {
int temp1_int;
int temp2_int;
- HDassert(type_size == sizeof(int));
+
+ if(type_size != sizeof(int))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not int size");
HDmemcpy(&temp1_int, mem1, sizeof(int));
HDmemcpy(&temp2_int, mem2, sizeof(int));
/* -d and !-p */
- if (options->d && !options->p) {
- if (ABS(temp1_int-temp2_int) > options->delta) {
- if (print_data(options)) {
+ if (opts->d && !opts->p) {
+ if (ABS(temp1_int-temp2_int) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
@@ -1156,19 +1173,19 @@ static hsize_t diff_datum(
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
PER(temp1_int, temp2_int);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per);
@@ -1177,19 +1194,19 @@ static hsize_t diff_datum(
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
PER(temp1_int, temp2_int);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_int - temp2_int) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_int - temp2_int) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per);
@@ -1198,7 +1215,7 @@ static hsize_t diff_datum(
}
}
else if (temp1_int != temp2_int) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
@@ -1214,14 +1231,16 @@ static hsize_t diff_datum(
else if (type_size == 4 && type_sign == H5T_SGN_NONE) {
unsigned int temp1_uint;
unsigned int temp2_uint;
- HDassert(type_size == sizeof(int));
+
+ if(type_size != sizeof(unsigned int))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not unsigned int size");
HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
/* -d and !-p */
- if (options->d && !options->p) {
- if (PDIFF(temp1_uint, temp2_uint) > options->delta) {
- if (print_data(options)) {
+ if (opts->d && !opts->p) {
+ if (PDIFF(temp1_uint, temp2_uint) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(UI_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
@@ -1230,19 +1249,19 @@ static hsize_t diff_datum(
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
PER_UNSIGN(signed int, temp1_uint, temp2_uint);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(UI_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(UI_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per);
@@ -1251,19 +1270,19 @@ static hsize_t diff_datum(
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
PER_UNSIGN(signed int, temp1_uint, temp2_uint);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(UI_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
}
nfound++;
}
- else if (per > options->percent && PDIFF(temp1_uint,temp2_uint) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && PDIFF(temp1_uint,temp2_uint) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(UI_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per);
@@ -1272,7 +1291,7 @@ static hsize_t diff_datum(
}
}
else if (temp1_uint != temp2_uint) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(UI_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
@@ -1288,14 +1307,16 @@ static hsize_t diff_datum(
else if (type_size == 8 && type_sign != H5T_SGN_NONE) {
long temp1_long;
long temp2_long;
- HDassert(type_size == sizeof(long));
+
+ if(type_size != sizeof(long))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not long size");
HDmemcpy(&temp1_long, mem1, sizeof(long));
HDmemcpy(&temp2_long, mem2, sizeof(long));
/* -d and !-p */
- if (options->d && !options->p) {
- if (ABS(temp1_long-temp2_long) > options->delta) {
- if (print_data(options)) {
+ if (opts->d && !opts->p) {
+ if (ABS(temp1_long-temp2_long) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
@@ -1304,19 +1325,19 @@ static hsize_t diff_datum(
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
PER(temp1_long, temp2_long);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per);
@@ -1325,19 +1346,19 @@ static hsize_t diff_datum(
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
PER(temp1_long, temp2_long);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_long-temp2_long) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_long-temp2_long) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per);
@@ -1346,7 +1367,7 @@ static hsize_t diff_datum(
}
}
else if (temp1_long != temp2_long) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
@@ -1362,14 +1383,16 @@ static hsize_t diff_datum(
else if (type_size == 8 && type_sign == H5T_SGN_NONE) {
unsigned long temp1_ulong;
unsigned long temp2_ulong;
- HDassert(type_size == sizeof(unsigned long));
+
+ if(type_size != sizeof(unsigned long))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not unsigned long size");
HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
/* -d and !-p */
- if (options->d && !options->p) {
- if (PDIFF(temp1_ulong, temp2_ulong) > options->delta) {
- if (print_data(options)) {
+ if (opts->d && !opts->p) {
+ if (PDIFF(temp1_ulong, temp2_ulong) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
@@ -1378,19 +1401,19 @@ static hsize_t diff_datum(
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
PER_UNSIGN(signed long, temp1_ulong, temp2_ulong);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per);
@@ -1399,19 +1422,19 @@ static hsize_t diff_datum(
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
PER_UNSIGN(signed long, temp1_ulong, temp2_ulong);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
}
nfound++;
}
- else if (per > options->percent && PDIFF(temp1_ulong,temp2_ulong) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && PDIFF(temp1_ulong,temp2_ulong) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per);
@@ -1420,7 +1443,7 @@ static hsize_t diff_datum(
}
}
else if (temp1_ulong != temp2_ulong) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
@@ -1445,31 +1468,32 @@ static hsize_t diff_datum(
hbool_t isnan1 = FALSE;
hbool_t isnan2 = FALSE;
- HDassert(type_size == sizeof(float));
+ if(type_size != sizeof(float))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not float size");
HDmemcpy(&temp1_float, mem1, sizeof(float));
HDmemcpy(&temp2_float, mem2, sizeof(float));
- /* logic for detecting NaNs is different with options -d, -p and no options */
+ /* logic for detecting NaNs is different with opts -d, -p and no opts */
/*-------------------------------------------------------------------------
* -d and !-p
*-------------------------------------------------------------------------
*/
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_FLOAT, &temp1_float);
isnan2 = my_isnan(FLT_FLOAT, &temp2_float);
}
/* both not NaN, do the comparison */
if (!isnan1 && !isnan2) {
- if (ABS(temp1_float-temp2_float) > (float) options->delta) {
- if (print_data(options)) {
+ if (ABS(temp1_float-temp2_float) > (float) opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
@@ -1479,7 +1503,7 @@ static hsize_t diff_datum(
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
@@ -1491,12 +1515,12 @@ static hsize_t diff_datum(
* !-d and -p
*-------------------------------------------------------------------------
*/
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_FLOAT, &temp1_float);
isnan2 = my_isnan(FLT_FLOAT, &temp2_float);
}
@@ -1506,15 +1530,15 @@ static hsize_t diff_datum(
PER(temp1_float, temp2_float);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
}
- else if (per > options->percent && (double) ABS(temp1_float - temp2_float) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && (double) ABS(temp1_float - temp2_float) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float,
@@ -1525,7 +1549,7 @@ static hsize_t diff_datum(
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
@@ -1537,12 +1561,12 @@ static hsize_t diff_datum(
* -d and -p
*-------------------------------------------------------------------------
*/
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_FLOAT, &temp1_float);
isnan2 = my_isnan(FLT_FLOAT, &temp2_float);
}
@@ -1552,15 +1576,15 @@ static hsize_t diff_datum(
PER(temp1_float, temp2_float);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float,
@@ -1571,7 +1595,7 @@ static hsize_t diff_datum(
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
@@ -1583,8 +1607,8 @@ static hsize_t diff_datum(
* no -d and -p
*-------------------------------------------------------------------------
*/
- else if (equal_float(temp1_float, temp2_float, options) == FALSE) {
- if (print_data(options)) {
+ else if (equal_float(temp1_float, temp2_float, opts) == FALSE) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
@@ -1603,30 +1627,31 @@ static hsize_t diff_datum(
hbool_t isnan1 = FALSE;
hbool_t isnan2 = FALSE;
- HDassert(type_size == sizeof(double));
+ if(type_size != sizeof(double))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not double size");
HDmemcpy(&temp1_double, mem1, sizeof(double));
HDmemcpy(&temp2_double, mem2, sizeof(double));
- /* logic for detecting NaNs is different with options -d, -p and no options */
+ /* logic for detecting NaNs is different with opts -d, -p and no opts */
/*-------------------------------------------------------------------------
* -d and !-p
*-------------------------------------------------------------------------
*/
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_DOUBLE, &temp1_double);
isnan2 = my_isnan(FLT_DOUBLE, &temp2_double);
}
/* both not NaN, do the comparison */
if (!isnan1 && !isnan2) {
- if (ABS(temp1_double-temp2_double) > options->delta) {
- if (print_data(options)) {
+ if (ABS(temp1_double-temp2_double) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -1636,24 +1661,24 @@ static hsize_t diff_datum(
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- } /* options->d && !options->p */
+ } /* opts->d && !opts->p */
/*-------------------------------------------------------------------------
* !-d and -p
*-------------------------------------------------------------------------
*/
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_DOUBLE, &temp1_double);
isnan2 = my_isnan(FLT_DOUBLE, &temp2_double);
}
@@ -1663,15 +1688,15 @@ static hsize_t diff_datum(
PER(temp1_double, temp2_double);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
@@ -1681,7 +1706,7 @@ static hsize_t diff_datum(
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -1693,12 +1718,12 @@ static hsize_t diff_datum(
* -d and -p
*-------------------------------------------------------------------------
*/
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_DOUBLE, &temp1_double);
isnan2 = my_isnan(FLT_DOUBLE, &temp2_double);
}
@@ -1708,16 +1733,16 @@ static hsize_t diff_datum(
PER(temp1_double, temp2_double);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- else if (per > options->percent &&
- ABS(temp1_double-temp2_double) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent &&
+ ABS(temp1_double-temp2_double) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
@@ -1727,7 +1752,7 @@ static hsize_t diff_datum(
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -1739,8 +1764,8 @@ static hsize_t diff_datum(
* no -d and -p
*-------------------------------------------------------------------------
*/
- else if (equal_double(temp1_double, temp2_double, options) == FALSE) {
- if (print_data(options)) {
+ else if (equal_double(temp1_double, temp2_double, opts) == FALSE) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -1761,7 +1786,9 @@ static hsize_t diff_datum(
hbool_t isnan1 = FALSE;
hbool_t isnan2 = FALSE;
- HDassert(type_size == sizeof(long double));
+ if(type_size != sizeof(long double)) {
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not long double size");
+ }
HDmemcpy(&temp1_double, mem1, sizeof(long double));
HDmemcpy(&temp2_double, mem2, sizeof(long double));
@@ -1772,20 +1799,20 @@ static hsize_t diff_datum(
* -d and !-p
*-------------------------------------------------------------------------
*/
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_LDOUBLE,&temp1_double);
isnan2 = my_isnan(FLT_LDOUBLE,&temp2_double);
}
/* both not NaN, do the comparison */
if (!isnan1 && !isnan2) {
- if (ABS(temp1_double-temp2_double) > options->delta) {
- if (print_data(options)) {
+ if (ABS(temp1_double-temp2_double) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LD_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -1795,7 +1822,7 @@ static hsize_t diff_datum(
} /* NaN */
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -1807,12 +1834,12 @@ static hsize_t diff_datum(
* !-d and -p
*-------------------------------------------------------------------------
*/
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_LDOUBLE, &temp1_double);
isnan2 = my_isnan(FLT_LDOUBLE, &temp2_double);
}
@@ -1822,15 +1849,15 @@ static hsize_t diff_datum(
PER(temp1_double,temp2_double);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
@@ -1840,7 +1867,7 @@ static hsize_t diff_datum(
} /* NaN */
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -1852,30 +1879,30 @@ static hsize_t diff_datum(
* -d and -p
*-------------------------------------------------------------------------
*/
- else if ( options->d && options->p) {
+ else if (opts->d && opts->p) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_LDOUBLE, &temp1_double);
isnan2 = my_isnan(FLT_LDOUBLE, &temp2_double);
}
/* both not NaN, do the comparison */
- if ( !isnan1 && !isnan2) {
+ if (!isnan1 && !isnan2) {
PER(temp1_double,temp2_double);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_double-temp2_double) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_double-temp2_double) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
@@ -1885,7 +1912,7 @@ static hsize_t diff_datum(
} /* NaN */
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -1897,8 +1924,8 @@ static hsize_t diff_datum(
* no -d and -p
*-------------------------------------------------------------------------
*/
- else if (equal_ldouble(temp1_double, temp2_double, options) == FALSE) {
- if (print_data(options)) {
+ else if (equal_ldouble(temp1_double, temp2_double, opts) == FALSE) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LD_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -1911,7 +1938,11 @@ static hsize_t diff_datum(
break; /* H5T_FLOAT class */
} /* switch */
- h5difftrace("diff_datum finish\n");
+
+done:
+ opts->err_stat = opts->err_stat | ret_value;
+
+ h5diffdebug3("diff_datum finish:%d - errstat:%d\n", nfound, opts->err_stat);
return nfound;
}
@@ -1922,7 +1953,6 @@ static hsize_t diff_datum(
* Purpose: Determines if memory is initialized to all zero bytes.
*
* Return: TRUE if all bytes are zero; FALSE otherwise
- *
*-------------------------------------------------------------------------
*/
@@ -1942,7 +1972,6 @@ static hbool_t all_zero(const void *_mem, size_t size) {
* Purpose: print start coordinates and opposite corner of a region block
*
* Return: void
- *
*-------------------------------------------------------------------------
*/
@@ -1965,7 +1994,6 @@ void print_region_block(int i, hsize_t *ptdata, int ndims) {
* Purpose: print points of a region reference
*
* Return: void
- *
*-------------------------------------------------------------------------
*/
@@ -1986,18 +2014,18 @@ void print_points(int i, hsize_t *ptdata, int ndims) {
* Purpose: diff a dataspace region
*
* Return: number of differences
- *
*-------------------------------------------------------------------------
*/
-static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, diff_opt_t *options)
+static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, diff_opt_t *opts)
{
+ hsize_t ret_value = 0;
hssize_t nblocks1, npoints1;
hssize_t nblocks2, npoints2;
hsize_t alloc_size;
- hsize_t *ptdata1;
- hsize_t *ptdata2;
+ hsize_t *ptdata1 = NULL;
+ hsize_t *ptdata2 = NULL;
int ndims1;
int ndims2;
int i, j;
@@ -2012,18 +2040,17 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
* respectively. They do not currently know how to translate from one to
* the other.
*/
- H5E_BEGIN_TRY
- {
- nblocks1 = H5Sget_select_hyper_nblocks(region1_id);
- nblocks2 = H5Sget_select_hyper_nblocks(region2_id);
+ H5E_BEGIN_TRY {
+ nblocks1 = H5Sget_select_hyper_nblocks(region1_id);
+ nblocks2 = H5Sget_select_hyper_nblocks(region2_id);
- npoints1 = H5Sget_select_elem_npoints(region1_id);
- npoints2 = H5Sget_select_elem_npoints(region2_id);
- }H5E_END_TRY;
+ npoints1 = H5Sget_select_elem_npoints(region1_id);
+ npoints2 = H5Sget_select_elem_npoints(region2_id);
+ } H5E_END_TRY;
if (nblocks1 != nblocks2 || npoints1 != npoints2 || ndims1 != ndims2) {
- options->not_cmp = 1;
- return 0;
+ opts->not_cmp = 1;
+ HGOTO_DONE (0);
}
/*-------------------------------------------------------------------------
@@ -2032,57 +2059,62 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
*/
if (nblocks1 > 0) {
HDassert(ndims1 > 0);
- alloc_size = (hsize_t) nblocks1 * (unsigned) ndims1 * 2
- * sizeof(ptdata1[0]);
+ alloc_size = (hsize_t) nblocks1 * (unsigned) ndims1 * 2 * sizeof(ptdata1[0]);
HDassert(alloc_size == (hsize_t)((size_t )alloc_size)); /*check for overflow*/
- ptdata1 = (hsize_t *) HDmalloc((size_t )alloc_size);
- H5_CHECK_OVERFLOW(nblocks1, hssize_t, hsize_t);
- H5Sget_select_hyper_blocklist(region1_id, (hsize_t) 0,
- (hsize_t) nblocks1, ptdata1);
-
- ptdata2 = (hsize_t *) HDmalloc((size_t )alloc_size);
- H5_CHECK_OVERFLOW(nblocks2, hssize_t, hsize_t);
- H5Sget_select_hyper_blocklist(region2_id, (hsize_t) 0,
- (hsize_t) nblocks2, ptdata2);
-
- for (i = 0; i < nblocks1; i++) {
- /* start coordinates and opposite corner */
- for (j = 0; j < ndims1; j++) {
- hsize_t start1, start2, end1, end2;
+ if((ptdata1 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "Buffer allocation failed");
+ }
+ else {
+ H5_CHECK_OVERFLOW(nblocks1, hssize_t, hsize_t);
+ H5Sget_select_hyper_blocklist(region1_id, (hsize_t) 0, (hsize_t) nblocks1, ptdata1);
- start1 = ptdata1[i * 2 * ndims1 + j];
- start2 = ptdata2[i * 2 * ndims1 + j];
- end1 = ptdata1[i * 2 * ndims1 + j + ndims1];
- end2 = ptdata2[i * 2 * ndims1 + j + ndims1];
- if (start1 != start2 || end1 != end2)
- nfound_b++;
+ if((ptdata2 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "Buffer allocation failed");
}
- }
+ else {
+ H5_CHECK_OVERFLOW(nblocks2, hssize_t, hsize_t);
+ H5Sget_select_hyper_blocklist(region2_id, (hsize_t) 0, (hsize_t) nblocks2, ptdata2);
+
+ for (i = 0; i < nblocks1; i++) {
+ /* start coordinates and opposite corner */
+ for (j = 0; j < ndims1; j++) {
+ hsize_t start1, start2, end1, end2;
+
+ start1 = ptdata1[i * 2 * ndims1 + j];
+ start2 = ptdata2[i * 2 * ndims1 + j];
+ end1 = ptdata1[i * 2 * ndims1 + j + ndims1];
+ end2 = ptdata2[i * 2 * ndims1 + j + ndims1];
+ if (start1 != start2 || end1 != end2)
+ nfound_b++;
+ }
+ }
- /* print differences if found */
- if (nfound_b && options->m_verbose) {
- H5O_info_t oi1, oi2;
+ /* print differences if found */
+ if (nfound_b && opts->m_verbose) {
+ H5O_info_t oi1, oi2;
- H5Oget_info(obj1_id, &oi1);
- H5Oget_info(obj2_id, &oi2);
+ H5Oget_info(obj1_id, &oi1);
+ H5Oget_info(obj2_id, &oi2);
- parallel_print("Referenced dataset %lu %lu\n",
- (unsigned long) oi1.addr, (unsigned long) oi2.addr);
- parallel_print(
- "------------------------------------------------------------\n");
+ parallel_print("Referenced dataset %lu %lu\n", (unsigned long) oi1.addr, (unsigned long) oi2.addr);
+ parallel_print( "------------------------------------------------------------\n");
- parallel_print("Region blocks\n");
- for (i = 0; i < nblocks1; i++) {
- parallel_print("block #%d", i);
- print_region_block(i, ptdata1, ndims1);
- print_region_block(i, ptdata2, ndims1);
- parallel_print("\n");
- }
- }
+ parallel_print("Region blocks\n");
+ for (i = 0; i < nblocks1; i++) {
+ parallel_print("block #%d", i);
+ print_region_block(i, ptdata1, ndims1);
+ print_region_block(i, ptdata2, ndims1);
+ parallel_print("\n");
+ }
+ }
+ HDfree(ptdata2);
+ } /* else ptdata2 */
- HDfree(ptdata1);
- HDfree(ptdata2);
+ HDfree(ptdata1);
+ } /* else ptdata1 */
}
/*-------------------------------------------------------------------------
@@ -2090,98 +2122,107 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
*-------------------------------------------------------------------------
*/
if (npoints1 > 0) {
- alloc_size = (hsize_t) npoints1 * (unsigned) ndims1
- * sizeof(ptdata1[0]);
+ alloc_size = (hsize_t) npoints1 * (unsigned) ndims1 * sizeof(ptdata1[0]);
HDassert(alloc_size == (hsize_t)((size_t )alloc_size)); /*check for overflow*/
- ptdata1 = (hsize_t *) HDmalloc((size_t )alloc_size);
- H5_CHECK_OVERFLOW(npoints1, hssize_t, hsize_t);
- H5Sget_select_elem_pointlist(region1_id, (hsize_t) 0,
- (hsize_t) npoints1, ptdata1);
-
- ptdata2 = (hsize_t *) HDmalloc((size_t )alloc_size);
- H5_CHECK_OVERFLOW(npoints1, hssize_t, hsize_t);
- H5Sget_select_elem_pointlist(region2_id, (hsize_t) 0,
- (hsize_t) npoints2, ptdata2);
-
- for (i = 0; i < npoints1; i++) {
- hsize_t pt1, pt2;
+ if((ptdata1 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "Buffer allocation failed");
+ }
+ else {
+ H5_CHECK_OVERFLOW(npoints1, hssize_t, hsize_t);
+ H5Sget_select_elem_pointlist(region1_id, (hsize_t) 0, (hsize_t) npoints1, ptdata1);
- for (j = 0; j < ndims1; j++) {
- pt1 = ptdata1[i * ndims1 + j];
- pt2 = ptdata2[i * ndims1 + j];
- if (pt1 != pt2)
- nfound_p++;
+ if((ptdata2 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "Buffer allocation failed");
}
- }
+ else {
+ H5_CHECK_OVERFLOW(npoints1, hssize_t, hsize_t);
+ H5Sget_select_elem_pointlist(region2_id, (hsize_t) 0, (hsize_t) npoints2, ptdata2);
- if (nfound_p && options->m_verbose) {
- parallel_print("Region points\n");
- for (i = 0; i < npoints1; i++) {
- hsize_t pt1, pt2;
- int diff_data = 0;
-
- for (j = 0; j < ndims1; j++) {
- pt1 = ptdata1[i * ndims1 + j];
- pt2 = ptdata2[i * ndims1 + j];
- if (pt1 != pt2) {
- diff_data = 1;
- break;
+ for (i = 0; i < npoints1; i++) {
+ hsize_t pt1, pt2;
+
+ for (j = 0; j < ndims1; j++) {
+ pt1 = ptdata1[i * ndims1 + j];
+ pt2 = ptdata2[i * ndims1 + j];
+ if (pt1 != pt2)
+ nfound_p++;
}
}
- if (diff_data) {
- parallel_print("point #%d", i);
- print_points(i, ptdata1, ndims1);
- print_points(i, ptdata2, ndims1);
- parallel_print("\n");
+
+ if (nfound_p && opts->m_verbose) {
+ parallel_print("Region points\n");
+ for (i = 0; i < npoints1; i++) {
+ hsize_t pt1, pt2;
+ int diff_data = 0;
+
+ for (j = 0; j < ndims1; j++) {
+ pt1 = ptdata1[i * ndims1 + j];
+ pt2 = ptdata2[i * ndims1 + j];
+ if (pt1 != pt2) {
+ diff_data = 1;
+ break;
+ }
+ }
+ if (diff_data) {
+ parallel_print("point #%d", i);
+ print_points(i, ptdata1, ndims1);
+ print_points(i, ptdata2, ndims1);
+ parallel_print("\n");
+ }
+ }
}
- }
- }
+ HDfree(ptdata2);
+ } /* else ptdata2 */
#if defined (H5DIFF_DEBUG)
- for (i = 0; i < npoints1; i++) {
- int j;
-
- parallel_print("%sPt%lu: " , i ? "," : "", (unsigned long)i);
+ for (i = 0; i < npoints1; i++) {
+ parallel_print("%sPt%lu: " , i ? "," : "", (unsigned long)i);
- for (j = 0; j < ndims1; j++)
- parallel_print("%s%lu", j ? "," : "(",
- (unsigned long)(ptdata1[i * ndims1 + j]));
+ for (j = 0; j < ndims1; j++)
+ parallel_print("%s%lu", j ? "," : "(", (unsigned long)(ptdata1[i * ndims1 + j]));
- parallel_print(")");
- }
+ parallel_print(")");
+ }
#endif
- HDfree(ptdata1);
- HDfree(ptdata2);
+ HDfree(ptdata1);
+ } /* else ptdata1 */
}
nfound_b = nfound_b / (unsigned) ndims1;
nfound_p = nfound_p / (unsigned) ndims1;
- return (nfound_p + nfound_b);
+
+ ret_value = nfound_p + nfound_b;
+
+done:
+ return ret_value;
}
/*-------------------------------------------------------------------------
* Function: character_compare
*
- * Purpose: do a byte-by-byte comparison and print in char format
- *
- * Return: number of differences found
+ * Purpose: do a byte-by-byte comparison and print in char format
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u,
- int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1, const char *obj2, int *ph) {
+ int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, const char *obj2, int *ph)
+{
hsize_t nfound = 0; /* differences found */
char temp1_uchar;
char temp2_uchar;
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
- HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); h5diffdebug3("character_compare start %d=%d\n",temp1_uchar,temp2_uchar);
+ HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
+ h5diffdebug3("character_compare start %d=%d\n",temp1_uchar,temp2_uchar);
if (temp1_uchar != temp2_uchar) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_char_pos(ph, 0, i, u, acc, pos, rank, dims, obj1, obj2);
parallel_print(" ");
h5diff_print_char(temp1_uchar);
@@ -2199,20 +2240,20 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u,
/*-------------------------------------------------------------------------
* Function: character_compare_opt
*
- * Purpose: do a byte-by-byte comparison and print in numerical format
- *
- * Return: number of differences found
+ * Purpose: do a byte-by-byte comparison and print in numerical format
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
- hsize_t i, int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1, const char *obj2, int *ph) {
- hsize_t nfound = 0; /* differences found */
+ hsize_t i, int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, const char *obj2, int *ph)
+{
+ hsize_t nfound = 0; /* differences found */
unsigned char temp1_uchar;
unsigned char temp2_uchar;
- double per;
- hbool_t both_zero;
+ double per;
+ hbool_t both_zero;
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
@@ -2220,9 +2261,9 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
h5difftrace("character_compare_opt start\n");
/* -d and !-p */
- if (options->d && !options->p) {
- if (PDIFF(temp1_uchar,temp2_uchar) > options->delta) {
- if (print_data(options)) {
+ if (opts->d && !opts->p) {
+ if (PDIFF(temp1_uchar,temp2_uchar) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
@@ -2231,10 +2272,10 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
- if (per > options->percent) {
- if (print_data(options)) {
+ if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
@@ -2243,10 +2284,10 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
- if (per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta) {
- if (print_data(options)) {
+ if (per > opts->percent && PDIFF(temp1_uchar,temp2_uchar) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
@@ -2255,7 +2296,7 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
}
}
else if (temp1_uchar != temp2_uchar) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
@@ -2269,14 +2310,14 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_float
*
- * Purpose: diff a H5T_NATIVE_FLOAT type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_FLOAT type
*
+ * Return: number of differences found
+*
*-------------------------------------------------------------------------
*/
static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
@@ -2296,7 +2337,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
*-------------------------------------------------------------------------
*/
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_float, mem1, sizeof(float));
HDmemcpy(&temp2_float, mem2, sizeof(float));
@@ -2305,15 +2346,15 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_FLOAT, &temp1_float);
isnan2 = my_isnan(FLT_FLOAT, &temp2_float);
}
/* both not NaN, do the comparison */
if (!isnan1 && !isnan2) {
- if ((double) ABS(temp1_float - temp2_float) > options->delta) {
- if (print_data(options)) {
+ if ((double) ABS(temp1_float - temp2_float) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
@@ -2323,7 +2364,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
@@ -2333,7 +2374,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(float);
mem2 += sizeof(float);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* i */
}
@@ -2341,7 +2382,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
* !-d and -p
*-------------------------------------------------------------------------
*/
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_float, mem1, sizeof(float));
HDmemcpy(&temp2_float, mem2, sizeof(float));
@@ -2350,7 +2391,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_FLOAT, &temp1_float);
isnan2 = my_isnan(FLT_FLOAT, &temp2_float);
}
@@ -2359,15 +2400,15 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
PER(temp1_float, temp2_float);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float,
@@ -2378,7 +2419,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
@@ -2388,7 +2429,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(float);
mem2 += sizeof(float);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* i */
}
@@ -2396,7 +2437,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
* -d and -p
*-------------------------------------------------------------------------
*/
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_float, mem1, sizeof(float));
HDmemcpy(&temp2_float, mem2, sizeof(float));
@@ -2405,7 +2446,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_FLOAT, &temp1_float);
isnan2 = my_isnan(FLT_FLOAT, &temp2_float);
}
@@ -2415,15 +2456,15 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
PER(temp1_float, temp2_float);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
}
- else if (per > options->percent && (double) ABS(temp1_float - temp2_float) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && (double) ABS(temp1_float - temp2_float) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float,
@@ -2435,7 +2476,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
@@ -2445,7 +2486,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(float);
mem2 += sizeof(float);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* i */
}
@@ -2459,8 +2500,8 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp1_float, mem1, sizeof(float));
HDmemcpy(&temp2_float, mem2, sizeof(float));
- if (equal_float(temp1_float, temp2_float, options) == FALSE) {
- if (print_data(options)) {
+ if (equal_float(temp1_float, temp2_float, opts) == FALSE) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
@@ -2470,7 +2511,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(float);
mem2 += sizeof(float);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -2482,23 +2523,22 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_double
*
- * Purpose: diff a H5T_NATIVE_DOUBLE type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_DOUBLE type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
hsize_t nfound = 0; /* number of differences found */
- double temp1_double;
- double temp2_double;
+ double temp1_double;
+ double temp2_double;
hsize_t i;
- double per;
+ double per;
hbool_t both_zero;
hbool_t isnan1 = FALSE;
hbool_t isnan2 = FALSE;
@@ -2509,7 +2549,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
*-------------------------------------------------------------------------
*/
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_double, mem1, sizeof(double));
HDmemcpy(&temp2_double, mem2, sizeof(double));
@@ -2518,15 +2558,15 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_DOUBLE, &temp1_double);
isnan2 = my_isnan(FLT_DOUBLE, &temp2_double);
}
/* both not NaN, do the comparison */
if (!isnan1 && !isnan2) {
- if (ABS(temp1_double-temp2_double) > options->delta) {
- if (print_data(options)) {
+ if (ABS(temp1_double-temp2_double) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -2536,7 +2576,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -2546,7 +2586,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(double);
mem2 += sizeof(double);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* i */
}
@@ -2555,7 +2595,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
* !-d and -p
*-------------------------------------------------------------------------
*/
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_double, mem1, sizeof(double));
HDmemcpy(&temp2_double, mem2, sizeof(double));
@@ -2564,7 +2604,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_DOUBLE, &temp1_double);
isnan2 = my_isnan(FLT_DOUBLE, &temp2_double);
}
@@ -2573,15 +2613,15 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
PER(temp1_double, temp2_double);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P, temp1_double, temp2_double,
@@ -2592,7 +2632,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -2602,7 +2642,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(double);
mem2 += sizeof(double);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* i */
}
@@ -2610,7 +2650,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
* -d and -p
*-------------------------------------------------------------------------
*/
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_double, mem1, sizeof(double));
@@ -2620,7 +2660,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_DOUBLE, &temp1_double);
isnan2 = my_isnan(FLT_DOUBLE, &temp2_double);
}
@@ -2630,15 +2670,15 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
PER(temp1_double, temp2_double);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_double-temp2_double) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_double-temp2_double) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P, temp1_double, temp2_double,
@@ -2649,7 +2689,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -2658,7 +2698,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(double);
mem2 += sizeof(double);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* i */
}
@@ -2671,8 +2711,8 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp1_double, mem1, sizeof(double));
HDmemcpy(&temp2_double, mem2, sizeof(double));
- if (equal_double(temp1_double, temp2_double, options) == FALSE) {
- if (print_data(options)) {
+ if (equal_double(temp1_double, temp2_double, opts) == FALSE) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -2682,7 +2722,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(double);
mem2 += sizeof(double);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -2694,10 +2734,9 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_ldouble
*
- * Purpose: diff a H5T_NATIVE_LDOUBLE type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_LDOUBLE type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
#if H5_SIZEOF_LONG_DOUBLE !=0
@@ -2710,13 +2749,13 @@ static hsize_t diff_ldouble(unsigned char *mem1,
hsize_t *dims,
hsize_t *acc,
hsize_t *pos,
- diff_opt_t *options,
+ diff_opt_t *opts,
const char *obj1,
const char *obj2,
int *ph)
{
- hsize_t nfound=0; /* number of differences found */
+ hsize_t nfound = 0; /* number of differences found */
long double temp1_double;
long double temp2_double;
hsize_t i;
@@ -2732,7 +2771,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
*-------------------------------------------------------------------------
*/
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for ( i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_double, mem1, sizeof(long double));
HDmemcpy(&temp2_double, mem2, sizeof(long double));
@@ -2741,15 +2780,15 @@ static hsize_t diff_ldouble(unsigned char *mem1,
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_LDOUBLE,&temp1_double);
isnan2 = my_isnan(FLT_LDOUBLE,&temp2_double);
}
/* both not NaN, do the comparison */
if (!isnan1 && !isnan2) {
- if (ABS(temp1_double-temp2_double) > options->delta) {
- if (print_data(options)) {
+ if (ABS(temp1_double-temp2_double) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -2759,7 +2798,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -2769,7 +2808,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
}
mem1 += sizeof(long double);
mem2 += sizeof(long double);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* i */
}
@@ -2778,7 +2817,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
* !-d and -p
*-------------------------------------------------------------------------
*/
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_double, mem1, sizeof(long double));
HDmemcpy(&temp2_double, mem2, sizeof(long double));
@@ -2787,7 +2826,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_LDOUBLE, &temp1_double);
isnan2 = my_isnan(FLT_LDOUBLE, &temp2_double);
}
@@ -2796,15 +2835,15 @@ static hsize_t diff_ldouble(unsigned char *mem1,
PER(temp1_double, temp2_double);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P, temp1_double, temp2_double,
@@ -2815,7 +2854,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start+i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -2824,7 +2863,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
}
mem1 += sizeof(long double);
mem2 += sizeof(long double);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* i */
}
@@ -2832,7 +2871,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
* -d and -p
*-------------------------------------------------------------------------
*/
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_double, mem1, sizeof(long double));
HDmemcpy(&temp2_double, mem2, sizeof(long double));
@@ -2841,7 +2880,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_LDOUBLE, &temp1_double);
isnan2 = my_isnan(FLT_LDOUBLE, &temp2_double);
}
@@ -2851,15 +2890,15 @@ static hsize_t diff_ldouble(unsigned char *mem1,
PER(temp1_double, temp2_double);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_double - temp2_double) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_double - temp2_double) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1-temp2_double / temp1_double));
@@ -2869,7 +2908,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -2878,7 +2917,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
}
mem1 += sizeof(long double);
mem2 += sizeof(long double);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* i */
}
@@ -2891,8 +2930,8 @@ static hsize_t diff_ldouble(unsigned char *mem1,
HDmemcpy(&temp1_double, mem1, sizeof(long double));
HDmemcpy(&temp2_double, mem2, sizeof(long double));
- if (equal_ldouble(temp1_double, temp2_double, options) == FALSE) {
- if (print_data(options)) {
+ if (equal_ldouble(temp1_double, temp2_double, opts) == FALSE) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -2901,7 +2940,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
}
mem1 += sizeof(long double);
mem2 += sizeof(long double);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -2914,34 +2953,33 @@ static hsize_t diff_ldouble(unsigned char *mem1,
/*-------------------------------------------------------------------------
* Function: diff_schar
*
- * Purpose: diff a H5T_NATIVE_SCHAR type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_SCHAR type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
hsize_t nfound = 0; /* number of differences found */
- char temp1_char;
- char temp2_char;
+ char temp1_char;
+ char temp2_char;
hsize_t i;
- double per;
+ double per;
hbool_t both_zero;
h5difftrace("diff_schar start\n");
/* -d and !-p */
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_char, mem1, sizeof(char));
HDmemcpy(&temp2_char, mem2, sizeof(char));
- if (ABS(temp1_char-temp2_char) > options->delta) {
- if (print_data(options)) {
+ if (ABS(temp1_char-temp2_char) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
@@ -2950,12 +2988,12 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(char);
mem2 += sizeof(char);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_char, mem1, sizeof(char));
HDmemcpy(&temp2_char, mem2, sizeof(char));
@@ -2963,15 +3001,15 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
PER(temp1_char, temp2_char);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per);
@@ -2980,12 +3018,12 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(char);
mem2 += sizeof(char);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_char, mem1, sizeof(char));
HDmemcpy(&temp2_char, mem2, sizeof(char));
@@ -2993,15 +3031,15 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
PER(temp1_char, temp2_char);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_char-temp2_char) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_char-temp2_char) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per);
@@ -3010,7 +3048,7 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(char);
mem2 += sizeof(char);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
@@ -3020,7 +3058,7 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp2_char, mem2, sizeof(char));
if (temp1_char != temp2_char) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
@@ -3030,7 +3068,7 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(char);
mem2 += sizeof(char);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -3042,33 +3080,32 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_uchar
*
- * Purpose: diff a H5T_NATIVE_UCHAR type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_UCHAR type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
- hsize_t nfound = 0; /* number of differences found */
+ hsize_t nfound = 0; /* number of differences found */
unsigned char temp1_uchar;
unsigned char temp2_uchar;
- hsize_t i;
- double per;
- hbool_t both_zero;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_uchar start\n");
/* -d and !-p */
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
- if (PDIFF(temp1_uchar,temp2_uchar) > options->delta) {
- if (print_data(options)) {
+ if (PDIFF(temp1_uchar,temp2_uchar) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
@@ -3077,12 +3114,12 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned char);
mem2 += sizeof(unsigned char);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
@@ -3090,15 +3127,15 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
@@ -3107,12 +3144,12 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned char);
mem2 += sizeof(unsigned char);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
@@ -3120,15 +3157,15 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
}
- else if (per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && PDIFF(temp1_uchar,temp2_uchar) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
@@ -3137,7 +3174,7 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned char);
mem2 += sizeof(unsigned char);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
@@ -3147,7 +3184,7 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
if (temp1_uchar != temp2_uchar) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
@@ -3157,7 +3194,7 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(unsigned char);
mem2 += sizeof(unsigned char);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -3169,33 +3206,32 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_short
*
- * Purpose: diff a H5T_NATIVE_SHORT type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_SHORT type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
hsize_t nfound = 0; /* number of differences found */
- short temp1_short;
- short temp2_short;
+ short temp1_short;
+ short temp2_short;
hsize_t i;
- double per;
+ double per;
hbool_t both_zero;
h5difftrace("diff_short start\n");
/* -d and !-p */
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_short, mem1, sizeof(short));
HDmemcpy(&temp2_short, mem2, sizeof(short));
- if (ABS(temp1_short-temp2_short) > options->delta) {
- if (print_data(options)) {
+ if (ABS(temp1_short-temp2_short) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
@@ -3204,12 +3240,12 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(short);
mem2 += sizeof(short);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_short, mem1, sizeof(short));
HDmemcpy(&temp2_short, mem2, sizeof(short));
@@ -3217,15 +3253,15 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
PER(temp1_short, temp2_short);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per);
@@ -3234,12 +3270,12 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(short);
mem2 += sizeof(short);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_short, mem1, sizeof(short));
HDmemcpy(&temp2_short, mem2, sizeof(short));
@@ -3247,15 +3283,15 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
PER(temp1_short, temp2_short);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_short-temp2_short) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_short-temp2_short) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per);
@@ -3264,7 +3300,7 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(short);
mem2 += sizeof(short);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
@@ -3274,7 +3310,7 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp2_short, mem2, sizeof(short));
if (temp1_short != temp2_short) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
@@ -3284,7 +3320,7 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(short);
mem2 += sizeof(short);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -3296,34 +3332,33 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_ushort
*
- * Purpose: diff a H5T_NATIVE_USHORT type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_USHORT type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
- hsize_t nfound = 0; /* number of differences found */
+ hsize_t nfound = 0; /* number of differences found */
unsigned short temp1_ushort;
unsigned short temp2_ushort;
- hsize_t i;
- double per;
- hbool_t both_zero;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_ushort start\n");
/* -d and !-p */
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
- if (PDIFF(temp1_ushort,temp2_ushort) > options->delta) {
- if (print_data(options)) {
+ if (PDIFF(temp1_ushort,temp2_ushort) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
@@ -3332,12 +3367,12 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned short);
mem2 += sizeof(unsigned short);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
@@ -3345,15 +3380,15 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
PER_UNSIGN(signed short, temp1_ushort, temp2_ushort);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per);
@@ -3362,12 +3397,12 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned short);
mem2 += sizeof(unsigned short);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
@@ -3375,15 +3410,15 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
PER_UNSIGN(signed short, temp1_ushort, temp2_ushort);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
}
nfound++;
}
- else if (per > options->percent && PDIFF(temp1_ushort,temp2_ushort) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && PDIFF(temp1_ushort,temp2_ushort) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per);
@@ -3392,7 +3427,7 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned short);
mem2 += sizeof(unsigned short);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
@@ -3402,7 +3437,7 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
if (temp1_ushort != temp2_ushort) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
@@ -3412,7 +3447,7 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(unsigned short);
mem2 += sizeof(unsigned short);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -3422,35 +3457,34 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
}
/*-------------------------------------------------------------------------
- * Function: diff_int
- *
- * Purpose: diff a H5T_NATIVE_INT type
+ * Function: diff_int
*
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_INT type
*
- *-------------------------------------------------------------------------
+ * Return: number of differences found
+ *-------------------------------------------------------------------------
*/
static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
hsize_t nfound = 0; /* number of differences found */
- int temp1_int;
- int temp2_int;
+ int temp1_int;
+ int temp2_int;
hsize_t i;
- double per;
+ double per;
hbool_t both_zero;
h5difftrace("diff_int start\n");
/* -d and !-p */
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_int, mem1, sizeof(int));
HDmemcpy(&temp2_int, mem2, sizeof(int));
- if (ABS(temp1_int-temp2_int) > options->delta) {
- if (print_data(options)) {
+ if (ABS(temp1_int-temp2_int) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
@@ -3459,12 +3493,12 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(int);
mem2 += sizeof(int);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_int, mem1, sizeof(int));
HDmemcpy(&temp2_int, mem2, sizeof(int));
@@ -3472,15 +3506,15 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
PER(temp1_int, temp2_int);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per);
@@ -3489,12 +3523,12 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(int);
mem2 += sizeof(int);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_int, mem1, sizeof(int));
HDmemcpy(&temp2_int, mem2, sizeof(int));
@@ -3502,15 +3536,15 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
PER(temp1_int, temp2_int);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_int-temp2_int) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_int-temp2_int) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per);
@@ -3519,7 +3553,7 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(int);
mem2 += sizeof(int);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
@@ -3529,7 +3563,7 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp2_int, mem2, sizeof(int));
if (temp1_int != temp2_int) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
@@ -3539,7 +3573,7 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(int);
mem2 += sizeof(int);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
@@ -3551,15 +3585,14 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_uint
*
- * Purpose: diff a H5T_NATIVE_UINT type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_UINT type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
hsize_t nfound = 0; /* number of differences found */
@@ -3571,13 +3604,13 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
h5difftrace("diff_uint start\n");
/* -d and !-p */
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
- if (PDIFF(temp1_uint,temp2_uint) > options->delta) {
- if (print_data(options)) {
+ if (PDIFF(temp1_uint,temp2_uint) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
@@ -3586,12 +3619,12 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned int);
mem2 += sizeof(unsigned int);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
@@ -3599,15 +3632,15 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
PER_UNSIGN(signed int, temp1_uint, temp2_uint);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per);
@@ -3616,12 +3649,12 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned int);
mem2 += sizeof(unsigned int);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
@@ -3629,16 +3662,16 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
PER_UNSIGN(signed int, temp1_uint, temp2_uint);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
}
nfound++;
}
- else if (per > options->percent
- && PDIFF(temp1_uint,temp2_uint) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent
+ && PDIFF(temp1_uint,temp2_uint) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per);
@@ -3647,7 +3680,7 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned int);
mem2 += sizeof(unsigned int);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
@@ -3657,7 +3690,7 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
if (temp1_uint != temp2_uint) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
@@ -3667,7 +3700,7 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(unsigned int);
mem2 += sizeof(unsigned int);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -3679,15 +3712,14 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_long
*
- * Purpose: diff a H5T_NATIVE_LONG type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_LONG type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
hsize_t nfound = 0; /* number of differences found */
@@ -3699,14 +3731,14 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
h5difftrace("diff_long start\n");
/* -d and !-p */
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_long, mem1, sizeof(long));
HDmemcpy(&temp2_long, mem2, sizeof(long));
- if (ABS(temp1_long-temp2_long) > options->delta) {
- if (print_data(options)) {
+ if (ABS(temp1_long-temp2_long) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
@@ -3715,13 +3747,13 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(long);
mem2 += sizeof(long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_long, mem1, sizeof(long));
HDmemcpy(&temp2_long, mem2, sizeof(long));
@@ -3729,15 +3761,15 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
PER(temp1_long, temp2_long);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per);
@@ -3746,12 +3778,12 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(long);
mem2 += sizeof(long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_long, mem1, sizeof(long));
HDmemcpy(&temp2_long, mem2, sizeof(long));
@@ -3759,15 +3791,15 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
PER(temp1_long, temp2_long);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_long-temp2_long) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_long-temp2_long) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per);
@@ -3776,7 +3808,7 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(long);
mem2 += sizeof(long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
@@ -3786,7 +3818,7 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp2_long, mem2, sizeof(long));
if (temp1_long != temp2_long) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
@@ -3796,7 +3828,7 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(long);
mem2 += sizeof(long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -3808,35 +3840,34 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_ulong
*
- * Purpose: diff a H5T_NATIVE_ULONG type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_ULONG type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
- hsize_t nfound = 0; /* number of differences found */
+ hsize_t nfound = 0; /* number of differences found */
unsigned long temp1_ulong;
unsigned long temp2_ulong;
- hsize_t i;
- double per;
- hbool_t both_zero;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_ulong start\n");
/* -d and !-p */
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
- if (PDIFF(temp1_ulong,temp2_ulong) > options->delta) {
- if (print_data(options)) {
+ if (PDIFF(temp1_ulong,temp2_ulong) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
@@ -3845,13 +3876,13 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned long);
mem2 += sizeof(unsigned long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
@@ -3859,15 +3890,15 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
PER_UNSIGN(signed long, temp1_ulong, temp2_ulong);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per);
@@ -3876,12 +3907,12 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned long);
mem2 += sizeof(unsigned long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
@@ -3889,16 +3920,16 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
PER_UNSIGN(signed long, temp1_ulong, temp2_ulong);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
}
nfound++;
}
- else if (per > options->percent
- && PDIFF(temp1_ulong,temp2_ulong) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent
+ && PDIFF(temp1_ulong,temp2_ulong) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per);
@@ -3907,7 +3938,7 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned long);
mem2 += sizeof(unsigned long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
@@ -3917,7 +3948,7 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
if (temp1_ulong != temp2_ulong) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
@@ -3927,7 +3958,7 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(unsigned long);
mem2 += sizeof(unsigned long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -3939,33 +3970,32 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_llong
*
- * Purpose: diff a H5T_NATIVE_LLONG type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_LLONG type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
- hsize_t nfound = 0; /* number of differences found */
+ hsize_t nfound = 0; /* number of differences found */
long long temp1_llong;
long long temp2_llong;
- hsize_t i;
- double per;
- hbool_t both_zero;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_llong start\n");
/* -d and !-p */
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_llong, mem1, sizeof(long long));
HDmemcpy(&temp2_llong, mem2, sizeof(long long));
- if (ABS( temp1_llong-temp2_llong) > options->delta) {
- if (print_data(options)) {
+ if (ABS( temp1_llong-temp2_llong) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LLI_FORMAT, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
@@ -3974,12 +4004,12 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(long long);
mem2 += sizeof(long long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_llong, mem1, sizeof(long long));
HDmemcpy(&temp2_llong, mem2, sizeof(long long));
@@ -3987,15 +4017,15 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
PER(temp1_llong, temp2_llong);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong),per);
@@ -4004,12 +4034,12 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(long long);
mem2 += sizeof(long long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_llong, mem1, sizeof(long long));
HDmemcpy(&temp2_llong, mem2, sizeof(long long));
@@ -4017,16 +4047,16 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
PER(temp1_llong, temp2_llong);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
}
nfound++;
}
- else if (per > options->percent
- && ABS(temp1_llong-temp2_llong) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent
+ && ABS(temp1_llong-temp2_llong) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong),per);
@@ -4035,7 +4065,7 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(long long);
mem2 += sizeof(long long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
@@ -4045,7 +4075,7 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp2_llong, mem2, sizeof(long long));
if (temp1_llong != temp2_llong) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LLI_FORMAT, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
@@ -4055,7 +4085,7 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(long long);
mem2 += sizeof(long long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -4067,34 +4097,33 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_ullong
*
- * Purpose: diff a H5T_NATIVE_ULLONG type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_ULLONG type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, hsize_t *acc,
- hsize_t *pos, diff_opt_t *options, const char *obj1, const char *obj2, int *ph)
+ hsize_t *pos, diff_opt_t *opts, const char *obj1, const char *obj2, int *ph)
{
- hsize_t nfound = 0; /* number of differences found */
+ hsize_t nfound = 0; /* number of differences found */
unsigned long long temp1_ullong;
unsigned long long temp2_ullong;
- hsize_t i;
- float f1, f2;
- double per;
- hbool_t both_zero;
+ hsize_t i;
+ float f1, f2;
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_ullong start\n");
/* -d and !-p */
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
- if (PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) options->delta) {
- if (print_data(options)) {
+ if (PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
@@ -4103,12 +4132,12 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned long long);
mem2 += sizeof(unsigned long long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
@@ -4118,15 +4147,15 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
PER(f1, f2);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per);
@@ -4135,12 +4164,12 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned long long);
mem2 += sizeof(unsigned long long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
@@ -4150,16 +4179,16 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
PER(f1, f2);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
}
nfound++;
}
- else if (per > options->percent
- && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent
+ && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per);
@@ -4168,7 +4197,7 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned long long);
mem2 += sizeof(unsigned long long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
@@ -4178,7 +4207,7 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
if (temp1_ullong != temp2_ullong) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
@@ -4188,7 +4217,7 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(unsigned long long);
mem2 += sizeof(unsigned long long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -4201,69 +4230,56 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
* Function: ull2float
*
* Purpose: convert unsigned long long to float
- *
- * Programmer: pvn
- * Mar 22, 2006
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static
-int ull2float(unsigned long long ull_value, float *f_value) {
- hid_t dxpl_id;
+int ull2float(unsigned long long ull_value, float *f_value)
+{
+ int ret_value = SUCCEED;
+ hid_t dxpl_id = -1;
unsigned char *buf = NULL;
- size_t src_size;
- size_t dst_size;
+ size_t src_size;
+ size_t dst_size;
h5difftrace("ull2float start\n");
if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed");
src_size = H5Tget_size(H5T_NATIVE_ULLONG);
dst_size = H5Tget_size(H5T_NATIVE_FLOAT);
- buf = (unsigned char*) HDcalloc((size_t )1, MAX(src_size, dst_size));
- if (!buf)
- goto error;
+ if((buf = (unsigned char*) HDcalloc((size_t )1, MAX(src_size, dst_size))) == NULL)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims");
HDmemcpy(buf, &ull_value, src_size);
/* do conversion */
if (H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, (size_t) 1, buf, NULL, dxpl_id) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tconvert failed");
HDmemcpy(f_value, buf, dst_size);
- if (buf)
- HDfree(buf);h5difftrace("ull2float finish\n");
-
- return 0;
-
-error:
- H5E_BEGIN_TRY
- {
+done:
+ H5E_BEGIN_TRY {
H5Pclose(dxpl_id);
- }H5E_END_TRY;
+ } H5E_END_TRY;
+
if (buf)
- HDfree(buf);h5difftrace("ull2float errored\n");
+ HDfree(buf);
- return -1;
+ h5difftrace("ull2float finish\n");
+
+ return ret_value;
}
/*-------------------------------------------------------------------------
* Function: equal_double
*
- * Purpose: use a absolute error formula to deal with floating point
- * uncertainty
- *
- * Modifications:
- * 8/1/2007. handle NaNs
- *
+ * Purpose: use a absolute error formula to deal with floating point uncertainty
*-------------------------------------------------------------------------
*/
-static hbool_t equal_double(double value, double expected, diff_opt_t *options) {
+static hbool_t equal_double(double value, double expected, diff_opt_t *opts) {
h5difftrace("equal_double start\n");
- if (options->do_nans) {
+ if (opts->do_nans) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
@@ -4275,26 +4291,24 @@ static hbool_t equal_double(double value, double expected, diff_opt_t *options)
* we consider NaN == NaN to be true
*-------------------------------------------------------------------------
*/
- if (isnan1 && isnan2) {
+ if (isnan1 && isnan2)
return TRUE;
- }
/*-------------------------------------------------------------------------
* one is a NaN, do not compare but assume difference
*-------------------------------------------------------------------------
*/
- if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
return FALSE;
- }
}
if (value == expected)
return TRUE;
- if (options->use_system_epsilon) {
- if ( ABS( (value-expected) ) < DBL_EPSILON)
+ if (opts->use_system_epsilon)
+ if (ABS((value-expected)) < DBL_EPSILON)
return TRUE;
- }
+
h5difftrace("equal_double finish\n");
return FALSE;
@@ -4303,18 +4317,16 @@ static hbool_t equal_double(double value, double expected, diff_opt_t *options)
/*-------------------------------------------------------------------------
* Function: equal_ldouble
*
- * Purpose: use a absolute error formula to deal with floating point
- * uncertainty
- *
+ * Purpose: use a absolute error formula to deal with floating point uncertainty
*-------------------------------------------------------------------------
*/
#if H5_SIZEOF_LONG_DOUBLE !=0
static
-hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *options)
+hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts)
{
h5difftrace("equal_ldouble start\n");
- if (options->do_nans) {
+ if (opts->do_nans) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
@@ -4326,26 +4338,24 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio
* we consider NaN == NaN to be true
*-------------------------------------------------------------------------
*/
- if (isnan1 && isnan2) {
+ if (isnan1 && isnan2)
return TRUE;
- }
/*-------------------------------------------------------------------------
* one is a NaN, do not compare but assume difference
*-------------------------------------------------------------------------
*/
- if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
return FALSE;
- }
}
if (value == expected)
return TRUE;
- if (options->use_system_epsilon) {
+ if (opts->use_system_epsilon)
if (ABS((value-expected)) < DBL_EPSILON)
return TRUE;
- }
+
h5difftrace("equal_ldouble finish\n");
return FALSE;
@@ -4356,17 +4366,12 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio
/*-------------------------------------------------------------------------
* Function: equal_float
*
- * Purpose: use a absolute error formula to deal with floating point
- * uncertainty
- *
- * Modifications:
- * 8/1/2007. handle NaNs
- *
+ * Purpose: use a absolute error formula to deal with floating point uncertainty
*-------------------------------------------------------------------------
*/
-static hbool_t equal_float(float value, float expected, diff_opt_t *options) {
+static hbool_t equal_float(float value, float expected, diff_opt_t *opts) {
h5difftrace("equal_float start\n");
- if (options->do_nans) {
+ if (opts->do_nans) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
@@ -4378,46 +4383,35 @@ static hbool_t equal_float(float value, float expected, diff_opt_t *options) {
* we consider NaN == NaN to be true
*-------------------------------------------------------------------------
*/
- if (isnan1 && isnan2) {
+ if (isnan1 && isnan2)
return TRUE;
- }
/*-------------------------------------------------------------------------
* one is a NaN, do not compare but assume difference
*-------------------------------------------------------------------------
*/
- if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
return FALSE;
- }
}
if (value == expected)
return TRUE;
- if (options->use_system_epsilon) {
- if ( ABS( (value-expected) ) < FLT_EPSILON)
+ if (opts->use_system_epsilon)
+ if (ABS( (value-expected) ) < FLT_EPSILON)
return TRUE;
- }
+
h5difftrace("equal_float finish\n");
return FALSE;
-
}
/*-------------------------------------------------------------------------
* Function: my_isnan
*
- * Purpose: Determines whether VAL points to NaN.
- *
- * Return: TRUE or FALSE
- *
- * Programmer: Robb Matzke
- * Monday, July 6, 1998
- *
- * Modifications:
- * Pedro Vicente, 12 October 2007.
- * Add a string detection type for WIN32
+ * Purpose: Determines whether VAL points to NaN.
*
+ * Return: TRUE or FALSE
*-------------------------------------------------------------------------
*/
static hbool_t my_isnan(dtype_t type, void *val) {
@@ -4445,9 +4439,8 @@ static hbool_t my_isnan(dtype_t type, void *val) {
retval = (x!=x);
}
#endif
- else {
+ else
return FALSE;
- }
/*
* Sometimes NaN==NaN (e.g., DEC Alpha) so we try to print it and see if
@@ -4474,9 +4467,8 @@ static hbool_t my_isnan(dtype_t type, void *val) {
HDsnprintf(s, sizeof(s), "%Lg", x);
}
#endif
- else {
+ else
return FALSE;
- }
if (HDstrstr(s, "NaN") ||
HDstrstr(s, "NAN") ||
@@ -4501,24 +4493,25 @@ static hbool_t my_isnan(dtype_t type, void *val) {
/*-------------------------------------------------------------------------
* Function: print_data
*
- * Purpose: print data only in report or verbose modes, and do not print in quiet mode
+ * Purpose: print data only in report or verbose modes, and do not print in quiet mode
*-------------------------------------------------------------------------
*/
static
-int print_data(diff_opt_t *options) {
- return ((options->m_report || options->m_verbose) && !options->m_quiet) ? 1 : 0;
+int print_data(diff_opt_t *opts)
+{
+ return ((opts->m_report || opts->m_verbose) && !opts->m_quiet) ? 1 : 0;
}
/*-------------------------------------------------------------------------
* Function: print_header
*
- * Purpose: print header for difference
- *
+ * Purpose: print header for difference
*-------------------------------------------------------------------------
*/
static
void print_header(int pp, /* print percentage */
- int rank, hsize_t *dims, const char *obj1, const char *obj2) {
+ int rank, hsize_t *dims, const char *obj1, const char *obj2)
+{
/* print header */
parallel_print("%-16s", "size:");
print_dimensions(rank, dims);
@@ -4528,8 +4521,7 @@ void print_header(int pp, /* print percentage */
if (pp) {
parallel_print("%-15s %-15s %-15s %-15s %-15s\n", "position",
- (obj1 != NULL) ? obj1 : " ", (obj2 != NULL) ? obj2 : " ", "difference",
- "relative");
+ (obj1 != NULL) ? obj1 : " ", (obj2 != NULL) ? obj2 : " ", "difference", "relative");
parallel_print(
"------------------------------------------------------------------------\n");
}
@@ -4544,15 +4536,15 @@ void print_header(int pp, /* print percentage */
/*-------------------------------------------------------------------------
* Function: print_pos
*
- * Purpose: print in matrix notation, converting from an array index position
- *
+ * Purpose: print in matrix notation, converting from an array index position
*-------------------------------------------------------------------------
*/
static
void print_pos(int *ph, /* print header */
int pp, /* print percentage */
hsize_t curr_pos, hsize_t *acc, hsize_t *pos, int rank, hsize_t *dims,
- const char *obj1, const char *obj2) {
+ const char *obj1, const char *obj2)
+{
int i;
/* print header */
@@ -4576,23 +4568,22 @@ void print_pos(int *ph, /* print header */
}
parallel_print("]");
}
- else {
+ else
parallel_print(" ");
- }
}
/*-------------------------------------------------------------------------
* Function: print_char_pos
*
- * Purpose: print character position in string
- *
+ * Purpose: print character position in string
*-------------------------------------------------------------------------
*/
static
void print_char_pos(int *ph, /* print header */
int pp, /* print percentage */
hsize_t curr_pos, size_t u, hsize_t *acc, hsize_t *pos, int rank, hsize_t *dims,
- const char *obj1, const char *obj2) {
+ const char *obj1, const char *obj2)
+{
int i;
/* print header */
@@ -4616,20 +4607,20 @@ void print_char_pos(int *ph, /* print header */
}
}
- else {
+ else
parallel_print("%zu", u);
- }
+
parallel_print("]");
}
/*-------------------------------------------------------------------------
- * Function: h5diff_print_char. Adapted from h5tools_print_char
- *
- * Purpose: Print a char
+ * Function: h5diff_print_char. Adapted from h5tools_print_char
*
+ * Purpose: Print a char
*-------------------------------------------------------------------------
*/
-static void h5diff_print_char(char ch) {
+static void h5diff_print_char(char ch)
+{
switch (ch) {
case '"':
parallel_print("\\\"");
@@ -4662,12 +4653,13 @@ static void h5diff_print_char(char ch) {
}
/*-------------------------------------------------------------------------
- * XCAO, 11/10/2010
* added to improve performance for compound datasets
* set up compound datatype structures.
+ *-------------------------------------------------------------------------
*/
-static void get_member_types(hid_t tid, mcomp_t *members) {
- int tclass;
+static void get_member_types(hid_t tid, mcomp_t *members)
+{
+ int tclass;
unsigned u;
if (tid <= 0 || !members)
@@ -4682,8 +4674,7 @@ static void get_member_types(hid_t tid, mcomp_t *members) {
else if (tclass == H5T_COMPOUND) {
int nmembs;
- nmembs = H5Tget_nmembers(tid);
- if (nmembs <= 0)
+ if ((nmembs = H5Tget_nmembers(tid)) <= 0)
return;
members->n = (unsigned) nmembs;
@@ -4701,15 +4692,15 @@ static void get_member_types(hid_t tid, mcomp_t *members) {
}
return;
-
}
/*-------------------------------------------------------------------------
- * XCAO, 11/10/2010
* added to improve performance for compound datasets
* clean and close compound members.
+ *-------------------------------------------------------------------------
*/
-static void close_member_types(mcomp_t *members) {
+static void close_member_types(mcomp_t *members)
+{
unsigned u;
if (!members || members->n <= 0 || !members->ids)
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 9bebcbe..6019738 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -136,54 +136,55 @@ static void table_attr_mark_exist(unsigned *exist, char *name, table_attrs_t *ta
*
* Parameter:
* table_out [OUT] : return the list
- *
- * Programmer: Jonathan Kim
- *
- * Date: March 15, 2011
*------------------------------------------------------------------------*/
-static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t ** table_out, diff_opt_t *options)
+static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t ** table_out, diff_opt_t *opts)
{
- H5O_info_t oinfo1, oinfo2; /* Object info */
- hid_t attr1_id=-1; /* attr ID */
- hid_t attr2_id=-1; /* attr ID */
- size_t curr1 = 0;
- size_t curr2 = 0;
- unsigned infile[2];
- char name1[ATTR_NAME_MAX];
- char name2[ATTR_NAME_MAX];
- int cmp;
- unsigned i;
+ int ret_value = 0;
+ H5O_info_t oinfo1, oinfo2; /* Object info */
+ hid_t attr1_id = -1; /* attr ID */
+ hid_t attr2_id = -1; /* attr ID */
+ size_t curr1 = 0;
+ size_t curr2 = 0;
+ unsigned infile[2];
+ char name1[ATTR_NAME_MAX];
+ char name2[ATTR_NAME_MAX];
+ int cmp;
+ unsigned i;
table_attrs_t *table_lp = NULL;
h5difftrace("build_match_list_attrs start\n");
+
if(H5Oget_info(loc1_id, &oinfo1) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info first object failed");
if(H5Oget_info(loc2_id, &oinfo2) < 0)
- goto error;
-
- table_attrs_init( &table_lp );
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info second object failed");
- h5diffdebug3("build_match_list_attrs: %ld - %ld\n", curr1 < oinfo1.num_attrs, curr2 < oinfo2.num_attrs);
+ table_attrs_init(&table_lp);
+ if (table_lp == NULL)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Table allocation failed");
/*--------------------------------------------------
* build the list
*/
while(curr1 < oinfo1.num_attrs && curr2 < oinfo2.num_attrs) {
+ h5diffdebug3("build_match_list_attrs 1: %ld - %ld\n", curr1, oinfo1.num_attrs);
+ h5diffdebug3("build_match_list_attrs 2: %ld - %ld\n", curr2, oinfo2.num_attrs);
+
/*------------------
* open attribute1 */
if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx first attribute failed");
/* get name */
if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name first attribute failed");
/*------------------
* open attribute2 */
if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx second attribute failed");
/* get name */
if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name second attribute failed");
/* criteria is string compare */
cmp = HDstrcmp(name1, name2);
@@ -221,13 +222,15 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
infile[0] = 1;
infile[1] = 0;
while(curr1 < oinfo1.num_attrs) {
+ h5diffdebug3("build_match_list_attrs 1: %ld - %ld\n", curr1, oinfo1.num_attrs);
+
/*------------------
* open attribute1 */
if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx first attribute failed");
/* get name */
if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name first attribute failed");
h5diffdebug2("build_match_list_attrs #1 name - %s\n", name1);
table_attr_mark_exist(infile, name1, table_lp);
@@ -243,13 +246,14 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
infile[0] = 0;
infile[1] = 1;
while(curr2 < oinfo2.num_attrs) {
+ h5diffdebug3("build_match_list_attrs 2: %ld - %ld\n", curr2, oinfo2.num_attrs);
/*------------------
* open attribute2 */
if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx second attribute failed");
/* get name */
if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name second attribute failed");
h5diffdebug2("build_match_list_attrs #2 name - %s\n", name2);
table_attr_mark_exist(infile, name2, table_lp);
@@ -258,12 +262,13 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
/* close for next turn */
H5Aclose(attr2_id);
+ attr2_id = -1;
}
/*------------------------------------------------------
* print the list
*/
- if(options->m_verbose_level == 2) {
+ if(opts->m_verbose_level == 2) {
/* if '-v2' is detected */
parallel_print(" obj1 obj2\n");
parallel_print(" --------------------------------------\n");
@@ -275,44 +280,35 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
} /* end for */
}
- if(options->m_verbose_level >= 1)
+ if(opts->m_verbose_level >= 1)
parallel_print("Attributes status: %d common, %d only in obj1, %d only in obj2\n",
table_lp->nattrs - table_lp->nattrs_only1 - table_lp->nattrs_only2,
table_lp->nattrs_only1, table_lp->nattrs_only2);
+done:
*table_out = table_lp;
- h5difftrace("build_match_list_attrs end\n");
- return 0;
-
-error:
- if (0 < attr1_id)
+ /* disable error reporting */
+ H5E_BEGIN_TRY {
H5Aclose(attr1_id);
- if (0 < attr2_id)
H5Aclose(attr2_id);
+ } H5E_END_TRY;
+
+ h5diffdebug2("build_match_list_attrs end - errstat:%d\n", opts->err_stat);
- h5difftrace("build_match_list_attrs end with error\n");
- return -1;
+ return ret_value;
}
/*-------------------------------------------------------------------------
* Function: diff_attr
*
- * Purpose: compare attributes located in LOC1_ID and LOC2_ID, which are
- * obtained either from
- * loc_id = H5Gopen2(fid, name, H5P_DEFAULT);
- * loc_id = H5Dopen2(fid, name);
- * loc_id = H5Topen2(fid, name, H5P_DEFAULT);
- *
- * Return: number of differences found
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: November, 03, 2003
- *
- * Modifications:
- * March, 02, 2007: return the number of differences found
+ * Purpose: compare attributes located in LOC1_ID and LOC2_ID, which are
+ * obtained either from
+ * loc_id = H5Gopen2(fid, name, H5P_DEFAULT);
+ * loc_id = H5Dopen2(fid, name);
+ * loc_id = H5Topen2(fid, name, H5P_DEFAULT);
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
@@ -320,34 +316,35 @@ hsize_t diff_attr(hid_t loc1_id,
hid_t loc2_id,
const char *path1,
const char *path2,
- diff_opt_t *options)
+ diff_opt_t *opts)
{
- hid_t attr1_id=-1; /* attr ID */
- hid_t attr2_id=-1; /* attr ID */
- hid_t space1_id=-1; /* space ID */
- hid_t space2_id=-1; /* space ID */
- hid_t ftype1_id=-1; /* file data type ID */
- hid_t ftype2_id=-1; /* file data type ID */
- int vstrtype1=0; /* ftype1 is a variable string */
- int vstrtype2=0; /* ftype2 is a variable string */
- hid_t mtype1_id=-1; /* memory data type ID */
- hid_t mtype2_id=-1; /* memory data type ID */
- size_t msize1; /* memory size of memory type */
- size_t msize2; /* memory size of memory type */
- void *buf1=NULL; /* data buffer */
- void *buf2=NULL; /* data buffer */
- hbool_t buf1hasdata=FALSE; /* buffer has data */
- hbool_t buf2hasdata=FALSE; /* buffer has data */
- hsize_t nelmts1; /* number of elements in dataset */
- int rank1; /* rank of dataset */
- int rank2; /* rank of dataset */
- hsize_t dims1[H5S_MAX_RANK];/* dimensions of dataset */
- hsize_t dims2[H5S_MAX_RANK];/* dimensions of dataset */
- char *name1;
- char *name2;
+ int ret_value = opts->err_stat;
+ hid_t attr1_id = -1; /* attr ID */
+ hid_t attr2_id = -1; /* attr ID */
+ hid_t space1_id = -1; /* space ID */
+ hid_t space2_id = -1; /* space ID */
+ hid_t ftype1_id = -1; /* file data type ID */
+ hid_t ftype2_id = -1; /* file data type ID */
+ int vstrtype1 = 0; /* ftype1 is a variable string */
+ int vstrtype2 = 0; /* ftype2 is a variable string */
+ hid_t mtype1_id = -1; /* memory data type ID */
+ hid_t mtype2_id = -1; /* memory data type ID */
+ size_t msize1; /* memory size of memory type */
+ size_t msize2; /* memory size of memory type */
+ void *buf1 = NULL; /* data buffer */
+ void *buf2 = NULL; /* data buffer */
+ hbool_t buf1hasdata = FALSE; /* buffer has data */
+ hbool_t buf2hasdata = FALSE; /* buffer has data */
+ hsize_t nelmts1; /* number of elements in dataset */
+ int rank1; /* rank of dataset */
+ int rank2; /* rank of dataset */
+ hsize_t dims1[H5S_MAX_RANK]; /* dimensions of dataset */
+ hsize_t dims2[H5S_MAX_RANK]; /* dimensions of dataset */
+ char *name1 = NULL;
+ char *name2 = NULL;
char np1[512];
char np2[512];
- unsigned u; /* Local index variable */
+ unsigned u; /* Local index variable */
hsize_t nfound = 0;
hsize_t nfound_total = 0;
int j;
@@ -355,17 +352,21 @@ hsize_t diff_attr(hid_t loc1_id,
table_attrs_t *match_list_attrs = NULL;
h5difftrace("diff_attr start\n");
- if(build_match_list_attrs(loc1_id, loc2_id, &match_list_attrs, options) < 0)
- goto error;
+ if(build_match_list_attrs(loc1_id, loc2_id, &match_list_attrs, opts) < 0) {
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "build_match_list_attrs failed");
+ }
+ h5diffdebug2("build_match_list_attrs - errstat:%d\n", opts->err_stat);
/* if detect any unique extra attr */
if(match_list_attrs->nattrs_only1 || match_list_attrs->nattrs_only2) {
h5difftrace("diff_attr attributes only in one file\n");
/* exit will be 1 */
- options->contents = 0;
+ opts->contents = 0;
}
+ h5diffdebug2("match_list_attrs info - errstat:%d\n", opts->err_stat);
for(u = 0; u < (unsigned)match_list_attrs->nattrs; u++) {
+ h5diffdebug3("match_list_attrs loop[%d] - errstat:%d\n", u, opts->err_stat);
if((match_list_attrs->attrs[u].exist[0]) && (match_list_attrs->attrs[u].exist[1])) {
name1 = name2 = match_list_attrs->attrs[u].name;
h5diffdebug2("diff_attr name - %s\n", name1);
@@ -373,59 +374,60 @@ hsize_t diff_attr(hid_t loc1_id,
/*--------------
* attribute 1 */
if((attr1_id = H5Aopen(loc1_id, name1, H5P_DEFAULT)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aopen first attribute failed");
/*--------------
* attribute 2 */
if((attr2_id = H5Aopen(loc2_id, name2, H5P_DEFAULT)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aopen second attribute failed");
h5difftrace("diff_attr got attributes\n");
/* get the datatypes */
if((ftype1_id = H5Aget_type(attr1_id)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed");
vstrtype1 = H5Tis_variable_str(ftype1_id);
if((ftype2_id = H5Aget_type(attr2_id)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
vstrtype2 = H5Tis_variable_str(ftype2_id);
+
/* no compare if either one but not both are variable string type */
if (vstrtype1 != vstrtype2) {
- if((options->m_verbose || options->m_list_not_cmp))
+ if((opts->m_verbose || opts->m_list_not_cmp))
parallel_print("Not comparable: one of attribute <%s/%s> or <%s/%s> is of variable length type\n",
path1, name1, path2, name2);
- options->not_cmp = 1;
+ opts->not_cmp = 1;
if (H5Tclose(ftype1_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute ftype failed");
if (H5Tclose(ftype2_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute ftype failed");
if (H5Aclose(attr1_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose first attribute failed");
if (H5Aclose(attr2_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose second attribute failed");
continue;
}
if((mtype1_id = H5Tget_native_type(ftype1_id, H5T_DIR_DEFAULT)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type first attribute ftype failed");
if((mtype2_id = H5Tget_native_type(ftype2_id, H5T_DIR_DEFAULT)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type second attribute ftype failed");
if((msize1 = H5Tget_size(mtype1_id)) == 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_size first attribute mtype failed");
if((msize2 = H5Tget_size(mtype2_id)) == 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_size second attribute mtype failed");
/* get the dataspace */
if((space1_id = H5Aget_space(attr1_id)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_space first attribute failed");
if((space2_id = H5Aget_space(attr2_id)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_space second attribute failed");
/* get dimensions */
if((rank1 = H5Sget_simple_extent_dims(space1_id, dims1, NULL)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_dims first attribute failed");
if((rank2 = H5Sget_simple_extent_dims(space2_id, dims2, NULL)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_dims second attribute failed");
/*----------------------------------------------------------------------
* check for comparable TYPE and SPACE
@@ -435,23 +437,23 @@ hsize_t diff_attr(hid_t loc1_id,
/* pass dims1 and dims2 for maxdims as well since attribute's maxdims
* are always same */
if(diff_can_type(ftype1_id, ftype2_id, rank1, rank2, dims1, dims2,
- dims1, dims2, name1, name2, options, 0) != 1) {
+ dims1, dims2, name1, name2, opts, 0) != 1) {
if(H5Tclose(ftype1_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute ftype failed");
if(H5Tclose(ftype2_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute ftype failed");
if(H5Sclose(space1_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sclose first attribute failed");
if(H5Sclose(space2_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sclose second attribute failed");
if(H5Aclose(attr1_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose first attribute failed");
if(H5Aclose(attr2_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose second attribute failed");
if(H5Tclose(mtype1_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute mtype failed");
if(H5Tclose(mtype2_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute mtype failed");
continue;
}
@@ -462,7 +464,7 @@ hsize_t diff_attr(hid_t loc1_id,
*/
if(FAIL == match_up_memsize(ftype1_id, ftype2_id, &mtype1_id,
&mtype2_id, &msize1, &msize2))
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "match_up_memsize failed");
/*---------------------------------------------------------------------
* read
@@ -476,18 +478,18 @@ hsize_t diff_attr(hid_t loc1_id,
buf2 = (void *)HDcalloc((size_t)(nelmts1), msize2);
if(buf1 == NULL || buf2 == NULL) {
parallel_print("cannot read into memory\n");
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "buffer allocation failed");
}
if(H5Aread(attr1_id, mtype1_id, buf1) < 0) {
parallel_print("Failed reading attribute1 %s/%s\n", path1, name1);
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed");
}
else
buf1hasdata = TRUE;
if(H5Aread(attr2_id, mtype2_id, buf2) < 0) {
parallel_print("Failed reading attribute2 %s/%s\n", path2, name2);
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
}
else
buf2hasdata = TRUE;
@@ -503,22 +505,22 @@ hsize_t diff_attr(hid_t loc1_id,
/* always print name */
/* verbose (-v) and report (-r) mode */
- if(options->m_verbose || options->m_report) {
+ if(opts->m_verbose || opts->m_report) {
do_print_attrname("attribute", np1, np2);
nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1,
- dims1, options, np1, np2, mtype1_id, attr1_id, attr2_id);
+ dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id);
print_found(nfound);
}
/* quiet mode (-q), just count differences */
- else if(options->m_quiet) {
+ else if(opts->m_quiet) {
nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1,
- dims1, options, np1, np2, mtype1_id, attr1_id, attr2_id);
+ dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id);
}
/* the rest (-c, none, ...) */
else {
nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1,
- dims1, options, np1, np2, mtype1_id, attr1_id, attr2_id);
+ dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id);
/* print info if compatible and difference found */
if (nfound) {
@@ -545,32 +547,29 @@ hsize_t diff_attr(hid_t loc1_id,
buf2 = NULL;
if(H5Tclose(ftype1_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed");
if(H5Tclose(ftype2_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
if(H5Sclose(space1_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed");
if(H5Sclose(space2_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
if(H5Aclose(attr1_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed");
if(H5Aclose(attr2_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
if(H5Tclose(mtype1_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute mtype failed");
if(H5Tclose(mtype2_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute mtype failed");
nfound_total += nfound;
}
} /* u */
- table_attrs_free(match_list_attrs);
-
- h5difftrace("diff_attr end\n");
- return nfound_total;
+done:
+ opts->err_stat = opts->err_stat | ret_value;
-error:
H5E_BEGIN_TRY {
if(buf1) {
if(buf1hasdata && TRUE == h5tools_detect_vlen(mtype1_id))
@@ -595,8 +594,7 @@ error:
H5Aclose(attr2_id);
} H5E_END_TRY;
- options->err_stat = 1;
- h5difftrace("diff_attr end with error\n");
+ h5diffdebug2("diff_attr end - errstat:%d\n", opts->err_stat);
return nfound_total;
}
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index 998a8ca..ee42b99 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -1,15 +1,15 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* Copyright by The HDF Group. *
-* Copyright by the Board of Trustees of the University of Illinois. *
-* All rights reserved. *
-* *
-* This file is part of HDF5. The full HDF5 copyright notice, including *
-* terms governing use, modification, and redistribution, is contained in *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "H5private.h"
#include "h5tools.h"
@@ -19,25 +19,22 @@
/*-------------------------------------------------------------------------
-* Function: diff_dataset
-*
-* Purpose: check for comparable datasets and read into a compatible
-* memory type
-*
-* Return: Number of differences found
-*
-* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
-*
-* Date: May 9, 2003
-*
-*-------------------------------------------------------------------------
-*/
-hsize_t diff_dataset( hid_t file1_id,
- hid_t file2_id,
- const char *obj1_name,
- const char *obj2_name,
- diff_opt_t *options)
+ * Function: diff_dataset
+ *
+ * Purpose: check for comparable datasets and read into a compatible
+ * memory type
+ *
+ * Return: Number of differences found
+ *-------------------------------------------------------------------------
+ */
+hsize_t diff_dataset(hid_t file1_id,
+ hid_t file2_id,
+ const char *obj1_name,
+ const char *obj2_name,
+ diff_opt_t *opts)
{
+ int ret_value = opts->err_stat;
+ int status = -1;
hid_t did1 = -1;
hid_t did2 = -1;
hid_t dcpl1 = -1;
@@ -46,53 +43,45 @@ hsize_t diff_dataset( hid_t file1_id,
h5difftrace("diff_dataset start\n");
/*-------------------------------------------------------------------------
- * open the handles
- *-------------------------------------------------------------------------
- */
- /* disable error reporting */
- H5E_BEGIN_TRY
- {
- /* Open the datasets */
- if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0) {
- parallel_print("Cannot open dataset <%s>\n", obj1_name);
- goto error;
- }
- if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0) {
- parallel_print("Cannot open dataset <%s>\n", obj2_name);
- goto error;
- }
- /* enable error reporting */
- } H5E_END_TRY;
-
+ * open the handles
+ *-------------------------------------------------------------------------
+ */
+ /* Open the datasets */
+ if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0) {
+ parallel_print("Cannot open dataset <%s>\n", obj1_name);
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dopen2 first dataset failed");
+ }
+ if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0) {
+ parallel_print("Cannot open dataset <%s>\n", obj2_name);
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dopen2 second dataset failed");
+ }
if((dcpl1 = H5Dget_create_plist(did1)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_create_plist first dataset failed");
if((dcpl2 = H5Dget_create_plist(did2)) < 0)
- goto error;
-
- /*-------------------------------------------------------------------------
- * check if the dataset creation property list has filters that
- * are not registered in the current configuration
- * 1) the external filters GZIP and SZIP might not be available
- * 2) the internal filters might be turned off
- *-------------------------------------------------------------------------
- */
- if ((h5tools_canreadf((options->m_verbose ? obj1_name : NULL), dcpl1) == 1) &&
- (h5tools_canreadf((options->m_verbose ? obj2_name : NULL), dcpl2) == 1))
- nfound = diff_datasetid(did1, did2, obj1_name, obj2_name, options);
- else
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_create_plist second dataset failed");
/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
- goto done;
-
-error:
- options->err_stat = 1;
+ * check if the dataset creation property list has filters that
+ * are not registered in the current configuration
+ * 1) the external filters GZIP and SZIP might not be available
+ * 2) the internal filters might be turned off
+ *-------------------------------------------------------------------------
+ */
+ if ((status = h5tools_canreadf((opts->m_verbose ? obj1_name : NULL), dcpl1) == 1) &&
+ (status = h5tools_canreadf((opts->m_verbose ? obj2_name : NULL), dcpl2) == 1))
+ nfound = diff_datasetid(did1, did2, obj1_name, obj2_name, opts);
+ else if (status < 0) {
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "h5tools_canreadf failed");
+ }
+ else {
+ ret_value = 1;
+ opts->not_cmp = 1;
+ }
done:
+ opts->err_stat = opts->err_stat | ret_value;
+
/* disable error reporting */
H5E_BEGIN_TRY {
H5Pclose(dcpl1);
@@ -102,82 +91,75 @@ done:
/* enable error reporting */
} H5E_END_TRY;
- h5difftrace("diff_dataset end\n");
+ h5diffdebug3("diff_dataset finish:%d - errstat:%d\n", nfound, opts->err_stat);
return nfound;
}
/*-------------------------------------------------------------------------
-* Function: diff_datasetid
-*
-* Purpose: check for comparable datasets and read into a compatible
-* memory type
-*
-* Return: Number of differences found
-*
-* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
-*
-* Date: May 9, 2003
-*
-* Modifications:
-*
-*
-* October 2006: Read by hyperslabs for big datasets.
-*
-* A threshold of H5TOOLS_MALLOCSIZE (128 MB) is the limit upon which I/O hyperslab is done
-* i.e., if the memory needed to read a dataset is greater than this limit,
-* then hyperslab I/O is done instead of one operation I/O
-* For each dataset, the memory needed is calculated according to
-*
-* memory needed = number of elements * size of each element
-*
-* if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations
-* are done
-*
-* H5Dread( input_dataset1 )
-* H5Dread( input_dataset2 )
-*
-* with all elements in the datasets selected. If the memory needed is greater than
-* H5TOOLS_MALLOCSIZE, then the following operations are done instead:
-*
-* a strip mine is defined for each dimension k (a strip mine is defined as a
-* hyperslab whose size is memory manageable) according to the formula
-*
-* (1) strip_mine_size[k ] = MIN(dimension[k ], H5TOOLS_BUFSIZE / size of memory type)
-*
-* where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures
-* that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip
-* mine size k is simply defined as its dimension k, but for larger datasets the
-* hyperslab size is still memory manageable.
-* a cycle is done until the number of elements in the dataset is reached. In each
-* iteration, two parameters are defined for the function H5Sselect_hyperslab,
-* the start and size of each hyperslab, according to
-*
-* (2) hyperslab_size [k] = MIN(dimension[k] - hyperslab_offset[k], strip_mine_size [k])
-*
-* where hyperslab_offset [k] is initially set to zero, and later incremented in
-* hyperslab_size[k] offsets. The reason for the operation
-*
-* dimension[k] - hyperslab_offset[k]
-*
-* in (2) is that, when using the strip mine size, it assures that the "remaining" part
-* of the dataset that does not fill an entire strip mine is processed.
-*
-*-------------------------------------------------------------------------
-*/
-hsize_t diff_datasetid( hid_t did1,
- hid_t did2,
- const char *obj1_name,
- const char *obj2_name,
- diff_opt_t *options)
+ * Function: diff_datasetid
+ *
+ * Purpose: check for comparable datasets and read into a compatible
+ * memory type
+ *
+ * Return: Number of differences found
+ *
+ * October 2006: Read by hyperslabs for big datasets.
+ *
+ * A threshold of H5TOOLS_MALLOCSIZE (128 MB) is the limit upon which I/O hyperslab is done
+ * i.e., if the memory needed to read a dataset is greater than this limit,
+ * then hyperslab I/O is done instead of one operation I/O
+ * For each dataset, the memory needed is calculated according to
+ *
+ * memory needed = number of elements * size of each element
+ *
+ * if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations
+ * are done
+ *
+ * H5Dread( input_dataset1 )
+ * H5Dread( input_dataset2 )
+ *
+ * with all elements in the datasets selected. If the memory needed is greater than
+ * H5TOOLS_MALLOCSIZE, then the following operations are done instead:
+ *
+ * a strip mine is defined for each dimension k (a strip mine is defined as a
+ * hyperslab whose size is memory manageable) according to the formula
+ *
+ * (1) strip_mine_size[k ] = MIN(dimension[k ], H5TOOLS_BUFSIZE / size of memory type)
+ *
+ * where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures
+ * that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip
+ * mine size k is simply defined as its dimension k, but for larger datasets the
+ * hyperslab size is still memory manageable.
+ * a cycle is done until the number of elements in the dataset is reached. In each
+ * iteration, two parameters are defined for the function H5Sselect_hyperslab,
+ * the start and size of each hyperslab, according to
+ *
+ * (2) hyperslab_size [k] = MIN(dimension[k] - hyperslab_offset[k], strip_mine_size [k])
+ *
+ * where hyperslab_offset [k] is initially set to zero, and later incremented in
+ * hyperslab_size[k] offsets. The reason for the operation
+ *
+ * dimension[k] - hyperslab_offset[k]
+ *
+ * in (2) is that, when using the strip mine size, it assures that the "remaining" part
+ * of the dataset that does not fill an entire strip mine is processed.
+ *
+ *-------------------------------------------------------------------------
+ */
+hsize_t diff_datasetid(hid_t did1,
+ hid_t did2,
+ const char *obj1_name,
+ const char *obj2_name,
+ diff_opt_t *opts)
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
- hid_t sid1=-1;
- hid_t sid2=-1;
- hid_t f_tid1=-1;
- hid_t f_tid2=-1;
- hid_t dam_tid=-1; /* m_tid for diff_array function */
- hid_t m_tid1=-1;
- hid_t m_tid2=-1;
+ int ret_value = opts->err_stat;
+ hid_t sid1 = -1;
+ hid_t sid2 = -1;
+ hid_t f_tid1 = -1;
+ hid_t f_tid2 = -1;
+ hid_t dam_tid = -1; /* m_tid for diff_array function */
+ hid_t m_tid1 = -1;
+ hid_t m_tid2 = -1;
hid_t dcpl1 = -1;
hid_t dcpl2 = -1;
H5D_layout_t stl1 = -1;
@@ -197,42 +179,41 @@ hsize_t diff_datasetid( hid_t did1,
hsize_t dims2[H5S_MAX_RANK];
hsize_t maxdim1[H5S_MAX_RANK];
hsize_t maxdim2[H5S_MAX_RANK];
- const char *name1=NULL; /* relative names */
- const char *name2=NULL;
+ const char *name1 = NULL; /* relative names */
+ const char *name2 = NULL;
hsize_t storage_size1;
hsize_t storage_size2;
- hsize_t nfound=0; /* number of differences found */
- int can_compare=1; /* do diff or not */
- void *buf1=NULL;
- void *buf2=NULL;
- void *sm_buf1=NULL;
- void *sm_buf2=NULL;
- hid_t sm_space; /*stripmine data space */
- size_t need; /* bytes needed for malloc */
+ hsize_t nfound = 0; /* number of differences found */
+ int can_compare = 1; /* do diff or not */
+ void *buf1 = NULL;
+ void *buf2 = NULL;
+ void *sm_buf1 = NULL;
+ void *sm_buf2 = NULL;
+ hid_t sm_space = -1; /*stripmine data space */
+ size_t need; /* bytes needed for malloc */
int i;
- unsigned int vl_data = 0; /*contains VL datatypes */
+ unsigned int vl_data = 0; /*contains VL datatypes */
- options->err_stat = 1;
h5difftrace("diff_datasetid start\n");
/* Get the dataspace handle */
if((sid1 = H5Dget_space(did1)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_space failed");
/* Get rank */
if((rank1 = H5Sget_simple_extent_ndims(sid1)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
/* Get the dataspace handle */
if((sid2 = H5Dget_space(did2)) < 0 )
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_space failed");
/* Get rank */
if((rank2 = H5Sget_simple_extent_ndims(sid2)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
/* Get dimensions */
if(H5Sget_simple_extent_dims(sid1, dims1, maxdim1) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
/* Get dimensions */
if(H5Sget_simple_extent_dims(sid2, dims2, maxdim2) < 0)
@@ -240,36 +221,36 @@ hsize_t diff_datasetid( hid_t did1,
h5diffdebug3("rank: %ld - %ld\n", rank1, rank2);
/*-------------------------------------------------------------------------
- * get the file data type
- *-------------------------------------------------------------------------
- */
+ * get the file data type
+ *-------------------------------------------------------------------------
+ */
/* Get the data type */
if((f_tid1 = H5Dget_type(did1)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_type failed");
/* Get the data type */
if((f_tid2 = H5Dget_type(did2)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_type failed");
/*-------------------------------------------------------------------------
- * get the storage layout type
- *-------------------------------------------------------------------------
- */
+ * get the storage layout type
+ *-------------------------------------------------------------------------
+ */
if((dcpl1 = H5Dget_create_plist(did1)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_create_plist failed");
if((dcpl2 = H5Dget_create_plist(did2)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_create_plist failed");
if((stl1 = H5Pget_layout(dcpl1)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Pget_layout failed");
if((stl2 = H5Pget_layout(dcpl2)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Pget_layout failed");
/*-------------------------------------------------------------------------
- * check for empty datasets
- *-------------------------------------------------------------------------
- */
+ * check for empty datasets
+ *-------------------------------------------------------------------------
+ */
h5difftrace("check for empty datasets\n");
storage_size1 = H5Dget_storage_size(did1);
@@ -278,71 +259,74 @@ hsize_t diff_datasetid( hid_t did1,
if(storage_size1 == 0 || storage_size2 == 0) {
if(stl1 == H5D_VIRTUAL || stl2 == H5D_VIRTUAL) {
- if((options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
+ if((opts->m_verbose||opts->m_list_not_cmp) && obj1_name && obj2_name)
parallel_print("Warning: <%s> or <%s> is a virtual dataset\n", obj1_name, obj2_name);
}
else {
- if((options->m_verbose || options->m_list_not_cmp) && obj1_name && obj2_name)
+ if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name)
parallel_print("Not comparable: <%s> or <%s> is an empty dataset\n", obj1_name, obj2_name);
can_compare = 0;
- options->not_cmp = 1;
+ opts->not_cmp = 1;
}
}
/*-------------------------------------------------------------------------
- * check for comparable TYPE and SPACE
- *-------------------------------------------------------------------------
- */
+ * check for comparable TYPE and SPACE
+ *-------------------------------------------------------------------------
+ */
if (diff_can_type(f_tid1, f_tid2, rank1, rank2,
dims1, dims2, maxdim1, maxdim2,
obj1_name, obj2_name,
- options, 0) != 1)
+ opts, 0) != 1)
can_compare = 0;
+ h5diffdebug2("diff_can_type - errstat:%d\n", opts->err_stat);
/*-------------------------------------------------------------------------
- * memory type and sizes
- *-------------------------------------------------------------------------
- */
+ * memory type and sizes
+ *-------------------------------------------------------------------------
+ */
h5difftrace("check for memory type and sizes\n");
if((m_tid1 = H5Tget_native_type(f_tid1, H5T_DIR_DEFAULT)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type failed");
if((m_tid2 = H5Tget_native_type(f_tid2, H5T_DIR_DEFAULT)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type failed");
m_size1 = H5Tget_size(m_tid1);
m_size2 = H5Tget_size(m_tid2);
h5diffdebug3("type size: %ld - %ld\n", m_size1, m_size2);
/*-------------------------------------------------------------------------
- * check for different signed/unsigned types
- *-------------------------------------------------------------------------
- */
+ * check for different signed/unsigned types
+ *-------------------------------------------------------------------------
+ */
if(can_compare) {
h5difftrace("can_compare for sign\n");
sign1 = H5Tget_sign(m_tid1);
sign2 = H5Tget_sign(m_tid2);
if(sign1 != sign2) {
h5difftrace("sign1 != sign2\n");
- if((options->m_verbose || options->m_list_not_cmp) && obj1_name && obj2_name) {
+ if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) {
parallel_print("Not comparable: <%s> has sign %s ", obj1_name, get_sign(sign1));
parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2));
}
can_compare = 0;
- options->not_cmp = 1;
+ opts->not_cmp = 1;
}
}
/* Check if type is either VLEN-data or VLEN-string to reclaim any
- * VLEN memory buffer later */
+ * VLEN memory buffer later
+ */
if(TRUE == h5tools_detect_vlen(m_tid1))
vl_data = TRUE;
+ h5diffdebug2("h5tools_detect_vlen - errstat:%d\n", opts->err_stat);
/*------------------------------------------------------------------------
- * only attempt to compare if possible
- *-------------------------------------------------------------------------
- */
+ * only attempt to compare if possible
+ *-------------------------------------------------------------------------
+ */
if(can_compare) { /* it is possible to compare */
H5T_class_t tclass = H5Tget_class(f_tid1);
h5difftrace("can_compare attempt\n");
@@ -363,14 +347,14 @@ hsize_t diff_datasetid( hid_t did1,
if(tclass != H5T_ARRAY) {
/*-----------------------------------------------------------------
- * "upgrade" the smaller memory size
- *------------------------------------------------------------------
- */
+ * "upgrade" the smaller memory size
+ *------------------------------------------------------------------
+ */
h5difftrace("upgrade the smaller memory size?\n");
if (FAIL == match_up_memsize (f_tid1, f_tid2,
&m_tid1, &m_tid2,
&m_size1, &m_size2))
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "match_up_memsize failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "match_up_memsize failed");
h5diffdebug3("m_size: %ld - %ld\n", m_size1, m_size2);
dadims = dims1;
dam_size = m_size1;
@@ -405,9 +389,9 @@ hsize_t diff_datasetid( hid_t did1,
/*----------------------------------------------------------------
- * read/compare
- *-----------------------------------------------------------------
- */
+ * read/compare
+ *-----------------------------------------------------------------
+ */
if(need < H5TOOLS_MALLOCSIZE) {
buf1 = HDmalloc(need);
buf2 = HDmalloc(need);
@@ -416,14 +400,14 @@ hsize_t diff_datasetid( hid_t did1,
if(buf1 != NULL && buf2 != NULL) {
h5difftrace("buf1 != NULL && buf2 != NULL\n");
if(H5Dread(did1, m_tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed");
h5difftrace("H5Dread did2\n");
if(H5Dread(did2, m_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed");
/* array diff */
nfound = diff_array(buf1, buf2, danelmts, (hsize_t)0, rank1, dadims,
- options, name1, name2, dam_tid, did1, did2);
+ opts, name1, name2, dam_tid, did1, did2);
h5diffdebug2("diff_array nfound:%d\n", nfound);
/* reclaim any VL memory, if necessary */
@@ -482,9 +466,9 @@ hsize_t diff_datasetid( hid_t did1,
* E.g., sm_space.
*/
if((sm_buf1 = HDmalloc((size_t)sm_nbytes)) == NULL)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "HDmalloc failed");
if((sm_buf2 = HDmalloc((size_t)sm_nbytes)) == NULL)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "HDmalloc failed");
sm_nelmts = sm_nbytes / p_type_nbytes;
sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
@@ -501,24 +485,24 @@ hsize_t diff_datasetid( hid_t did1,
hs_nelmts *= hs_size[i];
} /* end for */
if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
} /* end if */
else
hs_nelmts = 1;
if(H5Dread(did1, m_tid1, sm_space, sid1, H5P_DEFAULT, sm_buf1) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed");
if(H5Dread(did2, m_tid2, sm_space, sid2, H5P_DEFAULT, sm_buf2) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed");
/* get array differences. in the case of hyperslab read, increment the number of differences
found in each hyperslab and pass the position at the beginning for printing */
nfound += diff_array(sm_buf1, sm_buf2, hs_nelmts, elmtno, rank1,
- dadims, options, name1, name2, dam_tid, did1, did2);
+ dadims, opts, name1, name2, dam_tid, did1, did2);
/* reclaim any VL memory, if necessary */
if(vl_data) {
@@ -553,11 +537,10 @@ hsize_t diff_datasetid( hid_t did1,
* close
*-------------------------------------------------------------------------
*/
- h5difftrace("reclaim any VL memory\n");
+ h5diffdebug2("reclaim any VL memory - errstat:%d\n", opts->err_stat);
done:
-
- options->err_stat = ret_value;
+ opts->err_stat = opts->err_stat | ret_value;
/* free */
if(buf1 != NULL) {
@@ -599,60 +582,55 @@ done:
H5Tclose(m_tid2);
/* enable error reporting */
} H5E_END_TRY;
- h5diffdebug3("diff_datasetid return:%d with nfound:%d\n", ret_value, nfound);
+ h5diffdebug3("diff_datasetid return:%d with nfound:%d\n", ret_value, nfound);
return nfound;
}
/*-------------------------------------------------------------------------
-* Function: diff_can_type
-*
-* Purpose: check for comparable TYPE and SPACE
-*
-* Return:
-* 1, can compare
-* 0, cannot compare
-* -1, error
-*
-* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
-*
-* Date: November 3, 2003
-*
-*-------------------------------------------------------------------------
-*/
-
-int diff_can_type( hid_t f_tid1, /* file data type */
- hid_t f_tid2, /* file data type */
- int rank1,
- int rank2,
- hsize_t *dims1,
- hsize_t *dims2,
- hsize_t *maxdim1,
- hsize_t *maxdim2,
- const char *obj1_name,
- const char *obj2_name,
- diff_opt_t *options,
- int is_compound)
+ * Function: diff_can_type
+ *
+ * Purpose: check for comparable TYPE and SPACE
+ *
+ * Return:
+ * 1, can compare
+ * 0, cannot compare
+ * -1, error
+ *-------------------------------------------------------------------------
+ */
+
+int diff_can_type(hid_t f_tid1, /* file data type */
+ hid_t f_tid2, /* file data type */
+ int rank1,
+ int rank2,
+ hsize_t *dims1,
+ hsize_t *dims2,
+ hsize_t *maxdim1,
+ hsize_t *maxdim2,
+ const char *obj1_name,
+ const char *obj2_name,
+ diff_opt_t *opts,
+ int is_compound)
{
+ int ret_value = 1; /* can_compare value */
H5T_class_t tclass1;
H5T_class_t tclass2;
int maxdim_diff = 0; /* maximum dimensions are different */
int dim_diff = 0; /* current dimensions are different */
int i;
- int can_compare = 1; /* return value */
h5difftrace("diff_can_type start\n");
/*-------------------------------------------------------------------------
- * check for the same class
- *-------------------------------------------------------------------------
- */
+ * check for the same class
+ *-------------------------------------------------------------------------
+ */
if((tclass1 = H5Tget_class(f_tid1)) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_class first object failed");
if((tclass2 = H5Tget_class(f_tid2)) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_class second object failed");
if(tclass1 != tclass2) {
- if((options->m_verbose || options->m_list_not_cmp) && obj1_name && obj2_name) {
+ if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) {
if(is_compound) {
parallel_print("Not comparable: <%s> has a class %s and <%s> has a class %s\n",
obj1_name, get_class(tclass1),
@@ -664,24 +642,22 @@ int diff_can_type( hid_t f_tid1, /* file data type */
obj2_name, get_class(tclass2));
}
}
- can_compare = 0;
- options->not_cmp = 1;
- goto done;
+ opts->not_cmp = 1;
+ HGOTO_DONE(0);
}
/*-------------------------------------------------------------------------
- * check for non supported classes
- *-------------------------------------------------------------------------
- */
+ * check for non supported classes
+ *-------------------------------------------------------------------------
+ */
switch (tclass1) {
case H5T_TIME:
- if((options->m_verbose || options->m_list_not_cmp) && obj1_name && obj2_name) {
+ if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) {
parallel_print("Not comparable: <%s> and <%s> are of class %s\n",
obj1_name, obj2_name, get_class(tclass2));
} /* end if */
- can_compare = 0;
- options->not_cmp = 1;
- goto done;
+ opts->not_cmp = 1;
+ HGOTO_DONE(0);
case H5T_INTEGER:
case H5T_FLOAT:
@@ -701,10 +677,10 @@ int diff_can_type( hid_t f_tid1, /* file data type */
} /* end switch */
/*-------------------------------------------------------------------------
- * check for equal file datatype; warning only
- *-------------------------------------------------------------------------
- */
- if((H5Tequal(f_tid1, f_tid2) == 0) && (options->m_verbose) && obj1_name && obj2_name) {
+ * check for equal file datatype; warning only
+ *-------------------------------------------------------------------------
+ */
+ if((H5Tequal(f_tid1, f_tid2) == 0) && (opts->m_verbose) && obj1_name && obj2_name) {
H5T_class_t cl = H5Tget_class(f_tid1);
parallel_print("Warning: different storage datatype\n");
@@ -719,11 +695,11 @@ int diff_can_type( hid_t f_tid1, /* file data type */
}
/*-------------------------------------------------------------------------
- * check for the same rank
- *-------------------------------------------------------------------------
- */
+ * check for the same rank
+ *-------------------------------------------------------------------------
+ */
if(rank1 != rank2) {
- if((options->m_verbose || options->m_list_not_cmp) && obj1_name && obj2_name) {
+ if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) {
parallel_print("Not comparable: <%s> has rank %d, dimensions ", obj1_name, rank1);
print_dimensions(rank1, dims1);
parallel_print(", max dimensions ");
@@ -735,15 +711,14 @@ int diff_can_type( hid_t f_tid1, /* file data type */
print_dimensions(rank2, maxdim2);
parallel_print("\n");
}
- can_compare = 0;
- options->not_cmp = 1;
- goto done;
+ opts->not_cmp = 1;
+ HGOTO_DONE(0);
}
/*-------------------------------------------------------------------------
- * check for different dimensions
- *-------------------------------------------------------------------------
- */
+ * check for different dimensions
+ *-------------------------------------------------------------------------
+ */
for(i = 0; i<rank1; i++) {
if(maxdim1 && maxdim2) {
if(maxdim1[i] != maxdim2[i])
@@ -754,11 +729,11 @@ int diff_can_type( hid_t f_tid1, /* file data type */
}
/*-------------------------------------------------------------------------
- * current dimensions
- *-------------------------------------------------------------------------
- */
+ * current dimensions
+ *-------------------------------------------------------------------------
+ */
if(dim_diff == 1) {
- if((options->m_verbose || options->m_list_not_cmp) && obj1_name && obj2_name) {
+ if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) {
parallel_print("Not comparable: <%s> has rank %d, dimensions ", obj1_name, rank1);
print_dimensions(rank1, dims1);
if(maxdim1 && maxdim2) {
@@ -772,17 +747,16 @@ int diff_can_type( hid_t f_tid1, /* file data type */
parallel_print("\n");
}
}
- can_compare = 0;
- options->not_cmp = 1;
- goto done;
+ opts->not_cmp = 1;
+ HGOTO_DONE(0);
}
/*-------------------------------------------------------------------------
- * maximum dimensions; just give a warning
- *-------------------------------------------------------------------------
- */
+ * maximum dimensions; just give a warning
+ *-------------------------------------------------------------------------
+ */
if(maxdim1 && maxdim2 && maxdim_diff == 1 && obj1_name) {
- if(options->m_verbose) {
+ if(opts->m_verbose) {
parallel_print( "Warning: different maximum dimensions\n");
parallel_print("<%s> has max dimensions ", obj1_name);
print_dimensions(rank1, maxdim1);
@@ -797,21 +771,20 @@ int diff_can_type( hid_t f_tid1, /* file data type */
int nmembs1;
int nmembs2;
int j;
- hid_t memb_type1;
- hid_t memb_type2;
+ hid_t memb_type1 = -1;
+ hid_t memb_type2 = -1;
nmembs1 = H5Tget_nmembers(f_tid1);
nmembs2 = H5Tget_nmembers(f_tid2);
if(nmembs1 != nmembs2) {
- if((options->m_verbose || options->m_list_not_cmp) && obj1_name && obj2_name) {
+ if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) {
parallel_print("Not comparable: <%s> has %d members ", obj1_name, nmembs1);
parallel_print("<%s> has %d members ", obj2_name, nmembs2);
parallel_print("\n");
}
- can_compare = 0;
- options->not_cmp = 1;
- goto done;
+ opts->not_cmp = 1;
+ HGOTO_DONE(0);
}
for (j = 0; j < nmembs1; j++) {
@@ -820,30 +793,31 @@ int diff_can_type( hid_t f_tid1, /* file data type */
if (diff_can_type(memb_type1, memb_type2, rank1, rank2,
dims1, dims2, maxdim1, maxdim2, obj1_name, obj2_name,
- options, 1) != 1) {
- can_compare = 0;
- options->not_cmp = 1;
+ opts, 1) != 1) {
+ opts->not_cmp = 1;
H5Tclose(memb_type1);
H5Tclose(memb_type2);
- goto done;
+ HGOTO_DONE(0);
}
H5Tclose(memb_type1);
H5Tclose(memb_type2);
}
}
done:
- h5diffdebug2("diff_can_type end - %d\n", can_compare);
- return can_compare;
+ if (ret_value < 0)
+ opts->err_stat = 1;
+
+ h5diffdebug2("diff_can_type end - %d\n", ret_value);
+ return ret_value;
}
/*-------------------------------------------------------------------------
-* Function: print_sizes
-*
-* Purpose: Print datatype sizes
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: print_sizes
+ *
+ * Purpose: Print datatype sizes
+ *-------------------------------------------------------------------------
+ */
#if defined (H5DIFF_DEBUG)
void print_sizes( const char *obj1,
const char *obj2,
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index ad23ccf..d4fc3a2 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -24,8 +24,7 @@ int g_nTasks = 1;
/*-------------------------------------------------------------------------
* Function: print_dimensions
*
- * Purpose: print dimensions
- *
+ * Purpose: print dimensions
*-------------------------------------------------------------------------
*/
void
@@ -33,14 +32,14 @@ print_dimensions (int rank, hsize_t *dims)
{
int i;
- if( rank <= 0 )
+ if(rank <= 0)
parallel_print("H5S_SCALAR" );
else {
if (!dims)
parallel_print("dimension is NULL");
else {
parallel_print("[");
- for ( i = 0; i < rank-1; i++) {
+ for (i = 0; i < rank-1; i++) {
parallel_print(HSIZE_T_FORMAT, dims[i]);
parallel_print("x");
}
@@ -55,16 +54,11 @@ print_dimensions (int rank, hsize_t *dims)
/*-------------------------------------------------------------------------
* Function: print_type
*
- * Purpose: Print name of datatype
- *
- * Return: void
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Purpose: Print name of datatype
*
- * Date: May 9, 2003
- *
- * Comments: Adapted from h5dump for H5T_INTEGER and H5T_FLOAT classes only
+ * Return: void
*
+ * Comments: Adapted from h5dump for H5T_INTEGER and H5T_FLOAT classes only
*-------------------------------------------------------------------------
*/
void print_type(hid_t type)
@@ -188,12 +182,7 @@ void print_type(hid_t type)
/*-------------------------------------------------------------------------
* Function: diff_basename
*
- * Purpose: Returns a pointer to the last component absolute name
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: May 9, 2003
- *
+ * Purpose: Returns a pointer to the last component absolute name
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE const char*
@@ -219,12 +208,7 @@ diff_basename(const char *name)
/*-------------------------------------------------------------------------
* Function: get_type
*
- * Purpose: Returns the type as a string
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: May 9, 2003
- *
+ * Purpose: Returns the type as a string
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE H5_ATTR_CONST const char*
@@ -255,21 +239,13 @@ get_type(h5trav_type_t type)
/*-------------------------------------------------------------------------
* Function: get_sign
*
- * Purpose: Returns the sign as a string
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: May 9, 2003
- *
- * Comments:
- *
+ * Purpose: Returns the sign as a string
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE const char*
get_sign(H5T_sign_t sign)
{
- switch(sign)
- {
+ switch(sign) {
case H5T_SGN_NONE:
return "H5T_SGN_NONE";
@@ -291,12 +267,7 @@ get_sign(H5T_sign_t sign)
/*-------------------------------------------------------------------------
* Function: get_class
*
- * Purpose: Returns the class as a string
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: May 9, 2003
- *
+ * Purpose: Returns the class as a string
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE const char*
@@ -346,8 +317,7 @@ get_class(H5T_class_t tclass)
/*-------------------------------------------------------------------------
* Function: print_found
*
- * Purpose: print number of differences found
- *
+ * Purpose: print number of differences found
*-------------------------------------------------------------------------
*/
void print_found(hsize_t nfound)
@@ -362,43 +332,37 @@ void print_found(hsize_t nfound)
/*-----------------------------------------------------------------
* Function: match_up_memsize
*
- * Purpose: match smaller memory size up to bigger memory size
+ * Purpose: match smaller memory size up to bigger memory size
*------------------------------------------------------------------
*/
herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id,
hid_t *m_tid1, hid_t *m_tid2,
size_t *m_size1, size_t *m_size2)
{
- herr_t ret = SUCCEED;
+ herr_t ret_value = SUCCEED;
if((*m_size1) != (*m_size2)) {
if((*m_size1) < (*m_size2)) {
- H5Tclose( *m_tid1 );
+ H5Tclose(*m_tid1);
- if(((*m_tid1) = H5Tget_native_type(f_tid2_id, H5T_DIR_DEFAULT)) < 0) {
- ret = FAIL;
- goto out;
- }
+ if(((*m_tid1) = H5Tget_native_type(f_tid2_id, H5T_DIR_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed");
- *m_size1 = H5Tget_size( *m_tid1 );
+ *m_size1 = H5Tget_size(*m_tid1);
} /* end if */
else {
H5Tclose(*m_tid2);
- if(((*m_tid2) = H5Tget_native_type(f_tid1_id, H5T_DIR_DEFAULT)) < 0) {
- ret = FAIL;
- goto out;
- }
+ if(((*m_tid2) = H5Tget_native_type(f_tid1_id, H5T_DIR_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed");
*m_size2 = H5Tget_size(*m_tid2);
} /* end else */
} /* end if */
- if((*m_size1) != (*m_size2)) {
- ret = FAIL;
- goto out;
- }
+ if((*m_size1) != (*m_size2))
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "native type sizes do not compare");
-out:
- return ret;
+done:
+ return ret_value;
}
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 344913a..89cb524 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -23,10 +23,10 @@
#include "H5private.h"
/* global variables */
-hid_t H5tools_ERR_STACK_g = 0;
-hid_t H5tools_ERR_CLS_g = -1;
-hid_t H5E_tools_g = -1;
-hid_t H5E_tools_min_id_g = -1;
+hid_t H5tools_ERR_STACK_g = 0;
+hid_t H5tools_ERR_CLS_g = -1;
+hid_t H5E_tools_g = -1;
+hid_t H5E_tools_min_id_g = -1;
int compound_data;
FILE *rawattrstream = NULL; /* should initialize to stdout but gcc moans about it */
FILE *rawdatastream = NULL; /* should initialize to stdout but gcc moans about it */
@@ -77,18 +77,13 @@ typedef enum {
#define NUM_DRIVERS (sizeof(drivernames) / sizeof(drivernames[0]))
/*-------------------------------------------------------------------------
- * Audience: Public
- * Chapter: H5Tools Library
- * Purpose: Initialize the H5 Tools library
- * Description:
- * This should be called before any other h5tools function is called.
- * Effect of any h5tools function called before this has been called is
- * undetermined.
- * Return:
- * None
- * Programmer:
- * Albert Cheng, 2000-10-31
- * Modifications:
+ * Function: h5tools_init
+ *
+ * Purpose: This should be called before any other h5tools function is called.
+ * Effect of any h5tools function called before this has been called is
+ * undetermined.
+ *
+ * Return None
*-------------------------------------------------------------------------
*/
void
@@ -121,19 +116,14 @@ h5tools_init(void)
}
/*-------------------------------------------------------------------------
- * Audience: Public
- * Chapter: H5Tools Library
- * Purpose: Close the H5 Tools library
- * Description:
- * Close or release resources such as files opened by the library. This
- * should be called after all other h5tools functions have been called.
- * Effect of any h5tools function called after this has been called is
- * undetermined.
- * Return:
- * None
- * Programmer:
- * Albert Cheng, 2000-10-31
- * Modifications:
+ * Function: h5tools_close
+ *
+ * Purpose: Close or release resources such as files opened by the library. This
+ * should be called after all other h5tools functions have been called.
+ * Effect of any h5tools function called after this has been called is
+ * undetermined.
+ *
+ * Return: None
*-------------------------------------------------------------------------
*/
void
@@ -193,19 +183,13 @@ h5tools_close(void)
}
/*-------------------------------------------------------------------------
- * Function: h5tools_set_data_output_file
- *
- * Purpose: Open fname as the output file for dataset raw data.
- * Set rawdatastream as its file stream.
+ * Function: h5tools_set_data_output_file
*
- * Return: 0 -- succeeded
- * negative -- failed
- *
- * Programmer: Albert Cheng, 2000/09/30
- *
- * Modifications:
- * pvn June, 1, 2006. Add a switch for binary output
+ * Purpose: Open fname as the output file for dataset raw data.
+ * Set rawdatastream as its file stream.
*
+ * Return: 0 -- succeeded
+ * negative -- failed
*-------------------------------------------------------------------------
*/
int
@@ -247,14 +231,13 @@ h5tools_set_data_output_file(const char *fname, int is_bin)
}
/*-------------------------------------------------------------------------
- * Function: h5tools_set_attr_output_file
+ * Function: h5tools_set_attr_output_file
*
- * Purpose: Open fname as the output file for attribute raw data.
- * Set rawattrstream as its file stream.
- *
- * Return: 0 -- succeeded
- * negative -- failed
+ * Purpose: Open fname as the output file for attribute raw data.
+ * Set rawattrstream as its file stream.
*
+ * Return: 0 -- succeeded
+ * negative -- failed
*-------------------------------------------------------------------------
*/
int
@@ -296,13 +279,13 @@ h5tools_set_attr_output_file(const char *fname, int is_bin)
}
/*-------------------------------------------------------------------------
- * Function: h5tools_set_input_file
+ * Function: h5tools_set_input_file
*
- * Purpose: Open fname as the input file for raw input.
- * Set rawinstream as its file stream.
+ * Purpose: Open fname as the input file for raw input.
+ * Set rawinstream as its file stream.
*
- * Return: 0 -- succeeded
- * negative -- failed
+ * Return: 0 -- succeeded
+ * negative -- failed
*
*-------------------------------------------------------------------------
*/
@@ -344,13 +327,13 @@ h5tools_set_input_file(const char *fname, int is_bin)
}
/*-------------------------------------------------------------------------
- * Function: h5tools_set_output_file
+ * Function: h5tools_set_output_file
*
- * Purpose: Open fname as the output file for raw output.
- * Set rawoutstream as its file stream.
+ * Purpose: Open fname as the output file for raw output.
+ * Set rawoutstream as its file stream.
*
- * Return: 0 -- succeeded
- * negative -- failed
+ * Return: 0 -- succeeded
+ * negative -- failed
*
*-------------------------------------------------------------------------
*/
@@ -392,14 +375,13 @@ h5tools_set_output_file(const char *fname, int is_bin)
}
/*-------------------------------------------------------------------------
- * Function: h5tools_set_error_file
- *
- * Purpose: Open fname as the error output file for dataset raw error.
- * Set rawerrorstream as its file stream.
+ * Function: h5tools_set_error_file
*
- * Return: 0 -- succeeded
- * negative -- failed
+ * Purpose: Open fname as the error output file for dataset raw error.
+ * Set rawerrorstream as its file stream.
*
+ * Return: 0 -- succeeded
+ * negative -- failed
*-------------------------------------------------------------------------
*/
int
@@ -441,33 +423,28 @@ h5tools_set_error_file(const char *fname, int is_bin)
}
/*-------------------------------------------------------------------------
- * Audience: Private
- * Chapter: H5Tools Library
- * Purpose: Get a FAPL for a driver
- * Description:
- * Get a FAPL for a given VFL driver name.
- * Return:
- * None
- * Programmer:
- * Quincey Koziol, 2004-02-04
- * Modifications:
- * Pedro Vicente Nunes, Thursday, July 27, 2006
- * Added error return conditions for the H5Pset_fapl calls
+ * Function: h5tools_get_fapl
+ *
+ * Purpose: Get a FAPL for a given VFL driver name.
+ *
+ * Return: positive - succeeded
+ * negative - failed
*-------------------------------------------------------------------------
*/
static hid_t
h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum)
{
- hid_t new_fapl; /* Copy of file access property list passed in, or new property list */
+ hid_t new_fapl = -1; /* Copy of file access property list passed in, or new property list */
+ int ret_value = SUCCEED;
/* Make a copy of the FAPL, for the file open call to use, eventually */
if (fapl == H5P_DEFAULT) {
if ((new_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed");
} /* end if */
else {
if ((new_fapl = H5Pcopy(fapl)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcopy failed");
} /* end else */
/* Determine which driver the user wants to open the file with. Try
@@ -475,7 +452,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum)
if (!HDstrcmp(driver, drivernames[SEC2_IDX])) {
/* SEC2 driver */
if (H5Pset_fapl_sec2(new_fapl) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fapl_sec2 failed");
if (drivernum)
*drivernum = SEC2_IDX;
@@ -487,7 +464,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum)
* is the member size.
*/
if (H5Pset_fapl_family(new_fapl, (hsize_t) 0, H5P_DEFAULT) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fapl_family failed");
if (drivernum)
*drivernum = FAMILY_IDX;
@@ -495,7 +472,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum)
else if (!HDstrcmp(driver, drivernames[SPLIT_IDX])) {
/* SPLIT Driver */
if (H5Pset_fapl_split(new_fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fapl_split failed");
if (drivernum)
*drivernum = SPLIT_IDX;
@@ -503,7 +480,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum)
else if (!HDstrcmp(driver, drivernames[MULTI_IDX])) {
/* MULTI Driver */
if (H5Pset_fapl_multi(new_fapl, NULL, NULL, NULL, NULL, TRUE) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fapl_multi failed");
if(drivernum)
*drivernum = MULTI_IDX;
@@ -519,29 +496,28 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum)
if(mpi_initialized && !mpi_finalized) {
if(H5Pset_fapl_mpio(new_fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fapl_mpio failed");
if(drivernum)
*drivernum = MPIO_IDX;
} /* end if */
}
#endif /* H5_HAVE_PARALLEL */
else
- goto error;
+ ret_value = -1;
- return(new_fapl);
-
-error:
- if(new_fapl != H5P_DEFAULT)
+done:
+ if((new_fapl != H5P_DEFAULT) && (ret_value < 0)) {
H5Pclose(new_fapl);
- return -1;
+ new_fapl = -1;
+ }
+
+ return(new_fapl);
}
/*-------------------------------------------------------------------------
- * Audience: Public
- * Chapter: H5Tools Library
- * Purpose: Open a file with various VFL drivers.
- * Description:
- * Loop through the various types of VFL drivers trying to open FNAME.
+ * Function: h5tools_fopen
+ *
+ * Purpose: Loop through the various types of VFL drivers trying to open FNAME.
* If the HDF5 library is version 1.2 or less, then we have only the SEC2
* driver to try out. If the HDF5 library is greater than version 1.2,
* then we have the FAMILY, SPLIT, and MULTI drivers to play with.
@@ -549,6 +525,7 @@ error:
* If DRIVER is non-NULL, then it will try to open the file with that
* driver first. We assume that the user knows what they are doing so, if
* we fail, then we won't try other file drivers.
+ *
* Return:
* On success, returns a file id for the opened file. If DRIVERNAME is
* non-null then the first DRIVERNAME_SIZE-1 characters of the driver
@@ -556,38 +533,6 @@ error:
*
* Otherwise, the function returns FAIL. If DRIVERNAME is non-null then
* the first byte is set to the null terminator.
- * Programmer:
- * Lost in the mists of time.
- * Modifications:
- * Robb Matzke, 2000-06-23
- * We only have to initialize driver[] on the first call, thereby
- * preventing memory leaks from repeated calls to H5Pcreate().
- *
- * Robb Matzke, 2000-06-23
- * Added DRIVERNAME_SIZE arg to prevent overflows when writing to
- * DRIVERNAME.
- *
- * Robb Matzke, 2000-06-23
- * Added test to prevent coredump when the file could not be opened by
- * any driver.
- *
- * Robb Matzke, 2000-06-23
- * Changed name from H5ToolsFopen() so it jives better with the names we
- * already have at the top of this source file.
- *
- * Thomas Radke, 2000-09-12
- * Added Stream VFD to the driver[] array.
- *
- * Bill Wendling, 2001-01-10
- * Changed macro behavior so that if we have a version other than 1.2.x
- * (i.e., > 1.2), then we do the drivers check.
- *
- * Bill Wendling, 2001-07-30
- * Added DRIVER parameter so that the user can specify "try this driver"
- * instead of the default behaviour. If it fails to open the file with
- * that driver, this will fail completely (i.e., we won't try the other
- * drivers). We're assuming the user knows what they're doing. How UNIX
- * of us.
*-------------------------------------------------------------------------
*/
hid_t
@@ -652,18 +597,13 @@ done:
}
/*-------------------------------------------------------------------------
- * Audience: Public
- * Chapter: H5Tools Library
- * Purpose: Count the number of columns in a string.
- * Description:
- * Count the number of columns in a string. This is the number of
- * characters in the string not counting line-control characters.
- * Return:
- * On success, returns the width of the string. Otherwise this function
- * returns 0.
- * Programmer:
- * Robb Matzke, Tuesday, April 27, 1999
- * Modifications:
+ * Function: h5tools_count_ncols
+ *
+ * Purpose: Count the number of columns in a string. This is the number of
+ * characters in the string not counting line-control characters.
+ *
+ * Return: success - returns the width of the string.
+ * failure - 0.
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE static size_t
@@ -681,20 +621,17 @@ h5tools_count_ncols(const char *s)
/*-------------------------------------------------------------------------
* Function: h5tools_detect_vlen
*
- * Purpose: Recursive check for any variable length data in given type.
+ * Purpose: Recursive check for any variable length data in given type.
*
- * Return:
- * TRUE : type conatains any variable length data
- * FALSE : type doesn't contain any variable length data
- * Negative value: error occur
- *
- * Programmer: Jonathan Kim March 18, 2011
+ * Return: TRUE : type contains any variable length data
+ * FALSE : type doesn't contain any variable length data
+ * Negative value: failed
*-------------------------------------------------------------------------
*/
htri_t
h5tools_detect_vlen(hid_t tid)
{
- htri_t ret;
+ htri_t ret = FALSE;
/* recursive detect any vlen data values in type (compound, array ...) */
ret = H5Tdetect_class(tid, H5T_VLEN);
@@ -713,20 +650,18 @@ done:
/*-------------------------------------------------------------------------
* Function: h5tools_detect_vlen_str
*
- * Purpose: Recursive check for variable length string of a datatype.
- *
- * Return:
- * TRUE : type conatains any variable length string
- * FALSE : type doesn't contain any variable length string
- * Negative value: error occur
+ * Purpose: Recursive check for variable length string of a datatype.
*
+ * Return: TRUE : type contains any variable length string
+ * FALSE : type doesn't contain any variable length string
+ * Negative value: failed
*-------------------------------------------------------------------------
*/
htri_t
h5tools_detect_vlen_str(hid_t tid)
{
H5T_class_t tclass = -1;
- htri_t ret = FALSE;
+ htri_t ret = FALSE;
ret = H5Tis_variable_str(tid);
if((ret == TRUE) || (ret < 0))
@@ -774,25 +709,13 @@ done:
}
/*-------------------------------------------------------------------------
- * Audience: Public
- * Chapter: H5Tools Library
- * Purpose: Emit a simple prefix to STREAM.
- * Description:
- * If /ctx->need_prefix/ is set then terminate the current line (if
- * applicable), calculate the prefix string, and display it at the start
- * of a line.
- * Return:
- * None
- * Programmer:
- * Robb Matzke, Monday, April 26, 1999
- * Modifications:
- * Robb Matzke, 1999-09-29
- * If a new prefix is printed then the current element number is set back
- * to zero.
- * pvn, 2004-07-08
- * Added support for printing array indices:
- * the indentation is printed before the prefix (printed one indentation
- * level before)
+ * Function: h5tools_simple_prefix
+ *
+ * Purpose: If /ctx->need_prefix/ is set then terminate the current line (if
+ * applicable), calculate the prefix string, and display it at the start
+ * of a line.
+ *
+ * Return: None
*-------------------------------------------------------------------------
*/
void
@@ -800,7 +723,7 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info,
h5tools_context_t *ctx, hsize_t elmtno, int secnum)
{
h5tools_str_t prefix;
- h5tools_str_t str; /*temporary for indentation */
+ h5tools_str_t str; /*temporary for indentation */
size_t templength = 0;
unsigned u, indentlevel = 0;
@@ -871,15 +794,13 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info,
}
/*-------------------------------------------------------------------------
- * Audience: Public
- * Chapter: H5Tools Library
- * Purpose: Emit a simple prefix to STREAM.
- * Description:
- * If /ctx->need_prefix/ is set then terminate the current line (if
- * applicable), calculate the prefix string, and display it at the start
- * of a line. Calls region specific function.
- * Return:
- * None
+ * Function: h5tools_region_simple_prefix
+ *
+ * Purpose: If /ctx->need_prefix/ is set then terminate the current line (if
+ * applicable), calculate the prefix string, and display it at the start
+ * of a line. Calls region specific function.
+ *
+ * Return: None
*-------------------------------------------------------------------------
*/
void
@@ -887,7 +808,7 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info,
h5tools_context_t *ctx, hsize_t elmtno, hsize_t *ptdata, int secnum)
{
h5tools_str_t prefix;
- h5tools_str_t str; /*temporary for indentation */
+ h5tools_str_t str; /*temporary for indentation */
size_t templength = 0;
unsigned u, indentlevel = 0;
@@ -958,28 +879,26 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info,
}
/*-------------------------------------------------------------------------
- * Audience: Public
- * Chapter: H5Tools Library
- * Purpose: Render an element to output STREAM.
- * Description:
- * Prints the string buffer to the output STREAM. The string is
- * printed according to the format described in INFO. The CTX struct
- * contains context information shared between calls to this function.
+ * Function: h5tools_render_element
*
- * Return:
- * False if a dimension end is reached, otherwise true
+ * Purpose: Prints the string buffer to the output STREAM. The string is
+ * printed according to the format described in INFO. The CTX struct
+ * contains context information shared between calls to this function.
+ *
+ * Return: False if a dimension end is reached
+ * True otherwise
*
* In/Out:
- * h5tools_context_t *ctx
- * h5tools_str_t *buffer
- * hsize_t *curr_pos
+ * h5tools_context_t *ctx
+ * h5tools_str_t *buffer
+ * hsize_t *curr_pos
*
* Parameters Description:
- * h5tools_str_t *buffer is the string into which to render
- * hsize_t curr_pos is the total data element position
- * size_t ncols
- * hsize_t local_elmt_counter is the local element loop counter
- * hsize_t elmt_count is the data element loop counter
+ * h5tools_str_t *buffer is the string into which to render
+ * hsize_t curr_pos is the total data element position
+ * size_t ncols
+ * hsize_t local_elmt_counter is the local element loop counter
+ * hsize_t elmt_count is the data element loop counter
*-------------------------------------------------------------------------
*/
hbool_t
@@ -988,10 +907,10 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info,
size_t ncols, hsize_t local_elmt_counter, hsize_t elmt_counter)
{
hbool_t dimension_break = TRUE;
- char *s;
- char *section; /*a section of output */
- int secnum; /*section sequence number */
- int multiline; /*datum was multiline */
+ char *s = NULL;
+ char *section = NULL; /* a section of output */
+ int secnum; /* section sequence number */
+ int multiline; /* datum was multiline */
if (stream == NULL)
return dimension_break;
@@ -1114,29 +1033,28 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info,
}
/*-------------------------------------------------------------------------
- * Audience: Public
- * Chapter: H5Tools Library
- * Purpose: Render a region element to output STREAM.
- * Description:
- * Prints the string buffer to the output STREAM. The string is
- * printed according to the format described in INFO. The CTX struct
- * contains context information shared between calls to this function.
+ * Function: h5tools_render_region_element
+ *
+ * Purpose: Prints the string buffer to the output STREAM. The string is
+ * printed according to the format described in INFO. The CTX struct
+ * contains context information shared between calls to this function.
*
* Return:
- * False if a dimension end is reached, otherwise true
+ * False if a dimension end is reached
+ * True otherwise
*
* In/Out:
- * h5tools_context_t *ctx
- * h5tools_str_t *buffer
- * hsize_t *curr_pos
+ * h5tools_context_t *ctx
+ * h5tools_str_t *buffer
+ * hsize_t *curr_pos
*
* Parameters Description:
- * h5tools_str_t *buffer is the string into which to render
- * hsize_t curr_pos is the total data element position
- * size_t ncols
- * hsize_t *ptdata
- * hsize_t local_elmt_counter is the local element loop counter
- * hsize_t elmt_count is the data element loop counter
+ * h5tools_str_t *buffer is the string into which to render
+ * hsize_t curr_pos is the total data element position
+ * size_t ncols
+ * hsize_t *ptdata
+ * hsize_t local_elmt_counter is the local element loop counter
+ * hsize_t elmt_count is the data element loop counter
*-------------------------------------------------------------------------
*/
hbool_t
@@ -1145,10 +1063,10 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
size_t ncols, hsize_t *ptdata, hsize_t local_elmt_counter, hsize_t elmt_counter)
{
hbool_t dimension_break = TRUE;
- char *s;
- char *section; /*a section of output */
- int secnum; /*section sequence number */
- int multiline; /*datum was multiline */
+ char *s = NULL;
+ char *section = NULL; /* a section of output */
+ int secnum; /* section sequence number */
+ int multiline; /* datum was multiline */
s = h5tools_str_fmt(buffer, (size_t)0, "%s");
@@ -1270,11 +1188,11 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
}
/*-------------------------------------------------------------------------
- * Function: init_acc_pos
+ * Function: init_acc_pos
*
- * Purpose: initialize accumulator and matrix position
+ * Purpose: initialize accumulator and matrix position
*
- * Return: void
+ * Return: void
*-------------------------------------------------------------------------
*/
void
@@ -1295,10 +1213,10 @@ init_acc_pos(h5tools_context_t *ctx, hsize_t *dims)
/*-------------------------------------------------------------------------
* Function: render_bin_output
*
- * Purpose: Write one element of memory buffer to a binary file stream
+ * Purpose: Write one element of memory buffer to a binary file stream
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: Success: SUCCEED
+ * Failure: FAIL
*-------------------------------------------------------------------------
*/
int
@@ -1344,7 +1262,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
{
unsigned int i;
H5T_str_t pad;
- char *s;
+ char *s = NULL;
unsigned char tempuchar;
pad = H5Tget_strpad(tid);
@@ -1372,7 +1290,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
break;
case H5T_COMPOUND:
{
- int snmembs;
+ int snmembs;
unsigned nmembs;
if((snmembs = H5Tget_nmembers(tid)) < 0)
@@ -1384,7 +1302,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
mem = ((unsigned char*)_mem) + block_index * size;
for (j = 0; j < nmembs; j++) {
- hid_t memb;
+ hid_t memb = -1;
size_t offset;
offset = H5Tget_member_offset(tid, j);
@@ -1404,7 +1322,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
{
int k, ndims;
hsize_t dims[H5S_MAX_RANK], temp_nelmts, nelmts;
- hid_t memb;
+ hid_t memb = -1;
/* get the array's base datatype for each element */
memb = H5Tget_super(tid);
@@ -1437,7 +1355,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
case H5T_VLEN:
{
hsize_t nelmts;
- hid_t memb;
+ hid_t memb = -1;
/* get the VL sequences's base datatype for each element */
memb = H5Tget_super(tid);
@@ -1462,7 +1380,8 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
/* if (H5Tequal(tid, H5T_STD_REF_DSETREG)) */
if (region_output) {
/* region data */
- hid_t region_id, region_space;
+ hid_t region_id = -1;
+ hid_t region_space = -1;
H5S_sel_type region_type;
for (block_index = 0; block_index < block_nelmts; block_index++) {
@@ -1512,15 +1431,13 @@ CATCH
}
/*-------------------------------------------------------------------------
- * Audience: Public
- * Chapter: H5Tools Library
- * Purpose: Print the data values from a dataset referenced by region blocks.
+ * Function: render_bin_output_region_data_blocks
*
- * Description:
- * This is a special case subfunction to print the data in a region reference of type blocks.
+ * Purpose: Print the data values from a dataset referenced by region blocks.
+ * This is a special case subfunction to print the data in a region reference of type blocks.
*
- * Return:
- * The function returns FAIL if there was an error, otherwise SUCEED
+ * Return: FAIL if there was an error
+ * SUCCEED otherwise
*
*-------------------------------------------------------------------------
*/
@@ -1609,16 +1526,13 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
}
/*-------------------------------------------------------------------------
- * Audience: Public
- * Chapter: H5Tools Library
- * Purpose: Print some values from a dataset referenced by region blocks.
- *
- * Description:
- * This is a special case subfunction to dump a region reference using blocks.
+ * Function: render_bin_output_region_blocks
*
- * Return:
- * The function returns False if ERROR, otherwise True
+ * Purpose: Print some values from a dataset referenced by region blocks.
+ * This is a special case subfunction to dump a region reference using blocks.
*
+ * Return: False if ERROR
+ * True otherwise
*-------------------------------------------------------------------------
*/
hbool_t
@@ -1629,7 +1543,7 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
hssize_t snblocks;
hsize_t nblocks;
hsize_t alloc_size;
- hsize_t *ptdata;
+ hsize_t *ptdata = NULL;
int sndims;
unsigned ndims;
hid_t dtype = -1;
@@ -1675,8 +1589,7 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
}
/*-------------------------------------------------------------------------
- * Audience: Public
- * Chapter: H5Tools Library
+ * Function: H5Tools Library
* Purpose: Print the data values from a dataset referenced by region points.
*
* Description:
@@ -1736,16 +1649,13 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id,
}
/*-------------------------------------------------------------------------
- * Audience: Public
- * Chapter: H5Tools Library
- * Purpose: Print some values from a dataset referenced by region points.
+ * Function: render_bin_output_region_points
*
- * Description:
- * This is a special case subfunction to dump a region reference using points.
- *
- * Return:
- * The function returns False if the last dimension has been reached, otherwise True
+ * Purpose: Print some values from a dataset referenced by region points.
+ * This is a special case function to dump a region reference using points.
*
+ * Return: False if the last dimension has been reached
+ * True otherwise
*-------------------------------------------------------------------------
*/
hbool_t
@@ -1791,11 +1701,12 @@ CATCH
}
/*-------------------------------------------------------------------------
- * Function: h5tools_is_zero
+ * Function: h5tools_is_zero
*
- * Purpose: Determines if memory is initialized to all zero bytes.
+ * Purpose: Determines if memory is initialized to all zero bytes.
*
- * Return: TRUE if all bytes are zero; FALSE otherwise
+ * Return: TRUE if all bytes are zero
+ * FALSE otherwise
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE hbool_t
@@ -1811,23 +1722,20 @@ h5tools_is_zero(const void *_mem, size_t size)
}
/*-------------------------------------------------------------------------
- * Function: h5tools_is_obj_same
+ * Function: h5tools_is_obj_same
*
- * Purpose: Check if two given object IDs or link names point to the same object.
+ * Purpose: Check if two given object IDs or link names point to the same object.
*
* Parameters:
- * hid_t loc_id1: location of the first object
- * char *name1: link name of the first object.
- * Use "." or NULL if loc_id1 is the object to be compared.
- * hid_t loc_id2: location of the second object
- * char *name1: link name of the first object.
- * Use "." or NULL if loc_id2 is the object to be compared.
- *
- * Return: TRUE if it is the same object; FALSE otherwise.
+ * hid_t loc_id1: location of the first object
+ * char *name1: link name of the first object.
+ * Use "." or NULL if loc_id1 is the object to be compared.
+ * hid_t loc_id2: location of the second object
+ * char *name1: link name of the first object.
+ * Use "." or NULL if loc_id2 is the object to be compared.
*
- * Programmer: Peter Cao
- * 4/27/2011
- *
+ * Return: TRUE if it is the same object
+ * FALSE otherwise.
*-------------------------------------------------------------------------
*/
hbool_t
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index fb79b77..ed7d38a 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -642,8 +642,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
- if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL)
- {
+ if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL) {
HERROR(H5E_tools_g, H5E_tools_min_id_g, "Could not allocate buffer for ptdata");
HGOTO_DONE(dimension_break);
}
@@ -1910,9 +1909,8 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
obj = search_obj(h5dump_type_table, oinfo.addr);
if(obj) {
- if(!obj->recorded) {
+ if(!obj->recorded)
h5tools_str_append(buffer,"\"/#"H5_PRINTF_HADDR_FMT"\"", obj->objno);
- }
else
h5tools_str_append(buffer, "\"%s\"", obj->objname);
}
@@ -1929,121 +1927,86 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
switch (type_class) {
case H5T_INTEGER:
- if (H5Tequal(type, H5T_STD_I8BE) == TRUE) {
+ if (H5Tequal(type, H5T_STD_I8BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_I8BE");
- }
- else if (H5Tequal(type, H5T_STD_I8LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_I8LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_I8LE");
- }
- else if (H5Tequal(type, H5T_STD_I16BE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_I16BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_I16BE");
- }
- else if (H5Tequal(type, H5T_STD_I16LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_I16LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_I16LE");
- }
- else if (H5Tequal(type, H5T_STD_I32BE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_I32BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_I32BE");
- }
- else if (H5Tequal(type, H5T_STD_I32LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_I32LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_I32LE");
- }
- else if (H5Tequal(type, H5T_STD_I64BE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_I64BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_I64BE");
- }
- else if (H5Tequal(type, H5T_STD_I64LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_I64LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_I64LE");
- }
- else if (H5Tequal(type, H5T_STD_U8BE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_U8BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_U8BE");
- }
- else if (H5Tequal(type, H5T_STD_U8LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_U8LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_U8LE");
- }
- else if (H5Tequal(type, H5T_STD_U16BE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_U16BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_U16BE");
- }
- else if (H5Tequal(type, H5T_STD_U16LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_U16LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_U16LE");
- }
- else if (H5Tequal(type, H5T_STD_U32BE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_U32BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_U32BE");
- }
- else if (H5Tequal(type, H5T_STD_U32LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_U32LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_U32LE");
- }
- else if (H5Tequal(type, H5T_STD_U64BE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_U64BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_U64BE");
- }
- else if (H5Tequal(type, H5T_STD_U64LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_U64LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_U64LE");
- }
- else if (H5Tequal(type, H5T_NATIVE_SCHAR) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_SCHAR) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_SCHAR");
- }
- else if (H5Tequal(type, H5T_NATIVE_UCHAR) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_UCHAR) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_UCHAR");
- }
- else if (H5Tequal(type, H5T_NATIVE_SHORT) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_SHORT) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_SHORT");
- }
- else if (H5Tequal(type, H5T_NATIVE_USHORT) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_USHORT) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_USHORT");
- }
- else if (H5Tequal(type, H5T_NATIVE_INT) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_INT) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_INT");
- }
- else if (H5Tequal(type, H5T_NATIVE_UINT) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_UINT) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_UINT");
- }
- else if (H5Tequal(type, H5T_NATIVE_LONG) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_LONG) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_LONG");
- }
- else if (H5Tequal(type, H5T_NATIVE_ULONG) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_ULONG) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_ULONG");
- }
- else if (H5Tequal(type, H5T_NATIVE_LLONG) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_LLONG) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_LLONG");
- }
- else if (H5Tequal(type, H5T_NATIVE_ULLONG) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_ULLONG) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_ULLONG");
- }
else {
/* byte order */
if (H5Tget_size(type) > 1) {
order = H5Tget_order(type);
- if (H5T_ORDER_LE == order) {
+ if (H5T_ORDER_LE == order)
order_s = " little-endian";
- }
- else if (H5T_ORDER_BE == order) {
+ else if (H5T_ORDER_BE == order)
order_s = " big-endian";
- }
- else if (H5T_ORDER_VAX == order) {
+ else if (H5T_ORDER_VAX == order)
order_s = " mixed-endian";
- }
- else {
+ else
order_s = " unknown-byte-order";
- }
}
- else {
+ else
order_s = "";
- }
/* sign */
if ((sign = H5Tget_sign(type)) >= 0) {
- if (H5T_SGN_NONE == sign) {
+ if (H5T_SGN_NONE == sign)
sign_s = " unsigned";
- }
- else if (H5T_SGN_2 == sign) {
+ else if (H5T_SGN_2 == sign)
sign_s = "";
- }
- else {
+ else
sign_s = " unknown-sign";
- }
}
- else {
+ else
sign_s = " unknown-sign";
- }
/* print size, order, and sign */
h5tools_str_append(buffer, "%lu-bit%s%s integer",
@@ -2052,56 +2015,42 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
break;
case H5T_FLOAT:
- if (H5Tequal(type, H5T_IEEE_F32BE) == TRUE) {
+ if (H5Tequal(type, H5T_IEEE_F32BE) == TRUE)
h5tools_str_append(buffer, "H5T_IEEE_F32BE");
- }
- else if (H5Tequal(type, H5T_IEEE_F32LE) == TRUE) {
+ else if (H5Tequal(type, H5T_IEEE_F32LE) == TRUE)
h5tools_str_append(buffer, "H5T_IEEE_F32LE");
- }
- else if (H5Tequal(type, H5T_IEEE_F64BE) == TRUE) {
+ else if (H5Tequal(type, H5T_IEEE_F64BE) == TRUE)
h5tools_str_append(buffer, "H5T_IEEE_F64BE");
- }
- else if (H5Tequal(type, H5T_IEEE_F64LE) == TRUE) {
+ else if (H5Tequal(type, H5T_IEEE_F64LE) == TRUE)
h5tools_str_append(buffer, "H5T_IEEE_F64LE");
- }
- else if (H5Tequal(type, H5T_VAX_F32) == TRUE) {
+ else if (H5Tequal(type, H5T_VAX_F32) == TRUE)
h5tools_str_append(buffer, "H5T_VAX_F32");
- }
- else if (H5Tequal(type, H5T_VAX_F64) == TRUE) {
+ else if (H5Tequal(type, H5T_VAX_F64) == TRUE)
h5tools_str_append(buffer, "H5T_VAX_F64");
- }
- else if (H5Tequal(type, H5T_NATIVE_FLOAT) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_FLOAT) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_FLOAT");
- }
- else if (H5Tequal(type, H5T_NATIVE_DOUBLE) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_DOUBLE) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_DOUBLE");
#if H5_SIZEOF_LONG_DOUBLE !=0
- }
- else if (H5Tequal(type, H5T_NATIVE_LDOUBLE) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_LDOUBLE) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_LDOUBLE");
#endif
- }
else {
/* byte order */
if (H5Tget_size(type) > 1) {
order = H5Tget_order(type);
- if (H5T_ORDER_LE == order) {
+ if (H5T_ORDER_LE == order)
order_s = " little-endian";
- }
- else if (H5T_ORDER_BE == order) {
+ else if (H5T_ORDER_BE == order)
order_s = " big-endian";
- }
- else if (H5T_ORDER_VAX == order) {
+ else if (H5T_ORDER_VAX == order)
order_s = " mixed-endian";
- }
- else {
+ else
order_s = " unknown-byte-order";
- }
}
- else {
+ else
order_s = "";
- }
/* print size and byte order */
h5tools_str_append(buffer, "%lu-bit%s floating-point",
@@ -2308,33 +2257,24 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
break;
case H5T_BITFIELD:
- if (H5Tequal(type, H5T_STD_B8BE) == TRUE) {
+ if (H5Tequal(type, H5T_STD_B8BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_B8BE");
- }
- else if (H5Tequal(type, H5T_STD_B8LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_B8LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_B8LE");
- }
- else if (H5Tequal(type, H5T_STD_B16BE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_B16BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_B16BE");
- }
- else if (H5Tequal(type, H5T_STD_B16LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_B16LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_B16LE");
- }
- else if (H5Tequal(type, H5T_STD_B32BE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_B32BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_B32BE");
- }
- else if (H5Tequal(type, H5T_STD_B32LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_B32LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_B32LE");
- }
- else if (H5Tequal(type, H5T_STD_B64BE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_B64BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_B64BE");
- }
- else if (H5Tequal(type, H5T_STD_B64LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_B64LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_B64LE");
- }
- else {
+ else
h5tools_str_append(buffer, "undefined bitfield");
- }
break;
case H5T_OPAQUE:
@@ -2948,7 +2888,7 @@ void
h5tools_print_fill_value(h5tools_str_t *buffer/*in,out*/, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, hid_t dcpl, hid_t type_id, hid_t obj_id)
{
size_t size;
- hid_t n_type;
+ hid_t n_type = -1;
void *buf = NULL;
n_type = H5Tget_native_type(type_id, H5T_DIR_DEFAULT);
@@ -3698,7 +3638,8 @@ h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info,
error_msg("unable to open attribute \"%s\"\n", attr_name);
}
else {
- hid_t type, space;
+ hid_t type = -1;
+ hid_t space = -1;
ctx->indent_level++;
@@ -3917,9 +3858,9 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info,
H5S_class_t space_type;
int ndims;
int i;
- hid_t space;
- hid_t type;
- hid_t p_type;
+ hid_t space = -1;
+ hid_t type = -1;
+ hid_t p_type = -1;
hsize_t size[64];
hsize_t alloc_size;
hsize_t nelmts = 1;
diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c
index abd55db..db61d51 100644
--- a/tools/lib/h5tools_filters.c
+++ b/tools/lib/h5tools_filters.c
@@ -18,28 +18,32 @@
* print a warning message
*-------------------------------------------------------------------------
*/
-static void print_warning(const char *dname, const char *fname)
+static void print_filter_warning(const char *dname, const char *fname)
{
fprintf(stderr,
- "warning: dataset <%s> cannot be read, %s filter is not available\n",
+ "Warning: dataset <%s> cannot be read, %s filter is not available\n",
dname, fname);
}
/*-------------------------------------------------------------------------
* Function: h5tools_canreadf
*
- * Purpose: check if the dataset creation property list has filters that
- * are not registered in the current configuration
- * 1) the external filters GZIP and SZIP might not be available
- * 2) the internal filters might be turned off
+ * Purpose: check if the dataset creation property list has filters that
+ * are not registered in the current configuration
+ * 1) the external filters GZIP and SZIP might not be available
+ * 2) the internal filters might be turned off
*
- * Return: 1, can read, 0, cannot, -1 error
+ * Return:
+ * 1 can read,
+ * 0 cannot,
+ * -1 error
*-------------------------------------------------------------------------
*/
-int h5tools_canreadf(const char* name, /* object name, serves also as boolean print */
+int
+h5tools_canreadf(const char* name, /* object name, serves also as boolean print */
hid_t dcpl_id) /* dataset creation property list */
{
- int ret_value = 1; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ int ret_value = 1;
int nfilters; /* number of filters */
H5Z_filter_t filtn; /* filter identification number */
int i; /* index */
@@ -69,7 +73,7 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
}
else if (!udfilter_avail) {
if (name)
- print_warning(name, "user defined");
+ print_filter_warning(name, "user defined");
ret_value = 0;
}
break;
@@ -81,7 +85,7 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
case H5Z_FILTER_DEFLATE:
#ifndef H5_HAVE_FILTER_DEFLATE
if (name)
- print_warning(name,"deflate");
+ print_filter_warning(name,"deflate");
ret_value = 0;
#endif
break;
@@ -92,7 +96,7 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
case H5Z_FILTER_SZIP:
#ifndef H5_HAVE_FILTER_SZIP
if (name)
- print_warning(name,"SZIP");
+ print_filter_warning(name,"SZIP");
ret_value = 0;
#endif
break;
@@ -130,56 +134,58 @@ done:
/*-------------------------------------------------------------------------
* Function: h5tools_canwritef
*
- * Purpose: check if the filter is available and can write data.
- * At this time, all filters that are available can write data,
- * except SZIP, which may be configured decoder-only.
+ * Purpose: check if the filter is available and can write data.
*
- * Return: 1, can write, 0, cannot, -1 error
+ * Return: 1 can write,
+ * 0 cannot,
+ * -1 error
*-------------------------------------------------------------------------
*/
H5_ATTR_CONST int
-h5tools_can_encode(H5Z_filter_t filtn) {
+h5tools_can_encode(H5Z_filter_t filtn)
+{
+ int ret_value = 1;
+
switch (filtn) {
/* user defined filter */
default:
- return 0;
-
+ HGOTO_DONE(0)
case H5Z_FILTER_DEFLATE:
#ifndef H5_HAVE_FILTER_DEFLATE
- return 0;
+ HGOTO_DONE(0)
#endif
break;
case H5Z_FILTER_SZIP:
#ifndef H5_HAVE_FILTER_SZIP
- return 0;
+ HGOTO_DONE(0)
#else
- {
+ {
unsigned int filter_config_flags;
if (H5Zget_filter_info(filtn, &filter_config_flags) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Zget_filter_info failed");
if ((filter_config_flags
& (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) {
/* filter present but neither encode nor decode is supported (???) */
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "neither encode nor decode is supported");
}
else if ((filter_config_flags
& (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_DECODE_ENABLED) {
/* decoder only: read but not write */
- return 0;
+ HGOTO_DONE(0)
}
else if ((filter_config_flags
& (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_ENCODE_ENABLED) {
/* encoder only: write but not read (???) */
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "encoder only: write but not read");
}
else if ((filter_config_flags
& (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED))
== (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) {
- return 1;
+ HGOTO_DONE(1)
}
- }
+ }
#endif
break;
@@ -196,6 +202,7 @@ h5tools_can_encode(H5Z_filter_t filtn) {
break;
}/*switch*/
- return 1;
+done:
+ return ret_value;
}
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index a66cfe5..a018394 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -715,10 +715,11 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
{
size_t nsize, offset, size=0, nelmts, start;
H5T_sign_t nsign;
- char *name;
+ char *name = NULL;
unsigned char *ucp_vp = (unsigned char *)vp;
char *cp_vp = (char *)vp;
- hid_t memb, obj;
+ hid_t memb = -1;
+ hid_t obj = -1;
static char fmt_llong[8], fmt_ullong[8];
H5T_str_t pad;
H5T_class_t type_class;
@@ -1306,7 +1307,8 @@ void
h5tools_str_sprint_region(h5tools_str_t *str, const h5tool_format_t *info,
hid_t container, void *vp)
{
- hid_t obj, region;
+ hid_t obj = -1;
+ hid_t region = -1;
char ref_name[1024];
H5S_sel_type region_type;
diff --git a/tools/lib/h5tools_type.c b/tools/lib/h5tools_type.c
index ee58ccb..f63c228 100644
--- a/tools/lib/h5tools_type.c
+++ b/tools/lib/h5tools_type.c
@@ -21,12 +21,6 @@
*
* Return: Success: datatype ID
* Failure: FAIL
- *
- * Programmer: Pedro Vicente Nunes
- * Tuesday, July 18, 2006
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
@@ -43,40 +37,40 @@ h5tools_get_little_endian_type(hid_t tid)
switch(type_class) {
case H5T_INTEGER:
- if ( size == 1 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I8LE);
- else if ( size == 2 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I16LE);
- else if ( size == 4 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I32LE);
- else if ( size == 8 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I64LE);
- else if ( size == 1 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U8LE);
- else if ( size == 2 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U16LE);
- else if ( size == 4 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U32LE);
- else if ( size == 8 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U64LE);
+ if (size == 1 && sign == H5T_SGN_2)
+ p_type = H5Tcopy(H5T_STD_I8LE);
+ else if (size == 2 && sign == H5T_SGN_2)
+ p_type = H5Tcopy(H5T_STD_I16LE);
+ else if (size == 4 && sign == H5T_SGN_2)
+ p_type = H5Tcopy(H5T_STD_I32LE);
+ else if (size == 8 && sign == H5T_SGN_2)
+ p_type = H5Tcopy(H5T_STD_I64LE);
+ else if (size == 1 && sign == H5T_SGN_NONE)
+ p_type = H5Tcopy(H5T_STD_U8LE);
+ else if (size == 2 && sign == H5T_SGN_NONE)
+ p_type = H5Tcopy(H5T_STD_U16LE);
+ else if (size == 4 && sign == H5T_SGN_NONE)
+ p_type = H5Tcopy(H5T_STD_U32LE);
+ else if (size == 8 && sign == H5T_SGN_NONE)
+ p_type = H5Tcopy(H5T_STD_U64LE);
break;
case H5T_FLOAT:
- if ( size == 4)
- p_type=H5Tcopy(H5T_IEEE_F32LE);
- else if ( size == 8)
- p_type=H5Tcopy(H5T_IEEE_F64LE);
+ if (size == 4)
+ p_type = H5Tcopy(H5T_IEEE_F32LE);
+ else if (size == 8)
+ p_type = H5Tcopy(H5T_IEEE_F64LE);
break;
case H5T_BITFIELD:
- if ( size == 1)
- p_type=H5Tcopy(H5T_STD_B8LE);
- else if ( size == 2)
- p_type=H5Tcopy(H5T_STD_B16LE);
- else if ( size == 4)
- p_type=H5Tcopy(H5T_STD_B32LE);
- else if ( size == 8)
- p_type=H5Tcopy(H5T_STD_B64LE);
+ if (size == 1)
+ p_type = H5Tcopy(H5T_STD_B8LE);
+ else if (size == 2)
+ p_type = H5Tcopy(H5T_STD_B16LE);
+ else if (size == 4)
+ p_type = H5Tcopy(H5T_STD_B32LE);
+ else if (size == 8)
+ p_type = H5Tcopy(H5T_STD_B64LE);
break;
case H5T_TIME:
@@ -107,18 +101,12 @@ h5tools_get_little_endian_type(hid_t tid)
*
* Return: Success: datatype ID
* Failure: FAIL
- *
- * Programmer: Pedro Vicente Nunes
- * Tuesday, July 18, 2006
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
h5tools_get_big_endian_type(hid_t tid)
{
- hid_t p_type=-1;
+ hid_t p_type = -1;
H5T_class_t type_class;
size_t size;
H5T_sign_t sign;
@@ -129,39 +117,39 @@ h5tools_get_big_endian_type(hid_t tid)
switch(type_class) {
case H5T_INTEGER:
- if ( size == 1 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I8BE);
- else if ( size == 2 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I16BE);
- else if ( size == 4 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I32BE);
- else if ( size == 8 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I64BE);
- else if ( size == 1 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U8BE);
- else if ( size == 2 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U16BE);
- else if ( size == 4 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U32BE);
- else if ( size == 8 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U64BE);
+ if (size == 1 && sign == H5T_SGN_2)
+ p_type = H5Tcopy(H5T_STD_I8BE);
+ else if (size == 2 && sign == H5T_SGN_2)
+ p_type = H5Tcopy(H5T_STD_I16BE);
+ else if (size == 4 && sign == H5T_SGN_2)
+ p_type = H5Tcopy(H5T_STD_I32BE);
+ else if (size == 8 && sign == H5T_SGN_2)
+ p_type = H5Tcopy(H5T_STD_I64BE);
+ else if (size == 1 && sign == H5T_SGN_NONE)
+ p_type = H5Tcopy(H5T_STD_U8BE);
+ else if (size == 2 && sign == H5T_SGN_NONE)
+ p_type = H5Tcopy(H5T_STD_U16BE);
+ else if (size == 4 && sign == H5T_SGN_NONE)
+ p_type = H5Tcopy(H5T_STD_U32BE);
+ else if (size == 8 && sign == H5T_SGN_NONE)
+ p_type = H5Tcopy(H5T_STD_U64BE);
break;
case H5T_FLOAT:
- if ( size == 4)
- p_type=H5Tcopy(H5T_IEEE_F32BE);
- else if ( size == 8)
- p_type=H5Tcopy(H5T_IEEE_F64BE);
+ if (size == 4)
+ p_type = H5Tcopy(H5T_IEEE_F32BE);
+ else if (size == 8)
+ p_type = H5Tcopy(H5T_IEEE_F64BE);
break;
case H5T_BITFIELD:
- if ( size == 1)
- p_type=H5Tcopy(H5T_STD_B8BE);
- else if ( size == 2)
- p_type=H5Tcopy(H5T_STD_B16BE);
- else if ( size == 4)
- p_type=H5Tcopy(H5T_STD_B32BE);
- else if ( size == 8)
+ if (size == 1)
+ p_type = H5Tcopy(H5T_STD_B8BE);
+ else if (size == 2)
+ p_type = H5Tcopy(H5T_STD_B16BE);
+ else if (size == 4)
+ p_type = H5Tcopy(H5T_STD_B32BE);
+ else if (size == 8)
p_type=H5Tcopy(H5T_STD_B64BE);
break;
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 8c435b2..5272e81 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -58,15 +58,11 @@ static void add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t
/*-------------------------------------------------------------------------
* Function: parallel_print
*
- * Purpose: wrapper for printf for use in parallel mode.
- *
- * Programmer: Leon Arber
- *
- * Date: December 1, 2004
- *
+ * Purpose: wrapper for printf for use in parallel mode.
*-------------------------------------------------------------------------
*/
-void parallel_print(const char* format, ...)
+void
+parallel_print(const char* format, ...)
{
int bytes_written;
va_list ap;
@@ -103,18 +99,12 @@ void parallel_print(const char* format, ...)
/*-------------------------------------------------------------------------
- * Function: error_msg
+ * Function: error_msg
*
- * Purpose: Print a nicely formatted error message to stderr flushing the
+ * Purpose: Print a nicely formatted error message to stderr flushing the
* stdout stream first.
*
- * Return: Nothing
- *
- * Programmer: Bill Wendling
- * Tuesday, 20. February 2001
- *
- * Modifications:
- *
+ * Return: Nothing
*-------------------------------------------------------------------------
*/
void
@@ -134,18 +124,12 @@ error_msg(const char *fmt, ...)
/*-------------------------------------------------------------------------
- * Function: warn_msg
+ * Function: warn_msg
*
- * Purpose: Print a nicely formatted warning message to stderr flushing
+ * Purpose: Print a nicely formatted warning message to stderr flushing
* the stdout stream first.
*
- * Return: Nothing
- *
- * Programmer: Bill Wendling
- * Tuesday, 20. February 2001
- *
- * Modifications:
- *
+ * Return: Nothing
*-------------------------------------------------------------------------
*/
void
@@ -163,14 +147,11 @@ warn_msg(const char *fmt, ...)
}
/*-------------------------------------------------------------------------
- * Function: help_ref_msg
- *
- * Purpose: Print a message to refer help page
+ * Function: help_ref_msg
*
- * Return: Nothing
- *
- * Modifications:
+ * Purpose: Print a message to refer help page
*
+ * Return: Nothing
*-------------------------------------------------------------------------
*/
void
@@ -182,24 +163,16 @@ help_ref_msg(FILE *output)
/*-------------------------------------------------------------------------
- * Function: get_option
+ * Function: get_option
*
- * Purpose: Determine the command-line options a user specified. We can
- * accept both short and long type command-lines.
+ * Purpose: Determine the command-line options a user specified. We can
+ * accept both short and long type command-lines.
*
* Return: Success: The short valued "name" of the command line
* parameter or EOF if there are no more
* parameters to process.
*
- * Failure: A question mark.
- *
- * Programmer: Bill Wendling
- * Friday, 5. January 2001
- *
- * Modifications: Pedro Vicente
- * October, 27 2008
- * Wilcard "*" argument type
- *
+ * Failure: A question mark.
*-------------------------------------------------------------------------
*/
int
@@ -351,16 +324,11 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
/*-------------------------------------------------------------------------
- * Function: indentation
- *
- * Purpose: Print spaces for indentation
- *
- * Return: void
- *
- * Programmer: Ruey-Hsia Li
+ * Function: indentation
*
- * Modifications:
+ * Purpose: Print spaces for indentation
*
+ * Return: void
*-------------------------------------------------------------------------
*/
void
@@ -378,17 +346,12 @@ indentation(unsigned x)
/*-------------------------------------------------------------------------
- * Function: print_version
- *
- * Purpose: Print the program name and the version information which is
- * defined the same as the HDF5 library version.
- *
- * Return: void
+ * Function: print_version
*
- * Programmer: unknown
- *
- * Modifications:
+ * Purpose: Print the program name and the version information which is
+ * defined the same as the HDF5 library version.
*
+ * Return: void
*-------------------------------------------------------------------------
*/
void
@@ -407,11 +370,6 @@ print_version(const char *progname)
* and committed types
*
* Return: void
- *
- * Programmer: Ruey-Hsia Li
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
@@ -434,11 +392,6 @@ init_table(table_t **tbl)
* and committed types
*
* Return: void
- *
- * Programmer: Paul Harten
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
@@ -462,11 +415,6 @@ free_table(table_t *table)
* Purpose: display the contents of tables for debugging purposes
*
* Return: void
- *
- * Programmer: Ruey-Hsia Li
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
@@ -488,11 +436,6 @@ dump_table(char* tablename, table_t *table)
* Purpose: display the contents of tables for debugging purposes
*
* Return: void
- *
- * Programmer: Ruey-Hsia Li
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
@@ -513,11 +456,6 @@ dump_tables(find_objs_t *info)
* Return: Success: an integer, the location of the object
*
* Failure: FAIL if object is not found
- *
- * Programmer: Ruey-Hsia Li
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE obj_t *
@@ -541,16 +479,10 @@ search_obj(table_t *table, haddr_t objno)
* Return: Success: SUCCEED
*
* Failure: FAIL
- *
- * Programmer: Ruey-Hsia Li
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen,
- void *op_data)
+find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen, void *op_data)
{
find_objs_t *info = (find_objs_t*)op_data;
herr_t ret_value = 0;
@@ -563,7 +495,7 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen
case H5O_TYPE_DATASET:
if(NULL == already_seen) {
- hid_t dset;
+ hid_t dset = -1;
/* Add the dataset to the list of objects */
add_obj(info->dset_table, oinfo->addr, name, TRUE);
@@ -623,11 +555,6 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen
* Return: Success: SUCCEED
*
* Failure: FAIL
- *
- * Programmer: Ruey-Hsia Li
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -657,11 +584,6 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table,
* realloc the table if necessary
*
* Return: void
- *
- * Programmer: Ruey-Hsia Li
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
@@ -695,11 +617,6 @@ add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t record)
*
* Return: a stream description when succeeds.
* NULL if fails.
- *
- * Programmer: Albert Cheng, 2005/8/9
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
FILE *
@@ -723,70 +640,61 @@ tmpfile(void)
*
* Return:
* 2 : given pathname is object
- * 1 : Succed to get link info.
+ * 1 : Succeed to get link info.
* 0 : Detected as a dangling link
* -1 : H5 API failed.
*
* NOTE:
* link_info->trg_path must be freed out of this function
- *
- * Programmer: Jonathan Kim
- *
- * Date: Feb 8, 2010
*-------------------------------------------------------------------------*/
int
-H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info,
- hbool_t get_obj_type)
+H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info, hbool_t get_obj_type)
{
htri_t l_ret;
H5O_info_t trg_oinfo;
hid_t fapl = H5P_DEFAULT;
hid_t lapl = H5P_DEFAULT;
- int ret = -1; /* init to fail */
+ int ret_value = -1; /* init to fail */
/* init */
link_info->trg_type = H5O_TYPE_UNKNOWN;
/* if path is root, return group type */
- if(!HDstrcmp(linkpath,"/"))
- {
+ if(!HDstrcmp(linkpath,"/")) {
link_info->trg_type = H5O_TYPE_GROUP;
- ret = 2;
- goto out;
+ HGOTO_DONE(2);
}
/* check if link itself exist */
if(H5Lexists(file_id, linkpath, H5P_DEFAULT) <= 0) {
if(link_info->opt.msg_mode == 1)
parallel_print("Warning: link <%s> doesn't exist \n",linkpath);
- goto out;
+ HGOTO_DONE(FAIL);
} /* end if */
/* get info from link */
if(H5Lget_info(file_id, linkpath, &(link_info->linfo), H5P_DEFAULT) < 0) {
if(link_info->opt.msg_mode == 1)
parallel_print("Warning: unable to get link info from <%s>\n",linkpath);
- goto out;
+ HGOTO_DONE(FAIL);
} /* end if */
/* given path is hard link (object) */
- if(link_info->linfo.type == H5L_TYPE_HARD) {
- ret = 2;
- goto out;
- } /* end if */
+ if(link_info->linfo.type == H5L_TYPE_HARD)
+ HGOTO_DONE(2);
/* trg_path must be freed out of this function when finished using */
if((link_info->trg_path = (char*)HDcalloc(link_info->linfo.u.val_size, sizeof(char))) == NULL) {
if(link_info->opt.msg_mode == 1)
parallel_print("Warning: unable to allocate buffer for <%s>\n",linkpath);
- goto out;
+ HGOTO_DONE(FAIL);
} /* end if */
/* get link value */
if(H5Lget_val(file_id, linkpath, (void *)link_info->trg_path, link_info->linfo.u.val_size, H5P_DEFAULT) < 0) {
if(link_info->opt.msg_mode == 1)
parallel_print("Warning: unable to get link value from <%s>\n",linkpath);
- goto out;
+ HGOTO_DONE(FAIL);
} /* end if */
/*-----------------------------------------------------
@@ -795,13 +703,13 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_
*/
if(link_info->linfo.type == H5L_TYPE_EXTERNAL) {
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- goto out;
+ HGOTO_DONE(FAIL);
if(H5Pset_fapl_sec2(fapl) < 0)
- goto out;
+ HGOTO_DONE(FAIL);
if((lapl = H5Pcreate(H5P_LINK_ACCESS)) < 0)
- goto out;
+ HGOTO_DONE(FAIL);
if(H5Pset_elink_fapl(lapl, fapl) < 0)
- goto out;
+ HGOTO_DONE(FAIL);
} /* end if */
/* Check for retrieving object info */
@@ -814,25 +722,24 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_
/* detect dangling link */
if(l_ret == FALSE) {
- ret = 0;
- goto out;
- } /* end if */
- /* function failed */
- else if(l_ret < 0)
- goto out;
+ HGOTO_DONE(0);
+ }
+ else if(l_ret < 0) { /* function failed */
+ HGOTO_DONE(FAIL);
+ }
/* get target object info */
if(H5Oget_info_by_name(file_id, linkpath, &trg_oinfo, lapl) < 0) {
if(link_info->opt.msg_mode == 1)
parallel_print("Warning: unable to get object information for <%s>\n", linkpath);
- goto out;
+ HGOTO_DONE(FAIL);
} /* end if */
/* check unknown type */
if(trg_oinfo.type < H5O_TYPE_GROUP || trg_oinfo.type >=H5O_TYPE_NTYPES) {
if(link_info->opt.msg_mode == 1)
parallel_print("Warning: target object of <%s> is unknown type\n", linkpath);
- goto out;
+ HGOTO_DONE(FAIL);
} /* end if */
/* set target obj type to return */
@@ -844,31 +751,34 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_
link_info->trg_type = H5O_TYPE_UNKNOWN;
/* succeed */
- ret = 1;
+ ret_value = 1;
-out:
+done:
if(fapl != H5P_DEFAULT)
H5Pclose(fapl);
if(lapl != H5P_DEFAULT)
H5Pclose(lapl);
- return ret;
+ return ret_value;
} /* end H5tools_get_symlink_info() */
/*-------------------------------------------------------------------------
* Audience: Public
- * Chapter: H5Tools Library
+ *
* Purpose: Initialize the name and operation status of the H5 Tools library
+ *
* Description:
* These are utility functions to set/get the program name and operation status.
*-------------------------------------------------------------------------
*/
-void h5tools_setprogname(const char *Progname)
+void
+h5tools_setprogname(const char *Progname)
{
h5tools_progname = Progname;
}
-void h5tools_setstatus(int D_status)
+void
+h5tools_setstatus(int D_status)
{
h5tools_d_status = D_status;
}
@@ -892,25 +802,19 @@ h5tools_getstatus(void)
* This can be called from each tools main() as part of initial act.
* Note: this is more of debugging purpose for now.
*/
-int h5tools_getenv_update_hyperslab_bufsize(void)
+int
+h5tools_getenv_update_hyperslab_bufsize(void)
{
const char *env_str = NULL;
long hyperslab_bufsize_mb;
+ int ret_value = 1;
/* check if environment variable is set for the hyperslab buffer size */
- if (NULL != (env_str = HDgetenv ("H5TOOLS_BUFSIZE")))
- {
+ if (NULL != (env_str = HDgetenv ("H5TOOLS_BUFSIZE"))) {
errno = 0;
hyperslab_bufsize_mb = HDstrtol(env_str, (char**)NULL, 10);
if (errno != 0 || hyperslab_bufsize_mb <= 0)
- {
- /* TODO: later when pubilshed
- HDfprintf(rawerrorstream,"Error: Invalid environment variable \"H5TOOLS_BUFSIZE\" : %s\n", env_str);
- */
-
- goto error;
- }
-
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "hyperslab buffer size failed");
/* convert MB to byte */
H5TOOLS_BUFSIZE = (hsize_t)hyperslab_bufsize_mb * 1024 * 1024;
@@ -918,9 +822,7 @@ int h5tools_getenv_update_hyperslab_bufsize(void)
H5TOOLS_MALLOCSIZE = MAX(H5TOOLS_BUFSIZE, H5TOOLS_MALLOCSIZE);
}
- return (1);
-
-error:
- return (-1);
+done:
+ return ret_value;
}
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index ddc0109..b6d32f7 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -13,6 +13,7 @@
#include "h5trav.h"
+#include "h5tools.h"
#include "H5private.h"
/*-------------------------------------------------------------------------
@@ -81,10 +82,9 @@ static int trav_verbosity = 0;
/*-------------------------------------------------------------------------
* Function: h5trav_set_index
*
- * Purpose: Set indexing properties for the objects & links in the file
- *
- * Return: none
+ * Purpose: Set indexing properties for the objects & links in the file
*
+ * Return: none
*-------------------------------------------------------------------------
*/
void
@@ -97,10 +97,9 @@ h5trav_set_index(H5_index_t print_index_by, H5_iter_order_t print_index_order)
/*-------------------------------------------------------------------------
* Function: h5trav_set_verbose
*
- * Purpose: Set verbosity of file contents 1=>attributes
- *
- * Return: none
+ * Purpose: Set verbosity of file contents 1=>attributes
*
+ * Return: none
*-------------------------------------------------------------------------
*/
void
@@ -118,14 +117,9 @@ h5trav_set_verbose(int print_verbose)
/*-------------------------------------------------------------------------
* Function: trav_addr_add
*
- * Purpose: Add a hardlink address to visited data structure
- *
- * Return: void
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 1, 2007
+ * Purpose: Add a hardlink address to visited data structure
*
+ * Return: void
*-------------------------------------------------------------------------
*/
static void
@@ -149,14 +143,9 @@ trav_addr_add(trav_addr_t *visited, haddr_t addr, const char *path)
/*-------------------------------------------------------------------------
* Function: trav_addr_visited
*
- * Purpose: Check if an address has already been visited
- *
- * Return: TRUE/FALSE
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 1, 2007
+ * Purpose: Check if an address has already been visited
*
+ * Return: TRUE/FALSE
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE static const char *
@@ -178,12 +167,7 @@ trav_addr_visited(trav_addr_t *visited, haddr_t addr)
/*-------------------------------------------------------------------------
* Function: traverse_cb
*
- * Purpose: Iterator callback for traversing objects in file
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 1, 2007
- *
+ * Purpose: Iterator callback for traversing objects in file
*-------------------------------------------------------------------------
*/
static herr_t
@@ -258,26 +242,23 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
/*-------------------------------------------------------------------------
* Function: traverse
*
- * Purpose: Iterate over all the objects/links in a file. Conforms to the
- * "visitor" pattern.
- *
- * Return: 0 on success, -1 on failure
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 1, 2007
+ * Purpose: Iterate over all the objects/links in a file. Conforms to the
+ * "visitor" pattern.
*
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
static int
traverse(hid_t file_id, const char *grp_name, hbool_t visit_start,
- hbool_t recurse, const trav_visitor_t *visitor)
+ hbool_t recurse, const trav_visitor_t *visitor)
{
H5O_info_t oinfo; /* Object info for starting group */
+ int ret_value = SUCCEED;
/* Get info for starting object */
if(H5Oget_info_by_name(file_id, grp_name, &oinfo, H5P_DEFAULT) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info_by_name failed");
/* Visit the starting object */
if(visit_start && visitor->visit_obj)
@@ -306,12 +287,12 @@ traverse(hid_t file_id, const char *grp_name, hbool_t visit_start,
if(recurse) {
/* Visit all links in group, recursively */
if(H5Lvisit_by_name(file_id, grp_name, trav_index_by, trav_index_order, traverse_cb, &udata, H5P_DEFAULT) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lvisit_by_name failed");
} /* end if */
else {
/* Iterate over links in group */
if(H5Literate_by_name(file_id, grp_name, trav_index_by, trav_index_order, NULL, traverse_cb, &udata, H5P_DEFAULT) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Literate_by_name failed");
} /* end else */
/* Free visited addresses table */
@@ -325,21 +306,17 @@ traverse(hid_t file_id, const char *grp_name, hbool_t visit_start,
} /* end if */
} /* end if */
- return 0;
+done:
+ return ret_value;
}
/*-------------------------------------------------------------------------
* Function: trav_info_add
*
- * Purpose: Add a link path & type to info struct
- *
- * Return: void
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 1, 2007
+ * Purpose: Add a link path & type to info struct
*
+ * Return: void
*-------------------------------------------------------------------------
*/
void
@@ -347,18 +324,20 @@ trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type)
{
size_t idx; /* Index of address to use */
- /* Allocate space if necessary */
- if(info->nused == info->nalloc) {
- info->nalloc = MAX(1, info->nalloc * 2);;
- info->paths = (trav_path_t *)HDrealloc(info->paths, info->nalloc * sizeof(trav_path_t));
- } /* end if */
+ if (info) {
+ /* Allocate space if necessary */
+ if(info->nused == info->nalloc) {
+ info->nalloc = MAX(1, info->nalloc * 2);;
+ info->paths = (trav_path_t *)HDrealloc(info->paths, info->nalloc * sizeof(trav_path_t));
+ } /* end if */
- /* Append it */
- idx = info->nused++;
- info->paths[idx].path = HDstrdup(path);
- info->paths[idx].type = obj_type;
- info->paths[idx].fileno = 0;
- info->paths[idx].objno = HADDR_UNDEF;
+ /* Append it */
+ idx = info->nused++;
+ info->paths[idx].path = HDstrdup(path);
+ info->paths[idx].type = obj_type;
+ info->paths[idx].fileno = 0;
+ info->paths[idx].objno = HADDR_UNDEF;
+ }
} /* end trav_info_add() */
@@ -368,7 +347,6 @@ trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type)
* Purpose: Add a file addr & fileno to info struct
*
* Return: void
- *
*-------------------------------------------------------------------------
*/
void
@@ -390,22 +368,19 @@ trav_fileinfo_add(trav_info_t *info, hid_t loc_id)
/*-------------------------------------------------------------------------
* Function: trav_info_visit_obj
*
- * Purpose: Callback for visiting object, with 'info' structure
- *
- * Return: 0 on success, -1 on failure
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 1, 2007
+ * Purpose: Callback for visiting object, with 'info' structure
*
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
int
trav_info_visit_obj(const char *path, const H5O_info_t *oinfo,
- const char H5_ATTR_UNUSED *already_visited, void *udata)
+ const char H5_ATTR_UNUSED *already_visited, void *udata)
{
size_t idx;
trav_info_t *info_p;
+
/* Add the object to the 'info' struct */
/* (object types map directly to "traversal" types) */
trav_info_add((trav_info_t *)udata, path, (h5trav_type_t)oinfo->type);
@@ -423,14 +398,10 @@ trav_info_visit_obj(const char *path, const H5O_info_t *oinfo,
/*-------------------------------------------------------------------------
* Function: trav_info_visit_lnk
*
- * Purpose: Callback for visiting link, with 'info' structure
- *
- * Return: 0 on success, -1 on failure
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 1, 2007
+ * Purpose: Callback for visiting link, with 'info' structure
*
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
int
@@ -446,21 +417,18 @@ trav_info_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
/*-------------------------------------------------------------------------
* Function: h5trav_getinfo
*
- * Purpose: get an array of "trav_info_t" , containing the name and type of
- * objects in the file
- *
- * Return: number of object names in file
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: November 6, 2002
+ * Purpose: get an array of "trav_info_t" , containing the name and type of
+ * objects in the file
*
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
int
h5trav_getinfo(hid_t file_id, trav_info_t *info)
{
trav_visitor_t info_visitor; /* Visitor structure for trav_info_t's */
+ int ret_value = SUCCEED;
/* Init visitor structure */
info_visitor.visit_obj = trav_info_visit_obj;
@@ -469,25 +437,21 @@ h5trav_getinfo(hid_t file_id, trav_info_t *info)
/* Traverse all objects in the file, visiting each object & link */
if(traverse(file_id, "/", TRUE, TRUE, &info_visitor) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed");
- return 0;
+done:
+ return ret_value;
}
/*-------------------------------------------------------------------------
* Function: h5trav_getindex
*
- * Purpose: get index of OBJ in list
- *
- * Return: index, -1 if not found
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: May 9, 2003
+ * Purpose: get index of OBJ in list
*
+ * Return: index on success,
+ * -1 if not found
*-------------------------------------------------------------------------
*/
-
H5_ATTR_PURE ssize_t
h5trav_getindex(const trav_info_t *info, const char *obj)
{
@@ -511,17 +475,11 @@ h5trav_getindex(const trav_info_t *info, const char *obj)
/*-------------------------------------------------------------------------
* Function: trav_info_init
*
- * Purpose: Initialize the info
- *
- * Return: void
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 6, 2007
+ * Purpose: Initialize the info
*
+ * Return: void
*-------------------------------------------------------------------------
*/
-
void
trav_info_init(const char *filename, hid_t fileid, trav_info_t **_info)
{
@@ -545,11 +503,9 @@ trav_info_init(const char *filename, hid_t fileid, trav_info_t **_info)
/*-------------------------------------------------------------------------
* Function: trav_info_free
*
- * Purpose: free info memory
- *
+ * Purpose: free info memory
*-------------------------------------------------------------------------
*/
-
void
trav_info_free(trav_info_t *info)
{
@@ -557,11 +513,9 @@ trav_info_free(trav_info_t *info)
if(info) {
/* Free visited symbolic links path and file (if alloc) */
- for(u=0; u < info->symlink_visited.nused; u++)
- {
+ for(u = 0; u < info->symlink_visited.nused; u++) {
if (info->symlink_visited.objs[u].file)
HDfree(info->symlink_visited.objs[u].file);
-
HDfree(info->symlink_visited.objs[u].path);
}
HDfree(info->symlink_visited.objs);
@@ -586,12 +540,8 @@ trav_info_free(trav_info_t *info)
*
* Purpose: Callback for visiting object, with 'table' sructure
*
- * Return: 0 on success, -1 on failure
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 1, 2007
- *
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
static int
@@ -608,21 +558,17 @@ trav_table_visit_obj(const char *path, const H5O_info_t *oinfo,
/* Add alias for object to table */
trav_table_addlink(table, oinfo->addr, path);
- return(0);
+ return 0;
} /* end trav_table_visit_obj() */
/*-------------------------------------------------------------------------
* Function: trav_table_visit_lnk
*
- * Purpose: Callback for visiting link, with 'table' sructure
- *
- * Return: 0 on success, -1 on failure
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 1, 2007
+ * Purpose: Callback for visiting link, with 'table' sructure
*
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
static int
@@ -631,28 +577,24 @@ trav_table_visit_lnk(const char *path, const H5L_info_t H5_ATTR_UNUSED *linfo, v
/* Add the link to the 'table' struct */
trav_table_add((trav_table_t *)udata, path, NULL);
- return(0);
+ return 0;
} /* end trav_table_visit_lnk() */
/*-------------------------------------------------------------------------
* Function: h5trav_gettable
*
- * Purpose: get the trav_table_t struct
- *
- * Return: 0, -1 on error
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: December 17, 2003
+ * Purpose: get the trav_table_t struct
*
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
-
int
h5trav_gettable(hid_t fid, trav_table_t *table)
{
trav_visitor_t table_visitor; /* Visitor structure for trav_table_t's */
+ int ret_value = SUCCEED;
/* Init visitor structure */
table_visitor.visit_obj = trav_table_visit_obj;
@@ -661,71 +603,63 @@ h5trav_gettable(hid_t fid, trav_table_t *table)
/* Traverse all objects in the file, visiting each object & link */
if(traverse(fid, "/", TRUE, TRUE, &table_visitor) < 0)
- return -1;
- return 0;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed");
+
+done:
+ return ret_value;
}
/*-------------------------------------------------------------------------
* Function: h5trav_getindext
*
- * Purpose: get index of NAME in list
- *
- * Return: index, -1 if not found
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: December 18, 2003
+ * Purpose: get index of NAME in list
*
+ * Return: index on success,
+ * -1 if not found
*-------------------------------------------------------------------------
*/
-
H5_ATTR_PURE int
h5trav_getindext(const char *name, const trav_table_t *table)
{
unsigned int i;
- for(i = 0; i < table->nobjs; i++) {
- /* Check for object name having full path (with leading '/') */
- if(HDstrcmp(name, table->objs[i].name) == 0)
- return((int)i);
-
- /* Check for object name without leading '/' */
- if(HDstrcmp(name, table->objs[i].name + 1) == 0)
- return((int)i);
+ if(table) {
+ for(i = 0; i < table->nobjs; i++) {
+ /* Check for object name having full path (with leading '/') */
+ if(HDstrcmp(name, table->objs[i].name) == 0)
+ return((int)i);
- /* search also in the list of links */
- if(table->objs[i].nlinks) {
- unsigned int j;
+ /* Check for object name without leading '/' */
+ if(HDstrcmp(name, table->objs[i].name + 1) == 0)
+ return((int)i);
- for ( j=0; j<table->objs[i].nlinks; j++) {
- /* Check for object name having full path (with leading '/') */
- if(HDstrcmp(name, table->objs[i].links[j].new_name) == 0)
- return((int)i);
+ /* search also in the list of links */
+ if(table->objs[i].nlinks) {
+ unsigned int j;
- /* Check for object name without leading '/' */
- if(HDstrcmp(name, table->objs[i].links[j].new_name + 1) == 0)
- return((int)i);
- } /* end for */
- } /* end if */
- } /* end for */
+ for ( j=0; j<table->objs[i].nlinks; j++) {
+ /* Check for object name having full path (with leading '/') */
+ if(HDstrcmp(name, table->objs[i].links[j].new_name) == 0)
+ return((int)i);
+ /* Check for object name without leading '/' */
+ if(HDstrcmp(name, table->objs[i].links[j].new_name + 1) == 0)
+ return((int)i);
+ } /* end for */
+ } /* end if */
+ } /* end for */
+ }
return -1;
}
/*-------------------------------------------------------------------------
* Function: trav_table_add
*
- * Purpose: Add OBJNO, NAME and TYPE of object to table
- *
- * Return: void
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: November 4, 2002
+ * Purpose: Add OBJNO, NAME and TYPE of object to table
*
+ * Return: void
*-------------------------------------------------------------------------
*/
-
static void
trav_table_add(trav_table_t *table,
const char *path,
@@ -733,20 +667,22 @@ trav_table_add(trav_table_t *table,
{
size_t new_obj;
- if(table->nobjs == table->size) {
- table->size = MAX(1, table->size * 2);
- table->objs = (trav_obj_t *)HDrealloc(table->objs, table->size * sizeof(trav_obj_t));
- } /* end if */
+ if(table) {
+ if(table->nobjs == table->size) {
+ table->size = MAX(1, table->size * 2);
+ table->objs = (trav_obj_t *)HDrealloc(table->objs, table->size * sizeof(trav_obj_t));
+ } /* end if */
- new_obj = table->nobjs++;
- table->objs[new_obj].objno = oinfo ? oinfo->addr : HADDR_UNDEF;
- table->objs[new_obj].flags[0] = table->objs[new_obj].flags[1] = 0;
- table->objs[new_obj].is_same_trgobj = 0;
- table->objs[new_obj].name = (char *)HDstrdup(path);
- table->objs[new_obj].type = oinfo ? (h5trav_type_t)oinfo->type : H5TRAV_TYPE_LINK;
- table->objs[new_obj].nlinks = 0;
- table->objs[new_obj].sizelinks = 0;
- table->objs[new_obj].links = NULL;
+ new_obj = table->nobjs++;
+ table->objs[new_obj].objno = oinfo ? oinfo->addr : HADDR_UNDEF;
+ table->objs[new_obj].flags[0] = table->objs[new_obj].flags[1] = 0;
+ table->objs[new_obj].is_same_trgobj = 0;
+ table->objs[new_obj].name = (char *)HDstrdup(path);
+ table->objs[new_obj].type = oinfo ? (h5trav_type_t)oinfo->type : H5TRAV_TYPE_LINK;
+ table->objs[new_obj].nlinks = 0;
+ table->objs[new_obj].sizelinks = 0;
+ table->objs[new_obj].links = NULL;
+ }
}
/*-------------------------------------------------------------------------
@@ -755,58 +691,47 @@ trav_table_add(trav_table_t *table,
* Purpose: Add a hardlink name to the object
*
* Return: void
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: December 17, 2003
- *
*-------------------------------------------------------------------------
*/
-
static void
trav_table_addlink(trav_table_t *table, haddr_t objno, const char *path)
{
size_t i; /* Local index variable */
- for(i = 0; i < table->nobjs; i++) {
- if(table->objs[i].objno == objno) {
- size_t n;
+ if(table) {
+ for(i = 0; i < table->nobjs; i++) {
+ if(table->objs[i].objno == objno) {
+ size_t n;
- /* already inserted? */
- if(HDstrcmp(table->objs[i].name, path) == 0)
- return;
+ /* already inserted? */
+ if(HDstrcmp(table->objs[i].name, path) == 0)
+ return;
- /* allocate space if necessary */
- if(table->objs[i].nlinks == (unsigned)table->objs[i].sizelinks) {
- table->objs[i].sizelinks = MAX(1, table->objs[i].sizelinks * 2);
- table->objs[i].links = (trav_link_t *)HDrealloc(table->objs[i].links, table->objs[i].sizelinks * sizeof(trav_link_t));
- } /* end if */
+ /* allocate space if necessary */
+ if(table->objs[i].nlinks == (unsigned)table->objs[i].sizelinks) {
+ table->objs[i].sizelinks = MAX(1, table->objs[i].sizelinks * 2);
+ table->objs[i].links = (trav_link_t *)HDrealloc(table->objs[i].links, table->objs[i].sizelinks * sizeof(trav_link_t));
+ } /* end if */
- /* insert it */
- n = table->objs[i].nlinks++;
- table->objs[i].links[n].new_name = (char *)HDstrdup(path);
+ /* insert it */
+ n = table->objs[i].nlinks++;
+ table->objs[i].links[n].new_name = (char *)HDstrdup(path);
- return;
+ return;
+ } /* end for */
} /* end for */
- } /* end for */
+ }
}
-
/*-------------------------------------------------------------------------
* Function: trav_table_addflags
*
- * Purpose: Add FLAGS, NAME and TYPE of object to table
- *
- * Return: void
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: November 4, 2002
+ * Purpose: Add FLAGS, NAME and TYPE of object to table
*
+ * Return: void
*-------------------------------------------------------------------------
*/
-
void trav_table_addflags(unsigned *flags,
char *name,
h5trav_type_t type,
@@ -814,92 +739,83 @@ void trav_table_addflags(unsigned *flags,
{
size_t new_obj;
- if(table->nobjs == table->size) {
- table->size = MAX(1, table->size * 2);
- table->objs = (trav_obj_t *)HDrealloc(table->objs, table->size * sizeof(trav_obj_t));
- } /* end if */
+ if(table) {
+ if(table->nobjs == table->size) {
+ table->size = MAX(1, table->size * 2);
+ table->objs = (trav_obj_t *)HDrealloc(table->objs, table->size * sizeof(trav_obj_t));
+ } /* end if */
- new_obj = table->nobjs++;
- table->objs[new_obj].objno = 0;
- table->objs[new_obj].flags[0] = flags[0];
- table->objs[new_obj].flags[1] = flags[1];
- table->objs[new_obj].is_same_trgobj = 0;
- table->objs[new_obj].name = (char *)HDstrdup(name);
- table->objs[new_obj].type = type;
- table->objs[new_obj].nlinks = 0;
- table->objs[new_obj].sizelinks = 0;
- table->objs[new_obj].links = NULL;
+ new_obj = table->nobjs++;
+ table->objs[new_obj].objno = 0;
+ table->objs[new_obj].flags[0] = flags[0];
+ table->objs[new_obj].flags[1] = flags[1];
+ table->objs[new_obj].is_same_trgobj = 0;
+ table->objs[new_obj].name = (char *)HDstrdup(name);
+ table->objs[new_obj].type = type;
+ table->objs[new_obj].nlinks = 0;
+ table->objs[new_obj].sizelinks = 0;
+ table->objs[new_obj].links = NULL;
+ }
}
/*-------------------------------------------------------------------------
* Function: trav_table_init
*
- * Purpose: Initialize the table
- *
- * Return: void
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: November 4, 2002
+ * Purpose: Initialize the table
*
+ * Return: void
*-------------------------------------------------------------------------
*/
-
void trav_table_init(trav_table_t **tbl)
{
trav_table_t* table = (trav_table_t*) HDmalloc(sizeof(trav_table_t));
-
- table->size = 0;
- table->nobjs = 0;
- table->objs = NULL;
-
+ if(table) {
+ table->size = 0;
+ table->nobjs = 0;
+ table->objs = NULL;
+ }
*tbl = table;
}
-
/*-------------------------------------------------------------------------
* Function: trav_table_free
*
- * Purpose: free table memory
- *
- * Return: void
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: November 4, 2002
+ * Purpose: free table memory
*
+ * Return: void
*-------------------------------------------------------------------------
*/
-
-void trav_table_free( trav_table_t *table )
+void trav_table_free(trav_table_t *table)
{
- if(table->objs) {
- unsigned int i;
+ if(table) {
+ if(table->objs) {
+ unsigned int i;
- for(i = 0; i < table->nobjs; i++) {
- HDfree(table->objs[i].name );
- if(table->objs[i].nlinks) {
- unsigned int j;
+ for(i = 0; i < table->nobjs; i++) {
+ HDfree(table->objs[i].name );
+ if(table->objs[i].nlinks) {
+ unsigned int j;
- for(j = 0; j < table->objs[i].nlinks; j++)
- HDfree(table->objs[i].links[j].new_name);
+ for(j = 0; j < table->objs[i].nlinks; j++)
+ HDfree(table->objs[i].links[j].new_name);
- HDfree(table->objs[i].links);
- } /* end if */
- } /* end for */
- HDfree(table->objs);
- } /* end if */
- HDfree(table);
+ HDfree(table->objs[i].links);
+ } /* end if */
+ } /* end for */
+ HDfree(table->objs);
+ } /* end if */
+ HDfree(table);
+ }
}
static herr_t
trav_attr(hid_t
#ifndef H5TRAV_PRINT_SPACE
-H5_ATTR_UNUSED
+ H5_ATTR_UNUSED
#endif /* H5TRAV_PRINT_SPACE */
-obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *_op_data)
+ obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *_op_data)
{
trav_path_op_data_t *op_data = (trav_path_op_data_t *)_op_data;
const char *buf = op_data->path;
@@ -938,7 +854,7 @@ obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *_op_da
case H5S_SIMPLE:
/* simple dataspace */
printf(" {");
- for (i=0; i<ndims; i++) {
+ for (i = 0; i < ndims; i++) {
printf("%s" HSIZE_T_FORMAT, i?", ":"", size[i]);
}
printf("}\n");
@@ -968,19 +884,15 @@ obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *_op_da
/*-------------------------------------------------------------------------
* Function: trav_print_visit_obj
*
- * Purpose: Callback for visiting object, when printing info
- *
- * Return: 0 on success, -1 on failure
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 6, 2007
+ * Purpose: Callback for visiting object, when printing info
*
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
static int
trav_print_visit_obj(const char *path, const H5O_info_t *oinfo,
- const char *already_visited, void *udata)
+ const char *already_visited, void *udata)
{
trav_print_udata_t *print_udata = (trav_print_udata_t *)udata;
/* Print the name of the object */
@@ -1029,14 +941,10 @@ trav_print_visit_obj(const char *path, const H5O_info_t *oinfo,
/*-------------------------------------------------------------------------
* Function: trav_print_visit_lnk
*
- * Purpose: Callback for visiting link, when printing info
- *
- * Return: 0 on success, -1 on failure
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 6, 2007
+ * Purpose: Callback for visiting link, when printing info
*
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
static int
@@ -1062,7 +970,7 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
case H5L_TYPE_EXTERNAL:
if(linfo->u.val_size > 0) {
- char *targbuf;
+ char *targbuf = NULL;
const char *filename = NULL;
const char *objname = NULL;
@@ -1097,22 +1005,18 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
/*-------------------------------------------------------------------------
* Function: h5trav_print
*
- * Purpose: Print information about the objects & links in the file
- *
- * Return: 0, -1 on error
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 6, 2007
+ * Purpose: Print information about the objects & links in the file
*
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
-
int
h5trav_print(hid_t fid)
{
trav_print_udata_t print_udata; /* User data for traversal */
trav_visitor_t print_visitor; /* Visitor structure for printing objects */
+ int ret_value = SUCCEED;
/* Init user data for printing */
print_udata.fid = fid;
@@ -1124,9 +1028,10 @@ h5trav_print(hid_t fid)
/* Traverse all objects in the file, visiting each object & link */
if(traverse(fid, "/", TRUE, TRUE, &print_visitor) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed");
- return 0;
+done:
+ return ret_value;
}
@@ -1135,21 +1040,17 @@ h5trav_print(hid_t fid)
*
* Purpose: Generic traversal routine for visiting objects and links
*
- * Return: 0, -1 on error
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: November 6, 2007
- *
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
-
int
h5trav_visit(hid_t fid, const char *grp_name, hbool_t visit_start,
hbool_t recurse, h5trav_obj_func_t visit_obj, h5trav_lnk_func_t visit_lnk,
void *udata)
{
trav_visitor_t visitor; /* Visitor structure for objects */
+ int ret_value = SUCCEED;
/* Init visitor structure */
visitor.visit_obj = visit_obj;
@@ -1158,9 +1059,10 @@ h5trav_visit(hid_t fid, const char *grp_name, hbool_t visit_start,
/* Traverse all objects in the file, visiting each object & link */
if(traverse(fid, grp_name, visit_start, recurse, &visitor) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed");
- return 0;
+done:
+ return ret_value;
}
/*-------------------------------------------------------------------------
@@ -1168,19 +1070,15 @@ h5trav_visit(hid_t fid, const char *grp_name, hbool_t visit_start,
*
* Purpose: Add an symbolic link to visited data structure
*
- * Return: 0 on success, -1 on failure
- *
- * Programmer: Neil Fortner, nfortne2@hdfgroup.org
- * Adapted from trav_addr_add in h5trav.c by Quincey Koziol
- *
- * Date: September 5, 2008
- *
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
herr_t
symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path)
{
- size_t idx; /* Index of address to use */
+ herr_t ret_value = SUCCEED;
+ size_t idx; /* Index of address to use */
/* Allocate space if necessary */
if(visited->nused == visited->nalloc) {
@@ -1188,7 +1086,7 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co
visited->nalloc = MAX(1, visited->nalloc * 2);
if(NULL == (tmp_ptr = HDrealloc(visited->objs, visited->nalloc * sizeof(symlink_trav_path_t))))
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "visited data structure realloc failed");
visited->objs = (symlink_trav_path_t *)tmp_ptr;
} /* end if */
@@ -1202,7 +1100,7 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co
if(type == H5L_TYPE_EXTERNAL) {
if(NULL == (visited->objs[idx].file = HDstrdup(file))) {
visited->nused--;
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "visited data structure name allocation failed");
} /* end if */
} /* end if */
@@ -1210,25 +1108,20 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co
visited->nused--;
if(visited->objs[idx].file)
HDfree (visited->objs[idx].file);
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "visited data structure path allocation failed");
} /* end if */
- return 0;
+done:
+ return ret_value;
} /* end symlink_visit_add() */
/*-------------------------------------------------------------------------
* Function: symlink_is_visited
*
- * Purpose: Check if an symbolic link has already been visited
- *
- * Return: TRUE/FALSE
- *
- * Programmer: Neil Fortner, nfortne2@hdfgroup.org
- * Adapted from trav_addr_visited in h5trav.c by Quincey Koziol
- *
- * Date: September 5, 2008
+ * Purpose: Check if an symbolic link has already been visited
*
+ * Return: TRUE/FALSE
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE hbool_t
diff --git a/tools/lib/ph5diff.h b/tools/lib/ph5diff.h
index 996a611..2189e31 100644
--- a/tools/lib/ph5diff.h
+++ b/tools/lib/ph5diff.h
@@ -32,7 +32,7 @@ struct diff_mpi_args
{
char name1[256];
char name2[256];
- diff_opt_t options;
+ diff_opt_t opts;
diff_args_t argdata; /* rest args */
};
diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c
index e4696c0..ce5df78 100644
--- a/tools/src/h5diff/h5diff_common.c
+++ b/tools/src/h5diff/h5diff_common.c
@@ -52,7 +52,7 @@ static struct long_options l_opts[] = {
*
*-------------------------------------------------------------------------
*/
-static void check_options(diff_opt_t* options)
+static void check_options(diff_opt_t* opts)
{
/*--------------------------------------------------------------
* check for mutually exclusive options
@@ -61,7 +61,7 @@ static void check_options(diff_opt_t* options)
/* check between -d , -p, --use-system-epsilon.
* These options are mutually exclusive.
*/
- if ((options->d + options->p + options->use_system_epsilon) > 1) {
+ if ((opts->d + opts->p + opts->use_system_epsilon) > 1) {
printf("%s error: -d, -p and --use-system-epsilon options are mutually-exclusive;\n", PROGRAMNAME);
printf("use no more than one.\n");
printf("Try '-h' or '--help' option for more information or see the %s entry in the 'HDF5 Reference Manual'.\n", PROGRAMNAME);
@@ -84,27 +84,27 @@ void parse_command_line(int argc,
const char** fname2,
const char** objname1,
const char** objname2,
- diff_opt_t* options)
+ diff_opt_t* opts)
{
int i;
int opt;
struct exclude_path_list *exclude_head, *exclude_prev, *exclude_node;
/* process the command-line */
- memset(options, 0, sizeof (diff_opt_t));
+ memset(opts, 0, sizeof (diff_opt_t));
/* assume equal contents initially */
- options->contents = 1;
+ opts->contents = 1;
/* NaNs are handled by default */
- options->do_nans = 1;
+ opts->do_nans = 1;
/* not Listing objects that are not comparable */
- options->m_list_not_cmp = 0;
+ opts->m_list_not_cmp = 0;
/* initially no not-comparable. */
/**this is bad in mixing option with results**/
- options->not_cmp=0;
+ opts->not_cmp=0;
/* init for exclude-path option */
exclude_head = NULL;
@@ -115,17 +115,20 @@ void parse_command_line(int argc,
default:
usage();
h5diff_exit(EXIT_FAILURE);
+ break;
case 'h':
usage();
h5diff_exit(EXIT_SUCCESS);
+ break;
case 'V':
print_version(h5tools_getprogname());
h5diff_exit(EXIT_SUCCESS);
+ break;
case 'v':
- options->m_verbose = 1;
+ opts->m_verbose = 1;
/* This for loop is for handling style like
* -v, -v1, --verbose, --verbose=1.
*/
@@ -135,11 +138,11 @@ void parse_command_line(int argc,
*/
if (!strcmp (argv[i], "-v")) { /* no arg */
opt_ind--;
- options->m_verbose_level = 0;
+ opts->m_verbose_level = 0;
break;
}
else if (!strncmp (argv[i], "-v", (size_t)2)) {
- options->m_verbose_level = atoi(&argv[i][2]);
+ opts->m_verbose_level = atoi(&argv[i][2]);
break;
}
@@ -147,11 +150,11 @@ void parse_command_line(int argc,
* long opt
*/
if (!strcmp (argv[i], "--verbose")) { /* no arg */
- options->m_verbose_level = 0;
+ opts->m_verbose_level = 0;
break;
}
else if ( !strncmp (argv[i], "--verbose", (size_t)9) && argv[i][9]=='=') {
- options->m_verbose_level = atoi(&argv[i][10]);
+ opts->m_verbose_level = atoi(&argv[i][10]);
break;
}
}
@@ -159,19 +162,19 @@ void parse_command_line(int argc,
case 'q':
/* use quiet mode; supress the message "0 differences found" */
- options->m_quiet = 1;
+ opts->m_quiet = 1;
break;
case 'r':
- options->m_report = 1;
+ opts->m_report = 1;
break;
case 'l':
- options->follow_links = TRUE;
+ opts->follow_links = TRUE;
break;
case 'x':
- options->no_dangle_links = 1;
+ opts->no_dangle_links = 1;
break;
case 'S':
@@ -179,7 +182,7 @@ void parse_command_line(int argc,
break;
case 'E':
- options->exclude_path = 1;
+ opts->exclude_path = 1;
/* create linked list of excluding objects */
if( (exclude_node = (struct exclude_path_list*) HDmalloc(sizeof(struct exclude_path_list))) == NULL) {
@@ -206,64 +209,64 @@ void parse_command_line(int argc,
break;
case 'd':
- options->d=1;
+ opts->d=1;
if (check_d_input(opt_arg) == - 1) {
printf("<-d %s> is not a valid option\n", opt_arg);
usage();
h5diff_exit(EXIT_FAILURE);
}
- options->delta = atof(opt_arg);
+ opts->delta = atof(opt_arg);
/* -d 0 is the same as default */
- if (H5_DBL_ABS_EQUAL(options->delta, (double)0.0F))
- options->d=0;
+ if (H5_DBL_ABS_EQUAL(opts->delta, (double)0.0F))
+ opts->d=0;
break;
case 'p':
- options->p=1;
+ opts->p=1;
if (check_p_input(opt_arg) == -1) {
printf("<-p %s> is not a valid option\n", opt_arg);
usage();
h5diff_exit(EXIT_FAILURE);
}
- options->percent = atof(opt_arg);
+ opts->percent = atof(opt_arg);
/* -p 0 is the same as default */
- if (H5_DBL_ABS_EQUAL(options->percent, (double)0.0F))
- options->p = 0;
+ if (H5_DBL_ABS_EQUAL(opts->percent, (double)0.0F))
+ opts->p = 0;
break;
case 'n':
- options->n=1;
+ opts->n=1;
if ( check_n_input(opt_arg) == -1) {
printf("<-n %s> is not a valid option\n", opt_arg);
usage();
h5diff_exit(EXIT_FAILURE);
}
- options->count = HDstrtoull(opt_arg, NULL, 0);
+ opts->count = HDstrtoull(opt_arg, NULL, 0);
break;
case 'N':
- options->do_nans = 0;
+ opts->do_nans = 0;
break;
case 'c':
- options->m_list_not_cmp = 1;
+ opts->m_list_not_cmp = 1;
break;
case 'e':
- options->use_system_epsilon = 1;
+ opts->use_system_epsilon = 1;
break;
}
}
/* check options */
- check_options(options);
+ check_options(opts);
/* if exclude-path option is used, keep the exclude path list */
- if (options->exclude_path)
- options->exclude = exclude_head;
+ if (opts->exclude_path)
+ opts->exclude = exclude_head;
/* check for file names to be processed */
if (argc <= opt_ind || argv[ opt_ind + 1 ] == NULL) {
@@ -300,23 +303,23 @@ void parse_command_line(int argc,
*-------------------------------------------------------------------------
*/
- void print_info(diff_opt_t* options)
+ void print_info(diff_opt_t* opts)
{
- if (options->m_quiet || options->err_stat)
+ if (opts->m_quiet || opts->err_stat)
return;
- if (options->cmn_objs == 0) {
+ if (opts->cmn_objs == 0) {
printf("No common objects found. Files are not comparable.\n");
- if (!options->m_verbose)
+ if (!opts->m_verbose)
printf("Use -v for a list of objects.\n");
}
- if (options->not_cmp == 1) {
- if (options->m_list_not_cmp == 0) {
+ if (opts->not_cmp == 1) {
+ if (opts->m_list_not_cmp == 0) {
printf("--------------------------------\n");
printf("Some objects are not comparable\n");
printf("--------------------------------\n");
- if (options->m_verbose)
+ if (opts->m_verbose)
printf("Use -c for a list of objects without details of differences.\n");
else
printf("Use -c for a list of objects.\n");
diff --git a/tools/src/h5diff/h5diff_common.h b/tools/src/h5diff/h5diff_common.h
index e5dfe3f..dc0676c 100644
--- a/tools/src/h5diff/h5diff_common.h
+++ b/tools/src/h5diff/h5diff_common.h
@@ -23,9 +23,9 @@ extern "C" {
#endif
void usage(void);
-void parse_command_line(int argc, const char* argv[], const char** fname1, const char** fname2, const char** objname1, const char** objname2, diff_opt_t* options);
+void parse_command_line(int argc, const char* argv[], const char** fname1, const char** fname2, const char** objname1, const char** objname2, diff_opt_t* opts);
void h5diff_exit(int status);
-void print_info(diff_opt_t* options);
+void print_info(diff_opt_t* opts);
#ifdef __cplusplus
}
diff --git a/tools/src/h5diff/h5diff_main.c b/tools/src/h5diff/h5diff_main.c
index 8dab3b4..ad488a4 100644
--- a/tools/src/h5diff/h5diff_main.c
+++ b/tools/src/h5diff/h5diff_main.c
@@ -78,7 +78,7 @@ int main(int argc, const char *argv[])
const char *objname1 = NULL;
const char *objname2 = NULL;
hsize_t nfound=0;
- diff_opt_t options;
+ diff_opt_t opts;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -98,7 +98,7 @@ int main(int argc, const char *argv[])
* process the command-line
*-------------------------------------------------------------------------
*/
- parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &options);
+ parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &opts);
if (enable_error_stack) {
H5Eset_auto2(H5E_DEFAULT, func, edata);
@@ -110,9 +110,9 @@ int main(int argc, const char *argv[])
*-------------------------------------------------------------------------
*/
- nfound = h5diff(fname1, fname2, objname1, objname2, &options);
+ nfound = h5diff(fname1, fname2, objname1, objname2, &opts);
- print_info(&options);
+ print_info(&opts);
/*-------------------------------------------------------------------------
* exit code
@@ -123,11 +123,11 @@ int main(int argc, const char *argv[])
ret = (nfound == 0 ? 0 : 1);
/* if graph difference return 1 for differences */
- if (options.contents == 0)
+ if (opts.contents == 0)
ret = 1;
/* and return 2 for error */
- if (options.err_stat)
+ if (opts.err_stat)
ret = 2;
h5diff_exit(ret);
diff --git a/tools/src/h5diff/ph5diff_main.c b/tools/src/h5diff/ph5diff_main.c
index 89efc39..83240cb 100644
--- a/tools/src/h5diff/ph5diff_main.c
+++ b/tools/src/h5diff/ph5diff_main.c
@@ -50,7 +50,7 @@ int main(int argc, const char *argv[])
const char *fname2 = NULL;
const char *objname1 = NULL;
const char *objname2 = NULL;
- diff_opt_t options;
+ diff_opt_t opts;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -72,11 +72,11 @@ int main(int argc, const char *argv[])
g_Parallel = 0;
- parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &options);
+ parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &opts);
- h5diff(fname1, fname2, objname1, objname2, &options);
+ h5diff(fname1, fname2, objname1, objname2, &opts);
- print_info(&options);
+ print_info(&opts);
}
/* Parallel h5diff */
else {
@@ -84,13 +84,13 @@ int main(int argc, const char *argv[])
/* Have the manager process the command-line */
if(nID == 0)
{
- parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &options);
+ parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &opts);
- h5diff(fname1, fname2, objname1, objname2, &options);
+ h5diff(fname1, fname2, objname1, objname2, &opts);
MPI_Barrier(MPI_COMM_WORLD);
- print_info(&options);
+ print_info(&opts);
print_manager_output();
}
/* All other tasks become workers and wait for assignments. */
@@ -178,8 +178,8 @@ ph5diff_worker(int nID)
MPI_Recv(&args, sizeof(args), MPI_BYTE, 0, MPI_TAG_ARGS, MPI_COMM_WORLD, &Status);
/* Do the diff */
- diffs.nfound = diff(file1_id, args.name1, file2_id, args.name2, &(args.options), &(args.argdata));
- diffs.not_cmp = args.options.not_cmp;
+ diffs.nfound = diff(file1_id, args.name1, file2_id, args.name2, &(args.opts), &(args.argdata));
+ diffs.not_cmp = args.opts.not_cmp;
/* If print buffer has something in it, request print token.*/
if(outBuffOffset>0)
diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c
index 8c15686..cc5fcdc 100644
--- a/tools/src/h5jam/h5jam.c
+++ b/tools/src/h5jam/h5jam.c
@@ -179,9 +179,11 @@ parse_command_line (int argc, const char *argv[])
case 'h':
usage (h5tools_getprogname());
leave (EXIT_SUCCESS);
+ break;
case 'V':
print_version (h5tools_getprogname());
leave (EXIT_SUCCESS);
+ break;
case '?':
default:
usage (h5tools_getprogname());
@@ -198,10 +200,6 @@ parse_command_line (int argc, const char *argv[])
* Return: Success: 0
* Failure: 1
*
- * Programmer:
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index d397067..a07d308 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -2709,6 +2709,7 @@ main(int argc, const char *argv[])
case 'h': /* --help */
usage();
leave(EXIT_SUCCESS);
+ break;
case 'a': /* --address */
address_g = TRUE;
@@ -2759,6 +2760,7 @@ main(int argc, const char *argv[])
case 'V': /* --version */
print_version(h5tools_getprogname());
leave(EXIT_SUCCESS);
+ break;
case 'x': /* --hexdump */
hexdump_g = TRUE;
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index 6b8cf8a..e7f4aae 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -75,6 +75,8 @@ h5repack_init(pack_opt_t *options, int verbose, hbool_t latest)
options->verbose = verbose;
options->latest = latest;
options->layout_g = H5D_LAYOUT_ERROR;
+ options->low_bound = H5F_LIBVER_EARLIEST;
+ options->high_bound = H5F_LIBVER_LATEST;
for (n = 0; n < H5_REPACK_MAX_NFILTERS; n++) {
options->filter_g[n].filtn = -1;
@@ -221,13 +223,12 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout,
hid_t ret_value = -1; /* The identifier of the named dtype in the out file */
if (H5Oget_info(type_in, &oinfo) < 0)
- goto done;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed");
if (*named_dt_head_p) {
/* Stack already exists, search for the datatype */
while (dt && dt->addr_in != oinfo.addr)
dt = dt->next;
-
dt_ret = dt;
}
else {
@@ -238,7 +239,7 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout,
if (travt->objs[i].type == H5TRAV_TYPE_NAMED_DATATYPE) {
/* Push onto the stack */
if (NULL == (dt = (named_dt_t *)HDmalloc(sizeof(named_dt_t))))
- goto done;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "buffer allocation failed failed");
dt->next = *named_dt_head_p;
*named_dt_head_p = dt;
@@ -259,7 +260,7 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout,
if (!dt_ret) {
/* Push the new datatype onto the stack */
if (NULL == (dt_ret = (named_dt_t *)HDmalloc(sizeof(named_dt_t))))
- goto done;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "buffer allocation failed failed");
dt_ret->next = *named_dt_head_p;
*named_dt_head_p = dt_ret;
@@ -276,9 +277,9 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout,
else
dt_ret->id_out = H5Tcopy(type_in);
if (dt_ret->id_out < 0)
- goto done;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type-H5Tcopy failed");
if (H5Tcommit_anon(fidout, dt_ret->id_out, H5P_DEFAULT, H5P_DEFAULT) < 0)
- goto done;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcommit_anon failed");
} /* end if */
/* Set return value */
@@ -286,7 +287,7 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout,
/* Increment the ref count on id_out, because the calling function will try to close it */
if(H5Iinc_ref(ret_value) < 0)
- ret_value = -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Iinc_ref failed");
done:
return ret_value;
@@ -305,7 +306,7 @@ int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) {
while (dt) {
/* Pop the datatype off the stack and free it */
if (H5Tclose(dt->id_out) < 0 && !ignore_err)
- goto done;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
dt = dt->next;
HDfree(*named_dt_head_p);
*named_dt_head_p = dt;
@@ -332,7 +333,7 @@ int
copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p,
trav_table_t *travt, pack_opt_t *options)
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ int ret_value = 0;
hid_t attr_id = -1; /* attr ID */
hid_t attr_out = -1; /* attr ID */
hid_t space_id = -1; /* space ID */
@@ -375,7 +376,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p,
if ((is_named = H5Tcommitted(ftype_id)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcommitted failed");
if (is_named && travt) {
- hid_t fidout;
+ hid_t fidout = -1;
/* Create out file id */
if ((fidout = H5Iget_file_id(loc_out)) < 0)
@@ -426,7 +427,8 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p,
base_type = H5Tget_super(ftype_id);
is_ref = (is_ref || (H5Tget_class(base_type) == H5T_REFERENCE));
- H5Tclose(base_type);
+ if (H5Tclose(base_type) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose base_type failed");
}
if (type_class == H5T_COMPOUND) {
@@ -435,7 +437,8 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p,
for (j = 0; j < nmembers; j++) {
hid_t mtid = H5Tget_member_type(wtype_id, (unsigned)j);
H5T_class_t mtclass = H5Tget_class(mtid);
- H5Tclose(mtid);
+ if (H5Tclose(mtid) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose mtid failed");
if (mtclass == H5T_REFERENCE) {
is_ref = 1;
@@ -481,7 +484,24 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p,
if (options->verbose)
printf(FORMAT_OBJ_ATTR, "attr", name);
- } /* u */
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if (H5Sclose(space_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ space_id = -1;
+ if (H5Tclose(wtype_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ wtype_id = -1;
+ if (H5Tclose(ftype_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ ftype_id = -1;
+ if (H5Aclose(attr_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed");
+ attr_id = -1;
+ } /* for u */
done:
H5E_BEGIN_TRY {
@@ -495,11 +515,11 @@ done:
HDfree(buf);
} /* end if */
- H5Tclose(ftype_id);
- H5Tclose(wtype_id);
+ H5Aclose(attr_out);
H5Sclose(space_id);
+ H5Tclose(wtype_id);
+ H5Tclose(ftype_id);
H5Aclose(attr_id);
- H5Aclose(attr_out);
} H5E_END_TRY;
return ret_value;
@@ -689,9 +709,9 @@ done:
*/
static int check_objects(const char* fname, pack_opt_t *options) {
int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
- hid_t fid;
- hid_t did;
- hid_t sid;
+ hid_t fid = -1;
+ hid_t did = -1;
+ hid_t sid = -1;
unsigned int i;
unsigned int uf;
trav_table_t *travt = NULL;
@@ -792,9 +812,9 @@ static int check_objects(const char* fname, pack_opt_t *options) {
done:
H5E_BEGIN_TRY {
- H5Fclose(fid);
H5Sclose(sid);
H5Dclose(did);
+ H5Fclose(fid);
} H5E_END_TRY;
if (travt)
trav_table_free(travt);
diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h
index 0252768..a0e0387 100644
--- a/tools/src/h5repack/h5repack.h
+++ b/tools/src/h5repack/h5repack.h
@@ -101,21 +101,23 @@ typedef struct {
/* all the above, ready to go to the hrepack call */
typedef struct {
- pack_opttbl_t *op_tbl; /*table with all -c and -f options */
- int all_layout; /*apply the layout to all objects */
- int all_filter; /*apply the filter to all objects */
+ pack_opttbl_t *op_tbl; /*table with all -c and -f options */
+ int all_layout; /*apply the layout to all objects */
+ int all_filter; /*apply the filter to all objects */
filter_info_t filter_g[H5_REPACK_MAX_NFILTERS]; /*global filter array for the ALL case */
- int n_filter_g; /*number of global filters */
- chunk_info_t chunk_g; /*global chunk INFO for the ALL case */
- H5D_layout_t layout_g; /*global layout information for the ALL case */
- int verbose; /*verbose mode */
- hsize_t min_comp; /*minimum size to compress, in bytes */
- int use_native; /*use a native type in write */
- hbool_t latest; /*pack file with the latest file format */
- int grp_compact; /* Set the maximum number of links to store as header messages in the group */
- int grp_indexed; /* Set the minimum number of links to store in the indexed format */
- int msg_size[8]; /* Minimum size of shared messages: dataspace,
- datatype, fill value, filter pipleline, attribute */
+ int n_filter_g; /*number of global filters */
+ chunk_info_t chunk_g; /*global chunk INFO for the ALL case */
+ H5D_layout_t layout_g; /*global layout information for the ALL case */
+ int verbose; /*verbose mode */
+ hsize_t min_comp; /*minimum size to compress, in bytes */
+ int use_native; /*use a native type in write */
+ hbool_t latest; /*pack file with the latest file format */
+ H5F_libver_t low_bound; /* The file's low bound as in H5Fset_libver_bounds() */
+ H5F_libver_t high_bound; /* The file's high bound as in H5Fset_libver_bounds() */
+ int grp_compact; /* Set the maximum number of links to store as header messages in the group */
+ int grp_indexed; /* Set the minimum number of links to store in the indexed format */
+ int msg_size[8]; /* Minimum size of shared messages: dataspace,
+ datatype, fill value, filter pipleline, attribute */
const char *ublock_filename; /* user block file name */
hsize_t ublock_size; /* user block size */
hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index 9fcf218..b279cf9 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -78,23 +78,21 @@ static herr_t walk_error_callback(H5_ATTR_UNUSED unsigned n, const H5E_error2_t
*
* Return: 0, ok,
* -1 no
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: October, 23, 2003
- *
*-------------------------------------------------------------------------
*/
int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
{
- int ret_value = 0; /* no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
- hid_t fidin;
+ int ret_value = 0;
+ hid_t fidin = -1;
hid_t fidout = -1;
- trav_table_t *travt = NULL;
- hsize_t ub_size = 0; /* size of user block */
+ hid_t fcpl_in = -1; /* file creation property list ID for input file */
+ hid_t grp_in = -1; /* group ID */
+ hid_t gcpl_in = -1; /* group creation property list */
hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */
hid_t fapl = H5P_DEFAULT; /* file access property list ID */
+ trav_table_t *travt = NULL;
+ hsize_t ub_size = 0; /* size of user block */
H5F_fspace_strategy_t set_strategy; /* Strategy to be set in outupt file */
hbool_t set_persist; /* Persist free-space status to be set in output file */
hsize_t set_threshold; /* Free-space section threshold to be set in output file */
@@ -114,10 +112,6 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
/* get user block size and file space strategy/persist/threshold */
{
- hid_t fcpl_in; /* file creation property list ID for input file */
- hid_t grp_in = -1; /* group ID */
- hid_t gcpl_in = -1; /* group creation property list */
-
if ((fcpl_in = H5Fget_create_plist(fidin)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list");
@@ -148,8 +142,18 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed to close property list");
}
+ if(options->latest)
+ options->low_bound = options->high_bound = H5F_LIBVER_LATEST;
+ /* Create file access property list */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list");
+
+ /* It can be default, latest or other settings by users */
+ if(H5Pset_libver_bounds(fapl, options->low_bound, options->high_bound) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_libver_bounds failed to set format version bounds");
+
/* Check if we need to create a non-default file creation property list */
- if (options->latest || ub_size > 0) {
+ if (options->low_bound >= H5F_LIBVER_V18 || ub_size > 0) {
/* Create file creation property list */
if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list");
@@ -158,7 +162,7 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
if (H5Pset_userblock(fcpl, ub_size) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_userblock failed to set non-default userblock size");
- if (options->latest) {
+ if (options->low_bound >= H5F_LIBVER_V18) {
unsigned i = 0, nindex = 0, mesg_type_flags[5], min_mesg_sizes[5];
/* Adjust group creation parameters for root group */
@@ -209,12 +213,6 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shared_mesg_index failed to configure the specified shared object header message index");
} /* if (nindex>0) */
- /* Create file access property list */
- if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list");
-
- if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_libver_bounds failed to set property for using latest version of the format");
} /* end if */
} /* end if */
#if defined (H5REPACK_DEBUG_USER_BLOCK)
@@ -343,42 +341,26 @@ print_user_block(fnamein, fidin);
/* init table */
trav_table_init(&travt);
- /* get the list of objects in the file */
- if (h5trav_gettable(fidin, travt) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed");
-
- /*-------------------------------------------------------------------------
- * do the copy
- *-------------------------------------------------------------------------
- */
- if (do_copy_objects(fidin, fidout, travt, options) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "do_copy_objects from <%s> could not copy data to <%s>", fnamein, fnameout);
-
- /*-------------------------------------------------------------------------
- * do the copy of referenced objects
- * and create hard links
- *-------------------------------------------------------------------------
- */
- if (do_copy_refobjs(fidin, fidout, travt, options) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "do_copy_refobjs from <%s> could not copy data to <%s>", fnamein, fnameout);
-
- /*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
-
- if (fapl > 0)
- H5Pclose(fapl);
-
- if (fcpl > 0)
- H5Pclose(fcpl);
-
- H5Fclose(fidin);
- H5Fclose(fidout);
-
- /* free table */
- trav_table_free(travt);
- travt = NULL;
+ if (travt) {
+ /* get the list of objects in the file */
+ if (h5trav_gettable(fidin, travt) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed");
+
+ /*-------------------------------------------------------------------------
+ * do the copy
+ *-------------------------------------------------------------------------
+ */
+ if (do_copy_objects(fidin, fidout, travt, options) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "do_copy_objects from <%s> could not copy data to <%s>", fnamein, fnameout);
+
+ /*-------------------------------------------------------------------------
+ * do the copy of referenced objects
+ * and create hard links
+ *-------------------------------------------------------------------------
+ */
+ if (do_copy_refobjs(fidin, fidout, travt, options) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "do_copy_refobjs from <%s> could not copy data to <%s>", fnamein, fnameout);
+ }
/*-------------------------------------------------------------------------
* write only the input file user block if there is no user block file input
@@ -389,17 +371,15 @@ print_user_block(fnamein, fidin);
if (copy_user_block(fnamein, fnameout, ub_size) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not copy user block. Exiting...");
- return 0;
-
- /*-------------------------------------------------------------------------
- * out
- *-------------------------------------------------------------------------
- */
-
done:
H5E_BEGIN_TRY {
+ H5Pclose(fcpl_in);
+ H5Pclose(gcpl_in);
H5Pclose(fapl);
H5Pclose(fcpl);
+ H5Gclose(grp_in);
+ H5Fclose(fidin);
+ H5Fclose(fidout);
H5Fclose(fidin);
H5Fclose(fidout);
} H5E_END_TRY;
@@ -416,7 +396,7 @@ done:
* The size of hyperslab is limitted by H5TOOLS_BUFSIZE.
* Return the hyperslab dimentions and size in byte.
*
- * Return: 0 - SUCCEED, -1 FAILED
+ * Return: 0 - SUCCEED, -1 FAILED
*
* Parameters:
* dcpl_id : [IN] dataset creation property.
@@ -426,8 +406,6 @@ done:
* dims_hslab[] : [OUT] calculated hyperslab dimentions
* * hslab_nbytes_p : [OUT] total byte of the hyperslab
*
- * Programmer: Jonathan Kim
- * Date: Feburary, 2012
* Update:
* The hyperslab calucation would be depend on if the dataset is chunked
* or not.
@@ -441,25 +419,23 @@ done:
* the boundary would be dataset's dims.
*
* The calulation starts from the last dimention (h5dump dims output).
- *
- * Note:
- * Added for JIRA HDFFV-7862.
*-----------------------------------------*/
-int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
+int
+Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p)
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ int ret_value = 0;
int k;
H5D_layout_t dset_layout;
int rank_chunk;
hsize_t dims_chunk[H5S_MAX_RANK];
hsize_t size_chunk = 1;
- hsize_t nchunk_fit; /* number of chunks that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
- hsize_t ndatum_fit; /* number of dataum that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
+ hsize_t nchunk_fit; /* number of chunks that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
+ hsize_t ndatum_fit; /* number of dataum that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
hsize_t chunk_dims_map[H5S_MAX_RANK]; /* mapped chunk dimentions */
- hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */
- hsize_t hslab_nbytes; /* size of hyperslab in byte */
+ hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */
+ hsize_t hslab_nbytes; /* size of hyperslab in byte */
/* init to set as size of a data element */
hslab_nbytes = size_datum;
@@ -572,24 +548,9 @@ done:
/*-------------------------------------------------------------------------
* Function: do_copy_objects
*
- * Purpose: duplicate all HDF5 objects in the file
- *
- * Return: 0, ok, -1 no
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: October, 23, 2003
- *
- * Modifications:
- *
- * July 2004: Introduced the extra EC or NN option for SZIP
- *
- * December 2004: Added a check for H5Dcreate; if the dataset cannot be created
- * with the requested filter, use the input one
- *
- * October 2006: Read/write using the file type by default.
+ * Purpose: duplicate all HDF5 objects in the file
*
- * October 2006: Read by hyperslabs for big datasets.
+ * Return: 0, ok, -1 no
*
* A threshold of H5TOOLS_MALLOCSIZE (128 MB) is the limit upon which I/O hyperslab is done
* i.e., if the memory needed to read a dataset is greater than this limit,
@@ -630,31 +591,6 @@ done:
* in (2) is that, when using the strip mine size, it assures that the "remaining" part
* of the dataset that does not fill an entire strip mine is processed.
*
- * November 2006: Use H5Ocopy in the copy of objects. The logic for using
- * H5Ocopy or not is if a change of filters or layout is requested by the user
- * then use read/write else use H5Ocopy.
- *
- * May, 1, 2008: Add a printing of the compression ratio of old size / new size
- *
- * Feburary 2012: improve Read/Write by hyperslabs for big datasets.
- * Programmer: Jonathan Kim
- *
- * A threshold of H5TOOLS_MALLOCSIZE is the limit upon which I/O hyperslab is done
- * i.e., if the memory needed to read a dataset is greater than this limit,
- * then hyperslab I/O is done instead of one operation I/O
- * For each dataset, the memory needed is calculated according to
- *
- * memory needed = number of elements * size of each element
- *
- * if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations
- * are done
- *
- * H5Dread( input_dataset )
- * H5Dwrite( output_dataset )
- *
- * with all elements in the datasets selected. If the memory needed is greater than
- * H5TOOLS_MALLOCSIZE, then the following operations are done instead:
- *
* 1. figure out a hyperslab (dimentions) and size (refer to Get_hyperslab()).
* 2. Calculate the hyperslab selections as the selection is moving forward.
* Selection would be same as the hyperslab except for the remaining edge portion
@@ -666,7 +602,7 @@ done:
int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
pack_opt_t *options) /* repack options */
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ int ret_value = 0;
hid_t grp_in = -1; /* group ID */
hid_t grp_out = -1; /* group ID */
hid_t dset_in = -1; /* read dataset ID */
@@ -988,13 +924,18 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
if(H5Dread(dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
if(H5Dwrite(dset_out, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dwrite failed");
/* Check if we have VL data in the dataset's
* datatype that must be reclaimed */
if (TRUE == H5Tdetect_class(wtype_id, H5T_VLEN))
if (H5Dvlen_reclaim(wtype_id, f_space_id, H5P_DEFAULT, buf) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dvlen_reclaim failed");
+ /* free */
+ if (buf != NULL) {
+ HDfree(buf);
+ buf = NULL;
+ }
}
else { /* possibly not enough memory, read/write by hyperslabs */
size_t p_type_nbytes = msize; /*size of memory type */
@@ -1074,7 +1015,7 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
if(H5Dread(dset_in, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
if(H5Dwrite(dset_out, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dwrite failed");
/* reclaim any VL memory, if necessary */
if (vl_data)
@@ -1165,7 +1106,7 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
*-------------------------------------------------------------------------
*/
else {
- hid_t pid;
+ hid_t pid = -1;
/* create property to pass copy options */
if ((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0)
@@ -1243,6 +1184,7 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
if (H5Tclose(type_out) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ type_out = -1; /* named datatypes stack, named_dt_head, manages allocation */
break;
@@ -1273,6 +1215,18 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
} /* end if */
done:
+
+ /* Finalize (link) the stack of named datatypes (if any) first
+ * because of reference counting */
+ if (0 == ret_value && named_dt_head != NULL) {
+ if (named_datatype_free(&named_dt_head, 0) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "named_datatype_free failed");
+ }
+ else
+ H5E_BEGIN_TRY {
+ named_datatype_free(&named_dt_head, 1);
+ } H5E_END_TRY;
+
H5E_BEGIN_TRY
{
H5Gclose(grp_in);
@@ -1295,14 +1249,6 @@ done:
if (hslab_buf != NULL)
HDfree(hslab_buf);
- /* Finalize (link) the stack of named datatypes (if any) */
- if (0 == ret_value && named_dt_head != NULL)
- named_datatype_free(&named_dt_head, 0);
- else
- H5E_BEGIN_TRY {
- named_datatype_free(&named_dt_head, 1);
- } H5E_END_TRY;
-
return ret_value;
}
@@ -1310,10 +1256,10 @@ done:
* Function: print_dataset_info
*
* Purpose: print name, filters, percentage compression of a dataset
- *
*-------------------------------------------------------------------------
*/
-static void print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
+static void
+print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
{
char strfilter[255];
#if defined (PRINT_DEBUG )
@@ -1325,7 +1271,7 @@ static void print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int p
unsigned cd_values[20]; /* filter client data values */
size_t cd_nelmts; /* filter client number of values */
char f_objname[256]; /* filter objname */
- int i;
+ int i;
HDstrcpy(strfilter, "\0");
@@ -1417,19 +1363,15 @@ static void print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int p
/*-------------------------------------------------------------------------
* Function: copy_user_block
*
- * Purpose: copy user block from one file to another
- *
- * Return: 0, ok, -1 no
- *
- * Programmer: Peter Cao
- *
- * Date: October, 25, 2007
+ * Purpose: copy user block from one file to another
*
+ * Return: 0, ok, -1 no
*-------------------------------------------------------------------------
*/
-static int copy_user_block(const char *infile, const char *outfile, hsize_t size)
+static int
+copy_user_block(const char *infile, const char *outfile, hsize_t size)
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ int ret_value = 0;
int infid = -1, outfid = -1; /* File descriptors */
/* User block must be any power of 2 equal to 512 or greater (512, 1024, 2048, etc.) */
@@ -1491,66 +1433,62 @@ done:
/*-------------------------------------------------------------------------
* Function: print_user_block
*
- * Purpose: print user block
- *
- * Return: 0, ok, -1 no
- *
- * Programmer: Pedro Vicente
- *
- * Date: August, 20, 2008
+ * Purpose: print user block
*
+ * Return: 0, ok, -1 no
*-------------------------------------------------------------------------
*/
#if defined (H5REPACK_DEBUG_USER_BLOCK)
static
-void print_user_block(const char *filename, hid_t fid)
+void
+print_user_block(const char *filename, hid_t fid)
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
- int fh; /* file handle */
- hsize_t ub_size; /* user block size */
- hsize_t size; /* size read */
- hid_t fcpl; /* file creation property list ID for HDF5 file */
+ int ret_value = 0;
+ int fh = -1; /* file handle */
+ hsize_t ub_size; /* user block size */
+ hsize_t size; /* size read */
+ hid_t fcpl = -1; /* file creation property list ID for HDF5 file */
int i;
/* get user block size */
- if(( fcpl = H5Fget_create_plist(fid)) < 0) {
+ if ((fcpl = H5Fget_create_plist(fid)) < 0) {
HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list");
}
- if(H5Pget_userblock(fcpl, &ub_size) < 0) {
+ if (H5Pget_userblock(fcpl, &ub_size) < 0) {
HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_userblock failed to retrieve userblock size");
}
- if(H5Pclose(fcpl) < 0) {
+ if (H5Pclose(fcpl) < 0) {
HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed to close property list");
}
/* open file */
- if((fh = HDopen(filename, O_RDONLY)) < 0) {
+ if ((fh = HDopen(filename, O_RDONLY)) < 0) {
HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDopen failed to open file <%s>", filename);
}
size = ub_size;
/* read file */
- while(size > 0) {
+ while (size > 0) {
ssize_t nread; /* # of bytes read */
char rbuf[USERBLOCK_XFER_SIZE]; /* buffer for reading */
/* read buffer */
- if(size > USERBLOCK_XFER_SIZE)
+ if (size > USERBLOCK_XFER_SIZE)
nread = HDread(fh, rbuf, (size_t)USERBLOCK_XFER_SIZE);
else
nread = HDread(fh, rbuf, (size_t)size);
- for(i = 0; i < nread; i++) {
+ for (i = 0; i < nread; i++) {
printf("%c ", rbuf[i]);
}
printf("\n");
- if(nread < 0) {
+ if (nread < 0) {
HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "nread < 0");
}
@@ -1559,7 +1497,7 @@ void print_user_block(const char *filename, hid_t fid)
}
done:
- if(fh > 0)
+ if (fh > 0)
HDclose(fh);
return;
diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c
index e968b3c..067ebad 100644
--- a/tools/src/h5repack/h5repack_filters.c
+++ b/tools/src/h5repack/h5repack_filters.c
@@ -42,7 +42,7 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */
H5D_layout_t layout;
int rank; /* rank of dataset */
hsize_t chsize[64]; /* chunk size in elements */
- unsigned int i, j;
+ unsigned int i;
/* get information about input filters */
if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
@@ -240,7 +240,7 @@ int apply_filters(const char* name, /* object name from traverse list */
int nfilters; /* number of filters in DCPL */
hsize_t chsize[64]; /* chunk size in elements */
H5D_layout_t layout;
- int i, j;
+ int i;
pack_info_t obj;
pack_info_t filtobj;
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index d34c394..037aa4a 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -31,7 +31,7 @@ const char *outfile = NULL;
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char *s_opts = "hVvf:l:m:e:nLc:d:s:u:b:M:t:a:i:o:S:P:T:G:q:z:E";
+static const char *s_opts = "hVvf:l:m:e:nLj:k:c:d:s:u:b:M:t:a:i:o:S:P:T:G:q:z:E";
static struct long_options l_opts[] = {
{ "help", no_arg, 'h' },
{ "version", no_arg, 'V' },
@@ -42,6 +42,8 @@ static struct long_options l_opts[] = {
{ "file", require_arg, 'e' },
{ "native", no_arg, 'n' },
{ "latest", no_arg, 'L' },
+ { "low", require_arg, 'j' },
+ { "high", require_arg, 'k' },
{ "compact", require_arg, 'c' },
{ "indexed", require_arg, 'd' },
{ "ssize", require_arg, 's' },
@@ -82,6 +84,9 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
PRINTVALSTREAM(rawoutstream, " -n, --native Use a native HDF5 type when repacking\n");
PRINTVALSTREAM(rawoutstream, " -L, --latest Use latest version of file format\n");
+ PRINTVALSTREAM(rawoutstream, " This option will take precedence over the -j and -k options\n");
+ PRINTVALSTREAM(rawoutstream, " -j, --low The low bound as in H5Pset_libver_bounds()\n");
+ PRINTVALSTREAM(rawoutstream, " -k, --high The high bound as in H5Pset_libver_bounds()\n");
PRINTVALSTREAM(rawoutstream, " -c L1, --compact=L1 Maximum number of links in header messages\n");
PRINTVALSTREAM(rawoutstream, " -d L2, --indexed=L2 Minimum number of links in the indexed format\n");
PRINTVALSTREAM(rawoutstream, " -s S[:F], --ssize=S[:F] Shared object header message minimum size\n");
@@ -500,6 +505,22 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
options->latest = TRUE;
break;
+ case 'j':
+ options->low_bound = (H5F_libver_t)HDatoi(opt_arg);
+ if(options->low_bound < H5F_LIBVER_EARLIEST || options->low_bound > H5F_LIBVER_LATEST) {
+ error_msg("in parsing low bound\n");
+ goto done;
+ }
+ break;
+
+ case 'k':
+ options->high_bound = (H5F_libver_t)HDatoi(opt_arg);
+ if(options->high_bound < H5F_LIBVER_EARLIEST || options->high_bound > H5F_LIBVER_LATEST) {
+ error_msg("in parsing high bound\n");
+ goto done;
+ }
+ break;
+
case 'c':
options->grp_compact = HDatoi( opt_arg );
if (options->grp_compact > 0)
diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c
index 376ab92..7b610a3 100644
--- a/tools/src/h5repack/h5repack_refs.c
+++ b/tools/src/h5repack/h5repack_refs.c
@@ -145,7 +145,7 @@ int do_copy_refobjs(hid_t fidin,
*-------------------------------------------------------------------------
*/
if(H5Tequal(mtype_id, H5T_STD_REF_OBJ)) {
- hid_t refobj_id;
+ hid_t refobj_id = -1;
hobj_ref_t *refbuf = NULL; /* buffer for object references */
hobj_ref_t *buf = NULL;
const char* refname;
@@ -189,7 +189,8 @@ int do_copy_refobjs(hid_t fidin,
refname);
}
} /*refname*/
- H5Oclose(refobj_id);
+ if (H5Oclose(refobj_id) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Oclose refob failed");
} /* u */
} /*nelmts*/
@@ -220,7 +221,7 @@ int do_copy_refobjs(hid_t fidin,
*-------------------------------------------------------------------------
*/
else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) {
- hid_t refobj_id;
+ hid_t refobj_id = -1;
hdset_reg_ref_t *refbuf = NULL; /* input buffer for region references */
hdset_reg_ref_t *buf = NULL; /* output buffer */
const char* refname;
@@ -259,7 +260,7 @@ int do_copy_refobjs(hid_t fidin,
* in the second traversal of the file
*/
if((refname = MapIdToName(refobj_id, travt)) != NULL) {
- hid_t region_id; /* region id of the referenced dataset */
+ hid_t region_id = -1; /* region id of the referenced dataset */
if((region_id = H5Rget_region(dset_in, H5R_DATASET_REGION, &buf[u])) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rget_region failed");
@@ -276,7 +277,8 @@ int do_copy_refobjs(hid_t fidin,
refname);
}
} /*refname*/
- H5Oclose(refobj_id);
+ if (H5Oclose(refobj_id) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Oclose refobj_id failed");
} /* u */
} /*nelmts*/
@@ -377,7 +379,8 @@ int do_copy_refobjs(hid_t fidin,
* This function is paired with copy_named_datatype() which is called
* in copy_attr(), so need to free.
*/
- named_datatype_free(&named_dt_head, 0);
+ if (named_datatype_free(&named_dt_head, 0) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "named_datatype_free failed");
return ret_value;
@@ -392,7 +395,7 @@ done:
H5Tclose(ftype_id);
H5Tclose(mtype_id);
H5Tclose(type_in);
- named_datatype_free(&named_dt_head, 0);
+ named_datatype_free(&named_dt_head, 1);
} H5E_END_TRY;
return ret_value;
@@ -478,20 +481,20 @@ static int copy_refs_attr(hid_t loc_in,
is_ref = (type_class == H5T_REFERENCE);
if(type_class == H5T_VLEN ) {
- hid_t base_type;
+ hid_t base_type = H5Tget_super(ftype_id);
- base_type = H5Tget_super(ftype_id);
is_ref_vlen = (H5Tget_class(base_type) == H5T_REFERENCE);
msize = H5Tget_size(base_type);
- H5Tclose(base_type);
+ if (H5Tclose(base_type) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose base_type failed");
}
else if(type_class == H5T_ARRAY ) {
- hid_t base_type;
+ hid_t base_type = H5Tget_super(ftype_id);
- base_type = H5Tget_super(ftype_id);
is_ref_array = (H5Tget_class(base_type) == H5T_REFERENCE);
msize = H5Tget_size(base_type);
- H5Tclose(base_type);
+ if (H5Tclose(base_type) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose base_type failed");
}
else if(type_class == H5T_COMPOUND) {
int nmembers = H5Tget_nmembers(ftype_id) ;
@@ -511,7 +514,8 @@ static int copy_refs_attr(hid_t loc_in,
ref_comp_size[ref_comp_field_n] = H5Tget_size(mtid);
ref_comp_field_n++;
}
- H5Tclose(mtid);
+ if (H5Tclose(mtid) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose mtid failed");
}
/* if compound don't contain reference type member, free the above
@@ -533,9 +537,12 @@ static int copy_refs_attr(hid_t loc_in,
is_ref_comp = (ref_comp_field_n > 0);
if (!(is_ref || is_ref_vlen || is_ref_array || is_ref_comp)) {
- H5Tclose(mtype_id);
- H5Tclose(ftype_id);
- H5Aclose(attr_id);
+ if (H5Tclose(mtype_id) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose mtype_id failed");
+ if (H5Tclose(ftype_id) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose ftype_id failed");
+ if (H5Aclose(attr_id) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Aclose attr_id failed");
continue;
}
@@ -564,11 +571,11 @@ static int copy_refs_attr(hid_t loc_in,
unsigned array_rank = 0;
hsize_t array_size = 1;
hsize_t array_dims[H5S_MAX_RANK];
- hid_t base_type;
+ hid_t base_type = H5Tget_super(ftype_id);
- base_type = H5Tget_super(ftype_id);
msize = H5Tget_size(base_type);
- H5Tclose(base_type);
+ if (H5Tclose(base_type) < 0)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose base_type failed");
array_rank = (unsigned)H5Tget_array_ndims(mtype_id);
H5Tget_array_dims2(mtype_id, array_dims);
diff --git a/tools/src/misc/h5mkgrp.c b/tools/src/misc/h5mkgrp.c
index 43d6bfe..b7ff73c 100644
--- a/tools/src/misc/h5mkgrp.c
+++ b/tools/src/misc/h5mkgrp.c
@@ -129,6 +129,7 @@ parse_command_line(int argc, const char *argv[], param_t *parms)
case 'h':
usage();
leave(EXIT_SUCCESS);
+ break;
/* Create objects with the latest version of the format */
case 'l':
@@ -149,6 +150,7 @@ parse_command_line(int argc, const char *argv[], param_t *parms)
case 'V':
print_version(h5tools_getprogname());
leave(EXIT_SUCCESS);
+ break;
/* Bad command line argument */
default:
diff --git a/tools/test/h5copy/CMakeLists.txt b/tools/test/h5copy/CMakeLists.txt
index 4a519ab..c57cd5e 100644
--- a/tools/test/h5copy/CMakeLists.txt
+++ b/tools/test/h5copy/CMakeLists.txt
@@ -10,14 +10,44 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
# Add the h5copy test executables
# --------------------------------------------------------------------
- if (HDF5_BUILD_GENERATORS)
- add_executable (h5copygentest ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/h5copygentest.c)
- TARGET_NAMING (h5copygentest STATIC)
- TARGET_C_PROPERTIES (h5copygentest STATIC " " " ")
- target_link_libraries (h5copygentest ${HDF5_LIB_TARGET})
- set_target_properties (h5copygentest PROPERTIES FOLDER generator/tools)
+if (HDF5_BUILD_GENERATORS)
+ add_executable (h5copygentest ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/h5copygentest.c)
+ TARGET_NAMING (h5copygentest STATIC)
+ TARGET_C_PROPERTIES (h5copygentest STATIC " " " ")
+ target_link_libraries (h5copygentest ${HDF5_LIB_TARGET})
+ set_target_properties (h5copygentest PROPERTIES FOLDER generator/tools)
- #add_test (NAME h5copygentest COMMAND $<TARGET_FILE:h5copygentest>)
- endif ()
+ #add_test (NAME h5copygentest COMMAND $<TARGET_FILE:h5copygentest>)
+endif ()
- include (CMakeTests.cmake)
+#-----------------------------------------------------------------------------
+# If plugin library tests can be tested
+#-----------------------------------------------------------------------------
+if (BUILD_SHARED_LIBS)
+ set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibcopy")
+ set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}")
+ set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME})
+ add_definitions (${HDF_EXTRA_C_FLAGS})
+ INCLUDE_DIRECTORIES (${HDF5_SRC_DIR})
+
+ add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_copy.c)
+ TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED " " " ")
+ target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+ H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION})
+
+ # make plugins dir
+ file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")
+ #-----------------------------------------------------------------------------
+ # Copy plugin library to a plugins folder
+ #-----------------------------------------------------------------------------
+ add_custom_command (
+ TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different
+ "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_TARGET}>"
+ "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_TARGET}>"
+ )
+endif ()
+
+include (CMakeTests.cmake)
diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake
index b60c0e9..1bdefa6 100644
--- a/tools/test/h5copy/CMakeTests.cmake
+++ b/tools/test/h5copy/CMakeTests.cmake
@@ -24,10 +24,16 @@
${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_extlinks_trg.h5
${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_ref.h5
${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copytst.h5
+ ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/tudfilter.h5
+ ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/tudfilter2.h5
)
set (LIST_OTHER_TEST_FILES
${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_misc1.out
+ ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/tudfilter.h5.txt
+ ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/tudfilter.h5_ERR.txt
+ ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_plugin_fail_ERR.out.h5.txt
+ ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_plugin_test.out.h5.txt
)
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
@@ -74,9 +80,9 @@
if (NOT "${resultcode}" STREQUAL "2")
add_test (
NAME H5COPY_F-${testname}-DIFF
- COMMAND $<TARGET_FILE:h5diff> -q ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
+ COMMAND $<TARGET_FILE:h5diff> -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
)
- SET_TESTS_PROPERTIES(H5COPY_F-${testname}-DIFF PROPERTIES DEPENDS H5COPY_F-${testname})
+ set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES DEPENDS H5COPY_F-${testname})
if ("${resultcode}" STREQUAL "1")
set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES WILL_FAIL "true")
endif ()
@@ -110,9 +116,9 @@
if (NOT "${resultcode}" STREQUAL "2")
add_test (
NAME H5COPY-${testname}-DIFF
- COMMAND $<TARGET_FILE:h5diff> -q ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
+ COMMAND $<TARGET_FILE:h5diff> -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
)
- SET_TESTS_PROPERTIES(H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname})
+ set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname})
if ("${resultcode}" STREQUAL "1")
set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true")
endif ()
@@ -160,9 +166,9 @@
if (NOT "${resultcode}" STREQUAL "2")
add_test (
NAME H5COPY-${testname}-DIFF
- COMMAND $<TARGET_FILE:h5diff> -q ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
+ COMMAND $<TARGET_FILE:h5diff> -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
)
- SET_TESTS_PROPERTIES(H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname})
+ set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname})
if ("${resultcode}" STREQUAL "1")
set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true")
endif ()
@@ -201,9 +207,9 @@
if (NOT "${resultcode}" STREQUAL "2")
add_test (
NAME H5COPY_SAME-${testname}-DIFF
- COMMAND $<TARGET_FILE:h5diff> -q ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
+ COMMAND $<TARGET_FILE:h5diff> -v ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
)
- SET_TESTS_PROPERTIES(H5COPY_SAME-${testname}-DIFF PROPERTIES DEPENDS H5COPY_SAME-${testname})
+ set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES DEPENDS H5COPY_SAME-${testname})
if ("${resultcode}" STREQUAL "1")
set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES WILL_FAIL "true")
endif ()
@@ -250,6 +256,134 @@
endif ()
endmacro ()
+ macro (ADD_H5_UD_TEST testname resultcode infile sparam srcname dparam dstname cmpfile)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5COPY_UD-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ testfiles/${testname}.out.h5
+ testfiles/${infile}.out
+ testfiles/${infile}.out.err
+ testfiles/${testname}.out.h5.out
+ testfiles/${testname}.out.h5.out.err
+ )
+ if ("${resultcode}" STREQUAL "2")
+ add_test (
+ NAME H5COPY_UD-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5copy-shared>"
+ -D "TEST_ARGS:STRING=-v;-i;./testfiles/${infile};-o;./testfiles/${testname}.out.h5;${sparam};${srcname};${dparam};${dstname}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=./testfiles/${infile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=./testfiles/${infile}.txt"
+ -D "TEST_APPEND=EXIT CODE:"
+ -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
+ -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ else ()
+ add_test (
+ NAME H5COPY_UD-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5copy-shared>"
+ -D "TEST_ARGS:STRING=-v;-i;./testfiles/${infile};-o;./testfiles/${testname}.out.h5;${sparam};${srcname};${dparam};${dstname}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=./testfiles/${infile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=./testfiles/${infile}.txt"
+ -D "TEST_APPEND=EXIT CODE:"
+ -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
+ -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ()
+ set_tests_properties (H5COPY_UD-${testname} PROPERTIES DEPENDS H5COPY_UD-${testname}-clear-objects)
+ add_test (
+ NAME H5COPY_UD-${testname}-DIFF
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5diff-shared>"
+ -D "TEST_ARGS:STRING=-v;./testfiles/${cmpfile};./testfiles/${testname}.out.h5;${srcname};${dstname}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=./testfiles/${testname}.out.h5.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=./testfiles/${testname}.out.h5.txt"
+ -D "TEST_APPEND=EXIT CODE:"
+ -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
+ -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5COPY_UD-${testname}-DIFF PROPERTIES DEPENDS H5COPY_UD-${testname})
+ endif ()
+ endmacro ()
+
+ macro (ADD_H5_UD_ERR_TEST testname resultcode infile sparam srcname dparam dstname cmpfile)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5COPY_UD_ERR-${testname}-clearall-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ testfiles/${testname}_ERR.out.h5
+ testfiles/${infile}_ERR.out
+ testfiles/${infile}_ERR.out.err
+ testfiles/${testname}_ERR.out.h5.out
+ testfiles/${testname}_ERR.out.h5.out.err
+ )
+ if ("${resultcode}" STREQUAL "2")
+ add_test (
+ NAME H5COPY_UD_ERR-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5copy-shared>"
+ -D "TEST_ARGS:STRING=-v;--enable-error-stack;-i;./testfiles/${infile};-o;./testfiles/${testname}_ERR.out.h5;${sparam};${srcname};${dparam};${dstname}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=./testfiles/${infile}_ERR.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_REFERENCE=./testfiles/${infile}_ERR.txt"
+ -D "TEST_MASK_ERROR=true"
+ -D "TEST_APPEND=EXIT CODE:"
+ -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
+ -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ else ()
+ add_test (
+ NAME H5COPY_UD_ERR-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5copy-shared>"
+ -D "TEST_ARGS:STRING=-v;--enable-error-stack;-i;./testfiles/${infile};-o;./testfiles/${testname}_ERR.out.h5;${sparam};${srcname};${dparam};${dstname}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=./testfiles/${infile}_ERR.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=./testfiles/${infile}_ERR.txt"
+ -D "TEST_MASK_ERROR=true"
+ -D "TEST_APPEND=EXIT CODE:"
+ -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
+ -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ()
+ set_tests_properties (H5COPY_UD_ERR-${testname} PROPERTIES DEPENDS H5COPY_UD_ERR-${testname}-clearall-objects)
+ add_test (
+ NAME H5COPY_UD_ERR-${testname}-DIFF
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5diff-shared>"
+ -D "TEST_ARGS:STRING=-v;./testfiles/${cmpfile};./testfiles/${testname}_ERR.out.h5;${srcname};${dstname}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=./testfiles/${testname}_ERR.out.h5.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_REFERENCE=./testfiles/${testname}_ERR.out.h5.txt"
+ -D "TEST_APPEND=EXIT CODE:"
+ -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
+ -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5COPY_UD_ERR-${testname}-DIFF PROPERTIES DEPENDS H5COPY_UD_ERR-${testname})
+ endif ()
+ endmacro ()
+
##############################################################################
##############################################################################
### T H E T E S T S ###
@@ -434,3 +568,11 @@
else ()
ADD_H5_TEST_SAME (samefile2 2 ${HDF_FILE1}.h5 /grp_dsets /grp_dsets -v -s /grp_dsets -d /grp_dsets_cp)
endif ()
+
+##############################################################################
+### P L U G I N T E S T S
+##############################################################################
+if (BUILD_SHARED_LIBS)
+ ADD_H5_UD_TEST (h5copy_plugin_test 0 tudfilter.h5 -s /dynlibud -d /dynlibud tudfilter2.h5 )
+ ADD_H5_UD_ERR_TEST (h5copy_plugin_fail 2 tudfilter.h5 -s /dynlibud -d /dynlibud tudfilter2.h5)
+endif ()
diff --git a/test/dynlib2.c b/tools/test/h5copy/dynlib_copy.c
index 2574d4d..571452e 100644
--- a/test/dynlib2.c
+++ b/tools/test/h5copy/dynlib_copy.c
@@ -10,59 +10,52 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Raymond Lu
- * 13 February 2013
- *
- * Purpose: Tests the plugin module (H5PL)
+ * Purpose: Tests the plugin module (H5PL)
*/
#include <stdlib.h>
#include <stdio.h>
#include "H5PLextern.h"
-#define H5Z_FILTER_DYNLIB2 258
+#define H5Z_FILTER_DYNLIBUD 300
#define MULTIPLIER 3
-static size_t H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts,
+static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
-const H5Z_class2_t H5Z_DYNLIB2[1] = {{
+const H5Z_class2_t H5Z_DYNLIBUD[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_DYNLIB2, /* Filter id number */
+ H5Z_FILTER_DYNLIBUD, /* Filter id number */
1, 1, /* Encoding and decoding enabled */
- "dynlib2", /* Filter name for debugging */
+ "dynlibud", /* Filter name for debugging */
NULL, /* The "can apply" callback */
NULL, /* The "set local" callback */
- (H5Z_func_t)H5Z_filter_dynlib2, /* The actual filter function */
+ (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */
}};
H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
-const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB2;}
+const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;}
/*-------------------------------------------------------------------------
- * Function: H5Z_filter_dynlib2
+ * Function: H5Z_filter_dynlibud
*
- * Purpose: A dynlib2 filter method that multiplies the original value
+ * Purpose: A dynlib2 filter method that multiplies the original value
* during write and divide the original value during read. It
- * will be built as a shared library. plugin.c test will load
- * and use this filter library.
- *
- * Return: Success: Data chunk size
- *
- * Failure: 0
+ * will be built as a shared library. plugin.c test will load
+ * and use this filter library.
*
- * Programmer: Raymond Lu
- * 29 March 2013
+ * Return: Success: Data chunk size
*
+ * Failure: 0
*-------------------------------------------------------------------------
*/
static size_t
-H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts,
+H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes,
size_t *buf_size, void **buf)
{
- int *int_ptr = (int *)*buf; /* Pointer to the data values */
+ char *int_ptr = (char *)*buf; /* Pointer to the data values */
size_t buf_left = *buf_size; /* Amount of data buffer left to process */
/* Check for the correct number of parameters */
@@ -73,20 +66,24 @@ H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts,
cd_values = cd_values;
if(flags & H5Z_FLAG_REVERSE) { /*read*/
- /* Divide the original value with MULTIPLIER */
+ /* Subtract the original value with MULTIPLIER */
while(buf_left > 0) {
- *int_ptr++ /= MULTIPLIER;
- buf_left -= sizeof(int);
+ char temp = *int_ptr;
+ *int_ptr = temp - MULTIPLIER;
+ int_ptr++;
+ buf_left -= sizeof(*int_ptr);
} /* end while */
} /* end if */
else { /*write*/
- /* Multiply the original value with MULTIPLIER */
+ /* Add the original value with MULTIPLIER */
while(buf_left > 0) {
- *int_ptr++ *= MULTIPLIER;
- buf_left -= sizeof(int);
+ char temp = *int_ptr;
+ *int_ptr = temp + MULTIPLIER;
+ int_ptr++;
+ buf_left -= sizeof(*int_ptr);
} /* end while */
} /* end else */
return nbytes;
-} /* end H5Z_filter_dynlib2() */
+} /* end H5Z_filter_dynlibud() */
diff --git a/tools/test/h5copy/testfiles/h5copy_plugin_fail_ERR.out.h5.txt b/tools/test/h5copy/testfiles/h5copy_plugin_fail_ERR.out.h5.txt
new file mode 100644
index 0000000..66e9eb2
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copy_plugin_fail_ERR.out.h5.txt
@@ -0,0 +1,3 @@
+dataset: </dynlibud> and </dynlibud>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5copy/testfiles/h5copy_plugin_test.out.h5.txt b/tools/test/h5copy/testfiles/h5copy_plugin_test.out.h5.txt
new file mode 100644
index 0000000..66e9eb2
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copy_plugin_test.out.h5.txt
@@ -0,0 +1,3 @@
+dataset: </dynlibud> and </dynlibud>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5copy/testfiles/tudfilter.h5 b/tools/test/h5copy/testfiles/tudfilter.h5
new file mode 100644
index 0000000..081b000
--- /dev/null
+++ b/tools/test/h5copy/testfiles/tudfilter.h5
Binary files differ
diff --git a/tools/test/h5copy/testfiles/tudfilter.h5.txt b/tools/test/h5copy/testfiles/tudfilter.h5.txt
new file mode 100644
index 0000000..eabe407
--- /dev/null
+++ b/tools/test/h5copy/testfiles/tudfilter.h5.txt
@@ -0,0 +1,2 @@
+Copying file <./testfiles/tudfilter.h5> and object </dynlibud> to file <./testfiles/h5copy_plugin_test.out.h5> and object </dynlibud>
+EXIT CODE: 0
diff --git a/tools/test/h5copy/testfiles/tudfilter.h5_ERR.txt b/tools/test/h5copy/testfiles/tudfilter.h5_ERR.txt
new file mode 100644
index 0000000..3c5b3ca
--- /dev/null
+++ b/tools/test/h5copy/testfiles/tudfilter.h5_ERR.txt
@@ -0,0 +1,2 @@
+Copying file <./testfiles/tudfilter.h5> and object </dynlibud> to file <./testfiles/h5copy_plugin_fail_ERR.out.h5> and object </dynlibud>
+EXIT CODE: 0
diff --git a/tools/test/h5copy/testfiles/tudfilter2.h5 b/tools/test/h5copy/testfiles/tudfilter2.h5
new file mode 100644
index 0000000..081b000
--- /dev/null
+++ b/tools/test/h5copy/testfiles/tudfilter2.h5
Binary files differ
diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake
index d87a47f..bbc39d8 100644
--- a/tools/test/h5diff/CMakeTests.cmake
+++ b/tools/test/h5diff/CMakeTests.cmake
@@ -447,7 +447,7 @@
macro (ADD_PH5_TEST resultfile resultcode)
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME PH5DIFF-${resultfile} COMMAND $<TARGET_FILE:ph5diff> ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} ${ARGN})
+ add_test (NAME PH5DIFF-${resultfile} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:ph5diff> ${MPIEXEC_POSTFLAGS} ${ARGN})
set_tests_properties (PH5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/PAR/testfiles")
if (NOT "${resultcode}" STREQUAL "0")
set_tests_properties (PH5DIFF-${resultfile} PROPERTIES WILL_FAIL "true")
@@ -470,7 +470,7 @@
add_test (
NAME PH5DIFF-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=${MPIEXEC};${MPIEXEC_PREFLAGS};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_POSTFLAGS};$<TARGET_FILE:ph5diff>"
+ -D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$<TARGET_FILE:ph5diff>;${MPIEXEC_POSTFLAGS}"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/PAR/testfiles"
-D "TEST_OUTPUT=${resultfile}.out"
diff --git a/tools/test/h5diff/Makefile.am b/tools/test/h5diff/Makefile.am
index d2b5ebb..a2ce9c4 100644
--- a/tools/test/h5diff/Makefile.am
+++ b/tools/test/h5diff/Makefile.am
@@ -52,10 +52,7 @@ if HAVE_SHARED_CONDITIONAL
# Build it as shared library if configure is enabled for shared library.
noinst_LTLIBRARIES=libdynlibdiff.la
libdynlibdiff_la_SOURCES=dynlib_diff.c
- libdynlibdiff_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
-
- libdynlibdiff.la: $(libdynlibdiff_la_OBJECTS) $(libdynlibdiff_la_DEPENDENCIES) $(EXTRA_libdynlibdiff_la_DEPENDENCIES)
- $(AM_V_CCLD)$(libdynlibdiff_la_LINK) $(am_libdynlibdiff_la_rpath) $(libdynlibdiff_la_OBJECTS) $(libdynlibdiff_la_LIBADD)
+ libdynlibdiff_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere
endif
# Temporary files. *.h5 are generated by h5diff. They should
diff --git a/tools/test/h5diff/testfiles/h5diff_454_ERR.err b/tools/test/h5diff/testfiles/h5diff_454_ERR.err
index 8fa1718..82802a1 100644
--- a/tools/test/h5diff/testfiles/h5diff_454_ERR.err
+++ b/tools/test/h5diff/testfiles/h5diff_454_ERR.err
@@ -1,4 +1,4 @@
H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
- #000: (file name) line (number) in h5diff(): Error: treat dangling link as error
+ #000: (file name) line (number) in h5diff(): treat dangling link as error
major: Failure in tools library
minor: error in function
diff --git a/tools/test/h5diff/testfiles/h5diff_454_ERR.txt b/tools/test/h5diff/testfiles/h5diff_454_ERR.txt
index de25a69..4501071 100644
--- a/tools/test/h5diff/testfiles/h5diff_454_ERR.txt
+++ b/tools/test/h5diff/testfiles/h5diff_454_ERR.txt
@@ -1,6 +1,6 @@
Warning: </softlink_noexist> is a dangling link.
H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
- #000: (file name) line (number) in h5diff(): Error: treat dangling link as error
+ #000: (file name) line (number) in h5diff(): treat dangling link as error
major: Failure in tools library
minor: error in function
EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_455_ERR.err b/tools/test/h5diff/testfiles/h5diff_455_ERR.err
index 8fa1718..82802a1 100644
--- a/tools/test/h5diff/testfiles/h5diff_455_ERR.err
+++ b/tools/test/h5diff/testfiles/h5diff_455_ERR.err
@@ -1,4 +1,4 @@
H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
- #000: (file name) line (number) in h5diff(): Error: treat dangling link as error
+ #000: (file name) line (number) in h5diff(): treat dangling link as error
major: Failure in tools library
minor: error in function
diff --git a/tools/test/h5diff/testfiles/h5diff_455_ERR.txt b/tools/test/h5diff/testfiles/h5diff_455_ERR.txt
index de25a69..4501071 100644
--- a/tools/test/h5diff/testfiles/h5diff_455_ERR.txt
+++ b/tools/test/h5diff/testfiles/h5diff_455_ERR.txt
@@ -1,6 +1,6 @@
Warning: </softlink_noexist> is a dangling link.
H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
- #000: (file name) line (number) in h5diff(): Error: treat dangling link as error
+ #000: (file name) line (number) in h5diff(): treat dangling link as error
major: Failure in tools library
minor: error in function
EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_457_ERR.err b/tools/test/h5diff/testfiles/h5diff_457_ERR.err
index 8fa1718..82802a1 100644
--- a/tools/test/h5diff/testfiles/h5diff_457_ERR.err
+++ b/tools/test/h5diff/testfiles/h5diff_457_ERR.err
@@ -1,4 +1,4 @@
H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
- #000: (file name) line (number) in h5diff(): Error: treat dangling link as error
+ #000: (file name) line (number) in h5diff(): treat dangling link as error
major: Failure in tools library
minor: error in function
diff --git a/tools/test/h5diff/testfiles/h5diff_457_ERR.txt b/tools/test/h5diff/testfiles/h5diff_457_ERR.txt
index 6594c9a..9d73750 100644
--- a/tools/test/h5diff/testfiles/h5diff_457_ERR.txt
+++ b/tools/test/h5diff/testfiles/h5diff_457_ERR.txt
@@ -1,6 +1,6 @@
Warning: </ext_link_noexist1> is a dangling link.
H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
- #000: (file name) line (number) in h5diff(): Error: treat dangling link as error
+ #000: (file name) line (number) in h5diff(): treat dangling link as error
major: Failure in tools library
minor: error in function
EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_458_ERR.err b/tools/test/h5diff/testfiles/h5diff_458_ERR.err
index 8fa1718..82802a1 100644
--- a/tools/test/h5diff/testfiles/h5diff_458_ERR.err
+++ b/tools/test/h5diff/testfiles/h5diff_458_ERR.err
@@ -1,4 +1,4 @@
H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
- #000: (file name) line (number) in h5diff(): Error: treat dangling link as error
+ #000: (file name) line (number) in h5diff(): treat dangling link as error
major: Failure in tools library
minor: error in function
diff --git a/tools/test/h5diff/testfiles/h5diff_458_ERR.txt b/tools/test/h5diff/testfiles/h5diff_458_ERR.txt
index 9a09c17..b084914 100644
--- a/tools/test/h5diff/testfiles/h5diff_458_ERR.txt
+++ b/tools/test/h5diff/testfiles/h5diff_458_ERR.txt
@@ -1,6 +1,6 @@
Warning: </ext_link_noexist2> is a dangling link.
H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
- #000: (file name) line (number) in h5diff(): Error: treat dangling link as error
+ #000: (file name) line (number) in h5diff(): treat dangling link as error
major: Failure in tools library
minor: error in function
EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_459_ERR.err b/tools/test/h5diff/testfiles/h5diff_459_ERR.err
index 8fa1718..82802a1 100644
--- a/tools/test/h5diff/testfiles/h5diff_459_ERR.err
+++ b/tools/test/h5diff/testfiles/h5diff_459_ERR.err
@@ -1,4 +1,4 @@
H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
- #000: (file name) line (number) in h5diff(): Error: treat dangling link as error
+ #000: (file name) line (number) in h5diff(): treat dangling link as error
major: Failure in tools library
minor: error in function
diff --git a/tools/test/h5diff/testfiles/h5diff_459_ERR.txt b/tools/test/h5diff/testfiles/h5diff_459_ERR.txt
index 6594c9a..9d73750 100644
--- a/tools/test/h5diff/testfiles/h5diff_459_ERR.txt
+++ b/tools/test/h5diff/testfiles/h5diff_459_ERR.txt
@@ -1,6 +1,6 @@
Warning: </ext_link_noexist1> is a dangling link.
H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
- #000: (file name) line (number) in h5diff(): Error: treat dangling link as error
+ #000: (file name) line (number) in h5diff(): treat dangling link as error
major: Failure in tools library
minor: error in function
EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_60.txt b/tools/test/h5diff/testfiles/h5diff_60.txt
index 938f279..dde17f6 100644
--- a/tools/test/h5diff/testfiles/h5diff_60.txt
+++ b/tools/test/h5diff/testfiles/h5diff_60.txt
@@ -2,8 +2,8 @@ dataset: </string1> and </string1>
size: [3x4] [3x4]
position string1 string1 difference
------------------------------------------------------------
-[ 1 0 ] 5 \000
-[ 1 1 ] 6 \000
+[ 1 0 ] \000 5
+[ 1 1 ] \000 6
[ 1 2 ] \000 7
[ 1 3 ] \000 8
4 differences found
diff --git a/tools/test/h5diff/testfiles/h5diff_61.txt b/tools/test/h5diff/testfiles/h5diff_61.txt
index 1f238b1..5553d63 100644
--- a/tools/test/h5diff/testfiles/h5diff_61.txt
+++ b/tools/test/h5diff/testfiles/h5diff_61.txt
@@ -2,29 +2,29 @@ dataset: </string2> and </string2>
size: [20] [20]
position string2 string2 difference
------------------------------------------------------------
-[ 8 ] 9 e
-[ 8 ] f
-[ 8 ] 9
-[ 9 ] 0 e
-[ 9 ] f
-[ 9 ] 0
-[ 10 ] 1 e
-[ 10 ] f
-[ 10 ] 1
-[ 11 ] 2 e
-[ 11 ] f
-[ 11 ] 2
-[ 12 ] e 3
-[ 12 ] f
-[ 12 ] 3
-[ 13 ] e 4
-[ 13 ] f
-[ 13 ] 4
-[ 14 ] e 5
-[ 14 ] f
-[ 14 ] 5
-[ 15 ] e 6
-[ 15 ] f
-[ 15 ] 6
+[ 8 ] e 9
+[ 8 ] f
+[ 8 ] 9
+[ 9 ] e 0
+[ 9 ] f
+[ 9 ] 0
+[ 10 ] e 1
+[ 10 ] f
+[ 10 ] 1
+[ 11 ] e 2
+[ 11 ] f
+[ 11 ] 2
+[ 12 ] 3 e
+[ 12 ] f
+[ 12 ] 3
+[ 13 ] 4 e
+[ 13 ] f
+[ 13 ] 4
+[ 14 ] 5 e
+[ 14 ] f
+[ 14 ] 5
+[ 15 ] 6 e
+[ 15 ] f
+[ 15 ] 6
24 differences found
EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_62.txt b/tools/test/h5diff/testfiles/h5diff_62.txt
index 0cc0947..934f61e 100644
--- a/tools/test/h5diff/testfiles/h5diff_62.txt
+++ b/tools/test/h5diff/testfiles/h5diff_62.txt
@@ -2,36 +2,36 @@ dataset: </string3> and </string3>
size: [27] [27]
position string3 string3 difference
------------------------------------------------------------
-[ 12 ] d c
-[ 12 ] 2 d
-[ 12 ] \000 2
-[ 13 ] 3 d
-[ 13 ] \000 3
-[ 14 ] b a
-[ 14 ] c b
-[ 14 ] d c
-[ 14 ] 4 d
-[ 14 ] \000 4
-[ 15 ] c b
-[ 15 ] d c
-[ 15 ] 5 d
-[ 15 ] \000 5
-[ 16 ] c d
-[ 16 ] d 6
-[ 16 ] 6 \000
-[ 17 ] d 7
-[ 17 ] 7 \000
-[ 18 ] a b
-[ 18 ] b c
-[ 18 ] c d
-[ 18 ] d 8
-[ 18 ] 8 \000
-[ 19 ] b c
-[ 19 ] c d
-[ 19 ] d 9
-[ 19 ] 9 \000
-[ 24 ] c d
-[ 25 ] c d
-[ 26 ] c d
+[ 12 ] c d
+[ 12 ] d 2
+[ 12 ] 2 \000
+[ 13 ] d 3
+[ 13 ] 3 \000
+[ 14 ] a b
+[ 14 ] b c
+[ 14 ] c d
+[ 14 ] d 4
+[ 14 ] 4 \000
+[ 15 ] b c
+[ 15 ] c d
+[ 15 ] d 5
+[ 15 ] 5 \000
+[ 16 ] d c
+[ 16 ] 6 d
+[ 16 ] \000 6
+[ 17 ] 7 d
+[ 17 ] \000 7
+[ 18 ] b a
+[ 18 ] c b
+[ 18 ] d c
+[ 18 ] 8 d
+[ 18 ] \000 8
+[ 19 ] c b
+[ 19 ] d c
+[ 19 ] 9 d
+[ 19 ] \000 9
+[ 24 ] d c
+[ 25 ] d c
+[ 26 ] d c
31 differences found
EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_63.txt b/tools/test/h5diff/testfiles/h5diff_63.txt
index 043da16..6b46c18 100644
--- a/tools/test/h5diff/testfiles/h5diff_63.txt
+++ b/tools/test/h5diff/testfiles/h5diff_63.txt
@@ -2,9 +2,9 @@ dataset: </string4> and </string4>
size: [3] [3]
position string4 string4 difference
------------------------------------------------------------
-[ 1 ] 8
-[ 1 ] 9
-[ 2 ] 8
-[ 2 ] 9
+[ 1 ] 8
+[ 1 ] 9
+[ 2 ] 8
+[ 2 ] 9
4 differences found
EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_70.txt b/tools/test/h5diff/testfiles/h5diff_70.txt
index 0a6b0c0..efa34ea 100644
--- a/tools/test/h5diff/testfiles/h5diff_70.txt
+++ b/tools/test/h5diff/testfiles/h5diff_70.txt
@@ -11,79 +11,79 @@ attribute: <VLstring of </>> and <VLstring of </>>
size: [2] [2]
position VLstring of </> VLstring of </> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <VLstring2D of </>> and <VLstring2D of </>>
size: [3x2] [3x2]
position VLstring2D of </> VLstring2D of </> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <VLstring3D of </>> and <VLstring3D of </>>
size: [4x3x2] [4x3x2]
position VLstring3D of </> VLstring3D of </> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <array of </>> and <array of </>>
size: [2] [2]
@@ -514,79 +514,79 @@ attribute: <string of </>> and <string of </>>
size: [2] [2]
position string of </> string of </> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <string2D of </>> and <string2D of </>>
size: [3x2] [3x2]
position string2D of </> string2D of </> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <string3D of </>> and <string3D of </>>
size: [4x3x2] [4x3x2]
position string3D of </> string3D of </> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <vlen of </>> and <vlen of </>>
size: [2] [2]
@@ -683,79 +683,79 @@ attribute: <VLstring of </dset>> and <VLstring of </dset>>
size: [2] [2]
position VLstring of </dset> VLstring of </dset> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <VLstring2D of </dset>> and <VLstring2D of </dset>>
size: [3x2] [3x2]
position VLstring2D of </dset> VLstring2D of </dset> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <VLstring3D of </dset>> and <VLstring3D of </dset>>
size: [4x3x2] [4x3x2]
position VLstring3D of </dset> VLstring3D of </dset> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <array of </dset>> and <array of </dset>>
size: [2] [2]
@@ -1192,79 +1192,79 @@ attribute: <string of </dset>> and <string of </dset>>
size: [2] [2]
position string of </dset> string of </dset> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <string2D of </dset>> and <string2D of </dset>>
size: [3x2] [3x2]
position string2D of </dset> string2D of </dset> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <string3D of </dset>> and <string3D of </dset>>
size: [4x3x2] [4x3x2]
position string3D of </dset> string3D of </dset> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <vlen of </dset>> and <vlen of </dset>>
size: [2] [2]
@@ -1360,79 +1360,79 @@ attribute: <VLstring of </g1>> and <VLstring of </g1>>
size: [2] [2]
position VLstring of </g1> VLstring of </g1> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <VLstring2D of </g1>> and <VLstring2D of </g1>>
size: [3x2] [3x2]
position VLstring2D of </g1> VLstring2D of </g1> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <VLstring3D of </g1>> and <VLstring3D of </g1>>
size: [4x3x2] [4x3x2]
position VLstring3D of </g1> VLstring3D of </g1> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <array of </g1>> and <array of </g1>>
size: [2] [2]
@@ -1863,79 +1863,79 @@ attribute: <string of </g1>> and <string of </g1>>
size: [2] [2]
position string of </g1> string of </g1> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <string2D of </g1>> and <string2D of </g1>>
size: [3x2] [3x2]
position string2D of </g1> string2D of </g1> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <string3D of </g1>> and <string3D of </g1>>
size: [4x3x2] [4x3x2]
position string3D of </g1> string3D of </g1> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <vlen of </g1>> and <vlen of </g1>>
size: [2] [2]
diff --git a/tools/test/h5diff/testfiles/h5diff_700.txt b/tools/test/h5diff/testfiles/h5diff_700.txt
index 1cf71dd..851a407 100644
--- a/tools/test/h5diff/testfiles/h5diff_700.txt
+++ b/tools/test/h5diff/testfiles/h5diff_700.txt
@@ -13,79 +13,79 @@ attribute: <VLstring of </>> and <VLstring of </>>
size: [2] [2]
position VLstring of </> VLstring of </> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <VLstring2D of </>> and <VLstring2D of </>>
size: [3x2] [3x2]
position VLstring2D of </> VLstring2D of </> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <VLstring3D of </>> and <VLstring3D of </>>
size: [4x3x2] [4x3x2]
position VLstring3D of </> VLstring3D of </> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <array of </>> and <array of </>>
size: [2] [2]
@@ -516,79 +516,79 @@ attribute: <string of </>> and <string of </>>
size: [2] [2]
position string of </> string of </> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <string2D of </>> and <string2D of </>>
size: [3x2] [3x2]
position string2D of </> string2D of </> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <string3D of </>> and <string3D of </>>
size: [4x3x2] [4x3x2]
position string3D of </> string3D of </> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <vlen of </>> and <vlen of </>>
size: [2] [2]
@@ -687,79 +687,79 @@ attribute: <VLstring of </dset>> and <VLstring of </dset>>
size: [2] [2]
position VLstring of </dset> VLstring of </dset> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <VLstring2D of </dset>> and <VLstring2D of </dset>>
size: [3x2] [3x2]
position VLstring2D of </dset> VLstring2D of </dset> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <VLstring3D of </dset>> and <VLstring3D of </dset>>
size: [4x3x2] [4x3x2]
position VLstring3D of </dset> VLstring3D of </dset> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <array of </dset>> and <array of </dset>>
size: [2] [2]
@@ -1196,79 +1196,79 @@ attribute: <string of </dset>> and <string of </dset>>
size: [2] [2]
position string of </dset> string of </dset> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <string2D of </dset>> and <string2D of </dset>>
size: [3x2] [3x2]
position string2D of </dset> string2D of </dset> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <string3D of </dset>> and <string3D of </dset>>
size: [4x3x2] [4x3x2]
position string3D of </dset> string3D of </dset> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <vlen of </dset>> and <vlen of </dset>>
size: [2] [2]
@@ -1366,79 +1366,79 @@ attribute: <VLstring of </g1>> and <VLstring of </g1>>
size: [2] [2]
position VLstring of </g1> VLstring of </g1> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <VLstring2D of </g1>> and <VLstring2D of </g1>>
size: [3x2] [3x2]
position VLstring2D of </g1> VLstring2D of </g1> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <VLstring3D of </g1>> and <VLstring3D of </g1>>
size: [4x3x2] [4x3x2]
position VLstring3D of </g1> VLstring3D of </g1> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <array of </g1>> and <array of </g1>>
size: [2] [2]
@@ -1869,79 +1869,79 @@ attribute: <string of </g1>> and <string of </g1>>
size: [2] [2]
position string of </g1> string of </g1> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <string2D of </g1>> and <string2D of </g1>>
size: [3x2] [3x2]
position string2D of </g1> string2D of </g1> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <string3D of </g1>> and <string3D of </g1>>
size: [4x3x2] [4x3x2]
position string3D of </g1> string3D of </g1> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <vlen of </g1>> and <vlen of </g1>>
size: [2] [2]
diff --git a/tools/test/h5diff/testfiles/h5diff_701.txt b/tools/test/h5diff/testfiles/h5diff_701.txt
index 405ab2f..33f1a0f 100644
--- a/tools/test/h5diff/testfiles/h5diff_701.txt
+++ b/tools/test/h5diff/testfiles/h5diff_701.txt
@@ -45,79 +45,79 @@ attribute: <VLstring of </>> and <VLstring of </>>
size: [2] [2]
position VLstring of </> VLstring of </> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <VLstring2D of </>> and <VLstring2D of </>>
size: [3x2] [3x2]
position VLstring2D of </> VLstring2D of </> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <VLstring3D of </>> and <VLstring3D of </>>
size: [4x3x2] [4x3x2]
position VLstring3D of </> VLstring3D of </> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <array of </>> and <array of </>>
size: [2] [2]
@@ -548,79 +548,79 @@ attribute: <string of </>> and <string of </>>
size: [2] [2]
position string of </> string of </> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <string2D of </>> and <string2D of </>>
size: [3x2] [3x2]
position string2D of </> string2D of </> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <string3D of </>> and <string3D of </>>
size: [4x3x2] [4x3x2]
position string3D of </> string3D of </> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <vlen of </>> and <vlen of </>>
size: [2] [2]
@@ -754,79 +754,79 @@ attribute: <VLstring of </dset>> and <VLstring of </dset>>
size: [2] [2]
position VLstring of </dset> VLstring of </dset> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <VLstring2D of </dset>> and <VLstring2D of </dset>>
size: [3x2] [3x2]
position VLstring2D of </dset> VLstring2D of </dset> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <VLstring3D of </dset>> and <VLstring3D of </dset>>
size: [4x3x2] [4x3x2]
position VLstring3D of </dset> VLstring3D of </dset> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <array of </dset>> and <array of </dset>>
size: [2] [2]
@@ -1263,79 +1263,79 @@ attribute: <string of </dset>> and <string of </dset>>
size: [2] [2]
position string of </dset> string of </dset> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <string2D of </dset>> and <string2D of </dset>>
size: [3x2] [3x2]
position string2D of </dset> string2D of </dset> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <string3D of </dset>> and <string3D of </dset>>
size: [4x3x2] [4x3x2]
position string3D of </dset> string3D of </dset> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <vlen of </dset>> and <vlen of </dset>>
size: [2] [2]
@@ -1465,79 +1465,79 @@ attribute: <VLstring of </g1>> and <VLstring of </g1>>
size: [2] [2]
position VLstring of </g1> VLstring of </g1> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <VLstring2D of </g1>> and <VLstring2D of </g1>>
size: [3x2] [3x2]
position VLstring2D of </g1> VLstring2D of </g1> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <VLstring3D of </g1>> and <VLstring3D of </g1>>
size: [4x3x2] [4x3x2]
position VLstring3D of </g1> VLstring3D of </g1> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <array of </g1>> and <array of </g1>>
size: [2] [2]
@@ -1968,79 +1968,79 @@ attribute: <string of </g1>> and <string of </g1>>
size: [2] [2]
position string of </g1> string of </g1> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <string2D of </g1>> and <string2D of </g1>>
size: [3x2] [3x2]
position string2D of </g1> string2D of </g1> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <string3D of </g1>> and <string3D of </g1>>
size: [4x3x2] [4x3x2]
position string3D of </g1> string3D of </g1> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <vlen of </g1>> and <vlen of </g1>>
size: [2] [2]
diff --git a/tools/test/h5diff/testfiles/h5diff_702.txt b/tools/test/h5diff/testfiles/h5diff_702.txt
index 1cf71dd..851a407 100644
--- a/tools/test/h5diff/testfiles/h5diff_702.txt
+++ b/tools/test/h5diff/testfiles/h5diff_702.txt
@@ -13,79 +13,79 @@ attribute: <VLstring of </>> and <VLstring of </>>
size: [2] [2]
position VLstring of </> VLstring of </> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <VLstring2D of </>> and <VLstring2D of </>>
size: [3x2] [3x2]
position VLstring2D of </> VLstring2D of </> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <VLstring3D of </>> and <VLstring3D of </>>
size: [4x3x2] [4x3x2]
position VLstring3D of </> VLstring3D of </> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <array of </>> and <array of </>>
size: [2] [2]
@@ -516,79 +516,79 @@ attribute: <string of </>> and <string of </>>
size: [2] [2]
position string of </> string of </> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <string2D of </>> and <string2D of </>>
size: [3x2] [3x2]
position string2D of </> string2D of </> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <string3D of </>> and <string3D of </>>
size: [4x3x2] [4x3x2]
position string3D of </> string3D of </> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <vlen of </>> and <vlen of </>>
size: [2] [2]
@@ -687,79 +687,79 @@ attribute: <VLstring of </dset>> and <VLstring of </dset>>
size: [2] [2]
position VLstring of </dset> VLstring of </dset> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <VLstring2D of </dset>> and <VLstring2D of </dset>>
size: [3x2] [3x2]
position VLstring2D of </dset> VLstring2D of </dset> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <VLstring3D of </dset>> and <VLstring3D of </dset>>
size: [4x3x2] [4x3x2]
position VLstring3D of </dset> VLstring3D of </dset> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <array of </dset>> and <array of </dset>>
size: [2] [2]
@@ -1196,79 +1196,79 @@ attribute: <string of </dset>> and <string of </dset>>
size: [2] [2]
position string of </dset> string of </dset> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <string2D of </dset>> and <string2D of </dset>>
size: [3x2] [3x2]
position string2D of </dset> string2D of </dset> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <string3D of </dset>> and <string3D of </dset>>
size: [4x3x2] [4x3x2]
position string3D of </dset> string3D of </dset> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <vlen of </dset>> and <vlen of </dset>>
size: [2] [2]
@@ -1366,79 +1366,79 @@ attribute: <VLstring of </g1>> and <VLstring of </g1>>
size: [2] [2]
position VLstring of </g1> VLstring of </g1> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <VLstring2D of </g1>> and <VLstring2D of </g1>>
size: [3x2] [3x2]
position VLstring2D of </g1> VLstring2D of </g1> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <VLstring3D of </g1>> and <VLstring3D of </g1>>
size: [4x3x2] [4x3x2]
position VLstring3D of </g1> VLstring3D of </g1> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <array of </g1>> and <array of </g1>>
size: [2] [2]
@@ -1869,79 +1869,79 @@ attribute: <string of </g1>> and <string of </g1>>
size: [2] [2]
position string of </g1> string of </g1> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <string2D of </g1>> and <string2D of </g1>>
size: [3x2] [3x2]
position string2D of </g1> string2D of </g1> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <string3D of </g1>> and <string3D of </g1>>
size: [4x3x2] [4x3x2]
position string3D of </g1> string3D of </g1> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <vlen of </g1>> and <vlen of </g1>>
size: [2] [2]
diff --git a/tools/test/h5diff/testfiles/h5diff_703.txt b/tools/test/h5diff/testfiles/h5diff_703.txt
index 405ab2f..33f1a0f 100644
--- a/tools/test/h5diff/testfiles/h5diff_703.txt
+++ b/tools/test/h5diff/testfiles/h5diff_703.txt
@@ -45,79 +45,79 @@ attribute: <VLstring of </>> and <VLstring of </>>
size: [2] [2]
position VLstring of </> VLstring of </> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <VLstring2D of </>> and <VLstring2D of </>>
size: [3x2] [3x2]
position VLstring2D of </> VLstring2D of </> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <VLstring3D of </>> and <VLstring3D of </>>
size: [4x3x2] [4x3x2]
position VLstring3D of </> VLstring3D of </> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <array of </>> and <array of </>>
size: [2] [2]
@@ -548,79 +548,79 @@ attribute: <string of </>> and <string of </>>
size: [2] [2]
position string of </> string of </> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <string2D of </>> and <string2D of </>>
size: [3x2] [3x2]
position string2D of </> string2D of </> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <string3D of </>> and <string3D of </>>
size: [4x3x2] [4x3x2]
position string3D of </> string3D of </> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <vlen of </>> and <vlen of </>>
size: [2] [2]
@@ -754,79 +754,79 @@ attribute: <VLstring of </dset>> and <VLstring of </dset>>
size: [2] [2]
position VLstring of </dset> VLstring of </dset> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <VLstring2D of </dset>> and <VLstring2D of </dset>>
size: [3x2] [3x2]
position VLstring2D of </dset> VLstring2D of </dset> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <VLstring3D of </dset>> and <VLstring3D of </dset>>
size: [4x3x2] [4x3x2]
position VLstring3D of </dset> VLstring3D of </dset> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <array of </dset>> and <array of </dset>>
size: [2] [2]
@@ -1263,79 +1263,79 @@ attribute: <string of </dset>> and <string of </dset>>
size: [2] [2]
position string of </dset> string of </dset> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <string2D of </dset>> and <string2D of </dset>>
size: [3x2] [3x2]
position string2D of </dset> string2D of </dset> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <string3D of </dset>> and <string3D of </dset>>
size: [4x3x2] [4x3x2]
position string3D of </dset> string3D of </dset> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <vlen of </dset>> and <vlen of </dset>>
size: [2] [2]
@@ -1465,79 +1465,79 @@ attribute: <VLstring of </g1>> and <VLstring of </g1>>
size: [2] [2]
position VLstring of </g1> VLstring of </g1> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <VLstring2D of </g1>> and <VLstring2D of </g1>>
size: [3x2] [3x2]
position VLstring2D of </g1> VLstring2D of </g1> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <VLstring3D of </g1>> and <VLstring3D of </g1>>
size: [4x3x2] [4x3x2]
position VLstring3D of </g1> VLstring3D of </g1> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <array of </g1>> and <array of </g1>>
size: [2] [2]
@@ -1968,79 +1968,79 @@ attribute: <string of </g1>> and <string of </g1>>
size: [2] [2]
position string of </g1> string of </g1> difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
attribute: <string2D of </g1>> and <string2D of </g1>>
size: [3x2] [3x2]
position string2D of </g1> string2D of </g1> difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
attribute: <string3D of </g1>> and <string3D of </g1>>
size: [4x3x2] [4x3x2]
position string3D of </g1> string3D of </g1> difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
attribute: <vlen of </g1>> and <vlen of </g1>>
size: [2] [2]
diff --git a/tools/test/h5diff/testfiles/h5diff_80.txt b/tools/test/h5diff/testfiles/h5diff_80.txt
index 836e073..b223eed 100644
--- a/tools/test/h5diff/testfiles/h5diff_80.txt
+++ b/tools/test/h5diff/testfiles/h5diff_80.txt
@@ -59,79 +59,79 @@ dataset: </g1/VLstring> and </g1/VLstring>
size: [2] [2]
position VLstring VLstring difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
dataset: </g1/VLstring2D> and </g1/VLstring2D>
size: [3x2] [3x2]
position VLstring2D VLstring2D difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
dataset: </g1/VLstring3D> and </g1/VLstring3D>
size: [4x3x2] [4x3x2]
position VLstring3D VLstring3D difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
dataset: </g1/array> and </g1/array>
size: [2] [2]
@@ -702,79 +702,79 @@ dataset: </g1/string> and </g1/string>
size: [2] [2]
position string string difference
------------------------------------------------------------
-[ 0 ] a z
-[ 0 ] b z
-[ 1 ] d z
-[ 1 ] e z
+[ 0 ] z a
+[ 0 ] z b
+[ 1 ] z d
+[ 1 ] z e
4 differences found
dataset: </g1/string2D> and </g1/string2D>
size: [3x2] [3x2]
position string2D string2D difference
------------------------------------------------------------
-[ 0 0 ] a z
-[ 0 0 ] b z
-[ 0 1 ] c z
-[ 0 1 ] d z
-[ 1 0 ] e z
-[ 1 0 ] f z
-[ 1 1 ] g z
-[ 1 1 ] h z
-[ 2 0 ] i z
-[ 2 0 ] j z
-[ 2 1 ] k z
-[ 2 1 ] l z
+[ 0 0 ] z a
+[ 0 0 ] z b
+[ 0 1 ] z c
+[ 0 1 ] z d
+[ 1 0 ] z e
+[ 1 0 ] z f
+[ 1 1 ] z g
+[ 1 1 ] z h
+[ 2 0 ] z i
+[ 2 0 ] z j
+[ 2 1 ] z k
+[ 2 1 ] z l
12 differences found
dataset: </g1/string3D> and </g1/string3D>
size: [4x3x2] [4x3x2]
position string3D string3D difference
------------------------------------------------------------
-[ 0 0 0 ] a z
-[ 0 0 0 ] b z
-[ 0 0 1 ] c z
-[ 0 0 1 ] d z
-[ 0 1 0 ] e z
-[ 0 1 0 ] f z
-[ 0 1 1 ] g z
-[ 0 1 1 ] h z
-[ 0 2 0 ] i z
-[ 0 2 0 ] j z
-[ 0 2 1 ] k z
-[ 0 2 1 ] l z
-[ 1 0 0 ] m z
-[ 1 0 0 ] n z
-[ 1 0 1 ] p z
-[ 1 0 1 ] q z
-[ 1 1 0 ] r z
-[ 1 1 0 ] s z
-[ 1 1 1 ] t z
-[ 1 1 1 ] u z
-[ 1 2 0 ] v z
-[ 1 2 0 ] w z
-[ 1 2 1 ] x z
-[ 2 0 0 ] A z
-[ 2 0 0 ] B z
-[ 2 0 1 ] C z
-[ 2 0 1 ] D z
-[ 2 1 0 ] E z
-[ 2 1 0 ] F z
-[ 2 1 1 ] G z
-[ 2 1 1 ] H z
-[ 2 2 0 ] I z
-[ 2 2 0 ] J z
-[ 2 2 1 ] K z
-[ 2 2 1 ] L z
-[ 3 0 0 ] M z
-[ 3 0 0 ] N z
-[ 3 0 1 ] P z
-[ 3 0 1 ] Q z
-[ 3 1 0 ] R z
-[ 3 1 0 ] S z
-[ 3 1 1 ] T z
-[ 3 1 1 ] U z
-[ 3 2 0 ] V z
-[ 3 2 0 ] W z
-[ 3 2 1 ] X z
-[ 3 2 1 ] Z z
+[ 0 0 0 ] z a
+[ 0 0 0 ] z b
+[ 0 0 1 ] z c
+[ 0 0 1 ] z d
+[ 0 1 0 ] z e
+[ 0 1 0 ] z f
+[ 0 1 1 ] z g
+[ 0 1 1 ] z h
+[ 0 2 0 ] z i
+[ 0 2 0 ] z j
+[ 0 2 1 ] z k
+[ 0 2 1 ] z l
+[ 1 0 0 ] z m
+[ 1 0 0 ] z n
+[ 1 0 1 ] z p
+[ 1 0 1 ] z q
+[ 1 1 0 ] z r
+[ 1 1 0 ] z s
+[ 1 1 1 ] z t
+[ 1 1 1 ] z u
+[ 1 2 0 ] z v
+[ 1 2 0 ] z w
+[ 1 2 1 ] z x
+[ 2 0 0 ] z A
+[ 2 0 0 ] z B
+[ 2 0 1 ] z C
+[ 2 0 1 ] z D
+[ 2 1 0 ] z E
+[ 2 1 0 ] z F
+[ 2 1 1 ] z G
+[ 2 1 1 ] z H
+[ 2 2 0 ] z I
+[ 2 2 0 ] z J
+[ 2 2 1 ] z K
+[ 2 2 1 ] z L
+[ 3 0 0 ] z M
+[ 3 0 0 ] z N
+[ 3 0 1 ] z P
+[ 3 0 1 ] z Q
+[ 3 1 0 ] z R
+[ 3 1 0 ] z S
+[ 3 1 1 ] z T
+[ 3 1 1 ] z U
+[ 3 2 0 ] z V
+[ 3 2 0 ] z W
+[ 3 2 1 ] z X
+[ 3 2 1 ] z Z
47 differences found
dataset: </g1/vlen> and </g1/vlen>
size: [2] [2]
diff --git a/tools/test/h5diff/testfiles/h5diff_udfail.txt b/tools/test/h5diff/testfiles/h5diff_udfail.txt
index c154c6b..d51de38 100644
--- a/tools/test/h5diff/testfiles/h5diff_udfail.txt
+++ b/tools/test/h5diff/testfiles/h5diff_udfail.txt
@@ -8,5 +8,5 @@ group : </> and </>
0 differences found
dataset: </dynlibud> and </dynlibud>
0 differences found
-warning: dataset </dynlibud> cannot be read, user defined filter is not available
+Warning: dataset </dynlibud> cannot be read, user defined filter is not available
EXIT CODE: 2
diff --git a/tools/test/h5dump/Makefile.am b/tools/test/h5dump/Makefile.am
index 1454987..a7a2bcb 100644
--- a/tools/test/h5dump/Makefile.am
+++ b/tools/test/h5dump/Makefile.am
@@ -41,10 +41,7 @@ if HAVE_SHARED_CONDITIONAL
# Build it as shared library if configure is enabled for shared library.
noinst_LTLIBRARIES=libdynlibdump.la
libdynlibdump_la_SOURCES=dynlib_dump.c
- libdynlibdump_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
-
- libdynlibdump.la: $(libdynlibdump_la_OBJECTS) $(libdynlibdump_la_DEPENDENCIES) $(EXTRA_libdynlibdump_la_DEPENDENCIES)
- $(AM_V_CCLD)$(libdynlibdump_la_LINK) $(am_libdynlibdump_la_rpath) $(libdynlibdump_la_OBJECTS) $(libdynlibdump_la_LIBADD)
+ libdynlibdump_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere
endif
# Temporary files. *.h5 are generated by h5dumpgentest. They should
diff --git a/tools/test/h5format_convert/CMakeTests.cmake b/tools/test/h5format_convert/CMakeTests.cmake
index 4af220b..2240813 100644
--- a/tools/test/h5format_convert/CMakeTests.cmake
+++ b/tools/test/h5format_convert/CMakeTests.cmake
@@ -47,6 +47,7 @@
old_h5fc_ext2_sf.ddl
old_h5fc_ext3_isf.ddl
h5fc_v_err.ddl
+ h5fc_v_err.ddl.err
)
set (HDF5_REFERENCE_TEST_FILES
h5fc_non_v3.h5
@@ -140,6 +141,62 @@
endif ()
endmacro ()
+ macro (ADD_H5_MASK_OUTPUT testname resultfile resultcode testfile)
+ # If using memchecker add tests without using scripts
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5FC-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ./testfiles/outtmp.h5
+ ./testfiles/${testname}.out
+ ./testfiles/${testname}.out.err
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ endif ()
+ if (NOT "${testfile}" STREQUAL "")
+ add_test (
+ NAME H5FC-${testname}-${testfile}-tmpfile
+ COMMAND ${CMAKE_COMMAND}
+ -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5
+ )
+ set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects")
+ add_test (
+ NAME H5FC-${testname}-${testfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>"
+ -D "TEST_ARGS=${ARGN};outtmp.h5"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${testname}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}"
+ -D "TEST_ERRREF=${resultfile}.err"
+ -D "TEST_MASK_ERROR=true"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile")
+ set (last_test "H5FC-${testname}-${testfile}")
+ else ()
+ add_test (
+ NAME H5FC-${testname}-NA
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>"
+ -D "TEST_ARGS=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${testname}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}"
+ -D "TEST_ERRREF=${resultfile}.err"
+ -D "TEST_MASK_ERROR=true"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5FC-${testname}-NA PROPERTIES DEPENDS "H5FC-${testname}-clear-objects")
+ set (last_test "H5FC-${testname}-NA")
+ endif ()
+ endif ()
+ endmacro ()
+
macro (ADD_H5_TEST testname resultcode testfile)
# If using memchecker add tests without using scripts
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
@@ -391,7 +448,7 @@
#
#
# h5format_convert -v h5fc_err_level.h5 (error encountered in converting the dataset)
- ADD_H5_OUTPUT (h5fc_v_err h5fc_v_err.ddl 1 h5fc_err_level.h5 -v)
+ ADD_H5_MASK_OUTPUT (h5fc_v_err h5fc_v_err.ddl 1 h5fc_err_level.h5 -v)
#
#
#
diff --git a/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl b/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl
index b671db0..0b7d0ac 100644
--- a/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl
+++ b/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl
@@ -10,4 +10,3 @@ Dataset's chunk indexing type is not version 1 B-tree
Converting the dataset...
Error encountered
Close the file
-h5format_convert error: unable to downgrade dataset "/DSET_ERR"
diff --git a/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl.err b/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl.err
new file mode 100644
index 0000000..d85a999
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl.err
@@ -0,0 +1,8 @@
+h5format_convert error: unable to downgrade dataset "/DSET_ERR"
+H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
+ #000: (file name) line (number) in h5trav_visit(): traverse failed
+ major: Failure in tools library
+ minor: error in function
+ #001: (file name) line (number) in traverse(): H5Lvisit_by_name failed
+ major: Failure in tools library
+ minor: error in function
diff --git a/tools/test/h5format_convert/testh5fc.sh.in b/tools/test/h5format_convert/testh5fc.sh.in
index c3056e8..585d389 100644
--- a/tools/test/h5format_convert/testh5fc.sh.in
+++ b/tools/test/h5format_convert/testh5fc.sh.in
@@ -32,8 +32,8 @@ EXIT_FAILURE=1
FORMCONV=../../src/h5format_convert/h5format_convert # The tool name
FORMCONV_BIN=`pwd`/$FORMCONV # The path of the tool binary
-CHK_IDX=h5fc_chk_idx # The program name
-CHK_IDX_BIN=`pwd`/$CHK_IDX # The program to verify the chunk indexing type is v1 B-tree
+CHK_IDX=h5fc_chk_idx # The program name
+CHK_IDX_BIN=`pwd`/$CHK_IDX # The program to verify the chunk indexing type is v1 B-tree
RM='rm -rf'
CMP='cmp -s'
@@ -131,6 +131,7 @@ $SRC_H5FORMCONV_TESTFILES/old_h5fc_ext2_is.ddl
$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext2_sf.ddl
$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext3_isf.ddl
$SRC_H5FORMCONV_TESTFILES/h5fc_v_err.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_v_err.ddl.err
"
#
@@ -154,10 +155,10 @@ COPY_TESTFILES_TO_TESTDIR()
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
- $CP -f $tstfile $TESTDIR
+ $CP -f $tstfile $TESTDIR
if [ $? -ne 0 ]; then
echo "Error: FAILED to copy $tstfile ."
-
+
# Comment out this to CREATE expected file
exit $EXIT_FAILURE
fi
@@ -177,7 +178,7 @@ CLEAN_TESTFILES_AND_TESTDIR()
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
$RM $TESTDIR
else
- $RM $TESTDIR/$TMPFILE
+ $RM $TESTDIR/$TMPFILE
$RM $TESTDIR/$TMPOUTFILE
$RM $TESTDIR/$TMPCHKFILE
$RM $TESTDIR/$TMPDMPFILE
@@ -201,13 +202,13 @@ TESTING() {
# non-zero value.
#
# $1: expected output
-# $2: the test file name
-# --fname might be empty or fname does not exist
-# --fname is copied to a temporary file for testing
+# $2: the test file name
+# --fname might be empty or fname does not exist
+# --fname is copied to a temporary file for testing
# $3 to at most $6--options to the tool such as:
-# -d dname or --dname=dname
-# -v or --verbose
-# -n or --noop
+# -d dname or --dname=dname
+# -v or --verbose
+# -n or --noop
TOOLTEST_OUT() {
# Prepare expected and actual output
expect="$TESTDIR/$1"
@@ -220,15 +221,15 @@ TOOLTEST_OUT() {
$RM $TESTDIR/$TMPOUTFILE
TFILE=$2
if [ ! -z "$2" ] && [ -e $TESTDIR/$2 ] ; then
- $CP $TESTDIR/$2 $TESTDIR/$TMPOUTFILE
- TFILE=$TMPOUTFILE
+ $CP $TESTDIR/$2 $TESTDIR/$TMPOUTFILE
+ TFILE=$TMPOUTFILE
fi
# Run test.
TESTING $FORMCONV $3 $4 $5 $6 $2
(
- cd $TESTDIR
- $RUNSERIAL $FORMCONV_BIN $3 $4 $5 $6 $TFILE
+ cd $TESTDIR
+ $RUNSERIAL $FORMCONV_BIN $3 $4 $5 $6 $TFILE
) >$actual 2>$actual_err
cp $actual $actual_sav
cp $actual_err $actual_err_sav
@@ -239,20 +240,81 @@ TOOLTEST_OUT() {
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- $RM $actual $actual_err
- $RM $actual $actual_err $actual_sav $actual_err_sav
+ $RM $actual $actual_err
+ $RM $actual $actual_err $actual_sav $actual_err_sav
+ fi
+}
+# Same as TOOLTEST_OUT but filters error stack output and compares to an error file
+TOOLTEST_MASK_OUT() {
+ # Prepare expected and actual output
+ expect="$TESTDIR/$1"
+ expect_err="$TESTDIR/$1.err"
+ actual_ext="$TESTDIR/$1.ext"
+ actual="$TESTDIR/`basename $1 .ddl`.out"
+ actual_err="$TESTDIR/`basename $1 .ddl`.err"
+ actual_sav=${actual}-sav
+ actual_err_sav=${actual_err}-sav
+
+ # Prepare the test file
+ $RM $TESTDIR/$TMPOUTFILE
+ TFILE=$2
+ if [ ! -z "$2" ] && [ -e $TESTDIR/$2 ] ; then
+ $CP $TESTDIR/$2 $TESTDIR/$TMPOUTFILE
+ TFILE=$TMPOUTFILE
+ fi
+
+ # Run test.
+ TESTING $FORMCONV $3 $4 $5 $6 $2
+ (
+ cd $TESTDIR
+ $RUNSERIAL $FORMCONV_BIN $3 $4 $5 $6 $TFILE
+ ) >$actual 2>$actual_err
+ cp $actual $actual_sav
+ cp $actual_err $actual_err_sav
+ STDERR_FILTER $actual_err
+
+ # Extract file name, line number, version and thread IDs because they may be different
+ sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \
+ -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \
+ $actual_err > $actual_ext
+
+ # Compare output
+ if $CMP $expect $actual; then
+ if $CMP $expect_err $actual_ext; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.err) differs from actual result (*.oerr)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /'
+ fi
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ $RM $actual $actual_err
+ $RM $actual $actual_err $actual_sav $actual_err_sav
fi
}
-# To check that the tool exits success, no output
+# To check that the tool exits success, no output
# Assume all short options
-# $1 is the test file name
-# --fname exists
-# --fname is copied to a temporary file for testing
-# $2 is the temporary file name
+# $1 is the test file name
+# --fname exists
+# --fname is copied to a temporary file for testing
+# $2 is the temporary file name
# $3 to at most $5--options to the tool such as:
-# -d dname
-# -n
+# -d dname
+# -n
TOOLTEST() {
TESTING $FORMCONV $3 $4 $5 $1
$RM $TESTDIR/$2
@@ -260,11 +322,11 @@ TOOLTEST() {
$RUNSERIAL $FORMCONV_BIN $3 $4 $5 $TESTDIR/$2
exitcode=$?
if [ $exitcode -ne 0 ]; then
- echo "*FAILED*"
- echo " The tool exits failure"
- nerrors="`expr $nerrors + 1`"
+ echo "*FAILED*"
+ echo " The tool exits failure"
+ nerrors="`expr $nerrors + 1`"
else
- echo " PASSED"
+ echo " PASSED"
fi
}
@@ -280,11 +342,11 @@ IDX_CHECK() {
$RUNSERIAL $CHK_IDX_BIN $TESTDIR/$TMPCHKFILE $1
ret=$?
if [ $ret -eq 0 ]; then
- echo " PASSED"
+ echo " PASSED"
else
- echo "*FAILED*"
- echo " The chunk indexing type is not correct"
- nerrors="`expr $nerrors + 1`"
+ echo "*FAILED*"
+ echo " The chunk indexing type is not correct"
+ nerrors="`expr $nerrors + 1`"
fi
}
@@ -317,7 +379,7 @@ H5DUMP_CHECK() {
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- $RM $actual $actual_err
+ $RM $actual $actual_err
fi
}
@@ -326,12 +388,12 @@ SKIP() {
TESTING $STAT $@
echo " -SKIP-"
}
-
+
##############################################################################
##############################################################################
-### T H E T E S T S ###
+### T H E T E S T S ###
##############################################################################
##############################################################################
# prepare for test
@@ -377,7 +439,7 @@ TOOLTEST_OUT h5fc_v_n_all.ddl h5fc_non_v3.h5 -v -n
#
#
# h5format_convert -v h5fc_err_level.h5 (error encountered in converting the dataset)
-TOOLTEST_OUT h5fc_v_err.ddl h5fc_err_level.h5 -v
+TOOLTEST_MASK_OUT h5fc_v_err.ddl h5fc_err_level.h5 -v
#
#
#
@@ -436,7 +498,7 @@ TOOLTEST h5fc_non_v3.h5 $TMPFILE -n
#
# No output from tests: just check exit code
# h5format_convert h5fc_non_v3.h5
-# 1) convert all datasets
+# 1) convert all datasets
# 2) verify indexing types
TOOLTEST h5fc_non_v3.h5 $TMPCHKFILE
IDX_CHECK /DSET_NDATA_EA
diff --git a/tools/test/h5ls/Makefile.am b/tools/test/h5ls/Makefile.am
index ec8b8c3..f5ec0f7 100644
--- a/tools/test/h5ls/Makefile.am
+++ b/tools/test/h5ls/Makefile.am
@@ -38,10 +38,7 @@ if HAVE_SHARED_CONDITIONAL
# Build it as shared library if configure is enabled for shared library.
noinst_LTLIBRARIES=libdynlibls.la
libdynlibls_la_SOURCES=dynlib_ls.c
- libdynlibls_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
-
- libdynlibls.la: $(libdynlibls_la_OBJECTS) $(libdynlibls_la_DEPENDENCIES) $(EXTRA_libdynlibls_la_DEPENDENCIES)
- $(AM_V_CCLD)$(libdynlibls_la_LINK) $(am_libdynlibls_la_rpath) $(libdynlibls_la_OBJECTS) $(libdynlibls_la_LIBADD)
+ libdynlibls_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere
endif
diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake
index 559dd88..13ebd17 100644
--- a/tools/test/h5repack/CMakeTests.cmake
+++ b/tools/test/h5repack/CMakeTests.cmake
@@ -275,12 +275,12 @@
endif ()
add_test (
NAME H5REPACK-${testname}
- COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND $<TARGET_FILE:h5repack> --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
)
set_tests_properties (H5REPACK-${testname} PROPERTIES DEPENDS H5REPACK-${testname}-clear-objects)
add_test (
NAME H5REPACK-${testname}_DFF
- COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND $<TARGET_FILE:h5diff> --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
)
set_tests_properties (H5REPACK-${testname}_DFF PROPERTIES DEPENDS H5REPACK-${testname})
endif ()
diff --git a/tools/test/h5repack/Makefile.am b/tools/test/h5repack/Makefile.am
index d4dc843..ce7cad4 100644
--- a/tools/test/h5repack/Makefile.am
+++ b/tools/test/h5repack/Makefile.am
@@ -48,13 +48,8 @@ if HAVE_SHARED_CONDITIONAL
noinst_LTLIBRARIES=libdynlibadd.la libdynlibvers.la
libdynlibadd_la_SOURCES=dynlib_rpk.c
libdynlibvers_la_SOURCES=dynlib_vrpk.c
- libdynlibadd_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
- libdynlibvers_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
-
- libdynlibadd.la: $(libdynlibadd_la_OBJECTS) $(libdynlibadd_la_DEPENDENCIES) $(EXTRA_libdynlibadd_la_DEPENDENCIES)
- $(AM_V_CCLD)$(libdynlibadd_la_LINK) $(am_libdynlibadd_la_rpath) $(libdynlibadd_la_OBJECTS) $(libdynlibadd_la_LIBADD)
- libdynlibvers.la: $(libdynlibvers_la_OBJECTS) $(libdynlibvers_la_DEPENDENCIES) $(EXTRA_libdynlibvers_la_DEPENDENCIES)
- $(AM_V_CCLD)$(libdynlibvers_la_LINK) $(am_libdynlibvers_la_rpath) $(libdynlibvers_la_OBJECTS) $(libdynlibvers_la_LIBADD)
+ libdynlibadd_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere
+ libdynlibvers_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere
endif
diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c
index 264550e..f6166da 100644
--- a/tools/test/h5repack/h5repacktst.c
+++ b/tools/test/h5repack/h5repacktst.c
@@ -3041,9 +3041,9 @@ int make_all_filters(hid_t loc_id)
/* close */
if(H5Tclose(dtid) < 0)
- return -1;
+ goto out;
if(H5Dclose(dsid) < 0)
- return -1;
+ goto out;
if(H5Sclose(sid) < 0)
goto out;
@@ -3055,6 +3055,8 @@ int make_all_filters(hid_t loc_id)
out:
H5E_BEGIN_TRY
{
+ H5Tclose(dtid);
+ H5Dclose(dsid);
H5Pclose(dcpl);
H5Sclose(sid);
} H5E_END_TRY;
diff --git a/tools/test/h5repack/testfiles/h5repack-help.txt b/tools/test/h5repack/testfiles/h5repack-help.txt
index 1ff5b73..77e2178 100644
--- a/tools/test/h5repack/testfiles/h5repack-help.txt
+++ b/tools/test/h5repack/testfiles/h5repack-help.txt
@@ -7,6 +7,9 @@ usage: h5repack [OPTIONS] file1 file2
-V, --version Print version number and exit
-n, --native Use a native HDF5 type when repacking
-L, --latest Use latest version of file format
+ This option will take precedence over the -j and -k options
+ -j, --low The low bound as in H5Pset_libver_bounds()
+ -k, --high The high bound as in H5Pset_libver_bounds()
-c L1, --compact=L1 Maximum number of links in header messages
-d L2, --indexed=L2 Minimum number of links in the indexed format
-s S[:F], --ssize=S[:F] Shared object header message minimum size
diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake
index b9095fb..942ae7a 100644
--- a/tools/test/misc/CMakeTestsClear.cmake
+++ b/tools/test/misc/CMakeTestsClear.cmake
@@ -55,6 +55,8 @@
##############################################################################
##############################################################################
+ # Need special dependencies for tests that use the same reference file
+ # This is an issue on Windows
macro (ADD_H5_CMP testname resultfile resultcode)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
@@ -64,6 +66,9 @@
testfiles/${testname}.out
testfiles/${testname}.out.err
)
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ endif ()
add_test (
NAME H5CLEAR_CMP-${testname}
COMMAND "${CMAKE_COMMAND}"
@@ -76,6 +81,7 @@
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES DEPENDS H5CLEAR_CMP-${testname}-clear-objects)
+ set (last_test "H5CLEAR_CMP-${testname}")
endif ()
endmacro ()
diff --git a/tools/test/perform/CMakeTests.cmake b/tools/test/perform/CMakeTests.cmake
index 2bd8d46..450667a 100644
--- a/tools/test/perform/CMakeTests.cmake
+++ b/tools/test/perform/CMakeTests.cmake
@@ -167,13 +167,12 @@ else ()
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
-set_tests_properties (PERFORM_zip_perf PROPERTIES DEPENDS PERFORM_zip_perf_help)
-set_tests_properties (PERFORM_zip_perf PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects")
+set_tests_properties (PERFORM_zip_perf PROPERTIES DEPENDS "PERFORM_zip_perf_help;PERFORM_h5perform-clearall-objects")
if (H5_HAVE_PARALLEL)
- add_test (NAME PERFORM_h5perf COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:h5perf>)
+ add_test (NAME PERFORM_h5perf COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:h5perf> ${MPIEXEC_POSTFLAGS})
if (HDF5_BUILD_PERFORM_STANDALONE)
- add_test (NAME PERFORM_h5perf_alone COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:h5perf_alone>)
+ add_test (NAME PERFORM_h5perf_alone COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:h5perf_alone> ${MPIEXEC_POSTFLAGS})
endif ()
endif ()