summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorM. Scot Breitenfeld <brtnfld@hdfgroup.org>2017-11-28 19:59:33 (GMT)
committerM. Scot Breitenfeld <brtnfld@hdfgroup.org>2017-11-28 19:59:33 (GMT)
commit2df6fa758f6ddf68507950b4ce5071a388548595 (patch)
treed1dad8872f468d3c343b7e5dde83a3078a94e954
parent836fdd5c0e88b6ab524b5ffb76ce75fb8717248e (diff)
parent4d4eb4cd5cc64d47f46fd944fd9b9548d38c86be (diff)
downloadhdf5-2df6fa758f6ddf68507950b4ce5071a388548595.zip
hdf5-2df6fa758f6ddf68507950b4ce5071a388548595.tar.gz
hdf5-2df6fa758f6ddf68507950b4ce5071a388548595.tar.bz2
Merge branch 'develop' into multi_rd_wd_coll_io_merge
-rw-r--r--CMakeFilters.cmake16
-rw-r--r--CMakeLists.txt1
-rw-r--r--MANIFEST14
-rw-r--r--config/cmake_ext_mod/HDFMacros.cmake1
-rw-r--r--config/conclude.am84
-rw-r--r--configure.ac17
-rw-r--r--examples/h5_cmprss.c1
-rw-r--r--fortran/src/CMakeLists.txt10
-rw-r--r--hl/tools/h5watch/h5watch.c1
-rw-r--r--release_docs/RELEASE.txt43
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/H5Dchunk.c78
-rw-r--r--src/H5Dcompact.c2
-rw-r--r--src/H5Dcontig.c2
-rw-r--r--src/H5Dint.c860
-rw-r--r--src/H5Dio.c4
-rw-r--r--src/H5Dpkg.h138
-rw-r--r--src/H5Dprivate.h34
-rw-r--r--src/H5F.c694
-rw-r--r--src/H5FSint.c3
-rw-r--r--src/H5Fint.c787
-rw-r--r--src/H5Fquery.c625
-rw-r--r--src/H5Gnode.c6
-rw-r--r--src/H5HFcache.c88
-rw-r--r--src/H5HFhuge.c12
-rw-r--r--src/H5MF.c5
-rw-r--r--src/H5MM.c8
-rw-r--r--src/H5O.c2686
-rw-r--r--src/H5Oalloc.c15
-rw-r--r--src/H5Oint.c2713
-rw-r--r--src/H5Oprivate.h7
-rw-r--r--src/H5PLint.c62
-rw-r--r--src/H5PLpath.c4
-rw-r--r--src/H5PLpkg.h8
-rw-r--r--src/H5PLplugin_cache.c18
-rw-r--r--src/H5PLprivate.h7
-rw-r--r--src/H5PLpublic.h6
-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/H5Sprivate.h4
-rw-r--r--src/H5Tdbg.c227
-rw-r--r--src/H5Tprivate.h4
-rw-r--r--src/H5Z.c605
-rw-r--r--src/H5Zprivate.h7
-rw-r--r--src/H5Zpublic.h20
-rw-r--r--src/H5Zszip.c46
-rw-r--r--src/H5system.c2
-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/cache_tagging.c13
-rw-r--r--test/cross_read.c2
-rw-r--r--test/dsets.c2
-rw-r--r--test/dynlib1.c95
-rw-r--r--test/dynlib2.c92
-rw-r--r--test/dynlib3.c103
-rw-r--r--test/dynlib4.c102
-rw-r--r--test/error_test.c416
-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/tarray.c24
-rw-r--r--test/tattr.c904
-rw-r--r--test/tchecksum.c2
-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/testfiles/error_test_15
-rw-r--r--test/testhdf5.h209
-rw-r--r--test/tfile.c6
-rw-r--r--test/th5o.c4
-rw-r--r--test/theap.c42
-rw-r--r--test/tid.c348
-rw-r--r--test/titerate.c18
-rw-r--r--test/tmisc.c98
-rw-r--r--test/trefstr.c32
-rw-r--r--test/tselect.c130
-rw-r--r--test/tskiplist.c156
-rw-r--r--test/ttst.c18
-rw-r--r--test/tvltypes.c6
-rw-r--r--tools/src/h5diff/h5diff_common.c3
-rw-r--r--tools/src/h5jam/h5jam.c6
-rw-r--r--tools/src/h5ls/h5ls.c2
-rw-r--r--tools/src/h5repack/h5repack_filters.c4
-rw-r--r--tools/src/misc/h5mkgrp.c2
-rw-r--r--tools/test/h5diff/Makefile.am5
-rw-r--r--tools/test/h5dump/Makefile.am5
-rw-r--r--tools/test/h5dump/errfiles/filter_fail.err5
-rw-r--r--tools/test/h5ls/Makefile.am5
-rw-r--r--tools/test/h5repack/Makefile.am9
102 files changed, 9195 insertions, 9159 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 f21f8b7..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)
diff --git a/MANIFEST b/MANIFEST
index b5184fa..726a2c4 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -756,6 +756,7 @@
./src/H5Oflush.c
./src/H5Ofsinfo.c
./src/H5Oginfo.c
+./src/H5Oint.c
./src/H5Olayout.c
./src/H5Olinfo.c
./src/H5Olink.c
@@ -813,6 +814,7 @@
./src/H5PLextern.h
./src/H5R.c
./src/H5Rdeprec.c
+./src/H5Rint.c
./src/H5Rmodule.h
./src/H5Rpkg.h
./src/H5Rprivate.h
@@ -939,10 +941,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
@@ -970,6 +968,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
@@ -1034,7 +1037,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
@@ -1069,12 +1071,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
diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake
index 602b6bf..192a5c8 100644
--- a/config/cmake_ext_mod/HDFMacros.cmake
+++ b/config/cmake_ext_mod/HDFMacros.cmake
@@ -108,6 +108,7 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype)
set_target_properties (${libtarget}
PROPERTIES
+ OUTPUT_NAME ${LIB_RELEASE_NAME}
OUTPUT_NAME_DEBUG ${LIB_DEBUG_NAME}
OUTPUT_NAME_RELEASE ${LIB_RELEASE_NAME}
OUTPUT_NAME_MINSIZEREL ${LIB_RELEASE_NAME}
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 3dbd95c..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
diff --git a/examples/h5_cmprss.c b/examples/h5_cmprss.c
index ebc7712..b51ec44 100644
--- a/examples/h5_cmprss.c
+++ b/examples/h5_cmprss.c
@@ -36,7 +36,6 @@ int main () {
hsize_t dims[2];
hsize_t cdims[2];
- int idx;
int i,j, numfilt;
int buf[DIM0][DIM1];
int rbuf [DIM0][DIM1];
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt
index 51db4f0..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,7 +241,8 @@ 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} ${LINK_Fortran_LIBS})
+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_include_directories (${HDF5_F90_LIB_TARGET} PUBLIC ${MPI_Fortran_INCLUDE_DIRS})
endif ()
@@ -268,7 +269,8 @@ 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} ${LINK_Fortran_LIBS})
+ 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_include_directories (${HDF5_F90_LIBSH_TARGET} PUBLIC ${MPI_Fortran_INCLUDE_DIRS})
endif ()
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 54867af..7498d01 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -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
@@ -168,8 +179,35 @@ Bug Fixes since HDF5-1.10.1 release
(ADB - 2017/10/10, HDFFV-10297, HDFFV-10319)
+ - An uninitialized struct could cause a memory access error when using
+ variable-length or reference types in a compressed, chunked dataset.
+
+ A struct containing a callback function pointer and a pointer to some
+ associated data was used before initialization. This could cause a
+ memory access error and system crash. This could only occur under
+ unusual conditions when using variable-lenth and reference types in
+ a compressed, chunked dataset.
+
+ On recent versions of Visual Studio, when built in debug mode, the
+ debug heap will complain and cause a crash if the code in question
+ is executed (this will cause the objcopy test to fail).
+
+ (DER - 2017/11/21, HDFFV-10330)
+
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
@@ -197,7 +235,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
-----
@@ -224,7 +263,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 4be86a9..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,7 +883,7 @@ 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} PUBLIC ${LINK_LIBS})
+target_link_libraries (${HDF5_LIB_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS})
if (NOT WIN32)
target_link_libraries (${HDF5_LIB_TARGET} PUBLIC dl)
endif ()
@@ -925,7 +927,7 @@ 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} PUBLIC ${LINK_SHARED_LIBS})
+ target_link_libraries (${HDF5_LIBSH_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS})
if (NOT WIN32)
target_link_libraries (${HDF5_LIBSH_TARGET} PUBLIC dl)
endif ()
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index e962a29..0c85e64 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -5725,7 +5725,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
/* needed for commpressed variable length data */
hbool_t must_filter = FALSE; /* Whether chunk must be filtered during copy */
size_t nbytes; /* Size of chunk in file (in bytes) */
- H5Z_cb_t cb_struct; /* Filter failure callback struct */
+ H5Z_cb_t filter_cb; /* Filter failure callback struct */
int ret_value = H5_ITER_CONT; /* Return value */
@@ -5734,6 +5734,10 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
/* Get 'size_t' local value for number of bytes in chunk */
H5_CHECKED_ASSIGN(nbytes, size_t, chunk_rec->nbytes, uint32_t);
+ /* Initialize the filter callback struct */
+ filter_cb.op_data = NULL;
+ filter_cb.func = NULL; /* no callback function when failed */
+
/* Check for filtered chunks */
/* Check for an edge chunk that is not filtered */
if(pline && pline->nused) {
@@ -5780,11 +5784,12 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
HDassert(!H5F_addr_defined(chunk_rec->chunk_addr));
HDmemcpy(buf, udata->chunk, nbytes);
udata->chunk = NULL;
- } else {
+ }
+ else {
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) {
@@ -5812,7 +5817,8 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
H5_CHECKED_ASSIGN(nbytes, size_t, shared_fo->layout.u.chunk.size, uint32_t);
HDmemcpy(buf, ent->chunk, nbytes);
- } else {
+ }
+ else {
/* read chunk data from the source file */
if(H5F_block_read(udata->file_src, H5FD_MEM_DRAW, chunk_rec->chunk_addr, nbytes, H5AC_rawdata_dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk")
@@ -5823,8 +5829,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
if(must_filter && (is_vlen || fix_ref) && !udata->chunk_in_cache) {
unsigned filter_mask = chunk_rec->filter_mask;
- cb_struct.func = NULL; /* no callback function when failed */
- if(H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &filter_mask, H5Z_NO_EDC, cb_struct, &nbytes, &buf_size, &buf) < 0)
+ if(H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &filter_mask, H5Z_NO_EDC, filter_cb, &nbytes, &buf_size, &buf) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, H5_ITER_ERROR, "data pipeline read failed")
} /* end if */
@@ -5886,7 +5891,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
/* Need to compress variable-length or reference data elements or a chunk found in cache before writing to file */
if(must_filter && (is_vlen || fix_ref || udata->chunk_in_cache) ) {
- if(H5Z_pipeline(pline, 0, &(udata_dst.filter_mask), H5Z_NO_EDC, cb_struct, &nbytes, &buf_size, &buf) < 0)
+ if(H5Z_pipeline(pline, 0, &(udata_dst.filter_mask), H5Z_NO_EDC, filter_cb, &nbytes, &buf_size, &buf) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, H5_ITER_ERROR, "output pipeline failed")
#if H5_SIZEOF_SIZE_T > 4
/* Check for the chunk expanding too much to encode in a 32-bit value */
@@ -6771,46 +6776,49 @@ H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
H5_CHECKED_ASSIGN(nbytes, size_t, chunk_rec->nbytes, uint32_t);
chunk_addr = chunk_rec->chunk_addr;
- if(new_idx_info->pline->nused &&
+ if (new_idx_info->pline->nused &&
(new_idx_info->layout->flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) &&
(H5D__chunk_is_partial_edge_chunk(udata->dset_ndims, new_idx_info->layout->dim, chunk_rec->scaled, udata->dset_dims))) {
- /* This is a partial non-filtered edge chunk */
- /* Convert the chunk to a filtered edge chunk for v1 B-tree chunk index */
- unsigned filter_mask = chunk_rec->filter_mask;
- H5Z_cb_t cb_struct; /* Filter failure callback struct */
- size_t read_size = nbytes; /* Bytes to read */
+ /* This is a partial non-filtered edge chunk */
+ /* Convert the chunk to a filtered edge chunk for v1 B-tree chunk index */
- HDassert(read_size == new_idx_info->layout->size);
+ unsigned filter_mask = chunk_rec->filter_mask;
+ H5Z_cb_t filter_cb; /* Filter failure callback struct */
+ size_t read_size = nbytes; /* Bytes to read */
+
+ HDassert(read_size == new_idx_info->layout->size);
- cb_struct.func = NULL; /* no callback function when failed */
+ /* Initialize the filter callback struct */
+ filter_cb.op_data = NULL;
+ filter_cb.func = NULL; /* no callback function when failed */
- /* Allocate buffer for chunk data */
- if(NULL == (buf = H5MM_malloc(read_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed for raw data chunk")
+ /* Allocate buffer for chunk data */
+ if (NULL == (buf = H5MM_malloc(read_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed for raw data chunk")
- /* Read the non-filtered edge chunk */
- if(H5F_block_read(new_idx_info->f, H5FD_MEM_DRAW, chunk_addr, read_size, H5AC_rawdata_dxpl_id, buf) < 0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk")
+ /* Read the non-filtered edge chunk */
+ if (H5F_block_read(new_idx_info->f, H5FD_MEM_DRAW, chunk_addr, read_size, H5AC_rawdata_dxpl_id, buf) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk")
- /* Pass the chunk through the pipeline */
- if(H5Z_pipeline(new_idx_info->pline, 0, &filter_mask, H5Z_NO_EDC, cb_struct, &nbytes, &read_size, &buf) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, H5_ITER_ERROR, "output pipeline failed")
+ /* Pass the chunk through the pipeline */
+ if (H5Z_pipeline(new_idx_info->pline, 0, &filter_mask, H5Z_NO_EDC, filter_cb, &nbytes, &read_size, &buf) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, H5_ITER_ERROR, "output pipeline failed")
#if H5_SIZEOF_SIZE_T > 4
/* Check for the chunk expanding too much to encode in a 32-bit value */
- if(nbytes > ((size_t)0xffffffff))
- HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, H5_ITER_ERROR, "chunk too large for 32-bit length")
+ if (nbytes > ((size_t)0xffffffff))
+ HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, H5_ITER_ERROR, "chunk too large for 32-bit length")
#endif /* H5_SIZEOF_SIZE_T > 4 */
- /* Allocate space for the filtered chunk */
- if((chunk_addr = H5MF_alloc(new_idx_info->f, H5FD_MEM_DRAW, new_idx_info->dxpl_id, (hsize_t)nbytes)) == HADDR_UNDEF)
- HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, H5_ITER_ERROR, "file allocation failed for filtered chunk")
- HDassert(H5F_addr_defined(chunk_addr));
+ /* Allocate space for the filtered chunk */
+ if ((chunk_addr = H5MF_alloc(new_idx_info->f, H5FD_MEM_DRAW, new_idx_info->dxpl_id, (hsize_t)nbytes)) == HADDR_UNDEF)
+ HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, H5_ITER_ERROR, "file allocation failed for filtered chunk")
+ HDassert(H5F_addr_defined(chunk_addr));
- /* Write the filtered chunk to disk */
- if(H5F_block_write(new_idx_info->f, H5FD_MEM_DRAW, chunk_addr, nbytes, H5AC_rawdata_dxpl_id, buf) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, H5_ITER_ERROR, "unable to write raw data to file")
+ /* Write the filtered chunk to disk */
+ if (H5F_block_write(new_idx_info->f, H5FD_MEM_DRAW, chunk_addr, nbytes, H5AC_rawdata_dxpl_id, buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, H5_ITER_ERROR, "unable to write raw data to file")
} /* end if */
/* Set up chunk information for insertion to chunk index */
@@ -6822,11 +6830,11 @@ H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
insert_udata.common.storage = new_idx_info->storage;
/* Insert chunk into the v1 B-tree chunk index */
- if((new_idx_info->storage->ops->insert)(new_idx_info, &insert_udata, NULL) < 0)
+ if ((new_idx_info->storage->ops->insert)(new_idx_info, &insert_udata, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, H5_ITER_ERROR, "unable to insert chunk addr into index")
done:
- if(buf)
+ if (buf)
H5MM_xfree(buf);
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index 4bfb0f5..d71719f 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -436,7 +436,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 7c68987..cf7296e 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -1566,7 +1566,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 682c16c..3457844 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,26 +611,22 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__init_type
+ * Function: H5D__init_type
*
- * Purpose: Copy a datatype for a dataset's use, performing all the
+ * Purpose: Copy a datatype for a dataset's use, performing all the
* necessary adjustments, etc.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * Thursday, June 24, 2004
- *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
*-------------------------------------------------------------------------
*/
static herr_t
H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
{
- htri_t relocatable; /* Flag whether the type is relocatable */
- htri_t immutable; /* Flag whether the type is immutable */
- hbool_t use_latest_format; /* Flag indicating the 'latest datatype version support' is enabled */
- herr_t ret_value = SUCCEED; /* Return value */
+ htri_t relocatable; /* Flag whether the type is relocatable */
+ htri_t immutable; /* Flag whether the type is immutable */
+ hbool_t use_latest_format; /* Flag indicating the 'latest datatype version support' is enabled */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -681,8 +652,8 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
if((dset->shared->type = H5T_copy(type, H5T_COPY_ALL)) == NULL)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy datatype")
- /* Convert a datatype (if committed) to a transient type if the committed datatype's file
- location is different from the file location where the dataset will be created */
+ /* Convert a datatype (if committed) to a transient type if the committed datatype's file
+ location is different from the file location where the dataset will be created */
if(H5T_convert_committed_datatype(dset->shared->type, file) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get shared datatype info")
@@ -696,8 +667,8 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype")
/* Get a datatype ID for the dataset's datatype */
- if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type")
+ if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type")
} /* end if */
/* Not a custom datatype, just use it directly */
else {
@@ -715,16 +686,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
@@ -759,17 +726,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
@@ -811,16 +774,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
@@ -831,9 +790,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 */
@@ -875,10 +834,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 */
@@ -961,17 +922,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 */
}
@@ -1010,9 +971,6 @@ done:
* should be used.
*
* Return: SUCCEED/FAIL
- *
- * Programmer: Steffen Kiess
- * October 16, 2015
*--------------------------------------------------------------------------
*/
static herr_t
@@ -1025,7 +983,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
@@ -1064,7 +1022,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}"));
@@ -1081,32 +1039,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 */
@@ -1114,7 +1067,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
@@ -1218,24 +1171,24 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
/* Set the latest version of the layout, pline & fill messages, if requested */
if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DSET_MSG_FLAGS)) {
/* Set the latest version for the I/O pipeline message */
- if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_PLINE_MSG))
- if(H5O_pline_set_latest_version(&new_dset->shared->dcpl_cache.pline) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of I/O filter pipeline")
+ if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_PLINE_MSG))
+ if(H5O_pline_set_latest_version(&new_dset->shared->dcpl_cache.pline) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of I/O filter pipeline")
/* Set the latest version for the fill message */
- if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_FILL_MSG))
- /* Set the latest version for the fill value message */
- if(H5O_fill_set_latest_version(&new_dset->shared->dcpl_cache.fill) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of fill value")
+ if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_FILL_MSG))
+ /* Set the latest version for the fill value message */
+ if(H5O_fill_set_latest_version(&new_dset->shared->dcpl_cache.fill) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of fill value")
/* Set the latest version for the layout message */
- if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_LAYOUT_MSG))
- /* Set the latest version for the layout message */
- if(H5D__layout_set_latest_version(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of layout")
+ if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_LAYOUT_MSG))
+ /* Set the latest version for the layout message */
+ if(H5D__layout_set_latest_version(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of layout")
} /* end if */
else if(new_dset->shared->layout.version >= H5O_LAYOUT_VERSION_4) {
- /* Use latest indexing type for layout message version >= 4 */
+ /* Use latest indexing type for layout message version >= 4 */
if(H5D__layout_set_latest_indexing(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest indexing")
} /* end if */
@@ -1261,7 +1214,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)
@@ -1329,10 +1282,6 @@ done:
*
* Return: Success: Ptr to a new dataset.
* Failure: NULL
- *
- * Programmer: Neil Fortner
- * Friday, March 6, 2015
- *
*-------------------------------------------------------------------------
*/
H5D_t *
@@ -1387,17 +1336,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 *
@@ -1509,19 +1454,15 @@ done:
/*
*-------------------------------------------------------------------------
- * Function: H5D__flush_append_setup
- *
- * Purpose: Set the append flush parameters for a dataset
- *
- * Return: Non-negative on success/Negative on failure
+ * Function: H5D__flush_append_setup
*
- * 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 */
@@ -1538,47 +1479,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:
@@ -1587,15 +1528,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__open_oid
- *
- * Purpose: Opens a dataset for access.
- *
- * Return: Dataset pointer on success, NULL on failure
+ * Function: H5D__open_oid
*
- * Programmer: Quincey Koziol
- * Monday, October 12, 1998
+ * Purpose: Opens a dataset for access.
*
+ * Return: Dataset pointer on success, NULL on failure
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1605,8 +1542,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)
@@ -1652,7 +1589,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;
@@ -1665,7 +1602,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) {
@@ -1740,7 +1677,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)
@@ -1763,17 +1700,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.
+ * Function: H5D_close
*
- * Return: Non-negative on success/Negative on failure
- *
- * 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
@@ -1910,7 +1843,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")
/*
@@ -1934,9 +1867,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 */
@@ -1983,23 +1916,19 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_mult_refresh_close
- *
- * Purpose: Closing down the needed information when the dataset has
- * multiple opens. (From H5O_refresh_metadata_close())
+ * Function: H5D_mult_refresh_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)
@@ -2065,16 +1994,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_mult_refresh_reopen
- *
- * Purpose: Re-initialize the needed info when the dataset has multiple
- * opens. (From H5O_refresh_metadata_reopen())
+ * Function: H5D_mult_refresh_reopen
*
- * Return: Non-negative on success/Negative on failure
- *
- * 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
@@ -2089,25 +2014,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:
@@ -2116,16 +2041,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_oloc
- *
- * Purpose: Returns a pointer to the object location for a dataset.
- *
- * Return: Success: Ptr to location
- * Failure: NULL
+ * Function: H5D_oloc
*
- * 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 *
@@ -2139,16 +2060,12 @@ H5D_oloc(H5D_t *dataset)
/*-------------------------------------------------------------------------
- * Function: H5D_nameof
+ * Function: H5D_nameof
*
- * Purpose: Returns a pointer to the group hier. path for a dataset.
- *
- * 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 *
@@ -2162,17 +2079,13 @@ H5D_nameof(H5D_t *dataset)
/*-------------------------------------------------------------------------
- * Function: H5D_typeof
- *
- * 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
+ * Function: H5D_typeof
*
- * 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 *
@@ -2190,15 +2103,11 @@ H5D_typeof(const H5D_t *dset)
/*-------------------------------------------------------------------------
- * Function: H5D__alloc_storage
+ * Function: H5D__alloc_storage
*
- * Purpose: Allocate storage for the raw data of a dataset.
- *
- * 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
@@ -2206,11 +2115,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
@@ -2260,19 +2169,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) {
@@ -2284,7 +2192,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;
}
@@ -2326,7 +2235,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)
@@ -2360,24 +2269,20 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__init_storage
+ * 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.
- *
- * 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
@@ -2436,22 +2341,18 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__get_storage_size
- *
- * Purpose: Determines how much space has been reserved to store the raw
- * data of a dataset.
+ * Function: H5D__get_storage_size
*
- * Return: Non-negative on success, negative on failure
- *
- * 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)
@@ -2495,24 +2396,19 @@ done:
/*-------------------------------------------------------------------------
- * 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
+ * Function: H5D__get_offset
*
- * 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
@@ -2544,18 +2440,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_vlen_reclaim
+ * 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.
- *
- * 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
@@ -2565,7 +2457,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)
@@ -2595,18 +2487,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 *
@@ -2629,14 +2517,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
@@ -2646,11 +2534,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
@@ -2707,15 +2591,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
@@ -2761,16 +2641,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
@@ -2844,7 +2720,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 */
@@ -2933,7 +2809,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)
@@ -2946,16 +2822,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
@@ -2987,16 +2859,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
@@ -3024,29 +2892,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)
@@ -3096,7 +2960,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)
@@ -3139,7 +3003,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 */
@@ -3181,16 +3045,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
@@ -3246,24 +3106,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
@@ -3283,23 +3139,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)
@@ -3320,19 +3172,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
@@ -3343,8 +3190,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)
@@ -3385,7 +3232,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")
@@ -3502,18 +3349,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
@@ -3571,24 +3413,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
@@ -3616,24 +3453,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
@@ -3667,15 +3499,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
@@ -3702,7 +3530,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/H5Dio.c b/src/H5Dio.c
index 26e02c5..a5996ec 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -1450,7 +1450,9 @@ H5D__ioinfo_init(H5D_t *dset,
io_info->using_mpi_vfd = H5F_HAS_FEATURE(dset->oloc.file, H5FD_FEAT_HAS_MPI);
#endif /* H5_HAVE_PARALLEL */
-done:
+#ifdef H5_DEBUG_BUILD
+ done:
+#endif /* H5_DEBUG_BUILD */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__ioinfo_init() */
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 64075c3..8c42965 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 */
@@ -205,13 +205,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;
@@ -382,10 +382,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;
/*
@@ -394,9 +394,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 */
@@ -407,7 +407,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;
@@ -465,11 +465,11 @@ typedef struct H5D_chunk_ops_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;
/****************************/
@@ -486,24 +486,24 @@ 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 */
- H5D_chunk_info_t *single_chunk_info; /* Pointer to single piece's info */
+ 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 */
hsize_t scaled_dims[H5S_MAX_RANK]; /* The scaled dim sizes */
@@ -538,10 +538,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 {
@@ -554,7 +554,7 @@ typedef struct H5D_shared_t {
H5SL_t *sel_pieces; /* Skip list containing information for each piece selected */
} 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;
@@ -767,7 +767,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 39eca13..4b40248 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.
+ * Function: H5Fget_obj_count
*
- * Return: Non-negative on success; negative on failure.
- *
- * 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
- *
- * Purpose: Public function to return a list of opened object IDs.
- *
- * Return: Non-negative on success; negative on failure.
+ * Function: H5Fget_object_ids
*
- * 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
+ * Function: H5Fis_hdf5
*
- * Purpose: Check the file signature to detect an HDF5 file.
+ * 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.
+ * 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
- *
- * Programmer: Unknown
- *
- * Modifications:
- * Robb Matzke, 1999-08-02
- * Rewritten to use the virtual file layer.
+ * Return: Success: TRUE/FALSE
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
htri_t
@@ -414,38 +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)
{
- 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);
@@ -479,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;
/*
@@ -504,51 +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)
{
- 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);
@@ -591,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.
+ * Function: H5Fflush
*
- * Return: Non-negative on success/Negative on failure
- *
- * 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);
@@ -622,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")
@@ -632,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")
@@ -642,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")
@@ -652,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")
@@ -685,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
@@ -711,24 +661,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fclose
+ * 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
- *
- * 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
@@ -736,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);
@@ -772,29 +715,24 @@ done:
/*-------------------------------------------------------------------------
- * 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.
+ * Function: H5Freopen
*
- * 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);
@@ -828,16 +766,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fget_intent
- *
- * Purpose: Public API to retrieve the file's 'intent' flags passed
- * during H5Fopen()
+ * Function: H5Fget_intent
*
- * Return: Non-negative on success/negative on failure
- *
- * 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
@@ -850,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)))
@@ -888,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)
@@ -925,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
@@ -972,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
@@ -1033,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
@@ -1078,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
@@ -1115,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
@@ -1156,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
@@ -1202,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
@@ -1251,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
@@ -1309,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
@@ -1386,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);
@@ -1417,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);
@@ -1477,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
@@ -1525,9 +1411,6 @@ done:
*
* Return: Success: non-negative
* Failure: negative
- *
- * Programmer: Neil Fortner; December 30, 2010
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1554,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
@@ -1593,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);
@@ -1651,18 +1530,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++) {
@@ -1790,14 +1669,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);
@@ -1823,14 +1701,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);
@@ -1856,15 +1733,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);
@@ -1888,9 +1764,6 @@ done:
* Purpose: Enable switching 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
@@ -1924,17 +1797,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
@@ -1946,8 +1815,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)))
@@ -1961,9 +1830,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)
@@ -2004,9 +1873,6 @@ done:
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: Mohamad Chaarawi
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2040,9 +1906,6 @@ done:
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: Mohamad Chaarawi
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2084,9 +1947,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 7371c46..a48e41c 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,9 +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;
- hbool_t latest_format = FALSE; /* Always use the latest format? */
- 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)
@@ -142,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")
@@ -222,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
@@ -259,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
@@ -285,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
@@ -313,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) {
@@ -337,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,
@@ -380,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;
@@ -390,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
@@ -419,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 */
@@ -501,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;
@@ -554,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.
+ * Function: H5F_new
*
- * Failure: NULL
- *
- * 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
@@ -592,8 +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 */
- hbool_t latest_format; /* Always use the latest format? */
+ 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);
@@ -650,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)
@@ -826,25 +794,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
@@ -866,7 +829,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)
@@ -883,7 +846,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.
@@ -909,10 +872,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:
@@ -938,7 +901,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);
@@ -947,8 +910,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
@@ -967,11 +930,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)
@@ -991,7 +954,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*/
@@ -1067,7 +1030,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.
@@ -1089,42 +1053,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:
*
@@ -1157,12 +1121,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 *
@@ -1181,7 +1141,7 @@ 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 */
@@ -1210,7 +1170,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
@@ -1299,8 +1259,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 */
@@ -1311,7 +1271,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 */
@@ -1475,7 +1435,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 */
@@ -1483,11 +1443,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 */
@@ -1511,16 +1471,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_flush_phase1
- *
- * Purpose: First phase of flushing cached data.
+ * Function: H5F_flush_phase1
*
- * Return: Non-negative on success/Negative on failure
- *
- * 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
@@ -1553,16 +1508,11 @@ H5F__flush_phase1(H5F_t *f, hid_t meta_dxpl_id)
/*-------------------------------------------------------------------------
- * Function: H5F__flush_phase2
- *
- * Purpose: Second phase of flushing cached data.
- *
- * Return: Non-negative on success/Negative on failure
+ * Function: H5F__flush_phase2
*
- * 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
@@ -1620,16 +1570,11 @@ H5F__flush_phase2(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t closi
/*-------------------------------------------------------------------------
- * Function: H5F__flush
+ * Function: H5F__flush
*
- * Purpose: Flushes cached data.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Aug 29 1997
+ * Purpose: Flushes cached data.
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -1657,33 +1602,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
@@ -1722,18 +1663,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
@@ -1741,7 +1678,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
@@ -1772,12 +1709,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:
@@ -1899,16 +1836,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_get_id
- *
- * Purpose: Get the file ID, incrementing it, or "resurrecting" it as
- * appropriate.
- *
- * Return: Non-negative on success/Negative on failure
+ * Function: H5F_get_id
*
- * 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
@@ -1923,8 +1856,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")
@@ -1938,18 +1872,12 @@ done:
/*-------------------------------------------------------------------------
- * 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
+ * Function: H5F_incr_nopen_objs
*
- * 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
@@ -1965,18 +1893,12 @@ H5F_incr_nopen_objs(H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_decr_nopen_objs
- *
- * Purpose: Decrement the number of open objects for a file.
- *
- * Return: Success: The number of open objects, after the decrement
- *
- * Failure: (can't happen)
+ * Function: H5F_decr_nopen_objs
*
- * 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
@@ -1992,18 +1914,14 @@ H5F_decr_nopen_objs(H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_build_actual_name
+ * Function: H5F_build_actual_name
*
- * Purpose: Retrieve the name of a file, after following symlinks, etc.
+ * Purpose: Retrieve the name of a file, after following symlinks, etc.
*
- * Note: Currently only working for "POSIX I/O compatible" VFDs
- *
- * 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
@@ -2118,17 +2036,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
@@ -2143,15 +2057,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
@@ -2159,17 +2073,13 @@ H5F_addr_encode_len(size_t addr_len, uint8_t **pp/*in,out*/, haddr_t addr)
/*-------------------------------------------------------------------------
- * 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
+ * Function: H5F_addr_encode
*
- * 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
@@ -2187,27 +2097,23 @@ H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr)
/*-------------------------------------------------------------------------
- * Function: H5F_addr_decode_len
+ * 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.
+ * 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.
- *
- * 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
@@ -2221,27 +2127,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'
@@ -2255,20 +2161,16 @@ H5F_addr_decode_len(size_t addr_len, const uint8_t **pp/*in,out*/, haddr_t *addr
/*-------------------------------------------------------------------------
- * Function: H5F_addr_decode
+ * 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.
+ * 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.
- *
- * 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
@@ -2292,10 +2194,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
@@ -2322,10 +2220,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
@@ -2351,10 +2245,6 @@ H5F_set_sohm_addr(H5F_t *f, haddr_t addr)
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * 7/20/11
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2380,10 +2270,6 @@ H5F_set_sohm_vers(H5F_t *f, unsigned vers)
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * 7/20/11
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2409,10 +2295,6 @@ H5F_set_sohm_nindexes(H5F_t *f, unsigned nindexes)
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * 7/20/11
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2438,10 +2320,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
@@ -2482,20 +2360,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.
@@ -2514,7 +2392,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;
@@ -2545,34 +2423,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)
+ * Function: H5F_track_metadata_read_retries
*
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * 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)
@@ -2603,23 +2478,20 @@ done:
/*-------------------------------------------------------------------------
- * 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
+ * Function: H5F_set_retries
*
- * 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
@@ -2649,9 +2521,6 @@ H5F_set_retries(H5F_t *f)
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: Vailin Choi; October 2013
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2675,15 +2544,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F__set_base_addr
+ * Function: H5F__set_base_addr
*
- * Purpose: Quick and dirty routine to set the file's 'base_addr' value
- *
- * 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
@@ -2698,7 +2563,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)
@@ -2706,15 +2571,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
@@ -2729,7 +2590,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)
@@ -2737,15 +2598,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
@@ -2776,10 +2633,6 @@ done:
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * 2/10/16
- *
*-------------------------------------------------------------------------
*/
void
@@ -2805,10 +2658,6 @@ H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr)
*
* Return: Success: SUCCEED
* Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * 4/26/16
- *
*-------------------------------------------------------------------------
*/
herr_t
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index 41cf4d2..cc2399b 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,16 +97,12 @@ H5F_get_intent(const H5F_t *f)
/*-------------------------------------------------------------------------
- * 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)
+ * Function: H5F_get_open_name
*
- * 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 *
@@ -127,16 +119,12 @@ H5F_get_open_name(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_actual_name
+ * 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)
- *
- * 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 *
@@ -153,16 +141,13 @@ H5F_get_actual_name(const H5F_t *f)
/*-------------------------------------------------------------------------
- * 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.
+ * Function: H5F_get_extpath
*
- * 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 *
@@ -179,14 +164,11 @@ H5F_get_extpath(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_shared
- *
- * Purpose: Retrieve the file's 'shared' pointer
+ * Function: H5F_get_shared
*
- * Return: 'shared' on success/abort on failure (shouldn't fail)
- *
- * 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 *
@@ -202,14 +184,11 @@ H5F_get_shared(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_same_shared
- *
- * Purpose: Determine if two files have the same shared file pointer
+ * Function: H5F_same_shared
*
- * 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
@@ -228,14 +207,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
@@ -251,14 +227,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
@@ -274,14 +247,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 *
@@ -297,14 +267,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
@@ -320,14 +287,11 @@ H5F_get_nmounts(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_read_attempts
- *
- * Purpose: Retrieve the file's 'read_attempts' value
+ * Function: H5F_get_read_attempts
*
- * Return: '# of read attempts' on success/abort on failure (shouldn't fail)
- *
- * 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
@@ -343,18 +307,12 @@ H5F_get_read_attempts(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_fcpl
- *
- * Purpose: Retrieve the value of a file's FCPL.
- *
- * Return: Success: The FCPL for the file.
+ * Function: H5F_get_fcpl
*
- * 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
@@ -371,17 +329,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)
- *
- * Return: 'sizeof_addr' on success/abort on failure (shouldn't fail)
+ * Function: H5F_sizeof_addr
*
- * 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
@@ -398,17 +352,13 @@ H5F_sizeof_addr(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_sizeof_size
+ * 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)
- *
- * 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
@@ -425,14 +375,11 @@ H5F_sizeof_size(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_sohm_addr
- *
- * Purpose: Retrieve the file's 'sohm_addr' value
- *
- * Return: 'sohm_addr' on success/abort on failure (shouldn't fail)
+ * Function: H5F_get_sohm_addr
*
- * 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
@@ -449,14 +396,11 @@ H5F_get_sohm_addr(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_sohm_vers
+ * Function: H5F_get_sohm_vers
*
- * Purpose: Retrieve the file's 'sohm_vers' value
- *
- * 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
@@ -473,14 +417,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
@@ -497,21 +438,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
@@ -529,21 +464,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
@@ -562,14 +491,11 @@ H5F_Kvalue(const H5F_t *f, const H5B_class_t *type)
/*-------------------------------------------------------------------------
- * Function: H5F_get_nrefs
+ * Function: H5F_get_nrefs
*
- * Purpose: Retrieve the file's 'nrefs' value
- *
- * 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
@@ -586,21 +512,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
@@ -617,21 +537,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
@@ -648,21 +562,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
@@ -679,17 +587,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
@@ -707,21 +611,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 *
@@ -738,21 +636,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
@@ -769,21 +661,15 @@ 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.
+ * 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"
+ * Return: Success: The "garbage collect references flag"
* is returned.
- *
- * Failure: (should not happen)
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Jul 8 2005
- *
+ * Failure: (should not happen)
*-------------------------------------------------------------------------
*/
unsigned
@@ -800,18 +686,12 @@ H5F_gc_ref(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_use_latest_flags
- *
- * Purpose: Retrieve the 'latest version support' for the file.
- *
- * Return: Success: Non-negative, the requested 'version support'
+ * Function: H5F_use_latest_flags
*
- * Failure: (can't happen)
- *
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Mar 5 2007
+ * Purpose: Retrieve the 'latest version support' for the file.
*
+ * Return: Success: Non-negative, the requested 'version support'
+ * Failure: (can't happen)
*-------------------------------------------------------------------------
*/
unsigned
@@ -828,18 +708,12 @@ H5F_use_latest_flags(const H5F_t *f, unsigned fl)
/*-------------------------------------------------------------------------
- * Function: H5F_get_fc_degree
- *
- * Purpose: Retrieve the 'file close degree' for the file.
- *
- * Return: Success: Non-negative, the 'file close degree'
+ * Function: H5F_get_fc_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
@@ -864,10 +738,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
@@ -884,18 +754,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.
+ * Function: H5F_store_msg_crt_idx
*
- * Return: Success: Non-negative, the 'store message creation index' flag
- *
- * Failure: (can't happen)
- *
- * 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
@@ -912,17 +776,12 @@ H5F_store_msg_crt_idx(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_has_feature
- *
- * Purpose: Check if a file has a particular feature enabled
+ * Function: H5F_has_feature
*
- * 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
@@ -939,17 +798,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
@@ -967,23 +822,19 @@ H5F_get_driver_id(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_fileno
+ * 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
- *
- * 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)
@@ -994,7 +845,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)
@@ -1002,21 +853,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_get_eoa
- *
- * Purpose: Quick and dirty routine to retrieve the file's 'eoa' value
+ * Function: H5F_get_eoa
*
- * Return: Non-negative on success/Negative on failure
- *
- * 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)
@@ -1025,7 +872,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)
@@ -1040,10 +887,6 @@ done:
*
* Return: Success: Non-negative.
* Failure: negative.
- *
- * Programmer: Raymond Lu
- * Sep. 16, 2002
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1067,18 +910,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)
+ * Function: H5F_is_tmp_addr
*
- * Return: TRUE/FALSE on success/abort on failure (shouldn't fail)
- *
- * 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
@@ -1095,18 +934,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
@@ -1124,17 +959,12 @@ H5F_use_tmp_space(const H5F_t *f)
#ifdef H5_HAVE_PARALLEL
/*-------------------------------------------------------------------------
- * Function: H5F_coll_md_read
+ * 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)
- *
- * 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
@@ -1151,18 +981,14 @@ H5F_coll_md_read(const H5F_t *f)
/*-------------------------------------------------------------------------
- * 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)
+ * Function: H5F_use_mdc_logging
*
- * 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
@@ -1179,18 +1005,14 @@ H5F_use_mdc_logging(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_start_mdc_log_on_access
+ * 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)
- *
- * 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
@@ -1207,18 +1029,14 @@ H5F_start_mdc_log_on_access(const H5F_t *f)
/*-------------------------------------------------------------------------
- * 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)
+ * Function: H5F_mdc_log_location
*
- * 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 *
@@ -1235,16 +1053,12 @@ H5F_mdc_log_location(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_alignment
- *
- * Purpose: Retrieve the 'alignment' for the file.
- *
- * Return: Success: Non-negative, the 'alignment'
- *
- * Failure: (can't happen)
+ * Function: H5F_get_alignment
*
- * Programmer: Vailin Choi; Dec 2012
+ * Purpose: Retrieve the 'alignment' for the file.
*
+ * Return: Success: Non-negative, the 'alignment'
+ * Failure: (can't happen)
*-------------------------------------------------------------------------
*/
hsize_t
@@ -1261,16 +1075,12 @@ H5F_get_alignment(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_threshold
- *
- * Purpose: Retrieve the 'threshold' for alignment in the file.
- *
- * Return: Success: Non-negative, the 'threshold'
- *
- * Failure: (can't happen)
+ * Function: H5F_get_threshold
*
- * 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
@@ -1287,16 +1097,12 @@ H5F_get_threshold(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_pgend_meta_thres
+ * 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'
- *
- * 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
@@ -1313,13 +1119,12 @@ H5F_get_pgend_meta_thres(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_point_of_no_return
+ * Function: H5F_get_point_of_no_return
*
- * Purpose: Retrieve the 'point of no return' value for the file.
- *
- * 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
@@ -1336,13 +1141,12 @@ H5F_get_point_of_no_return(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_first_alloc_dealloc
- *
- * Purpose: Retrieve the 'first alloc / dealloc' value for the file.
+ * Function: H5F_get_first_alloc_dealloc
*
- * 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
@@ -1359,13 +1163,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/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/H5HFcache.c b/src/H5HFcache.c
index f957e2e..069bf17 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -1671,9 +1671,13 @@ H5HF__cache_dblock_verify_chksum(const void *_image, size_t len, void *_udata)
HGOTO_DONE(TRUE);
if(hdr->filter_len > 0) {
- size_t nbytes; /* Number of bytes used in buffer, after applying reverse filters */
- unsigned filter_mask; /* Excluded filters for direct block */
- H5Z_cb_t filter_cb = {NULL, NULL}; /* Filter callback structure */
+ size_t nbytes; /* Number of bytes used in buffer, after applying reverse filters */
+ unsigned filter_mask; /* Excluded filters for direct block */
+ H5Z_cb_t filter_cb; /* Filter callback structure */
+
+ /* Initialize the filter callback struct */
+ filter_cb.op_data = NULL;
+ filter_cb.func = NULL; /* no callback function when failed */
/* Allocate buffer to perform I/O filtering on and copy image into
* it. Must do this as H5Z_pipeline() may re-size the buffer
@@ -1682,17 +1686,17 @@ H5HF__cache_dblock_verify_chksum(const void *_image, size_t len, void *_udata)
if(NULL == (read_buf = H5MM_malloc(len)))
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline buffer")
- /* Set up parameters for filter pipeline */
- nbytes = len;
- filter_mask = udata->filter_mask;
+ /* Set up parameters for filter pipeline */
+ nbytes = len;
+ filter_mask = udata->filter_mask;
HDmemcpy(read_buf, image, len);
- /* Push direct block data through I/O filter pipeline */
- if(H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_ENABLE_EDC, filter_cb, &nbytes, &len, &read_buf) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, FAIL, "output pipeline failed")
+ /* Push direct block data through I/O filter pipeline */
+ if(H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_ENABLE_EDC, filter_cb, &nbytes, &len, &read_buf) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, FAIL, "output pipeline failed")
/* Update info about direct block */
- udata->decompressed = TRUE;
+ udata->decompressed = TRUE;
len = nbytes;
} /* end if */
else
@@ -1818,45 +1822,49 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata,
udata->dblk = NULL;
} /* end if */
else {
- H5Z_cb_t filter_cb = {NULL, NULL}; /* Filter callback structure */
+ H5Z_cb_t filter_cb; /* Filter callback structure */
size_t nbytes; /* Number of bytes used in buffer, after applying reverse filters */
unsigned filter_mask; /* Excluded filters for direct block */
/* Sanity check */
- HDassert(udata->dblk == NULL);
+ HDassert(udata->dblk == NULL);
- /* Allocate buffer to perform I/O filtering on and copy image into
- * it. Must do this as H5Z_pipeline() may resize the buffer
- * provided to it.
- */
- if(NULL == (read_buf = H5MM_malloc(len)))
- HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "memory allocation failed for pipeline buffer")
+ /* Initialize the filter callback struct */
+ filter_cb.op_data = NULL;
+ filter_cb.func = NULL; /* no callback function when failed */
+
+ /* Allocate buffer to perform I/O filtering on and copy image into
+ * it. Must do this as H5Z_pipeline() may resize the buffer
+ * provided to it.
+ */
+ if (NULL == (read_buf = H5MM_malloc(len)))
+ HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "memory allocation failed for pipeline buffer")
/* Copy compressed image into buffer */
- HDmemcpy(read_buf, image, len);
+ HDmemcpy(read_buf, image, len);
- /* Push direct block data through I/O filter pipeline */
- nbytes = len;
- filter_mask = udata->filter_mask;
- if(H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_ENABLE_EDC, filter_cb, &nbytes, &len, &read_buf) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, NULL, "output pipeline failed")
+ /* Push direct block data through I/O filter pipeline */
+ nbytes = len;
+ filter_mask = udata->filter_mask;
+ if (H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_ENABLE_EDC, filter_cb, &nbytes, &len, &read_buf) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, NULL, "output pipeline failed")
- /* Sanity check */
- HDassert(nbytes == dblock->size);
+ /* Sanity check */
+ HDassert(nbytes == dblock->size);
- /* Copy un-filtered data into block's buffer */
- HDmemcpy(dblock->blk, read_buf, dblock->size);
- } /* end if */
+ /* Copy un-filtered data into block's buffer */
+ HDmemcpy(dblock->blk, read_buf, dblock->size);
+ } /* end if */
} /* end if */
else {
/* Sanity checks */
- HDassert(udata->dblk == NULL);
- HDassert(!udata->decompressed);
+ HDassert(udata->dblk == NULL);
+ HDassert(!udata->decompressed);
- /* Allocate block buffer */
-/* XXX: Change to using free-list factories */
- if(NULL == (dblock->blk = H5FL_BLK_MALLOC(direct_block, (size_t)dblock->size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ /* Allocate block buffer */
+ /* XXX: Change to using free-list factories */
+ if (NULL == (dblock->blk = H5FL_BLK_MALLOC(direct_block, (size_t)dblock->size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy image to dblock->blk */
HDassert(dblock->size == len);
@@ -1895,9 +1903,9 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata,
/* Decode checksum on direct block, if requested */
if(hdr->checksum_dblocks) {
- uint32_t stored_chksum; /* Metadata checksum value */
+ uint32_t stored_chksum; /* Metadata checksum value */
- /* checksum verification already done in verify_chksum cb */
+ /* checksum verification already done in verify_chksum cb */
/* Metadata checksum */
UINT32DECODE(image, stored_chksum);
@@ -2188,10 +2196,14 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, hid_t dxpl_id, void *_thing,
/* Check for I/O filters on this heap */
if(hdr->filter_len > 0) {
- H5Z_cb_t filter_cb = {NULL, NULL}; /* Filter callback structure */
+ H5Z_cb_t filter_cb; /* Filter callback structure */
size_t nbytes; /* Number of bytes used */
unsigned filter_mask = 0; /* Filter mask for block */
+ /* Initialize the filter callback struct */
+ filter_cb.op_data = NULL;
+ filter_cb.func = NULL; /* no callback function when failed */
+
/* Allocate buffer to perform I/O filtering on */
write_size = dblock->size;
if(NULL == (write_buf = H5MM_malloc(write_size)))
diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c
index b2a1e68..350100e 100644
--- a/src/H5HFhuge.c
+++ b/src/H5HFhuge.c
@@ -345,9 +345,13 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size);
/* Check for I/O pipeline filter on heap */
if(hdr->filter_len > 0) {
- H5Z_cb_t filter_cb = {NULL, NULL}; /* Filter callback structure */
+ H5Z_cb_t filter_cb; /* Filter callback structure */
size_t nbytes; /* Number of bytes used */
+ /* Initialize the filter callback struct */
+ filter_cb.op_data = NULL;
+ filter_cb.func = NULL; /* no callback function when failed */
+
/* Allocate buffer to perform I/O filtering on */
write_size = obj_size;
if(NULL == (write_buf = H5MM_malloc(write_size)))
@@ -773,10 +777,14 @@ H5HF_huge_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
/* Check for I/O pipeline filter on heap */
if(hdr->filter_len > 0) {
- H5Z_cb_t filter_cb = {NULL, NULL}; /* Filter callback structure */
+ H5Z_cb_t filter_cb; /* Filter callback structure */
size_t read_size; /* Object's size in the file */
size_t nbytes; /* Number of bytes used */
+ /* Initialize the filter callback struct */
+ filter_cb.op_data = NULL;
+ filter_cb.func = NULL; /* no callback function when failed */
+
/* De-filter the object */
read_size = nbytes = obj_size;
if(H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_NO_EDC, filter_cb, &nbytes, &read_size, &read_buf) < 0)
diff --git a/src/H5MF.c b/src/H5MF.c
index 49c7b77..7e06654 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -3247,7 +3247,6 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled)
/* for self referential FSMs */
haddr_t eoa_post_fsm_fsalloc; /* eoa post file space allocation */
/* for self referential FSMs */
- H5FS_stat_t fs_stat; /* Information for hdr FSM */
H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */
H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
hbool_t reset_ring = FALSE; /* Whether we set the ring */
@@ -3310,6 +3309,9 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled)
reset_ring = TRUE;
#ifndef NDEBUG
+{
+ H5FS_stat_t fs_stat; /* Information for hdr FSM */
+
/* Verify that sm_hdr_fspace is floating if it exists */
if(sm_hdr_fspace) {
/* Query free space manager info for this type */
@@ -3357,6 +3359,7 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled)
HDassert(fs_stat.alloc_sect_size == 0);
} /* end if */
} /* end if */
+}
#endif /* NDEBUG */
/* Free the space in the metadata aggregator. Do this via the
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 152e6cc..cf84b47 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,136 +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) */
-};
-
-
-
-/*-------------------------------------------------------------------------
- * 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() */
/*-------------------------------------------------------------------------
@@ -302,11 +167,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)
@@ -710,11 +575,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")
@@ -958,15 +823,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)
@@ -1020,9 +885,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")
@@ -1032,7 +897,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)
@@ -1212,2514 +1077,3 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Oare_mdc_flushes_disabled() */
-
-/*-------------------------------------------------------------------------
- * 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(H5F_USE_LATEST_FLAGS(f, H5F_LATEST_OBJ_HEADER) || store_msg_crt_idx || (oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED))
- oh->version = H5O_VERSION_LATEST;
- else
- oh->version = H5O_VERSION_1;
- 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/H5Oint.c b/src/H5Oint.c
new file mode 100644
index 0000000..6ab5393
--- /dev/null
+++ b/src/H5Oint.c
@@ -0,0 +1,2713 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 */
+};
+
+/* 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_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(H5F_USE_LATEST_FLAGS(f, H5F_LATEST_OBJ_HEADER) || store_msg_crt_idx || (oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED))
+ oh->version = H5O_VERSION_LATEST;
+ else
+ oh->version = H5O_VERSION_1;
+ 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/H5Oprivate.h b/src/H5Oprivate.h
index 563f8fa..e87c148 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
@@ -881,6 +883,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/H5PLint.c b/src/H5PLint.c
index c887f86..b190746 100644
--- a/src/H5PLint.c
+++ b/src/H5PLint.c
@@ -235,11 +235,11 @@ done:
*-------------------------------------------------------------------------
*/
const void *
-H5PL_load(H5PL_type_t type, int id)
+H5PL_load(H5PL_type_t type, H5PL_key_t key)
{
- H5PL_search_params_t search_params;
+ H5PL_search_params_t search_params; /* Plugin search parameters */
hbool_t found = FALSE; /* Whether the plugin was found */
- const void *plugin_info = NULL;
+ const void *plugin_info = NULL; /* Information from the plugin */
const void *ret_value = NULL;
FUNC_ENTER_NOAPI(NULL)
@@ -248,18 +248,17 @@ H5PL_load(H5PL_type_t type, int id)
switch (type) {
case H5PL_TYPE_FILTER:
if ((H5PL_plugin_control_mask_g & H5PL_FILTER_PLUGIN) == 0)
- HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin filter '%d' is not available", id)
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "filter plugins disabled")
break;
-
case H5PL_TYPE_ERROR:
case H5PL_TYPE_NONE:
default:
- HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin '%d' is not valid", id)
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "Invalid plugin type specified")
}
/* Set up the search parameters */
search_params.type = type;
- search_params.id = id;
+ search_params.key.id = key.id;
/* Search in the table of already loaded plugin libraries */
if(H5PL__find_plugin_in_cache(&search_params, &found, &plugin_info) < 0)
@@ -304,11 +303,11 @@ done:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
herr_t
-H5PL__open(const char *path, H5PL_type_t type, int id, hbool_t *success, const void **plugin_info)
+H5PL__open(const char *path, H5PL_type_t type, H5PL_key_t key, hbool_t *success, const void **plugin_info)
{
H5PL_HANDLE handle = NULL;
H5PL_get_plugin_info_t get_plugin_info = NULL;
- htri_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE
@@ -326,35 +325,46 @@ H5PL__open(const char *path, H5PL_type_t type, int id, hbool_t *success, const v
*/
if (NULL == (handle = H5PL_OPEN_DLIB(path))) {
H5PL_CLR_ERROR; /* clear error */
- HGOTO_DONE(SUCCEED);
+ HGOTO_DONE(SUCCEED)
}
/* Return a handle for the function H5PLget_plugin_info in the dynamic library.
* The plugin library is suppose to define this function.
*/
- if (NULL != (get_plugin_info = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC(handle, "H5PLget_plugin_info"))) {
-
- const H5Z_class2_t *info;
+ if (NULL == (get_plugin_info = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC(handle, "H5PLget_plugin_info")))
+ HGOTO_DONE(SUCCEED)
- /* Get the plugin info */
- if (NULL == (info = (const H5Z_class2_t *)(*get_plugin_info)()))
- HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get plugin info")
+ /* Get the plugin information */
+ switch (type) {
+ case H5PL_TYPE_FILTER:
+ {
+ const H5Z_class2_t *filter_info;
- /* Check if the filter IDs match */
- if (info->id == id) {
+ /* Get the plugin info */
+ if (NULL == (filter_info = (const H5Z_class2_t *)(*get_plugin_info)()))
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get filter info from plugin")
- /* Store the plugin in the cache */
- if (H5PL__add_plugin(type, id, handle))
- HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to add new plugin to plugin cache")
+ /* If the filter IDs match, we're done. Set the output parameters. */
+ if (filter_info->id == key.id) {
+ *plugin_info = (const void *)filter_info;
+ *success = TRUE;
+ }
- /* Set output parameters */
- *success = TRUE;
- *plugin_info = (const void *)info;
+ break;
}
- }
+ case H5PL_TYPE_ERROR:
+ case H5PL_TYPE_NONE:
+ default:
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "Invalid plugin type specified")
+ } /* end switch */
+
+ /* If we found the correct plugin, store it in the cache */
+ if (*success)
+ if (H5PL__add_plugin(type, key, handle))
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to add new plugin to plugin cache")
done:
- if (!success && handle)
+ if (!(*success) && handle)
if (H5PL__close(handle) < 0)
HDONE_ERROR(H5E_PLUGIN, H5E_CLOSEERROR, FAIL, "can't close dynamic library")
diff --git a/src/H5PLpath.c b/src/H5PLpath.c
index 435802a..972f1d0 100644
--- a/src/H5PLpath.c
+++ b/src/H5PLpath.c
@@ -689,7 +689,7 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo
continue;
/* attempt to open the dynamic library as a filter library */
- if (H5PL__open(path, search_params->type, search_params->id, found, plugin_info) < 0)
+ if (H5PL__open(path, search_params->type, search_params->key, found, plugin_info) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed")
if (*found)
HGOTO_DONE(SUCCEED)
@@ -755,7 +755,7 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo
continue;
/* attempt to open the dynamic library as a filter library */
- if (H5PL__open(path, search_params->type, search_params->id, found, plugin_info) < 0)
+ if (H5PL__open(path, search_params->type, search_params->key, found, plugin_info) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed")
if (*found)
HGOTO_DONE(SUCCEED)
diff --git a/src/H5PLpkg.h b/src/H5PLpkg.h
index 0d1c271..dfaa4af 100644
--- a/src/H5PLpkg.h
+++ b/src/H5PLpkg.h
@@ -115,8 +115,8 @@
/* Data used to search for plugins */
typedef struct H5PL_search_params_t {
- H5PL_type_t type;
- int id;
+ H5PL_type_t type;
+ H5PL_key_t key;
} H5PL_search_params_t;
@@ -134,13 +134,13 @@ H5_DLL herr_t H5PL__get_plugin_control_mask(unsigned int *mask /*out*/);
H5_DLL herr_t H5PL__set_plugin_control_mask(unsigned int mask);
/* Plugin search and manipulation */
-H5_DLL herr_t H5PL__open(const char *libname, H5PL_type_t type, int id, hbool_t *success /*out*/, const void **plugin_info /*out*/);
+H5_DLL herr_t H5PL__open(const char *libname, H5PL_type_t type, H5PL_key_t key, hbool_t *success /*out*/, const void **plugin_info /*out*/);
H5_DLL herr_t H5PL__close(H5PL_HANDLE handle);
/* Plugin cache calls */
H5_DLL herr_t H5PL__create_plugin_cache(void);
H5_DLL herr_t H5PL__close_plugin_cache(hbool_t *already_closed /*out*/);
-H5_DLL herr_t H5PL__add_plugin(H5PL_type_t type, int id, H5PL_HANDLE handle);
+H5_DLL herr_t H5PL__add_plugin(H5PL_type_t type, H5PL_key_t key, H5PL_HANDLE handle);
H5_DLL herr_t H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *found /*out*/, const void **plugin_info /*out*/);
/* Plugin search path calls */
diff --git a/src/H5PLplugin_cache.c b/src/H5PLplugin_cache.c
index d826ba0..e905ac2 100644
--- a/src/H5PLplugin_cache.c
+++ b/src/H5PLplugin_cache.c
@@ -56,9 +56,9 @@
/* Type for the list of info for opened plugin libraries */
typedef struct H5PL_plugin_t {
- H5PL_type_t type; /* Plugin type */
- int id; /* ID for the plugin */
- H5PL_HANDLE handle; /* Plugin handle */
+ H5PL_type_t type; /* Plugin type */
+ H5PL_key_t key; /* Unique key to identify the plugin */
+ H5PL_HANDLE handle; /* Plugin handle */
} H5PL_plugin_t;
@@ -209,14 +209,14 @@ done:
/*-------------------------------------------------------------------------
* Function: H5PL__add_plugin
*
- * Purpose: Add a plugin to the plugin cached.
+ * Purpose: Add a plugin to the plugin cache.
*
* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-H5PL__add_plugin(H5PL_type_t type, int id, H5PL_HANDLE handle)
+H5PL__add_plugin(H5PL_type_t type, H5PL_key_t key, H5PL_HANDLE handle)
{
herr_t ret_value = SUCCEED;
@@ -229,7 +229,7 @@ H5PL__add_plugin(H5PL_type_t type, int id, H5PL_HANDLE handle)
/* Store the plugin info and bump the # of plugins */
H5PL_cache_g[H5PL_num_plugins_g].type = type;
- H5PL_cache_g[H5PL_num_plugins_g].id = id;
+ H5PL_cache_g[H5PL_num_plugins_g].key = key;
H5PL_cache_g[H5PL_num_plugins_g].handle = handle;
H5PL_num_plugins_g++;
@@ -276,18 +276,18 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f
for (u = 0; u < H5PL_num_plugins_g; u++) {
/* If the plugin type (filter, etc.) and ID match, query the plugin for its info */
- if ((search_params->type == (H5PL_cache_g[u]).type) && (search_params->id == (H5PL_cache_g[u]).id)) {
+ if ((search_params->type == (H5PL_cache_g[u]).type) && (search_params->key.id == (H5PL_cache_g[u]).key.id)) {
H5PL_get_plugin_info_t get_plugin_info_function;
const H5Z_class2_t *filter_info;
/* 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/H5PLprivate.h b/src/H5PLprivate.h
index bc12e64..cc2e258 100644
--- a/src/H5PLprivate.h
+++ b/src/H5PLprivate.h
@@ -33,6 +33,11 @@
/* Library Private Typedefs */
/****************************/
+/* The key that will be used to find the plugin */
+typedef union H5PL_key_t {
+ int id; /* filters */
+} H5PL_key_t;
+
/*****************************/
/* Library-private Variables */
@@ -44,7 +49,7 @@
/***************************************/
/* Internal API routines */
-H5_DLL const void *H5PL_load(H5PL_type_t plugin_type, int type_id);
+H5_DLL const void *H5PL_load(H5PL_type_t plugin_type, H5PL_key_t key);
#endif /* _H5PLprivate_H */
diff --git a/src/H5PLpublic.h b/src/H5PLpublic.h
index 3b36ccd..fe5bdfb 100644
--- a/src/H5PLpublic.h
+++ b/src/H5PLpublic.h
@@ -30,9 +30,9 @@
/* Plugin type used by the plugin library */
typedef enum H5PL_type_t {
- H5PL_TYPE_ERROR = -1, /* Error */
- H5PL_TYPE_FILTER = 0, /* Filter */
- H5PL_TYPE_NONE = 1 /* This must be last! */
+ H5PL_TYPE_ERROR = -1, /* Error */
+ H5PL_TYPE_FILTER = 0, /* Filter */
+ H5PL_TYPE_NONE = 1 /* This must be last! */
} H5PL_type_t;
/* Common dynamic plugin type flags used by the set/get_loading_state functions */
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/H5Sprivate.h b/src/H5Sprivate.h
index 8934726..f125035 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;
diff --git a/src/H5Tdbg.c b/src/H5Tdbg.c
index f434543..eb648f3 100644
--- a/src/H5Tdbg.c
+++ b/src/H5Tdbg.c
@@ -32,9 +32,9 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Tpkg.h" /* Datatypes */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Tpkg.h" /* Datatypes */
/****************/
@@ -74,28 +74,21 @@
/*-------------------------------------------------------------------------
- * Function: H5T__print_stats
+ * Function: H5T__print_stats
*
- * Purpose: Print statistics about a conversion path. Statistics are
- * printed only if all the following conditions are true:
+ * Purpose: Print statistics about a conversion path. Statistics are
+ * printed only if all the following conditions are true:
*
- * 1. The library was compiled with H5T_DEBUG defined.
- * 2. Data type debugging is turned on at run time.
- * 3. The path was called at least one time.
+ * 1. The library was compiled with H5T_DEBUG defined.
+ * 2. Data type debugging is turned on at run time.
+ * 3. The path was called at least one time.
*
- * The optional NPRINT argument keeps track of the number of
- * conversions paths for which statistics have been shown. If
- * its value is zero then table headers are printed before the
- * first line of output.
+ * The optional NPRINT argument keeps track of the number of
+ * conversions paths for which statistics have been shown. If
+ * its value is zero then table headers are printed before the
+ * first line of output.
*
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Robb Matzke
- * Monday, December 14, 1998
- *
- * Modifications:
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -110,34 +103,34 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED * path, int H5_ATTR_UNUSED * nprint/*
FUNC_ENTER_PACKAGE_NOERR
#ifdef H5T_DEBUG
- if(H5DEBUG(T) && path->stats.ncalls > 0) {
- if(nprint && 0 == (*nprint)++) {
- HDfprintf(H5DEBUG(T), "H5T: type conversion statistics:\n");
- HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n",
- "Conversion", "Elmts", "Calls", "User",
- "System", "Elapsed", "Bandwidth");
- HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n",
- "----------", "-----", "-----", "----",
- "------", "-------", "---------");
- }
- if(path->src && path->dst)
+ if (H5DEBUG(T) && path->stats.ncalls > 0) {
+ if (nprint && 0 == (*nprint)++) {
+ HDfprintf(H5DEBUG(T), "H5T: type conversion statistics:\n");
+ HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n",
+ "Conversion", "Elmts", "Calls", "User",
+ "System", "Elapsed", "Bandwidth");
+ HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n",
+ "----------", "-----", "-----", "----",
+ "------", "-------", "---------");
+ }
+ if (path->src && path->dst)
nbytes = MAX(H5T_get_size(path->src), H5T_get_size(path->dst));
- else if(path->src)
+ else if (path->src)
nbytes = H5T_get_size(path->src);
- else if(path->dst)
+ else if (path->dst)
nbytes = H5T_get_size(path->dst);
else
nbytes = 0;
- nbytes *= path->stats.nelmts;
- H5_bandwidth(bandwidth, (double)nbytes, path->stats.timer.etime);
- HDfprintf(H5DEBUG(T), " %-16s %10Hd %10d %8.2f %8.2f %8.2f %10s\n",
- path->name,
- path->stats.nelmts,
- path->stats.ncalls,
- path->stats.timer.utime,
- path->stats.timer.stime,
- path->stats.timer.etime,
- bandwidth);
+ nbytes *= path->stats.nelmts;
+ H5_bandwidth(bandwidth, (double)nbytes, path->stats.timer.etime);
+ HDfprintf(H5DEBUG(T), " %-16s %10Hd %10d %8.2f %8.2f %8.2f %10s\n",
+ path->name,
+ path->stats.nelmts,
+ path->stats.ncalls,
+ path->stats.timer.utime,
+ path->stats.timer.stime,
+ path->stats.timer.etime,
+ bandwidth);
}
#endif
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -145,24 +138,20 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED * path, int H5_ATTR_UNUSED * nprint/*
/*-------------------------------------------------------------------------
- * Function: H5T_debug
- *
- * Purpose: Prints information about a data type.
+ * Function: H5T_debug
*
- * Return: Non-negative on success/Negative on failure
+ * Purpose: Prints information about a data type.
*
- * Programmer: Robb Matzke
- * Wednesday, January 7, 1998
- *
- * Modifications:
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5T_debug(const H5T_t *dt, FILE *stream)
{
- const char *s1 = "", *s2 = "";
- unsigned i;
+ const char *s1 = "";
+ const char *s2 = "";
+ unsigned i;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -171,7 +160,7 @@ H5T_debug(const H5T_t *dt, FILE *stream)
HDassert(dt);
HDassert(stream);
- switch(dt->shared->type) {
+ switch (dt->shared->type) {
case H5T_NO_CLASS:
HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "no class");
break;
@@ -221,9 +210,9 @@ H5T_debug(const H5T_t *dt, FILE *stream)
default:
s1 = "";
break;
- } /* end switch */
+ } /* end switch */
- switch(dt->shared->state) {
+ switch (dt->shared->state) {
case H5T_STATE_TRANSIENT:
s2 = "[transient]";
break;
@@ -245,14 +234,14 @@ H5T_debug(const H5T_t *dt, FILE *stream)
break;
default:
HDassert(0 && "This Should never be executed!");
- } /* end switch */
+ } /* end switch */
- fprintf(stream, "%s%s {nbytes=%lu", s1, s2, (unsigned long)(dt->shared->size));
+ HDfprintf(stream, "%s%s {nbytes=%lu", s1, s2, (unsigned long)(dt->shared->size));
- if(H5T_IS_ATOMIC(dt->shared)) {
- uint64_t tmp;
+ if (H5T_IS_ATOMIC(dt->shared)) {
+ uint64_t tmp;
- switch(dt->shared->u.atomic.order) {
+ switch (dt->shared->u.atomic.order) {
case H5T_ORDER_ERROR:
HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "order error");
break;
@@ -277,17 +266,16 @@ H5T_debug(const H5T_t *dt, FILE *stream)
default:
s1 = "order?";
break;
- } /* end switch */
+ } /* end switch */
+
+ HDfprintf(stream, ", %s", s1);
- fprintf(stream, ", %s", s1);
+ if (dt->shared->u.atomic.offset)
+ HDfprintf(stream, ", offset=%lu", (unsigned long) (dt->shared->u.atomic.offset));
+ if (dt->shared->u.atomic.prec != 8 * dt->shared->size)
+ HDfprintf(stream, ", prec=%lu", (unsigned long) (dt->shared->u.atomic.prec));
- if(dt->shared->u.atomic.offset)
- fprintf(stream, ", offset=%lu",
- (unsigned long) (dt->shared->u.atomic.offset));
- if(dt->shared->u.atomic.prec != 8 * dt->shared->size)
- fprintf(stream, ", prec=%lu",
- (unsigned long) (dt->shared->u.atomic.prec));
- switch(dt->shared->type) {
+ switch (dt->shared->type) {
case H5T_NO_CLASS:
HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "no class");
break;
@@ -313,7 +301,7 @@ H5T_debug(const H5T_t *dt, FILE *stream)
} /* end switch */
if(s1)
- fprintf(stream, ", %s", s1);
+ HDfprintf(stream, ", %s", s1);
break;
case H5T_FLOAT:
@@ -339,23 +327,24 @@ H5T_debug(const H5T_t *dt, FILE *stream)
break;
} /* end switch */
- fprintf(stream, ", sign=%lu+1",
+ HDfprintf(stream, ", sign=%lu+1",
(unsigned long)(dt->shared->u.atomic.u.f.sign));
- fprintf(stream, ", mant=%lu+%lu (%s)",
+ HDfprintf(stream, ", mant=%lu+%lu (%s)",
(unsigned long)(dt->shared->u.atomic.u.f.mpos),
(unsigned long)(dt->shared->u.atomic.u.f.msize), s1);
- fprintf(stream, ", exp=%lu+%lu",
+ HDfprintf(stream, ", exp=%lu+%lu",
(unsigned long)(dt->shared->u.atomic.u.f.epos),
(unsigned long)(dt->shared->u.atomic.u.f.esize));
tmp = dt->shared->u.atomic.u.f.ebias >> 32;
- if(tmp) {
+ if (tmp) {
size_t hi = (size_t)tmp;
size_t lo = (size_t)(dt->shared->u.atomic.u.f.ebias & 0xffffffff);
- fprintf(stream, " bias=0x%08lx%08lx",
+ HDfprintf(stream, " bias=0x%08lx%08lx",
(unsigned long)hi, (unsigned long)lo);
- } else {
+ }
+ else {
size_t lo = (size_t)(dt->shared->u.atomic.u.f.ebias & 0xffffffff);
- fprintf(stream, " bias=0x%08lx", (unsigned long)lo);
+ HDfprintf(stream, " bias=0x%08lx", (unsigned long)lo);
}
break;
@@ -372,69 +361,73 @@ H5T_debug(const H5T_t *dt, FILE *stream)
default:
/* No additional info */
break;
- } /* end switch */
- } else if(H5T_COMPOUND == dt->shared->type) {
- /* Compound data type */
- for(i = 0; i < dt->shared->u.compnd.nmembs; i++) {
- fprintf(stream, "\n\"%s\" @%lu",
- dt->shared->u.compnd.memb[i].name,
- (unsigned long)(dt->shared->u.compnd.memb[i].offset));
- fprintf(stream, " ");
- H5T_debug(dt->shared->u.compnd.memb[i].type, stream);
- } /* end for */
- fprintf(stream, "\n");
- } else if(H5T_VLEN == dt->shared->type) {
- switch(dt->shared->u.vlen.loc) {
+ } /* end switch */
+ }
+ else if (H5T_COMPOUND == dt->shared->type) {
+ /* Compound data type */
+ for (i = 0; i < dt->shared->u.compnd.nmembs; i++) {
+ HDfprintf(stream, "\n\"%s\" @%lu",
+ dt->shared->u.compnd.memb[i].name,
+ (unsigned long)(dt->shared->u.compnd.memb[i].offset));
+ HDfprintf(stream, " ");
+ H5T_debug(dt->shared->u.compnd.memb[i].type, stream);
+ } /* end for */
+ HDfprintf(stream, "\n");
+ }
+ else if (H5T_VLEN == dt->shared->type) {
+ switch (dt->shared->u.vlen.loc) {
case H5T_LOC_BADLOC:
HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "invalid datatype location");
break;
case H5T_LOC_MEMORY:
- fprintf(stream, ", loc=memory");
+ HDfprintf(stream, ", loc=memory");
break;
case H5T_LOC_DISK:
- fprintf(stream, ", loc=disk");
+ HDfprintf(stream, ", loc=disk");
break;
case H5T_LOC_MAXLOC:
default:
- fprintf(stream, ", loc=UNKNOWN");
+ HDfprintf(stream, ", loc=UNKNOWN");
break;
} /* end switch */
- if(H5T_IS_VL_STRING(dt->shared))
+ if (H5T_IS_VL_STRING(dt->shared))
/* Variable length string datatype */
- fprintf(stream, ", variable-length");
+ HDfprintf(stream, ", variable-length");
else {
/* Variable length sequence datatype */
- fprintf(stream, " VLEN ");
+ HDfprintf(stream, " VLEN ");
H5T_debug(dt->shared->parent, stream);
- fprintf(stream, "\n");
+ HDfprintf(stream, "\n");
} /* end else */
- } else if(H5T_ENUM == dt->shared->type) {
+ }
+ else if (H5T_ENUM == dt->shared->type) {
size_t base_size;
- /* Enumeration data type */
- fprintf(stream, " ");
- H5T_debug(dt->shared->parent, stream);
- base_size = dt->shared->parent->shared->size;
- for(i = 0; i < dt->shared->u.enumer.nmembs; i++) {
+ /* Enumeration data type */
+ HDfprintf(stream, " ");
+ H5T_debug(dt->shared->parent, stream);
+ base_size = dt->shared->parent->shared->size;
+ for (i = 0; i < dt->shared->u.enumer.nmembs; i++) {
size_t k;
- fprintf(stream, "\n\"%s\" = 0x", dt->shared->u.enumer.name[i]);
- for(k = 0; k < base_size; k++)
- fprintf(stream, "%02lx",
- (unsigned long)(dt->shared->u.enumer.value + (i * base_size) + k));
- } /* end for */
- fprintf(stream, "\n");
- } else if(H5T_OPAQUE == dt->shared->type) {
- fprintf(stream, ", tag=\"%s\"", dt->shared->u.opaque.tag);
- } else {
- /* Unknown */
- fprintf(stream, "unknown class %d\n", (int)(dt->shared->type));
+ HDfprintf(stream, "\n\"%s\" = 0x", dt->shared->u.enumer.name[i]);
+ for (k = 0; k < base_size; k++)
+ HDfprintf(stream, "%02lx", (unsigned long)(dt->shared->u.enumer.value + (i * base_size) + k));
+ } /* end for */
+ HDfprintf(stream, "\n");
+ }
+ else if (H5T_OPAQUE == dt->shared->type) {
+ HDfprintf(stream, ", tag=\"%s\"", dt->shared->u.opaque.tag);
+ }
+ else {
+ /* Unknown */
+ HDfprintf(stream, "unknown class %d\n", (int)(dt->shared->type));
}
- fprintf(stream, "}");
+ HDfprintf(stream, "}");
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index f2da62e..17cdc49 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..6f173b2 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,24 +86,24 @@ H5Z__init_package(void)
FUNC_ENTER_PACKAGE
/* Internal filters */
- if(H5Z_register(H5Z_SHUFFLE) < 0)
+ if (H5Z_register(H5Z_SHUFFLE) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register shuffle filter")
- if(H5Z_register(H5Z_FLETCHER32) < 0)
+ if (H5Z_register(H5Z_FLETCHER32) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register fletcher32 filter")
- if(H5Z_register(H5Z_NBIT) < 0)
+ if (H5Z_register(H5Z_NBIT) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register nbit filter")
- if(H5Z_register(H5Z_SCALEOFFSET) < 0)
+ 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)
- HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register deflate filter")
+ 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)
- HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register szip filter")
+ if (H5Z_register(H5Z_SZIP) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register szip filter")
#endif /* H5_HAVE_FILTER_SZIP */
done:
@@ -180,7 +180,7 @@ H5Z_term_package(void)
} /* end if */
#endif /* H5Z_DEBUG */
/* Free the table of filters */
- if(H5Z_table_g) {
+ if (H5Z_table_g) {
H5Z_table_g = (H5Z_class2_t *)H5MM_xfree(H5Z_table_g);
#ifdef H5Z_DEBUG
H5Z_stat_table_g = (H5Z_stats_t *)H5MM_xfree(H5Z_stat_table_g);
@@ -191,7 +191,7 @@ H5Z_term_package(void)
} /* end if */
/* Mark interface as closed */
- if(0 == n)
+ if (0 == n)
H5_PKG_INIT_VAR = FALSE;
} /* end if */
@@ -211,15 +211,15 @@ 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);
/* Check args */
if (cls_real==NULL)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter class")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter class")
/* Check H5Z_class_t version number; this is where a function to convert
* from an outdated version should be called.
@@ -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;
@@ -255,16 +255,16 @@ H5Zregister(const void *cls)
#endif /* H5_NO_DEPRECATED_SYMBOLS */
} /* end if */
- 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)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "unable to modify predefined filters")
- if (cls_real->filter==NULL)
+ 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)
+ 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")
/* Do it */
- if (H5Z_register (cls_real)<0)
- HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter")
+ if (H5Z_register(cls_real) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter")
done:
FUNC_LEAVE_API(ret_value)
@@ -275,16 +275,17 @@ done:
* Function: H5Z_register
*
* Purpose: Same as the public version except this one allows filters
- * to be set for predefined method numbers <H5Z_FILTER_RESERVED
+ * 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)
@@ -292,23 +293,23 @@ H5Z_register (const H5Z_class2_t *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)
+ if (!table)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend filter table")
H5Z_table_g = table;
#ifdef H5Z_DEBUG
- if(!stat_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 */
@@ -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,11 +449,11 @@ 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)))
+ 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)
+ 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:
@@ -483,24 +486,24 @@ 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)
+ 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)
+ 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)
+ 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)
@@ -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
@@ -532,24 +535,24 @@ H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *
HDassert(obj_ptr);
/* Get the dataset creation property */
- if((ocpl_id = H5D_get_create_plist((H5D_t *)obj_ptr)) < 0)
+ 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)
+ 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)
+ 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)
@@ -569,7 +572,7 @@ 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
@@ -577,8 +580,8 @@ H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void H5_ATTR_UNUS
/* 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)
+ 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 */
@@ -598,16 +601,16 @@ 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)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number")
+ 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)
+ if ((ret_value = H5Z_filter_avail(id)) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "unable to check the availability of the filter")
done:
@@ -626,22 +629,25 @@ 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 */
+ H5PL_key_t key; /* Key for finding a plugin */
+ const H5Z_class2_t *filter_info; /* Filter information */
+ size_t i; /* Local index variable */
+ 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)
+ 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)
+ key.id = (int)id;
+ if (NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, key))) {
+ 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)
} /* end H5Z_filter_avail() */
@@ -666,52 +672,52 @@ 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")
} /* 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)
+ 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")
} /* end if */
@@ -745,8 +751,9 @@ 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 */
+ H5O_layout_t *dcpl_layout = NULL; /* Dataset's layout information */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -754,55 +761,61 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type
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 */
+
+ /* Get memory for the layout */
+ if (NULL == (dcpl_layout = (H5O_layout_t *)H5MM_calloc(sizeof(H5O_layout_t))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate dcpl layout buffer")
/* 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++)
- 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")
+ /* 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")
/* Get ID for dataspace to pass to filter routines */
- if((space_id = H5I_register(H5I_DATASPACE, space, FALSE)) < 0) {
+ 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 */
+ HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
+ }
/* 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")
- } /* end if */
- } /* end if */
- } /* end if */
+ 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")
+ }
+ }
+ }
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")
+ if (dcpl_layout)
+ dcpl_layout = (H5O_layout_t *)H5MM_xfree(dcpl_layout);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_prepare_prelude_callback_dcpl() */
@@ -814,7 +827,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,7 +843,7 @@ 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)
+ 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:
@@ -844,7 +858,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,7 +874,7 @@ 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)
+ 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:
@@ -874,7 +889,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
@@ -887,7 +903,7 @@ H5Z_can_apply_direct(const H5O_pline_t *pline)
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)
+ 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:
@@ -902,7 +918,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
@@ -919,7 +936,7 @@ H5Z_set_local_direct(const H5O_pline_t *pline)
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)
+ 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:
@@ -930,17 +947,18 @@ 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)
@@ -950,12 +968,12 @@ H5Z_modify(const H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags,
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)
+ if (idx > pline->nused)
HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline")
/* Change parameters for filter */
@@ -963,25 +981,25 @@ H5Z_modify(const H5O_pline_t *pline, H5Z_filter_t filter, unsigned 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)
+ 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,15 +1014,16 @@ 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)
@@ -1017,15 +1036,15 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags,
* 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,20 +1055,20 @@ 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.
*/
- for(n = 0; n < pline->nalloc; ++n)
- if(x.filter[n].cd_values == (void *) ~((size_t) NULL))
+ for (n = 0; n < pline->nalloc; ++n)
+ if (x.filter[n].cd_values == (void *) ~((size_t) NULL))
x.filter[n].cd_values = x.filter[n]._cd_values;
/* Point to newly allocated buffer */
@@ -1061,22 +1080,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)
+ 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 +1114,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 +1126,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 +1141,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)
+ 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 +1168,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,94 +1194,96 @@ 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(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;
+ H5PL_key_t key;
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)))) {
+ key.id = (int)(pline->filter[idx].id);
+ if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, key))) {
/* Register the filter we loaded */
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")
- } /* end if */
+ }
} /* end if */
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;
+ 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)
+ 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 +1298,35 @@ 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;
+ 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)
+ 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 +1342,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 *
@@ -1335,12 +1358,12 @@ H5Z_filter_info(const H5O_pline_t *pline, H5Z_filter_t filter)
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)
HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, NULL, "filter not in pipeline")
/* Set return value */
@@ -1365,8 +1388,8 @@ 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)
@@ -1374,12 +1397,12 @@ H5Z_filter_in_pline(const H5O_pline_t *pline, H5Z_filter_t filter)
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,14 +1417,15 @@ 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)
@@ -1409,14 +1433,14 @@ H5Z_all_filters_avail(const H5O_pline_t *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)
+ if (j == H5Z_table_used_g)
HGOTO_DONE(FALSE)
} /* end for */
@@ -1432,7 +1456,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
@@ -1447,57 +1472,57 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter)
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)
+ 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)
+ 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 = (char *)H5MM_xfree(pline->filter[idx].name);
- if(pline->filter[idx].cd_values && 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)
+ 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 */
+ }
+ }
/* Decrement number of used filters */
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 +1535,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 +1549,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 +1562,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 +1576,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)))
+ 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/H5Zpublic.h b/src/H5Zpublic.h
index f6b313e..fcb2d37 100644
--- a/src/H5Zpublic.h
+++ b/src/H5Zpublic.h
@@ -129,8 +129,8 @@ typedef H5Z_cb_return_t (*H5Z_filter_func_t)(H5Z_filter_t filter, void* buf,
/* Structure for filter callback property */
typedef struct H5Z_cb_t {
- H5Z_filter_func_t func;
- void* op_data;
+ H5Z_filter_func_t func;
+ void *op_data;
} H5Z_cb_t;
#ifdef __cplusplus
@@ -206,14 +206,14 @@ typedef size_t (*H5Z_func_t)(unsigned int flags, size_t cd_nelmts,
* contain a pointers to the filter function and timing statistics.
*/
typedef struct H5Z_class2_t {
- int version; /* Version number of the H5Z_class_t struct */
- H5Z_filter_t id; /* Filter ID number */
- unsigned encoder_present; /* Does this filter have an encoder? */
- unsigned decoder_present; /* Does this filter have a decoder? */
- const char *name; /* Comment for debugging */
- H5Z_can_apply_func_t can_apply; /* The "can apply" callback for a filter */
- H5Z_set_local_func_t set_local; /* The "set local" callback for a filter */
- H5Z_func_t filter; /* The actual filter function */
+ int version; /* Version number of the H5Z_class_t struct */
+ H5Z_filter_t id; /* Filter ID number */
+ unsigned encoder_present; /* Does this filter have an encoder? */
+ unsigned decoder_present; /* Does this filter have a decoder? */
+ const char *name; /* Comment for debugging */
+ H5Z_can_apply_func_t can_apply; /* The "can apply" callback for a filter */
+ H5Z_set_local_func_t set_local; /* The "set local" callback for a filter */
+ H5Z_func_t filter; /* The actual filter function */
} H5Z_class2_t;
H5_DLL herr_t H5Zregister(const void *cls);
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/H5system.c b/src/H5system.c
index a1cdf19..a8726c2 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -977,7 +977,7 @@ Wround(double arg)
float
Wroundf(float arg)
{
- return arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F);
+ return (float)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F));
}
#endif /* H5_HAVE_WIN32_API */
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 cced9f7..5d81c69 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 ()
@@ -412,17 +412,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 72c0c31..3089e1b 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 8a4b70c..4f03386 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 mdset.h5 compact_dataset.h5 dataset.h5 d
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/cache_tagging.c b/test/cache_tagging.c
index 99ab49c..9c79968 100644
--- a/test/cache_tagging.c
+++ b/test/cache_tagging.c
@@ -3631,11 +3631,14 @@ error:
static unsigned
check_invalid_tag_application(void)
{
+#if H5C_DO_TAGGING_SANITY_CHECKS
/* Variables */
H5F_t * f = NULL;
- hid_t fid, dxpl_id = -1;
+ hid_t fid = -1;
+ hid_t dxpl_id = -1;
haddr_t addr;
H5HL_t * lheap = NULL;
+#endif /* H5C_DO_TAGGING_SANITY_CHECKS */
/* Testing Macro */
TESTING("failure on invalid tag application");
@@ -3683,8 +3686,8 @@ check_invalid_tag_application(void)
PASSED();
#else
SKIPPED();
- printf(" test skipped because sanity checking on tag value is disabled.\n");
-#endif
+ HDprintf(" test skipped because sanity checking on tag value is disabled.\n");
+#endif /* H5C_DO_TAGGING_SANITY_CHECKS */
return 0;
@@ -3791,10 +3794,10 @@ main(void)
HDremove(FILENAME2);
/* Return Errors */
- return(nerrs > 0);
+ return nerrs > 0;
error:
/* Return with Error */
- return(1);
+ return 1;
} /* main */
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/dynlib2.c b/test/dynlib2.c
deleted file mode 100644
index 2574d4d..0000000
--- a/test/dynlib2.c
+++ /dev/null
@@ -1,92 +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_DYNLIB2 258
-#define MULTIPLIER 3
-
-static size_t H5Z_filter_dynlib2(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] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_DYNLIB2, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "dynlib2", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)H5Z_filter_dynlib2, /* The actual filter function */
-}};
-
-H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
-const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB2;}
-
-/*-------------------------------------------------------------------------
- * Function: H5Z_filter_dynlib2
- *
- * 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
- *
- * Programmer: Raymond Lu
- * 29 March 2013
- *
- *-------------------------------------------------------------------------
- */
-static size_t
-H5Z_filter_dynlib2(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 with MULTIPLIER */
- while(buf_left > 0) {
- *int_ptr++ /= MULTIPLIER;
- buf_left -= sizeof(int);
- } /* end while */
- } /* end if */
- else { /*write*/
- /* Multiply the original value with MULTIPLIER */
- while(buf_left > 0) {
- *int_ptr++ *= MULTIPLIER;
- buf_left -= sizeof(int);
- } /* end while */
- } /* end else */
-
- return nbytes;
-} /* end H5Z_filter_dynlib2() */
-
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/error_test.c b/test/error_test.c
index 9c39065..5356fa7 100644
--- a/test/error_test.c
+++ b/test/error_test.c
@@ -82,35 +82,33 @@ static herr_t custom_print_cb(unsigned n, const H5E_error2_t *err_desc,
/*-------------------------------------------------------------------------
- * Function: test_error
+ * Function: test_error
*
- * Purpose: Test error API functions
+ * Purpose: Test error API functions
*
- * Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Raymond Lu
- * July 10, 2003
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
static herr_t
test_error(hid_t file)
{
- hid_t dataset, space;
- hid_t estack_id;
+ hid_t dataset = -1;
+ hid_t space = -1;
+ hid_t estack_id = -1;
hsize_t dims[2];
const char *FUNC_test_error = "test_error";
H5E_auto2_t old_func;
- void *old_data;
+ void *old_data = NULL;
HDfprintf(stderr, "\nTesting error API based on data I/O\n");
/* Create the data space */
dims[0] = DIM0;
dims[1] = DIM1;
- if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR;
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR;
/* Test H5E_BEGIN_TRY */
H5E_BEGIN_TRY {
@@ -118,40 +116,40 @@ test_error(hid_t file)
} H5E_END_TRY;
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ if ((dataset = H5Dcreate2(file, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
H5Epush(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_CREATE,
"H5Dcreate2 failed");
goto error;
- } /* end if */
+ }
/* Test enabling and disabling default printing */
- if(H5Eget_auto2(H5E_DEFAULT, &old_func, &old_data) < 0)
- TEST_ERROR;
- if(old_data != NULL)
- TEST_ERROR;
+ if (H5Eget_auto2(H5E_DEFAULT, &old_func, &old_data) < 0)
+ TEST_ERROR;
+ if (old_data != NULL)
+ TEST_ERROR;
#ifdef H5_USE_16_API
if (old_func != (H5E_auto_t)H5Eprint)
- TEST_ERROR;
+ TEST_ERROR;
#else /* H5_USE_16_API */
if (old_func != (H5E_auto2_t)H5Eprint2)
- TEST_ERROR;
+ TEST_ERROR;
#endif /* H5_USE_16_API */
- if(H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0)
+ if (H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0)
TEST_ERROR;
/* Make H5Dwrite fail, verify default print is disabled */
- if(H5Dwrite(FAKE_ID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2) >= 0) {
+ if (H5Dwrite(FAKE_ID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2) >= 0) {
H5Epush(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_WRITE,
"H5Dwrite shouldn't succeed");
goto error;
- } /* end if */
+ }
- if(H5Eset_auto2(H5E_DEFAULT, old_func, old_data) < 0)
+ if (H5Eset_auto2(H5E_DEFAULT, old_func, old_data) < 0)
TEST_ERROR;
/* Test saving and restoring the current error stack */
- if(H5Dwrite(FAKE_ID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2) < 0) {
+ if (H5Dwrite(FAKE_ID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2) < 0) {
H5Epush(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_WRITE,
"H5Dwrite failed as supposed to");
estack_id = H5Eget_current_stack();
@@ -159,10 +157,11 @@ test_error(hid_t file)
H5Sclose(space);
H5Eset_current_stack(estack_id);
goto error;
- } /* end if */
+ }
/* In case program comes to this point, close dataset */
- if(H5Dclose(dataset) < 0) TEST_ERROR;
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR;
TEST_ERROR;
@@ -172,16 +171,12 @@ test_error(hid_t file)
/*-------------------------------------------------------------------------
- * Function: init_error
+ * Function: init_error
*
- * Purpose: Initialize error information.
+ * Purpose: Initialize error information.
*
- * Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Raymond Lu
- * July 10, 2003
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -194,46 +189,46 @@ init_error(void)
char *msg = NULL;
H5E_type_t msg_type;
- if(NULL == (cls_name = (char *)HDmalloc(HDstrlen(ERR_CLS_NAME) + 1)))
+ if (NULL == (cls_name = (char *)HDmalloc(HDstrlen(ERR_CLS_NAME) + 1)))
TEST_ERROR
- if(NULL == (msg = (char *)HDmalloc(HDstrlen(ERR_MIN_SUBROUTINE_MSG) + 1)))
+ if (NULL == (msg = (char *)HDmalloc(HDstrlen(ERR_MIN_SUBROUTINE_MSG) + 1)))
TEST_ERROR
- if((ERR_CLS = H5Eregister_class(ERR_CLS_NAME, PROG_NAME, PROG_VERS)) < 0)
+ if ((ERR_CLS = H5Eregister_class(ERR_CLS_NAME, PROG_NAME, PROG_VERS)) < 0)
TEST_ERROR;
- if(cls_size != H5Eget_class_name(ERR_CLS, cls_name, (size_t)cls_size) + 1)
+ if (cls_size != H5Eget_class_name(ERR_CLS, cls_name, (size_t)cls_size) + 1)
TEST_ERROR;
- if(HDstrcmp(ERR_CLS_NAME, cls_name))
+ if (HDstrcmp(ERR_CLS_NAME, cls_name))
TEST_ERROR;
- if((ERR_MAJ_TEST = H5Ecreate_msg(ERR_CLS, H5E_MAJOR, ERR_MAJ_TEST_MSG)) < 0)
+ if ((ERR_MAJ_TEST = H5Ecreate_msg(ERR_CLS, H5E_MAJOR, ERR_MAJ_TEST_MSG)) < 0)
TEST_ERROR;
- if((ERR_MAJ_IO = H5Ecreate_msg(ERR_CLS, H5E_MAJOR, ERR_MAJ_IO_MSG)) < 0)
+ if ((ERR_MAJ_IO = H5Ecreate_msg(ERR_CLS, H5E_MAJOR, ERR_MAJ_IO_MSG)) < 0)
TEST_ERROR;
- if((ERR_MAJ_API = H5Ecreate_msg(ERR_CLS, H5E_MAJOR, ERR_MAJ_API_MSG)) < 0)
+ if ((ERR_MAJ_API = H5Ecreate_msg(ERR_CLS, H5E_MAJOR, ERR_MAJ_API_MSG)) < 0)
TEST_ERROR;
- if((ERR_MIN_SUBROUTINE = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_SUBROUTINE_MSG)) < 0)
+ if ((ERR_MIN_SUBROUTINE = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_SUBROUTINE_MSG)) < 0)
TEST_ERROR;
- if((ERR_MIN_ERRSTACK = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_ERRSTACK_MSG)) < 0)
+ if ((ERR_MIN_ERRSTACK = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_ERRSTACK_MSG)) < 0)
TEST_ERROR;
- if((ERR_MIN_CREATE = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_CREATE_MSG)) < 0)
+ if ((ERR_MIN_CREATE = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_CREATE_MSG)) < 0)
TEST_ERROR;
- if((ERR_MIN_WRITE = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_WRITE_MSG)) < 0)
+ if ((ERR_MIN_WRITE = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_WRITE_MSG)) < 0)
TEST_ERROR;
- if((ERR_MIN_GETNUM = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_GETNUM_MSG)) < 0)
+ if ((ERR_MIN_GETNUM = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_GETNUM_MSG)) < 0)
TEST_ERROR;
- if(msg_size != H5Eget_msg(ERR_MIN_SUBROUTINE, &msg_type, msg, (size_t)msg_size) + 1)
+ if (msg_size != H5Eget_msg(ERR_MIN_SUBROUTINE, &msg_type, msg, (size_t)msg_size) + 1)
TEST_ERROR;
- if(msg_type != H5E_MINOR)
+ if (msg_type != H5E_MINOR)
TEST_ERROR;
- if(HDstrcmp(msg, ERR_MIN_SUBROUTINE_MSG))
+ if (HDstrcmp(msg, ERR_MIN_SUBROUTINE_MSG))
TEST_ERROR;
/* Register another class for later testing. */
- if((ERR_CLS2 = H5Eregister_class(ERR_CLS2_NAME, PROG2_NAME, PROG_VERS)) < 0)
+ if ((ERR_CLS2 = H5Eregister_class(ERR_CLS2_NAME, PROG2_NAME, PROG_VERS)) < 0)
TEST_ERROR;
HDfree(cls_name);
@@ -242,9 +237,9 @@ init_error(void)
return 0;
error:
- if(cls_name)
+ if (cls_name)
HDfree(cls_name);
- if(msg)
+ if (msg)
HDfree(msg);
return -1;
@@ -252,16 +247,12 @@ error:
/*-------------------------------------------------------------------------
- * Function: error_stack
- *
- * Purpose: Manipulates current error stack.
+ * Function: error_stack
*
- * Return: Success: 0
+ * Purpose: Manipulates current error stack.
*
- * Failure: -1
- *
- * Programmer: Raymond Lu
- * July 14, 2003
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -271,23 +262,23 @@ error_stack(void)
ssize_t err_num;
const char *FUNC_error_stack = "error_stack";
- if((err_num = H5Eget_num(H5E_DEFAULT)) < 0)
+ if ((err_num = H5Eget_num(H5E_DEFAULT)) < 0)
TEST_ERROR;
- if(err_num)
+ if (err_num)
TEST_ERROR;
- if((ERR_STACK = H5Eget_current_stack()) < 0)
+ if ((ERR_STACK = H5Eget_current_stack()) < 0)
TEST_ERROR;
/* Make it push error, force this function to fail */
- if((err_num = H5Eget_num(ERR_STACK)) == 0) {
+ if ((err_num = H5Eget_num(ERR_STACK)) == 0) {
H5Epush(ERR_STACK, __FILE__, FUNC_error_stack, __LINE__, ERR_CLS, ERR_MAJ_API, ERR_MIN_GETNUM,
"Get number test failed, returned %d", (int)err_num);
goto error;
- } /* end if */
+ }
/* In case program falls through here, close the stack and let it fail. */
- if(H5Eclose_stack(ERR_STACK) < 0)
+ if (H5Eclose_stack(ERR_STACK) < 0)
TEST_ERROR;
return -1;
@@ -300,14 +291,10 @@ error:
/*-------------------------------------------------------------------------
* Function: long_desc_cb
*
- * Purpose: Callback function to help test long description handling
- *
- * Return: Success: 0
+ * Purpose: Callback function to help test long description handling
*
- * Failure: -1
- *
- * Programmer: Quincey Koziol
- * January 19, 2005
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -316,24 +303,20 @@ long_desc_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *clie
{
char *real_desc = (char *)client_data;
- if(err_desc->desc != NULL && HDstrcmp(err_desc->desc, real_desc) == 0)
- return(0);
+ if (err_desc->desc != NULL && HDstrcmp(err_desc->desc, real_desc) == 0)
+ return 0;
else
- return(-1);
+ return -1;
} /* end long_desc_cb() */
/*-------------------------------------------------------------------------
- * Function: test_long_desc
+ * Function: test_long_desc
*
- * Purpose: Test long error description handling
+ * Purpose: Test long error description handling
*
- * Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Quincey Koziol
- * January 19, 2005
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -347,56 +330,59 @@ test_long_desc(void)
const char *test_FUNC = "test_long_desc";
/* Allocate space for the error description info */
- if(NULL == (long_desc = (char*)HDmalloc(LONG_DESC_SIZE))) TEST_ERROR;
- if(NULL == (full_desc = (char*)HDmalloc(LONG_DESC_SIZE + 128))) TEST_ERROR;
+ if (NULL == (long_desc = (char *)HDmalloc(LONG_DESC_SIZE)))
+ TEST_ERROR;
+ if (NULL == (full_desc = (char *)HDmalloc(LONG_DESC_SIZE + 128)))
+ TEST_ERROR;
/* Create the long part of the error description */
- for(u = 0; u < LONG_DESC_SIZE; u++)
+ for (u = 0; u < LONG_DESC_SIZE; u++)
long_desc[u] = (char)('A' + (u % 26));
long_desc[LONG_DESC_SIZE - 1] = '\0';
/* Clear the default error stack */
- if(H5Eclear2(H5E_DEFAULT) < 0) TEST_ERROR;
+ if (H5Eclear2(H5E_DEFAULT) < 0)
+ TEST_ERROR;
/* Push an error with a long description */
- if(H5Epush(H5E_DEFAULT, __FILE__, test_FUNC, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, format, long_desc) < 0) TEST_ERROR;
+ if (H5Epush(H5E_DEFAULT, __FILE__, test_FUNC, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, format, long_desc) < 0)
+ TEST_ERROR;
/* Create the string that should be in the description. Must use HDsnprintf here
- * because snprintf is _snprintf on Windows */
+ * because snprintf is _snprintf on Windows
+ */
HDsnprintf(full_desc, (size_t)(LONG_DESC_SIZE + 128), format, long_desc);
/* Make certain that the description is correct */
- if(H5Ewalk2(H5E_DEFAULT, H5E_WALK_UPWARD, long_desc_cb, full_desc) < 0) TEST_ERROR;
+ if (H5Ewalk2(H5E_DEFAULT, H5E_WALK_UPWARD, long_desc_cb, full_desc) < 0)
+ TEST_ERROR;
/* Clear the default error stack again */
- if(H5Eclear2(H5E_DEFAULT) < 0) TEST_ERROR;
+ if (H5Eclear2(H5E_DEFAULT) < 0)
+ TEST_ERROR;
HDfree(long_desc);
HDfree(full_desc);
- return(0);
+ return 0;
error:
- if(long_desc)
+ if (long_desc)
HDfree(long_desc);
- if(full_desc)
+ if (full_desc)
HDfree(full_desc);
- return(-1);
+ return -1;
} /* end test_long_desc() */
/*-------------------------------------------------------------------------
* Function: dump_error
*
- * Purpose: Prints error stack in default and customized ways.
+ * Purpose: Prints error stack in default and customized ways.
*
- * Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Raymond Lu
- * July 17, 2003
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -405,12 +391,12 @@ dump_error(hid_t estack)
{
/* Print errors in library default way */
HDfprintf(stderr, "********* Print error stack in HDF5 default way *********\n");
- if(H5Eprint2(estack, stderr) < 0)
+ if (H5Eprint2(estack, stderr) < 0)
TEST_ERROR;
/* Customized way to print errors */
HDfprintf(stderr, "\n********* Print error stack in customized way *********\n");
- if(H5Ewalk2(estack, H5E_WALK_UPWARD, custom_print_cb, stderr) < 0)
+ if (H5Ewalk2(estack, H5E_WALK_UPWARD, custom_print_cb, stderr) < 0)
TEST_ERROR;
return 0;
@@ -423,34 +409,30 @@ error:
/*-------------------------------------------------------------------------
* Function: custom_print_cb
*
- * Purpose: Callback function to print error stack in customized way.
- *
- * Return: Success: 0
+ * Purpose: Callback function to print error stack in customized way.
*
- * Failure: -1
- *
- * Programmer: Raymond Lu
- * July 17, 2003
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
static herr_t
custom_print_cb(unsigned n, const H5E_error2_t *err_desc, void* client_data)
{
- FILE *stream = (FILE *)client_data;
+ FILE *stream = (FILE *)client_data;
char maj[MSG_SIZE];
char min[MSG_SIZE];
char cls[MSG_SIZE];
- const int indent = 4;
+ const int indent = 4;
/* Get descriptions for the major and minor error numbers */
- if(H5Eget_class_name(err_desc->cls_id, cls, MSG_SIZE) < 0)
+ if (H5Eget_class_name(err_desc->cls_id, cls, MSG_SIZE) < 0)
TEST_ERROR;
- if(H5Eget_msg(err_desc->maj_num, NULL, maj, MSG_SIZE) < 0)
+ if (H5Eget_msg(err_desc->maj_num, NULL, maj, MSG_SIZE) < 0)
TEST_ERROR;
- if(H5Eget_msg(err_desc->min_num, NULL, min, MSG_SIZE) < 0)
+ if (H5Eget_msg(err_desc->min_num, NULL, min, MSG_SIZE) < 0)
TEST_ERROR;
HDfprintf(stream, "%*serror #%03d: %s in %s(): line %u\n",
@@ -468,54 +450,58 @@ error:
/*-------------------------------------------------------------------------
- * Function: test_create
- *
- * Purpose: Test creating an empty error stack
+ * Function: test_create
*
- * Return: Success: 0
- * Failure: -1
+ * Purpose: Test creating an empty error stack
*
- * Programmer: Quincey Koziol
- * November 1, 2007
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
static herr_t
test_create(void)
{
- const char *err_func = "test_create"; /* Function name for pushing error */
- const char *err_msg = "Error message"; /* Error message for pushing error */
- ssize_t err_num; /* Number of errors on stack */
- hid_t estack_id; /* Error stack ID */
+ const char *err_func = "test_create"; /* Function name for pushing error */
+ const char *err_msg = "Error message"; /* Error message for pushing error */
+ ssize_t err_num; /* Number of errors on stack */
+ hid_t estack_id = -1; /* Error stack ID */
/* Create an empty error stack */
- if((estack_id = H5Ecreate_stack()) < 0) TEST_ERROR
+ if ((estack_id = H5Ecreate_stack()) < 0)
+ TEST_ERROR
/* Check the number of errors on stack */
err_num = H5Eget_num(estack_id);
- if(err_num != 0) TEST_ERROR
+ if (err_num != 0)
+ TEST_ERROR
/* Push an error with a long description */
- if(H5Epush(estack_id, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s", err_msg) < 0) TEST_ERROR;
+ if (H5Epush(estack_id, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s", err_msg) < 0)
+ TEST_ERROR;
/* Check the number of errors on stack */
err_num = H5Eget_num(estack_id);
- if(err_num != 1) TEST_ERROR
+ if (err_num != 1)
+ TEST_ERROR
/* Clear the error stack */
- if(H5Eclear2(estack_id) < 0) TEST_ERROR
+ if (H5Eclear2(estack_id) < 0)
+ TEST_ERROR
/* Check the number of errors on stack */
err_num = H5Eget_num(estack_id);
- if(err_num != 0) TEST_ERROR
+ if (err_num != 0)
+ TEST_ERROR
/* Close error stack */
- if(H5Eclose_stack(estack_id) < 0) TEST_ERROR
+ if(H5Eclose_stack(estack_id) < 0)
+ TEST_ERROR
- return(0);
+ return 0;
error:
- return(-1);
+ return -1;
} /* end test_create() */
/*-------------------------------------------------------------------------
@@ -526,70 +512,72 @@ error:
* Return: Success: 0
* Failure: -1
*
- * Programmer: Allen Byrne
- * February 18, 2010
- *
*-------------------------------------------------------------------------
*/
static herr_t
test_copy(void)
{
- const char *err_func = "test_copy"; /* Function name for pushing error */
- const char *err_msg = "Error message"; /* Error message for pushing error */
- ssize_t err_num; /* Number of errors on stack */
- hid_t estack_id; /* Error stack ID */
- herr_t ret; /* Generic return value */
+ const char *err_func = "test_copy"; /* Function name for pushing error */
+ const char *err_msg = "Error message"; /* Error message for pushing error */
+ ssize_t err_num; /* Number of errors on stack */
+ hid_t estack_id = -1; /* Error stack ID */
+ herr_t ret; /* Generic return value */
/* Push an error with a long description */
- if(H5Epush(H5E_DEFAULT, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s", err_msg) < 0) TEST_ERROR;
+ if (H5Epush(H5E_DEFAULT, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s", err_msg) < 0)
+ TEST_ERROR;
/* Check the number of errors on stack */
err_num = H5Eget_num(H5E_DEFAULT);
- if(err_num != 1) TEST_ERROR
+ if (err_num != 1)
+ TEST_ERROR
/* Copy error stack, which clears the original */
- if((estack_id = H5Eget_current_stack()) < 0) TEST_ERROR
+ if ((estack_id = H5Eget_current_stack()) < 0)
+ TEST_ERROR
/* Check the number of errors on stack copy */
err_num = H5Eget_num(estack_id);
- if(err_num != 1) TEST_ERROR
+ if (err_num != 1)
+ TEST_ERROR
/* Check the number of errors on original stack */
err_num = H5Eget_num(H5E_DEFAULT);
- if(err_num != 0) TEST_ERROR
+ if (err_num != 0)
+ TEST_ERROR
/* Put the stack copy as the default. It closes the stack copy, too. */
- if(H5Eset_current_stack(estack_id) < 0) TEST_ERROR
+ if (H5Eset_current_stack(estack_id) < 0)
+ TEST_ERROR
/* Check the number of errors on default stack */
err_num = H5Eget_num(H5E_DEFAULT);
- if(err_num != 1) TEST_ERROR
+ if (err_num != 1)
+ TEST_ERROR
/* Try to close error stack copy. Should fail because
- * the current H5Eset_current_stack closes the stack to be set.*/
+ * the current H5Eset_current_stack closes the stack to be set.
+ */
H5E_BEGIN_TRY {
ret = H5Eclose_stack(estack_id);
} H5E_END_TRY
- if(ret >= 0) TEST_ERROR
+ if (ret >= 0)
+ TEST_ERROR
- return(0);
+ return 0;
error:
- return(-1);
+ return -1;
} /* end test_copy() */
/*-------------------------------------------------------------------------
- * Function: close_error
+ * Function: close_error
*
- * Purpose: Closes error information.
+ * Purpose: Closes error information.
*
- * Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Raymond Lu
- * July 10, 2003
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -597,19 +585,19 @@ static herr_t
close_error(void)
{
/* Close major errors, let H5Eunregister_class close minor errors */
- if(H5Eclose_msg(ERR_MAJ_TEST) < 0)
+ if (H5Eclose_msg(ERR_MAJ_TEST) < 0)
TEST_ERROR;
- if(H5Eclose_msg(ERR_MAJ_IO) < 0)
+ if (H5Eclose_msg(ERR_MAJ_IO) < 0)
TEST_ERROR;
- if(H5Eclose_msg(ERR_MAJ_API) < 0)
+ if (H5Eclose_msg(ERR_MAJ_API) < 0)
TEST_ERROR;
- if(H5Eunregister_class(ERR_CLS) < 0)
+ if (H5Eunregister_class(ERR_CLS) < 0)
TEST_ERROR;
- if(H5Eunregister_class(ERR_CLS2) < 0)
+ if (H5Eunregister_class(ERR_CLS2) < 0)
TEST_ERROR;
return 0;
@@ -620,19 +608,15 @@ error:
/*-------------------------------------------------------------------------
- * Function: test_filter_error
+ * Function: test_filter_error
*
- * Purpose: Make sure the error message prints out the filter name
+ * Purpose: Make sure the error message prints out the filter name
* when the existent file is opened but the filter isn't
* registered. The existent file was created with
* gen_filters.c.
*
- * Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Raymond Lu
- * 2 June 2011
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
@@ -640,71 +624,72 @@ static herr_t
test_filter_error(const char *fname)
{
const char *pathname = H5_get_srcdir_filename(fname); /* Corrected test file name */
- hid_t file, dataset; /* handles */
+ hid_t file = -1;
+ hid_t dataset = -1;
int buf[20];
HDfprintf(stderr, "\nTesting error message during data reading when filter isn't registered\n");
/* Open the file */
- if((file = H5Fopen(pathname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((file = H5Fopen(pathname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Open the regular dataset */
- if((dataset = H5Dopen2(file, DSET_FILTER_NAME, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dopen2(file, DSET_FILTER_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) >= 0)
- TEST_ERROR;
+ if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) >= 0)
+ TEST_ERROR;
/* Close/release resources */
- if(H5Dclose(dataset) < 0)
+ if (H5Dclose(dataset) < 0)
TEST_ERROR
- if(H5Fclose(file) < 0)
+ if (H5Fclose(file) < 0)
TEST_ERROR
return 0;
error:
return -1;
-}
+} /* end test_filter_error() */
/*-------------------------------------------------------------------------
- * Function: main
+ * Function: main
*
- * Purpose: Test error API.
- *
- * Programmer: Raymond Lu
- * July 10, 2003
+ * Purpose: Test error API.
*
*-------------------------------------------------------------------------
*/
int
main(void)
{
- hid_t file, fapl;
- hid_t estack_id;
- char filename[1024];
- const char *FUNC_main = "main";
+ hid_t file = -1;
+ hid_t fapl = -1;
+ hid_t estack_id = -1;
+ char filename[1024];
+ const char *FUNC_main = "main";
HDfprintf(stderr, " This program tests the Error API. There're supposed to be some error messages\n");
/* Initialize errors */
- if(init_error() < 0)
+ if (init_error() < 0)
TEST_ERROR;
- fapl = h5_fileaccess();
+ if ((fapl = h5_fileaccess()) < 0)
+ TEST_ERROR;
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR;
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
/* Test error stack */
- if(error_stack() < 0) {
+ if (error_stack() < 0) {
/* Push an error onto error stack */
- if(H5Epush(ERR_STACK, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_ERRSTACK,
- "Error stack test failed") < 0) TEST_ERROR;
+ if (H5Epush(ERR_STACK, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_ERRSTACK,
+ "Error stack test failed") < 0)
+ TEST_ERROR;
/* Delete an error from the top of error stack */
H5Epop(ERR_STACK, 1);
@@ -724,34 +709,39 @@ main(void)
} /* end if */
/* Test error API */
- if(test_error(file) < 0) {
+ if (test_error(file) < 0) {
H5Epush(H5E_DEFAULT, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE,
"Error test failed, %s", "it's wrong");
estack_id = H5Eget_current_stack();
H5Eprint2(estack_id, stderr);
H5Eclose_stack(estack_id);
- } /* end if */
+ }
/* Test pushing a very long error description */
- if(test_long_desc() < 0) TEST_ERROR;
+ if (test_long_desc() < 0)
+ TEST_ERROR;
/* Test creating a new error stack */
- if(test_create() < 0) TEST_ERROR;
+ if (test_create() < 0)
+ TEST_ERROR;
/* Test copying a new error stack */
- if(test_copy() < 0) TEST_ERROR;
+ if (test_copy() < 0)
+ TEST_ERROR;
- if(H5Fclose(file) < 0) TEST_ERROR;
+ if (H5Fclose(file) < 0)
+ TEST_ERROR;
/* Close error information */
- if(close_error() < 0)
+ if (close_error() < 0)
TEST_ERROR;
/* Test error message during data reading when filter isn't registered
* Use default FAPL to avoid some VFD drivers by the check-vfd test because
- * the test file was pre-generated. */
+ * the test file was pre-generated.
+ */
h5_fixname(DATAFILE, H5P_DEFAULT, filename, sizeof filename);
- if(test_filter_error(filename) < 0)
+ if (test_filter_error(filename) < 0)
TEST_ERROR;
h5_clean_files(FILENAME, fapl);
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/tarray.c b/test/tarray.c
index a35b8a3..b2e0ee7 100644
--- a/test/tarray.c
+++ b/test/tarray.c
@@ -679,7 +679,7 @@ test_array_compound_atomic(void)
/* Check the 1st field's name */
mname = H5Tget_member_name(tid2, 0);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(HDstrcmp(mname, "i") != 0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
H5free_memory(mname);
@@ -698,7 +698,7 @@ test_array_compound_atomic(void)
/* Check the 2nd field's name */
mname = H5Tget_member_name(tid2, 1);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(HDstrcmp(mname, "f") != 0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
H5free_memory(mname);
@@ -897,7 +897,7 @@ test_array_compound_array(void)
/* Check the 1st field's name */
mname=H5Tget_member_name(tid2,0);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(HDstrcmp(mname,"i")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
H5free_memory(mname);
@@ -916,7 +916,7 @@ test_array_compound_array(void)
/* Check the 2nd field's name */
mname=H5Tget_member_name(tid2,1);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(HDstrcmp(mname,"f")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
H5free_memory(mname);
@@ -1604,7 +1604,7 @@ test_array_bkg(void)
/* Initialize the data */
/* ------------------- */
dtsinfo = (CmpDTSinfo *)HDmalloc(sizeof(CmpDTSinfo));
- CHECK(dtsinfo, NULL, "HDmalloc");
+ CHECK_PTR(dtsinfo, "HDmalloc");
HDmemset(dtsinfo, 0, sizeof(CmpDTSinfo));
for (i = 0; i < LENGTH; i++) {
for (j = 0; j < ALEN; j++) {
@@ -1927,7 +1927,7 @@ test_compat(void)
/* Check the 1st field's name */
mname=H5Tget_member_name(tid1,0);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(HDstrcmp(mname,"i")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
H5free_memory(mname);
@@ -1946,7 +1946,7 @@ test_compat(void)
/* Check the 2nd field's name */
mname=H5Tget_member_name(tid1,1);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(HDstrcmp(mname,"f")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
H5free_memory(mname);
@@ -1965,7 +1965,7 @@ test_compat(void)
/* Check the 3rd field's name */
mname=H5Tget_member_name(tid1,2);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(HDstrcmp(mname,"l")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
H5free_memory(mname);
@@ -2009,7 +2009,7 @@ test_compat(void)
/* Check the 1st field's name */
mname=H5Tget_member_name(tid1,0);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(mname && HDstrcmp(mname,"i")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
if(mname) H5free_memory(mname);
@@ -2028,7 +2028,7 @@ test_compat(void)
/* Check the 2nd field's name */
mname=H5Tget_member_name(tid1,1);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(mname && HDstrcmp(mname,"f")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
if(mname) H5free_memory(mname);
@@ -2073,7 +2073,7 @@ test_compat(void)
/* Check the 3rd field's name */
mname=H5Tget_member_name(tid1,2);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(mname && HDstrcmp(mname,"l")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
if(mname) H5free_memory(mname);
@@ -2118,7 +2118,7 @@ test_compat(void)
/* Check the 4th field's name */
mname=H5Tget_member_name(tid1,3);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(mname && HDstrcmp(mname,"d")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
if(mname) H5free_memory(mname);
diff --git a/test/tattr.c b/test/tattr.c
index 3b0c90e..2d333e9 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"));
@@ -277,8 +277,8 @@ 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");
-
+ CHECK_PTR(attr_name, "HDcalloc");
+
if(attr_name) {
ret = (herr_t)H5Aget_name(attr, (size_t)(attr_name_size + 1), attr_name);
CHECK(ret, FAIL, "H5Aget_name");
@@ -313,8 +313,8 @@ 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");
-
+ CHECK_PTR(attr_name, "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);
@@ -6862,7 +6862,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Allocate the "visited link" array */
iter_info.max_visit = max_compact * 2;
visited = (hbool_t*)HDmalloc(sizeof(hbool_t) * iter_info.max_visit);
- CHECK(visited, NULL, "HDmalloc");
+ CHECK_PTR(visited, "HDmalloc");
iter_info.visited = visited;
/* Loop over operating on different indices on link fields */
@@ -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,35 +8012,35 @@ 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"));
/* Allocate & initialize "big" attribute data */
big_value = (unsigned *)HDmalloc((size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3) * sizeof(unsigned));
- CHECK(big_value, NULL, "HDmalloc");
+ CHECK_PTR(big_value, "HDmalloc");
HDmemset(big_value, 1, sizeof(unsigned) * (size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3));
/* Create dataspace for dataset */
@@ -8342,36 +8342,36 @@ 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"));
/* Allocate & initialize "big" attribute data */
big_value = (unsigned *)HDmalloc((size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3) * sizeof(unsigned));
- CHECK(big_value, NULL, "HDmalloc");
+ CHECK_PTR(big_value, "HDmalloc");
HDmemset(big_value, 1, sizeof(unsigned) * (size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3));
/* Create dataspace for dataset */
@@ -8789,35 +8789,35 @@ 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"));
/* Allocate & initialize "big" attribute data */
big_value = (unsigned *)HDmalloc((size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3) * sizeof(unsigned));
- CHECK(big_value, NULL, "HDmalloc");
+ CHECK_PTR(big_value, "HDmalloc");
HDmemset(big_value, 1, sizeof(unsigned) * (size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3));
/* Create dataspace for dataset */
@@ -9158,35 +9158,35 @@ 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"));
/* Allocate & initialize "big" attribute data */
big_value = (unsigned *)HDmalloc((size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3) * sizeof(unsigned));
- CHECK(big_value, NULL, "HDmalloc");
+ CHECK_PTR(big_value, "HDmalloc");
HDmemset(big_value, 1, sizeof(unsigned) * (size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3));
/* Create dataspace for dataset */
@@ -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/tchecksum.c b/test/tchecksum.c
index febaacc..ffbab45 100644
--- a/test/tchecksum.c
+++ b/test/tchecksum.c
@@ -187,7 +187,7 @@ test_chksum_large(void)
/* Allocate the buffer */
large_buf = (uint8_t *)HDmalloc((size_t)BUF_LEN);
- CHECK(large_buf, NULL, "HDmalloc");
+ CHECK_PTR(large_buf, "HDmalloc");
/* Initialize buffer w/known data */
for(u = 0; u < BUF_LEN; u++)
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/testfiles/error_test_1 b/test/testfiles/error_test_1
index f5687f3..ea44ccc 100644
--- a/test/testfiles/error_test_1
+++ b/test/testfiles/error_test_1
@@ -59,10 +59,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#004: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed
major: Data filters
minor: Filter operation failed
- #005: (file name) line (number) in H5Z_pipeline(): required filter 'bogus' is not registered
- major: Data filters
- minor: Read failed
- #006: (file name) line (number) in H5PL_load(): required dynamically loaded plugin filter '305' is not available
+ #005: (file name) line (number) in H5PL_load(): filter plugins disabled
major: Plugin for dynamically loaded library
minor: Unable to load metadata into cache
diff --git a/test/testhdf5.h b/test/testhdf5.h
index 2cbe6c6..127c687 100644
--- a/test/testhdf5.h
+++ b/test/testhdf5.h
@@ -30,130 +30,147 @@
/* Use %ld to print the value because long should cover most cases. */
/* Used to make certain a return value _is_not_ a value */
-#define CHECK(ret, val, where) do { \
- if (VERBOSE_HI) print_func(" Call to routine: %15s at line %4d " \
- "in %s returned %ld \n", \
- where, (int)__LINE__, __FILE__, \
- (long)(ret)); \
- if ((ret) == (val)) { \
- TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
- "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \
- H5Eprint2(H5E_DEFAULT, stdout); \
- } \
+#define CHECK(ret, val, where) do { \
+ if (VERBOSE_HI) { \
+ print_func(" Call to routine: %15s at line %4d " \
+ "in %s returned %ld \n", \
+ where, (int)__LINE__, __FILE__, \
+ (long)(ret)); \
+ } \
+ if ((ret) == (val)) { \
+ TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
+ "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ } \
} while(0)
-#define CHECK_I(ret,where) { \
- if (VERBOSE_HI) { \
- print_func(" Call to routine: %15s at line %4d in %s returned %ld\n", \
- (where), (int)__LINE__, __FILE__, (long)(ret)); \
- } \
- if ((ret)<0) { \
- TestErrPrintf ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \
- (where), (long)(ret), (int)__LINE__, __FILE__); \
- H5Eprint2(H5E_DEFAULT, stdout); \
- } \
+#define CHECK_I(ret,where) { \
+ if (VERBOSE_HI) { \
+ print_func(" Call to routine: %15s at line %4d in %s returned %ld\n", \
+ (where), (int)__LINE__, __FILE__, (long)(ret)); \
+ } \
+ if ((ret)<0) { \
+ TestErrPrintf ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \
+ (where), (long)(ret), (int)__LINE__, __FILE__); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ } \
}
-#define CHECK_PTR(ret,where) { \
- if (VERBOSE_HI) { \
- print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \
- (where), (int)__LINE__, __FILE__, (ret)); \
- } \
- if (!(ret)) { \
- TestErrPrintf ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \
- (where), (int)__LINE__, __FILE__); \
- H5Eprint2(H5E_DEFAULT, stdout); \
- } \
+/* Check that a pointer is valid (i.e.: not NULL) */
+#define CHECK_PTR(ret,where) { \
+ if (VERBOSE_HI) { \
+ print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \
+ (where), (int)__LINE__, __FILE__, (ret)); \
+ } \
+ if (!(ret)) { \
+ TestErrPrintf ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \
+ (where), (int)__LINE__, __FILE__); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ } \
}
-#define CHECK_PTR_NULL(ret,where) { \
- if (VERBOSE_HI) { \
- print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \
- (where), (int)__LINE__, __FILE__, (ret)); \
- } \
- if (ret) { \
- TestErrPrintf ("*** UNEXPECTED RETURN from %s is not NULL line %4d in %s\n", \
- (where), (int)__LINE__, __FILE__); \
- H5Eprint2(H5E_DEFAULT, stdout); \
- } \
+/* Check that a pointer is NULL */
+#define CHECK_PTR_NULL(ret,where) { \
+ if (VERBOSE_HI) { \
+ print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \
+ (where), (int)__LINE__, __FILE__, (ret)); \
+ } \
+ if (ret) { \
+ TestErrPrintf ("*** UNEXPECTED RETURN from %s is not NULL line %4d in %s\n", \
+ (where), (int)__LINE__, __FILE__); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ } \
+}
+
+/* Check that two pointers are equal */
+#define CHECK_PTR_EQ(ret, val, where) { \
+ if (VERBOSE_HI) { \
+ print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \
+ (where), (int)__LINE__, __FILE__, (const void *)(ret)); \
+ } \
+ if (ret != val) { \
+ TestErrPrintf ("*** UNEXPECTED RETURN from %s: returned value of %p is not equal to %p line %4d in %s\n", \
+ (where), (const void *)(ret), (const void *)(val), (int)__LINE__, __FILE__); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ } \
}
/* Used to make certain a return value _is_ a value */
-#define VERIFY(_x, _val, where) do { \
- long __x = (long)_x, __val = (long)_val; \
- if(VERBOSE_HI) { \
- print_func(" Call to routine: %15s at line %4d in %s had value " \
- "%ld \n", (where), (int)__LINE__, __FILE__, __x); \
- } \
- if((__x) != (__val)) { \
- TestErrPrintf("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \
- "in %s\n", (where), __val, __x, (int)__LINE__, __FILE__); \
- H5Eprint2(H5E_DEFAULT, stdout); \
- } \
+#define VERIFY(_x, _val, where) do { \
+ long __x = (long)_x, __val = (long)_val; \
+ if(VERBOSE_HI) { \
+ print_func(" Call to routine: %15s at line %4d in %s had value " \
+ "%ld \n", (where), (int)__LINE__, __FILE__, __x); \
+ } \
+ if((__x) != (__val)) { \
+ TestErrPrintf("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \
+ "in %s\n", (where), __val, __x, (int)__LINE__, __FILE__); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ } \
} while(0)
/* Used to make certain a (non-'long' type's) return value _is_ a value */
-#define VERIFY_TYPE(_x, _val, _type, _format, where) do { \
- _type __x = (_type)_x, __val = (_type)_val; \
- if(VERBOSE_HI) { \
- print_func(" Call to routine: %15s at line %4d in %s had value " \
- _format " \n", (where), (int)__LINE__, __FILE__, __x); \
- } \
- if((__x) != (__val)) { \
- TestErrPrintf("*** UNEXPECTED VALUE from %s should be " _format ", but is " _format " at line %4d " \
- "in %s\n", (where), __val, __x, (int)__LINE__, __FILE__); \
- H5Eprint2(H5E_DEFAULT, stdout); \
- } \
+#define VERIFY_TYPE(_x, _val, _type, _format, where) do { \
+ _type __x = (_type)_x, __val = (_type)_val; \
+ if(VERBOSE_HI) { \
+ print_func(" Call to routine: %15s at line %4d in %s had value " \
+ _format " \n", (where), (int)__LINE__, __FILE__, __x); \
+ } \
+ if((__x) != (__val)) { \
+ TestErrPrintf("*** UNEXPECTED VALUE from %s should be " _format ", but is " _format " at line %4d " \
+ "in %s\n", (where), __val, __x, (int)__LINE__, __FILE__); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ } \
} while(0)
/* Used to make certain a string return value _is_ a value */
-#define VERIFY_STR(x, val, where) do { \
- if (VERBOSE_HI) { \
- print_func(" Call to routine: %15s at line %4d in %s had value " \
- "%s \n", (where), (int)__LINE__, __FILE__, x); \
- } \
- if (HDstrcmp(x, val)) { \
- TestErrPrintf("*** UNEXPECTED VALUE from %s should be %s, but is %s at line %4d " \
- "in %s\n", where, val, x, (int)__LINE__, __FILE__); \
- H5Eprint2(H5E_DEFAULT, stdout); \
- } \
+#define VERIFY_STR(x, val, where) do { \
+ if (VERBOSE_HI) { \
+ print_func(" Call to routine: %15s at line %4d in %s had value " \
+ "%s \n", (where), (int)__LINE__, __FILE__, x); \
+ } \
+ if (HDstrcmp(x, val)) { \
+ TestErrPrintf("*** UNEXPECTED VALUE from %s should be %s, but is %s at line %4d " \
+ "in %s\n", where, val, x, (int)__LINE__, __FILE__); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ } \
} while(0)
/* Used to document process through a test and to check for errors */
-#define RESULT(ret,func) do { \
- if (VERBOSE_MED) { \
- print_func(" Call to routine: %15s at line %4d in %s returned " \
- "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \
- } \
- if (VERBOSE_HI) \
- H5Eprint2(H5E_DEFAULT, stdout); \
- if ((ret) == FAIL) { \
- TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
- "in %s\n", func, (long)(ret), (int)__LINE__, __FILE__); \
- H5Eprint2(H5E_DEFAULT, stdout); \
- } \
+#define RESULT(ret,func) do { \
+ if (VERBOSE_MED) { \
+ print_func(" Call to routine: %15s at line %4d in %s returned " \
+ "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \
+ } \
+ if (VERBOSE_HI) \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ if ((ret) == FAIL) { \
+ TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
+ "in %s\n", func, (long)(ret), (int)__LINE__, __FILE__); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
+ } \
} while(0)
/* Used to document process through a test */
#if defined(H5_HAVE_PARALLEL) && defined(H5_PARALLEL_TEST)
-#define MESSAGE(V,A) { \
- int mpi_rank; \
- \
- MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); \
- if(mpi_rank == 0 && HDGetTestVerbosity() > (V)) \
- print_func A ; \
+#define MESSAGE(V,A) { \
+ int mpi_rank; \
+ \
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); \
+ if(mpi_rank == 0 && HDGetTestVerbosity() > (V)) \
+ print_func A ; \
}
#else /* H5_HAVE_PARALLEL */
#define MESSAGE(V,A) {if (HDGetTestVerbosity() > (V)) print_func A;}
#endif /* H5_HAVE_PARALLEL */
/* Used to indicate an error that is complex to check for */
-#define ERROR(where) do { \
- if(VERBOSE_HI) \
- print_func(" Call to routine: %15s at line %4d in %s returned " \
- "invalid result\n", where, (int)__LINE__, __FILE__); \
- TestErrPrintf("*** UNEXPECTED RESULT from %s at line %4d in %s\n", \
- where, (int)__LINE__, __FILE__); \
+#define ERROR(where) do { \
+ if(VERBOSE_HI) \
+ print_func(" Call to routine: %15s at line %4d in %s returned " \
+ "invalid result\n", where, (int)__LINE__, __FILE__); \
+ TestErrPrintf("*** UNEXPECTED RESULT from %s at line %4d in %s\n", \
+ where, (int)__LINE__, __FILE__); \
} while(0)
/* definitions for command strings */
diff --git a/test/tfile.c b/test/tfile.c
index 027ad62..80ba4da 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -1072,7 +1072,7 @@ test_get_obj_ids(void)
VERIFY(oid_count, (NGROUPS + NDSETS + 1), "H5Fget_obj_count");
oid_list = (hid_t *)HDcalloc((size_t)oid_list_size, sizeof(hid_t));
- CHECK(oid_list, NULL, "HDcalloc");
+ CHECK_PTR(oid_list, "HDcalloc");
/* Call the public function H5F_get_obj_ids to use H5F_get_objects. User reported having problem here.
* that the returned size (ret_count) from H5Fget_obj_ids is one greater than the size passed in
@@ -1135,7 +1135,7 @@ test_get_obj_ids(void)
VERIFY(oid_count, NDSETS, "H5Fget_obj_count");
oid_list = (hid_t *)HDcalloc((size_t)oid_count, sizeof(hid_t));
- CHECK(oid_list, NULL, "HDcalloc");
+ CHECK_PTR(oid_list, "HDcalloc");
/* Get the list of all opened objects */
ret_count = H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)oid_count, oid_list);
@@ -2667,7 +2667,7 @@ cal_chksum(const char *file, uint32_t *chksum)
/* Allocate space for the file data */
file_data = HDmalloc((size_t)sb.st_size);
- CHECK(file_data, NULL, "HDmalloc");
+ CHECK_PTR(file_data, "HDmalloc");
if(file_data) {
/* Read file's data into memory */
diff --git a/test/th5o.c b/test/th5o.c
index 4baac20..144ea4c 100644
--- a/test/th5o.c
+++ b/test/th5o.c
@@ -783,9 +783,9 @@ test_h5o_link(void)
/* Allocate memory buffers */
/* (These are treated as 2-D buffers) */
wdata = (int *)HDmalloc((size_t)(TEST6_DIM1 * TEST6_DIM2) * sizeof(int));
- CHECK(wdata, NULL, "HDmalloc");
+ CHECK_PTR(wdata, "HDmalloc");
rdata = (int *)HDmalloc((size_t)(TEST6_DIM1 * TEST6_DIM2) * sizeof(int));
- CHECK(rdata, NULL, "HDmalloc");
+ CHECK_PTR(rdata, "HDmalloc");
/* Initialize the raw data */
for(i = n = 0; i < (TEST6_DIM1 * TEST6_DIM2); i++)
diff --git a/test/theap.c b/test/theap.c
index 3c23025..7b2fadb 100644
--- a/test/theap.c
+++ b/test/theap.c
@@ -88,11 +88,11 @@ test_heap_init(void)
/* Allocate arrays */
rand_num = (test_obj *)HDmalloc(sizeof(test_obj) * NUM_ELEMS);
- CHECK(rand_num, NULL, "HDmalloc");
+ CHECK_PTR(rand_num, "HDmalloc");
inc_sort_num = (test_obj *)HDmalloc(sizeof(test_obj) * NUM_ELEMS);
- CHECK(inc_sort_num, NULL, "HDmalloc");
+ CHECK_PTR(inc_sort_num, "HDmalloc");
dec_sort_num = (test_obj *)HDmalloc(sizeof(test_obj) * NUM_ELEMS);
- CHECK(dec_sort_num, NULL, "HDmalloc");
+ CHECK_PTR(dec_sort_num, "HDmalloc");
/* Create randomized set of numbers */
curr_time = HDtime(NULL);
@@ -127,7 +127,7 @@ test_heap_create(void)
/* Try creating a maximum Heap */
heap=H5HP_create(H5HP_MAX_HEAP);
- CHECK(heap, NULL, "H5HP_create");
+ CHECK_PTR(heap, "H5HP_create");
/* Try closing the heap */
ret=H5HP_close(heap);
@@ -135,7 +135,7 @@ test_heap_create(void)
/* Try creating a minimum Heap */
heap=H5HP_create(H5HP_MIN_HEAP);
- CHECK(heap, NULL, "H5HP_create");
+ CHECK_PTR(heap, "H5HP_create");
/* Try closing the heap */
ret=H5HP_close(heap);
@@ -163,7 +163,7 @@ test_heap_insert_min(void)
/* Create a Heap */
heap=H5HP_create(H5HP_MIN_HEAP);
- CHECK(heap, NULL, "H5HP_create");
+ CHECK_PTR(heap, "H5HP_create");
/* Check that the heap has no elements */
num=H5HP_count(heap);
@@ -237,7 +237,7 @@ test_heap_insert_max(void)
/* Create a Heap */
heap=H5HP_create(H5HP_MAX_HEAP);
- CHECK(heap, NULL, "H5HP_create");
+ CHECK_PTR(heap, "H5HP_create");
/* Check that the heap has no elements */
num=H5HP_count(heap);
@@ -325,7 +325,7 @@ test_heap_insert_many_core(H5HP_type_t heap_type, test_obj *arr, size_t nelem, i
/* Create a Heap */
heap=H5HP_create(heap_type);
- CHECK(heap, NULL, "H5HP_create");
+ CHECK_PTR(heap, "H5HP_create");
/* Check that the heap has no elements */
num=H5HP_count(heap);
@@ -405,7 +405,7 @@ test_heap_remove_min(void)
/* Create a Heap */
heap=H5HP_create(H5HP_MIN_HEAP);
- CHECK(heap, NULL, "H5HP_create");
+ CHECK_PTR(heap, "H5HP_create");
/* Check that the heap has no elements */
num=H5HP_count(heap);
@@ -434,19 +434,19 @@ test_heap_remove_min(void)
ret=H5HP_remove(heap,&val,&ptr);
CHECK(ret, FAIL, "H5HP_remove");
VERIFY(val, 5, "H5HP_remove");
- VERIFY(ptr, &obj2, "H5HP_remove");
+ CHECK_PTR_EQ(ptr, &obj2, "H5HP_remove");
/* Remove second maximum value from heap */
ret=H5HP_remove(heap,&val,&ptr);
CHECK(ret, FAIL, "H5HP_remove");
VERIFY(val, 10, "H5HP_remove");
- VERIFY(ptr, &obj1, "H5HP_remove");
+ CHECK_PTR_EQ(ptr, &obj1, "H5HP_remove");
/* Remove third maximum value from heap */
ret=H5HP_remove(heap,&val,&ptr);
CHECK(ret, FAIL, "H5HP_remove");
VERIFY(val, 20, "H5HP_remove");
- VERIFY(ptr, &obj3, "H5HP_remove");
+ CHECK_PTR_EQ(ptr, &obj3, "H5HP_remove");
/* Try removing an object from an empty heap */
ret=H5HP_remove(heap,&val,&ptr);
@@ -479,7 +479,7 @@ test_heap_remove_max(void)
/* Create a Heap */
heap=H5HP_create(H5HP_MAX_HEAP);
- CHECK(heap, NULL, "H5HP_create");
+ CHECK_PTR(heap, "H5HP_create");
/* Check that the heap has no elements */
num=H5HP_count(heap);
@@ -508,19 +508,19 @@ test_heap_remove_max(void)
ret=H5HP_remove(heap,&val,&ptr);
CHECK(ret, FAIL, "H5HP_remove");
VERIFY(val, 20, "H5HP_remove");
- VERIFY(ptr, &obj3, "H5HP_remove");
+ CHECK_PTR_EQ(ptr, &obj3, "H5HP_remove");
/* Remove second maximum value from heap */
ret=H5HP_remove(heap,&val,&ptr);
CHECK(ret, FAIL, "H5HP_remove");
VERIFY(val, 10, "H5HP_remove");
- VERIFY(ptr, &obj1, "H5HP_remove");
+ CHECK_PTR_EQ(ptr, &obj1, "H5HP_remove");
/* Remove third maximum value from heap */
ret=H5HP_remove(heap,&val,&ptr);
CHECK(ret, FAIL, "H5HP_remove");
VERIFY(val, 5, "H5HP_remove");
- VERIFY(ptr, &obj2, "H5HP_remove");
+ CHECK_PTR_EQ(ptr, &obj2, "H5HP_remove");
/* Try removing an object from an empty heap */
ret=H5HP_remove(heap,&val,&ptr);
@@ -567,7 +567,7 @@ static void test_heap_remove_many_core(H5HP_type_t heap_type, test_obj *arr, siz
/* Create a Heap */
heap=H5HP_create(heap_type);
- CHECK(heap, NULL, "H5HP_create");
+ CHECK_PTR(heap, "H5HP_create");
/* Check that the heap has no elements */
num=H5HP_count(heap);
@@ -714,7 +714,7 @@ test_heap_change_min(void)
/* Create a Heap */
heap=H5HP_create(H5HP_MIN_HEAP);
- CHECK(heap, NULL, "H5HP_create");
+ CHECK_PTR(heap, "H5HP_create");
/* Check that the heap has no elements */
num=H5HP_count(heap);
@@ -788,7 +788,7 @@ test_heap_change_max(void)
/* Create a Heap */
heap=H5HP_create(H5HP_MAX_HEAP);
- CHECK(heap, NULL, "H5HP_create");
+ CHECK_PTR(heap, "H5HP_create");
/* Check that the heap has no elements */
num=H5HP_count(heap);
@@ -880,7 +880,7 @@ test_heap_incdec_min(void)
/* Create a Heap */
heap=H5HP_create(H5HP_MIN_HEAP);
- CHECK(heap, NULL, "H5HP_create");
+ CHECK_PTR(heap, "H5HP_create");
/* Check that the heap has no elements */
num=H5HP_count(heap);
@@ -955,7 +955,7 @@ test_heap_incdec_max(void)
/* Create a Heap */
heap=H5HP_create(H5HP_MAX_HEAP);
- CHECK(heap, NULL, "H5HP_create");
+ CHECK_PTR(heap, "H5HP_create");
/* Check that the heap has no elements */
num=H5HP_count(heap);
diff --git a/test/tid.c b/test/tid.c
index 494ee60..7d6757f 100644
--- a/test/tid.c
+++ b/test/tid.c
@@ -16,223 +16,225 @@
#include "testhdf5.h"
#include "hdf5.h"
- /* Include H5Ipkg.h to calculate max number of groups */
+/* Include H5Ipkg.h to calculate max number of groups */
#define H5I_FRIEND /*suppress error about including H5Ipkg */
#include "H5Ipkg.h"
- /* Test basic functionality of registering and deleting types and IDs */
+/* Test basic functionality of registering and deleting types and IDs */
static int basic_id_test(void)
{
- H5I_type_t myType = H5I_BADID;
- hid_t arrayID = H5I_INVALID_HID;
- void* testObj = NULL;
- void* testPtr = NULL;
- char nameString[10];
- hid_t testID;
- ssize_t testSize = -1;
- herr_t err;
- int num_ref;
- hsize_t num_members;
-
+ H5I_type_t myType = H5I_BADID;
+ hid_t arrayID = H5I_INVALID_HID;
+ void* testObj = NULL;
+ void* testPtr = NULL;
+ char nameString[10];
+ hid_t testID;
+ ssize_t testSize = -1;
+ herr_t err;
+ int num_ref;
+ hsize_t num_members;
+
+
+ /* Try to register an ID with ficticious types */
+ H5E_BEGIN_TRY
+ arrayID = H5Iregister((H5I_type_t) 420, testObj);
+ H5E_END_TRY
- /* Try to register an ID with ficticious types */
- H5E_BEGIN_TRY
- arrayID = H5Iregister((H5I_type_t) 420, testObj);
- H5E_END_TRY
+ VERIFY(arrayID, H5I_INVALID_HID, "H5Iregister");
+ if(arrayID != H5I_INVALID_HID)
+ goto out;
- VERIFY(arrayID, H5I_INVALID_HID, "H5Iregister");
- if(arrayID != H5I_INVALID_HID)
- goto out;
+ H5E_BEGIN_TRY
+ arrayID = H5Iregister((H5I_type_t) -1, testObj);
+ H5E_END_TRY
- H5E_BEGIN_TRY
- arrayID = H5Iregister((H5I_type_t) -1, testObj);
- H5E_END_TRY
+ VERIFY(arrayID, H5I_INVALID_HID, "H5Iregister");
+ if(arrayID != H5I_INVALID_HID)
+ goto out;
- VERIFY(arrayID, H5I_INVALID_HID, "H5Iregister");
- if(arrayID != H5I_INVALID_HID)
- goto out;
+ /* Try to access IDs with ficticious types */
+ H5E_BEGIN_TRY
+ testPtr = H5Iobject_verify((hid_t)100, (H5I_type_t) 0);
+ H5E_END_TRY
- /* Try to access IDs with ficticious types */
- H5E_BEGIN_TRY
- testPtr = H5Iobject_verify((hid_t)100, (H5I_type_t) 0);
- H5E_END_TRY
+ CHECK_PTR_NULL(testPtr, "H5Iobject_verify");
+ if(testPtr != NULL)
+ goto out;
- VERIFY(testPtr, NULL, "H5Iobject_verify");
- if(testPtr != NULL)
- goto out;
+ H5E_BEGIN_TRY
+ testPtr = H5Iobject_verify((hid_t)700, (H5I_type_t) 700);
+ H5E_END_TRY
- H5E_BEGIN_TRY
- testPtr = H5Iobject_verify((hid_t)700, (H5I_type_t) 700);
- H5E_END_TRY
+ CHECK_PTR_NULL(testPtr, "H5Iobject_verify");
+ if(testPtr != NULL)
+ goto out;
- VERIFY(testPtr, NULL, "H5Iobject_verify");
- if(testPtr != NULL)
- goto out;
+ /* Register a type */
+ myType = H5Iregister_type((size_t)64, 0, (H5I_free_t) free );
- /* Register a type */
- myType = H5Iregister_type((size_t)64, 0, (H5I_free_t) free );
+ CHECK(myType, H5I_BADID, "H5Iregister_type");
+ if(myType == H5I_BADID)
+ goto out;
- CHECK(myType, H5I_BADID, "H5Iregister_type");
- if(myType == H5I_BADID)
- goto out;
+ /* Register an ID and retrieve the object it points to.
+ * Once the ID has been registered, testObj will be freed when
+ * its ID type is destroyed.
+ */
+ testObj = HDmalloc(7 * sizeof(int));
+ arrayID = H5Iregister(myType, testObj);
- /* Register an ID and retrieve the object it points to.
- * Once the ID has been registered, testObj will be freed when
- * its ID type is destroyed. */
- testObj = HDmalloc(7 * sizeof(int));
- arrayID = H5Iregister(myType, testObj);
+ CHECK(arrayID, H5I_INVALID_HID, "H5Iregister");
+ if(arrayID == H5I_INVALID_HID) {
+ HDfree(testObj);
+ goto out;
+ }
- CHECK(arrayID, H5I_INVALID_HID, "H5Iregister");
- if(arrayID == H5I_INVALID_HID)
- {
- HDfree(testObj);
- goto out;
- }
+ testPtr = (int *)H5Iobject_verify(arrayID, myType);
- testPtr = (int *) H5Iobject_verify(arrayID, myType);
+ CHECK_PTR_EQ(testPtr, testObj, "H5Iobject_verify");
+ if(testPtr != testObj)
+ goto out;
- VERIFY(testPtr, testObj, "H5Iobject_verify");
- if(testPtr != testObj)
- goto out;
+ /* Ensure that H5Iget_file_id and H5Iget_name() fail, since this
+ * is an hid_t for the wrong kind of object
+ */
+ H5E_BEGIN_TRY
+ testID = H5Iget_file_id(arrayID);
+ H5E_END_TRY
- /* Ensure that H5Iget_file_id and H5Iget_name() fail, since this
- * is an hid_t for the wrong kind of object */
- H5E_BEGIN_TRY
- testID = H5Iget_file_id(arrayID);
- H5E_END_TRY
+ VERIFY(testID, H5I_INVALID_HID, "H5Iget_file_id");
+ if(testID != H5I_INVALID_HID)
+ goto out;
- VERIFY(testID, H5I_INVALID_HID, "H5Iget_file_id");
- if(testID != H5I_INVALID_HID)
- goto out;
+ H5E_BEGIN_TRY
+ testSize = H5Iget_name(arrayID, nameString, (size_t)9);
+ H5E_END_TRY
- H5E_BEGIN_TRY
- testSize = H5Iget_name(arrayID, nameString, (size_t)9);
- H5E_END_TRY
+ VERIFY(testSize, -1, "H5Iget_name");
+ if(testSize != -1)
+ goto out;
- VERIFY(testSize, -1, "H5Iget_name");
- if(testSize != -1)
- goto out;
+ /* Make sure H5Iremove_verify catches objects of the wrong type */
+ H5E_BEGIN_TRY
+ testPtr = (int*) H5Iremove_verify(arrayID, (H5I_type_t) 0);
+ H5E_END_TRY
- /* Make sure H5Iremove_verify catches objects of the wrong type */
- H5E_BEGIN_TRY
- testPtr = (int*) H5Iremove_verify(arrayID, (H5I_type_t) 0);
- H5E_END_TRY
+ CHECK_PTR_NULL(testPtr, "H5Iremove_verify");
+ if(testPtr != NULL)
+ goto out;
- VERIFY(testPtr, NULL, "H5Iremove_verify");
- if(testPtr != NULL)
- goto out;
+ H5E_BEGIN_TRY
+ testPtr = (int*) H5Iremove_verify(arrayID, (H5I_type_t) ((int) myType-1));
+ H5E_END_TRY
- H5E_BEGIN_TRY
- testPtr = (int*) H5Iremove_verify(arrayID, (H5I_type_t) ((int) myType-1));
- H5E_END_TRY
+ CHECK_PTR_NULL(testPtr, "H5Iremove_verify");
+ if(testPtr != NULL)
+ goto out;
- VERIFY(testPtr, NULL, "H5Iremove_verify");
- if(testPtr != NULL)
- goto out;
+ /* Remove an ID and make sure we can't access it */
+ testPtr = (int*) H5Iremove_verify(arrayID, myType);
- /* Remove an ID and make sure we can't access it */
- testPtr = (int*) H5Iremove_verify(arrayID, myType);
+ CHECK_PTR(testPtr, "H5Iremove_verify");
+ if(testPtr == NULL)
+ goto out;
- CHECK(testPtr, NULL, "H5Iremove_verify");
- if(testPtr == NULL)
- goto out;
+ H5E_BEGIN_TRY
+ testPtr = (int*) H5Iobject_verify(arrayID, myType);
+ H5E_END_TRY
- H5E_BEGIN_TRY
- testPtr = (int*) H5Iobject_verify(arrayID, myType);
- H5E_END_TRY
+ CHECK_PTR_NULL(testPtr, "H5Iobject_verify");
+ if(testPtr != NULL)
+ goto out;
- VERIFY(testPtr, NULL, "H5Iobject_verify");
- if(testPtr != NULL)
- goto out;
+ /* Delete the type and make sure we can't access objects within it */
+ arrayID = H5Iregister(myType, testObj);
- /* Delete the type and make sure we can't access objects within it */
- arrayID = H5Iregister(myType, testObj);
+ err = H5Idestroy_type(myType);
+ VERIFY(err, 0, "H5Idestroy_type");
+ if( err != 0)
+ goto out;
+ VERIFY(H5Itype_exists(myType), 0, "H5Itype_exists");
+ if(H5Itype_exists(myType) != 0)
+ goto out;
- err = H5Idestroy_type(myType);
- VERIFY(err, 0, "H5Idestroy_type");
- if( err != 0)
- goto out;
- VERIFY(H5Itype_exists(myType), 0, "H5Itype_exists");
- if(H5Itype_exists(myType) != 0)
+ H5E_BEGIN_TRY
+ VERIFY(H5Inmembers(myType, NULL), -1, "H5Inmembers");
+ if(H5Inmembers(myType, NULL) != -1)
goto out;
+ H5E_END_TRY
- H5E_BEGIN_TRY
- VERIFY(H5Inmembers(myType, NULL), -1, "H5Inmembers");
- if(H5Inmembers(myType, NULL) != -1)
- goto out;
- H5E_END_TRY
-
- /* Register another type and another object in that type */
- myType = H5Iregister_type((size_t)64, 0, (H5I_free_t) free );
+ /* Register another type and another object in that type */
+ myType = H5Iregister_type((size_t)64, 0, (H5I_free_t) free );
- CHECK(myType, H5I_BADID, "H5Iregister_type");
- if(myType == H5I_BADID)
- goto out;
+ CHECK(myType, H5I_BADID, "H5Iregister_type");
+ if(myType == H5I_BADID)
+ goto out;
- /* The memory that testObj pointed to should already have been
- * freed when the previous type was destroyed. Allocate new
- * memory for it.
- */
- testObj = HDmalloc(7 * sizeof(int));
- arrayID = H5Iregister(myType, testObj);
+ /* The memory that testObj pointed to should already have been
+ * freed when the previous type was destroyed. Allocate new
+ * memory for it.
+ */
+ testObj = HDmalloc(7 * sizeof(int));
+ arrayID = H5Iregister(myType, testObj);
- CHECK(arrayID, H5I_INVALID_HID, "H5Iregister");
- if(arrayID == H5I_INVALID_HID)
- {
- HDfree(testObj);
- goto out;
- }
+ CHECK(arrayID, H5I_INVALID_HID, "H5Iregister");
+ if(arrayID == H5I_INVALID_HID) {
+ HDfree(testObj);
+ goto out;
+ }
- err = H5Inmembers(myType, &num_members);
- CHECK(err, -1, "H5Inmembers");
- if (err < 0)
- goto out;
- VERIFY(num_members, 1, "H5Inmembers");
- if(num_members != 1)
- goto out;
+ err = H5Inmembers(myType, &num_members);
+ CHECK(err, -1, "H5Inmembers");
+ if (err < 0)
+ goto out;
+ VERIFY(num_members, 1, "H5Inmembers");
+ if(num_members != 1)
+ goto out;
- /* Increment references to type and ensure that dec_type_ref
- doesn't destroy the type */
- num_ref = H5Iinc_type_ref(myType);
- VERIFY(num_ref, 2, "H5Iinc_type_ref");
- if( num_ref != 2)
- goto out;
- num_ref = H5Idec_type_ref(myType);
- VERIFY(num_ref, 1, "H5Idec_type_ref");
- if(num_ref != 1)
- goto out;
- err = H5Inmembers(myType, &num_members);
- CHECK(err, -1, "H5Inmembers");
- if (err < 0)
- goto out;
- VERIFY(num_members, 1, "H5Inmembers");
- if(num_members != 1)
- goto out;
+ /* Increment references to type and ensure that dec_type_ref
+ * doesn't destroy the type
+ */
+ num_ref = H5Iinc_type_ref(myType);
+ VERIFY(num_ref, 2, "H5Iinc_type_ref");
+ if( num_ref != 2)
+ goto out;
+ num_ref = H5Idec_type_ref(myType);
+ VERIFY(num_ref, 1, "H5Idec_type_ref");
+ if(num_ref != 1)
+ goto out;
+ err = H5Inmembers(myType, &num_members);
+ CHECK(err, -1, "H5Inmembers");
+ if (err < 0)
+ goto out;
+ VERIFY(num_members, 1, "H5Inmembers");
+ if(num_members != 1)
+ goto out;
- /* This call to dec_type_ref should destroy the type */
- num_ref = H5Idec_type_ref(myType);
- VERIFY(num_ref, 0, "H5Idec_type_ref");
- if(num_ref != 0)
- goto out;
- VERIFY(H5Itype_exists(myType), 0, "H5Itype_exists");
- if (H5Itype_exists(myType) != 0)
- goto out;
+ /* This call to dec_type_ref should destroy the type */
+ num_ref = H5Idec_type_ref(myType);
+ VERIFY(num_ref, 0, "H5Idec_type_ref");
+ if(num_ref != 0)
+ goto out;
+ VERIFY(H5Itype_exists(myType), 0, "H5Itype_exists");
+ if (H5Itype_exists(myType) != 0)
+ goto out;
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
err = H5Inmembers(myType, &num_members);
- if(err >= 0)
- goto out;
- H5E_END_TRY
+ if(err >= 0)
+ goto out;
+ H5E_END_TRY
- return 0;
+ return 0;
out:
- /* Clean up type if it has been allocated and free memory used
- * by testObj */
- if(myType >= 0)
- H5Idestroy_type(myType);
+ /* Clean up type if it has been allocated and free memory used
+ * by testObj
+ */
+ if(myType >= 0)
+ H5Idestroy_type(myType);
- return -1;
+ return -1;
}
@@ -263,7 +265,7 @@ static int id_predefined_test(void )
testPtr = H5Isearch(H5I_GENPROP_LST, (H5I_search_func_t) test_search_func, testObj);
H5E_END_TRY
- VERIFY(testPtr, NULL, "H5Isearch");
+ CHECK_PTR_NULL(testPtr, "H5Isearch");
if(testPtr != NULL)
goto out;
@@ -301,7 +303,7 @@ static int id_predefined_test(void )
testPtr = H5Iremove_verify(typeID, H5I_DATATYPE);
H5E_END_TRY
- VERIFY(testPtr, NULL, "H5Iremove_verify");
+ CHECK_PTR_NULL(testPtr, "H5Iremove_verify");
if(testPtr != NULL)
goto out;
@@ -309,7 +311,7 @@ static int id_predefined_test(void )
testPtr = H5Iobject_verify(typeID, H5I_DATATYPE);
H5E_END_TRY
- VERIFY(testPtr, NULL, "H5Iobject_verify");
+ CHECK_PTR_NULL(testPtr, "H5Iobject_verify");
if(testPtr != NULL)
goto out;
diff --git a/test/titerate.c b/test/titerate.c
index aad62c9..231bd2e 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -159,7 +159,7 @@ test_iter_group(hid_t fapl, hbool_t new_format)
/* Keep a copy of the dataset names around for later */
lnames[i] = HDstrdup(name);
- CHECK(lnames[i], NULL, "strdup");
+ CHECK_PTR(lnames[i], "strdup");
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
@@ -170,13 +170,13 @@ test_iter_group(hid_t fapl, hbool_t new_format)
CHECK(ret, FAIL, "H5Gcreate2");
lnames[NDATASETS] = HDstrdup("grp");
- CHECK(lnames[NDATASETS], NULL, "strdup");
+ CHECK_PTR(lnames[NDATASETS], "strdup");
ret = H5Tcommit2(file, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Tcommit2");
lnames[NDATASETS + 1] = HDstrdup("dtype");
- CHECK(lnames[NDATASETS], NULL, "strdup");
+ CHECK_PTR(lnames[NDATASETS], "strdup");
/* Close everything up */
ret = H5Tclose(datatype);
@@ -412,7 +412,7 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format)
/* Keep a copy of the attribute names around for later */
anames[i] = HDstrdup(name);
- CHECK(anames[i], NULL, "strdup");
+ CHECK_PTR(anames[i], "strdup");
ret = H5Aclose(attribute);
CHECK(ret, FAIL, "H5Aclose");
@@ -596,7 +596,7 @@ test_iter_group_large(hid_t fapl)
/* Allocate & initialize array */
names = (iter_info *)HDcalloc(sizeof(iter_info), (ITER_NGROUPS + 2));
- CHECK(names, NULL, "HDcalloc");
+ CHECK_PTR(names, "HDcalloc");
/* Output message about test being performed */
MESSAGE(5, ("Testing Large Group Iteration Functionality\n"));
@@ -733,7 +733,7 @@ static void test_grp_memb_funcs(hid_t fapl)
/* Keep a copy of the dataset names around for later */
dnames[i] = HDstrdup(name);
- CHECK(dnames[i], NULL, "strdup");
+ CHECK_PTR(dnames[i], "strdup");
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
@@ -744,13 +744,13 @@ static void test_grp_memb_funcs(hid_t fapl)
CHECK(ret, FAIL, "H5Gcreate2");
dnames[NDATASETS] = HDstrdup("grp");
- CHECK(dnames[NDATASETS], NULL, "strdup");
+ CHECK_PTR(dnames[NDATASETS], "strdup");
ret = H5Tcommit2(file, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Tcommit2");
dnames[NDATASETS + 1] = HDstrdup("dtype");
- CHECK(dnames[NDATASETS], NULL, "strdup");
+ CHECK_PTR(dnames[NDATASETS], "strdup");
/* Close everything up */
ret = H5Tclose(datatype);
@@ -797,7 +797,7 @@ static void test_grp_memb_funcs(hid_t fapl)
/* Keep a copy of the dataset names around for later */
obj_names[i] = HDstrdup(dataset_name);
- CHECK(obj_names[i], NULL, "strdup");
+ CHECK_PTR(obj_names[i], "strdup");
ret = H5Oget_info_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_idx");
diff --git a/test/tmisc.c b/test/tmisc.c
index 102325a..f0e595b 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"
@@ -722,7 +723,7 @@ create_struct3(void)
herr_t ret; /* For error checking */
str3hndl = (misc5_struct3_hndl *)HDmalloc(sizeof(misc5_struct3_hndl));
- CHECK(str3hndl,NULL,"malloc");
+ CHECK_PTR(str3hndl, "malloc");
str3hndl->st3h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct3));
CHECK(str3hndl->st3h_base, FAIL, "H5Tcreate");
@@ -765,7 +766,7 @@ create_struct2(void)
herr_t ret; /* For error checking */
str2hndl = (misc5_struct2_hndl *)HDmalloc(sizeof(misc5_struct2_hndl));
- CHECK(str2hndl, NULL, "malloc");
+ CHECK_PTR(str2hndl, "HDmalloc");
str2hndl->st2h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct2));
CHECK(str2hndl->st2h_base, FAIL, "H5Tcreate");
@@ -774,7 +775,7 @@ create_struct2(void)
CHECK(ret, FAIL, "H5Tinsert");
str2hndl->st2h_st3hndl = create_struct3();
- CHECK(str2hndl->st2h_st3hndl,NULL,"create_struct3");
+ CHECK_PTR(str2hndl->st2h_st3hndl, "create_struct3");
ret = H5Tinsert(str2hndl->st2h_base, "st2_el2", HOFFSET(misc5_struct2, st2_el2), str2hndl->st2h_st3hndl->st3h_id);
CHECK(ret,FAIL,"H5Tinsert");
@@ -810,7 +811,7 @@ set_struct2(misc5_struct2 *buf)
buf->st2_el2.len = MISC5_DBGNELM3;
buf->st2_el2.p = HDmalloc((buf->st2_el2.len)*sizeof(misc5_struct3));
- CHECK(buf->st2_el2.p,NULL,"malloc");
+ CHECK_PTR(buf->st2_el2.p, "HDmalloc");
for(i=0; i<(buf->st2_el2.len); i++)
set_struct3(&(((misc5_struct3 *)(buf->st2_el2.p))[i]));
@@ -831,7 +832,7 @@ create_struct1(void)
herr_t ret; /* For error checking */
str1hndl = (misc5_struct1_hndl *)HDmalloc(sizeof(misc5_struct1_hndl));
- CHECK(str1hndl, NULL, "malloc");
+ CHECK_PTR(str1hndl, "HDmalloc");
str1hndl->st1h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct1));
CHECK(str1hndl->st1h_base, FAIL, "H5Tcreate");
@@ -840,7 +841,7 @@ create_struct1(void)
CHECK(ret, FAIL, "H5Tinsert");
str1hndl->st1h_st2hndl=create_struct2();
- CHECK(str1hndl->st1h_st2hndl,NULL,"create_struct2");
+ CHECK_PTR(str1hndl->st1h_st2hndl, "create_struct2");
ret = H5Tinsert(str1hndl->st1h_base, "st1_el2", HOFFSET(misc5_struct1, st1_el2), str1hndl->st1h_st2hndl->st2h_id);
CHECK(ret,FAIL,"H5Tinsert");
@@ -876,7 +877,7 @@ set_struct1(misc5_struct1 *buf)
buf->st1_el2.len=MISC5_DBGNELM2;
buf->st1_el2.p=HDmalloc((buf->st1_el2.len)*sizeof(misc5_struct2));
- CHECK(buf->st1_el2.p,NULL,"malloc");
+ CHECK_PTR(buf->st1_el2.p, "HDmalloc");
for(i=0; i<(buf->st1_el2.len); i++)
set_struct2(&(((misc5_struct2 *)(buf->st1_el2.p))[i]));
@@ -912,7 +913,7 @@ test_misc5(void)
/* Create the memory structure to write */
str1hndl = create_struct1();
- CHECK(str1hndl, NULL, "create_struct1");
+ CHECK_PTR(str1hndl, "create_struct1");
/* Create the dataspace */
dims[0] = MISC5_NELMTOPLVL;
@@ -926,7 +927,7 @@ test_misc5(void)
/* Create the variable-length buffer */
buf.len = MISC5_DBGNELM1;
buf.p = HDmalloc((buf.len) * sizeof(misc5_struct1));
- CHECK(buf.p, NULL, "malloc");
+ CHECK_PTR(buf.p, "HDmalloc");
/* Create the top-level VL information */
for(i = 0; i < MISC5_DBGNELM1; i++)
@@ -1252,10 +1253,10 @@ test_misc8(void)
/* Allocate space for the data to write & read */
wdata = (int *)HDmalloc(sizeof(int) * MISC8_DIM0 * MISC8_DIM1);
- CHECK(wdata,NULL,"malloc");
+ CHECK_PTR(wdata, "HDmalloc");
#ifdef VERIFY_DATA
rdata = (int *)HDmalloc(sizeof(int) * MISC8_DIM0 * MISC8_DIM1);
- CHECK(rdata,NULL,"malloc");
+ CHECK_PTR(rdata, "HDmalloc");
#endif /* VERIFY_DATA */
/* Initialize values */
@@ -2143,7 +2144,7 @@ misc13_verify_dataset(hid_t loc_id, const char *name, const unsigned *data)
/* Create a data buffer for the dataset read */
read_data = (unsigned *)HDcalloc(MISC13_DIM1, sizeof(unsigned));
- CHECK(read_data, NULL, "HDcalloc");
+ CHECK_PTR(read_data, "HDcalloc");
/* Open the contiguous dataset in the root group */
dsid = H5Dopen2(loc_id, name, H5P_DEFAULT);
@@ -2269,14 +2270,14 @@ misc13_insert_user_block(const char *old_name, const char *new_name, const char
/* Allocate space for the user block */
user_block = HDcalloc(size, (size_t)1);
- CHECK(user_block, NULL, "HDcalloc");
+ CHECK_PTR(user_block, "HDcalloc");
/* Copy in the user block data */
HDmemcpy(user_block, str, strlen(str));
/* Open the new file */
new_fp = HDfopen(new_name,"wb");
- CHECK(new_fp, NULL, "HDfopen");
+ CHECK_PTR(new_fp, "HDfopen");
/* Write the user block to the new file */
written = HDfwrite(user_block, (size_t)1, size, new_fp);
@@ -2284,11 +2285,11 @@ misc13_insert_user_block(const char *old_name, const char *new_name, const char
/* Open the old file */
old_fp = HDfopen(old_name,"rb");
- CHECK(old_fp, NULL, "HDfopen");
+ CHECK_PTR(old_fp, "HDfopen");
/* Allocate space for the copy buffer */
copy_buf = HDmalloc((size_t)MISC13_COPY_BUF_SIZE);
- CHECK(copy_buf, NULL, "HDmalloc");
+ CHECK_PTR(copy_buf, "HDmalloc");
/* Copy data from the old file to the new file */
while((read_in = HDfread(copy_buf, (size_t)1, (size_t)MISC13_COPY_BUF_SIZE, old_fp)) > 0) {
@@ -2438,7 +2439,7 @@ test_misc13(void)
/* Create a data buffer for the datasets */
data = (unsigned *)HDcalloc(MISC13_DIM1, sizeof(unsigned));
- CHECK(data, NULL, "HDcalloc");
+ CHECK_PTR(data, "HDcalloc");
/* Initialize data to write */
misc13_init_data(data);
@@ -3445,7 +3446,7 @@ test_misc19(void)
/* Get a VFD class to register */
vfd_cls = h5_get_dummy_vfd_class();
- CHECK(vfd_cls, NULL, "h5_get_dummy_vfd_class");
+ CHECK_PTR(vfd_cls, "h5_get_dummy_vfd_class");
/* Register a virtual file driver */
vfdid = H5FDregister(vfd_cls);
@@ -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/test/trefstr.c b/test/trefstr.c
index 40ce344..83e2951 100644
--- a/test/trefstr.c
+++ b/test/trefstr.c
@@ -67,7 +67,7 @@ test_refstr_create(void)
/* Try creating a ref-counted string */
rs=H5RS_create("foo");
- CHECK(rs, NULL, "H5RS_create");
+ CHECK_PTR(rs, "H5RS_create");
/* Get the reference count on the string */
count=H5RS_get_count(rs);
@@ -97,7 +97,7 @@ test_refstr_count(void)
/* Try creating a ref-counted string */
rs=H5RS_create("foo");
- CHECK(rs, NULL, "H5RS_create");
+ CHECK_PTR(rs, "H5RS_create");
/* Get the reference count on the string */
count=H5RS_get_count(rs);
@@ -144,7 +144,7 @@ test_refstr_dup(void)
/* Try creating a ref-counted string */
rs1=H5RS_create("foo");
- CHECK(rs1, NULL, "H5RS_create");
+ CHECK_PTR(rs1, "H5RS_create");
/* Get the reference count on the string */
count=H5RS_get_count(rs1);
@@ -152,7 +152,7 @@ test_refstr_dup(void)
/* Duplicate r-string */
rs2=H5RS_dup(rs1);
- CHECK(rs2, NULL, "H5RS_dup");
+ CHECK_PTR(rs2, "H5RS_dup");
/* Get the reference count on the strings */
count=H5RS_get_count(rs1);
@@ -194,11 +194,11 @@ test_refstr_cmp(void)
/* Create first reference counted string */
rs1=H5RS_create("foo");
- CHECK(rs1, NULL, "H5RS_create");
+ CHECK_PTR(rs1, "H5RS_create");
/* Create second reference counted string */
rs2=H5RS_create("foo2");
- CHECK(rs2, NULL, "H5RS_create");
+ CHECK_PTR(rs2, "H5RS_create");
/* Compare the strings in various ways */
cmp=H5RS_cmp(rs1,rs1);
@@ -246,12 +246,12 @@ test_refstr_wrap(void)
/* Wrap ref-counted string around existing buffer */
rs=H5RS_wrap(buf);
- CHECK(rs, NULL, "H5RS_wrap");
+ CHECK_PTR(rs, "H5RS_wrap");
/* Get pointer to raw string in ref-counted string */
s=H5RS_get_str(rs);
- CHECK(s, NULL, "H5RS_get_str");
- VERIFY(s, buf, "wrapping");
+ CHECK_PTR(s, "H5RS_get_str");
+ CHECK_PTR_EQ(s, buf, "wrapping");
cmp=HDstrcmp(s,buf);
VERIFY(cmp, 0, "HDstrcmp");
@@ -264,7 +264,7 @@ test_refstr_wrap(void)
/* Get pointer to raw string in ref-counted string */
s=H5RS_get_str(rs);
- CHECK(s, NULL, "H5RS_get_str");
+ CHECK_PTR(s, "H5RS_get_str");
CHECK(s, buf, "wrapping");
cmp=HDstrcmp(s,buf);
if(cmp<=0)
@@ -299,17 +299,17 @@ test_refstr_own(void)
/* Initialize buffer */
s = (char *)H5FL_BLK_MALLOC(str_buf,HDstrlen("foo") + 1);
- CHECK(s, NULL, "H5FL_BLK_MALLOC");
+ CHECK_PTR(s, "H5FL_BLK_MALLOC");
HDstrcpy(s, "foo");
/* Transfer ownership of dynamically allocated string to ref-counted string */
rs=H5RS_own(s);
- CHECK(rs, NULL, "H5RS_own");
+ CHECK_PTR(rs, "H5RS_own");
/* Get pointer to raw string in ref-counted string */
t=H5RS_get_str(rs);
- CHECK(t, NULL, "H5RS_get_str");
- VERIFY(t, s, "transferring");
+ CHECK_PTR(t, "H5RS_get_str");
+ CHECK_PTR_EQ(t, s, "transferring");
cmp=HDstrcmp(s,t);
VERIFY(cmp, 0, "HDstrcmp");
@@ -322,8 +322,8 @@ test_refstr_own(void)
/* Get pointer to raw string in ref-counted string */
t=H5RS_get_str(rs);
- CHECK(t, NULL, "H5RS_get_str");
- VERIFY(t, s, "transferring");
+ CHECK_PTR(t, "H5RS_get_str");
+ CHECK_PTR_EQ(t, s, "transferring");
cmp=HDstrcmp(t,s);
VERIFY(cmp, 0, "HDstrcmp");
diff --git a/test/tselect.c b/test/tselect.c
index 85c21bb..2022a11 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -228,9 +228,9 @@ test_select_hyper(hid_t xfer_plist)
/* Allocate write & read buffers */
wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -432,9 +432,9 @@ test_select_point(hid_t xfer_plist)
/* Allocate write & read buffers */
wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -710,9 +710,9 @@ test_select_all(hid_t xfer_plist)
/* Allocate write & read buffers */
wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3));
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE4_DIM1; i++)
@@ -797,9 +797,9 @@ test_select_all_hyper(hid_t xfer_plist)
/* Allocate write & read buffers */
wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -939,9 +939,9 @@ test_select_combo(void)
/* Allocate write & read buffers */
wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -1106,9 +1106,9 @@ test_select_hyper_stride(hid_t xfer_plist)
/* Allocate write & read buffers */
wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -1234,9 +1234,9 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist)
/* Allocate write & read buffers */
wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -1364,9 +1364,9 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist)
/* Allocate write & read buffers */
wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4));
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE8_DIM1; i++)
@@ -1491,9 +1491,9 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist)
/* Allocate write & read buffers */
wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4));
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE8_DIM4; i++)
@@ -1735,9 +1735,9 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf,
/* Allocate buffers */
small_cube_buf_1 = (uint16_t *)HDcalloc(sizeof(uint16_t), small_cube_size);
- CHECK(small_cube_buf_1, NULL, "HDcalloc");
+ CHECK_PTR(small_cube_buf_1, "HDcalloc");
large_cube_buf_1 = (uint16_t *)HDcalloc(sizeof(uint16_t), large_cube_size);
- CHECK(large_cube_buf_1, NULL, "HDcalloc");
+ CHECK_PTR(large_cube_buf_1, "HDcalloc");
/* Create a dataset transfer property list */
fapl = H5Pcreate(H5P_FILE_ACCESS);
@@ -2342,7 +2342,7 @@ test_select_hyper_contig_dr(hid_t dset_type, hid_t xfer_plist)
/* Allocate cube buffer for writing values */
cube_buf = (uint16_t *)HDmalloc(sizeof(uint16_t) * max_cube_size);
- CHECK(cube_buf, NULL, "HDmalloc");
+ CHECK_PTR(cube_buf, "HDmalloc");
/* Initialize the cube buffer */
cube_ptr = cube_buf;
@@ -2351,7 +2351,7 @@ test_select_hyper_contig_dr(hid_t dset_type, hid_t xfer_plist)
/* Allocate cube buffer for zeroing values on disk */
zero_buf = (uint16_t *)HDcalloc(sizeof(uint16_t), max_cube_size);
- CHECK(zero_buf, NULL, "HDcalloc");
+ CHECK_PTR(zero_buf, "HDcalloc");
for(large_rank = 1; large_rank <= max_rank; large_rank++) {
for(small_rank = 1; small_rank < large_rank; small_rank++) {
@@ -2811,9 +2811,9 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
/* Allocate & initialize buffers */
small_cube_buf_1 = (uint16_t *)HDcalloc(sizeof(uint16_t), small_cube_size);
- CHECK(small_cube_buf_1, NULL, "HDcalloc");
+ CHECK_PTR(small_cube_buf_1, "HDcalloc");
large_cube_buf_1 = (uint16_t *)HDcalloc(sizeof(uint16_t), large_cube_size);
- CHECK(large_cube_buf_1, NULL, "HDcalloc");
+ CHECK_PTR(large_cube_buf_1, "HDcalloc");
/* Create a dataset transfer property list */
@@ -3574,7 +3574,7 @@ test_select_hyper_checker_board_dr(hid_t dset_type, hid_t xfer_plist)
/* Allocate cube buffer for writing values */
cube_buf = (uint16_t *)HDmalloc(sizeof(uint16_t) * max_cube_size);
- CHECK(cube_buf, NULL, "HDmalloc");
+ CHECK_PTR(cube_buf, "HDmalloc");
/* Initialize the cube buffer */
cube_ptr = cube_buf;
@@ -3583,7 +3583,7 @@ test_select_hyper_checker_board_dr(hid_t dset_type, hid_t xfer_plist)
/* Allocate cube buffer for zeroing values on disk */
zero_buf = (uint16_t *)HDcalloc(sizeof(uint16_t), max_cube_size);
- CHECK(zero_buf, NULL, "HDcalloc");
+ CHECK_PTR(zero_buf, "HDcalloc");
for(large_rank = 1; large_rank <= max_rank; large_rank++) {
for(small_rank = 1; small_rank < large_rank; small_rank++) {
@@ -3651,11 +3651,11 @@ test_select_hyper_copy(void)
/* Allocate write & read buffers */
wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
rbuf2 = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
- CHECK(rbuf2, NULL, "HDcalloc");
+ CHECK_PTR(rbuf2, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -3813,11 +3813,11 @@ test_select_point_copy(void)
/* Allocate write & read buffers */
wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
rbuf2 = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
- CHECK(rbuf2, NULL, "HDcalloc");
+ CHECK_PTR(rbuf2, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -3991,9 +3991,9 @@ test_select_hyper_offset(void)
/* Allocate write & read buffers */
wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -4149,9 +4149,9 @@ test_select_hyper_offset2(void)
/* Allocate write & read buffers */
wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE7_DIM1 * SPACE7_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE7_DIM1 * SPACE7_DIM2));
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++)
@@ -4272,9 +4272,9 @@ test_select_point_offset(void)
/* Allocate write & read buffers */
wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -4452,9 +4452,9 @@ test_select_hyper_union(void)
/* Allocate write & read buffers */
wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -5319,9 +5319,9 @@ test_select_hyper_and_2d(void)
/* Allocate write & read buffers */
wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -5448,9 +5448,9 @@ test_select_hyper_xor_2d(void)
/* Allocate write & read buffers */
wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -5579,9 +5579,9 @@ test_select_hyper_notb_2d(void)
/* Allocate write & read buffers */
wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -5709,9 +5709,9 @@ test_select_hyper_nota_2d(void)
/* Allocate write & read buffers */
wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -5869,9 +5869,9 @@ test_select_hyper_union_random_5d(hid_t read_plist)
/* Allocate write & read buffers */
wbuf = (int *)HDmalloc(sizeof(int) * SPACE5_DIM1 * SPACE5_DIM2 * SPACE5_DIM3 * SPACE5_DIM4 * SPACE5_DIM5);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (int *)HDcalloc(sizeof(int), (size_t)(SPACE5_DIM1 * SPACE5_DIM2 * SPACE5_DIM3 * SPACE5_DIM4 * SPACE5_DIM5));
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE5_DIM1; i++)
@@ -6061,9 +6061,9 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist)
/* Allocate the transfer buffers */
data = (short *)HDmalloc(sizeof(short) * X * Y * Z);
- CHECK(data, NULL, "HDmalloc");
+ CHECK_PTR(data, "HDmalloc");
data_out = (short *)HDcalloc((size_t)(NX * NY * NZ), sizeof(short));
- CHECK(data_out, NULL, "HDcalloc");
+ CHECK_PTR(data_out, "HDcalloc");
/*
* Data buffer initialization.
@@ -6296,9 +6296,9 @@ test_select_point_chunk(void)
/* Allocate the transfer buffers */
data = (unsigned *)HDmalloc(sizeof(unsigned) * SPACE7_DIM1 * SPACE7_DIM2);
- CHECK(data, NULL, "HDmalloc");
+ CHECK_PTR(data, "HDmalloc");
data_out = (unsigned *)HDcalloc((size_t)(SPACE7_DIM1 * SPACE7_DIM2), sizeof(unsigned));
- CHECK(data_out, NULL, "HDcalloc");
+ CHECK_PTR(data_out, "HDcalloc");
/*
* Data buffer initialization.
@@ -7057,7 +7057,7 @@ test_select_fill_all(void)
/* Allocate memory buffer */
wbuf = (unsigned *)HDmalloc(sizeof(unsigned) * SPACE7_DIM1 * SPACE7_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
/* Initialize memory buffer */
for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
@@ -7133,7 +7133,7 @@ test_select_fill_point(hssize_t *offset)
/* Allocate memory buffer */
wbuf = (unsigned *)HDmalloc(sizeof(unsigned) * SPACE7_DIM1 * SPACE7_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
/* Initialize memory buffer */
for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
@@ -7230,7 +7230,7 @@ test_select_fill_hyper_simple(hssize_t *offset)
/* Allocate memory buffer */
wbuf = (unsigned *)HDmalloc(sizeof(unsigned) * SPACE7_DIM1 * SPACE7_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
/* Initialize memory buffer */
for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
@@ -7337,7 +7337,7 @@ test_select_fill_hyper_regular(hssize_t *offset)
/* Allocate memory buffer */
wbuf = (unsigned *)HDmalloc(sizeof(unsigned) * SPACE7_DIM1 * SPACE7_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
/* Initialize memory buffer */
for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
@@ -7456,7 +7456,7 @@ test_select_fill_hyper_irregular(hssize_t *offset)
/* Allocate memory buffer */
wbuf = (unsigned *)HDmalloc(sizeof(unsigned) * SPACE7_DIM1 * SPACE7_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
/* Initialize memory buffer */
for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
@@ -7558,9 +7558,9 @@ test_select_none(void)
/* Allocate write & read buffers */
wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE7_DIM1 * SPACE7_DIM2);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), SPACE7_DIM1 * SPACE7_DIM2);
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++)
@@ -7661,9 +7661,9 @@ test_scalar_select(void)
/* Allocate write & read buffers */
wbuf_uint8 = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE7_DIM1 * SPACE7_DIM2);
- CHECK(wbuf_uint8, NULL, "HDmalloc");
+ CHECK_PTR(wbuf_uint8, "HDmalloc");
wbuf_ushort = (unsigned short *)HDmalloc(sizeof(unsigned short) * SPACE7_DIM1 * SPACE7_DIM2);
- CHECK(wbuf_ushort, NULL, "HDmalloc");
+ CHECK_PTR(wbuf_ushort, "HDmalloc");
/* Initialize write buffers */
for(i=0, tbuf_uint8=wbuf_uint8, tbuf_ushort=wbuf_ushort; i<SPACE7_DIM1; i++)
@@ -12581,9 +12581,9 @@ test_select_hyper_chunk_offset(void)
/* Allocate buffers */
wbuf = (int *)HDmalloc(sizeof(int) * SPACE10_DIM1);
- CHECK(wbuf, NULL, "HDmalloc");
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (int *)HDcalloc(sizeof(int), SPACE10_DIM1);
- CHECK(rbuf, NULL, "HDcalloc");
+ CHECK_PTR(rbuf, "HDcalloc");
/* Initialize the write buffer */
for(i=0; i<SPACE10_DIM1; i++)
diff --git a/test/tskiplist.c b/test/tskiplist.c
index b9b00df..2806afe 100644
--- a/test/tskiplist.c
+++ b/test/tskiplist.c
@@ -66,11 +66,11 @@ test_skiplist_init(void)
/* Allocate arrays */
rand_num = (int *)HDmalloc(sizeof(int) * NUM_ELEMS);
- CHECK(rand_num, NULL, "HDmalloc");
+ CHECK_PTR(rand_num, "HDmalloc");
sort_rand_num = (int *)HDmalloc(sizeof(int) * NUM_ELEMS);
- CHECK(sort_rand_num, NULL, "HDmalloc");
+ CHECK_PTR(sort_rand_num, "HDmalloc");
rev_sort_rand_num = (int *)HDmalloc(sizeof(int) * NUM_ELEMS);
- CHECK(rev_sort_rand_num, NULL, "HDmalloc");
+ CHECK_PTR(rev_sort_rand_num, "HDmalloc");
/* Initialize random number seed */
curr_time = HDtime(NULL);
@@ -125,7 +125,7 @@ test_skiplist_create(void)
/* Try creating a skip list */
slist = H5SL_create(H5SL_TYPE_INT, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Try closing the skip list */
ret=H5SL_close(slist);
@@ -155,7 +155,7 @@ test_skiplist_insert(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_INT, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
num=H5SL_count(slist);
@@ -164,7 +164,7 @@ test_skiplist_insert(void)
/* Try searching for item in empty skip list */
key=37;
found_item=(int *)H5SL_search(slist,&key);
- VERIFY(found_item, NULL, "H5SL_search");
+ CHECK_PTR_NULL(found_item, "H5SL_search");
/* Insert an object into the skip list */
key=2; item=10;
@@ -177,13 +177,13 @@ test_skiplist_insert(void)
/* Search for the item just inserted */
found_item=(int *)H5SL_search(slist,&key);
- CHECK(found_item, NULL, "H5SL_search");
- VERIFY(*found_item,item,"H5SL_search");
+ CHECK_PTR(found_item, "H5SL_search");
+ VERIFY(*found_item, item, "H5SL_search");
/* Search for an item not in list */
search_key=37;
found_item=(int *)H5SL_search(slist,&search_key);
- VERIFY(found_item, NULL, "H5SL_search");
+ CHECK_PTR_NULL(found_item, "H5SL_search");
/* Attempt to insert duplicate key (should fail) */
search_key=2;
@@ -216,7 +216,7 @@ test_skiplist_insert_many(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_INT, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
num=H5SL_count(slist);
@@ -235,7 +235,7 @@ test_skiplist_insert_many(void)
/* Search for all objects in the skip list */
for(u=0; u<NUM_ELEMS; u++) {
found_item=(int *)H5SL_search(slist,&rand_num[u]);
- CHECK(found_item, NULL, "H5SL_search");
+ CHECK_PTR(found_item, "H5SL_search");
VERIFY(*found_item,rand_num[u],"H5SL_search");
} /* end for */
@@ -290,7 +290,7 @@ test_skiplist_remove(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_INT, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
num=H5SL_count(slist);
@@ -299,7 +299,7 @@ test_skiplist_remove(void)
/* Try removing an item in empty skip list */
search_key=37;
found_item=(int *)H5SL_remove(slist,&search_key);
- VERIFY(found_item, NULL, "H5SL_remove");
+ CHECK_PTR_NULL(found_item, "H5SL_remove");
/* Insert three objects into the skip list */
key1=15;
@@ -321,18 +321,18 @@ test_skiplist_remove(void)
/* Try removing items from skip list */
search_key=key1;
found_item=(int *)H5SL_remove(slist,&search_key);
- CHECK(found_item, NULL, "H5SL_remove");
- VERIFY(found_item, &key1, "H5SL_remove");
+ CHECK_PTR(found_item, "H5SL_remove");
+ CHECK_PTR_EQ(found_item, &key1, "H5SL_remove");
search_key=key2;
found_item=(int *)H5SL_remove(slist,&search_key);
- CHECK(found_item, NULL, "H5SL_remove");
- VERIFY(found_item, &key2, "H5SL_remove");
+ CHECK_PTR(found_item, "H5SL_remove");
+ CHECK_PTR_EQ(found_item, &key2, "H5SL_remove");
search_key=key3;
found_item=(int *)H5SL_remove(slist,&search_key);
- CHECK(found_item, NULL, "H5SL_remove");
- VERIFY(found_item, &key3, "H5SL_remove");
+ CHECK_PTR(found_item, "H5SL_remove");
+ CHECK_PTR_EQ(found_item, &key3, "H5SL_remove");
/* Check that the skip list has no elements */
num=H5SL_count(slist);
@@ -341,7 +341,7 @@ test_skiplist_remove(void)
/* Try removing items from empty skip list (after its been worked on) */
search_key=key1;
found_item=(int *)H5SL_remove(slist,&search_key);
- VERIFY(found_item, NULL, "H5SL_remove");
+ CHECK_PTR_NULL(found_item, "H5SL_remove");
/* Close the skip list */
ret=H5SL_close(slist);
@@ -369,7 +369,7 @@ test_skiplist_remove_many(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_INT, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
num=H5SL_count(slist);
@@ -388,7 +388,7 @@ test_skiplist_remove_many(void)
/* Remove all objects from the skip list (in random order) */
for(u=0; u<NUM_ELEMS; u++) {
found_item=(int *)H5SL_remove(slist,&rand_num[u]);
- CHECK(found_item, NULL, "H5SL_remove");
+ CHECK_PTR(found_item, "H5SL_remove");
VERIFY(*found_item,rand_num[u],"H5SL_remove");
} /* end for */
@@ -411,7 +411,7 @@ test_skiplist_remove_many(void)
/* Remove all objects from the skip list */
for(u=0; u<NUM_ELEMS; u++) {
found_item=(int *)H5SL_remove(slist,&sort_rand_num[u]);
- CHECK(found_item, NULL, "H5SL_remove");
+ CHECK_PTR(found_item, "H5SL_remove");
VERIFY(*found_item,sort_rand_num[u],"H5SL_remove");
} /* end for */
@@ -434,7 +434,7 @@ test_skiplist_remove_many(void)
/* Remove all objects from the skip list */
for(u=0; u<NUM_ELEMS; u++) {
found_item=(int *)H5SL_remove(slist,&rev_sort_rand_num[u]);
- CHECK(found_item, NULL, "H5SL_remove");
+ CHECK_PTR(found_item, "H5SL_remove");
VERIFY(*found_item,rev_sort_rand_num[u],"H5SL_remove");
} /* end for */
@@ -469,7 +469,7 @@ test_skiplist_firstnext(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_INT, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
num=H5SL_count(slist);
@@ -477,7 +477,7 @@ test_skiplist_firstnext(void)
VERIFY(num, 0, "H5SL_count");
/* Check that the list appears empty */
node=H5SL_first(slist);
- VERIFY(node, NULL, "H5SL_first");
+ CHECK_PTR_NULL(node, "H5SL_first");
/* Insert many objects into the skip list */
for(u=0; u<NUM_ELEMS; u++) {
@@ -491,7 +491,7 @@ test_skiplist_firstnext(void)
/* Iterate over all the nodes in the skip list */
node=H5SL_first(slist);
- CHECK(node, NULL, "H5SL_first");
+ CHECK_PTR(node, "H5SL_first");
u=0;
while(node!=NULL) {
found_item=(int *)H5SL_item(node);
@@ -506,7 +506,7 @@ test_skiplist_firstnext(void)
/* Check that the list appears empty again */
node=H5SL_first(slist);
- VERIFY(node, NULL, "H5SL_first");
+ CHECK_PTR_NULL(node, "H5SL_first");
/* Close the skip list */
ret=H5SL_close(slist);
@@ -562,7 +562,7 @@ test_skiplist_string(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_STR, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
num=H5SL_count(slist);
@@ -624,7 +624,7 @@ test_skiplist_iterate(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_INT, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
num=H5SL_count(slist);
@@ -674,7 +674,7 @@ test_skiplist_hsize(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_HSIZE, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
num=H5SL_count(slist);
@@ -729,7 +729,7 @@ test_skiplist_unsigned(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
num=H5SL_count(slist);
@@ -784,7 +784,7 @@ test_skiplist_obj(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_OBJ, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
num=H5SL_count(slist);
@@ -862,7 +862,7 @@ test_skiplist_generic(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_GENERIC, test_skiplist_generic_cmp);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
num=H5SL_count(slist);
@@ -916,7 +916,7 @@ test_skiplist_lastprev(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_INT, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Check that the skip list has no elements */
num=H5SL_count(slist);
@@ -924,7 +924,7 @@ test_skiplist_lastprev(void)
/* Check that the list appears empty */
node=H5SL_last(slist);
- VERIFY(node, NULL, "H5SL_last");
+ CHECK_PTR_NULL(node, "H5SL_last");
/* Insert many objects into the skip list */
for(u=0; u<NUM_ELEMS; u++) {
@@ -938,7 +938,7 @@ test_skiplist_lastprev(void)
/* Iterate over all the nodes in the skip list */
node=H5SL_last(slist);
- CHECK(node, NULL, "H5SL_last");
+ CHECK_PTR(node, "H5SL_last");
u=NUM_ELEMS-1;
while(node!=NULL) {
found_item=(int *)H5SL_item(node);
@@ -953,7 +953,7 @@ test_skiplist_lastprev(void)
/* Check that the list appears empty again */
node=H5SL_last(slist);
- VERIFY(node, NULL, "H5SL_last");
+ CHECK_PTR_NULL(node, "H5SL_last");
/* Close the skip list */
ret=H5SL_close(slist);
@@ -984,7 +984,7 @@ test_skiplist_find(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Insert objects into the skip list */
for(u=0; u<10; u++) {
@@ -995,7 +995,7 @@ test_skiplist_find(void)
/* Find the element with key==30 in the skip list */
find_item=30;
node=H5SL_find(slist,&find_item);
- CHECK(node, NULL, "H5SL_find");
+ CHECK_PTR(node, "H5SL_find");
/* Iterate over the rest of the nodes in the skip list */
u=4;
@@ -1009,7 +1009,7 @@ test_skiplist_find(void)
/* Check for trying to locate non-existent item */
find_item=81;
node=H5SL_find(slist,&find_item);
- VERIFY(node, NULL, "H5SL_find");
+ CHECK_PTR_NULL(node, "H5SL_find");
/* Close the skip list */
ret=H5SL_close(slist);
@@ -1040,7 +1040,7 @@ test_skiplist_add(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Insert objects into the skip list */
for(u=0; u<10; u++) {
@@ -1051,11 +1051,11 @@ test_skiplist_add(void)
/* Add the element with key==12 in the skip list */
new_item=12;
node=H5SL_add(slist,&new_item,&new_item);
- CHECK(node, NULL, "H5SL_add");
+ CHECK_PTR(node, "H5SL_add");
/* Advance to next node in list */
node=H5SL_next(node);
- CHECK(node, NULL, "H5SL_next");
+ CHECK_PTR(node, "H5SL_next");
/* Iterate over the rest of the nodes in the skip list */
u=2;
@@ -1102,7 +1102,7 @@ test_skiplist_destroy(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_INT, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Insert objects into the skip list */
for(u=0; u<NUM_ELEMS; u++) {
@@ -1138,7 +1138,7 @@ test_skiplist_free(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_INT, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Insert objects into the skip list */
for(u=0; u<NUM_ELEMS; u++) {
@@ -1210,8 +1210,8 @@ static herr_t test_tfs_iter(void *_obj, void *key, void *_udata) {
test_tfs_it_ud_t *udata = (test_tfs_it_ud_t *)_udata;
/* Check consistency */
- VERIFY((void *)&obj->idx, key, "obj->idx");
- VERIFY(obj, &udata->obj_list->list[obj->idx], "obj_list->list[obj->idx]");
+ CHECK_PTR_EQ((void *)&obj->idx, key, "obj->idx");
+ CHECK_PTR_EQ(obj, &udata->obj_list->list[obj->idx], "obj_list->list[obj->idx]");
/* Increment number of calls */
udata->ncalls++;
@@ -1236,8 +1236,8 @@ static htri_t test_tfs_free(void *_obj, void *key, void *_obj_list) {
htri_t ret_value;
/* Check consistency */
- VERIFY((void *)&obj->idx, key, "obj->idx");
- VERIFY(obj, &obj_list->list[obj->idx], "obj_list->list[obj->idx]");
+ CHECK_PTR_EQ((void *)&obj->idx, key, "obj->idx");
+ CHECK_PTR_EQ(obj, &obj_list->list[obj->idx], "obj_list->list[obj->idx]");
/* Mark this object as freed (to make sure it isn't recursively freed, that
* is not something we support, we will undo this if we decide later not to
@@ -1269,7 +1269,7 @@ static htri_t test_tfs_free(void *_obj, void *key, void *_obj_list) {
else {
/* Remove the object */
obj_ret = (test_tfs_obj_t *)H5SL_remove(obj_list->slist, &j);
- CHECK(obj_ret, NULL, "H5SL_remove");
+ CHECK_PTR(obj_ret, "H5SL_remove");
obj_ret->nfrees++;
obj_list->nobjs_rem--;
} /* end else */
@@ -1324,7 +1324,7 @@ test_skiplist_try_free_safe(void)
/* Create a skip list */
obj_list.slist = H5SL_create(H5SL_TYPE_INT, NULL);
- CHECK(obj_list.slist, NULL, "H5SL_create");
+ CHECK_PTR(obj_list.slist, "H5SL_create");
/* Init obj_list.list */
obj_list.list = list;
@@ -1396,7 +1396,7 @@ test_skiplist_less(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Insert objects into the skip list */
for(u=0; u<10; u++) {
@@ -1430,7 +1430,7 @@ test_skiplist_less(void)
VERIFY(*found_item,5,"H5SL_less");
find_item=4;
found_item=(unsigned *)H5SL_less(slist,&find_item);
- VERIFY(found_item,NULL,"H5SL_less");
+ CHECK_PTR_NULL(found_item, "H5SL_less");
/* Close the skip list */
ret=H5SL_close(slist);
@@ -1460,7 +1460,7 @@ test_skiplist_greater(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Insert objects into the skip list */
for(u = 0; u < 10; u++) {
@@ -1488,7 +1488,7 @@ test_skiplist_greater(void)
VERIFY(*found_item, 90, "H5SL_greater");
find_item = 100;
found_item = (unsigned *)H5SL_greater(slist, &find_item);
- VERIFY(found_item, NULL, "H5SL_greater");
+ CHECK_PTR_NULL(found_item, "H5SL_greater");
find_item = 6;
found_item = (unsigned *)H5SL_greater(slist, &find_item);
VERIFY(*found_item, 10, "H5SL_greater");
@@ -1525,7 +1525,7 @@ test_skiplist_below(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Insert objects into the skip list */
for(u = 0; u < 10; u++) {
@@ -1536,44 +1536,44 @@ test_skiplist_below(void)
/* Check for exact match of items in various positions */
find_item = 20;
node = H5SL_below(slist, &find_item);
- CHECK(node, NULL, "H5SL_below");
+ CHECK_PTR(node, "H5SL_below");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, find_item, "H5SL_below");
find_item = 90;
node = H5SL_below(slist, &find_item);
- CHECK(node, NULL, "H5SL_below");
+ CHECK_PTR(node, "H5SL_below");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, find_item, "H5SL_below");
find_item = 5;
node = H5SL_below(slist, &find_item);
- CHECK(node, NULL, "H5SL_below");
+ CHECK_PTR(node, "H5SL_below");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, find_item, "H5SL_below");
/* Find item less than a missing key, in various positions */
find_item = 19;
node = H5SL_below(slist, &find_item);
- CHECK(node, NULL, "H5SL_below");
+ CHECK_PTR(node, "H5SL_below");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, 15, "H5SL_below");
find_item = 89;
node = H5SL_below(slist, &find_item);
- CHECK(node, NULL, "H5SL_below");
+ CHECK_PTR(node, "H5SL_below");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, 80, "H5SL_below");
find_item = 100;
node = H5SL_below(slist, &find_item);
- CHECK(node, NULL, "H5SL_below");
+ CHECK_PTR(node, "H5SL_below");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, 90, "H5SL_below");
find_item = 9;
node = H5SL_below(slist, &find_item);
- CHECK(node, NULL, "H5SL_below");
+ CHECK_PTR(node, "H5SL_below");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, 5, "H5SL_below");
find_item = 4;
node = (H5SL_node_t *)H5SL_less(slist, &find_item);
- VERIFY(node, NULL, "H5SL_below");
+ CHECK_PTR_NULL(node, "H5SL_below");
/* Close the skip list */
ret = H5SL_close(slist);
@@ -1604,7 +1604,7 @@ test_skiplist_above(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Insert objects into the skip list */
for(u = 0; u < 10; u++) {
@@ -1615,42 +1615,42 @@ test_skiplist_above(void)
/* Check for exact match of items in various positions */
find_item = 20;
node = H5SL_above(slist, &find_item);
- CHECK(node, NULL, "H5SL_above");
+ CHECK_PTR(node, "H5SL_above");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, find_item, "H5SL_above");
find_item = 90;
node = H5SL_above(slist, &find_item);
- CHECK(node, NULL, "H5SL_above");
+ CHECK_PTR(node, "H5SL_above");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, find_item, "H5SL_above");
find_item = 5;
node = H5SL_above(slist, &find_item);
- CHECK(node, NULL, "H5SL_above");
+ CHECK_PTR(node, "H5SL_above");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, find_item, "H5SL_above");
/* Find item greater than a missing key, in various positions */
find_item = 19;
node = H5SL_above(slist, &find_item);
- CHECK(node, NULL, "H5SL_above");
+ CHECK_PTR(node, "H5SL_above");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, 20, "H5SL_above");
find_item = 89;
node = H5SL_above(slist, &find_item);
- CHECK(node, NULL, "H5SL_above");
+ CHECK_PTR(node, "H5SL_above");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, 90, "H5SL_above");
find_item = 100;
node = H5SL_above(slist, &find_item);
- VERIFY(node, NULL, "H5SL_above");
+ CHECK_PTR_NULL(node, "H5SL_above");
find_item = 6;
node = H5SL_above(slist, &find_item);
- CHECK(node, NULL, "H5SL_above");
+ CHECK_PTR(node, "H5SL_above");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, 10, "H5SL_above");
find_item = 4;
node = H5SL_above(slist, &find_item);
- CHECK(node, NULL, "H5SL_above");
+ CHECK_PTR(node, "H5SL_above");
found_item = (unsigned *)H5SL_item(node);
VERIFY(*found_item, 5, "H5SL_above");
@@ -1681,7 +1681,7 @@ test_skiplist_remove_first(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_UNSIGNED, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Insert objects into the skip list */
for(u = 0; u < 10; u++) {
@@ -1697,7 +1697,7 @@ test_skiplist_remove_first(void)
/* Check for removing object from empty list */
found_item = (unsigned *)H5SL_remove_first(slist);
- VERIFY(found_item, NULL, "H5SL_remove_first");
+ CHECK_PTR_NULL(found_item, "H5SL_remove_first");
/* Close the skip list */
ret = H5SL_close(slist);
@@ -1725,7 +1725,7 @@ test_skiplist_remove_first_many(void)
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_INT, NULL);
- CHECK(slist, NULL, "H5SL_create");
+ CHECK_PTR(slist, "H5SL_create");
/* Insert objects into the skip list */
for(u = 0; u < NUM_ELEMS; u++) {
@@ -1742,7 +1742,7 @@ test_skiplist_remove_first_many(void)
/* Check for removing object from empty list */
found_item = (int *)H5SL_remove_first(slist);
- VERIFY(found_item, NULL, "H5SL_remove_first");
+ CHECK_PTR_NULL(found_item, "H5SL_remove_first");
/* Close the skip list */
ret = H5SL_close(slist);
diff --git a/test/ttst.c b/test/ttst.c
index b26d582..c5912c5 100644
--- a/test/ttst.c
+++ b/test/ttst.c
@@ -157,7 +157,7 @@ test_tst_create(void)
/* Try creating a TST */
tree=H5ST_create();
- CHECK(tree, NULL, "H5ST_create");
+ CHECK_PTR(tree, "H5ST_create");
/* Try closing a real tree */
ret=H5ST_close(tree);
@@ -186,7 +186,7 @@ test_tst_insert(void)
/* Create the TST */
tree=H5ST_create();
- CHECK(tree, NULL, "H5ST_create");
+ CHECK_PTR(tree, "H5ST_create");
/* Insert unique words into TST, in random order */
for(u=0; u<num_uniq_words; u++) {
@@ -202,13 +202,13 @@ test_tst_insert(void)
/* Check that the value "payloads" are correct */
found=H5ST_find(tree,uniq_words[u]);
- CHECK(found, NULL, "H5ST_find");
+ CHECK_PTR(found, "H5ST_find");
if(HDstrcmp((const char *)found->eqkid,uniq_words[u]))
TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, uniq_words[%u]=%s\n",__LINE__,(char *)found->eqkid,(unsigned)u,uniq_words[u]);
obj=H5ST_locate(tree,uniq_words[u]);
- CHECK(obj, NULL, "H5ST_locate");
+ CHECK_PTR(obj, "H5ST_locate");
if(HDstrcmp((const char *)obj,uniq_words[u]))
TestErrPrintf("%d: TST objects don't match!, obj=%s, uniq_words[%u]=%s\n",__LINE__,(char *)obj,(unsigned)u,uniq_words[u]);
@@ -246,7 +246,7 @@ test_tst_iterate(void)
/* Create the TST */
tree=H5ST_create();
- CHECK(tree, NULL, "H5ST_create");
+ CHECK_PTR(tree, "H5ST_create");
/* Insert unique words into TST, in random order */
for(u=0; u<num_uniq_words; u++) {
@@ -256,7 +256,7 @@ test_tst_iterate(void)
/* Use findfirst/findnext calls to iterate through TST */
found=H5ST_findfirst(tree);
- CHECK(found, NULL, "H5ST_findfirst");
+ CHECK_PTR(found, "H5ST_findfirst");
u=0;
do {
/* Check that the strings in the TST are in the correct order */
@@ -294,7 +294,7 @@ test_tst_remove(void)
/* Create the TST */
tree=H5ST_create();
- CHECK(tree, NULL, "H5ST_create");
+ CHECK_PTR(tree, "H5ST_create");
/* Insert unique words into TST, in random order */
for(u=0; u<num_uniq_words; u++) {
@@ -305,7 +305,7 @@ test_tst_remove(void)
/* Remove strings from TST in random order */
for(u=0; u<num_uniq_words; u++) {
obj=H5ST_remove(tree,rand_uniq_words[u]);
- CHECK(obj, NULL, "H5ST_remove");
+ CHECK_PTR(obj, "H5ST_remove");
/* Check that the correct string was removed from TST */
if(HDstrcmp((const char *)obj,rand_uniq_words[u]))
@@ -326,7 +326,7 @@ test_tst_remove(void)
for(u=0; u<num_uniq_words; u++) {
/* Get the pointer to the node to delete */
found=H5ST_find(tree,rand_uniq_words[u]);
- CHECK(found, NULL, "H5ST_find");
+ CHECK_PTR(found, "H5ST_find");
/* Check that the correct object will be removed from TST */
if(HDstrcmp((const char *)found->eqkid,rand_uniq_words[u]))
diff --git a/test/tvltypes.c b/test/tvltypes.c
index 5121a66..0c4cb9d 100644
--- a/test/tvltypes.c
+++ b/test/tvltypes.c
@@ -1015,9 +1015,9 @@ test_vltypes_compound_vlen_vlen(void)
/* Allocate and initialize VL data to write */
wdata = (s1 *)HDmalloc(sizeof(s1) * SPACE3_DIM1);
- CHECK(wdata, NULL, "HDmalloc");
+ CHECK_PTR(wdata, "HDmalloc");
rdata = (s1 *)HDmalloc(sizeof(s1) * SPACE3_DIM1);
- CHECK(rdata, NULL, "HDmalloc");
+ CHECK_PTR(rdata, "HDmalloc");
for(i = 0; i < SPACE3_DIM1; i++) {
wdata[i].i = (int)(i * 10);
wdata[i].f = (float)(i * 20) / 3.0F;
@@ -2503,7 +2503,7 @@ test_vltypes_fill_value(void)
/* Allocate space for the buffer to read data */
rbuf = (dtype1_struct *)HDmalloc(SPACE4_DIM_LARGE * sizeof(dtype1_struct));
- CHECK(rbuf, NULL, "HDmalloc");
+ CHECK_PTR(rbuf, "HDmalloc");
/* Create the small & large dataspaces to use */
diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c
index 532169f..ce5df78 100644
--- a/tools/src/h5diff/h5diff_common.c
+++ b/tools/src/h5diff/h5diff_common.c
@@ -115,14 +115,17 @@ 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':
opts->m_verbose = 1;
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_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/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/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/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/h5dump/errfiles/filter_fail.err b/tools/test/h5dump/errfiles/filter_fail.err
index afcbbe1..9b1afa9 100644
--- a/tools/test/h5dump/errfiles/filter_fail.err
+++ b/tools/test/h5dump/errfiles/filter_fail.err
@@ -14,10 +14,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#004: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed
major: Data filters
minor: Filter operation failed
- #005: (file name) line (number) in H5Z_pipeline(): required filter 'filter_fail_test' is not registered
- major: Data filters
- minor: Read failed
- #006: (file name) line (number) in H5PL_load(): required dynamically loaded plugin filter '312' is not available
+ #005: (file name) line (number) in H5PL_load(): filter plugins disabled
major: Plugin for dynamically loaded library
minor: Unable to load metadata into cache
h5dump error: unable to print data
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/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