summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2019-07-31 20:18:58 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2019-07-31 20:18:58 (GMT)
commitc8d32112f87e0c79999e33cc40cb411da1642b5c (patch)
treeac3d1dfffa72156bac18aefbf3b76a255ea06478
parentc1a6ba6b648fe4c42dca2ada0f0e8e2c904e3f9e (diff)
downloadhdf5-c8d32112f87e0c79999e33cc40cb411da1642b5c.zip
hdf5-c8d32112f87e0c79999e33cc40cb411da1642b5c.tar.gz
hdf5-c8d32112f87e0c79999e33cc40cb411da1642b5c.tar.bz2
HDFFV-10845 More changes from 1.10 branch
-rw-r--r--CMakeInstallation.cmake10
-rw-r--r--MANIFEST2
-rw-r--r--c++/examples/CMakeLists.txt32
-rw-r--r--c++/examples/CMakeTests.cmake132
-rw-r--r--c++/src/CMakeLists.txt51
-rw-r--r--c++/test/CMakeLists.txt20
-rw-r--r--c++/test/CMakeTests.cmake59
-rw-r--r--c++/test/CMakeVFDTests.cmake67
-rw-r--r--examples/h5_cmprss.c1
-rw-r--r--fortran/test/CMakeTests.cmake21
-rw-r--r--hl/src/CMakeLists.txt8
-rw-r--r--hl/tools/gif2h5/decompress.c2
-rw-r--r--hl/tools/gif2h5/gif2mem.c4
-rw-r--r--hl/tools/gif2h5/h52gifgentst.c8
-rw-r--r--hl/tools/gif2h5/h52giftest.sh.in2
-rw-r--r--hl/tools/gif2h5/testfiles/README (renamed from hl/tools/gif2h5/testfiles/REAMDE)0
-rw-r--r--src/H5Edefin.h228
-rw-r--r--src/H5Einit.h820
-rw-r--r--src/H5Epubgen.h410
-rw-r--r--src/H5Eterm.h230
-rw-r--r--src/H5private.h240
-rw-r--r--src/H5system.c36
-rw-r--r--src/H5win32defs.h2
-rw-r--r--test/H5srcdir.h42
-rw-r--r--test/accum.c156
-rw-r--r--test/app_ref.c6
-rw-r--r--test/big.c10
-rw-r--r--test/bittests.c240
-rw-r--r--test/cmpd_dset.c3
-rw-r--r--test/dangle.c87
-rw-r--r--test/dsets.c2342
-rw-r--r--test/dt_arith.c1761
-rw-r--r--test/dtransform.c4
-rw-r--r--test/enum.c2
-rw-r--r--test/err_compat.c2
-rw-r--r--test/error_test.c472
-rw-r--r--test/extend.c2
-rw-r--r--test/file_image.c12
-rw-r--r--test/fillval.c134
-rw-r--r--test/filter_fail.c6
-rw-r--r--test/flush1.c13
-rw-r--r--test/flush2.c4
-rw-r--r--test/freespace.c253
-rw-r--r--test/gen_bogus.c3
-rw-r--r--test/gen_cross.c121
-rw-r--r--test/gen_deflate.c112
-rw-r--r--test/gen_file_image.c71
-rw-r--r--test/getname.c96
-rw-r--r--test/gheap.c443
-rw-r--r--test/h5test.c2
-rw-r--r--test/h5test.h5
-rw-r--r--test/hyperslab.c438
-rw-r--r--test/istore.c514
-rw-r--r--test/lheap.c101
-rw-r--r--test/links.c4826
-rw-r--r--test/links_env.c12
-rw-r--r--test/mf.c57
-rw-r--r--test/mount.c38
-rw-r--r--test/mtime.c4
-rw-r--r--test/pool.c2
-rw-r--r--test/tarray.c855
-rw-r--r--test/tattr.c588
-rw-r--r--test/tcheck_version.c8
-rw-r--r--test/testfiles/err_compat_14
-rw-r--r--test/testfiles/err_compat_22
-rw-r--r--test/testfiles/error_test_22
66 files changed, 7827 insertions, 8413 deletions
diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake
index b10416e..31591da 100644
--- a/CMakeInstallation.cmake
+++ b/CMakeInstallation.cmake
@@ -23,16 +23,6 @@ if (WIN32)
find_program (WIX_EXECUTABLE candle PATHS "${CPACK_WIX_ROOT}/bin")
endif ()
-#-----------------------------------------------------------------------------
-# Add file(s) to CMake Install
-#-----------------------------------------------------------------------------
-if (NOT HDF5_INSTALL_NO_DEVELOPMENT)
- install (
- FILES ${PROJECT_BINARY_DIR}/H5pubconf.h
- DESTINATION ${HDF5_INSTALL_INCLUDE_DIR}
- COMPONENT headers
- )
-endif ()
#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install for import into other projects
diff --git a/MANIFEST b/MANIFEST
index 7028d57..29283e2 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -2277,7 +2277,7 @@
./hl/tools/gif2h5/writehdf.c
./hl/tools/gif2h5/h52gifgentst.c
./hl/tools/gif2h5/h52giftest.sh.in
-./hl/tools/gif2h5/testfiles/REAMDE
+./hl/tools/gif2h5/testfiles/README
./hl/tools/gif2h5/testfiles/ex_image2.h5
./hl/tools/gif2h5/testfiles/image1.gif
./hl/tools/gif2h5/testfiles/h52giftst.h5
diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt
index d3a18f2..58d85c1 100644
--- a/c++/examples/CMakeLists.txt
+++ b/c++/examples/CMakeLists.txt
@@ -34,17 +34,37 @@ set (tutr_examples
foreach (example ${examples})
add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp)
- target_include_directories(cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (cpp_ex_${example} STATIC)
- target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET})
+ target_include_directories (cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (cpp_ex_${example} STATIC)
+ target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (cpp_ex_${example} SHARED)
+ target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ if (MINGW)
+ target_link_options (${HDF5_CPP_LIBSH_TARGET}
+ PRIVATE -static-libgcc -static-libstdc++
+ )
+ endif ()
+ endif ()
set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp)
endforeach ()
foreach (example ${tutr_examples})
add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp)
- target_include_directories(cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (cpp_ex_${example} STATIC)
- target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET})
+ target_include_directories (cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (cpp_ex_${example} STATIC)
+ target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (cpp_ex_${example} SHARED)
+ target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ if (MINGW)
+ target_link_options (${HDF5_CPP_LIBSH_TARGET}
+ PRIVATE -static-libgcc -static-libstdc++
+ )
+ endif ()
+ endif ()
set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp)
endforeach ()
diff --git a/c++/examples/CMakeTests.cmake b/c++/examples/CMakeTests.cmake
index 58bdb68..bbe3433 100644
--- a/c++/examples/CMakeTests.cmake
+++ b/c++/examples/CMakeTests.cmake
@@ -16,81 +16,79 @@
##############################################################################
##############################################################################
# Remove any output file left over from previous test run
- add_test (
- NAME CPP_ex-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- Group.h5
- SDS.h5
- SDScompound.h5
- SDSextendible.h5
- Select.h5
- )
+add_test (
+ NAME CPP_ex-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ Group.h5
+ SDS.h5
+ SDScompound.h5
+ SDSextendible.h5
+ Select.h5
+)
+set_tests_properties (CPP_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_cppex)
+
+foreach (example ${examples})
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME CPP_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:cpp_ex_${example}>)
+ else ()
+ add_test (NAME CPP_ex_${example} COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:cpp_ex_${example}>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=cpp_ex_${example}.txt"
+ #-D "TEST_REFERENCE=cpp_ex_${example}.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ()
+ set_tests_properties (CPP_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_cppex)
if (last_test)
- set_tests_properties (CPP_ex-clear-objects PROPERTIES DEPENDS ${last_test})
+ set_tests_properties (CPP_ex_${example} PROPERTIES DEPENDS ${last_test})
endif ()
- set (last_test "CPP_ex-clear-objects")
-
- foreach (example ${examples})
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME CPP_ex_${example} COMMAND $<TARGET_FILE:cpp_ex_${example}>)
- else ()
- add_test (NAME CPP_ex_${example} COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:cpp_ex_${example}>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=cpp_ex_${example}.txt"
- #-D "TEST_REFERENCE=cpp_ex_${example}.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
- if (last_test)
- set_tests_properties (CPP_ex_${example} PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "CPP_ex_${example}")
- endforeach ()
+ set (last_test "CPP_ex_${example}")
+endforeach ()
#the following dependencies are handled by the order of the files
# SET_TESTS_PROPERTIES(CPP_ex_readdata PROPERTIES DEPENDS CPP_ex_create)
# SET_TESTS_PROPERTIES(CPP_ex_chunks PROPERTIES DEPENDS CPP_ex_extend_ds)
- add_test (
- NAME CPP_ex_tutr-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- h5tutr_cmprss.h5
- h5tutr_dset.h5
- h5tutr_extend.h5
- h5tutr_group.h5
- h5tutr_groups.h5
- h5tutr_subset.h5
- )
+add_test (
+ NAME CPP_ex_tutr-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ h5tutr_cmprss.h5
+ h5tutr_dset.h5
+ h5tutr_extend.h5
+ h5tutr_group.h5
+ h5tutr_groups.h5
+ h5tutr_subset.h5
+)
+set_tests_properties (CPP_ex_tutr-clear-objects PROPERTIES FIXTURES_SETUP clear_cppex_tutr)
+
+foreach (example ${tutr_examples})
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME CPP_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:cpp_ex_${example}>)
+ else ()
+ add_test (NAME CPP_ex_${example} COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:cpp_ex_${example}>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=cpp_ex_${example}.txt"
+ #-D "TEST_REFERENCE=cpp_ex_${example}.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ()
+ set_tests_properties (CPP_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_cppex_tutr)
if (last_test)
- set_tests_properties (CPP_ex_tutr-clear-objects PROPERTIES DEPENDS ${last_test})
+ set_tests_properties (CPP_ex_${example} PROPERTIES DEPENDS ${last_test})
endif ()
- set (last_test "CPP_ex_tutr-clear-objects")
-
- foreach (example ${tutr_examples})
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME CPP_ex_${example} COMMAND $<TARGET_FILE:cpp_ex_${example}>)
- else ()
- add_test (NAME CPP_ex_${example} COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:cpp_ex_${example}>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=cpp_ex_${example}.txt"
- #-D "TEST_REFERENCE=cpp_ex_${example}.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
- if (last_test)
- set_tests_properties (CPP_ex_${example} PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "CPP_ex_${example}")
- endforeach ()
+ set (last_test "CPP_ex_${example}")
+endforeach ()
#the following dependencies are handled by the order of the files
# SET_TESTS_PROPERTIES(CPP_ex_h5tutr_crtatt PROPERTIES DEPENDS CPP_ex_h5tutr_crtdat)
# SET_TESTS_PROPERTIES(CPP_ex_h5tutr_rdwt PROPERTIES DEPENDS CPP_ex_h5tutr_crtdat)
diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt
index 42061ce..3eafaa8 100644
--- a/c++/src/CMakeLists.txt
+++ b/c++/src/CMakeLists.txt
@@ -86,24 +86,26 @@ set (CPP_HDRS
${HDF5_CPP_SRC_SOURCE_DIR}/H5VarLenType.h
)
-add_library (${HDF5_CPP_LIB_TARGET} STATIC ${CPP_SOURCES} ${CPP_HDRS})
-target_include_directories(${HDF5_CPP_LIB_TARGET}
- PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
- INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
-target_compile_definitions(${HDF5_CPP_LIB_TARGET}
- PRIVATE $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings
-)
-TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} STATIC)
-target_link_libraries (${HDF5_CPP_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET})
-set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIB_TARGET}")
-H5_SET_LIB_OPTIONS (${HDF5_CPP_LIB_TARGET} ${HDF5_CPP_LIB_NAME} STATIC 0)
-set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/cpp)
-set (install_targets ${HDF5_CPP_LIB_TARGET})
+if (NOT ONLY_SHARED_LIBS)
+ add_library (${HDF5_CPP_LIB_TARGET} STATIC ${CPP_SOURCES} ${CPP_HDRS})
+ target_include_directories (${HDF5_CPP_LIB_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ target_compile_definitions(${HDF5_CPP_LIB_TARGET}
+ PRIVATE $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings
+ )
+ TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} STATIC)
+ target_link_libraries (${HDF5_CPP_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET})
+ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIB_TARGET}")
+ H5_SET_LIB_OPTIONS (${HDF5_CPP_LIB_TARGET} ${HDF5_CPP_LIB_NAME} STATIC 0)
+ set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/cpp)
+ set (install_targets ${HDF5_CPP_LIB_TARGET})
+endif ()
if (BUILD_SHARED_LIBS)
add_library (${HDF5_CPP_LIBSH_TARGET} SHARED ${CPP_SOURCES} ${CPP_HDRS})
- target_include_directories(${HDF5_CPP_LIBSH_TARGET}
+ target_include_directories (${HDF5_CPP_LIBSH_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
@@ -112,7 +114,14 @@ if (BUILD_SHARED_LIBS)
PRIVATE $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings
)
TARGET_C_PROPERTIES (${HDF5_CPP_LIBSH_TARGET} SHARED)
- target_link_libraries (${HDF5_CPP_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET})
+ target_link_libraries (${HDF5_CPP_LIBSH_TARGET}
+ PUBLIC ${HDF5_LIBSH_TARGET}
+ )
+ if (MINGW)
+ target_link_options (${HDF5_CPP_LIBSH_TARGET}
+ PRIVATE -static-libgcc -static-libstdc++
+ )
+ endif ()
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIBSH_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_CPP_LIBSH_TARGET} ${HDF5_CPP_LIB_NAME} SHARED "CXX")
set_target_properties (${HDF5_CPP_LIBSH_TARGET} PROPERTIES FOLDER libraries/cpp)
@@ -138,7 +147,9 @@ if (HDF5_EXPORTED_TARGETS)
if (BUILD_SHARED_LIBS)
INSTALL_TARGET_PDB (${HDF5_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries)
endif ()
- INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries)
+ if (NOT ONLY_SHARED_LIBS)
+ INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} cpplibraries)
+ endif ()
install (
TARGETS
@@ -165,7 +176,9 @@ set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}")
set (_PKG_CONFIG_LIBS_PRIVATE)
-set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_CPP_LIB_CORENAME}")
+if (NOT ONLY_SHARED_LIBS)
+ set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_CPP_LIB_CORENAME}")
+endif ()
if (BUILD_SHARED_LIBS)
set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_CPP_LIB_CORENAME}")
endif ()
@@ -184,7 +197,7 @@ install (
COMPONENT cpplibraries
)
-if (NOT WIN32)
+if (NOT WIN32 AND NOT MINGW)
set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER})
configure_file (
${HDF_RESOURCES_DIR}/libh5cc.in
diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt
index 7bd9694..ace9306 100644
--- a/c++/test/CMakeLists.txt
+++ b/c++/test/CMakeLists.txt
@@ -37,16 +37,22 @@ set (srcdir ${CMAKE_CURRENT_SOURCE_DIR})
configure_file (${HDF5_CPP_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY)
add_executable (cpp_testhdf5 ${CPP_TEST_SOURCES} )
-target_include_directories(cpp_testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+target_include_directories (cpp_testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_compile_definitions(cpp_testhdf5
PRIVATE $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings
)
-TARGET_C_PROPERTIES (cpp_testhdf5 STATIC)
-target_link_libraries (cpp_testhdf5 PRIVATE
- ${HDF5_CPP_LIB_TARGET}
- ${HDF5_LIB_TARGET}
- ${HDF5_TEST_LIB_TARGET}
-)
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (cpp_testhdf5 STATIC)
+ target_link_libraries (cpp_testhdf5 PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (cpp_testhdf5 SHARED)
+ target_link_libraries (cpp_testhdf5 PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET})
+ if (MINGW)
+ target_link_options (${HDF5_CPP_LIBSH_TARGET}
+ PRIVATE -static-libgcc -static-libstdc++
+ )
+ endif ()
+endif ()
set_target_properties (cpp_testhdf5 PROPERTIES FOLDER test/cpp)
include (CMakeTests.cmake)
diff --git a/c++/test/CMakeTests.cmake b/c++/test/CMakeTests.cmake
index 11463a0..d3b1f56 100644
--- a/c++/test/CMakeTests.cmake
+++ b/c++/test/CMakeTests.cmake
@@ -31,9 +31,10 @@ add_test (
)
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME CPP_testhdf5 COMMAND $<TARGET_FILE:cpp_testhdf5>)
+ add_test (NAME CPP_testhdf5 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:cpp_testhdf5>)
else ()
add_test (NAME CPP_testhdf5 COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
-D "TEST_PROGRAM=$<TARGET_FILE:cpp_testhdf5>"
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
@@ -46,54 +47,12 @@ else ()
endif ()
set_tests_properties (CPP_testhdf5 PROPERTIES DEPENDS CPP_testhdf5-clear-objects)
-if (HDF5_TEST_VFD)
-
- set (VFD_LIST
- sec2
- stdio
- core
- split
- multi
- family
- )
-
- if (DIRECT_VFD)
- set (VFD_LIST ${VFD_LIST} direct)
- endif ()
-
- macro (ADD_VFD_TEST vfdname resultcode)
- if (NOT HDF5_ENABLE_USING_MEMCHECKER)
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}")
- add_test (
- NAME CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- tattr_basic.h5
- tattr_compound.h5
- tattr_dtype.h5
- tattr_multi.h5
- tattr_scalar.h5
- tfattrs.h5
- )
- add_test (
- NAME CPP_VFD-${vfdname}-cpp_testhdf5
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:cpp_testhdf5>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VFD:STRING=${vfdname}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=cpp_testhdf5"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}"
- -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
- )
- set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES DEPENDS CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects)
- set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES TIMEOUT 30)
- endif ()
- endmacro ()
-
- # Run test with different Virtual File Driver
- foreach (vfd ${VFD_LIST})
- ADD_VFD_TEST (${vfd} 0)
- endforeach ()
+##############################################################################
+##############################################################################
+### V F D T E S T S ###
+##############################################################################
+##############################################################################
+if (HDF5_TEST_VFD)
+ include (CMakeVFDTests.cmake)
endif ()
diff --git a/c++/test/CMakeVFDTests.cmake b/c++/test/CMakeVFDTests.cmake
new file mode 100644
index 0000000..b26165a
--- /dev/null
+++ b/c++/test/CMakeVFDTests.cmake
@@ -0,0 +1,67 @@
+#
+# 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.
+#
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+ set (VFD_LIST
+ sec2
+ stdio
+ core
+ split
+ multi
+ family
+ )
+
+ if (DIRECT_VFD)
+ set (VFD_LIST ${VFD_LIST} direct)
+ endif ()
+
+ macro (ADD_VFD_TEST vfdname resultcode)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}")
+ add_test (
+ NAME CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ tattr_basic.h5
+ tattr_compound.h5
+ tattr_dtype.h5
+ tattr_multi.h5
+ tattr_scalar.h5
+ tfattrs.h5
+ titerate.h5
+ WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${vfdname}
+ )
+ add_test (
+ NAME CPP_VFD-${vfdname}-cpp_testhdf5
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:cpp_testhdf5>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_VFD:STRING=${vfdname}"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_OUTPUT=${vfdname}-cpp_testhdf5.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}"
+ -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
+ )
+ set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES DEPENDS CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects)
+ set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES TIMEOUT ${CTEST_SHORT_TIMEOUT})
+ endif ()
+ endmacro ()
+
+ # Run test with different Virtual File Driver
+ foreach (vfd ${VFD_LIST})
+ ADD_VFD_TEST (${vfd} 0)
+ endforeach ()
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/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake
index f4a46ee..9917f1a 100644
--- a/fortran/test/CMakeTests.cmake
+++ b/fortran/test/CMakeTests.cmake
@@ -32,8 +32,23 @@ if (HDF5_ENABLE_F2003)
endif ()
#-- Adding test for fflush1
-add_test (NAME FORTRAN_fflush1 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:fflush1>)
+add_test (
+ NAME FORTRAN_flush1-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove flush.h5
+)
+add_test (
+ NAME FORTRAN_fflush1
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:fflush1>
+)
+set_tests_properties (FORTRAN_fflush1 PROPERTIES
+ DEPENDS FORTRAN_flush1-clear-objects
+)
#-- Adding test for fflush2
-add_test (NAME FORTRAN_fflush2 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:fflush2>)
-set_tests_properties (FORTRAN_fflush2 PROPERTIES DEPENDS FORTRAN_fflush1)
+add_test (
+ NAME FORTRAN_fflush2
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:fflush2>
+)
+set_tests_properties (FORTRAN_fflush2 PROPERTIES
+ DEPENDS FORTRAN_fflush1
+)
diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt
index cab8e7a..7e03dc4 100644
--- a/hl/src/CMakeLists.txt
+++ b/hl/src/CMakeLists.txt
@@ -26,8 +26,12 @@ set (HL_HEADERS
${HDF5_HL_SRC_SOURCE_DIR}/hdf5_hl.h
)
+set (HL_PRIVATE_HEADERS
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h
+)
+
if (NOT ONLY_SHARED_LIBS)
- add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SOURCES} ${HL_HEADERS})
+ add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS})
target_include_directories (${HDF5_HL_LIB_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
@@ -41,7 +45,7 @@ if (NOT ONLY_SHARED_LIBS)
endif ()
if (BUILD_SHARED_LIBS)
- add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SOURCES} ${HL_HEADERS})
+ add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS})
target_include_directories (${HDF5_HL_LIBSH_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c
index 453db12..6668c22 100644
--- a/hl/tools/gif2h5/decompress.c
+++ b/hl/tools/gif2h5/decompress.c
@@ -261,7 +261,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
* chain puts its associated output code on the output queue.
*/
while (CurCode > DataMask) {
- if (OutCount > 1024) {
+ if (OutCount >= 1024) {
/*return error message*/
}
diff --git a/hl/tools/gif2h5/gif2mem.c b/hl/tools/gif2h5/gif2mem.c
index 11c9536..8fb575c 100644
--- a/hl/tools/gif2h5/gif2mem.c
+++ b/hl/tools/gif2h5/gif2mem.c
@@ -326,7 +326,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
break;
default:
- printf("Unknown Extension Label: 0x%02x\n", Label);
+ printf("Unknown Extension Label: %#02x\n", Label);
break;
}
@@ -334,7 +334,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
default:
fprintf(stderr,
- "Unknown Block Separator Character: 0x%02x\n", Identifier);
+ "Unknown Block Separator Character: %#02x\n", Identifier);
}
}
}
diff --git a/hl/tools/gif2h5/h52gifgentst.c b/hl/tools/gif2h5/h52gifgentst.c
index b1efabf..655563c 100644
--- a/hl/tools/gif2h5/h52gifgentst.c
+++ b/hl/tools/gif2h5/h52gifgentst.c
@@ -11,6 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include "hdf5.h"
@@ -47,12 +48,15 @@ int main(void)
{
hid_t fid;
int i, j, n, space;
- unsigned char buf [ WIDTH*HEIGHT ];
+ unsigned char *buf;
unsigned char pal[ PAL_ENTRIES * 3 ]; /* palette array */
hsize_t pal_dims[2] = {PAL_ENTRIES,3}; /* palette dimensions */
hsize_t width = WIDTH;
hsize_t height = HEIGHT;
+ /* Allocate buffer */
+ if(NULL == (buf = (unsigned char *)malloc(WIDTH * HEIGHT)))
+ return EXIT_FAILURE;
/* create a file */
if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0)
@@ -97,6 +101,8 @@ int main(void)
if(H5Fclose(fid)<0)
return EXIT_FAILURE;
+ free(buf);
+
return EXIT_SUCCESS;
}
diff --git a/hl/tools/gif2h5/h52giftest.sh.in b/hl/tools/gif2h5/h52giftest.sh.in
index 133f574..5643e30 100644
--- a/hl/tools/gif2h5/h52giftest.sh.in
+++ b/hl/tools/gif2h5/h52giftest.sh.in
@@ -75,7 +75,7 @@ TOOLTEST ./h52gif $TESTFILE1 image1.gif -i image
echo ""
# Negative tests.
-echo "**verify the the h52gif tool handle error conditions correctly..."
+echo "**verify that the h52gif tool handles error conditions correctly..."
# nonexisting dataset name
TESTING "./h52gif h52giftst.h5 image.gif -i nosuch_image"
TOOLTESTFAIL "./h52gif $TESTFILE1 image.gif -i nosuch_image"
diff --git a/hl/tools/gif2h5/testfiles/REAMDE b/hl/tools/gif2h5/testfiles/README
index a428d47..a428d47 100644
--- a/hl/tools/gif2h5/testfiles/REAMDE
+++ b/hl/tools/gif2h5/testfiles/README
diff --git a/src/H5Edefin.h b/src/H5Edefin.h
index 6c0e794..1b17898 100644
--- a/src/H5Edefin.h
+++ b/src/H5Edefin.h
@@ -19,37 +19,37 @@
#define _H5Edefin_H
/* Major error IDs */
-hid_t H5E_DATASET_g = FAIL; /* Dataset */
-hid_t H5E_FUNC_g = FAIL; /* Function entry/exit */
-hid_t H5E_STORAGE_g = FAIL; /* Data storage */
-hid_t H5E_FILE_g = FAIL; /* File accessibilty */
-hid_t H5E_SOHM_g = FAIL; /* Shared Object Header Messages */
-hid_t H5E_SYM_g = FAIL; /* Symbol table */
-hid_t H5E_PLUGIN_g = FAIL; /* Plugin for dynamically loaded library */
-hid_t H5E_VFL_g = FAIL; /* Virtual File Layer */
-hid_t H5E_INTERNAL_g = FAIL; /* Internal error (too specific to document in detail) */
-hid_t H5E_BTREE_g = FAIL; /* B-Tree node */
-hid_t H5E_REFERENCE_g = FAIL; /* References */
-hid_t H5E_DATASPACE_g = FAIL; /* Dataspace */
-hid_t H5E_RESOURCE_g = FAIL; /* Resource unavailable */
hid_t H5E_PLIST_g = FAIL; /* Property lists */
+hid_t H5E_INTERNAL_g = FAIL; /* Internal error (too specific to document in detail) */
hid_t H5E_LINK_g = FAIL; /* Links */
-hid_t H5E_DATATYPE_g = FAIL; /* Datatype */
-hid_t H5E_RS_g = FAIL; /* Reference Counted Strings */
+hid_t H5E_STORAGE_g = FAIL; /* Data storage */
+hid_t H5E_BTREE_g = FAIL; /* B-Tree node */
+hid_t H5E_FUNC_g = FAIL; /* Function entry/exit */
+hid_t H5E_DATASET_g = FAIL; /* Dataset */
hid_t H5E_HEAP_g = FAIL; /* Heap */
-hid_t H5E_OHDR_g = FAIL; /* Object header */
-hid_t H5E_ATOM_g = FAIL; /* Object atom */
-hid_t H5E_ATTR_g = FAIL; /* Attribute */
+hid_t H5E_RESOURCE_g = FAIL; /* Resource unavailable */
+hid_t H5E_DATASPACE_g = FAIL; /* Dataspace */
+hid_t H5E_ERROR_g = FAIL; /* Error API */
+hid_t H5E_EFL_g = FAIL; /* External file list */
hid_t H5E_NONE_MAJOR_g = FAIL; /* No error */
+hid_t H5E_PLINE_g = FAIL; /* Data filters */
+hid_t H5E_OHDR_g = FAIL; /* Object header */
+hid_t H5E_PLUGIN_g = FAIL; /* Plugin for dynamically loaded library */
hid_t H5E_IO_g = FAIL; /* Low-level I/O */
-hid_t H5E_SLIST_g = FAIL; /* Skip Lists */
-hid_t H5E_EFL_g = FAIL; /* External file list */
+hid_t H5E_SOHM_g = FAIL; /* Shared Object Header Messages */
hid_t H5E_TST_g = FAIL; /* Ternary Search Trees */
+hid_t H5E_ATOM_g = FAIL; /* Object atom */
+hid_t H5E_ATTR_g = FAIL; /* Attribute */
hid_t H5E_ARGS_g = FAIL; /* Invalid arguments to routine */
-hid_t H5E_ERROR_g = FAIL; /* Error API */
-hid_t H5E_PLINE_g = FAIL; /* Data filters */
+hid_t H5E_FILE_g = FAIL; /* File accessibilty */
hid_t H5E_FSPACE_g = FAIL; /* Free Space Manager */
+hid_t H5E_SLIST_g = FAIL; /* Skip Lists */
+hid_t H5E_SYM_g = FAIL; /* Symbol table */
+hid_t H5E_DATATYPE_g = FAIL; /* Datatype */
hid_t H5E_CACHE_g = FAIL; /* Object cache */
+hid_t H5E_RS_g = FAIL; /* Reference Counted Strings */
+hid_t H5E_VFL_g = FAIL; /* Virtual File Layer */
+hid_t H5E_REFERENCE_g = FAIL; /* References */
/* Minor error IDs */
@@ -61,17 +61,35 @@ hid_t H5E_CLOSEERROR_g = FAIL; /* Close failed */
hid_t H5E_OVERFLOW_g = FAIL; /* Address overflowed */
hid_t H5E_FCNTL_g = FAIL; /* File control (fcntl) failed */
-/* Resource errors */
-hid_t H5E_NOSPACE_g = FAIL; /* No space available for allocation */
-hid_t H5E_CANTALLOC_g = FAIL; /* Can't allocate space */
-hid_t H5E_CANTCOPY_g = FAIL; /* Unable to copy object */
-hid_t H5E_CANTFREE_g = FAIL; /* Unable to free object */
-hid_t H5E_ALREADYEXISTS_g = FAIL; /* Object already exists */
-hid_t H5E_CANTLOCK_g = FAIL; /* Unable to lock object */
-hid_t H5E_CANTUNLOCK_g = FAIL; /* Unable to unlock object */
-hid_t H5E_CANTGC_g = FAIL; /* Unable to garbage collect */
-hid_t H5E_CANTGETSIZE_g = FAIL; /* Unable to compute size */
-hid_t H5E_OBJOPEN_g = FAIL; /* Object is already open */
+/* Link related errors */
+hid_t H5E_TRAVERSE_g = FAIL; /* Link traversal failure */
+hid_t H5E_NLINKS_g = FAIL; /* Too many soft links in path */
+hid_t H5E_NOTREGISTERED_g = FAIL; /* Link class not registered */
+hid_t H5E_CANTMOVE_g = FAIL; /* Can't move object */
+hid_t H5E_CANTSORT_g = FAIL; /* Can't sort objects */
+
+/* Property list errors */
+hid_t H5E_CANTGET_g = FAIL; /* Can't get value */
+hid_t H5E_CANTSET_g = FAIL; /* Can't set value */
+hid_t H5E_DUPCLASS_g = FAIL; /* Duplicate class name in parent class */
+hid_t H5E_SETDISALLOWED_g = FAIL; /* Disallowed operation */
+
+/* Cache related errors */
+hid_t H5E_CANTFLUSH_g = FAIL; /* Unable to flush data from cache */
+hid_t H5E_CANTSERIALIZE_g = FAIL; /* Unable to serialize data from cache */
+hid_t H5E_CANTLOAD_g = FAIL; /* Unable to load metadata into cache */
+hid_t H5E_PROTECT_g = FAIL; /* Protected metadata error */
+hid_t H5E_NOTCACHED_g = FAIL; /* Metadata not currently cached */
+hid_t H5E_SYSTEM_g = FAIL; /* Internal error detected */
+hid_t H5E_CANTINS_g = FAIL; /* Unable to insert metadata into cache */
+hid_t H5E_CANTPROTECT_g = FAIL; /* Unable to protect metadata */
+hid_t H5E_CANTUNPROTECT_g = FAIL; /* Unable to unprotect metadata */
+hid_t H5E_CANTPIN_g = FAIL; /* Unable to pin cache entry */
+hid_t H5E_CANTUNPIN_g = FAIL; /* Unable to un-pin cache entry */
+hid_t H5E_CANTMARKDIRTY_g = FAIL; /* Unable to mark a pinned entry as dirty */
+hid_t H5E_CANTDIRTY_g = FAIL; /* Unable to mark metadata as dirty */
+hid_t H5E_CANTEXPUNGE_g = FAIL; /* Unable to expunge a metadata cache entry */
+hid_t H5E_CANTRESIZE_g = FAIL; /* Unable to resize a metadata cache entry */
/* Heap errors */
hid_t H5E_CANTRESTORE_g = FAIL; /* Can't restore condition */
@@ -86,16 +104,48 @@ hid_t H5E_CANTINIT_g = FAIL; /* Unable to initialize object */
hid_t H5E_ALREADYINIT_g = FAIL; /* Object already initialized */
hid_t H5E_CANTRELEASE_g = FAIL; /* Unable to release object */
-/* Property list errors */
-hid_t H5E_CANTGET_g = FAIL; /* Can't get value */
-hid_t H5E_CANTSET_g = FAIL; /* Can't set value */
-hid_t H5E_DUPCLASS_g = FAIL; /* Duplicate class name in parent class */
-hid_t H5E_SETDISALLOWED_g = FAIL; /* Disallowed operation */
+/* Parallel MPI errors */
+hid_t H5E_MPI_g = FAIL; /* Some MPI function failed */
+hid_t H5E_MPIERRSTR_g = FAIL; /* MPI Error String */
+hid_t H5E_CANTRECV_g = FAIL; /* Can't receive data */
-/* Free space errors */
-hid_t H5E_CANTMERGE_g = FAIL; /* Can't merge objects */
-hid_t H5E_CANTREVIVE_g = FAIL; /* Can't revive object */
-hid_t H5E_CANTSHRINK_g = FAIL; /* Can't shrink container */
+/* Resource errors */
+hid_t H5E_NOSPACE_g = FAIL; /* No space available for allocation */
+hid_t H5E_CANTALLOC_g = FAIL; /* Can't allocate space */
+hid_t H5E_CANTCOPY_g = FAIL; /* Unable to copy object */
+hid_t H5E_CANTFREE_g = FAIL; /* Unable to free object */
+hid_t H5E_ALREADYEXISTS_g = FAIL; /* Object already exists */
+hid_t H5E_CANTLOCK_g = FAIL; /* Unable to lock object */
+hid_t H5E_CANTUNLOCK_g = FAIL; /* Unable to unlock object */
+hid_t H5E_CANTGC_g = FAIL; /* Unable to garbage collect */
+hid_t H5E_CANTGETSIZE_g = FAIL; /* Unable to compute size */
+hid_t H5E_OBJOPEN_g = FAIL; /* Object is already open */
+
+/* System level errors */
+hid_t H5E_SYSERRSTR_g = FAIL; /* System error message */
+
+/* Argument errors */
+hid_t H5E_UNINITIALIZED_g = FAIL; /* Information is uinitialized */
+hid_t H5E_UNSUPPORTED_g = FAIL; /* Feature is unsupported */
+hid_t H5E_BADTYPE_g = FAIL; /* Inappropriate type */
+hid_t H5E_BADRANGE_g = FAIL; /* Out of range */
+hid_t H5E_BADVALUE_g = FAIL; /* Bad value */
+
+/* B-tree related errors */
+hid_t H5E_NOTFOUND_g = FAIL; /* Object not found */
+hid_t H5E_EXISTS_g = FAIL; /* Object already exists */
+hid_t H5E_CANTENCODE_g = FAIL; /* Unable to encode value */
+hid_t H5E_CANTDECODE_g = FAIL; /* Unable to decode value */
+hid_t H5E_CANTSPLIT_g = FAIL; /* Unable to split node */
+hid_t H5E_CANTREDISTRIBUTE_g = FAIL; /* Unable to redistribute records */
+hid_t H5E_CANTSWAP_g = FAIL; /* Unable to swap records */
+hid_t H5E_CANTINSERT_g = FAIL; /* Unable to insert object */
+hid_t H5E_CANTLIST_g = FAIL; /* Unable to list node */
+hid_t H5E_CANTMODIFY_g = FAIL; /* Unable to modify record */
+hid_t H5E_CANTREMOVE_g = FAIL; /* Unable to remove object */
+
+/* No error */
+hid_t H5E_NONE_MINOR_g = FAIL; /* No error */
/* Object header related errors */
hid_t H5E_LINKCOUNT_g = FAIL; /* Bad object header link count */
@@ -108,26 +158,6 @@ hid_t H5E_CANTPACK_g = FAIL; /* Can't pack messages */
hid_t H5E_CANTRESET_g = FAIL; /* Can't reset object */
hid_t H5E_CANTRENAME_g = FAIL; /* Unable to rename object */
-/* System level errors */
-hid_t H5E_SYSERRSTR_g = FAIL; /* System error message */
-
-/* I/O pipeline errors */
-hid_t H5E_NOFILTER_g = FAIL; /* Requested filter is not available */
-hid_t H5E_CALLBACK_g = FAIL; /* Callback failed */
-hid_t H5E_CANAPPLY_g = FAIL; /* Error from filter 'can apply' callback */
-hid_t H5E_SETLOCAL_g = FAIL; /* Error from filter 'set local' callback */
-hid_t H5E_NOENCODER_g = FAIL; /* Filter present but encoding disabled */
-hid_t H5E_CANTFILTER_g = FAIL; /* Filter operation failed */
-
-/* Group related errors */
-hid_t H5E_CANTOPENOBJ_g = FAIL; /* Can't open object */
-hid_t H5E_CANTCLOSEOBJ_g = FAIL; /* Can't close object */
-hid_t H5E_COMPLEN_g = FAIL; /* Name component is too long */
-hid_t H5E_PATH_g = FAIL; /* Problem with path to object */
-
-/* No error */
-hid_t H5E_NONE_MINOR_g = FAIL; /* No error */
-
/* Plugin errors */
hid_t H5E_OPENERROR_g = FAIL; /* Can't open directory or file */
@@ -142,6 +172,23 @@ hid_t H5E_BADFILE_g = FAIL; /* Bad file ID accessed */
hid_t H5E_TRUNCATED_g = FAIL; /* File has been truncated */
hid_t H5E_MOUNT_g = FAIL; /* File mount error */
+/* I/O pipeline errors */
+hid_t H5E_NOFILTER_g = FAIL; /* Requested filter is not available */
+hid_t H5E_CALLBACK_g = FAIL; /* Callback failed */
+hid_t H5E_CANAPPLY_g = FAIL; /* Error from filter 'can apply' callback */
+hid_t H5E_SETLOCAL_g = FAIL; /* Error from filter 'set local' callback */
+hid_t H5E_NOENCODER_g = FAIL; /* Filter present but encoding disabled */
+hid_t H5E_CANTFILTER_g = FAIL; /* Filter operation failed */
+
+/* Datatype conversion errors */
+hid_t H5E_CANTCONVERT_g = FAIL; /* Can't convert datatypes */
+hid_t H5E_BADSIZE_g = FAIL; /* Bad size for object */
+
+/* Free space errors */
+hid_t H5E_CANTMERGE_g = FAIL; /* Can't merge objects */
+hid_t H5E_CANTREVIVE_g = FAIL; /* Can't revive object */
+hid_t H5E_CANTSHRINK_g = FAIL; /* Can't shrink container */
+
/* Object atom related errors */
hid_t H5E_BADATOM_g = FAIL; /* Unable to find atom information (already closed?) */
hid_t H5E_BADGROUP_g = FAIL; /* Unable to find ID group information */
@@ -150,35 +197,6 @@ hid_t H5E_CANTINC_g = FAIL; /* Unable to increment reference count *
hid_t H5E_CANTDEC_g = FAIL; /* Unable to decrement reference count */
hid_t H5E_NOIDS_g = FAIL; /* Out of IDs for group */
-/* Cache related errors */
-hid_t H5E_CANTFLUSH_g = FAIL; /* Unable to flush data from cache */
-hid_t H5E_CANTSERIALIZE_g = FAIL; /* Unable to serialize data from cache */
-hid_t H5E_CANTLOAD_g = FAIL; /* Unable to load metadata into cache */
-hid_t H5E_PROTECT_g = FAIL; /* Protected metadata error */
-hid_t H5E_NOTCACHED_g = FAIL; /* Metadata not currently cached */
-hid_t H5E_SYSTEM_g = FAIL; /* Internal error detected */
-hid_t H5E_CANTINS_g = FAIL; /* Unable to insert metadata into cache */
-hid_t H5E_CANTPROTECT_g = FAIL; /* Unable to protect metadata */
-hid_t H5E_CANTUNPROTECT_g = FAIL; /* Unable to unprotect metadata */
-hid_t H5E_CANTPIN_g = FAIL; /* Unable to pin cache entry */
-hid_t H5E_CANTUNPIN_g = FAIL; /* Unable to un-pin cache entry */
-hid_t H5E_CANTMARKDIRTY_g = FAIL; /* Unable to mark a pinned entry as dirty */
-hid_t H5E_CANTDIRTY_g = FAIL; /* Unable to mark metadata as dirty */
-hid_t H5E_CANTEXPUNGE_g = FAIL; /* Unable to expunge a metadata cache entry */
-hid_t H5E_CANTRESIZE_g = FAIL; /* Unable to resize a metadata cache entry */
-
-/* Link related errors */
-hid_t H5E_TRAVERSE_g = FAIL; /* Link traversal failure */
-hid_t H5E_NLINKS_g = FAIL; /* Too many soft links in path */
-hid_t H5E_NOTREGISTERED_g = FAIL; /* Link class not registered */
-hid_t H5E_CANTMOVE_g = FAIL; /* Can't move object */
-hid_t H5E_CANTSORT_g = FAIL; /* Can't sort objects */
-
-/* Parallel MPI errors */
-hid_t H5E_MPI_g = FAIL; /* Some MPI function failed */
-hid_t H5E_MPIERRSTR_g = FAIL; /* MPI Error String */
-hid_t H5E_CANTRECV_g = FAIL; /* Can't receive data */
-
/* Dataspace errors */
hid_t H5E_CANTCLIP_g = FAIL; /* Can't clip hyperslab region */
hid_t H5E_CANTCOUNT_g = FAIL; /* Can't count elements */
@@ -187,28 +205,10 @@ hid_t H5E_CANTNEXT_g = FAIL; /* Can't move to next iterator location
hid_t H5E_BADSELECT_g = FAIL; /* Invalid selection */
hid_t H5E_CANTCOMPARE_g = FAIL; /* Can't compare objects */
-/* Argument errors */
-hid_t H5E_UNINITIALIZED_g = FAIL; /* Information is uinitialized */
-hid_t H5E_UNSUPPORTED_g = FAIL; /* Feature is unsupported */
-hid_t H5E_BADTYPE_g = FAIL; /* Inappropriate type */
-hid_t H5E_BADRANGE_g = FAIL; /* Out of range */
-hid_t H5E_BADVALUE_g = FAIL; /* Bad value */
-
-/* B-tree related errors */
-hid_t H5E_NOTFOUND_g = FAIL; /* Object not found */
-hid_t H5E_EXISTS_g = FAIL; /* Object already exists */
-hid_t H5E_CANTENCODE_g = FAIL; /* Unable to encode value */
-hid_t H5E_CANTDECODE_g = FAIL; /* Unable to decode value */
-hid_t H5E_CANTSPLIT_g = FAIL; /* Unable to split node */
-hid_t H5E_CANTREDISTRIBUTE_g = FAIL; /* Unable to redistribute records */
-hid_t H5E_CANTSWAP_g = FAIL; /* Unable to swap records */
-hid_t H5E_CANTINSERT_g = FAIL; /* Unable to insert object */
-hid_t H5E_CANTLIST_g = FAIL; /* Unable to list node */
-hid_t H5E_CANTMODIFY_g = FAIL; /* Unable to modify record */
-hid_t H5E_CANTREMOVE_g = FAIL; /* Unable to remove object */
-
-/* Datatype conversion errors */
-hid_t H5E_CANTCONVERT_g = FAIL; /* Can't convert datatypes */
-hid_t H5E_BADSIZE_g = FAIL; /* Bad size for object */
+/* Group related errors */
+hid_t H5E_CANTOPENOBJ_g = FAIL; /* Can't open object */
+hid_t H5E_CANTCLOSEOBJ_g = FAIL; /* Can't close object */
+hid_t H5E_COMPLEN_g = FAIL; /* Name component is too long */
+hid_t H5E_PATH_g = FAIL; /* Problem with path to object */
#endif /* H5Edefin_H */
diff --git a/src/H5Einit.h b/src/H5Einit.h
index 4423ebb..c70a5c3 100644
--- a/src/H5Einit.h
+++ b/src/H5Einit.h
@@ -22,100 +22,100 @@
/* Major error codes */
/*********************/
-assert(H5E_DATASET_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Dataset"))==NULL)
+assert(H5E_PLIST_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Property lists"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_DATASET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_PLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_FUNC_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Function entry/exit"))==NULL)
+assert(H5E_INTERNAL_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Internal error (too specific to document in detail)"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_FUNC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_INTERNAL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_LINK_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Links"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_LINK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
assert(H5E_STORAGE_g==(-1));
if((msg = H5E_create_msg(cls, H5E_MAJOR, "Data storage"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
if((H5E_STORAGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_FILE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "File accessibilty"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_FILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_SOHM_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Shared Object Header Messages"))==NULL)
+assert(H5E_BTREE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "B-Tree node"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_SOHM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_BTREE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_SYM_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Symbol table"))==NULL)
+assert(H5E_FUNC_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Function entry/exit"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_SYM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_FUNC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_PLUGIN_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Plugin for dynamically loaded library"))==NULL)
+assert(H5E_DATASET_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Dataset"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_PLUGIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_DATASET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_VFL_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Virtual File Layer"))==NULL)
+assert(H5E_HEAP_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Heap"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_VFL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_HEAP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_INTERNAL_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Internal error (too specific to document in detail)"))==NULL)
+assert(H5E_RESOURCE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Resource unavailable"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_INTERNAL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_RESOURCE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_BTREE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "B-Tree node"))==NULL)
+assert(H5E_DATASPACE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Dataspace"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_BTREE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_DATASPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_REFERENCE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "References"))==NULL)
+assert(H5E_ERROR_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Error API"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_REFERENCE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_ERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_DATASPACE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Dataspace"))==NULL)
+assert(H5E_EFL_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "External file list"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_DATASPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_EFL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_RESOURCE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Resource unavailable"))==NULL)
+assert(H5E_NONE_MAJOR_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "No error"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_RESOURCE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_NONE_MAJOR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_PLIST_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Property lists"))==NULL)
+assert(H5E_PLINE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Data filters"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_PLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_PLINE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_LINK_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Links"))==NULL)
+assert(H5E_OHDR_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Object header"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_LINK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_OHDR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_DATATYPE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Datatype"))==NULL)
+assert(H5E_PLUGIN_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Plugin for dynamically loaded library"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_DATATYPE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_PLUGIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_RS_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Reference Counted Strings"))==NULL)
+assert(H5E_IO_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Low-level I/O"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_RS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_IO_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_HEAP_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Heap"))==NULL)
+assert(H5E_SOHM_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Shared Object Header Messages"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_HEAP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_SOHM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_OHDR_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Object header"))==NULL)
+assert(H5E_TST_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Ternary Search Trees"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_OHDR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_TST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
assert(H5E_ATOM_g==(-1));
if((msg = H5E_create_msg(cls, H5E_MAJOR, "Object atom"))==NULL)
@@ -127,55 +127,55 @@ if((msg = H5E_create_msg(cls, H5E_MAJOR, "Attribute"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
if((H5E_ATTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_NONE_MAJOR_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "No error"))==NULL)
+assert(H5E_ARGS_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Invalid arguments to routine"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_NONE_MAJOR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_ARGS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_IO_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Low-level I/O"))==NULL)
+assert(H5E_FILE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "File accessibilty"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_IO_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_FILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_FSPACE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Free Space Manager"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_FSPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
assert(H5E_SLIST_g==(-1));
if((msg = H5E_create_msg(cls, H5E_MAJOR, "Skip Lists"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
if((H5E_SLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_EFL_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "External file list"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_EFL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_TST_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Ternary Search Trees"))==NULL)
+assert(H5E_SYM_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Symbol table"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_TST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_SYM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_ARGS_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Invalid arguments to routine"))==NULL)
+assert(H5E_DATATYPE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Datatype"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_ARGS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_DATATYPE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_ERROR_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Error API"))==NULL)
+assert(H5E_CACHE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Object cache"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_ERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CACHE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_PLINE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Data filters"))==NULL)
+assert(H5E_RS_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Reference Counted Strings"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_PLINE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_RS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_FSPACE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Free Space Manager"))==NULL)
+assert(H5E_VFL_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "Virtual File Layer"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_FSPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_VFL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CACHE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MAJOR, "Object cache"))==NULL)
+assert(H5E_REFERENCE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MAJOR, "References"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CACHE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_REFERENCE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
/*********************/
@@ -215,56 +215,130 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "File control (fcntl) failed"))==NULL)
if((H5E_FCNTL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-/* Resource errors */
-assert(H5E_NOSPACE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "No space available for allocation"))==NULL)
+/* Link related errors */
+assert(H5E_TRAVERSE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Link traversal failure"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_NOSPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_TRAVERSE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTALLOC_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't allocate space"))==NULL)
+assert(H5E_NLINKS_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Too many soft links in path"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTALLOC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_NLINKS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTCOPY_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to copy object"))==NULL)
+assert(H5E_NOTREGISTERED_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Link class not registered"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTCOPY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_NOTREGISTERED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTFREE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to free object"))==NULL)
+assert(H5E_CANTMOVE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't move object"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTFREE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTMOVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_ALREADYEXISTS_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Object already exists"))==NULL)
+assert(H5E_CANTSORT_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't sort objects"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_ALREADYEXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTSORT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTLOCK_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to lock object"))==NULL)
+
+/* Property list errors */
+assert(H5E_CANTGET_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't get value"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTLOCK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTGET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTUNLOCK_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to unlock object"))==NULL)
+assert(H5E_CANTSET_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't set value"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTUNLOCK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTSET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTGC_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to garbage collect"))==NULL)
+assert(H5E_DUPCLASS_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Duplicate class name in parent class"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTGC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_DUPCLASS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTGETSIZE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to compute size"))==NULL)
+assert(H5E_SETDISALLOWED_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Disallowed operation"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTGETSIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_SETDISALLOWED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_OBJOPEN_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Object is already open"))==NULL)
+
+/* Cache related errors */
+assert(H5E_CANTFLUSH_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to flush data from cache"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_OBJOPEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTFLUSH_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTSERIALIZE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to serialize data from cache"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTSERIALIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTLOAD_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to load metadata into cache"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTLOAD_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_PROTECT_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Protected metadata error"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_PROTECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_NOTCACHED_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Metadata not currently cached"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_NOTCACHED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_SYSTEM_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Internal error detected"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_SYSTEM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTINS_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to insert metadata into cache"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTINS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTPROTECT_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to protect metadata"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTPROTECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTUNPROTECT_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to unprotect metadata"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTUNPROTECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTPIN_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to pin cache entry"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTPIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTUNPIN_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to un-pin cache entry"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTUNPIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTMARKDIRTY_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to mark a pinned entry as dirty"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTMARKDIRTY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTDIRTY_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to mark metadata as dirty"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTDIRTY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTEXPUNGE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to expunge a metadata cache entry"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTEXPUNGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTRESIZE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to resize a metadata cache entry"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTRESIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
/* Heap errors */
@@ -316,90 +390,73 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to release object"))==NULL)
if((H5E_CANTRELEASE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-/* Property list errors */
-assert(H5E_CANTGET_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't get value"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTGET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTSET_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't set value"))==NULL)
+/* Parallel MPI errors */
+assert(H5E_MPI_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Some MPI function failed"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTSET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_MPI_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_DUPCLASS_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Duplicate class name in parent class"))==NULL)
+assert(H5E_MPIERRSTR_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "MPI Error String"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_DUPCLASS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_MPIERRSTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_SETDISALLOWED_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Disallowed operation"))==NULL)
+assert(H5E_CANTRECV_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't receive data"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_SETDISALLOWED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTRECV_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-/* Free space errors */
-assert(H5E_CANTMERGE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't merge objects"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTMERGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTREVIVE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't revive object"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTREVIVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTSHRINK_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't shrink container"))==NULL)
+/* Resource errors */
+assert(H5E_NOSPACE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "No space available for allocation"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTSHRINK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_NOSPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-
-/* Object header related errors */
-assert(H5E_LINKCOUNT_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad object header link count"))==NULL)
+assert(H5E_CANTALLOC_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't allocate space"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_LINKCOUNT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTALLOC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_VERSION_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Wrong version number"))==NULL)
+assert(H5E_CANTCOPY_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to copy object"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_VERSION_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTCOPY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_ALIGNMENT_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Alignment error"))==NULL)
+assert(H5E_CANTFREE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to free object"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_ALIGNMENT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTFREE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_BADMESG_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unrecognized message"))==NULL)
+assert(H5E_ALREADYEXISTS_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Object already exists"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_BADMESG_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_ALREADYEXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTDELETE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't delete message"))==NULL)
+assert(H5E_CANTLOCK_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to lock object"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTDELETE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTLOCK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_BADITER_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Iteration failed"))==NULL)
+assert(H5E_CANTUNLOCK_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to unlock object"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_BADITER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTUNLOCK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTPACK_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't pack messages"))==NULL)
+assert(H5E_CANTGC_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to garbage collect"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTPACK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTGC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTRESET_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't reset object"))==NULL)
+assert(H5E_CANTGETSIZE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to compute size"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTRESET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTGETSIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTRENAME_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to rename object"))==NULL)
+assert(H5E_OBJOPEN_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Object is already open"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTRENAME_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_OBJOPEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
/* System level errors */
@@ -409,58 +466,88 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "System error message"))==NULL)
if((H5E_SYSERRSTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-/* I/O pipeline errors */
-assert(H5E_NOFILTER_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Requested filter is not available"))==NULL)
+/* Argument errors */
+assert(H5E_UNINITIALIZED_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Information is uinitialized"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_NOFILTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_UNINITIALIZED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CALLBACK_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Callback failed"))==NULL)
+assert(H5E_UNSUPPORTED_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Feature is unsupported"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CALLBACK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_UNSUPPORTED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANAPPLY_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Error from filter 'can apply' callback"))==NULL)
+assert(H5E_BADTYPE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Inappropriate type"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANAPPLY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_BADTYPE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_SETLOCAL_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Error from filter 'set local' callback"))==NULL)
+assert(H5E_BADRANGE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Out of range"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_SETLOCAL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_BADRANGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_NOENCODER_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Filter present but encoding disabled"))==NULL)
+assert(H5E_BADVALUE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad value"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_NOENCODER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_BADVALUE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTFILTER_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Filter operation failed"))==NULL)
+
+/* B-tree related errors */
+assert(H5E_NOTFOUND_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Object not found"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTFILTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_NOTFOUND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-
-/* Group related errors */
-assert(H5E_CANTOPENOBJ_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't open object"))==NULL)
+assert(H5E_EXISTS_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Object already exists"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTOPENOBJ_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_EXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTCLOSEOBJ_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't close object"))==NULL)
+assert(H5E_CANTENCODE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to encode value"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTCLOSEOBJ_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTENCODE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_COMPLEN_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Name component is too long"))==NULL)
+assert(H5E_CANTDECODE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to decode value"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_COMPLEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTDECODE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_PATH_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Problem with path to object"))==NULL)
+assert(H5E_CANTSPLIT_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to split node"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_PATH_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTSPLIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTREDISTRIBUTE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to redistribute records"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTREDISTRIBUTE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTSWAP_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to swap records"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTSWAP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTINSERT_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to insert object"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTINSERT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTLIST_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to list node"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTMODIFY_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to modify record"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTMODIFY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTREMOVE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to remove object"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTREMOVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
/* No error */
@@ -470,6 +557,53 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "No error"))==NULL)
if((H5E_NONE_MINOR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+/* Object header related errors */
+assert(H5E_LINKCOUNT_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad object header link count"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_LINKCOUNT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_VERSION_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Wrong version number"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_VERSION_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_ALIGNMENT_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Alignment error"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_ALIGNMENT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_BADMESG_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unrecognized message"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_BADMESG_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTDELETE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't delete message"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTDELETE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_BADITER_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Iteration failed"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_BADITER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTPACK_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't pack messages"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTPACK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTRESET_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't reset object"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTRESET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_CANTRENAME_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to rename object"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTRENAME_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+
/* Plugin errors */
assert(H5E_OPENERROR_g==(-1));
if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't open directory or file"))==NULL)
@@ -524,157 +658,97 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "File mount error"))==NULL)
if((H5E_MOUNT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-/* Object atom related errors */
-assert(H5E_BADATOM_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to find atom information (already closed?)"))==NULL)
+/* I/O pipeline errors */
+assert(H5E_NOFILTER_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Requested filter is not available"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_BADATOM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_NOFILTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_BADGROUP_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to find ID group information"))==NULL)
+assert(H5E_CALLBACK_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Callback failed"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_BADGROUP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CALLBACK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTREGISTER_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to register new atom"))==NULL)
+assert(H5E_CANAPPLY_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Error from filter 'can apply' callback"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTREGISTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANAPPLY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTINC_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to increment reference count"))==NULL)
+assert(H5E_SETLOCAL_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Error from filter 'set local' callback"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTINC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_SETLOCAL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTDEC_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to decrement reference count"))==NULL)
+assert(H5E_NOENCODER_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Filter present but encoding disabled"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTDEC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_NOENCODER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_NOIDS_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Out of IDs for group"))==NULL)
+assert(H5E_CANTFILTER_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Filter operation failed"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_NOIDS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTFILTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-/* Cache related errors */
-assert(H5E_CANTFLUSH_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to flush data from cache"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTFLUSH_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTSERIALIZE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to serialize data from cache"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTSERIALIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTLOAD_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to load metadata into cache"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTLOAD_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_PROTECT_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Protected metadata error"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_PROTECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_NOTCACHED_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Metadata not currently cached"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_NOTCACHED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_SYSTEM_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Internal error detected"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_SYSTEM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTINS_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to insert metadata into cache"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTINS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTPROTECT_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to protect metadata"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTPROTECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTUNPROTECT_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to unprotect metadata"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTUNPROTECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTPIN_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to pin cache entry"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTPIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTUNPIN_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to un-pin cache entry"))==NULL)
+/* Datatype conversion errors */
+assert(H5E_CANTCONVERT_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't convert datatypes"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTUNPIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTCONVERT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTMARKDIRTY_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to mark a pinned entry as dirty"))==NULL)
+assert(H5E_BADSIZE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad size for object"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTMARKDIRTY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_BADSIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTDIRTY_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to mark metadata as dirty"))==NULL)
+
+/* Free space errors */
+assert(H5E_CANTMERGE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't merge objects"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTDIRTY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTMERGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTEXPUNGE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to expunge a metadata cache entry"))==NULL)
+assert(H5E_CANTREVIVE_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't revive object"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTEXPUNGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTREVIVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTRESIZE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to resize a metadata cache entry"))==NULL)
+assert(H5E_CANTSHRINK_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't shrink container"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTRESIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTSHRINK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-/* Link related errors */
-assert(H5E_TRAVERSE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Link traversal failure"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_TRAVERSE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_NLINKS_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Too many soft links in path"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_NLINKS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_NOTREGISTERED_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Link class not registered"))==NULL)
+/* Object atom related errors */
+assert(H5E_BADATOM_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to find atom information (already closed?)"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_NOTREGISTERED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_BADATOM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTMOVE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't move object"))==NULL)
+assert(H5E_BADGROUP_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to find ID group information"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTMOVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_BADGROUP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTSORT_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't sort objects"))==NULL)
+assert(H5E_CANTREGISTER_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to register new atom"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTSORT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTREGISTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-
-/* Parallel MPI errors */
-assert(H5E_MPI_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Some MPI function failed"))==NULL)
+assert(H5E_CANTINC_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to increment reference count"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_MPI_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTINC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_MPIERRSTR_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "MPI Error String"))==NULL)
+assert(H5E_CANTDEC_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to decrement reference count"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_MPIERRSTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTDEC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTRECV_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't receive data"))==NULL)
+assert(H5E_NOIDS_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Out of IDs for group"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTRECV_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_NOIDS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
/* Dataspace errors */
@@ -709,100 +783,26 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't compare objects"))==NULL)
if((H5E_CANTCOMPARE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-/* Argument errors */
-assert(H5E_UNINITIALIZED_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Information is uinitialized"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_UNINITIALIZED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_UNSUPPORTED_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Feature is unsupported"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_UNSUPPORTED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_BADTYPE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Inappropriate type"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_BADTYPE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_BADRANGE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Out of range"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_BADRANGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_BADVALUE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad value"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_BADVALUE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-
-/* B-tree related errors */
-assert(H5E_NOTFOUND_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Object not found"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_NOTFOUND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_EXISTS_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Object already exists"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_EXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTENCODE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to encode value"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTENCODE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTDECODE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to decode value"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTDECODE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTSPLIT_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to split node"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTSPLIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTREDISTRIBUTE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to redistribute records"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTREDISTRIBUTE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTSWAP_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to swap records"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTSWAP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTINSERT_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to insert object"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTINSERT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTLIST_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to list node"))==NULL)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTMODIFY_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to modify record"))==NULL)
+/* Group related errors */
+assert(H5E_CANTOPENOBJ_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't open object"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTMODIFY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTOPENOBJ_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_CANTREMOVE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to remove object"))==NULL)
+assert(H5E_CANTCLOSEOBJ_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't close object"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTREMOVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_CANTCLOSEOBJ_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-
-/* Datatype conversion errors */
-assert(H5E_CANTCONVERT_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't convert datatypes"))==NULL)
+assert(H5E_COMPLEN_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Name component is too long"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_CANTCONVERT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_COMPLEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_BADSIZE_g==(-1));
-if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad size for object"))==NULL)
+assert(H5E_PATH_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Problem with path to object"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
-if((H5E_BADSIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+if((H5E_PATH_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
#endif /* H5Einit_H */
diff --git a/src/H5Epubgen.h b/src/H5Epubgen.h
index 0a72245..9c2f1fd 100644
--- a/src/H5Epubgen.h
+++ b/src/H5Epubgen.h
@@ -26,68 +26,68 @@ extern "C" {
/* Major error codes */
/*********************/
-#define H5E_DATASET (H5OPEN H5E_DATASET_g)
-#define H5E_FUNC (H5OPEN H5E_FUNC_g)
-#define H5E_STORAGE (H5OPEN H5E_STORAGE_g)
-#define H5E_FILE (H5OPEN H5E_FILE_g)
-#define H5E_SOHM (H5OPEN H5E_SOHM_g)
-#define H5E_SYM (H5OPEN H5E_SYM_g)
-#define H5E_PLUGIN (H5OPEN H5E_PLUGIN_g)
-#define H5E_VFL (H5OPEN H5E_VFL_g)
-#define H5E_INTERNAL (H5OPEN H5E_INTERNAL_g)
-#define H5E_BTREE (H5OPEN H5E_BTREE_g)
-#define H5E_REFERENCE (H5OPEN H5E_REFERENCE_g)
-#define H5E_DATASPACE (H5OPEN H5E_DATASPACE_g)
-#define H5E_RESOURCE (H5OPEN H5E_RESOURCE_g)
#define H5E_PLIST (H5OPEN H5E_PLIST_g)
+#define H5E_INTERNAL (H5OPEN H5E_INTERNAL_g)
#define H5E_LINK (H5OPEN H5E_LINK_g)
-#define H5E_DATATYPE (H5OPEN H5E_DATATYPE_g)
-#define H5E_RS (H5OPEN H5E_RS_g)
+#define H5E_STORAGE (H5OPEN H5E_STORAGE_g)
+#define H5E_BTREE (H5OPEN H5E_BTREE_g)
+#define H5E_FUNC (H5OPEN H5E_FUNC_g)
+#define H5E_DATASET (H5OPEN H5E_DATASET_g)
#define H5E_HEAP (H5OPEN H5E_HEAP_g)
-#define H5E_OHDR (H5OPEN H5E_OHDR_g)
-#define H5E_ATOM (H5OPEN H5E_ATOM_g)
-#define H5E_ATTR (H5OPEN H5E_ATTR_g)
+#define H5E_RESOURCE (H5OPEN H5E_RESOURCE_g)
+#define H5E_DATASPACE (H5OPEN H5E_DATASPACE_g)
+#define H5E_ERROR (H5OPEN H5E_ERROR_g)
+#define H5E_EFL (H5OPEN H5E_EFL_g)
#define H5E_NONE_MAJOR (H5OPEN H5E_NONE_MAJOR_g)
+#define H5E_PLINE (H5OPEN H5E_PLINE_g)
+#define H5E_OHDR (H5OPEN H5E_OHDR_g)
+#define H5E_PLUGIN (H5OPEN H5E_PLUGIN_g)
#define H5E_IO (H5OPEN H5E_IO_g)
-#define H5E_SLIST (H5OPEN H5E_SLIST_g)
-#define H5E_EFL (H5OPEN H5E_EFL_g)
+#define H5E_SOHM (H5OPEN H5E_SOHM_g)
#define H5E_TST (H5OPEN H5E_TST_g)
+#define H5E_ATOM (H5OPEN H5E_ATOM_g)
+#define H5E_ATTR (H5OPEN H5E_ATTR_g)
#define H5E_ARGS (H5OPEN H5E_ARGS_g)
-#define H5E_ERROR (H5OPEN H5E_ERROR_g)
-#define H5E_PLINE (H5OPEN H5E_PLINE_g)
+#define H5E_FILE (H5OPEN H5E_FILE_g)
#define H5E_FSPACE (H5OPEN H5E_FSPACE_g)
+#define H5E_SLIST (H5OPEN H5E_SLIST_g)
+#define H5E_SYM (H5OPEN H5E_SYM_g)
+#define H5E_DATATYPE (H5OPEN H5E_DATATYPE_g)
#define H5E_CACHE (H5OPEN H5E_CACHE_g)
-H5_DLLVAR hid_t H5E_DATASET_g; /* Dataset */
-H5_DLLVAR hid_t H5E_FUNC_g; /* Function entry/exit */
-H5_DLLVAR hid_t H5E_STORAGE_g; /* Data storage */
-H5_DLLVAR hid_t H5E_FILE_g; /* File accessibilty */
-H5_DLLVAR hid_t H5E_SOHM_g; /* Shared Object Header Messages */
-H5_DLLVAR hid_t H5E_SYM_g; /* Symbol table */
-H5_DLLVAR hid_t H5E_PLUGIN_g; /* Plugin for dynamically loaded library */
-H5_DLLVAR hid_t H5E_VFL_g; /* Virtual File Layer */
-H5_DLLVAR hid_t H5E_INTERNAL_g; /* Internal error (too specific to document in detail) */
-H5_DLLVAR hid_t H5E_BTREE_g; /* B-Tree node */
-H5_DLLVAR hid_t H5E_REFERENCE_g; /* References */
-H5_DLLVAR hid_t H5E_DATASPACE_g; /* Dataspace */
-H5_DLLVAR hid_t H5E_RESOURCE_g; /* Resource unavailable */
+#define H5E_RS (H5OPEN H5E_RS_g)
+#define H5E_VFL (H5OPEN H5E_VFL_g)
+#define H5E_REFERENCE (H5OPEN H5E_REFERENCE_g)
H5_DLLVAR hid_t H5E_PLIST_g; /* Property lists */
+H5_DLLVAR hid_t H5E_INTERNAL_g; /* Internal error (too specific to document in detail) */
H5_DLLVAR hid_t H5E_LINK_g; /* Links */
-H5_DLLVAR hid_t H5E_DATATYPE_g; /* Datatype */
-H5_DLLVAR hid_t H5E_RS_g; /* Reference Counted Strings */
+H5_DLLVAR hid_t H5E_STORAGE_g; /* Data storage */
+H5_DLLVAR hid_t H5E_BTREE_g; /* B-Tree node */
+H5_DLLVAR hid_t H5E_FUNC_g; /* Function entry/exit */
+H5_DLLVAR hid_t H5E_DATASET_g; /* Dataset */
H5_DLLVAR hid_t H5E_HEAP_g; /* Heap */
-H5_DLLVAR hid_t H5E_OHDR_g; /* Object header */
-H5_DLLVAR hid_t H5E_ATOM_g; /* Object atom */
-H5_DLLVAR hid_t H5E_ATTR_g; /* Attribute */
+H5_DLLVAR hid_t H5E_RESOURCE_g; /* Resource unavailable */
+H5_DLLVAR hid_t H5E_DATASPACE_g; /* Dataspace */
+H5_DLLVAR hid_t H5E_ERROR_g; /* Error API */
+H5_DLLVAR hid_t H5E_EFL_g; /* External file list */
H5_DLLVAR hid_t H5E_NONE_MAJOR_g; /* No error */
+H5_DLLVAR hid_t H5E_PLINE_g; /* Data filters */
+H5_DLLVAR hid_t H5E_OHDR_g; /* Object header */
+H5_DLLVAR hid_t H5E_PLUGIN_g; /* Plugin for dynamically loaded library */
H5_DLLVAR hid_t H5E_IO_g; /* Low-level I/O */
-H5_DLLVAR hid_t H5E_SLIST_g; /* Skip Lists */
-H5_DLLVAR hid_t H5E_EFL_g; /* External file list */
+H5_DLLVAR hid_t H5E_SOHM_g; /* Shared Object Header Messages */
H5_DLLVAR hid_t H5E_TST_g; /* Ternary Search Trees */
+H5_DLLVAR hid_t H5E_ATOM_g; /* Object atom */
+H5_DLLVAR hid_t H5E_ATTR_g; /* Attribute */
H5_DLLVAR hid_t H5E_ARGS_g; /* Invalid arguments to routine */
-H5_DLLVAR hid_t H5E_ERROR_g; /* Error API */
-H5_DLLVAR hid_t H5E_PLINE_g; /* Data filters */
+H5_DLLVAR hid_t H5E_FILE_g; /* File accessibilty */
H5_DLLVAR hid_t H5E_FSPACE_g; /* Free Space Manager */
+H5_DLLVAR hid_t H5E_SLIST_g; /* Skip Lists */
+H5_DLLVAR hid_t H5E_SYM_g; /* Symbol table */
+H5_DLLVAR hid_t H5E_DATATYPE_g; /* Datatype */
H5_DLLVAR hid_t H5E_CACHE_g; /* Object cache */
+H5_DLLVAR hid_t H5E_RS_g; /* Reference Counted Strings */
+H5_DLLVAR hid_t H5E_VFL_g; /* Virtual File Layer */
+H5_DLLVAR hid_t H5E_REFERENCE_g; /* References */
/*********************/
/* Minor error codes */
@@ -107,6 +107,90 @@ H5_DLLVAR hid_t H5E_CLOSEERROR_g; /* Close failed */
H5_DLLVAR hid_t H5E_OVERFLOW_g; /* Address overflowed */
H5_DLLVAR hid_t H5E_FCNTL_g; /* File control (fcntl) failed */
+/* Link related errors */
+#define H5E_TRAVERSE (H5OPEN H5E_TRAVERSE_g)
+#define H5E_NLINKS (H5OPEN H5E_NLINKS_g)
+#define H5E_NOTREGISTERED (H5OPEN H5E_NOTREGISTERED_g)
+#define H5E_CANTMOVE (H5OPEN H5E_CANTMOVE_g)
+#define H5E_CANTSORT (H5OPEN H5E_CANTSORT_g)
+H5_DLLVAR hid_t H5E_TRAVERSE_g; /* Link traversal failure */
+H5_DLLVAR hid_t H5E_NLINKS_g; /* Too many soft links in path */
+H5_DLLVAR hid_t H5E_NOTREGISTERED_g; /* Link class not registered */
+H5_DLLVAR hid_t H5E_CANTMOVE_g; /* Can't move object */
+H5_DLLVAR hid_t H5E_CANTSORT_g; /* Can't sort objects */
+
+/* Property list errors */
+#define H5E_CANTGET (H5OPEN H5E_CANTGET_g)
+#define H5E_CANTSET (H5OPEN H5E_CANTSET_g)
+#define H5E_DUPCLASS (H5OPEN H5E_DUPCLASS_g)
+#define H5E_SETDISALLOWED (H5OPEN H5E_SETDISALLOWED_g)
+H5_DLLVAR hid_t H5E_CANTGET_g; /* Can't get value */
+H5_DLLVAR hid_t H5E_CANTSET_g; /* Can't set value */
+H5_DLLVAR hid_t H5E_DUPCLASS_g; /* Duplicate class name in parent class */
+H5_DLLVAR hid_t H5E_SETDISALLOWED_g; /* Disallowed operation */
+
+/* Cache related errors */
+#define H5E_CANTFLUSH (H5OPEN H5E_CANTFLUSH_g)
+#define H5E_CANTSERIALIZE (H5OPEN H5E_CANTSERIALIZE_g)
+#define H5E_CANTLOAD (H5OPEN H5E_CANTLOAD_g)
+#define H5E_PROTECT (H5OPEN H5E_PROTECT_g)
+#define H5E_NOTCACHED (H5OPEN H5E_NOTCACHED_g)
+#define H5E_SYSTEM (H5OPEN H5E_SYSTEM_g)
+#define H5E_CANTINS (H5OPEN H5E_CANTINS_g)
+#define H5E_CANTPROTECT (H5OPEN H5E_CANTPROTECT_g)
+#define H5E_CANTUNPROTECT (H5OPEN H5E_CANTUNPROTECT_g)
+#define H5E_CANTPIN (H5OPEN H5E_CANTPIN_g)
+#define H5E_CANTUNPIN (H5OPEN H5E_CANTUNPIN_g)
+#define H5E_CANTMARKDIRTY (H5OPEN H5E_CANTMARKDIRTY_g)
+#define H5E_CANTDIRTY (H5OPEN H5E_CANTDIRTY_g)
+#define H5E_CANTEXPUNGE (H5OPEN H5E_CANTEXPUNGE_g)
+#define H5E_CANTRESIZE (H5OPEN H5E_CANTRESIZE_g)
+H5_DLLVAR hid_t H5E_CANTFLUSH_g; /* Unable to flush data from cache */
+H5_DLLVAR hid_t H5E_CANTSERIALIZE_g; /* Unable to serialize data from cache */
+H5_DLLVAR hid_t H5E_CANTLOAD_g; /* Unable to load metadata into cache */
+H5_DLLVAR hid_t H5E_PROTECT_g; /* Protected metadata error */
+H5_DLLVAR hid_t H5E_NOTCACHED_g; /* Metadata not currently cached */
+H5_DLLVAR hid_t H5E_SYSTEM_g; /* Internal error detected */
+H5_DLLVAR hid_t H5E_CANTINS_g; /* Unable to insert metadata into cache */
+H5_DLLVAR hid_t H5E_CANTPROTECT_g; /* Unable to protect metadata */
+H5_DLLVAR hid_t H5E_CANTUNPROTECT_g; /* Unable to unprotect metadata */
+H5_DLLVAR hid_t H5E_CANTPIN_g; /* Unable to pin cache entry */
+H5_DLLVAR hid_t H5E_CANTUNPIN_g; /* Unable to un-pin cache entry */
+H5_DLLVAR hid_t H5E_CANTMARKDIRTY_g; /* Unable to mark a pinned entry as dirty */
+H5_DLLVAR hid_t H5E_CANTDIRTY_g; /* Unable to mark metadata as dirty */
+H5_DLLVAR hid_t H5E_CANTEXPUNGE_g; /* Unable to expunge a metadata cache entry */
+H5_DLLVAR hid_t H5E_CANTRESIZE_g; /* Unable to resize a metadata cache entry */
+
+/* Heap errors */
+#define H5E_CANTRESTORE (H5OPEN H5E_CANTRESTORE_g)
+#define H5E_CANTCOMPUTE (H5OPEN H5E_CANTCOMPUTE_g)
+#define H5E_CANTEXTEND (H5OPEN H5E_CANTEXTEND_g)
+#define H5E_CANTATTACH (H5OPEN H5E_CANTATTACH_g)
+#define H5E_CANTUPDATE (H5OPEN H5E_CANTUPDATE_g)
+#define H5E_CANTOPERATE (H5OPEN H5E_CANTOPERATE_g)
+H5_DLLVAR hid_t H5E_CANTRESTORE_g; /* Can't restore condition */
+H5_DLLVAR hid_t H5E_CANTCOMPUTE_g; /* Can't compute value */
+H5_DLLVAR hid_t H5E_CANTEXTEND_g; /* Can't extend heap's space */
+H5_DLLVAR hid_t H5E_CANTATTACH_g; /* Can't attach object */
+H5_DLLVAR hid_t H5E_CANTUPDATE_g; /* Can't update object */
+H5_DLLVAR hid_t H5E_CANTOPERATE_g; /* Can't operate on object */
+
+/* Function entry/exit interface errors */
+#define H5E_CANTINIT (H5OPEN H5E_CANTINIT_g)
+#define H5E_ALREADYINIT (H5OPEN H5E_ALREADYINIT_g)
+#define H5E_CANTRELEASE (H5OPEN H5E_CANTRELEASE_g)
+H5_DLLVAR hid_t H5E_CANTINIT_g; /* Unable to initialize object */
+H5_DLLVAR hid_t H5E_ALREADYINIT_g; /* Object already initialized */
+H5_DLLVAR hid_t H5E_CANTRELEASE_g; /* Unable to release object */
+
+/* Parallel MPI errors */
+#define H5E_MPI (H5OPEN H5E_MPI_g)
+#define H5E_MPIERRSTR (H5OPEN H5E_MPIERRSTR_g)
+#define H5E_CANTRECV (H5OPEN H5E_CANTRECV_g)
+H5_DLLVAR hid_t H5E_MPI_g; /* Some MPI function failed */
+H5_DLLVAR hid_t H5E_MPIERRSTR_g; /* MPI Error String */
+H5_DLLVAR hid_t H5E_CANTRECV_g; /* Can't receive data */
+
/* Resource errors */
#define H5E_NOSPACE (H5OPEN H5E_NOSPACE_g)
#define H5E_CANTALLOC (H5OPEN H5E_CANTALLOC_g)
@@ -129,45 +213,49 @@ H5_DLLVAR hid_t H5E_CANTGC_g; /* Unable to garbage collect */
H5_DLLVAR hid_t H5E_CANTGETSIZE_g; /* Unable to compute size */
H5_DLLVAR hid_t H5E_OBJOPEN_g; /* Object is already open */
-/* Heap errors */
-#define H5E_CANTRESTORE (H5OPEN H5E_CANTRESTORE_g)
-#define H5E_CANTCOMPUTE (H5OPEN H5E_CANTCOMPUTE_g)
-#define H5E_CANTEXTEND (H5OPEN H5E_CANTEXTEND_g)
-#define H5E_CANTATTACH (H5OPEN H5E_CANTATTACH_g)
-#define H5E_CANTUPDATE (H5OPEN H5E_CANTUPDATE_g)
-#define H5E_CANTOPERATE (H5OPEN H5E_CANTOPERATE_g)
-H5_DLLVAR hid_t H5E_CANTRESTORE_g; /* Can't restore condition */
-H5_DLLVAR hid_t H5E_CANTCOMPUTE_g; /* Can't compute value */
-H5_DLLVAR hid_t H5E_CANTEXTEND_g; /* Can't extend heap's space */
-H5_DLLVAR hid_t H5E_CANTATTACH_g; /* Can't attach object */
-H5_DLLVAR hid_t H5E_CANTUPDATE_g; /* Can't update object */
-H5_DLLVAR hid_t H5E_CANTOPERATE_g; /* Can't operate on object */
+/* System level errors */
+#define H5E_SYSERRSTR (H5OPEN H5E_SYSERRSTR_g)
+H5_DLLVAR hid_t H5E_SYSERRSTR_g; /* System error message */
-/* Function entry/exit interface errors */
-#define H5E_CANTINIT (H5OPEN H5E_CANTINIT_g)
-#define H5E_ALREADYINIT (H5OPEN H5E_ALREADYINIT_g)
-#define H5E_CANTRELEASE (H5OPEN H5E_CANTRELEASE_g)
-H5_DLLVAR hid_t H5E_CANTINIT_g; /* Unable to initialize object */
-H5_DLLVAR hid_t H5E_ALREADYINIT_g; /* Object already initialized */
-H5_DLLVAR hid_t H5E_CANTRELEASE_g; /* Unable to release object */
+/* Argument errors */
+#define H5E_UNINITIALIZED (H5OPEN H5E_UNINITIALIZED_g)
+#define H5E_UNSUPPORTED (H5OPEN H5E_UNSUPPORTED_g)
+#define H5E_BADTYPE (H5OPEN H5E_BADTYPE_g)
+#define H5E_BADRANGE (H5OPEN H5E_BADRANGE_g)
+#define H5E_BADVALUE (H5OPEN H5E_BADVALUE_g)
+H5_DLLVAR hid_t H5E_UNINITIALIZED_g; /* Information is uinitialized */
+H5_DLLVAR hid_t H5E_UNSUPPORTED_g; /* Feature is unsupported */
+H5_DLLVAR hid_t H5E_BADTYPE_g; /* Inappropriate type */
+H5_DLLVAR hid_t H5E_BADRANGE_g; /* Out of range */
+H5_DLLVAR hid_t H5E_BADVALUE_g; /* Bad value */
-/* Property list errors */
-#define H5E_CANTGET (H5OPEN H5E_CANTGET_g)
-#define H5E_CANTSET (H5OPEN H5E_CANTSET_g)
-#define H5E_DUPCLASS (H5OPEN H5E_DUPCLASS_g)
-#define H5E_SETDISALLOWED (H5OPEN H5E_SETDISALLOWED_g)
-H5_DLLVAR hid_t H5E_CANTGET_g; /* Can't get value */
-H5_DLLVAR hid_t H5E_CANTSET_g; /* Can't set value */
-H5_DLLVAR hid_t H5E_DUPCLASS_g; /* Duplicate class name in parent class */
-H5_DLLVAR hid_t H5E_SETDISALLOWED_g; /* Disallowed operation */
+/* B-tree related errors */
+#define H5E_NOTFOUND (H5OPEN H5E_NOTFOUND_g)
+#define H5E_EXISTS (H5OPEN H5E_EXISTS_g)
+#define H5E_CANTENCODE (H5OPEN H5E_CANTENCODE_g)
+#define H5E_CANTDECODE (H5OPEN H5E_CANTDECODE_g)
+#define H5E_CANTSPLIT (H5OPEN H5E_CANTSPLIT_g)
+#define H5E_CANTREDISTRIBUTE (H5OPEN H5E_CANTREDISTRIBUTE_g)
+#define H5E_CANTSWAP (H5OPEN H5E_CANTSWAP_g)
+#define H5E_CANTINSERT (H5OPEN H5E_CANTINSERT_g)
+#define H5E_CANTLIST (H5OPEN H5E_CANTLIST_g)
+#define H5E_CANTMODIFY (H5OPEN H5E_CANTMODIFY_g)
+#define H5E_CANTREMOVE (H5OPEN H5E_CANTREMOVE_g)
+H5_DLLVAR hid_t H5E_NOTFOUND_g; /* Object not found */
+H5_DLLVAR hid_t H5E_EXISTS_g; /* Object already exists */
+H5_DLLVAR hid_t H5E_CANTENCODE_g; /* Unable to encode value */
+H5_DLLVAR hid_t H5E_CANTDECODE_g; /* Unable to decode value */
+H5_DLLVAR hid_t H5E_CANTSPLIT_g; /* Unable to split node */
+H5_DLLVAR hid_t H5E_CANTREDISTRIBUTE_g; /* Unable to redistribute records */
+H5_DLLVAR hid_t H5E_CANTSWAP_g; /* Unable to swap records */
+H5_DLLVAR hid_t H5E_CANTINSERT_g; /* Unable to insert object */
+H5_DLLVAR hid_t H5E_CANTLIST_g; /* Unable to list node */
+H5_DLLVAR hid_t H5E_CANTMODIFY_g; /* Unable to modify record */
+H5_DLLVAR hid_t H5E_CANTREMOVE_g; /* Unable to remove object */
-/* Free space errors */
-#define H5E_CANTMERGE (H5OPEN H5E_CANTMERGE_g)
-#define H5E_CANTREVIVE (H5OPEN H5E_CANTREVIVE_g)
-#define H5E_CANTSHRINK (H5OPEN H5E_CANTSHRINK_g)
-H5_DLLVAR hid_t H5E_CANTMERGE_g; /* Can't merge objects */
-H5_DLLVAR hid_t H5E_CANTREVIVE_g; /* Can't revive object */
-H5_DLLVAR hid_t H5E_CANTSHRINK_g; /* Can't shrink container */
+/* No error */
+#define H5E_NONE_MINOR (H5OPEN H5E_NONE_MINOR_g)
+H5_DLLVAR hid_t H5E_NONE_MINOR_g; /* No error */
/* Object header related errors */
#define H5E_LINKCOUNT (H5OPEN H5E_LINKCOUNT_g)
@@ -189,38 +277,6 @@ H5_DLLVAR hid_t H5E_CANTPACK_g; /* Can't pack messages */
H5_DLLVAR hid_t H5E_CANTRESET_g; /* Can't reset object */
H5_DLLVAR hid_t H5E_CANTRENAME_g; /* Unable to rename object */
-/* System level errors */
-#define H5E_SYSERRSTR (H5OPEN H5E_SYSERRSTR_g)
-H5_DLLVAR hid_t H5E_SYSERRSTR_g; /* System error message */
-
-/* I/O pipeline errors */
-#define H5E_NOFILTER (H5OPEN H5E_NOFILTER_g)
-#define H5E_CALLBACK (H5OPEN H5E_CALLBACK_g)
-#define H5E_CANAPPLY (H5OPEN H5E_CANAPPLY_g)
-#define H5E_SETLOCAL (H5OPEN H5E_SETLOCAL_g)
-#define H5E_NOENCODER (H5OPEN H5E_NOENCODER_g)
-#define H5E_CANTFILTER (H5OPEN H5E_CANTFILTER_g)
-H5_DLLVAR hid_t H5E_NOFILTER_g; /* Requested filter is not available */
-H5_DLLVAR hid_t H5E_CALLBACK_g; /* Callback failed */
-H5_DLLVAR hid_t H5E_CANAPPLY_g; /* Error from filter 'can apply' callback */
-H5_DLLVAR hid_t H5E_SETLOCAL_g; /* Error from filter 'set local' callback */
-H5_DLLVAR hid_t H5E_NOENCODER_g; /* Filter present but encoding disabled */
-H5_DLLVAR hid_t H5E_CANTFILTER_g; /* Filter operation failed */
-
-/* Group related errors */
-#define H5E_CANTOPENOBJ (H5OPEN H5E_CANTOPENOBJ_g)
-#define H5E_CANTCLOSEOBJ (H5OPEN H5E_CANTCLOSEOBJ_g)
-#define H5E_COMPLEN (H5OPEN H5E_COMPLEN_g)
-#define H5E_PATH (H5OPEN H5E_PATH_g)
-H5_DLLVAR hid_t H5E_CANTOPENOBJ_g; /* Can't open object */
-H5_DLLVAR hid_t H5E_CANTCLOSEOBJ_g; /* Can't close object */
-H5_DLLVAR hid_t H5E_COMPLEN_g; /* Name component is too long */
-H5_DLLVAR hid_t H5E_PATH_g; /* Problem with path to object */
-
-/* No error */
-#define H5E_NONE_MINOR (H5OPEN H5E_NONE_MINOR_g)
-H5_DLLVAR hid_t H5E_NONE_MINOR_g; /* No error */
-
/* Plugin errors */
#define H5E_OPENERROR (H5OPEN H5E_OPENERROR_g)
H5_DLLVAR hid_t H5E_OPENERROR_g; /* Can't open directory or file */
@@ -245,6 +301,34 @@ H5_DLLVAR hid_t H5E_BADFILE_g; /* Bad file ID accessed */
H5_DLLVAR hid_t H5E_TRUNCATED_g; /* File has been truncated */
H5_DLLVAR hid_t H5E_MOUNT_g; /* File mount error */
+/* I/O pipeline errors */
+#define H5E_NOFILTER (H5OPEN H5E_NOFILTER_g)
+#define H5E_CALLBACK (H5OPEN H5E_CALLBACK_g)
+#define H5E_CANAPPLY (H5OPEN H5E_CANAPPLY_g)
+#define H5E_SETLOCAL (H5OPEN H5E_SETLOCAL_g)
+#define H5E_NOENCODER (H5OPEN H5E_NOENCODER_g)
+#define H5E_CANTFILTER (H5OPEN H5E_CANTFILTER_g)
+H5_DLLVAR hid_t H5E_NOFILTER_g; /* Requested filter is not available */
+H5_DLLVAR hid_t H5E_CALLBACK_g; /* Callback failed */
+H5_DLLVAR hid_t H5E_CANAPPLY_g; /* Error from filter 'can apply' callback */
+H5_DLLVAR hid_t H5E_SETLOCAL_g; /* Error from filter 'set local' callback */
+H5_DLLVAR hid_t H5E_NOENCODER_g; /* Filter present but encoding disabled */
+H5_DLLVAR hid_t H5E_CANTFILTER_g; /* Filter operation failed */
+
+/* Datatype conversion errors */
+#define H5E_CANTCONVERT (H5OPEN H5E_CANTCONVERT_g)
+#define H5E_BADSIZE (H5OPEN H5E_BADSIZE_g)
+H5_DLLVAR hid_t H5E_CANTCONVERT_g; /* Can't convert datatypes */
+H5_DLLVAR hid_t H5E_BADSIZE_g; /* Bad size for object */
+
+/* Free space errors */
+#define H5E_CANTMERGE (H5OPEN H5E_CANTMERGE_g)
+#define H5E_CANTREVIVE (H5OPEN H5E_CANTREVIVE_g)
+#define H5E_CANTSHRINK (H5OPEN H5E_CANTSHRINK_g)
+H5_DLLVAR hid_t H5E_CANTMERGE_g; /* Can't merge objects */
+H5_DLLVAR hid_t H5E_CANTREVIVE_g; /* Can't revive object */
+H5_DLLVAR hid_t H5E_CANTSHRINK_g; /* Can't shrink container */
+
/* Object atom related errors */
#define H5E_BADATOM (H5OPEN H5E_BADATOM_g)
#define H5E_BADGROUP (H5OPEN H5E_BADGROUP_g)
@@ -259,58 +343,6 @@ H5_DLLVAR hid_t H5E_CANTINC_g; /* Unable to increment reference count */
H5_DLLVAR hid_t H5E_CANTDEC_g; /* Unable to decrement reference count */
H5_DLLVAR hid_t H5E_NOIDS_g; /* Out of IDs for group */
-/* Cache related errors */
-#define H5E_CANTFLUSH (H5OPEN H5E_CANTFLUSH_g)
-#define H5E_CANTSERIALIZE (H5OPEN H5E_CANTSERIALIZE_g)
-#define H5E_CANTLOAD (H5OPEN H5E_CANTLOAD_g)
-#define H5E_PROTECT (H5OPEN H5E_PROTECT_g)
-#define H5E_NOTCACHED (H5OPEN H5E_NOTCACHED_g)
-#define H5E_SYSTEM (H5OPEN H5E_SYSTEM_g)
-#define H5E_CANTINS (H5OPEN H5E_CANTINS_g)
-#define H5E_CANTPROTECT (H5OPEN H5E_CANTPROTECT_g)
-#define H5E_CANTUNPROTECT (H5OPEN H5E_CANTUNPROTECT_g)
-#define H5E_CANTPIN (H5OPEN H5E_CANTPIN_g)
-#define H5E_CANTUNPIN (H5OPEN H5E_CANTUNPIN_g)
-#define H5E_CANTMARKDIRTY (H5OPEN H5E_CANTMARKDIRTY_g)
-#define H5E_CANTDIRTY (H5OPEN H5E_CANTDIRTY_g)
-#define H5E_CANTEXPUNGE (H5OPEN H5E_CANTEXPUNGE_g)
-#define H5E_CANTRESIZE (H5OPEN H5E_CANTRESIZE_g)
-H5_DLLVAR hid_t H5E_CANTFLUSH_g; /* Unable to flush data from cache */
-H5_DLLVAR hid_t H5E_CANTSERIALIZE_g; /* Unable to serialize data from cache */
-H5_DLLVAR hid_t H5E_CANTLOAD_g; /* Unable to load metadata into cache */
-H5_DLLVAR hid_t H5E_PROTECT_g; /* Protected metadata error */
-H5_DLLVAR hid_t H5E_NOTCACHED_g; /* Metadata not currently cached */
-H5_DLLVAR hid_t H5E_SYSTEM_g; /* Internal error detected */
-H5_DLLVAR hid_t H5E_CANTINS_g; /* Unable to insert metadata into cache */
-H5_DLLVAR hid_t H5E_CANTPROTECT_g; /* Unable to protect metadata */
-H5_DLLVAR hid_t H5E_CANTUNPROTECT_g; /* Unable to unprotect metadata */
-H5_DLLVAR hid_t H5E_CANTPIN_g; /* Unable to pin cache entry */
-H5_DLLVAR hid_t H5E_CANTUNPIN_g; /* Unable to un-pin cache entry */
-H5_DLLVAR hid_t H5E_CANTMARKDIRTY_g; /* Unable to mark a pinned entry as dirty */
-H5_DLLVAR hid_t H5E_CANTDIRTY_g; /* Unable to mark metadata as dirty */
-H5_DLLVAR hid_t H5E_CANTEXPUNGE_g; /* Unable to expunge a metadata cache entry */
-H5_DLLVAR hid_t H5E_CANTRESIZE_g; /* Unable to resize a metadata cache entry */
-
-/* Link related errors */
-#define H5E_TRAVERSE (H5OPEN H5E_TRAVERSE_g)
-#define H5E_NLINKS (H5OPEN H5E_NLINKS_g)
-#define H5E_NOTREGISTERED (H5OPEN H5E_NOTREGISTERED_g)
-#define H5E_CANTMOVE (H5OPEN H5E_CANTMOVE_g)
-#define H5E_CANTSORT (H5OPEN H5E_CANTSORT_g)
-H5_DLLVAR hid_t H5E_TRAVERSE_g; /* Link traversal failure */
-H5_DLLVAR hid_t H5E_NLINKS_g; /* Too many soft links in path */
-H5_DLLVAR hid_t H5E_NOTREGISTERED_g; /* Link class not registered */
-H5_DLLVAR hid_t H5E_CANTMOVE_g; /* Can't move object */
-H5_DLLVAR hid_t H5E_CANTSORT_g; /* Can't sort objects */
-
-/* Parallel MPI errors */
-#define H5E_MPI (H5OPEN H5E_MPI_g)
-#define H5E_MPIERRSTR (H5OPEN H5E_MPIERRSTR_g)
-#define H5E_CANTRECV (H5OPEN H5E_CANTRECV_g)
-H5_DLLVAR hid_t H5E_MPI_g; /* Some MPI function failed */
-H5_DLLVAR hid_t H5E_MPIERRSTR_g; /* MPI Error String */
-H5_DLLVAR hid_t H5E_CANTRECV_g; /* Can't receive data */
-
/* Dataspace errors */
#define H5E_CANTCLIP (H5OPEN H5E_CANTCLIP_g)
#define H5E_CANTCOUNT (H5OPEN H5E_CANTCOUNT_g)
@@ -325,47 +357,15 @@ H5_DLLVAR hid_t H5E_CANTNEXT_g; /* Can't move to next iterator location */
H5_DLLVAR hid_t H5E_BADSELECT_g; /* Invalid selection */
H5_DLLVAR hid_t H5E_CANTCOMPARE_g; /* Can't compare objects */
-/* Argument errors */
-#define H5E_UNINITIALIZED (H5OPEN H5E_UNINITIALIZED_g)
-#define H5E_UNSUPPORTED (H5OPEN H5E_UNSUPPORTED_g)
-#define H5E_BADTYPE (H5OPEN H5E_BADTYPE_g)
-#define H5E_BADRANGE (H5OPEN H5E_BADRANGE_g)
-#define H5E_BADVALUE (H5OPEN H5E_BADVALUE_g)
-H5_DLLVAR hid_t H5E_UNINITIALIZED_g; /* Information is uinitialized */
-H5_DLLVAR hid_t H5E_UNSUPPORTED_g; /* Feature is unsupported */
-H5_DLLVAR hid_t H5E_BADTYPE_g; /* Inappropriate type */
-H5_DLLVAR hid_t H5E_BADRANGE_g; /* Out of range */
-H5_DLLVAR hid_t H5E_BADVALUE_g; /* Bad value */
-
-/* B-tree related errors */
-#define H5E_NOTFOUND (H5OPEN H5E_NOTFOUND_g)
-#define H5E_EXISTS (H5OPEN H5E_EXISTS_g)
-#define H5E_CANTENCODE (H5OPEN H5E_CANTENCODE_g)
-#define H5E_CANTDECODE (H5OPEN H5E_CANTDECODE_g)
-#define H5E_CANTSPLIT (H5OPEN H5E_CANTSPLIT_g)
-#define H5E_CANTREDISTRIBUTE (H5OPEN H5E_CANTREDISTRIBUTE_g)
-#define H5E_CANTSWAP (H5OPEN H5E_CANTSWAP_g)
-#define H5E_CANTINSERT (H5OPEN H5E_CANTINSERT_g)
-#define H5E_CANTLIST (H5OPEN H5E_CANTLIST_g)
-#define H5E_CANTMODIFY (H5OPEN H5E_CANTMODIFY_g)
-#define H5E_CANTREMOVE (H5OPEN H5E_CANTREMOVE_g)
-H5_DLLVAR hid_t H5E_NOTFOUND_g; /* Object not found */
-H5_DLLVAR hid_t H5E_EXISTS_g; /* Object already exists */
-H5_DLLVAR hid_t H5E_CANTENCODE_g; /* Unable to encode value */
-H5_DLLVAR hid_t H5E_CANTDECODE_g; /* Unable to decode value */
-H5_DLLVAR hid_t H5E_CANTSPLIT_g; /* Unable to split node */
-H5_DLLVAR hid_t H5E_CANTREDISTRIBUTE_g; /* Unable to redistribute records */
-H5_DLLVAR hid_t H5E_CANTSWAP_g; /* Unable to swap records */
-H5_DLLVAR hid_t H5E_CANTINSERT_g; /* Unable to insert object */
-H5_DLLVAR hid_t H5E_CANTLIST_g; /* Unable to list node */
-H5_DLLVAR hid_t H5E_CANTMODIFY_g; /* Unable to modify record */
-H5_DLLVAR hid_t H5E_CANTREMOVE_g; /* Unable to remove object */
-
-/* Datatype conversion errors */
-#define H5E_CANTCONVERT (H5OPEN H5E_CANTCONVERT_g)
-#define H5E_BADSIZE (H5OPEN H5E_BADSIZE_g)
-H5_DLLVAR hid_t H5E_CANTCONVERT_g; /* Can't convert datatypes */
-H5_DLLVAR hid_t H5E_BADSIZE_g; /* Bad size for object */
+/* Group related errors */
+#define H5E_CANTOPENOBJ (H5OPEN H5E_CANTOPENOBJ_g)
+#define H5E_CANTCLOSEOBJ (H5OPEN H5E_CANTCLOSEOBJ_g)
+#define H5E_COMPLEN (H5OPEN H5E_COMPLEN_g)
+#define H5E_PATH (H5OPEN H5E_PATH_g)
+H5_DLLVAR hid_t H5E_CANTOPENOBJ_g; /* Can't open object */
+H5_DLLVAR hid_t H5E_CANTCLOSEOBJ_g; /* Can't close object */
+H5_DLLVAR hid_t H5E_COMPLEN_g; /* Name component is too long */
+H5_DLLVAR hid_t H5E_PATH_g; /* Problem with path to object */
#ifdef __cplusplus
}
diff --git a/src/H5Eterm.h b/src/H5Eterm.h
index 2a8e11e..dd353a7 100644
--- a/src/H5Eterm.h
+++ b/src/H5Eterm.h
@@ -20,37 +20,37 @@
/* Reset major error IDs */
-H5E_DATASET_g=
-H5E_FUNC_g=
-H5E_STORAGE_g=
-H5E_FILE_g=
-H5E_SOHM_g=
-H5E_SYM_g=
-H5E_PLUGIN_g=
-H5E_VFL_g=
-H5E_INTERNAL_g=
-H5E_BTREE_g=
-H5E_REFERENCE_g=
-H5E_DATASPACE_g=
-H5E_RESOURCE_g=
H5E_PLIST_g=
+H5E_INTERNAL_g=
H5E_LINK_g=
-H5E_DATATYPE_g=
-H5E_RS_g=
+H5E_STORAGE_g=
+H5E_BTREE_g=
+H5E_FUNC_g=
+H5E_DATASET_g=
H5E_HEAP_g=
-H5E_OHDR_g=
-H5E_ATOM_g=
-H5E_ATTR_g=
+H5E_RESOURCE_g=
+H5E_DATASPACE_g=
+H5E_ERROR_g=
+H5E_EFL_g=
H5E_NONE_MAJOR_g=
+H5E_PLINE_g=
+H5E_OHDR_g=
+H5E_PLUGIN_g=
H5E_IO_g=
-H5E_SLIST_g=
-H5E_EFL_g=
+H5E_SOHM_g=
H5E_TST_g=
+H5E_ATOM_g=
+H5E_ATTR_g=
H5E_ARGS_g=
-H5E_ERROR_g=
-H5E_PLINE_g=
+H5E_FILE_g=
H5E_FSPACE_g=
-H5E_CACHE_g= (-1);
+H5E_SLIST_g=
+H5E_SYM_g=
+H5E_DATATYPE_g=
+H5E_CACHE_g=
+H5E_RS_g=
+H5E_VFL_g=
+H5E_REFERENCE_g= (-1);
/* Reset minor error IDs */
@@ -63,17 +63,35 @@ H5E_CLOSEERROR_g=
H5E_OVERFLOW_g=
H5E_FCNTL_g=
-/* Resource errors */
-H5E_NOSPACE_g=
-H5E_CANTALLOC_g=
-H5E_CANTCOPY_g=
-H5E_CANTFREE_g=
-H5E_ALREADYEXISTS_g=
-H5E_CANTLOCK_g=
-H5E_CANTUNLOCK_g=
-H5E_CANTGC_g=
-H5E_CANTGETSIZE_g=
-H5E_OBJOPEN_g=
+/* Link related errors */
+H5E_TRAVERSE_g=
+H5E_NLINKS_g=
+H5E_NOTREGISTERED_g=
+H5E_CANTMOVE_g=
+H5E_CANTSORT_g=
+
+/* Property list errors */
+H5E_CANTGET_g=
+H5E_CANTSET_g=
+H5E_DUPCLASS_g=
+H5E_SETDISALLOWED_g=
+
+/* Cache related errors */
+H5E_CANTFLUSH_g=
+H5E_CANTSERIALIZE_g=
+H5E_CANTLOAD_g=
+H5E_PROTECT_g=
+H5E_NOTCACHED_g=
+H5E_SYSTEM_g=
+H5E_CANTINS_g=
+H5E_CANTPROTECT_g=
+H5E_CANTUNPROTECT_g=
+H5E_CANTPIN_g=
+H5E_CANTUNPIN_g=
+H5E_CANTMARKDIRTY_g=
+H5E_CANTDIRTY_g=
+H5E_CANTEXPUNGE_g=
+H5E_CANTRESIZE_g=
/* Heap errors */
H5E_CANTRESTORE_g=
@@ -88,16 +106,48 @@ H5E_CANTINIT_g=
H5E_ALREADYINIT_g=
H5E_CANTRELEASE_g=
-/* Property list errors */
-H5E_CANTGET_g=
-H5E_CANTSET_g=
-H5E_DUPCLASS_g=
-H5E_SETDISALLOWED_g=
+/* Parallel MPI errors */
+H5E_MPI_g=
+H5E_MPIERRSTR_g=
+H5E_CANTRECV_g=
-/* Free space errors */
-H5E_CANTMERGE_g=
-H5E_CANTREVIVE_g=
-H5E_CANTSHRINK_g=
+/* Resource errors */
+H5E_NOSPACE_g=
+H5E_CANTALLOC_g=
+H5E_CANTCOPY_g=
+H5E_CANTFREE_g=
+H5E_ALREADYEXISTS_g=
+H5E_CANTLOCK_g=
+H5E_CANTUNLOCK_g=
+H5E_CANTGC_g=
+H5E_CANTGETSIZE_g=
+H5E_OBJOPEN_g=
+
+/* System level errors */
+H5E_SYSERRSTR_g=
+
+/* Argument errors */
+H5E_UNINITIALIZED_g=
+H5E_UNSUPPORTED_g=
+H5E_BADTYPE_g=
+H5E_BADRANGE_g=
+H5E_BADVALUE_g=
+
+/* B-tree related errors */
+H5E_NOTFOUND_g=
+H5E_EXISTS_g=
+H5E_CANTENCODE_g=
+H5E_CANTDECODE_g=
+H5E_CANTSPLIT_g=
+H5E_CANTREDISTRIBUTE_g=
+H5E_CANTSWAP_g=
+H5E_CANTINSERT_g=
+H5E_CANTLIST_g=
+H5E_CANTMODIFY_g=
+H5E_CANTREMOVE_g=
+
+/* No error */
+H5E_NONE_MINOR_g=
/* Object header related errors */
H5E_LINKCOUNT_g=
@@ -110,26 +160,6 @@ H5E_CANTPACK_g=
H5E_CANTRESET_g=
H5E_CANTRENAME_g=
-/* System level errors */
-H5E_SYSERRSTR_g=
-
-/* I/O pipeline errors */
-H5E_NOFILTER_g=
-H5E_CALLBACK_g=
-H5E_CANAPPLY_g=
-H5E_SETLOCAL_g=
-H5E_NOENCODER_g=
-H5E_CANTFILTER_g=
-
-/* Group related errors */
-H5E_CANTOPENOBJ_g=
-H5E_CANTCLOSEOBJ_g=
-H5E_COMPLEN_g=
-H5E_PATH_g=
-
-/* No error */
-H5E_NONE_MINOR_g=
-
/* Plugin errors */
H5E_OPENERROR_g=
@@ -144,6 +174,23 @@ H5E_BADFILE_g=
H5E_TRUNCATED_g=
H5E_MOUNT_g=
+/* I/O pipeline errors */
+H5E_NOFILTER_g=
+H5E_CALLBACK_g=
+H5E_CANAPPLY_g=
+H5E_SETLOCAL_g=
+H5E_NOENCODER_g=
+H5E_CANTFILTER_g=
+
+/* Datatype conversion errors */
+H5E_CANTCONVERT_g=
+H5E_BADSIZE_g=
+
+/* Free space errors */
+H5E_CANTMERGE_g=
+H5E_CANTREVIVE_g=
+H5E_CANTSHRINK_g=
+
/* Object atom related errors */
H5E_BADATOM_g=
H5E_BADGROUP_g=
@@ -152,35 +199,6 @@ H5E_CANTINC_g=
H5E_CANTDEC_g=
H5E_NOIDS_g=
-/* Cache related errors */
-H5E_CANTFLUSH_g=
-H5E_CANTSERIALIZE_g=
-H5E_CANTLOAD_g=
-H5E_PROTECT_g=
-H5E_NOTCACHED_g=
-H5E_SYSTEM_g=
-H5E_CANTINS_g=
-H5E_CANTPROTECT_g=
-H5E_CANTUNPROTECT_g=
-H5E_CANTPIN_g=
-H5E_CANTUNPIN_g=
-H5E_CANTMARKDIRTY_g=
-H5E_CANTDIRTY_g=
-H5E_CANTEXPUNGE_g=
-H5E_CANTRESIZE_g=
-
-/* Link related errors */
-H5E_TRAVERSE_g=
-H5E_NLINKS_g=
-H5E_NOTREGISTERED_g=
-H5E_CANTMOVE_g=
-H5E_CANTSORT_g=
-
-/* Parallel MPI errors */
-H5E_MPI_g=
-H5E_MPIERRSTR_g=
-H5E_CANTRECV_g=
-
/* Dataspace errors */
H5E_CANTCLIP_g=
H5E_CANTCOUNT_g=
@@ -189,28 +207,10 @@ H5E_CANTNEXT_g=
H5E_BADSELECT_g=
H5E_CANTCOMPARE_g=
-/* Argument errors */
-H5E_UNINITIALIZED_g=
-H5E_UNSUPPORTED_g=
-H5E_BADTYPE_g=
-H5E_BADRANGE_g=
-H5E_BADVALUE_g=
-
-/* B-tree related errors */
-H5E_NOTFOUND_g=
-H5E_EXISTS_g=
-H5E_CANTENCODE_g=
-H5E_CANTDECODE_g=
-H5E_CANTSPLIT_g=
-H5E_CANTREDISTRIBUTE_g=
-H5E_CANTSWAP_g=
-H5E_CANTINSERT_g=
-H5E_CANTLIST_g=
-H5E_CANTMODIFY_g=
-H5E_CANTREMOVE_g=
-
-/* Datatype conversion errors */
-H5E_CANTCONVERT_g=
-H5E_BADSIZE_g= (-1);
+/* Group related errors */
+H5E_CANTOPENOBJ_g=
+H5E_CANTCLOSEOBJ_g=
+H5E_COMPLEN_g=
+H5E_PATH_g= (-1);
#endif /* H5Eterm_H */
diff --git a/src/H5private.h b/src/H5private.h
index 500aa43..389b4a2 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -517,13 +517,13 @@
* It's the developer's responsibility not to pass in the value 0, which
* may cause the equation to fail.
*/
-#define H5_FLT_ABS_EQUAL(X,Y) (HDfabsf(X-Y) < FLT_EPSILON)
-#define H5_DBL_ABS_EQUAL(X,Y) (HDfabs (X-Y) < DBL_EPSILON)
-#define H5_LDBL_ABS_EQUAL(X,Y) (HDfabsl(X-Y) < LDBL_EPSILON)
+#define H5_FLT_ABS_EQUAL(X,Y) (HDfabsf((X)-(Y)) < FLT_EPSILON)
+#define H5_DBL_ABS_EQUAL(X,Y) (HDfabs ((X)-(Y)) < DBL_EPSILON)
+#define H5_LDBL_ABS_EQUAL(X,Y) (HDfabsl((X)-(Y)) < LDBL_EPSILON)
-#define H5_FLT_REL_EQUAL(X,Y,M) (HDfabsf((Y-X) / X) < M)
-#define H5_DBL_REL_EQUAL(X,Y,M) (HDfabs ((Y-X) / X) < M)
-#define H5_LDBL_REL_EQUAL(X,Y,M) (HDfabsl((Y-X) / X) < M)
+#define H5_FLT_REL_EQUAL(X,Y,M) (HDfabsf(((Y)-(X)) / (X)) < (M))
+#define H5_DBL_REL_EQUAL(X,Y,M) (HDfabs (((Y)-(X)) / (X)) < (M))
+#define H5_LDBL_REL_EQUAL(X,Y,M) (HDfabsl(((Y)-(X)) / (X)) < (M))
/* KiB, MiB, GiB, TiB, EiB - Used in profiling and timing code */
#define H5_KB (1024.0F)
@@ -1616,25 +1616,25 @@ extern char *strdup(const char *s);
* information about the package in H5_init_library().
*/
typedef enum {
- H5_PKG_A, /*Attributes */
- H5_PKG_AC, /*Meta data cache */
- H5_PKG_B, /*B-trees */
- H5_PKG_D, /*Datasets */
- H5_PKG_E, /*Error handling */
- H5_PKG_F, /*Files */
- H5_PKG_G, /*Groups */
- H5_PKG_HG, /*Global heap */
- H5_PKG_HL, /*Local heap */
- H5_PKG_I, /*Interface */
- H5_PKG_MF, /*File memory management */
- H5_PKG_MM, /*Core memory management */
- H5_PKG_O, /*Object headers */
- H5_PKG_P, /*Property lists */
- H5_PKG_S, /*Data spaces */
- H5_PKG_T, /*Data types */
- H5_PKG_V, /*Vector functions */
- H5_PKG_Z, /*Raw data filters */
- H5_NPKGS /*Must be last */
+ H5_PKG_A, /* Attributes */
+ H5_PKG_AC, /* Metadata cache */
+ H5_PKG_B, /* B-trees */
+ H5_PKG_D, /* Datasets */
+ H5_PKG_E, /* Error handling */
+ H5_PKG_F, /* Files */
+ H5_PKG_G, /* Groups */
+ H5_PKG_HG, /* Global heaps */
+ H5_PKG_HL, /* Local heaps */
+ H5_PKG_I, /* IDs */
+ H5_PKG_MF, /* File memory management */
+ H5_PKG_MM, /* Core memory management */
+ H5_PKG_O, /* Object headers */
+ H5_PKG_P, /* Property lists */
+ H5_PKG_S, /* Dataspaces */
+ H5_PKG_T, /* Datatypes */
+ H5_PKG_V, /* Vector functions */
+ H5_PKG_Z, /* Raw data filters */
+ H5_NPKGS /* Must be last */
} H5_pkg_t;
typedef struct H5_debug_open_stream_t {
@@ -1672,60 +1672,77 @@ extern char H5libhdf5_settings[]; /* embedded library information */
*-------------------------------------------------------------------------
*/
#ifdef H5_DEBUG_API
-#define H5TRACE_DECL const char *RTYPE=NULL; \
- double CALLTIME;
-#define H5TRACE0(R,T) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T)
-#define H5TRACE1(R,T,A0) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0)
-#define H5TRACE2(R,T,A0,A1) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1)
-#define H5TRACE3(R,T,A0,A1,A2) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2)
-#define H5TRACE4(R,T,A0,A1,A2,A3) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3)
-#define H5TRACE5(R,T,A0,A1,A2,A3,A4) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \
- #A4,A4)
-#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \
- #A4,A4,#A5,A5)
-#define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \
- #A4,A4,#A5,A5,#A6,A6)
-#define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \
- #A4,A4,#A5,A5,#A6,A6,#A7,A7)
-#define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \
- #A4,A4,#A5,A5,#A6,A6,#A7,A7,#A8,A8)
-#define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \
- #A4,A4,#A5,A5,#A6,A6,#A7,A7,#A8,A8,#A9,A9)
-#define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) RTYPE=R; \
- CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \
- #A4,A4,#A5,A5,#A6,A6,#A7,A7,#A8,A8,#A9,A9, \
- #A10,A10)
-#define H5TRACE_RETURN(V) if (RTYPE) { \
- H5_trace(&CALLTIME,FUNC,RTYPE,NULL,V); \
- RTYPE=NULL; \
- }
+
+#define H5TRACE_DECL \
+ const char *RTYPE = NULL; \
+ double CALLTIME;
+
+#define H5TRACE0(R,T) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T)
+#define H5TRACE1(R,T,A0) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0)
+#define H5TRACE2(R,T,A0,A1) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1)
+#define H5TRACE3(R,T,A0,A1,A2) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2)
+#define H5TRACE4(R,T,A0,A1,A2,A3) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3)
+#define H5TRACE5(R,T,A0,A1,A2,A3,A4) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4)
+#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5)
+#define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6)
+#define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7)
+#define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7, \
+ #A8,A8)
+#define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7, \
+ #A8,A8,#A9,A9)
+#define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7, \
+ #A8,A8,#A9,A9,#A10,A10)
+#define H5TRACE12(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11) \
+ RTYPE=R; \
+ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3,#A4,A4,#A5,A5,#A6,A6,#A7,A7, \
+ #A8,A8,#A9,A9,#A10,A10,#A11,A11)
+
+#define H5TRACE_RETURN(V) \
+ if (RTYPE) { \
+ H5_trace(&CALLTIME, FUNC, RTYPE, NULL, V); \
+ RTYPE = NULL; \
+ }
#else
-#define H5TRACE_DECL /*void*/
-#define H5TRACE0(R,T) /*void*/
-#define H5TRACE1(R,T,A0) /*void*/
-#define H5TRACE2(R,T,A0,A1) /*void*/
-#define H5TRACE3(R,T,A0,A1,A2) /*void*/
-#define H5TRACE4(R,T,A0,A1,A2,A3) /*void*/
-#define H5TRACE5(R,T,A0,A1,A2,A3,A4) /*void*/
-#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) /*void*/
-#define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) /*void*/
-#define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) /*void*/
-#define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) /*void*/
-#define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) /*void*/
-#define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) /*void*/
-#define H5TRACE_RETURN(V) /*void*/
-#endif
+#define H5TRACE_DECL /*void*/
+#define H5TRACE0(R,T) /*void*/
+#define H5TRACE1(R,T,A0) /*void*/
+#define H5TRACE2(R,T,A0,A1) /*void*/
+#define H5TRACE3(R,T,A0,A1,A2) /*void*/
+#define H5TRACE4(R,T,A0,A1,A2,A3) /*void*/
+#define H5TRACE5(R,T,A0,A1,A2,A3,A4) /*void*/
+#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) /*void*/
+#define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) /*void*/
+#define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) /*void*/
+#define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) /*void*/
+#define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) /*void*/
+#define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) /*void*/
+#define H5TRACE12(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11) /*void*/
+#define H5TRACE_RETURN(V) /*void*/
+#endif /* H5_DEBUG_API */
H5_DLL double H5_trace(const double *calltime, const char *func, const char *type, ...);
@@ -1884,47 +1901,48 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
#ifndef NDEBUG
-#define FUNC_ENTER_CHECK_NAME(asrt) \
- { \
- static hbool_t func_check = FALSE; \
+#define FUNC_ENTER_CHECK_NAME(asrt) \
+ { \
+ static hbool_t func_check = FALSE; \
\
if(!func_check) { \
/* Check function naming status */ \
HDassert(asrt); \
\
- /* Don't check again */ \
- func_check = TRUE; \
- } /* end if */ \
+ /* Don't check again */ \
+ func_check = TRUE; \
+ } /* end if */ \
} /* end scope */
#else /* NDEBUG */
#define FUNC_ENTER_CHECK_NAME(asrt)
#endif /* NDEBUG */
-#define FUNC_ENTER_COMMON(asrt) \
- hbool_t err_occurred = FALSE; \
+#define FUNC_ENTER_COMMON(asrt) \
+ hbool_t err_occurred = FALSE; \
+ \
FUNC_ENTER_CHECK_NAME(asrt);
-#define FUNC_ENTER_COMMON_NOERR(asrt) \
+#define FUNC_ENTER_COMMON_NOERR(asrt) \
FUNC_ENTER_CHECK_NAME(asrt);
/* Threadsafety initialization code for API routines */
#define FUNC_ENTER_API_THREADSAFE \
- /* Initialize the thread-safe code */ \
+ /* Initialize the thread-safe code */ \
H5_FIRST_THREAD_INIT \
- \
- /* Grab the mutex for the library */ \
+ \
+ /* Grab the mutex for the library */ \
H5_API_UNSET_CANCEL \
H5_API_LOCK
/* Local variables for API routines */
#define FUNC_ENTER_API_VARS \
- MPE_LOG_VARS \
+ MPE_LOG_VARS \
H5TRACE_DECL
-#define FUNC_ENTER_API_COMMON \
+#define FUNC_ENTER_API_COMMON \
FUNC_ENTER_API_VARS \
- FUNC_ENTER_COMMON(H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON(H5_IS_API(FUNC)); \
FUNC_ENTER_API_THREADSAFE;
#define FUNC_ENTER_API_INIT(err) \
@@ -1939,26 +1957,26 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
/* Initialize the interface, if appropriate */ \
H5_INTERFACE_INIT(err) \
\
- /* Push the name of this function on the function stack */ \
- H5_PUSH_FUNC \
+ /* Push the name of this function on the function stack */ \
+ H5_PUSH_FUNC \
\
BEGIN_MPE_LOG
/* Use this macro for all "normal" API functions */
-#define FUNC_ENTER_API(err) {{ \
+#define FUNC_ENTER_API(err) {{ \
FUNC_ENTER_API_COMMON \
- FUNC_ENTER_API_INIT(err); \
- /* Clear thread error stack entering public functions */ \
- H5E_clear_stack(NULL); \
+ FUNC_ENTER_API_INIT(err); \
+ /* Clear thread error stack entering public functions */ \
+ H5E_clear_stack(NULL); \
{
/*
* Use this macro for API functions that shouldn't clear the error stack
* like H5Eprint and H5Ewalk.
*/
-#define FUNC_ENTER_API_NOCLEAR(err) {{ \
+#define FUNC_ENTER_API_NOCLEAR(err) {{ \
FUNC_ENTER_API_COMMON \
- FUNC_ENTER_API_INIT(err); \
+ FUNC_ENTER_API_INIT(err); \
{
/*
@@ -1967,7 +1985,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
* are: H5check_version, etc.
*
*/
-#define FUNC_ENTER_API_NOINIT {{ \
+#define FUNC_ENTER_API_NOINIT {{ \
FUNC_ENTER_API_COMMON \
H5_PUSH_FUNC \
BEGIN_MPE_LOG \
@@ -1980,10 +1998,10 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
* are: H5close, H5check_version, etc.
*
*/
-#define FUNC_ENTER_API_NOINIT_NOERR_NOFS {{ \
+#define FUNC_ENTER_API_NOINIT_NOERR_NOFS {{ \
FUNC_ENTER_API_VARS \
- FUNC_ENTER_COMMON_NOERR(H5_IS_API(FUNC)); \
- FUNC_ENTER_API_THREADSAFE; \
+ FUNC_ENTER_COMMON_NOERR(H5_IS_API(FUNC)); \
+ FUNC_ENTER_API_THREADSAFE; \
BEGIN_MPE_LOG \
{
@@ -1992,8 +2010,8 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
/* Initialize the interface, if appropriate */ \
H5_INTERFACE_INIT(err) \
\
- /* Push the name of this function on the function stack */ \
- H5_PUSH_FUNC
+ /* Push the name of this function on the function stack */ \
+ H5_PUSH_FUNC
/* Use this macro for all "normal" non-API functions */
#define FUNC_ENTER_NOAPI(err) { \
@@ -2039,8 +2057,8 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
* - functions which are called during library shutdown, since we don't
* want to re-initialize the library.
*/
-#define FUNC_ENTER_NOAPI_NOINIT { \
- FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \
+#define FUNC_ENTER_NOAPI_NOINIT { \
+ FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \
H5_PUSH_FUNC \
{
@@ -2053,8 +2071,8 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
* want to re-initialize the library.
* - functions that propagate, but don't issue errors
*/
-#define FUNC_ENTER_NOAPI_NOINIT_NOERR { \
- FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \
+#define FUNC_ENTER_NOAPI_NOINIT_NOERR { \
+ FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \
H5_PUSH_FUNC \
{
diff --git a/src/H5system.c b/src/H5system.c
index d0c691d..ee37810 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -30,11 +30,10 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Fprivate.h" /* File access */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Eprivate.h"
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -74,7 +73,7 @@
/* Track whether tzset routine was called */
static hbool_t H5_ntzset = FALSE;
-
+
/*-------------------------------------------------------------------------
* Function: HDfprintf
*
@@ -433,7 +432,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
} /* end HDfprintf() */
#pragma GCC diagnostic pop
-
+
/*-------------------------------------------------------------------------
* Function: HDstrtoll
*
@@ -560,7 +559,7 @@ HDstrtoll(const char *s, const char **rest, int base)
return acc;
} /* end HDstrtoll() */
#endif
-
+
/*-------------------------------------------------------------------------
* Function: HDrand/HDsrand
*
@@ -596,6 +595,7 @@ void HDsrand(unsigned int seed)
#endif /* H5_HAVE_RAND_R */
+
/*-------------------------------------------------------------------------
* Function: H5_make_time
*
@@ -680,7 +680,7 @@ done:
/* Offset between 1/1/1601 and 1/1/1970 in 100 nanosecond units */
#define _W32_FT_OFFSET (116444736000000000ULL)
-
+
/*-------------------------------------------------------------------------
* Function: Wgettimeofday
*
@@ -732,7 +732,7 @@ Wgettimeofday(struct timeval *tv, struct timezone *tz)
return 0;
} /* end Wgettimeofday() */
-
+
/*-------------------------------------------------------------------------
* Function: Wsetenv
*
@@ -830,7 +830,7 @@ Wnanosleep(const struct timespec *req, struct timespec *rem)
} /* end Wnanosleep() */
-
+
/*-------------------------------------------------------------------------
* Function: Wllround, Wllroundf, Wlround, Wlroundf, Wround, Wroundf
*
@@ -1008,7 +1008,7 @@ done:
#endif /* H5_HAVE_WIN32_API */
-
+
/*-------------------------------------------------------------------------
* Function: H5_build_extpath
*
@@ -1128,7 +1128,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5_build_extpath() */
-
+
/*--------------------------------------------------------------------------
* Function: H5_combine_path
*
@@ -1191,11 +1191,11 @@ H5_combine_path(const char* path1, const char* path2, char **full_name /*out*/)
* Allocate a buffer to hold path1 + path2 + possibly the delimiter
* + terminating null byte
*/
- if(NULL == (*full_name = (char *)H5MM_malloc(path1_len + path2_len + 2)))
+ if(NULL == (*full_name = (char *)H5MM_malloc(path1_len + path2_len + 2 + 2))) /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer")
/* Compose the full file name */
- HDsnprintf(*full_name, (path1_len + path2_len + 2), "%s%s%s", path1,
+ HDsnprintf(*full_name, (path1_len + path2_len + 2 + 2), "%s%s%s", path1, /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */
(H5_CHECK_DELIMITER(path1[path1_len - 1]) ? "" : H5_DIR_SEPS), path2);
} /* end else */
@@ -1203,7 +1203,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5_combine_path() */
-
+
/*--------------------------------------------------------------------------
* Function: H5_nanosleep
*
@@ -1231,7 +1231,7 @@ H5_nanosleep(uint64_t nanosec)
FUNC_LEAVE_NOAPI_VOID
} /* end H5_nanosleep() */
-
+
/*--------------------------------------------------------------------------
* Function: H5_get_time
*
@@ -1267,7 +1267,7 @@ H5_get_time(void)
#define H5_WIN32_ENV_VAR_BUFFER_SIZE 32767
-
+
/*-------------------------------------------------------------------------
* Function: H5_expand_windows_env_vars()
*
diff --git a/src/H5win32defs.h b/src/H5win32defs.h
index 5411068..a16cb25 100644
--- a/src/H5win32defs.h
+++ b/src/H5win32defs.h
@@ -56,7 +56,7 @@ typedef __int64 h5_stat_size_t;
#define HDopen(S,F,...) Wopen_utf8(S,F,__VA_ARGS__)
#else
#define HDopen(S,F,...) Wopen_utf8(S,F,##__VA_ARGS__)
-#endif /* H5_HAVE_MINGW */
+#endif
#define HDread(F,M,Z) _read(F,M,Z)
#define HDremove(S) Wremove_utf8(S)
#define HDrmdir(S) _rmdir(S)
diff --git a/test/H5srcdir.h b/test/H5srcdir.h
index 1c02f46..32fe8c9 100644
--- a/test/H5srcdir.h
+++ b/test/H5srcdir.h
@@ -29,26 +29,9 @@ static char srcdir_path[1024] = "";
/* Buffer to construct file in and return pointer to */
static char srcdir_testpath[1024] = "";
-/* Append the test file name to the srcdir path and return the whole string */
-static const char *H5_get_srcdir_filename(const char *filename)
-{
- const char *srcdir = HDgetenv("srcdir");
-
- /* Check for using the srcdir from configure time */
- if(NULL == srcdir)
- srcdir = config_srcdir;
-
- /* Build path to test file */
- if((HDstrlen(srcdir) + HDstrlen(filename) + 2) < sizeof(srcdir_testpath)) {
- HDsnprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s/%s", srcdir, filename);
- return(srcdir_testpath);
- } /* end if */
- else
- return(NULL);
-}
-
/* Just return the srcdir path */
-static const char *H5_get_srcdir(void)
+static const char *
+H5_get_srcdir(void)
{
const char *srcdir = HDgetenv("srcdir");
@@ -63,6 +46,25 @@ static const char *H5_get_srcdir(void)
} /* end if */
else
return(NULL);
-}
+} /* end H5_get_srcdir() */
+
+/* Append the test file name to the srcdir path and return the whole string */
+static const char *H5_get_srcdir_filename(const char *filename)
+{
+ const char *srcdir = H5_get_srcdir();
+
+ /* Check for error */
+ if(NULL == srcdir)
+ return(NULL);
+ else {
+ /* Build path to test file */
+ if((HDstrlen(srcdir) + HDstrlen(filename) + 1) < sizeof(srcdir_testpath)) {
+ HDsnprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s%s", srcdir, filename);
+ return(srcdir_testpath);
+ } /* end if */
+ else
+ return(NULL);
+ } /* end else */
+} /* end H5_get_srcdir_filename() */
#endif /* _H5SRCDIR_H */
diff --git a/test/accum.c b/test/accum.c
index d298aec..57429c1 100644
--- a/test/accum.c
+++ b/test/accum.c
@@ -85,8 +85,9 @@ main(void)
unsigned nerrors = 0; /* track errors */
hid_t fid = -1;
+
/* Test Setup */
- puts("Testing the metadata accumulator");
+ HDputs("Testing the metadata accumulator");
/* Create a test file */
if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
@@ -125,12 +126,12 @@ main(void)
if(nerrors)
goto error;
- puts("All metadata accumulator tests passed.");
+ HDputs("All metadata accumulator tests passed.");
return 0;
error:
- puts("*** TESTS FAILED ***");
+ HDputs("*** TESTS FAILED ***");
return 1;
} /* end main() */
@@ -163,7 +164,7 @@ test_write_read(const H5F_io_info_t *fio_info)
/* Allocate buffers */
write_buf = (int *)HDmalloc(1024 * sizeof(int));
HDassert(write_buf);
- read_buf = (int *)HDcalloc(1024, sizeof(int));
+ read_buf = (int *)HDcalloc((size_t)1024, sizeof(int));
HDassert(read_buf);
/* Fill buffer with data, zero out read buffer */
@@ -174,7 +175,7 @@ test_write_read(const H5F_io_info_t *fio_info)
/* Write 1KB at Address 0 */
if(accum_write(0, 1024, write_buf) < 0) FAIL_STACK_ERROR;
if(accum_read(0, 1024, read_buf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(write_buf, read_buf, 1024) != 0) TEST_ERROR;
+ if(HDmemcmp(write_buf, read_buf, (size_t)1024) != 0) TEST_ERROR;
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -219,7 +220,7 @@ test_write_read_nonacc_front(const H5F_io_info_t *fio_info)
/* Allocate buffers */
write_buf = (int *)HDmalloc(2048 * sizeof(int));
HDassert(write_buf);
- read_buf = (int *)HDcalloc(2048, sizeof(int));
+ read_buf = (int *)HDcalloc((size_t)2048, sizeof(int));
HDassert(read_buf);
/* Fill buffer with data, zero out read buffer */
@@ -233,7 +234,7 @@ test_write_read_nonacc_front(const H5F_io_info_t *fio_info)
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(1024, 1024, write_buf) < 0) FAIL_STACK_ERROR;
if(accum_read(0, 1024, read_buf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(write_buf, read_buf, 1024) != 0) TEST_ERROR;
+ if(HDmemcmp(write_buf, read_buf, (size_t)1024) != 0) TEST_ERROR;
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -278,7 +279,7 @@ test_write_read_nonacc_end(const H5F_io_info_t *fio_info)
/* Allocate buffers */
write_buf = (int *)HDmalloc(2048 * sizeof(int));
HDassert(write_buf);
- read_buf = (int *)HDcalloc(2048, sizeof(int));
+ read_buf = (int *)HDcalloc((size_t)2048, sizeof(int));
HDassert(read_buf);
/* Fill buffer with data, zero out read buffer */
@@ -292,7 +293,7 @@ test_write_read_nonacc_end(const H5F_io_info_t *fio_info)
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(0, 1024, write_buf) < 0) FAIL_STACK_ERROR;
if(accum_read(1024, 1024, read_buf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(write_buf, read_buf, 1024) != 0) TEST_ERROR;
+ if(HDmemcmp(write_buf, read_buf, (size_t)1024) != 0) TEST_ERROR;
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -524,7 +525,7 @@ test_accum_overlap(const H5F_io_info_t *fio_info)
/* Allocate buffers */
wbuf = (int32_t *)HDmalloc(4096 * sizeof(int32_t));
HDassert(wbuf);
- rbuf = (int32_t *)HDcalloc(4096, sizeof(int32_t));
+ rbuf = (int32_t *)HDcalloc((size_t)4096, sizeof(int32_t));
HDassert(rbuf);
/* Case 1: No metadata in accumulator */
@@ -696,7 +697,7 @@ test_accum_overlap_clean(const H5F_io_info_t *fio_info)
/* Allocate buffers */
wbuf = (int32_t *)HDmalloc(4096 * sizeof(int32_t));
HDassert(wbuf);
- rbuf = (int32_t *)HDcalloc(4096, sizeof(int32_t));
+ rbuf = (int32_t *)HDcalloc((size_t)4096, sizeof(int32_t));
HDassert(rbuf);
/* Case 1: No metadata in accumulator */
@@ -875,7 +876,7 @@ test_accum_non_overlap_size(const H5F_io_info_t *fio_info)
/* Allocate buffers */
wbuf = (int *)HDmalloc(4096 * sizeof(int32_t));
HDassert(wbuf);
- rbuf = (int *)HDcalloc(4096, sizeof(int32_t));
+ rbuf = (int *)HDcalloc((size_t)4096, sizeof(int32_t));
HDassert(rbuf);
/* Case 1: No metadata in accumulator */
@@ -942,7 +943,7 @@ test_accum_overlap_size(const H5F_io_info_t *fio_info)
/* Allocate buffers */
wbuf = (int32_t *)HDmalloc(4096 * sizeof(int32_t));
HDassert(wbuf);
- rbuf = (int32_t *)HDcalloc(4096, sizeof(int32_t));
+ rbuf = (int32_t *)HDcalloc((size_t)4096, sizeof(int32_t));
HDassert(rbuf);
/* Case 1: No metadata in accumulator */
@@ -1049,11 +1050,11 @@ test_accum_adjust(const H5F_io_info_t *fio_info)
/* Read back and verify first write */
if(accum_read((1024 * 1024), (1024 * 1024) - 1, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, (1024 * 1024) - 1) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)((1024 * 1024) - 1)) != 0) TEST_ERROR;
/* Read back and verify second write */
if(accum_read((1024 * 1024) - 1024, 1024, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 1024) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)1024) != 0) TEST_ERROR;
/* Reset accumulator for next case */
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1079,10 +1080,10 @@ test_accum_adjust(const H5F_io_info_t *fio_info)
/* Read back and verify both pieces of data */
if(accum_read(1048576, 1048575, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 1048576) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)1048576) != 0) TEST_ERROR;
if(accum_read(5, 1048571, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 1048571) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)1048571) != 0) TEST_ERROR;
/* Reset accumulator for next case */
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1117,7 +1118,7 @@ test_accum_adjust(const H5F_io_info_t *fio_info)
/* Read in the piece we wrote to disk above, and then verify that
the data is as expected */
if(accum_read((1024 * 1024) - 1, 1024, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 1024) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)1024) != 0) TEST_ERROR;
/* Reset accumulator for next case */
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1157,7 +1158,7 @@ test_accum_adjust(const H5F_io_info_t *fio_info)
/* Read in the piece we wrote to disk above, and then verify that
the data is as expected */
if(accum_read(1048571, 349523, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 349523) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)349523) != 0) TEST_ERROR;
/* Reset accumulator for next case */
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1194,7 +1195,7 @@ test_accum_adjust(const H5F_io_info_t *fio_info)
/* Read in the piece we wrote to disk above, and then verify that
the data is as expected */
if(accum_read((1024 * 1024) - 5, 10, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 10) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)10) != 0) TEST_ERROR;
/* Reset accumulator for next case */
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1226,7 +1227,7 @@ test_accum_adjust(const H5F_io_info_t *fio_info)
/* Read in the piece we wrote to disk above, and then verify that
the data is as expected */
if(accum_read(1048571, 349523, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 349523) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)349523) != 0) TEST_ERROR;
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1309,7 +1310,7 @@ test_read_after(const H5F_io_info_t *fio_info)
/* Read in the piece we wrote to disk above, and then verify that
the data is as expected */
if(accum_read(512, 512, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 128) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)128) != 0) TEST_ERROR;
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1351,13 +1352,13 @@ test_big(const H5F_io_info_t *fio_info)
unsigned u; /* Local index variable */
/* Allocate space for the write & read buffers */
- wbuf = (uint8_t *)HDmalloc(BIG_BUF_SIZE);
+ wbuf = (uint8_t *)HDmalloc((size_t)BIG_BUF_SIZE);
HDassert(wbuf);
- wbuf2 = (uint8_t *)HDmalloc(BIG_BUF_SIZE);
+ wbuf2 = (uint8_t *)HDmalloc((size_t)BIG_BUF_SIZE);
HDassert(wbuf2);
- rbuf = (uint8_t *)HDcalloc(BIG_BUF_SIZE + 1536, 1);
+ rbuf = (uint8_t *)HDcalloc((size_t)(BIG_BUF_SIZE + 1536), (size_t)1);
HDassert(rbuf);
- zbuf = (uint8_t *)HDcalloc(BIG_BUF_SIZE + 1536, 1);
+ zbuf = (uint8_t *)HDcalloc((size_t)(BIG_BUF_SIZE + 1536), (size_t)1);
HDassert(zbuf);
/* Initialize write buffers */
@@ -1375,12 +1376,12 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(0, BIG_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(wbuf, rbuf, BIG_BUF_SIZE) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(0, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR;
- HDmemset(rbuf, 0, BIG_BUF_SIZE);
+ HDmemset(rbuf, 0, (size_t)BIG_BUF_SIZE);
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1392,14 +1393,14 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(0, BIG_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(zbuf, rbuf, 1024) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf, rbuf + 1024, 1024) != 0) TEST_ERROR;
- if(HDmemcmp(zbuf, rbuf + 2048, (BIG_BUF_SIZE - 2048)) != 0) TEST_ERROR;
+ if(HDmemcmp(zbuf, rbuf, (size_t)1024) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf + 1024, (size_t)1024) != 0) TEST_ERROR;
+ if(HDmemcmp(zbuf, rbuf + 2048, (size_t)(BIG_BUF_SIZE - 2048)) != 0) TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(1024, 1024, zbuf) < 0) FAIL_STACK_ERROR;
- HDmemset(rbuf, 0, BIG_BUF_SIZE);
+ HDmemset(rbuf, 0, (size_t)BIG_BUF_SIZE);
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1411,13 +1412,13 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(0, BIG_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(zbuf, rbuf, (BIG_BUF_SIZE - 512)) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf, rbuf + (BIG_BUF_SIZE - 512), 512) != 0) TEST_ERROR;
+ if(HDmemcmp(zbuf, rbuf, (size_t)(BIG_BUF_SIZE - 512)) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf + (BIG_BUF_SIZE - 512), (size_t)512) != 0) TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(BIG_BUF_SIZE - 512, 1024, zbuf) < 0) FAIL_STACK_ERROR;
- HDmemset(rbuf, 0, BIG_BUF_SIZE);
+ HDmemset(rbuf, 0, (size_t)BIG_BUF_SIZE);
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1429,13 +1430,13 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(512, BIG_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(wbuf + 512, rbuf, 512) != 0) TEST_ERROR;
- if(HDmemcmp(zbuf, rbuf + 512, (BIG_BUF_SIZE - 512)) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf + 512, rbuf, (size_t)512) != 0) TEST_ERROR;
+ if(HDmemcmp(zbuf, rbuf + 512, (size_t)(BIG_BUF_SIZE - 512)) != 0) TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(0, 1024, zbuf) < 0) FAIL_STACK_ERROR;
- HDmemset(rbuf, 0, BIG_BUF_SIZE);
+ HDmemset(rbuf, 0, (size_t)BIG_BUF_SIZE);
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1452,12 +1453,12 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(0, BIG_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(wbuf2, rbuf, BIG_BUF_SIZE) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf2, rbuf, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(0, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR;
- HDmemset(rbuf, 0, BIG_BUF_SIZE);
+ HDmemset(rbuf, 0, (size_t)BIG_BUF_SIZE);
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1474,13 +1475,13 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(0, BIG_BUF_SIZE + 512, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(wbuf2, rbuf, BIG_BUF_SIZE) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf + 512, rbuf + BIG_BUF_SIZE, 512) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf2, rbuf, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf + 512, rbuf + BIG_BUF_SIZE, (size_t)512) != 0) TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(0, BIG_BUF_SIZE + 512, zbuf) < 0) FAIL_STACK_ERROR;
- HDmemset(rbuf, 0, BIG_BUF_SIZE + 512);
+ HDmemset(rbuf, 0, (size_t)(BIG_BUF_SIZE + 512));
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1501,14 +1502,14 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(0, BIG_BUF_SIZE + 1024, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(wbuf2, rbuf, BIG_BUF_SIZE) != 0) TEST_ERROR;
- if(HDmemcmp(zbuf, rbuf + BIG_BUF_SIZE, 512) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf, rbuf + BIG_BUF_SIZE + 512, 512) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf2, rbuf, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
+ if(HDmemcmp(zbuf, rbuf + BIG_BUF_SIZE, (size_t)512) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf + BIG_BUF_SIZE + 512, (size_t)512) != 0) TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(0, BIG_BUF_SIZE + 1536, zbuf) < 0) FAIL_STACK_ERROR;
- HDmemset(rbuf, 0, BIG_BUF_SIZE + 1024);
+ HDmemset(rbuf, 0, (size_t)(BIG_BUF_SIZE + 1024));
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1530,13 +1531,13 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(0, BIG_BUF_SIZE + 1536, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(zbuf, rbuf, 1536) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf2, rbuf + 1536, BIG_BUF_SIZE) != 0) TEST_ERROR;
+ if(HDmemcmp(zbuf, rbuf, (size_t)1536) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf2, rbuf + 1536, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(1536, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR;
- HDmemset(rbuf, 0, BIG_BUF_SIZE + 1536);
+ HDmemset(rbuf, 0, (size_t)(BIG_BUF_SIZE + 1536));
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1557,13 +1558,13 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(0, BIG_BUF_SIZE + 512, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(zbuf, rbuf, 512) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf2, rbuf + 512, BIG_BUF_SIZE) != 0) TEST_ERROR;
+ if(HDmemcmp(zbuf, rbuf, (size_t)512) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf2, rbuf + 512, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(512, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR;
- HDmemset(rbuf, 0, BIG_BUF_SIZE + 512);
+ HDmemset(rbuf, 0, (size_t)(BIG_BUF_SIZE + 512));
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1584,14 +1585,14 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(0, BIG_BUF_SIZE + 1536, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(wbuf, rbuf, 1024) != 0) TEST_ERROR;
- if(HDmemcmp(zbuf, rbuf + 1024, 512) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf2, rbuf + 1536, BIG_BUF_SIZE) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)1024) != 0) TEST_ERROR;
+ if(HDmemcmp(zbuf, rbuf + 1024, (size_t)512) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf2, rbuf + 1536, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(0, BIG_BUF_SIZE + 1536, zbuf) < 0) FAIL_STACK_ERROR;
- HDmemset(rbuf, 0, BIG_BUF_SIZE + 1536);
+ HDmemset(rbuf, 0, (size_t)(BIG_BUF_SIZE + 1536));
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1612,8 +1613,8 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(0, BIG_BUF_SIZE + 512, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(wbuf, rbuf, 512) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf2, rbuf + 512, BIG_BUF_SIZE) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)512) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf2, rbuf + 512, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1665,9 +1666,9 @@ test_random_write(const H5F_io_info_t *fio_info)
unsigned u; /* Local index variable */
/* Allocate space for the write & read buffers */
- wbuf = (uint8_t *)malloc(RANDOM_BUF_SIZE);
+ wbuf = (uint8_t *)HDmalloc((size_t)RANDOM_BUF_SIZE);
HDassert(wbuf);
- rbuf = (uint8_t *)calloc(RANDOM_BUF_SIZE, 1);
+ rbuf = (uint8_t *)HDcalloc((size_t)RANDOM_BUF_SIZE, (size_t)1);
HDassert(rbuf);
/* Initialize write buffer */
@@ -1685,9 +1686,9 @@ HDfprintf(stderr, "Random # seed was: %u\n", seed);
HDsrandom(seed);
/* Allocate space for the segment length buffer */
- off = (size_t *)malloc(MAX_RANDOM_SEGMENTS * sizeof(size_t));
+ off = (size_t *)HDmalloc(MAX_RANDOM_SEGMENTS * sizeof(size_t));
HDassert(off);
- len = (size_t *)malloc(MAX_RANDOM_SEGMENTS * sizeof(size_t));
+ len = (size_t *)HDmalloc(MAX_RANDOM_SEGMENTS * sizeof(size_t));
HDassert(len);
/* Randomly choose lengths of segments */
@@ -1751,7 +1752,7 @@ HDfprintf(stderr, "Random # seed was: %u\n", seed);
if(accum_read(RANDOM_BASE_OFF, RANDOM_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read back in */
- if(HDmemcmp(wbuf, rbuf, RANDOM_BUF_SIZE) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)RANDOM_BUF_SIZE) != 0) TEST_ERROR;
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1795,18 +1796,19 @@ accum_printf(void)
{
H5F_meta_accum_t * accum = &f->shared->accum;
- printf("\n");
- printf("Current contents of accumulator:\n");
- if (accum->alloc_size == 0) {
- printf("=====================================================\n");
- printf(" No accumulator allocated.\n");
- printf("=====================================================\n");
- } else {
- printf("=====================================================\n");
- printf(" accumulator allocated size == %zu\n", accum->alloc_size);
- printf(" accumulated data size == %zu\n", accum->size);
+ HDprintf("\n");
+ HDprintf("Current contents of accumulator:\n");
+ if(accum->alloc_size == 0) {
+ HDprintf("=====================================================\n");
+ HDprintf(" No accumulator allocated.\n");
+ HDprintf("=====================================================\n");
+ }
+ else {
+ HDprintf("=====================================================\n");
+ HDprintf(" accumulator allocated size == %zu\n", accum->alloc_size);
+ HDprintf(" accumulated data size == %zu\n", accum->size);
HDfprintf(stdout, " accumulator dirty? == %t\n", accum->dirty);
- printf("=====================================================\n");
+ HDprintf("=====================================================\n");
HDfprintf(stdout, " start of accumulated data, loc = %a\n", accum->loc);
if(accum->dirty) {
HDfprintf(stdout, " start of dirty region, loc = %a\n", (haddr_t)(accum->loc + accum->dirty_off));
@@ -1814,8 +1816,8 @@ accum_printf(void)
} /* end if */
HDfprintf(stdout, " end of accumulated data, loc = %a\n", (haddr_t)(accum->loc + accum->size));
HDfprintf(stdout, " end of accumulator allocation, loc = %a\n", (haddr_t)(accum->loc + accum->alloc_size));
- printf("=====================================================\n");
+ HDprintf("=====================================================\n");
}
- printf("\n\n");
+ HDprintf("\n\n");
} /* accum_printf() */
diff --git a/test/app_ref.c b/test/app_ref.c
index 3ef3fef..a4853fa 100644
--- a/test/app_ref.c
+++ b/test/app_ref.c
@@ -83,8 +83,8 @@ Abrt_Handler (int H5_ATTR_UNUSED sig)
int i, n;
for (i=0; i<T_NUMCLASSES; i++) {
- fprintf(stderr, "%s ID reference count: %n", IDNAME[i], &n);
- fprintf(stderr, "%*d\n", (n < ERR_WIDTH) ? (ERR_WIDTH - n) : 0, rc[i]);
+ HDfprintf(stderr, "%s ID reference count: %n", IDNAME[i], &n);
+ HDfprintf(stderr, "%*d\n", (n < ERR_WIDTH) ? (ERR_WIDTH - n) : 0, rc[i]);
}
}
@@ -195,7 +195,7 @@ main (void)
error:
- puts("***** APPLICATION REFERENCE COUNT TESTS FAILED *****");
+ HDputs("***** APPLICATION REFERENCE COUNT TESTS FAILED *****");
return 1;
}
diff --git a/test/big.c b/test/big.c
index c91aebb..30b715e 100644
--- a/test/big.c
+++ b/test/big.c
@@ -127,8 +127,8 @@ randll(hsize_t limit, int current_index)
/* does not overlap with any previous writes */
while(overlap != 0 && tries < MAX_TRIES)
{
- acc = HDrandom();
- acc *= HDrandom();
+ acc = (hsize_t)HDrandom();
+ acc *= (hsize_t)HDrandom();
acc = acc % limit;
overlap = 0;
@@ -524,7 +524,7 @@ reader(char *filename, hid_t fapl)
}
if(zero) {
H5_FAILED();
- printf(" %d zero%s\n", zero, 1 == zero ? "" : "s");
+ HDprintf(" %d zero%s\n", zero, 1 == zero ? "" : "s");
} else if(wrong) {
SKIPPED();
HDputs(" Possible overlap with another region.");
@@ -765,7 +765,7 @@ main (int ac, char **av)
family_size_def = (hsize_t)HDstrtoull(*av, NULL, 0);
}
else{
- printf("***Missing fsize value***\n");
+ HDprintf("***Missing fsize value***\n");
usage();
return 1;
}
@@ -799,7 +799,7 @@ main (int ac, char **av)
/* seed = (unsigned long)1155438845; */
HDfprintf(stderr, "Random # seed was: %lu\n", seed);
#endif /* QAK */
- HDsrandom(seed);
+ HDsrandom((unsigned)seed);
/* run VFD-specific test */
if(H5FD_SEC2 == driver) {
diff --git a/test/bittests.c b/test/bittests.c
index 21ced0f..c4dbf70 100644
--- a/test/bittests.c
+++ b/test/bittests.c
@@ -57,13 +57,13 @@ test_find (void)
n = H5T__bit_find(v1, (size_t)0, (size_t)0, H5T_BIT_LSB, TRUE);
if(-1 != n) {
H5_FAILED();
- puts (" Zero length test failed (lsb)!");
+ HDputs (" Zero length test failed (lsb)!");
goto failed;
}
n = H5T__bit_find(v1, (size_t)0, (size_t)0, H5T_BIT_MSB, TRUE);
if(-1 != n) {
H5_FAILED();
- puts (" Zero length test failed (msb)!");
+ HDputs (" Zero length test failed (msb)!");
goto failed;
}
@@ -73,30 +73,30 @@ test_find (void)
n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_LSB, TRUE);
if(-1 != n) {
H5_FAILED();
- puts (" Zero buffer test failed (lsb)!");
+ HDputs (" Zero buffer test failed (lsb)!");
goto failed;
}
n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_MSB, TRUE);
if(-1 != n) {
H5_FAILED();
- puts (" Zero buffer test failed (msb)!");
+ HDputs (" Zero buffer test failed (msb)!");
goto failed;
}
/* Try all combinations of one byte */
for(i = 0; i < 8 * (int)sizeof(v1); i++) {
HDmemset(v1, 0, sizeof v1);
- v1[i / 8] = 1 << (i % 8);
+ v1[i / 8] = (uint8_t)(1 << (i % 8));
n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_LSB, TRUE);
if((ssize_t)i != n) {
H5_FAILED();
- printf (" Test for set bit %d failed (lsb)!\n", i);
+ HDprintf (" Test for set bit %d failed (lsb)!\n", i);
goto failed;
}
n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_MSB, TRUE);
if((ssize_t)i != n) {
H5_FAILED();
- printf (" Test for set bit %d failed (msb)!\n", i);
+ HDprintf (" Test for set bit %d failed (msb)!\n", i);
goto failed;
}
}
@@ -106,30 +106,30 @@ test_find (void)
n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_LSB, FALSE);
if(-1 != n) {
H5_FAILED();
- puts (" One buffer test failed (lsb)!");
+ HDputs (" One buffer test failed (lsb)!");
goto failed;
}
n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_MSB, FALSE);
if(-1 != n) {
H5_FAILED();
- puts (" One buffer test failed (msb)!");
+ HDputs (" One buffer test failed (msb)!");
goto failed;
}
/* Try all combinations of one byte */
for (i=0; i<8*(int)sizeof(v1); i++) {
- memset (v1, 0xff, sizeof v1);
- v1[i/8] &= ~(1<<(i%8));
+ HDmemset(v1, 0xff, sizeof v1);
+ v1[i / 8] &= (uint8_t)~(1 << (i % 8));
n = H5T__bit_find (v1, (size_t)0, 8*sizeof(v1), H5T_BIT_LSB, FALSE);
if ((ssize_t)i!=n) {
H5_FAILED();
- printf (" Test for clear bit %d failed (lsb)!\n", i);
+ HDprintf (" Test for clear bit %d failed (lsb)!\n", i);
goto failed;
}
n = H5T__bit_find (v1, (size_t)0, 8*sizeof(v1), H5T_BIT_MSB, FALSE);
if ((ssize_t)i!=n) {
H5_FAILED();
- printf (" Test for clear bit %d failed (lsb)!\n", i);
+ HDprintf (" Test for clear bit %d failed (lsb)!\n", i);
goto failed;
}
}
@@ -139,9 +139,9 @@ test_find (void)
return 0;
failed:
- printf (" v = 0x");
- for (i=0; i<(int)sizeof(v1); i++) printf ("%02x", v1[i]);
- printf ("\n");
+ HDprintf (" v = 0x");
+ for (i=0; i<(int)sizeof(v1); i++) HDprintf ("%02x", v1[i]);
+ HDprintf ("\n");
return -1;
}
@@ -173,24 +173,24 @@ test_copy (void)
TESTING("bit copy operations");
for (i=0; i<NTESTS; i++) {
- s_offset = HDrand() % (8*sizeof v1);
- d_offset = HDrand() % (8*sizeof v2);
+ s_offset = (size_t)HDrand() % (8 * sizeof v1);
+ d_offset = (size_t)HDrand() % (8 * sizeof v2);
size = (unsigned)HDrand() % MIN (8*sizeof(v1), 8*sizeof(v2));
size = MIN3 (size, 8*sizeof(v1)-s_offset, 8*sizeof(v2)-d_offset);
- memset (v1, 0xff, sizeof v1);
- memset (v2, 0x00, sizeof v2);
+ HDmemset(v1, 0xff, sizeof v1);
+ HDmemset(v2, 0x00, sizeof v2);
/* Copy some bits to v2 and make sure something was copied */
H5T__bit_copy (v2, d_offset, v1, s_offset, size);
for (j=0; j<(int)sizeof(v2); j++) if (v2[j]) break;
if (size>0 && j>=(int)sizeof(v2)) {
H5_FAILED();
- puts (" Unabled to find copied region in destination");
+ HDputs (" Unabled to find copied region in destination");
goto failed;
}
if (0==size && j<(int)sizeof(v2)) {
H5_FAILED();
- puts (" Found copied bits when we shouldn't have");
+ HDputs (" Found copied bits when we shouldn't have");
goto failed;
}
@@ -199,25 +199,25 @@ test_copy (void)
n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_LSB, 1);
if (size>0 && n!=(ssize_t)d_offset) {
H5_FAILED();
- printf (" Unable to find first copied bit in destination "
+ HDprintf (" Unable to find first copied bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
if (0==size && n>=0) {
H5_FAILED();
- puts (" Found copied bits and shouldn't have!");
+ HDputs (" Found copied bits and shouldn't have!");
goto failed;
}
n = H5T__bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 0);
if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) {
H5_FAILED();
- printf (" Unable to find last copied bit in destination "
+ HDprintf (" Unable to find last copied bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
if (d_offset+size==8*sizeof(v2) && n>=0) {
H5_FAILED();
- puts (" High-order zeros are present and shouldn't be!");
+ HDputs (" High-order zeros are present and shouldn't be!");
goto failed;
}
@@ -228,25 +228,25 @@ test_copy (void)
n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_MSB, 1);
if (size>0 && (size_t)(n+1)!=d_offset+size) {
H5_FAILED();
- printf (" Unable to find last copied bit in destination "
+ HDprintf (" Unable to find last copied bit in destination "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
if (0==size && n>=0) {
H5_FAILED();
- puts (" Found copied bits but shouldn't have (reverse)!");
+ HDputs (" Found copied bits but shouldn't have (reverse)!");
goto failed;
}
n = H5T__bit_find (v2, (size_t)0, d_offset+size, H5T_BIT_MSB, 0);
if (d_offset>0 && n+1!=(ssize_t)d_offset) {
H5_FAILED();
- printf (" Unable to find beginning of copied data "
+ HDprintf (" Unable to find beginning of copied data "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
if (0==d_offset && n>=0) {
H5_FAILED();
- puts (" Found leading original data but shouldn't have!");
+ HDputs (" Found leading original data but shouldn't have!");
goto failed;
}
@@ -256,14 +256,14 @@ test_copy (void)
return 0;
failed:
- printf (" i=%d, s_offset=%lu, d_offset=%lu, size=%lu\n",
+ HDprintf (" i=%d, s_offset=%lu, d_offset=%lu, size=%lu\n",
i, (unsigned long)s_offset, (unsigned long)d_offset,
(unsigned long)size);
- printf (" s = 0x");
- for (j=sizeof(v1)-1; j>=0; --j) printf ("%02x", v1[j]);
- printf ("\n d = 0x");
- for (j=sizeof(v2)-1; j>=0; --j) printf ("%02x", v2[j]);
- printf ("\n");
+ HDprintf (" s = 0x");
+ for (j=sizeof(v1)-1; j>=0; --j) HDprintf ("%02x", v1[j]);
+ HDprintf ("\n d = 0x");
+ for (j=sizeof(v2)-1; j>=0; --j) HDprintf ("%02x", v2[j]);
+ HDprintf ("\n");
return -1;
}
@@ -295,23 +295,23 @@ test_shift (void)
TESTING("bit shift operations");
for (i=0; i<NTESTS; i++) {
- offset = HDrand() % (8*sizeof vector);
- size = (unsigned)HDrand() % (8*sizeof(vector)-offset);
+ offset = (size_t)HDrand() % (8 * sizeof vector);
+ size = (size_t)HDrand() % (8 * sizeof(vector) - offset);
/* Don't want size to be 0 */
if(size == 0) continue;
- shift_dist = HDrand() % size;
+ shift_dist = (ssize_t)((size_t)HDrand() % size);
/*-------- LEFT-shift some bits and make sure something was shifted --------*/
- memset (vector, 0x00, sizeof vector);
+ HDmemset(vector, 0x00, sizeof vector);
H5T__bit_set (vector, offset, size, 1);
H5T__bit_shift (vector, shift_dist, offset, size);
/* Look for the ones */
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
- if ((size_t)n!=offset+shift_dist) {
+ if(n != (ssize_t)offset + shift_dist) {
H5_FAILED();
- printf (" Unable to find first bit in destination "
+ HDprintf (" Unable to find first bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
@@ -323,13 +323,13 @@ test_shift (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
if (n!=(ssize_t)(offset+size-1)) {
H5_FAILED();
- printf (" Unable to find last bit in destination "
+ HDprintf (" Unable to find last bit in destination "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
/*-------- RIGHT-shift some bits and make sure something was shifted --------*/
- memset (vector, 0x00, sizeof vector);
+ HDmemset(vector, 0x00, sizeof vector);
H5T__bit_set (vector, offset, size, 1);
H5T__bit_shift (vector, -shift_dist, offset, size);
@@ -338,7 +338,7 @@ test_shift (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
if ((size_t)n!=offset) {
H5_FAILED();
- printf (" Unable to find first bit in destination "
+ HDprintf (" Unable to find first bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
@@ -348,9 +348,9 @@ test_shift (void)
* that reverse searches work as expected.
*/
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
- if (n!=(ssize_t)(offset+size-shift_dist-1)) {
+ if(n != (ssize_t)(offset + size) - shift_dist - 1) {
H5_FAILED();
- printf (" Unable to find last bit in destination "
+ HDprintf (" Unable to find last bit in destination "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
@@ -360,11 +360,11 @@ test_shift (void)
/* Randomly decide shift direction */
if(size % 2 == 0)
- shift_dist = size;
+ shift_dist = (ssize_t)size;
else
shift_dist = -((ssize_t)size);
- memset (vector, 0x00, sizeof vector);
+ HDmemset(vector, 0x00, sizeof vector);
H5T__bit_set (vector, offset, size, 1);
H5T__bit_shift (vector, shift_dist, offset, size);
@@ -373,7 +373,7 @@ test_shift (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
if (n >= 0) {
H5_FAILED();
- printf (" Unable to verify all bits are zero in destination(LSB) "
+ HDprintf (" Unable to verify all bits are zero in destination(LSB) "
"(n=%d)\n", (int)n);
goto failed;
}
@@ -382,7 +382,7 @@ test_shift (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
if (n >= 0) {
H5_FAILED();
- printf (" Unable to verify all bits are zero in destination(MSB) "
+ HDprintf (" Unable to verify all bits are zero in destination(MSB) "
"(n=%d)\n", (int)n);
goto failed;
}
@@ -392,11 +392,11 @@ test_shift (void)
return 0;
failed:
- printf (" i=%d, offset=%lu, size=%lu, shift_dist=%lu\n",
+ HDprintf (" i=%d, offset=%lu, size=%lu, shift_dist=%lu\n",
i, (unsigned long)offset, (unsigned long)size,
(unsigned long)shift_dist);
- for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]);
- printf ("\n");
+ for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]);
+ HDprintf ("\n");
return -1;
}
@@ -428,12 +428,12 @@ test_increment (void)
TESTING("bit increment operations");
for (i=0; i<NTESTS; i++) {
- offset = HDrand() % (8*sizeof vector);
- size = (unsigned)HDrand() % (8*sizeof(vector)-offset);
+ offset = (size_t)HDrand() % (8 * sizeof vector);
+ size = (size_t)HDrand() % (8 * sizeof(vector) - offset);
/* Don't want size to be 0 */
if(size == 0) continue;
- memset (vector, 0x00, sizeof vector);
+ HDmemset(vector, 0x00, sizeof vector);
if(size>1) /* if size=6, make a sequence like 011111 */
H5T__bit_set (vector, offset, size-1, 1);
else /* if size=1, just set this one bit to 1 */
@@ -446,13 +446,13 @@ test_increment (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
if (size!=1 && (size_t)n!=offset+size-1) {
H5_FAILED();
- printf (" Unable to find first bit in destination "
+ HDprintf (" Unable to find first bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
if(size==1 && n>=0) {
H5_FAILED();
- printf (" Unable to verify all-zero bit in destination "
+ HDprintf (" Unable to verify all-zero bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
@@ -464,13 +464,13 @@ test_increment (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
if (size!=1 && n!=(ssize_t)(offset+size-1)) {
H5_FAILED();
- printf (" Unable to find last bit in destination "
+ HDprintf (" Unable to find last bit in destination "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
if(size==1 && n>=0) {
H5_FAILED();
- printf (" Unable to verify all-zero bit in destination "
+ HDprintf (" Unable to verify all-zero bit in destination "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
@@ -480,10 +480,10 @@ test_increment (void)
return 0;
failed:
- printf (" i=%d, offset=%lu, size=%lu\n",
+ HDprintf (" i=%d, offset=%lu, size=%lu\n",
i, (unsigned long)offset, (unsigned long)size);
- for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]);
- printf ("\n");
+ for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]);
+ HDprintf ("\n");
return -1;
}
@@ -515,13 +515,13 @@ test_decrement (void)
TESTING("bit decrement operations");
for (i=0; i<NTESTS; i++) {
- offset = HDrand() % (8*sizeof vector);
- size = (unsigned)HDrand() % (8*sizeof(vector)-offset);
+ offset = (size_t)HDrand() % (8 * sizeof vector);
+ size = (size_t)HDrand() % (8 * sizeof(vector) - offset);
/* Don't want size to be 0 */
if(size == 0) continue;
/* All-zero sequence will become 111111(size=6) after decrement */
- memset (vector, 0x00, sizeof vector);
+ HDmemset(vector, 0x00, sizeof vector);
/* decrement the sequence by one */
H5T__bit_dec (vector, offset, size);
@@ -530,7 +530,7 @@ test_decrement (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
if ((size_t)n!=offset) {
H5_FAILED();
- printf (" Unable to find first bit in destination "
+ HDprintf (" Unable to find first bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
@@ -542,7 +542,7 @@ test_decrement (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
if (n!=(ssize_t)(offset+size-1)) {
H5_FAILED();
- printf (" Unable to find last bit in destination "
+ HDprintf (" Unable to find last bit in destination "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
@@ -552,10 +552,10 @@ test_decrement (void)
return 0;
failed:
- printf (" i=%d, offset=%lu, size=%lu\n",
+ HDprintf (" i=%d, offset=%lu, size=%lu\n",
i, (unsigned long)offset, (unsigned long)size);
- for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]);
- printf ("\n");
+ for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]);
+ HDprintf ("\n");
return -1;
}
@@ -587,13 +587,13 @@ test_negate (void)
TESTING("bit negate operations");
for (i=0; i<NTESTS; i++) {
- offset = HDrand() % (8*sizeof vector);
- size = (unsigned)HDrand() % (8*sizeof(vector)-offset);
+ offset = (size_t)HDrand() % (8 * sizeof vector);
+ size = (size_t)HDrand() % (8 * sizeof(vector) - offset);
/* Don't want size to be 0 */
if(size == 0) continue;
/* All-zero sequence will become 111111(size=6) after negating */
- memset (vector, 0x00, sizeof vector);
+ HDmemset(vector, 0x00, sizeof vector);
/* negate the sequence */
H5T__bit_neg (vector, offset, size);
@@ -602,7 +602,7 @@ test_negate (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
if ((size_t)n!=offset) {
H5_FAILED();
- printf (" Unable to find first bit in destination "
+ HDprintf (" Unable to find first bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
@@ -614,13 +614,13 @@ test_negate (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
if (n!=(ssize_t)(offset+size-1)) {
H5_FAILED();
- printf (" Unable to find last bit in destination "
+ HDprintf (" Unable to find last bit in destination "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
/* All-one sequence will become 000000(size=6) after negating */
- memset (vector, 0x00, sizeof vector);
+ HDmemset(vector, 0x00, sizeof vector);
H5T__bit_set (vector, offset, size, 1);
/* negate the sequence */
@@ -630,7 +630,7 @@ test_negate (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
if (n>=0) {
H5_FAILED();
- printf (" Unable to verify all-zero bits in destination "
+ HDprintf (" Unable to verify all-zero bits in destination "
"(n=%d)\n", (int)n);
goto failed;
}
@@ -642,7 +642,7 @@ test_negate (void)
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
if (n>=0) {
H5_FAILED();
- printf (" Unable to verify all-zero bits in destination "
+ HDprintf (" Unable to verify all-zero bits in destination "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
@@ -652,10 +652,10 @@ test_negate (void)
return 0;
failed:
- printf (" i=%d, offset=%lu, size=%lu\n",
+ HDprintf (" i=%d, offset=%lu, size=%lu\n",
i, (unsigned long)offset, (unsigned long)size);
- for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]);
- printf ("\n");
+ for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]);
+ HDprintf ("\n");
return -1;
}
@@ -687,22 +687,22 @@ test_set (void)
TESTING("bit set operations");
for (i=0; i<NTESTS; i++) {
- d_offset = HDrand() % (8*sizeof v2);
- size = (unsigned)HDrand() % (8*sizeof(v2));
+ d_offset = (size_t)HDrand() % (8 * sizeof v2);
+ size = (size_t)HDrand() % (8 * sizeof(v2));
size = MIN (size, 8*sizeof(v2)-d_offset);
- memset (v2, 0x00, sizeof v2);
+ HDmemset(v2, 0x00, sizeof v2);
/* Set some bits in v2 */
H5T__bit_set (v2, d_offset, size, TRUE);
for (j=0; j<(int)sizeof(v2); j++) if (v2[j]) break;
if (size>0 && j>=(int)sizeof(v2)) {
H5_FAILED();
- puts (" Unabled to find set region in buffer");
+ HDputs (" Unabled to find set region in buffer");
goto failed;
}
if (0==size && j<(int)sizeof(v2)) {
H5_FAILED();
- puts (" Found set bits when we shouldn't have");
+ HDputs (" Found set bits when we shouldn't have");
goto failed;
}
@@ -711,25 +711,25 @@ test_set (void)
n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_LSB, 1);
if (size>0 && n!=(ssize_t)d_offset) {
H5_FAILED();
- printf (" Unable to find first set bit in destination "
+ HDprintf (" Unable to find first set bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
if (0==size && n>=0) {
H5_FAILED();
- puts (" Found set bits and shouldn't have!");
+ HDputs (" Found set bits and shouldn't have!");
goto failed;
}
n = H5T__bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 0);
if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) {
H5_FAILED();
- printf (" Unable to find last set bit in destination "
+ HDprintf (" Unable to find last set bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
if (d_offset+size==8*sizeof(v2) && n>=0) {
H5_FAILED();
- puts (" High-order zeros are present and shouldn't be!");
+ HDputs (" High-order zeros are present and shouldn't be!");
goto failed;
}
@@ -740,25 +740,25 @@ test_set (void)
n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_MSB, 1);
if (size>0 && (size_t)(n+1)!=d_offset+size) {
H5_FAILED();
- printf (" Unable to find last set bit in destination "
+ HDprintf (" Unable to find last set bit in destination "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
if (0==size && n>=0) {
H5_FAILED();
- puts (" Found set bits but shouldn't have (reverse)!");
+ HDputs (" Found set bits but shouldn't have (reverse)!");
goto failed;
}
n = H5T__bit_find (v2, (size_t)0, d_offset+size, H5T_BIT_MSB, 0);
if (d_offset>0 && n+1!=(ssize_t)d_offset) {
H5_FAILED();
- printf (" Unable to find beginning of set bit region "
+ HDprintf (" Unable to find beginning of set bit region "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
if (0==d_offset && n>=0) {
H5_FAILED();
- puts (" Found leading zeros but shouldn't have!");
+ HDputs (" Found leading zeros but shouldn't have!");
goto failed;
}
@@ -768,11 +768,11 @@ test_set (void)
return 0;
failed:
- printf (" i=%d, d_offset=%lu, size=%lu\n",
+ HDprintf (" i=%d, d_offset=%lu, size=%lu\n",
i, (unsigned long)d_offset, (unsigned long)size);
- printf (" d = 0x");
- for (j=sizeof(v2)-1; j>=0; --j) printf ("%02x", v2[j]);
- printf ("\n");
+ HDprintf (" d = 0x");
+ for (j=sizeof(v2)-1; j>=0; --j) HDprintf ("%02x", v2[j]);
+ HDprintf ("\n");
return -1;
}
@@ -804,22 +804,22 @@ test_clear (void)
TESTING("bit clear operations");
for (i=0; i<NTESTS; i++) {
- d_offset = HDrand() % (8*sizeof v2);
- size = (unsigned)HDrand() % (8*sizeof(v2));
+ d_offset = (size_t)HDrand() % (8 * sizeof v2);
+ size = (size_t)HDrand() % (8 * sizeof(v2));
size = MIN (size, 8*sizeof(v2)-d_offset);
- memset (v2, 0xff, sizeof v2);
+ HDmemset(v2, 0xff, sizeof v2);
/* Clear some bits in v2 */
H5T__bit_set (v2, d_offset, size, FALSE);
for (j=0; j<(int)sizeof(v2); j++) if (0xff!=v2[j]) break;
if (size>0 && j>=(int)sizeof(v2)) {
H5_FAILED();
- puts (" Unabled to find cleared region in buffer");
+ HDputs (" Unabled to find cleared region in buffer");
goto failed;
}
if (0==size && j<(int)sizeof(v2)) {
H5_FAILED();
- puts (" Found cleared bits when we shouldn't have");
+ HDputs (" Found cleared bits when we shouldn't have");
goto failed;
}
@@ -828,25 +828,25 @@ test_clear (void)
n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_LSB, 0);
if (size>0 && n!=(ssize_t)d_offset) {
H5_FAILED();
- printf (" Unable to find first cleared bit in destination "
+ HDprintf (" Unable to find first cleared bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
if (0==size && n>=0) {
H5_FAILED();
- puts (" Found cleared bits and shouldn't have!");
+ HDputs (" Found cleared bits and shouldn't have!");
goto failed;
}
n = H5T__bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 1);
if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) {
H5_FAILED();
- printf (" Unable to find last cleared bit in destination "
+ HDprintf (" Unable to find last cleared bit in destination "
"(n=%d)\n", (int)n);
goto failed;
}
if (d_offset+size==8*sizeof(v2) && n>=0) {
H5_FAILED();
- puts (" High-order ones are present and shouldn't be!");
+ HDputs (" High-order ones are present and shouldn't be!");
goto failed;
}
@@ -857,25 +857,25 @@ test_clear (void)
n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_MSB, 0);
if (size>0 && (size_t)(n+1)!=d_offset+size) {
H5_FAILED();
- printf (" Unable to find last cleared bit in destination "
+ HDprintf (" Unable to find last cleared bit in destination "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
if (0==size && n>=0) {
H5_FAILED();
- puts (" Found cleared bits but shouldn't have (reverse)!");
+ HDputs (" Found cleared bits but shouldn't have (reverse)!");
goto failed;
}
n = H5T__bit_find (v2, (size_t)0, d_offset+size, H5T_BIT_MSB, 1);
if (d_offset>0 && n+1!=(ssize_t)d_offset) {
H5_FAILED();
- printf (" Unable to find beginning of cleared bit region "
+ HDprintf (" Unable to find beginning of cleared bit region "
"(reverse, n=%d)\n", (int)n);
goto failed;
}
if (0==d_offset && n>=0) {
H5_FAILED();
- puts (" Found leading ones but shouldn't have!");
+ HDputs (" Found leading ones but shouldn't have!");
goto failed;
}
@@ -885,11 +885,11 @@ test_clear (void)
return 0;
failed:
- printf (" i=%d, d_offset=%lu, size=%lu\n",
+ HDprintf (" i=%d, d_offset=%lu, size=%lu\n",
i, (unsigned long)d_offset, (unsigned long)size);
- printf (" d = 0x");
- for (j=sizeof(v2)-1; j>=0; --j) printf ("%02x", v2[j]);
- printf ("\n");
+ HDprintf (" d = 0x");
+ for (j=sizeof(v2)-1; j>=0; --j) HDprintf ("%02x", v2[j]);
+ HDprintf ("\n");
return -1;
}
@@ -928,11 +928,11 @@ main(void)
nerrors += test_negate() < 0 ? 1 : 0;
if(nerrors) {
- printf("***** %u FAILURE%s! *****\n",
+ HDprintf("***** %u FAILURE%s! *****\n",
nerrors, 1 == nerrors ? "" : "S");
- exit(1);
+ exit(EXIT_FAILURE);
}
- printf("All bit tests passed.\n");
+ HDprintf("All bit tests passed.\n");
H5close();
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index 4087f28..fd3bb30 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -100,15 +100,18 @@ typedef struct {
float f, g, h[16], i, j;
double k, l, m, n;
} stype1;
+
typedef struct {
int a, b, c[8], d, e;
float f, g, h[16], i, j;
double k, l, m, n;
long o, p, q;
} stype2;
+
typedef struct {
int a, b, c[8], d, e;
} stype3;
+
typedef struct {
int a, b, c[8], d, e;
float f, g, h[16], i, j;
diff --git a/test/dangle.c b/test/dangle.c
index ed5e3b8..b9cb284 100644
--- a/test/dangle.c
+++ b/test/dangle.c
@@ -15,10 +15,9 @@
* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
* Tuesday, May 13, 2003
*
- * Purpose: Test dangling IDs
+ * Purpose: Test dangling IDs
*/
#include "h5test.h"
-#include "H5private.h"
const char *FILENAME[] = {
"dangle",
@@ -32,17 +31,17 @@ const char *FILENAME[] = {
#define TYPENAME "Type"
#define ATTRNAME "Attribute"
-
+
/*-------------------------------------------------------------------------
- * Function: test_dangle_dataset
+ * Function: test_dangle_dataset
*
- * Purpose: Check for dangling dataset IDs causing problems on library
+ * Purpose: Check for dangling dataset IDs causing problems on library
* shutdown
*
- * Return: Success: zero
- * Failure: non-zero
+ * Return: Success: zero
+ * Failure: non-zero
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, May 13, 2003
*
* Modifications:
@@ -52,7 +51,7 @@ const char *FILENAME[] = {
static int
test_dangle_dataset(H5F_close_degree_t degree)
{
- char filename[1024];
+ char filename[1024];
hid_t fid; /* File ID */
hid_t fapl; /* File access property list */
hid_t dsid; /* Dataset ID */
@@ -128,17 +127,17 @@ error:
return 1;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_dangle_group
+ * Function: test_dangle_group
*
- * Purpose: Check for dangling group IDs causing problems on library
+ * Purpose: Check for dangling group IDs causing problems on library
* shutdown
*
- * Return: Success: zero
- * Failure: non-zero
+ * Return: Success: zero
+ * Failure: non-zero
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, May 13, 2003
*
* Modifications:
@@ -148,7 +147,7 @@ error:
static int
test_dangle_group(H5F_close_degree_t degree)
{
- char filename[1024];
+ char filename[1024];
hid_t fid; /* File ID */
hid_t fapl; /* File access property list */
hid_t gid; /* Group ID */
@@ -219,17 +218,17 @@ error:
return 1;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_dangle_datatype1
+ * Function: test_dangle_datatype1
*
- * Purpose: Check for dangling datatype IDs causing problems on library
+ * Purpose: Check for dangling datatype IDs causing problems on library
* shutdown
*
- * Return: Success: zero
- * Failure: non-zero
+ * Return: Success: zero
+ * Failure: non-zero
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, May 13, 2003
*
* Modifications:
@@ -239,7 +238,7 @@ error:
static int
test_dangle_datatype1(H5F_close_degree_t degree)
{
- char filename[1024];
+ char filename[1024];
hid_t fid; /* File ID */
hid_t fapl; /* File access property list */
hid_t tid; /* Datatype ID */
@@ -315,17 +314,17 @@ error:
return 1;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_dangle_datatype2
+ * Function: test_dangle_datatype2
*
- * Purpose: Check for dangling datatype IDs causing problems on library
+ * Purpose: Check for dangling datatype IDs causing problems on library
* shutdown
*
- * Return: Success: zero
- * Failure: non-zero
+ * Return: Success: zero
+ * Failure: non-zero
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, August 25, 2005
*
* Modifications:
@@ -335,7 +334,7 @@ error:
static int
test_dangle_datatype2(H5F_close_degree_t degree)
{
- char filename[1024];
+ char filename[1024];
hid_t fid; /* File ID */
hid_t fapl; /* File access property list */
hid_t did; /* Dataset ID */
@@ -402,17 +401,17 @@ error:
return 1;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_dangle_attribute
+ * Function: test_dangle_attribute
*
- * Purpose: Check for dangling attribute IDs causing problems on library
+ * Purpose: Check for dangling attribute IDs causing problems on library
* shutdown
*
- * Return: Success: zero
- * Failure: non-zero
+ * Return: Success: zero
+ * Failure: non-zero
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Wednesday, June 18, 2003
*
* Modifications:
@@ -422,7 +421,7 @@ error:
static int
test_dangle_attribute(H5F_close_degree_t degree)
{
- char filename[1024];
+ char filename[1024];
hid_t fid; /* File ID */
hid_t fapl; /* File access property list */
hid_t dsid; /* Dataset ID */
@@ -509,16 +508,16 @@ error:
return 1;
}
-
+
/*-------------------------------------------------------------------------
- * Function: main
+ * Function: main
*
- * Purpose: Executes dangling ID tests
+ * Purpose: Executes dangling ID tests
*
- * Return: Success: zero
- * Failure: non-zero
+ * Return: Success: zero
+ * Failure: non-zero
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, May 13, 2003
*
* Modifications:
@@ -528,7 +527,7 @@ error:
int
main(void)
{
- int nerrors=0;
+ int nerrors=0;
/* Run tests w/weak file close */
puts("Testing dangling objects with weak file close:");
diff --git a/test/dsets.c b/test/dsets.c
index 865948a..6bd0f7f 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -18,10 +18,7 @@
* Purpose: Tests the dataset interface (H5D)
*/
-#include <stdlib.h>
-#include <time.h>
-
-#include "h5test.h"
+#include "testhdf5.h"
#include "H5srcdir.h"
#ifdef H5_HAVE_SZLIB_H
# include "szlib.h"
@@ -57,39 +54,39 @@ const char *FILENAME[] = {
#define FILE_DEFLATE_NAME "deflate.h5"
/* Dataset names for testing filters */
-#define DSET_DEFAULT_NAME "default"
-#define DSET_CHUNKED_NAME "chunked"
-#define DSET_COMPACT_NAME "compact"
-#define DSET_SIMPLE_IO_NAME "simple_io"
-#define DSET_USERBLOCK_IO_NAME "userblock_io"
-#define DSET_COMPACT_IO_NAME "compact_io"
-#define DSET_COMPACT_MAX_NAME "max_compact"
-#define DSET_COMPACT_MAX2_NAME "max_compact_2"
-#define DSET_CONV_BUF_NAME "conv_buf"
-#define DSET_TCONV_NAME "tconv"
-#define DSET_DEFLATE_NAME "deflate"
-#define DSET_SHUFFLE_NAME "shuffle"
-#define DSET_FLETCHER32_NAME "fletcher32"
-#define DSET_FLETCHER32_NAME_2 "fletcher32_2"
-#define DSET_FLETCHER32_NAME_3 "fletcher32_3"
-#define DSET_SHUF_DEF_FLET_NAME "shuffle+deflate+fletcher32"
-#define DSET_SHUF_DEF_FLET_NAME_2 "shuffle+deflate+fletcher32_2"
+#define DSET_DEFAULT_NAME "default"
+#define DSET_CHUNKED_NAME "chunked"
+#define DSET_COMPACT_NAME "compact"
+#define DSET_SIMPLE_IO_NAME "simple_io"
+#define DSET_USERBLOCK_IO_NAME "userblock_io"
+#define DSET_COMPACT_IO_NAME "compact_io"
+#define DSET_COMPACT_MAX_NAME "max_compact"
+#define DSET_COMPACT_MAX2_NAME "max_compact_2"
+#define DSET_CONV_BUF_NAME "conv_buf"
+#define DSET_TCONV_NAME "tconv"
+#define DSET_DEFLATE_NAME "deflate"
+#define DSET_SHUFFLE_NAME "shuffle"
+#define DSET_FLETCHER32_NAME "fletcher32"
+#define DSET_FLETCHER32_NAME_2 "fletcher32_2"
+#define DSET_FLETCHER32_NAME_3 "fletcher32_3"
+#define DSET_SHUF_DEF_FLET_NAME "shuffle+deflate+fletcher32"
+#define DSET_SHUF_DEF_FLET_NAME_2 "shuffle+deflate+fletcher32_2"
#ifdef H5_HAVE_FILTER_SZIP
-#define DSET_SZIP_NAME "szip"
+#define DSET_SZIP_NAME "szip"
#define DSET_SHUF_SZIP_FLET_NAME "shuffle+szip+fletcher32"
-#define DSET_SHUF_SZIP_FLET_NAME_2 "shuffle+szip+fletcher32_2"
+#define DSET_SHUF_SZIP_FLET_NAME_2 "shuffle+szip+fletcher32_2"
#endif /* H5_HAVE_FILTER_SZIP */
-#define DSET_BOGUS_NAME "bogus"
-#define DSET_MISSING_NAME "missing"
-#define DSET_CAN_APPLY_NAME "can_apply"
-#define DSET_CAN_APPLY_NAME2 "can_apply2"
+#define DSET_BOGUS_NAME "bogus"
+#define DSET_MISSING_NAME "missing"
+#define DSET_CAN_APPLY_NAME "can_apply"
+#define DSET_CAN_APPLY_NAME2 "can_apply2"
#ifdef H5_HAVE_FILTER_SZIP
#define DSET_CAN_APPLY_SZIP_NAME "can_apply_szip"
#endif /* H5_HAVE_FILTER_SZIP */
-#define DSET_SET_LOCAL_NAME "set_local"
-#define DSET_SET_LOCAL_NAME_2 "set_local_2"
-#define DSET_ONEBYTE_SHUF_NAME "onebyte_shuffle"
+#define DSET_SET_LOCAL_NAME "set_local"
+#define DSET_SET_LOCAL_NAME_2 "set_local_2"
+#define DSET_ONEBYTE_SHUF_NAME "onebyte_shuffle"
#define DSET_NBIT_INT_NAME "nbit_int"
#define DSET_NBIT_FLOAT_NAME "nbit_float"
#define DSET_NBIT_DOUBLE_NAME "nbit_double"
@@ -105,27 +102,28 @@ const char *FILENAME[] = {
#define DSET_SCALEOFFSET_FLOAT_NAME_2 "scaleoffset_float_2"
#define DSET_SCALEOFFSET_DOUBLE_NAME "scaleoffset_double"
#define DSET_SCALEOFFSET_DOUBLE_NAME_2 "scaleoffset_double_2"
-#define DSET_COMPARE_DCPL_NAME "compare_dcpl"
-#define DSET_COMPARE_DCPL_NAME_2 "compare_dcpl_2"
-#define DSET_COPY_DCPL_NAME_1 "copy_dcpl_1"
-#define DSET_COPY_DCPL_NAME_2 "copy_dcpl_2"
-#define COPY_DCPL_EXTFILE_NAME "ext_file"
-#define DSET_DEPREC_NAME "deprecated"
-#define DSET_DEPREC_NAME_CHUNKED "deprecated_chunked"
-#define DSET_DEPREC_NAME_COMPACT "deprecated_compact"
-#define DSET_DEPREC_NAME_FILTER "deprecated_filter"
+#define DSET_COMPARE_DCPL_NAME "compare_dcpl"
+#define DSET_COMPARE_DCPL_NAME_2 "compare_dcpl_2"
+#define DSET_COPY_DCPL_NAME_1 "copy_dcpl_1"
+#define DSET_COPY_DCPL_NAME_2 "copy_dcpl_2"
+#define COPY_DCPL_EXTFILE_NAME "ext_file"
+#define DSET_DEPREC_NAME "deprecated"
+#define DSET_DEPREC_NAME_CHUNKED "deprecated_chunked"
+#define DSET_DEPREC_NAME_COMPACT "deprecated_compact"
+#define DSET_DEPREC_NAME_FILTER "deprecated_filter"
#define USER_BLOCK 1024
#define SIXTY_FOUR_KB 65536
/* Temporary filter IDs used for testing */
-#define H5Z_FILTER_BOGUS 305
-#define H5Z_FILTER_CORRUPT 306
+#define H5Z_FILTER_BOGUS 305
+#define H5Z_FILTER_CORRUPT 306
#define H5Z_FILTER_CAN_APPLY_TEST 307
#define H5Z_FILTER_SET_LOCAL_TEST 308
-#define H5Z_FILTER_DEPREC 309
-#define H5Z_FILTER_EXPAND 310
-#define H5Z_FILTER_CAN_APPLY_TEST2 311
+#define H5Z_FILTER_DEPREC 309
+#define H5Z_FILTER_EXPAND 310
+#define H5Z_FILTER_CAN_APPLY_TEST2 311
+#define H5Z_FILTER_COUNT 312
/* Flags for testing filters */
#define DISABLE_FLETCHER32 0
@@ -154,10 +152,10 @@ const char *FILENAME[] = {
/* Names for noencoder test */
#ifdef H5_HAVE_FILTER_SZIP
-#define NOENCODER_FILENAME "noencoder.h5"
+#define NOENCODER_FILENAME "noencoder.h5"
#define NOENCODER_COPY_FILENAME "noencoder.h5.copy"
-#define NOENCODER_TEST_DATASET "noencoder_tdset.h5"
-#define NOENCODER_SZIP_DATASET "noencoder_szip_dset.h5"
+#define NOENCODER_TEST_DATASET "noencoder_tdset.h5"
+#define NOENCODER_SZIP_DATASET "noencoder_szip_dset.h5"
#define NOENCODER_SZIP_SHUFF_FLETCH_DATASET "noencoder_szip_shuffle_fletcher_dset.h5"
#endif /* H5_HAVE_FILTER_SZIP */
@@ -207,39 +205,34 @@ double points_dbl[DSET_DIM1][DSET_DIM2], check_dbl[DSET_DIM1][DSET_DIM2];
/* Local prototypes for filter functions */
static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+ const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
static htri_t can_apply_bogus(hid_t dcpl_id, hid_t type_id, hid_t space_id);
static herr_t set_local_bogus2(hid_t dcpl_id, hid_t type_id, hid_t space_id);
static size_t filter_bogus2(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+ const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
static size_t filter_bogus3(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+ const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
static size_t filter_corrupt(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+ const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
static size_t filter_expand(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+ const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+
-
/*-------------------------------------------------------------------------
- * Function: test_create
+ * Function: test_create
*
- * Purpose: Attempts to create a dataset.
+ * Purpose: Attempts to create a dataset.
*
* Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Tuesday, December 9, 1997
- *
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
test_create(hid_t file)
{
- hid_t dataset, space, small_space, create_parms;
+ hid_t dataset, space, small_space, create_parms;
hsize_t dims[2], small_dims[2];
- herr_t status;
+ herr_t status;
hsize_t csize[2];
TESTING("create, open, close");
@@ -281,9 +274,9 @@ test_create(hid_t file)
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
} H5E_END_TRY;
if(dataset >= 0) {
- H5_FAILED();
- puts(" Library allowed overwrite of existing dataset.");
- goto error;
+ H5_FAILED();
+ HDputs(" Library allowed overwrite of existing dataset.");
+ goto error;
}
/*
@@ -300,12 +293,12 @@ test_create(hid_t file)
* reporting.
*/
H5E_BEGIN_TRY {
- dataset = H5Dopen2(file, "does_not_exist", H5P_DEFAULT);
+ dataset = H5Dopen2(file, "does_not_exist", H5P_DEFAULT);
} H5E_END_TRY;
if(dataset >= 0) {
- H5_FAILED();
- puts(" Opened a non-existent dataset.");
- goto error;
+ H5_FAILED();
+ HDputs(" Opened a non-existent dataset.");
+ goto error;
}
/*
@@ -325,9 +318,9 @@ test_create(hid_t file)
H5P_DEFAULT, create_parms, H5P_DEFAULT);
} H5E_END_TRY;
if(dataset >= 0) {
- H5_FAILED();
- puts(" Opened a dataset with incorrect chunking parameters.");
- goto error;
+ H5_FAILED();
+ HDputs(" Opened a dataset with incorrect chunking parameters.");
+ goto error;
}
csize[0] = 5;
@@ -365,44 +358,39 @@ test_create(hid_t file)
if(H5Dclose(dataset) < 0) goto error;
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
+ return FAIL;
+} /* end test_create() */
+
-
/*-------------------------------------------------------------------------
- * Function: test_simple_io
+ * Function: test_simple_io
*
* Purpose: Tests simple I/O. That is, reading and writing a complete
* multi-dimensional array without data type or data space
* conversions, without compression, and stored contiguously.
*
* Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Wednesday, December 10, 1997
- *
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
test_simple_io(const char *env_h5_drvr, hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t file, dataset, space, xfer;
- int i, j, n;
- hsize_t dims[2];
+ char filename[FILENAME_BUF_SIZE];
+ hid_t file = -1, dataset = -1, space = -1, xfer = -1;
+ int i, j, n;
+ hsize_t dims[2];
void *tconv_buf = NULL;
- int f;
- haddr_t offset;
- int rdata[DSET_DIM1][DSET_DIM2];
+ int f = -1;
+ haddr_t offset;
+ int rdata[DSET_DIM1][DSET_DIM2];
TESTING("simple I/O");
- /* Can't run this test with multi-file VFDs */
+ /* Can't run this test with multi-file VFDs because of HDopen/read/seek the file directly */
if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) {
h5_fixname(FILENAME[4], fapl, filename, sizeof filename);
@@ -428,6 +416,8 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl)
/* Create the dataset */
if((dataset = H5Dcreate2(file, DSET_SIMPLE_IO_NAME, H5T_NATIVE_INT, space,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
+ if(H5Sclose(space) < 0) TEST_ERROR
+ space = -1;
/* Test dataset address. Should be undefined. */
if(H5Dget_offset(dataset) != HADDR_UNDEF) goto error;
@@ -450,78 +440,90 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl)
for(j = 0; j < DSET_DIM2; j++) {
if(points[i][j] != check[i][j]) {
H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %d,%d\n", i, j);
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %d,%d\n", i, j);
goto error;
}
}
}
if(H5Pclose (xfer) < 0) goto error;
+ xfer = -1;
if(H5Dclose(dataset) < 0) goto error;
+ dataset = -1;
if(H5Fclose(file) < 0) goto error;
+ file = -1;
f = HDopen(filename, O_RDONLY, 0);
HDlseek(f, (off_t)offset, SEEK_SET);
- HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2);
+ if(HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0)
+ goto error;
/* Check that the values read are the same as the values written */
for(i = 0; i < DSET_DIM1; i++) {
for(j = 0; j < DSET_DIM2; j++) {
if(points[i][j] != rdata[i][j]) {
H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %d,%d\n", i, j);
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %d,%d\n", i, j);
goto error;
}
}
}
HDclose(f);
+ f = -1;
- HDfree (tconv_buf);
+ HDfree(tconv_buf);
PASSED();
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support continuous address space");
+ SKIPPED();
+ HDputs(" Current VFD doesn't support continuous address space");
} /* end else */
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
+ if(space > 0)
+ if(H5Sclose(space) < 0) TEST_ERROR
+ if(xfer > 0)
+ if(H5Pclose(xfer) < 0) TEST_ERROR
+ if(dataset > 0)
+ if(H5Dclose(dataset) < 0) TEST_ERROR
+ if(file > 0)
+ if(H5Fclose(file) < 0) TEST_ERROR
+ if(f > 0)
+ HDclose(f);
+ if(tconv_buf)
+ HDfree(tconv_buf);
+ return FAIL;
+} /* end test_simple_io() */
+
-
/*-------------------------------------------------------------------------
- * Function: test_userblock_offset
+ * Function: test_userblock_offset
*
- * Purpose: Tests H5Dget_offset when user block exists.
+ * Purpose: Tests H5Dget_offset when user block exists.
*
* Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Raymond Lu
- * Wednesday, November 27, 2002
- *
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
test_userblock_offset(const char *env_h5_drvr, hid_t fapl)
{
char filename[FILENAME_BUF_SIZE];
- hid_t file, fcpl, dataset, space;
- int i, j;
- hsize_t dims[2];
- int f;
+ hid_t file = -1, fcpl = -1, dataset = -1, space = -1;
+ int i, j;
+ hsize_t dims[2];
+ int f = -1;
haddr_t offset;
int rdata[DSET_DIM1][DSET_DIM2];
TESTING("dataset offset with user block");
- /* Can't run this test with multi-file VFDs */
+ /* Can't run this test with multi-file VFDs because of HDopen/read/seek the file directly */
if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) {
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
@@ -530,6 +532,8 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl)
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
goto error;
+ if(H5Pclose(fcpl) < 0) TEST_ERROR
+ fcpl = -1;
/* Create the data space */
dims[0] = DSET_DIM1;
@@ -539,6 +543,8 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl)
/* Create the dataset */
if((dataset = H5Dcreate2(file, DSET_USERBLOCK_IO_NAME, H5T_NATIVE_INT, space,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
+ if(H5Sclose(space) < 0) TEST_ERROR
+ space = -1;
/* Write the data to the dataset */
if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
@@ -550,40 +556,54 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl)
if((offset = H5Dget_offset(dataset)) == HADDR_UNDEF) goto error;
if(H5Dclose(dataset) < 0) goto error;
+ dataset = -1;
if(H5Fclose(file) < 0) goto error;
+ file = -1;
f = HDopen(filename, O_RDONLY, 0);
HDlseek(f, (off_t)offset, SEEK_SET);
- HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2);
+ if(HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0)
+ goto error;
/* Check that the values read are the same as the values written */
for(i = 0; i < DSET_DIM1; i++) {
for(j = 0; j < DSET_DIM2; j++) {
if(points[i][j] != rdata[i][j]) {
H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %d,%d\n", i, j);
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %d,%d\n", i, j);
goto error;
}
}
}
HDclose(f);
+ f = -1;
PASSED();
} /* end if */
else {
- SKIPPED();
- puts(" Current VFD doesn't support continuous address space");
+ SKIPPED();
+ HDputs(" Current VFD doesn't support continuous address space");
} /* end else */
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
+ if(space > 0)
+ if(H5Sclose(space) < 0) TEST_ERROR
+ if(fcpl > 0)
+ if(H5Pclose(fcpl) < 0) TEST_ERROR
+ if(dataset > 0)
+ if(H5Dclose(dataset) < 0) TEST_ERROR
+ if(file > 0)
+ if(H5Fclose(file) < 0) TEST_ERROR
+ if(f > 0)
+ HDclose(f);
+ return FAIL;
+} /* end test_userblock_offset() */
+
-
/*-------------------------------------------------------------------------
* Function: test_compact_io
*
@@ -593,12 +613,7 @@ error:
* compact dataset.
*
* Return: Success: 0
- *
* Failure: -1
- *
- * Programmer: Raymond Lu
- * August 8, 2002
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -667,24 +682,31 @@ test_compact_io(hid_t fapl)
for(j = 0; j < 8; j++)
if(rbuf[i][j] != wbuf[i][j]) {
H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %d,%d\n", i, j);
- printf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]);
- printf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]);
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %d,%d\n", i, j);
+ HDprintf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]);
+ HDprintf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]);
goto error;
- } /* end if */
+ } /* end */
if(H5Dclose(dataset) < 0) TEST_ERROR
if(H5Fclose(file) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
+ H5E_BEGIN_TRY {
+ H5Sclose(space);
+ H5Pclose(plist);
+ H5Dclose(dataset);
+ H5Fclose(file);
+ } H5E_END_TRY;
+
+ return FAIL;
+} /* end test_compact_io() */
+
-
/*-------------------------------------------------------------------------
* Function: test_max_compact
*
@@ -692,10 +714,6 @@ test_compact_io(hid_t fapl)
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Raymond Lu
- * August 8, 2002
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -709,7 +727,7 @@ test_max_compact(hid_t fapl)
size_t compact_size;
int *wbuf = NULL;
int *rbuf = NULL;
- char filename[FILENAME_BUF_SIZE];
+ char filename[FILENAME_BUF_SIZE];
int n;
size_t u;
@@ -776,8 +794,8 @@ test_max_compact(hid_t fapl)
for(u = 0; u < compact_size; u++)
if(rbuf[u] != wbuf[u]) {
H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %u\n", (unsigned)u);
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %u\n", (unsigned)u);
goto error;
} /* end if */
@@ -822,7 +840,7 @@ test_max_compact(hid_t fapl)
FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
if(wbuf)
@@ -838,10 +856,10 @@ error:
H5Fclose(file);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end test_max_compact() */
-
+
/*-------------------------------------------------------------------------
* Function: test_layout_extend
*
@@ -854,9 +872,6 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Vailin Choi; August 2010
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -950,7 +965,7 @@ test_layout_extend(hid_t fapl)
if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -964,22 +979,17 @@ error:
H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end test_layout_extend() */
-
+
/*-------------------------------------------------------------------------
- * Function: test_conv_buffer
+ * Function: test_conv_buffer
*
- * Purpose: Test size of data type conversion buffer.
+ * Purpose: Test size of data type conversion buffer.
*
* Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Raymond Lu
- * Monday, May 12, 2003
- *
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1004,14 +1014,19 @@ test_conv_buffer(hid_t fid)
CmpField *cf = NULL;
CmpFieldR *cfrR = NULL;
- hid_t dataset = -1; /* dataset ID */
- hid_t space = -1; /* data space ID */
- hid_t ctype1, ctype2; /* data type ID */
- hid_t arr_type1, arr_type2, arr_type3, arr_type4, arr_type5;
+ hid_t dataset = H5I_INVALID_HID; /* dataset ID */
+ hid_t space = H5I_INVALID_HID; /* data space ID */
+ hid_t ctype1 = H5I_INVALID_HID,
+ ctype2 = H5I_INVALID_HID; /* data type ID */
+ hid_t arr_type1 = H5I_INVALID_HID,
+ arr_type2 = H5I_INVALID_HID,
+ arr_type3 = H5I_INVALID_HID,
+ arr_type4 = H5I_INVALID_HID,
+ arr_type5 = H5I_INVALID_HID;
hsize_t dimsa[3];
hsize_t dimsb[1];
hsize_t dimsc[1];
- hid_t xfer_list;
+ hid_t xfer_list = H5I_INVALID_HID;
size_t size;
TESTING("data type conversion buffer size");
@@ -1020,15 +1035,15 @@ test_conv_buffer(hid_t fid)
/* Populate the data members */
for(j = 0; j < DIM1; j++)
- for(k = 0; k < DIM2; k++)
- for(l = 0; l < DIM3; l++)
- cf->a[j][k][l] = 10*(j+1) + l + k;
+ for(k = 0; k < DIM2; k++)
+ for(l = 0; l < DIM3; l++)
+ cf->a[j][k][l] = 10*(j+1) + l + k;
for(j = 0; j < DIM2; j++)
- cf->b[j] = (float)(100.0f*(j+1) + 0.01f*j);
+ cf->b[j] = 100.0f * (float)(j+1) + 0.01f * (float)j;
for(j = 0; j < DIM3; j++)
- cf->c[j] = 100.0f*(j+1) + 0.02f*j;
+ cf->c[j] = 100.0f * (float)(j+1) + 0.02f * (float)j;
/* Create data space */
@@ -1079,7 +1094,7 @@ test_conv_buffer(hid_t fid)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- puts(" Library shouldn't allow conversion buffer too small");
+ HDputs(" Library shouldn't allow conversion buffer too small");
goto error;
}
@@ -1104,26 +1119,34 @@ test_conv_buffer(hid_t fid)
HDfree(cf);
HDfree(cfrR);
- puts(" PASSED");
- return(0);
+ HDputs(" PASSED");
+ return SUCCEED;
error:
- return -1;
-}
+ H5E_BEGIN_TRY {
+ H5Pclose(xfer_list);
+ H5Sclose(space);
+ H5Tclose(arr_type1);
+ H5Tclose(arr_type2);
+ H5Tclose(arr_type3);
+ H5Tclose(ctype1);
+ H5Tclose(ctype2);
+ H5Tclose(arr_type4);
+ H5Tclose(arr_type5);
+ H5Dclose(dataset);
+ } H5E_END_TRY;
+
+ return FAIL;
+} /* end test_conv_buffer() */
+
-
/*-------------------------------------------------------------------------
- * Function: test_tconv
+ * Function: test_tconv
*
- * Purpose: Test some simple data type conversion stuff.
+ * Purpose: Test some simple data type conversion stuff.
*
* Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Wednesday, January 14, 1998
- *
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1173,7 +1196,7 @@ test_tconv(hid_t file)
in[4 * i + 2] != out[4 * i + 1] ||
in[4 * i + 3] != out[4 * i + 0]) {
H5_FAILED();
- puts(" Read with byte order conversion failed.");
+ HDputs(" Read with byte order conversion failed.");
goto error;
}
}
@@ -1183,8 +1206,8 @@ test_tconv(hid_t file)
HDfree(out);
HDfree(in);
- puts(" PASSED");
- return 0;
+ HDputs(" PASSED");
+ return SUCCEED;
error:
if(out)
@@ -1197,8 +1220,8 @@ error:
H5Sclose(space);
} H5E_END_TRY;
- return -1;
-}
+ return FAIL;
+} /* end test_tconv() */
/* This message derives from H5Z */
const H5Z_class2_t H5Z_BOGUS[1] = {{
@@ -1211,19 +1234,15 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{
filter_bogus, /* The actual filter function */
}};
-
+
/*-------------------------------------------------------------------------
- * Function: can_apply_bogus
+ * Function: can_apply_bogus
*
- * Purpose: A bogus 'can apply' callback that returns 0 for H5T_NATIVE_DOUBLE
- * dataype, but returns 1 for all other datatypes
+ * Purpose: A bogus 'can apply' callback that returns 0 for H5T_NATIVE_DOUBLE
+ * dataype, but returns 1 for all other datatypes
*
* Return: Success: Described above
- * Failure: 0
- *
- * Programmer: Quincey Koziol
- * Friday, April 5, 2003
- *
+ * Failure: 0
*-------------------------------------------------------------------------
*/
static htri_t
@@ -1235,21 +1254,16 @@ can_apply_bogus(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSE
return 1;
else
return -1;
-}
+} /* end can_apply_bogus() */
+
-
/*-------------------------------------------------------------------------
- * Function: filter_bogus
+ * Function: filter_bogus
*
- * Purpose: A bogus compression method that doesn't do anything.
+ * Purpose: A bogus compression method that doesn't do anything.
*
* Return: Success: Data chunk size
- *
- * Failure: 0
- *
- * Programmer: Robb Matzke
- * Tuesday, April 21, 1998
- *
+ * Failure: 0
*-------------------------------------------------------------------------
*/
static size_t
@@ -1258,22 +1272,18 @@ filter_bogus(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf)
{
return nbytes;
-}
+} /* end filter_bogus() */
+
-
/*-------------------------------------------------------------------------
- * Function: set_local_bogus2
+ * Function: set_local_bogus2
*
- * Purpose: A 'set local' callback that stores the size of the datatype
- * and adds it to all the H5T_NATIVE_INT values during
- * filter operation.
+ * Purpose: A 'set local' callback that stores the size of the datatype
+ * and adds it to all the H5T_NATIVE_INT values during
+ * filter operation.
*
* Return: Success: non-negative
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Friday, April 5, 2003
- *
+ * Failure: negative
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1310,21 +1320,17 @@ set_local_bogus2(hid_t dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSED space_id)
return(SUCCEED);
} /* end set_local_bogus2() */
-
+
/*-------------------------------------------------------------------------
- * Function: filter_bogus2
+ * Function: filter_bogus2
*
- * Purpose: A filter method that adds a value to data values on writing
- * (if the parameter is set), but does not modify data values on
- * reading (so that correct operation of the filter can be
- * checked).
+ * Purpose: A filter method that adds a value to data values on writing
+ * (if the parameter is set), but does not modify data values on
+ * reading (so that correct operation of the filter can be
+ * checked).
*
* Return: Success: Data chunk size
- * Failure: 0
- *
- * Programmer: Quincey Koziol
- * Monday, April 7, 2003
- *
+ * Failure: 0
*-------------------------------------------------------------------------
*/
static size_t
@@ -1366,21 +1372,16 @@ filter_bogus2(unsigned int flags, size_t cd_nelmts,
/* Filter is "no op" */
else
return(nbytes);
-}
+} /* end filter_bogus2() */
+
-
/*-------------------------------------------------------------------------
- * Function: filter_bogus3
+ * Function: filter_bogus3
*
- * Purpose: A bogus compression method that returns a failure.
+ * Purpose: A bogus compression method that returns a failure.
*
* Return: Success: Data chunk size
- *
- * Failure: 0
- *
- * Programmer: Raymond Lu
- * 4 August 2010
- *
+ * Failure: 0
*-------------------------------------------------------------------------
*/
static size_t
@@ -1389,7 +1390,7 @@ filter_bogus3(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts
size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf)
{
return 0;
-}
+} /* end filter_bogus3() */
/* This message derives from H5Z */
const H5Z_class2_t H5Z_CORRUPT[1] = {{
@@ -1402,21 +1403,16 @@ const H5Z_class2_t H5Z_CORRUPT[1] = {{
filter_corrupt, /* The actual filter function */
}};
-
+
/*-------------------------------------------------------------------------
- * Function: filter_corrupt
+ * Function: filter_corrupt
*
- * Purpose: For testing Fletcher32 checksum. modify data slightly during
- * writing so that when data is read back, the checksum should
- * fail.
+ * Purpose: For testing Fletcher32 checksum. modify data slightly during
+ * writing so that when data is read back, the checksum should
+ * fail.
*
* Return: Success: Data chunk size
- *
- * Failure: 0
- *
- * Programmer: Raymond Lu
- * Jan 14, 2003
- *
+ * Failure: 0
*-------------------------------------------------------------------------
*/
static size_t
@@ -1466,17 +1462,13 @@ error:
return ret_value;
} /* end filter_corrupt() */
-
+
/*-------------------------------------------------------------------------
* Function: filter_cb_cont
*
* Purpose: Callback function to handle checksum failure. Let it continue.
*
* Return: continue
- *
- * Programmer: Raymond Lu
- * Jan 14, 2003
- *
*-------------------------------------------------------------------------
*/
static H5Z_cb_return_t
@@ -1487,19 +1479,15 @@ filter_cb_cont(H5Z_filter_t filter, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNU
return H5Z_CB_CONT;
else
return H5Z_CB_FAIL;
-}
+} /* end filter_cb_cont() */
+
-
/*-------------------------------------------------------------------------
* Function: filter_cb_fail
*
* Purpose: Callback function to handle checksum failure. Let it fail.
*
* Return: fail
- *
- * Programmer: Raymond Lu
- * Jan 14, 2003
- *
*-------------------------------------------------------------------------
*/
static H5Z_cb_return_t
@@ -1510,39 +1498,35 @@ filter_cb_fail(H5Z_filter_t filter, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNU
return H5Z_CB_FAIL;
else
return H5Z_CB_CONT;
-}
+} /* end filter_cb_fail() */
+
-
/*-------------------------------------------------------------------------
- * Function: test_filter_internal
+ * Function: test_filter_internal
*
- * Purpose: Tests dataset compression. If compression is requested when
- * it hasn't been compiled into the library (such as when
- * updating an existing compressed dataset) then data is sent to
- * the file uncompressed but no errors are returned.
+ * Purpose: Tests dataset compression. If compression is requested when
+ * it hasn't been compiled into the library (such as when
+ * updating an existing compressed dataset) then data is sent to
+ * the file uncompressed but no errors are returned.
*
* Return: Success: 0
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Wednesday, April 15, 1998
- *
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
int corrupted, hsize_t *dset_size)
{
- hid_t dataset; /* Dataset ID */
- hid_t dxpl; /* Dataset xfer property list ID */
- hid_t write_dxpl; /* Dataset xfer property list ID for writing */
- hid_t sid; /* Dataspace ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t dxpl; /* Dataset xfer property list ID */
+ hid_t write_dxpl; /* Dataset xfer property list ID for writing */
+ hid_t sid; /* 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 */
- size_t i, j, n; /* Local index variables */
- herr_t status; /* Error status */
+ void *tconv_buf = NULL; /* Temporary conversion buffer */
+ size_t i, j, n; /* Local index variables */
+ herr_t status; /* Error status */
/* Create the data space */
if((sid = H5Screate_simple(2, size, NULL)) < 0) goto error;
@@ -1568,7 +1552,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
/* Check if all the filters are available */
if(H5Pall_filters_avail(dcpl)!=TRUE) {
H5_FAILED();
- printf(" Line %d: Incorrect filter availability\n",__LINE__);
+ HDprintf(" Line %d: Incorrect filter availability\n",__LINE__);
goto error;
} /* end if */
@@ -1591,8 +1575,8 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
for(j=0; j<(size_t)size[1]; j++) {
if(0!=check[i][j]) {
H5_FAILED();
- printf(" Read a non-zero value.\n");
- printf(" At index %lu,%lu\n",
+ HDprintf(" Read a non-zero value.\n");
+ HDprintf(" At index %lu,%lu\n",
(unsigned long)i, (unsigned long)j);
goto error;
}
@@ -1608,13 +1592,13 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
TESTING(" filters (write)");
for(i=n=0; i<size[0]; i++) {
- for(j=0; j<size[1]; j++) {
- points[i][j] = (int)(n++);
- }
+ 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;
+ TEST_ERROR;
if((*dset_size=H5Dget_storage_size(dataset))==0) TEST_ERROR;
@@ -1647,22 +1631,23 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
} H5E_END_TRY;
if(status>=0) TEST_ERROR;
- } else {
+ }
+ else {
if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
- TEST_ERROR;
+ 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();
- fprintf(stderr," Read different values than written.\n");
- fprintf(stderr," At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
- fprintf(stderr," At original: %d\n", (int)points[i][j]);
- fprintf(stderr," At returned: %d\n", (int)check[i][j]);
- goto error;
- }
- }
+ 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]);
+ goto error;
+ }
+ }
}
}
@@ -1678,12 +1663,12 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
TESTING(" filters (modify)");
for(i=0; i<size[0]; i++) {
- for(j=0; j<size[1]/2; j++) {
- points[i][j] = (int)HDrandom ();
- }
+ for(j=0; j<size[1]/2; j++) {
+ points[i][j] = (int)HDrandom ();
+ }
}
if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points) < 0)
- TEST_ERROR;
+ TEST_ERROR;
if(corrupted) {
/* Default behavior is failure when data is corrupted. */
@@ -1705,22 +1690,23 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
} H5E_END_TRY;
if(status>=0) TEST_ERROR;
- } else {
+ }
+ else {
/* Read the dataset back and check it */
if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
- TEST_ERROR;
+ 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();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n",
- (unsigned long)i, (unsigned long)j);
- goto error;
- }
- }
+ 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);
+ goto error;
+ }
+ }
}
}
@@ -1766,14 +1752,14 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
/* 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();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n",
- (unsigned long)i, (unsigned long)j);
- goto error;
- } /* end if */
+ 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);
+ goto error;
+ } /* end if */
} /* end else */
PASSED();
@@ -1788,9 +1774,9 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
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();
- }
+ 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();
+ }
}
if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size,
NULL) < 0) TEST_ERROR;
@@ -1818,61 +1804,60 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
} H5E_END_TRY;
if(status>=0) TEST_ERROR;
- } else {
+ }
+ else {
if(H5Dread (dataset, H5T_NATIVE_INT, sid, sid, dxpl, check) < 0)
- TEST_ERROR;
+ 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();
- fprintf(stderr," Read different values than written.\n");
- fprintf(stderr," At index %lu,%lu\n",
- (unsigned long)((size_t)hs_offset[0]+i),
- (unsigned long)((size_t)hs_offset[1]+j));
- fprintf(stderr," At original: %d\n",
- (int)points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]);
- fprintf(stderr," At returned: %d\n",
- (int)check[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]);
- goto error;
- }
- }
+ 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]);
+ goto error;
+ }
+ }
}
}
- PASSED();
-
/* Get the storage size of the dataset */
if((*dset_size=H5Dget_storage_size(dataset))==0) goto error;
+
+ PASSED();
+
/* Clean up objects used for this test */
if(H5Dclose (dataset) < 0) goto error;
if(H5Sclose (sid) < 0) goto error;
if(H5Pclose (dxpl) < 0) goto error;
+ if(H5Pclose (write_dxpl) < 0) goto error;
HDfree (tconv_buf);
- return(0);
+ return SUCCEED;
error:
if(tconv_buf)
HDfree (tconv_buf);
- return -1;
-}
+ return FAIL;
+} /* end test_filter_internal() */
/*-------------------------------------------------------------------------
- * Function: test_filter_noencoder
+ * Function: test_filter_noencoder
*
- * Purpose: Tests filters with no encoder present. Ensures that data
+ * Purpose: Tests filters with no encoder present. Ensures that data
* can still be decoded correctly and that errors are thrown
* when the application tries to write.
*
* Return: Success: 0
- * Failure: -1
- *
- * Programmer: Nat Furrer and James Laird
- * Monday, June 7, 2004
- *
+ * Failure: -1
*-------------------------------------------------------------------------
*/
#ifdef H5_HAVE_FILTER_SZIP
@@ -1943,7 +1928,7 @@ test_filter_noencoder(const char *dset_name)
*/
dims = 20; /* Dataset is originally of size 10 */
H5E_BEGIN_TRY{
- err = H5Dset_extent(dset_id, &dims);
+ err = H5Dset_extent(dset_id, &dims);
}H5E_END_TRY
if(err >= 0) goto error;
@@ -1952,7 +1937,7 @@ test_filter_noencoder(const char *dset_name)
* the filter does not have an encoder.
*/
H5E_BEGIN_TRY{
- err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, test_ints);
+ err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, test_ints);
}H5E_END_TRY
if(err >= 0) goto error;
@@ -1964,7 +1949,7 @@ test_filter_noencoder(const char *dset_name)
PASSED();
- return 0;
+ return SUCCEED;
error:
H5_FAILED();
@@ -1979,8 +1964,8 @@ error:
if(file_id != -1)
H5Fclose(file_id);
- return -1;
-}
+ return FAIL;
+} /* end test_filter_noencoder() */
#endif /* H5_HAVE_FILTER_SZIP */
/*-------------------------------------------------------------------------
@@ -1990,10 +1975,6 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Nat Furrer and James Laird
- * Thursday, June 10, 2004
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2050,23 +2031,19 @@ test_get_filter_info(void)
if(err >= 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
+ return FAIL;
+} /* end test_get_filter_info() */
/*-------------------------------------------------------------------------
- * Function: test_filters
+ * Function: test_filters
*
- * Purpose: Tests dataset filter.
+ * Purpose: Tests dataset filter.
*
* Return: Success: 0
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Wednesday, April 15, 1998
- *
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2076,27 +2053,27 @@ H5_ATTR_UNUSED
#endif /* H5_HAVE_FILTER_SZIP */
fapl)
{
- hid_t dc; /* Dataset creation property list ID */
+ hid_t dc; /* Dataset creation property list ID */
const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */
- hsize_t null_size; /* Size of dataset with null filter */
+ hsize_t null_size; /* Size of dataset with null filter */
- hsize_t fletcher32_size; /* Size of dataset with Fletcher32 checksum */
+ hsize_t fletcher32_size; /* Size of dataset with Fletcher32 checksum */
unsigned data_corrupt[3]; /* position and length of data to be corrupted */
#ifdef H5_HAVE_FILTER_DEFLATE
- hsize_t deflate_size; /* Size of dataset with deflate filter */
+ hsize_t deflate_size; /* Size of dataset with deflate filter */
#endif /* H5_HAVE_FILTER_DEFLATE */
#ifdef H5_HAVE_FILTER_SZIP
- hsize_t szip_size; /* Size of dataset with szip filter */
- unsigned szip_options_mask=H5_SZIP_NN_OPTION_MASK;
- unsigned szip_pixels_per_block=4;
+ hsize_t szip_size; /* Size of dataset with szip filter */
+ unsigned szip_options_mask = H5_SZIP_NN_OPTION_MASK;
+ unsigned szip_pixels_per_block = 4;
#endif /* H5_HAVE_FILTER_SZIP */
hsize_t shuffle_size; /* Size of dataset with shuffle filter */
#if(defined H5_HAVE_FILTER_DEFLATE | defined H5_HAVE_FILTER_SZIP)
- hsize_t combo_size; /* Size of dataset with multiple filters */
+ hsize_t combo_size; /* Size of dataset with multiple filters */
#endif /* defined H5_HAVE_FILTER_DEFLATE | defined H5_HAVE_FILTER_SZIP */
/* test the H5Zget_filter_info function */
@@ -2106,7 +2083,7 @@ H5_ATTR_UNUSED
* STEP 0: Test null I/O filter by itself.
*----------------------------------------------------------
*/
- puts("Testing 'null' filter");
+ HDputs("Testing 'null' filter");
if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
if(H5Zregister (H5Z_BOGUS) < 0) goto error;
@@ -2121,7 +2098,7 @@ H5_ATTR_UNUSED
* STEP 1: Test Fletcher32 Checksum by itself.
*----------------------------------------------------------
*/
- puts("Testing Fletcher32 checksum(enabled for read)");
+ HDputs("Testing Fletcher32 checksum(enabled for read)");
if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
if(H5Pset_filter(dc, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL) < 0) goto error;
@@ -2130,21 +2107,21 @@ H5_ATTR_UNUSED
if(test_filter_internal(file,DSET_FLETCHER32_NAME,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&fletcher32_size) < 0) goto error;
if(fletcher32_size<=null_size) {
H5_FAILED();
- puts(" Size after checksumming is incorrect.");
+ HDputs(" Size after checksumming is incorrect.");
goto error;
} /* end if */
/* Disable checksum during read */
- puts("Testing Fletcher32 checksum(disabled for read)");
+ HDputs("Testing Fletcher32 checksum(disabled for read)");
if(test_filter_internal(file,DSET_FLETCHER32_NAME_2,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&fletcher32_size) < 0) goto error;
if(fletcher32_size<=null_size) {
H5_FAILED();
- puts(" Size after checksumming is incorrect.");
+ HDputs(" Size after checksumming is incorrect.");
goto error;
} /* end if */
/* Try to corrupt data and see if checksum fails */
- puts("Testing Fletcher32 checksum(when data is corrupted)");
+ HDputs("Testing Fletcher32 checksum(when data is corrupted)");
data_corrupt[0] = 52;
data_corrupt[1] = 33;
data_corrupt[2] = 27;
@@ -2154,7 +2131,7 @@ H5_ATTR_UNUSED
if(test_filter_internal(file,DSET_FLETCHER32_NAME_3,dc,DISABLE_FLETCHER32,DATA_CORRUPTED,&fletcher32_size) < 0) goto error;
if(fletcher32_size<=null_size) {
H5_FAILED();
- puts(" Size after checksumming is incorrect.");
+ HDputs(" Size after checksumming is incorrect.");
goto error;
} /* end if */
@@ -2167,7 +2144,7 @@ H5_ATTR_UNUSED
*----------------------------------------------------------
*/
#ifdef H5_HAVE_FILTER_DEFLATE
- puts("Testing deflate filter");
+ HDputs("Testing deflate filter");
if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
if(H5Pset_deflate (dc, 6) < 0) goto error;
@@ -2178,7 +2155,7 @@ H5_ATTR_UNUSED
#else /* H5_HAVE_FILTER_DEFLATE */
TESTING("deflate filter");
SKIPPED();
- puts(" Deflate filter not enabled");
+ HDputs(" Deflate filter not enabled");
#endif /* H5_HAVE_FILTER_DEFLATE */
/*----------------------------------------------------------
@@ -2191,34 +2168,36 @@ H5_ATTR_UNUSED
if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
- puts("");
+ HDputs("");
if(H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block) < 0) goto error;
if(test_filter_internal(file,DSET_SZIP_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&szip_size) < 0) goto error;
if(H5Pclose (dc) < 0) goto error;
- } else {
- SKIPPED();
+ }
+ else {
+ SKIPPED();
}
TESTING("szip filter (without encoder)");
if( h5_szip_can_encode() != 1) {
- puts("");
- if(test_filter_noencoder(NOENCODER_SZIP_DATASET) < 0) goto error;
- } else {
- SKIPPED();
+ HDputs("");
+ if(test_filter_noencoder(NOENCODER_SZIP_DATASET) < 0) goto error;
+ }
+ else {
+ SKIPPED();
}
#else /* H5_HAVE_FILTER_SZIP */
TESTING("szip filter");
SKIPPED();
- puts(" Szip filter not enabled");
+ HDputs(" Szip filter not enabled");
#endif /* H5_HAVE_FILTER_SZIP */
/*----------------------------------------------------------
* STEP 4: Test shuffling by itself.
*----------------------------------------------------------
*/
- puts("Testing shuffle filter");
+ HDputs("Testing shuffle filter");
if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
if(H5Pset_shuffle (dc) < 0) goto error;
@@ -2226,7 +2205,7 @@ H5_ATTR_UNUSED
if(test_filter_internal(file,DSET_SHUFFLE_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&shuffle_size) < 0) goto error;
if(shuffle_size!=null_size) {
H5_FAILED();
- puts(" Shuffled size not the same as uncompressed size.");
+ HDputs(" Shuffled size not the same as uncompressed size.");
goto error;
} /* end if */
@@ -2238,7 +2217,7 @@ H5_ATTR_UNUSED
*----------------------------------------------------------
*/
#ifdef H5_HAVE_FILTER_DEFLATE
- puts("Testing shuffle+deflate+checksum filters(checksum first)");
+ HDputs("Testing shuffle+deflate+checksum filters(checksum first)");
if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
if(H5Pset_fletcher32 (dc) < 0) goto error;
@@ -2250,7 +2229,7 @@ H5_ATTR_UNUSED
/* Clean up objects used for this test */
if(H5Pclose (dc) < 0) goto error;
- puts("Testing shuffle+deflate+checksum filters(checksum last)");
+ HDputs("Testing shuffle+deflate+checksum filters(checksum last)");
if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
if(H5Pset_shuffle (dc) < 0) goto error;
@@ -2264,7 +2243,7 @@ H5_ATTR_UNUSED
#else /* H5_HAVE_FILTER_DEFLATE */
TESTING("shuffle+deflate+fletcher32 filters");
SKIPPED();
- puts(" Deflate filter not enabled");
+ HDputs(" Deflate filter not enabled");
#endif /* H5_HAVE_FILTER_DEFLATE */
/*----------------------------------------------------------
@@ -2281,19 +2260,21 @@ H5_ATTR_UNUSED
/* Make sure encoding is enabled */
if( h5_szip_can_encode() == 1) {
- puts("");
- if(H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block) < 0) goto error;
- if(test_filter_internal(file,DSET_SHUF_SZIP_FLET_NAME,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&combo_size) < 0) goto error;
- } else {
+ HDputs("");
+ if(H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block) < 0) goto error;
+ if(test_filter_internal(file,DSET_SHUF_SZIP_FLET_NAME,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&combo_size) < 0) goto error;
+ }
+ else {
SKIPPED();
}
TESTING("shuffle+szip+checksum filters(checksum first, without encoder)");
if( h5_szip_can_encode() != 1) {
- puts("");
- if(test_filter_noencoder(NOENCODER_SZIP_SHUFF_FLETCH_DATASET) < 0) goto error;
- } else {
+ HDputs("");
+ if(test_filter_noencoder(NOENCODER_SZIP_SHUFF_FLETCH_DATASET) < 0) goto error;
+ }
+ else {
SKIPPED();
}
@@ -2304,45 +2285,40 @@ H5_ATTR_UNUSED
/* Make sure encoding is enabled */
if( h5_szip_can_encode() == 1) {
- puts("");
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_shuffle (dc) < 0) goto error;
- if(H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block) < 0) goto error;
- if(H5Pset_fletcher32 (dc) < 0) goto error;
-
- if(test_filter_internal(file,DSET_SHUF_SZIP_FLET_NAME_2,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&combo_size) < 0) goto error;
+ HDputs("");
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
+ if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
+ if(H5Pset_shuffle (dc) < 0) goto error;
+ if(H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block) < 0) goto error;
+ if(H5Pset_fletcher32 (dc) < 0) goto error;
- /* Clean up objects used for this test */
- if(H5Pclose (dc) < 0) goto error;
+ if(test_filter_internal(file,DSET_SHUF_SZIP_FLET_NAME_2,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&combo_size) < 0) goto error;
- } else {
- SKIPPED();
+ /* Clean up objects used for this test */
+ if(H5Pclose (dc) < 0) goto error;
+ }
+ else {
+ SKIPPED();
}
#else /* H5_HAVE_FILTER_SZIP */
TESTING("shuffle+szip+fletcher32 filters");
SKIPPED();
- puts(" szip filter not enabled");
+ HDputs(" szip filter not enabled");
#endif /* H5_HAVE_FILTER_SZIP */
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
+ return FAIL;
+} /* end test_filters() */
+
-
/*-------------------------------------------------------------------------
- * Function: test_missing_filter
+ * Function: test_missing_filter
*
- * Purpose: Tests library behavior when filter is missing
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Quincey Koziol
- * Thursday, November 14, 2002
+ * Purpose: Tests library behavior when filter is missing
*
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2367,38 +2343,38 @@ test_missing_filter(hid_t file)
/* Verify deflate filter is registered currently */
if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=TRUE) {
H5_FAILED();
- printf(" Line %d: Deflate filter not available\n",__LINE__);
+ HDprintf(" Line %d: Deflate filter not available\n",__LINE__);
goto error;
} /* end if */
/* Unregister deflate filter (use internal function) */
if(H5Z_unregister(H5Z_FILTER_DEFLATE) < 0) {
H5_FAILED();
- printf(" Line %d: Can't unregister deflate filter\n",__LINE__);
+ HDprintf(" Line %d: Can't unregister deflate filter\n",__LINE__);
goto error;
} /* end if */
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Verify deflate filter is not registered currently */
if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=FALSE) {
H5_FAILED();
- printf(" Line %d: Deflate filter available\n",__LINE__);
+ HDprintf(" Line %d: Deflate filter available\n",__LINE__);
goto error;
} /* end if */
/* Create dcpl with deflate filter */
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't create dcpl\n",__LINE__);
+ HDprintf(" Line %d: Can't create dcpl\n",__LINE__);
goto error;
} /* end if */
if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) {
H5_FAILED();
- printf(" Line %d: Can't set chunk sizes\n",__LINE__);
+ HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__);
goto error;
} /* end if */
if(H5Pset_deflate(dcpl, 9) < 0) {
H5_FAILED();
- printf(" Line %d: Can't set deflate filter\n",__LINE__);
+ HDprintf(" Line %d: Can't set deflate filter\n",__LINE__);
goto error;
} /* end if */
@@ -2406,47 +2382,47 @@ test_missing_filter(hid_t file)
ret=H5Pall_filters_avail(dcpl);
if(ret<0) {
H5_FAILED();
- printf(" Line %d: Can't check filter availability\n",__LINE__);
+ HDprintf(" Line %d: Can't check filter availability\n",__LINE__);
goto error;
} /* end if */
if(ret!=FALSE) {
H5_FAILED();
- printf(" Line %d: Filter shouldn't be available\n",__LINE__);
+ HDprintf(" Line %d: Filter shouldn't be available\n",__LINE__);
goto error;
} /* end if */
/* Create the data space */
if((sid = H5Screate_simple(2, dims, NULL)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't open dataspace\n",__LINE__);
+ HDprintf(" Line %d: Can't open dataspace\n",__LINE__);
goto error;
} /* end if */
/* Create new dataset */
if((dsid = H5Dcreate2(file, DSET_MISSING_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't create dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't create dataset\n",__LINE__);
goto error;
} /* end if */
/* Write data */
if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) {
H5_FAILED();
- printf(" Line %d: Error writing dataset data\n",__LINE__);
+ HDprintf(" Line %d: Error writing dataset data\n",__LINE__);
goto error;
} /* end if */
/* Flush the file (to clear the cache) */
if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) {
H5_FAILED();
- printf(" Line %d: Error flushing file\n",__LINE__);
+ HDprintf(" Line %d: Error flushing file\n",__LINE__);
goto error;
} /* end if */
/* Query the dataset's size on disk */
if(0 == (dset_size = H5Dget_storage_size(dsid))) {
H5_FAILED();
- printf(" Line %d: Error querying dataset size, dset_size=%lu\n",__LINE__,(unsigned long)dset_size);
+ HDprintf(" Line %d: Error querying dataset size, dset_size=%lu\n",__LINE__,(unsigned long)dset_size);
goto error;
} /* end if */
@@ -2454,50 +2430,50 @@ test_missing_filter(hid_t file)
/* (i.e. the deflation filter we asked for was silently ignored) */
if((H5Tget_size(H5T_NATIVE_INT) * DSET_DIM1 * DSET_DIM2) != dset_size) {
H5_FAILED();
- printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size);
+ HDprintf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size);
goto error;
} /* end if */
/* Read data */
if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) {
H5_FAILED();
- printf(" Line %d: Error reading dataset data\n",__LINE__);
+ HDprintf(" Line %d: Error reading dataset data\n",__LINE__);
goto error;
} /* end if */
/* Compare data */
/* Check that the values read are the same as the values written */
for(i=0; i<(size_t)dims[0]; i++) {
- for(j=0; j<(size_t)dims[1]; j++) {
- if(points[i][j] != check[i][j]) {
- H5_FAILED();
- printf(" Line %d: Read different values than written.\n",__LINE__);
- printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
- printf(" At original: %d\n",points[i][j]);
- printf(" At returned: %d\n",check[i][j]);
- goto error;
- } /* end if */
- } /* end for */
+ for(j=0; j<(size_t)dims[1]; j++) {
+ if(points[i][j] != check[i][j]) {
+ H5_FAILED();
+ HDprintf(" Line %d: Read different values than written.\n",__LINE__);
+ HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
+ HDprintf(" At original: %d\n",points[i][j]);
+ HDprintf(" At returned: %d\n",check[i][j]);
+ goto error;
+ } /* end if */
+ } /* end for */
} /* end for */
/* Close dataset */
if(H5Dclose(dsid) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't close dataset\n",__LINE__);
goto error;
} /* end if */
/* Close dataspace */
if(H5Sclose(sid) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close dataspace\n",__LINE__);
+ HDprintf(" Line %d: Can't close dataspace\n",__LINE__);
goto error;
} /* end if */
/* Close dataset creation property list */
if(H5Pclose(dcpl) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close dcpl\n",__LINE__);
+ HDprintf(" Line %d: Can't close dcpl\n",__LINE__);
goto error;
} /* end if */
@@ -2506,22 +2482,22 @@ test_missing_filter(hid_t file)
/* Compose the name of the file to open, using the srcdir, if appropriate */
if(srcdir && ((HDstrlen(srcdir) + HDstrlen(FILE_DEFLATE_NAME) + 1) < sizeof(testfile))){
- HDstrcpy(testfile, srcdir);
- HDstrcat(testfile, "/");
+ HDstrcpy(testfile, srcdir);
+ HDstrcat(testfile, "/");
}
HDstrcat(testfile, FILE_DEFLATE_NAME);
/* Open existing file */
if((fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't open existing deflated file\n", __LINE__);
+ HDprintf(" Line %d: Can't open existing deflated file\n", __LINE__);
goto error;
} /* end if */
/* Open dataset */
if((dsid = H5Dopen2(fid, "Dataset1", H5P_DEFAULT)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't open dataset\n", __LINE__);
+ HDprintf(" Line %d: Can't open dataset\n", __LINE__);
goto error;
} /* end if */
@@ -2531,21 +2507,21 @@ test_missing_filter(hid_t file)
} H5E_END_TRY;
if(ret>=0) {
H5_FAILED();
- printf(" Line %d: Should not be able to read dataset data\n", __LINE__);
+ HDprintf(" Line %d: Should not be able to read dataset data\n", __LINE__);
goto error;
} /* end if */
/* Close dataset */
if(H5Dclose(dsid) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close dataset\n", __LINE__);
+ HDprintf(" Line %d: Can't close dataset\n", __LINE__);
goto error;
} /* end if */
/* Close existing file */
if(H5Fclose(fid) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close file\n", __LINE__);
+ HDprintf(" Line %d: Can't close file\n", __LINE__);
goto error;
} /* end if */
@@ -2553,58 +2529,53 @@ test_missing_filter(hid_t file)
/* Verify deflate filter is not registered currently */
if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=FALSE) {
H5_FAILED();
- printf(" Line %d: Deflate filter available\n",__LINE__);
+ HDprintf(" Line %d: Deflate filter available\n",__LINE__);
goto error;
} /* end if */
#ifdef H5_HAVE_FILTER_DEFLATE
/* Register deflate filter (use internal function to avoid range checks) */
if(H5Z_register(H5Z_DEFLATE) < 0) {
H5_FAILED();
- printf(" Line %d: Can't unregister deflate filter\n",__LINE__);
+ HDprintf(" Line %d: Can't unregister deflate filter\n",__LINE__);
goto error;
} /* end if */
/* Verify deflate filter is registered currently */
if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=TRUE) {
H5_FAILED();
- printf(" Line %d: Deflate filter not available\n",__LINE__);
+ HDprintf(" Line %d: Deflate filter not available\n",__LINE__);
goto error;
} /* end if */
#endif /* H5_HAVE_FILTER_DEFLATE */
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
+ return FAIL;
+} /* end test_missing_filter() */
/*-------------------------------------------------------------------------
- * Function: test_onebyte_shuffle
+ * Function: test_onebyte_shuffle
*
- * Purpose: Tests the 8-bit array with shuffling algorithm.
- * The shuffled array should be the same result as
- * that before the shuffling.
+ * Purpose: Tests the 8-bit array with shuffling algorithm.
+ * The shuffled array should be the same result as
+ * that before the shuffling.
*
* Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Kent Yang
- * Wednesday, Nov. 13th, 2002
- *
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
test_onebyte_shuffle(hid_t file)
{
- hid_t dataset, space,dc;
+ hid_t dataset, space,dc;
const hsize_t size[2] = {10, 20};
- const hsize_t chunk_size[2] = {10, 20};
- unsigned char orig_data[10][20];
- unsigned char new_data[10][20];
- size_t i, j;
+ const hsize_t chunk_size[2] = {10, 20};
+ unsigned char orig_data[10][20];
+ unsigned char new_data[10][20];
+ size_t i, j;
TESTING("8-bit shuffling (setup)");
@@ -2621,8 +2592,8 @@ test_onebyte_shuffle(hid_t file)
space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
for(i= 0;i< 10; i++)
- for(j = 0; j < 20; j++)
- orig_data[i][j] = (unsigned char)HDrandom();
+ for(j = 0; j < 20; j++)
+ orig_data[i][j] = (unsigned char)HDrandom();
PASSED();
@@ -2633,9 +2604,8 @@ test_onebyte_shuffle(hid_t file)
*/
TESTING("8-bit shuffling (write)");
- if(H5Dwrite(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0)
- goto error;
+ if(H5Dwrite(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ goto error;
PASSED();
@@ -2646,22 +2616,21 @@ test_onebyte_shuffle(hid_t file)
TESTING("8-bit shuffling (read)");
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0)
- goto error;
+ if(H5Dread(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ goto error;
/* Check that the values read are the same as the values written */
for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
- if(new_data[i][j] != orig_data[i][j]) {
- H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n",
- (unsigned long)i, (unsigned long)j);
- goto error;
+ for(j=0; j<(size_t)size[1]; j++) {
+ if(new_data[i][j] != orig_data[i][j]) {
+ H5_FAILED();
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %lu,%lu\n",
+ (unsigned long)i, (unsigned long)j);
+ goto error;
+ }
}
}
- }
/*----------------------------------------------------------------------
* Cleanup
@@ -2672,25 +2641,20 @@ test_onebyte_shuffle(hid_t file)
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
+ return FAIL;
+} /* end test_onebyte_shuffle() */
+
-
/*-------------------------------------------------------------------------
* Function: test_nbit_int
*
* Purpose: Tests the integer datatype for nbit filter
*
* Return: Success: 0
- *
* Failure: -1
- *
- * Programmer: Xiaowen Wu
- * Wednesday, Dec. 23th, 2004
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2703,9 +2667,10 @@ test_nbit_int(hid_t file)
int new_data[2][5];
unsigned int mask;
size_t precision, offset;
- size_t i, j;
+ double power;
+ size_t i, j;
- puts("Testing nbit filter");
+ HDputs("Testing nbit filter");
TESTING(" nbit int (setup)");
/* Define dataset datatype (integer), and set precision, offset */
@@ -2735,14 +2700,14 @@ test_nbit_int(hid_t file)
/* Initialize data, assuming size of long long >= size of int */
for(i= 0;i< (size_t)size[0]; i++)
- for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[i][j] = (int)(((long long)HDrandom() %
- (long long)HDpow(2.0f, (double)(precision - 1))) << offset);
+ for(j = 0; j < (size_t)size[1]; j++) {
+ power = HDpow(2.0f, (double)(precision - 1));
+ orig_data[i][j] = (int)(((long long)HDrandom() % (long long)power) << offset);
- /* even-numbered values are negtive */
- if((i*size[1]+j+1)%2 == 0)
- orig_data[i][j] = -orig_data[i][j];
- }
+ /* even-numbered values are negtive */
+ if((i*size[1]+j+1)%2 == 0)
+ orig_data[i][j] = -orig_data[i][j];
+ }
PASSED();
@@ -2753,8 +2718,7 @@ test_nbit_int(hid_t file)
*/
TESTING(" nbit int (write)");
- if(H5Dwrite(dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0)
+ if(H5Dwrite(dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
goto error;
PASSED();
@@ -2765,8 +2729,7 @@ test_nbit_int(hid_t file)
TESTING(" nbit int (read)");
/* Read the dataset back */
- if(H5Dread(dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0)
+ if(H5Dread(dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
goto error;
/* Check that the values read are the same as the values written
@@ -2775,10 +2738,10 @@ test_nbit_int(hid_t file)
mask = ~((unsigned)~0 << (precision + offset)) & ((unsigned)~0 << offset);
for(i=0; i<(size_t)size[0]; i++) {
for(j=0; j<(size_t)size[1]; j++) {
- if((new_data[i][j] & mask) != (orig_data[i][j] & mask)) {
+ if(((unsigned)new_data[i][j] & mask) != ((unsigned)orig_data[i][j] & mask)) {
H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
goto error;
}
}
@@ -2796,24 +2759,20 @@ test_nbit_int(hid_t file)
PASSED();
- return 0;
+ return SUCCEED;
+
error:
- return -1;
-}
+ return FAIL;
+} /* end test_nbit_int() */
+
-
/*-------------------------------------------------------------------------
* Function: test_nbit_float
*
* Purpose: Tests the float datatype of nbit filter
*
* Return: Success: 0
- *
* Failure: -1
- *
- * Programmer: Xiaowen Wu
- * Friday, Jan. 21th, 2005
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2829,31 +2788,40 @@ test_nbit_float(hid_t file)
{-49140.0f, 2350.25f, -3.2110596e-1f, 6.4998865e-5f, -0.0f}};
float new_data[2][5];
size_t precision, offset;
- size_t i, j;
+ size_t i, j;
TESTING(" nbit float (setup)");
/* Define user-defined single-precision floating-point type for dataset */
datatype = H5Tcopy(H5T_IEEE_F32BE);
- if(H5Tset_fields(datatype, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) goto error;
+ if(H5Tset_fields(datatype, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0)
+ FAIL_STACK_ERROR
offset = 7;
- if(H5Tset_offset(datatype,offset) < 0) goto error;
+ if(H5Tset_offset(datatype,offset) < 0)
+ FAIL_STACK_ERROR
precision = 20;
- if(H5Tset_precision(datatype,precision) < 0) goto error;
- if(H5Tset_size(datatype, (size_t)4) < 0) goto error;
- if(H5Tset_ebias(datatype, (size_t)31) < 0) goto error;
+ if(H5Tset_precision(datatype,precision) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_size(datatype, (size_t)4) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_ebias(datatype, (size_t)31) < 0)
+ FAIL_STACK_ERROR
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if((space = H5Screate_simple(2, size, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_nbit(dc) < 0) goto error;
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dc, 2, chunk_size) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_nbit(dc) < 0)
+ FAIL_STACK_ERROR
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_FLOAT_NAME, datatype,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if((dataset = H5Dcreate2(file, DSET_NBIT_FLOAT_NAME, datatype, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
PASSED();
/*----------------------------------------------------------------------
@@ -2863,9 +2831,8 @@ test_nbit_float(hid_t file)
*/
TESTING(" nbit float (write)");
- if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0)
- goto error;
+ if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ FAIL_STACK_ERROR
PASSED();
@@ -2876,20 +2843,20 @@ test_nbit_float(hid_t file)
TESTING(" nbit float (read)");
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0)
- goto error;
+ if(H5Dread(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ FAIL_STACK_ERROR
/* Check that the values read are the same as the values written
* Assume size of int = size of float
*/
- for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
- if(!(orig_data[i][j]==orig_data[i][j])) continue; /* skip if value is NaN */
- if(new_data[i][j] != orig_data[i][j]) {
+ for(i = 0; i < (size_t)size[0]; i++) {
+ for(j = 0; j < (size_t)size[1]; j++) {
+ if(!(orig_data[i][j] == orig_data[i][j]))
+ continue; /* skip if value is NaN */
+ if(!H5_FLT_ABS_EQUAL(new_data[i][j], orig_data[i][j])) {
H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
goto error;
}
}
@@ -2899,32 +2866,31 @@ test_nbit_float(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(datatype) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if(H5Tclose(datatype) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(dc) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
+ return FAIL;
+} /* end test_nbit_float() */
+
-
/*-------------------------------------------------------------------------
* Function: test_nbit_double
*
* Purpose: Tests the double datatype of nbit filter
*
* Return: Success: 0
- *
* Failure: -1
- *
- * Programmer: Xiaowen Wu
- * Wednesday, Jan. 26th, 2005
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2960,25 +2926,34 @@ test_nbit_double(hid_t file)
/* Define user-defined doule-precision floating-point type for dataset */
datatype = H5Tcopy(H5T_IEEE_F64BE);
- if(H5Tset_fields(datatype, (size_t)55, (size_t)46, (size_t)9, (size_t)5, (size_t)41) < 0) goto error;
+ if(H5Tset_fields(datatype, (size_t)55, (size_t)46, (size_t)9, (size_t)5, (size_t)41) < 0)
+ FAIL_STACK_ERROR
offset = 5;
- if(H5Tset_offset(datatype,offset) < 0) goto error;
+ if(H5Tset_offset(datatype,offset) < 0)
+ FAIL_STACK_ERROR
precision = 51;
- if(H5Tset_precision(datatype,precision) < 0) goto error;
- if(H5Tset_size(datatype, (size_t)8) < 0) goto error;
- if(H5Tset_ebias(datatype, (size_t)255) < 0) goto error;
+ if(H5Tset_precision(datatype,precision) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_size(datatype, (size_t)8) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_ebias(datatype, (size_t)255) < 0)
+ FAIL_STACK_ERROR
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if((space = H5Screate_simple(2, size, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_nbit(dc) < 0) goto error;
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dc, 2, chunk_size) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_nbit(dc) < 0)
+ FAIL_STACK_ERROR
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_DOUBLE_NAME, datatype,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if((dataset = H5Dcreate2(file, DSET_NBIT_DOUBLE_NAME, datatype, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
PASSED();
@@ -2989,9 +2964,8 @@ test_nbit_double(hid_t file)
*/
TESTING(" nbit double (write)");
- if(H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0)
- goto error;
+ if(H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ FAIL_STACK_ERROR
PASSED();
/*----------------------------------------------------------------------
@@ -3001,20 +2975,20 @@ test_nbit_double(hid_t file)
TESTING(" nbit double (read)");
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0)
- goto error;
+ if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ FAIL_STACK_ERROR
/* Check that the values read are the same as the values written
* Assume size of long long = size of double
*/
- for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
- if(!(orig_data[i][j]==orig_data[i][j])) continue; /* skip if value is NaN */
- if(new_data[i][j] != orig_data[i][j]) {
+ for(i = 0; i < (size_t)size[0]; i++) {
+ for(j = 0; j < (size_t)size[1]; j++) {
+ if(!(orig_data[i][j] == orig_data[i][j]))
+ continue; /* skip if value is NaN */
+ if(!H5_DBL_ABS_EQUAL(new_data[i][j], orig_data[i][j])) {
H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
goto error;
}
}
@@ -3024,32 +2998,31 @@ test_nbit_double(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(datatype) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if(H5Tclose(datatype) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(dc) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
+ return FAIL;
+} /* end test_nbit_double() */
+
-
/*-------------------------------------------------------------------------
* Function: test_nbit_array
*
* Purpose: Tests the simple version array datatype for nbit filter
*
* Return: Success: 0
- *
* Failure: -1
- *
- * Programmer: Xiaowen Wu
- * Tuesday, Jan. 18th, 2005
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -3063,7 +3036,8 @@ test_nbit_array(hid_t file)
unsigned int orig_data[2][5][3][2];
unsigned int new_data[2][5][3][2];
size_t precision, offset;
- size_t i, j, m, n;
+ double power;
+ size_t i, j, m, n;
TESTING(" nbit array (setup)");
@@ -3102,9 +3076,11 @@ test_nbit_array(hid_t file)
for(i= 0;i< (size_t)size[0]; i++)
for(j = 0; j < (size_t)size[1]; j++)
for(m = 0; m < (size_t)adims[0]; m++)
- for(n = 0; n < (size_t)adims[1]; n++)
+ for(n = 0; n < (size_t)adims[1]; n++) {
+ power = HDpow(2.0F, (double)precision);
orig_data[i][j][m][n] = (unsigned int)(((long long)HDrandom() %
- (long long)HDpow(2.0F, (double)precision)) << offset);
+ (long long)power) << offset);
+ } /* end for */
PASSED();
/*----------------------------------------------------------------------
@@ -3139,8 +3115,8 @@ test_nbit_array(hid_t file)
for(n = 0; n < (size_t)adims[1]; n++) {
if(new_data[i][j][m][n]!= orig_data[i][j][m][n]) {
H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu,%lu,%lu\n",
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %lu,%lu,%lu,%lu\n",
(unsigned long)i, (unsigned long)j, (unsigned long)m, (unsigned long)n);
goto error;
}
@@ -3160,13 +3136,13 @@ test_nbit_array(hid_t file)
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
+ return FAIL;
+} /* end test_nbit_array() */
+
-
/*-------------------------------------------------------------------------
* Function: test_nbit_compound
*
@@ -3203,79 +3179,110 @@ test_nbit_compound(hid_t file)
atomic orig_data[2][5];
atomic new_data[2][5];
unsigned int i_mask, s_mask, c_mask;
- size_t i, j;
+ double power;
+ size_t i, j;
TESTING(" nbit compound (setup)");
/* Define datatypes of members of compound datatype */
- i_tid=H5Tcopy(H5T_NATIVE_INT);
- c_tid=H5Tcopy(H5T_NATIVE_CHAR);
- s_tid=H5Tcopy(H5T_NATIVE_SHORT);
- f_tid=H5Tcopy(H5T_IEEE_F32BE);
+ if((i_tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ FAIL_STACK_ERROR
+ if((c_tid = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
+ FAIL_STACK_ERROR
+ if((s_tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0)
+ FAIL_STACK_ERROR
+ if((f_tid = H5Tcopy(H5T_IEEE_F32BE)) < 0)
+ FAIL_STACK_ERROR
/* Set precision and offset etc. */
- if(H5Tset_precision(i_tid,precision[0]) < 0) goto error;
- if(H5Tset_offset(i_tid,offset[0]) < 0) goto error;
+ if(H5Tset_precision(i_tid,precision[0]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(i_tid,offset[0]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_precision(c_tid,precision[1]) < 0) goto error;
- if(H5Tset_offset(c_tid,offset[1]) < 0) goto error;
+ if(H5Tset_precision(c_tid,precision[1]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(c_tid,offset[1]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_precision(s_tid,precision[2]) < 0) goto error;
- if(H5Tset_offset(s_tid,offset[2]) < 0) goto error;
+ if(H5Tset_precision(s_tid,precision[2]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(s_tid,offset[2]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) goto error;
- if(H5Tset_offset(f_tid, (size_t)7) < 0) goto error;
- if(H5Tset_precision(f_tid, (size_t)20) < 0) goto error;
- if(H5Tset_size(f_tid, (size_t)4) < 0) goto error;
- if(H5Tset_ebias(f_tid, (size_t)31) < 0) goto error;
+ if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(f_tid, (size_t)7) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_precision(f_tid, (size_t)20) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_size(f_tid, (size_t)4) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_ebias(f_tid, (size_t)31) < 0)
+ FAIL_STACK_ERROR
/* Create a memory compound datatype before setting the order */
- mem_cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic));
- if(H5Tinsert(mem_cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0) goto error;
+ if((mem_cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0)
+ FAIL_STACK_ERROR
/* Create a dataset compound datatype and insert some atomic types */
- cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic));
- if(H5Tinsert(cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid, "f", HOFFSET(atomic, f), f_tid) < 0) goto error;
+ if((cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid, "f", HOFFSET(atomic, f), f_tid) < 0)
+ FAIL_STACK_ERROR
/* Set order of dataset compound datatype */
- if(H5Tset_order(cmpd_tid, H5T_ORDER_BE) < 0) goto error;
+ if(H5Tset_order(cmpd_tid, H5T_ORDER_BE) < 0)
+ FAIL_STACK_ERROR
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if((space = H5Screate_simple(2, size, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_nbit(dc) < 0) goto error;
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dc, 2, chunk_size) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_nbit(dc) < 0)
+ FAIL_STACK_ERROR
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME, cmpd_tid,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME, cmpd_tid, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Initialize data, assuming size of long long >= size of member datatypes */
- for(i= 0;i< (size_t)size[0]; i++)
- for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[i][j].i = (int)(((long long)HDrandom() %
- (long long)HDpow(2.0F, (double)(precision[0]-1))) << offset[0]);
- orig_data[i][j].c = (char)(((long long)HDrandom() %
- (long long)HDpow(2.0F, (double)(precision[1]-1))) << offset[1]);
- orig_data[i][j].s = (short)(((long long)HDrandom() %
- (long long)HDpow(2.0F, (double)(precision[2]-1))) << offset[2]);
- orig_data[i][j].f = float_val[i][j];
-
- /* some even-numbered integer values are negtive */
- if((i*size[1]+j+1)%2 == 0) {
- orig_data[i][j].i = -orig_data[i][j].i;
- orig_data[i][j].s = (short)-orig_data[i][j].s;
+ for(i = 0; i < (size_t)size[0]; i++)
+ for(j = 0; j < (size_t)size[1]; j++) {
+ power = HDpow(2.0F, (double)(precision[0]-1));
+ orig_data[i][j].i = (int)(((long long)HDrandom() % (long long)power) << offset[0]);
+ power = HDpow(2.0F, (double)(precision[1]-1));
+ orig_data[i][j].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
+ power = HDpow(2.0F, (double)(precision[2]-1));
+ orig_data[i][j].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]);
+ orig_data[i][j].f = float_val[i][j];
+
+ /* some even-numbered integer values are negtive */
+ if((i * size[1] + j + 1) % 2 == 0) {
+ orig_data[i][j].i = -orig_data[i][j].i;
+ orig_data[i][j].s = (short)-orig_data[i][j].s;
+ }
}
- }
PASSED();
@@ -3286,9 +3293,8 @@ test_nbit_compound(hid_t file)
*/
TESTING(" nbit compound (write)");
- if(H5Dwrite(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0)
- goto error;
+ if(H5Dwrite(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ FAIL_STACK_ERROR
PASSED();
/*----------------------------------------------------------------------
@@ -3298,9 +3304,8 @@ test_nbit_compound(hid_t file)
TESTING(" nbit compound (read)");
/* Read the dataset back */
- if(H5Dread(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0)
- goto error;
+ if(H5Dread(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ FAIL_STACK_ERROR
/* Check that the values read are the same as the values written
* Use mask for checking the significant bits, ignoring the padding bits
@@ -3308,16 +3313,16 @@ test_nbit_compound(hid_t file)
i_mask = ~((unsigned)~0 << (precision[0] + offset[0])) & ((unsigned)~0 << offset[0]);
c_mask = ~((unsigned)~0 << (precision[1] + offset[1])) & ((unsigned)~0 << offset[1]);
s_mask = ~((unsigned)~0 << (precision[2] + offset[2])) & ((unsigned)~0 << offset[2]);
- for(i=0; i<size[0]; i++) {
- for(j=0; j<size[1]; j++) {
- if((new_data[i][j].i & i_mask) != (orig_data[i][j].i & i_mask) ||
- (new_data[i][j].c & c_mask) != (orig_data[i][j].c & c_mask) ||
- (new_data[i][j].s & s_mask) != (orig_data[i][j].s & s_mask) ||
- (orig_data[i][j].f==orig_data[i][j].f && new_data[i][j].f != orig_data[i][j].f))
+ for(i = 0; i < size[0]; i++) {
+ for(j = 0; j < size[1]; j++) {
+ if(((unsigned)new_data[i][j].i & i_mask) != ((unsigned)orig_data[i][j].i & i_mask) ||
+ ((unsigned)new_data[i][j].c & c_mask) != ((unsigned)orig_data[i][j].c & c_mask) ||
+ ((unsigned)new_data[i][j].s & s_mask) != ((unsigned)orig_data[i][j].s & s_mask) ||
+ (orig_data[i][j].f == orig_data[i][j].f && !H5_FLT_ABS_EQUAL(new_data[i][j].f, orig_data[i][j].f)))
{
H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
goto error;
}
}
@@ -3327,25 +3332,34 @@ test_nbit_compound(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(i_tid) < 0) goto error;
- if(H5Tclose(c_tid) < 0) goto error;
- if(H5Tclose(s_tid) < 0) goto error;
- if(H5Tclose(f_tid) < 0) goto error;
- if(H5Tclose(cmpd_tid) < 0) goto error;
- if(H5Tclose(mem_cmpd_tid) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if(H5Tclose(i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(f_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(cmpd_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(mem_cmpd_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(dc) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
+ return FAIL;
+} /* end test_nbit_compound() */
+
-
/*-------------------------------------------------------------------------
* Function: test_nbit_compound_2
*
@@ -3397,124 +3411,176 @@ test_nbit_compound_2(hid_t file)
complex orig_data[2][5];
complex new_data[2][5];
unsigned int i_mask, s_mask, c_mask, b_mask;
- size_t i, j, m, n, b_failed, d_failed;
+ double power;
+ size_t i, j, m, n, b_failed, d_failed;
TESTING(" nbit compound complex (setup)");
/* Define datatypes of members of compound datatype */
- i_tid=H5Tcopy(H5T_NATIVE_INT);
- c_tid=H5Tcopy(H5T_NATIVE_CHAR);
- s_tid=H5Tcopy(H5T_NATIVE_SHORT);
- v_tid=H5Tcopy(H5T_NATIVE_UINT);
- f_tid=H5Tcopy(H5T_IEEE_F32BE);
+ if((i_tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ FAIL_STACK_ERROR
+ if((c_tid = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
+ FAIL_STACK_ERROR
+ if((s_tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0)
+ FAIL_STACK_ERROR
+ if((v_tid = H5Tcopy(H5T_NATIVE_UINT)) < 0)
+ FAIL_STACK_ERROR
+ if((f_tid = H5Tcopy(H5T_IEEE_F32BE)) < 0)
+ FAIL_STACK_ERROR
/* Set precision and offset etc. of atomic compound datatype members */
- if(H5Tset_precision(i_tid,precision[0]) < 0) goto error;
- if(H5Tset_offset(i_tid,offset[0]) < 0) goto error;
+ if(H5Tset_precision(i_tid,precision[0]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(i_tid,offset[0]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_precision(c_tid,precision[1]) < 0) goto error;
- if(H5Tset_offset(c_tid,offset[1]) < 0) goto error;
+ if(H5Tset_precision(c_tid,precision[1]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(c_tid,offset[1]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_precision(s_tid,precision[2]) < 0) goto error;
- if(H5Tset_offset(s_tid,offset[2]) < 0) goto error;
+ if(H5Tset_precision(s_tid,precision[2]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(s_tid,offset[2]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) goto error;
- if(H5Tset_offset(f_tid, (size_t)7) < 0) goto error;
- if(H5Tset_precision(f_tid, (size_t)20) < 0) goto error;
- if(H5Tset_size(f_tid, (size_t)4) < 0) goto error;
- if(H5Tset_ebias(f_tid, (size_t)31) < 0) goto error;
+ if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(f_tid, (size_t)7) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_precision(f_tid, (size_t)20) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_size(f_tid, (size_t)4) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_ebias(f_tid, (size_t)31) < 0)
+ FAIL_STACK_ERROR
/* Create a memory atomic compound datatype before setting the order */
- mem_cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic));
- if(H5Tinsert(mem_cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid1, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0) goto error;
+ if((mem_cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid1, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0)
+ FAIL_STACK_ERROR
/* Create a dataset atomic compound datatype and insert some atomic types */
- cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic));
- if(H5Tinsert(cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid1, "f", HOFFSET(atomic, f), f_tid) < 0) goto error;
+ if((cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid1, "f", HOFFSET(atomic, f), f_tid) < 0)
+ FAIL_STACK_ERROR
/* Set order of dataset compound datatype */
- if(H5Tset_order(cmpd_tid1, H5T_ORDER_BE) < 0) goto error;
+ if(H5Tset_order(cmpd_tid1, H5T_ORDER_BE) < 0)
+ FAIL_STACK_ERROR
/* Set precision and offset of the other data member */
- if(H5Tset_precision(v_tid,precision[3]) < 0) goto error;
- if(H5Tset_offset(v_tid,offset[3]) < 0) goto error;
+ if(H5Tset_precision(v_tid,precision[3]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(v_tid,offset[3]) < 0)
+ FAIL_STACK_ERROR
/* Create the simple array datatype */
- base_tid = H5Tcopy(H5T_NATIVE_CHAR);
- if(H5Tset_precision(base_tid,precision[4]) < 0) goto error;
- if(H5Tset_offset(base_tid,offset[4]) < 0) goto error;
- array_tid = H5Tarray_create2(base_tid, 2, array_dims);
+ if((base_tid = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_precision(base_tid,precision[4]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(base_tid,offset[4]) < 0)
+ FAIL_STACK_ERROR
+ if((array_tid = H5Tarray_create2(base_tid, 2, array_dims)) < 0)
+ FAIL_STACK_ERROR
/* Create the complex memory and dataset array datatype */
- array_cmplx_tid = H5Tarray_create2(cmpd_tid1, 2, array_dims);
- mem_array_cmplx_tid = H5Tarray_create2(mem_cmpd_tid1, 2, array_dims);
+ if((array_cmplx_tid = H5Tarray_create2(cmpd_tid1, 2, array_dims)) < 0)
+ FAIL_STACK_ERROR
+ if((mem_array_cmplx_tid = H5Tarray_create2(mem_cmpd_tid1, 2, array_dims)) < 0)
+ FAIL_STACK_ERROR
/* Create a memory complex compound datatype before setting the order */
- mem_cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex));
- if(H5Tinsert(mem_cmpd_tid2, "a", HOFFSET(complex, a), mem_cmpd_tid1) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid2, "d", HOFFSET(complex, d), mem_array_cmplx_tid) < 0) goto error;
+ if((mem_cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid2, "a", HOFFSET(complex, a), mem_cmpd_tid1) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid2, "d", HOFFSET(complex, d), mem_array_cmplx_tid) < 0)
+ FAIL_STACK_ERROR
/* Set order of dataset other complex compound member datatype */
- if(H5Tset_order(v_tid, H5T_ORDER_BE) < 0) goto error;
+ if(H5Tset_order(v_tid, H5T_ORDER_BE) < 0)
+ FAIL_STACK_ERROR
/* Create a dataset complex compound datatype and insert members */
- cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex));
- if(H5Tinsert(cmpd_tid2, "a", HOFFSET(complex, a), cmpd_tid1) < 0) goto error;
- if(H5Tinsert(cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid2, "d", HOFFSET(complex, d), array_cmplx_tid) < 0) goto error;
+ if((cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid2, "a", HOFFSET(complex, a), cmpd_tid1) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid2, "d", HOFFSET(complex, d), array_cmplx_tid) < 0)
+ FAIL_STACK_ERROR
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if((space = H5Screate_simple(2, size, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_nbit(dc) < 0) goto error;
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dc, 2, chunk_size) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_nbit(dc) < 0)
+ FAIL_STACK_ERROR
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME_2, cmpd_tid2,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME_2, cmpd_tid2, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Initialize data, assuming size of long long >= size of member datatypes */
for(i= 0;i< (size_t)size[0]; i++)
- for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[i][j].a.i = (int)(((long long)HDrandom() %
- (long long)HDpow(2.0F, (double)(precision[0]-1))) << offset[0]);
- orig_data[i][j].a.c = (char)(((long long)HDrandom() %
- (long long)HDpow(2.0F, (double)(precision[1]-1))) << offset[1]);
- orig_data[i][j].a.s = (short)(-((long long)HDrandom() %
- (long long)HDpow(2.0F, (double)(precision[2]-1))) << offset[2]);
- orig_data[i][j].a.f = float_val[i][j];
-
- orig_data[i][j].v = (unsigned int)(((long long)HDrandom() %
- (long long)HDpow(2.0F, (double)precision[3])) << offset[3]);
-
- for(m = 0; m < (size_t)array_dims[0]; m++)
- for(n = 0; n < (size_t)array_dims[1]; n++)
- orig_data[i][j].b[m][n] = (char)(((long long)HDrandom() %
- (long long)HDpow(2.0F, (double)(precision[4]-1))) << offset[4]);
-
- for(m = 0; m < (size_t)array_dims[0]; m++)
- for(n = 0; n < (size_t)array_dims[1]; n++) {
- orig_data[i][j].d[m][n].i = (int)(-((long long)HDrandom() %
- (long long)HDpow(2.0F, (double)(precision[0]-1))) << offset[0]);
- orig_data[i][j].d[m][n].c = (char)(((long long)HDrandom() %
- (long long)HDpow(2.0F, (double)(precision[1]-1))) << offset[1]);
- orig_data[i][j].d[m][n].s = (short)(((long long)HDrandom() %
- (long long)HDpow(2.0F, (double)(precision[2]-1))) << offset[2]);
- orig_data[i][j].d[m][n].f = float_val[i][j];
- }
- }
+ for(j = 0; j < (size_t)size[1]; j++) {
+ power = HDpow(2.0F, (double)(precision[0]-1));
+ orig_data[i][j].a.i = (int)(((long long)HDrandom() % (long long)power) << offset[0]);
+ power = HDpow(2.0F, (double)(precision[1]-1));
+ orig_data[i][j].a.c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
+ power = HDpow(2.0F, (double)(precision[2]-1));
+ orig_data[i][j].a.s = (short)(-((long long)HDrandom() % (long long)power) << offset[2]);
+ orig_data[i][j].a.f = float_val[i][j];
+
+ power = HDpow(2.0F, (double)precision[3]);
+ orig_data[i][j].v = (unsigned int)(((long long)HDrandom() % (long long)power) << offset[3]);
+
+ for(m = 0; m < (size_t)array_dims[0]; m++)
+ for(n = 0; n < (size_t)array_dims[1]; n++) {
+ power = HDpow(2.0F, (double)(precision[4]-1));
+ orig_data[i][j].b[m][n] = (char)(((long long)HDrandom() % (long long)power) << offset[4]);
+ } /* end for */
+
+ for(m = 0; m < (size_t)array_dims[0]; m++)
+ for(n = 0; n < (size_t)array_dims[1]; n++) {
+ power = HDpow(2.0F, (double)(precision[0]-1));
+ orig_data[i][j].d[m][n].i = (int)(-((long long)HDrandom() % (long long)power) << offset[0]);
+ power = HDpow(2.0F, (double)(precision[1]-1));
+ orig_data[i][j].d[m][n].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
+ power = HDpow(2.0F, (double)(precision[2]-1));
+ orig_data[i][j].d[m][n].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]);
+ orig_data[i][j].d[m][n].f = float_val[i][j];
+ } /* end for */
+ } /* end for */
PASSED();
@@ -3525,9 +3591,8 @@ test_nbit_compound_2(hid_t file)
*/
TESTING(" nbit compound complex (write)");
- if(H5Dwrite(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0)
- goto error;
+ if(H5Dwrite(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ FAIL_STACK_ERROR
PASSED();
/*----------------------------------------------------------------------
@@ -3537,9 +3602,8 @@ test_nbit_compound_2(hid_t file)
TESTING(" nbit compound complex (read)");
/* Read the dataset back */
- if(H5Dread(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0)
- goto error;
+ if(H5Dread(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ FAIL_STACK_ERROR
/* Check that the values read are the same as the values written
* Use mask for checking the significant bits, ignoring the padding bits
@@ -3560,73 +3624,87 @@ test_nbit_compound_2(hid_t file)
s_mask = ~((unsigned)~0 << (precision[2] + offset[2])) & ((unsigned)~0 << offset[2]);
b_mask = ~((unsigned)~0 << (precision[4] + offset[4])) & ((unsigned)~0 << offset[4]);
for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
- b_failed = 0;
- d_failed = 0;
+ for(j=0; j<(size_t)size[1]; j++) {
+ b_failed = 0;
+ d_failed = 0;
- for(m = 0; m < (size_t)array_dims[0]; m++)
- for(n = 0; n < (size_t)array_dims[1]; n++)
- if((new_data[i][j].b[m][n]&b_mask)!=(orig_data[i][j].b[m][n]&b_mask)) {
+ for(m = 0; m < (size_t)array_dims[0]; m++)
+ for(n = 0; n < (size_t)array_dims[1]; n++)
+ if(((unsigned)new_data[i][j].b[m][n] & b_mask)!=((unsigned)orig_data[i][j].b[m][n] & b_mask)) {
b_failed = 1;
goto out;
- }
-
- for(m = 0; m < (size_t)array_dims[0]; m++)
- for(n = 0; n < (size_t)array_dims[1]; n++)
- if((new_data[i][j].d[m][n].i & i_mask)!=(orig_data[i][j].d[m][n].i & i_mask)||
- (new_data[i][j].d[m][n].c & c_mask)!=(orig_data[i][j].d[m][n].c & c_mask)||
- (new_data[i][j].d[m][n].s & s_mask)!=(orig_data[i][j].d[m][n].s & s_mask)||
- (new_data[i][j].d[m][n].f==new_data[i][j].d[m][n].f &&
- new_data[i][j].d[m][n].f != new_data[i][j].d[m][n].f)) {
- d_failed = 1;
- goto out;
- }
-
- out:
- if((new_data[i][j].a.i & i_mask)!=(orig_data[i][j].a.i & i_mask)||
- (new_data[i][j].a.c & c_mask)!=(orig_data[i][j].a.c & c_mask)||
- (new_data[i][j].a.s & s_mask)!=(orig_data[i][j].a.s & s_mask)||
- (new_data[i][j].a.f==new_data[i][j].a.f &&
- new_data[i][j].a.f != new_data[i][j].a.f)||
- new_data[i][j].v != orig_data[i][j].v || b_failed || d_failed) {
- H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
- goto error;
+ }
+
+ for(m = 0; m < (size_t)array_dims[0]; m++)
+ for(n = 0; n < (size_t)array_dims[1]; n++)
+ if(((unsigned)new_data[i][j].d[m][n].i & i_mask) != ((unsigned)orig_data[i][j].d[m][n].i & i_mask)||
+ ((unsigned)new_data[i][j].d[m][n].c & c_mask) != ((unsigned)orig_data[i][j].d[m][n].c & c_mask)||
+ ((unsigned)new_data[i][j].d[m][n].s & s_mask) != ((unsigned)orig_data[i][j].d[m][n].s & s_mask)||
+ (new_data[i][j].d[m][n].f == new_data[i][j].d[m][n].f && !H5_FLT_ABS_EQUAL(new_data[i][j].d[m][n].f, new_data[i][j].d[m][n].f))) {
+ d_failed = 1;
+ goto out;
+ }
+
+out:
+ if(((unsigned)new_data[i][j].a.i & i_mask) != ((unsigned)orig_data[i][j].a.i & i_mask)||
+ ((unsigned)new_data[i][j].a.c & c_mask) != ((unsigned)orig_data[i][j].a.c & c_mask)||
+ ((unsigned)new_data[i][j].a.s & s_mask) != ((unsigned)orig_data[i][j].a.s & s_mask)||
+ (new_data[i][j].a.f == new_data[i][j].a.f && !H5_FLT_ABS_EQUAL(new_data[i][j].a.f, new_data[i][j].a.f)) ||
+ new_data[i][j].v != orig_data[i][j].v || b_failed || d_failed) {
+ H5_FAILED();
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
+ goto error;
+ }
}
- }
}
/*----------------------------------------------------------------------
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(i_tid) < 0) goto error;
- if(H5Tclose(c_tid) < 0) goto error;
- if(H5Tclose(s_tid) < 0) goto error;
- if(H5Tclose(f_tid) < 0) goto error;
- if(H5Tclose(v_tid) < 0) goto error;
- if(H5Tclose(cmpd_tid2) < 0) goto error;
- if(H5Tclose(cmpd_tid1) < 0) goto error;
- if(H5Tclose(mem_cmpd_tid2) < 0) goto error;
- if(H5Tclose(mem_cmpd_tid1) < 0) goto error;
- if(H5Tclose(array_tid) < 0) goto error;
- if(H5Tclose(base_tid) < 0) goto error;
- if(H5Tclose(array_cmplx_tid) < 0) goto error;
- if(H5Tclose(mem_array_cmplx_tid) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if(H5Tclose(i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(f_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(v_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(cmpd_tid2) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(cmpd_tid1) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(mem_cmpd_tid2) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(mem_cmpd_tid1) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(array_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(base_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(array_cmplx_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(mem_array_cmplx_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(dc) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
+ return FAIL;
+} /* end test_nbit_compound_2() */
+
-
/*-------------------------------------------------------------------------
* Function: test_nbit_compound_3
*
@@ -3659,7 +3737,8 @@ test_nbit_compound_3(hid_t file)
const hsize_t chunk_size[1] = {5};
atomic orig_data[5];
atomic new_data[5];
- size_t i, k, j;
+ double power;
+ size_t i, k, j;
TESTING(" nbit compound with no-op type (setup)");
@@ -3706,8 +3785,9 @@ test_nbit_compound_3(hid_t file)
/* Initialize data */
for(i = 0; i < (size_t)size[0]; i++) {
+ power = HDpow(2.0F, 17.0F - 1.0F);
HDmemset(&orig_data[i], 0, sizeof(orig_data[i]));
- orig_data[i].i = HDrandom() % (long)HDpow(2.0F, 17.0F - 1.0F);
+ orig_data[i].i = (int)(HDrandom() % (long)power);
HDstrcpy(orig_data[i].str, "fixed-length C string");
orig_data[i].vl_str = HDstrdup("variable-length C string");
@@ -3755,8 +3835,8 @@ test_nbit_compound_3(hid_t file)
new_data[i].r != orig_data[i].r)
{
H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu\n", (unsigned long)i);
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %lu\n", (unsigned long)i);
goto error;
}
@@ -3764,8 +3844,8 @@ test_nbit_compound_3(hid_t file)
if(((unsigned int *)orig_data[i].v.p)[k] !=((unsigned int *)new_data[i].v.p)[k])
{
H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu\n", (unsigned long)i);
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %lu\n", (unsigned long)i);
goto error;
}
@@ -3773,8 +3853,8 @@ test_nbit_compound_3(hid_t file)
if(orig_data[i].o[j] != new_data[i].o[j])
{
H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu\n", (unsigned long)i);
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %lu\n", (unsigned long)i);
goto error;
}
}
@@ -3798,13 +3878,13 @@ test_nbit_compound_3(hid_t file)
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
+ return FAIL;
+} /* end test_nbit_compound_3() */
+
-
/*-------------------------------------------------------------------------
* Function: test_nbit_int_size
*
@@ -3826,6 +3906,7 @@ test_nbit_int_size(hid_t file)
hsize_t dims[2], chunk_size[2];
hsize_t dset_size = 0;
int orig_data[DSET_DIM1][DSET_DIM2];
+ double power;
int i, j;
size_t precision, offset;
@@ -3834,41 +3915,41 @@ test_nbit_int_size(hid_t file)
/* Define dataset datatype (integer), and set precision, offset */
if((datatype = H5Tcopy(H5T_NATIVE_INT)) < 0) {
H5_FAILED();
- printf(" line %d: H5Tcopy failed\n",__LINE__);
+ HDprintf(" line %d: H5Tcopy failed\n",__LINE__);
goto error;
} /* end if */
precision = 16; /* precision includes sign bit */
if(H5Tset_precision(datatype,precision)<0) {
H5_FAILED();
- printf(" line %d: H5Pset_precision failed\n",__LINE__);
+ HDprintf(" line %d: H5Pset_precision failed\n",__LINE__);
goto error;
} /* end if */
offset = 8;
if(H5Tset_offset(datatype,offset)<0) {
H5_FAILED();
- printf(" line %d: H5Tset_offset failed\n",__LINE__);
+ HDprintf(" line %d: H5Tset_offset failed\n",__LINE__);
goto error;
} /* end if */
/* Copy to memory datatype */
if((mem_datatype = H5Tcopy(datatype)) < 0) {
H5_FAILED();
- printf(" line %d: H5Tcopy failed\n",__LINE__);
+ HDprintf(" line %d: H5Tcopy failed\n",__LINE__);
goto error;
} /* end if */
/* Set order of dataset datatype */
if(H5Tset_order(datatype, H5T_ORDER_BE)<0) {
H5_FAILED();
- printf(" line %d: H5Pset_order failed\n",__LINE__);
+ HDprintf(" line %d: H5Pset_order failed\n",__LINE__);
goto error;
} /* end if */
if(H5Tset_size(datatype, 4)<0) {
H5_FAILED();
- printf(" line %d: H5Pset_size failed\n",__LINE__);
+ HDprintf(" line %d: H5Pset_size failed\n",__LINE__);
goto error;
} /* end if */
@@ -3876,8 +3957,10 @@ test_nbit_int_size(hid_t file)
* corresponding to the memory datatype's precision and offset.
*/
for (i=0; i < DSET_DIM1; i++)
- for (j=0; j < DSET_DIM2; j++)
- orig_data[i][j] = rand() % (int)pow((double)2, (double)(precision-1)) << offset;
+ for (j=0; j < DSET_DIM2; j++) {
+ power = HDpow(2.0F, (double)(precision-1));
+ orig_data[i][j] = HDrandom() % (int)power << offset;
+ } /* end for */
/* Describe the dataspace. */
@@ -3885,7 +3968,7 @@ test_nbit_int_size(hid_t file)
dims[1] = DSET_DIM2;
if((dataspace = H5Screate_simple (2, dims, NULL))<0) {
H5_FAILED();
- printf(" line %d: H5Pcreate failed\n",__LINE__);
+ HDprintf(" line %d: H5Pcreate failed\n",__LINE__);
goto error;
} /* end if */
@@ -3896,13 +3979,13 @@ test_nbit_int_size(hid_t file)
chunk_size[1] = DSET_DIM2/10;
if((dset_create_props = H5Pcreate (H5P_DATASET_CREATE))<0) {
H5_FAILED();
- printf(" line %d: H5Pcreate failed\n",__LINE__);
+ HDprintf(" line %d: H5Pcreate failed\n",__LINE__);
goto error;
} /* end if */
if(H5Pset_chunk (dset_create_props, 2, chunk_size)<0) {
H5_FAILED();
- printf(" line %d: H5Pset_chunk failed\n",__LINE__);
+ HDprintf(" line %d: H5Pset_chunk failed\n",__LINE__);
goto error;
} /* end if */
@@ -3911,7 +3994,7 @@ test_nbit_int_size(hid_t file)
*/
if(H5Pset_nbit (dset_create_props)<0) {
H5_FAILED();
- printf(" line %d: H5Pset_nbit failed\n",__LINE__);
+ HDprintf(" line %d: H5Pset_nbit failed\n",__LINE__);
goto error;
} /* end if */
@@ -3922,7 +4005,7 @@ test_nbit_int_size(hid_t file)
dataspace, H5P_DEFAULT,
dset_create_props, H5P_DEFAULT))<0) {
H5_FAILED();
- printf(" line %d: H5dwrite failed\n",__LINE__);
+ HDprintf(" line %d: H5dwrite failed\n",__LINE__);
goto error;
} /* end if */
@@ -3932,7 +4015,7 @@ test_nbit_int_size(hid_t file)
if(H5Dwrite (dataset, mem_datatype, H5S_ALL, H5S_ALL,
H5P_DEFAULT, orig_data)<0) {
H5_FAILED();
- printf(" Line %d: H5Dwrite failed\n",__LINE__);
+ HDprintf(" Line %d: H5Dwrite failed\n",__LINE__);
goto error;
} /* end if */
@@ -3941,7 +4024,7 @@ test_nbit_int_size(hid_t file)
*/
if((precision = H5Tget_precision(datatype)) == 0) {
H5_FAILED();
- printf(" Line %d: wrong precision size: %zu\n",__LINE__, precision);
+ HDprintf(" Line %d: wrong precision size: %zu\n",__LINE__, precision);
goto error;
} /* end if */
@@ -3963,12 +4046,12 @@ test_nbit_int_size(hid_t file)
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
+ return FAIL;
+} /* end test_nbit_int_size() */
+
-
/*-------------------------------------------------------------------------
* Function: test_nbit_flt_size
*
@@ -4021,7 +4104,7 @@ test_nbit_flt_size(hid_t file)
*-------------------------------------------------------------------*/
if((datatype = H5Tcopy(H5T_IEEE_F32LE)) < 0) {
H5_FAILED();
- printf(" line %d: H5Tcopy failed\n",__LINE__);
+ HDprintf(" line %d: H5Tcopy failed\n",__LINE__);
goto error;
} /* end if */
@@ -4035,38 +4118,38 @@ test_nbit_flt_size(hid_t file)
if(H5Tset_fields(datatype, spos, epos, esize, mpos, msize)<0) {
H5_FAILED();
- printf(" line %d: H5Tset_fields failed\n",__LINE__);
+ HDprintf(" line %d: H5Tset_fields failed\n",__LINE__);
goto error;
} /* end if */
if(H5Tset_offset(datatype,offset)<0) {
H5_FAILED();
- printf(" line %d: H5Tset_offset failed\n",__LINE__);
+ HDprintf(" line %d: H5Tset_offset failed\n",__LINE__);
goto error;
} /* end if */
if(H5Tset_precision(datatype,precision)<0) {
H5_FAILED();
- printf(" line %d: H5Tset_precision failed\n",__LINE__);
+ HDprintf(" line %d: H5Tset_precision failed\n",__LINE__);
goto error;
} /* end if */
if(H5Tset_size(datatype, 4)<0) {
H5_FAILED();
- printf(" line %d: H5Pset_size failed\n",__LINE__);
+ HDprintf(" line %d: H5Pset_size failed\n",__LINE__);
goto error;
} /* end if */
/* Set order of dataset datatype */
if(H5Tset_order(datatype, H5T_ORDER_BE)<0) {
H5_FAILED();
- printf(" line %d: H5Pset_order failed\n",__LINE__);
+ HDprintf(" line %d: H5Pset_order failed\n",__LINE__);
goto error;
} /* end if */
if(H5Tset_ebias(datatype, 31)<0) {
H5_FAILED();
- printf(" line %d: H5Pset_size failed\n",__LINE__);
+ HDprintf(" line %d: H5Pset_size failed\n",__LINE__);
goto error;
} /* end if */
@@ -4075,7 +4158,7 @@ test_nbit_flt_size(hid_t file)
*/
for (i=0; i < DSET_DIM1; i++)
for (j=0; j < DSET_DIM2; j++)
- orig_data[i][j] = (rand() % 1234567) / 2;
+ orig_data[i][j] = (float)(HDrandom() % 1234567) / 2;
/* Describe the dataspace. */
@@ -4083,7 +4166,7 @@ test_nbit_flt_size(hid_t file)
dims[1] = DSET_DIM2;
if((dataspace = H5Screate_simple (2, dims, NULL))<0) {
H5_FAILED();
- printf(" line %d: H5Pcreate failed\n",__LINE__);
+ HDprintf(" line %d: H5Pcreate failed\n",__LINE__);
goto error;
} /* end if */
@@ -4094,13 +4177,13 @@ test_nbit_flt_size(hid_t file)
chunk_size[1] = DSET_DIM2/10;
if((dset_create_props = H5Pcreate (H5P_DATASET_CREATE))<0) {
H5_FAILED();
- printf(" line %d: H5Pcreate failed\n",__LINE__);
+ HDprintf(" line %d: H5Pcreate failed\n",__LINE__);
goto error;
} /* end if */
if(H5Pset_chunk (dset_create_props, 2, chunk_size)<0) {
H5_FAILED();
- printf(" line %d: H5Pset_chunk failed\n",__LINE__);
+ HDprintf(" line %d: H5Pset_chunk failed\n",__LINE__);
goto error;
} /* end if */
@@ -4109,7 +4192,7 @@ test_nbit_flt_size(hid_t file)
*/
if(H5Pset_nbit (dset_create_props)<0) {
H5_FAILED();
- printf(" line %d: H5Pset_nbit failed\n",__LINE__);
+ HDprintf(" line %d: H5Pset_nbit failed\n",__LINE__);
goto error;
} /* end if */
@@ -4120,7 +4203,7 @@ test_nbit_flt_size(hid_t file)
dataspace, H5P_DEFAULT,
dset_create_props, H5P_DEFAULT))<0) {
H5_FAILED();
- printf(" line %d: H5dwrite failed\n",__LINE__);
+ HDprintf(" line %d: H5dwrite failed\n",__LINE__);
goto error;
} /* end if */
@@ -4130,7 +4213,7 @@ test_nbit_flt_size(hid_t file)
if(H5Dwrite (dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
H5P_DEFAULT, orig_data)<0) {
H5_FAILED();
- printf(" Line %d: H5Dwrite failed\n",__LINE__);
+ HDprintf(" Line %d: H5Dwrite failed\n",__LINE__);
goto error;
} /* end if */
@@ -4139,7 +4222,7 @@ test_nbit_flt_size(hid_t file)
*/
if((precision = H5Tget_precision(datatype)) == 0) {
H5_FAILED();
- printf(" Line %d: wrong precision size: %zu\n",__LINE__, precision);
+ HDprintf(" Line %d: wrong precision size: %zu\n",__LINE__, precision);
goto error;
} /* end if */
@@ -4160,11 +4243,11 @@ test_nbit_flt_size(hid_t file)
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
-
+ return FAIL;
+} /* end test_nbit_flt_size() */
+
/*-------------------------------------------------------------------------
* Function: test_scaleoffset_int
*
@@ -4190,7 +4273,7 @@ test_scaleoffset_int(hid_t file)
int new_data[2][5];
size_t i, j;
- puts("Testing scaleoffset filter");
+ HDputs("Testing scaleoffset filter");
TESTING(" scaleoffset int without fill value (setup)");
datatype = H5Tcopy(H5T_NATIVE_INT);
@@ -4253,8 +4336,8 @@ test_scaleoffset_int(hid_t file)
for(j=0; j<(size_t)size[1]; j++) {
if(new_data[i][j] != orig_data[i][j]) {
H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
goto error;
}
}
@@ -4271,12 +4354,12 @@ test_scaleoffset_int(hid_t file)
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
+ return FAIL;
+} /* end test_scaleoffset_int() */
+
-
/*-------------------------------------------------------------------------
* Function: test_scaleoffset_int_2
*
@@ -4382,8 +4465,8 @@ test_scaleoffset_int_2(hid_t file)
for(j=0; j<(size_t)size[1]; j++) {
if(new_data[0][j] != orig_data[0][j]) {
H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j);
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j);
goto error;
}
}
@@ -4399,12 +4482,12 @@ test_scaleoffset_int_2(hid_t file)
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
+ return FAIL;
+} /* end test_scaleoffset_int_2() */
+
-
/*-------------------------------------------------------------------------
* Function: test_scaleoffset_float
*
@@ -4459,7 +4542,7 @@ test_scaleoffset_float(hid_t file)
/* Initialize data */
for(i= 0;i< (size_t)size[0]; i++)
for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[i][j] = (float)((HDrandom() % 100000) / 1000.0F);
+ orig_data[i][j] = (float)(HDrandom() % 100000) / 1000.0F;
/* even-numbered values are negtive */
if((i*size[1]+j+1)%2 == 0)
@@ -4494,8 +4577,8 @@ test_scaleoffset_float(hid_t file)
for(j=0; j<(size_t)size[1]; j++) {
if(HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0F, -3.0F)) {
H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
goto error;
}
}
@@ -4512,12 +4595,12 @@ test_scaleoffset_float(hid_t file)
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
+ return FAIL;
+} /* end test_scaleoffset_float() */
+
-
/*-------------------------------------------------------------------------
* Function: test_scaleoffset_float_2
*
@@ -4590,10 +4673,10 @@ test_scaleoffset_float_2(hid_t file)
/* Initialize data of hyperslab */
for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[0][j] = (float)((HDrandom() % 100000) / 1000.0F);
+ orig_data[0][j] = (float)(HDrandom() % 100000) / 1000.0F;
/* even-numbered values are negtive */
- if((j+1)%2 == 0)
+ if((j + 1) % 2 == 0)
orig_data[0][j] = -orig_data[0][j];
}
@@ -4625,8 +4708,8 @@ test_scaleoffset_float_2(hid_t file)
for(j=0; j<(size_t)size[1]; j++) {
if(HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0F, -3.0F)) {
H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j);
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j);
goto error;
}
}
@@ -4641,12 +4724,12 @@ test_scaleoffset_float_2(hid_t file)
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
+ return FAIL;
+} /* end test_scaleoffset_float_2() */
+
-
/*-------------------------------------------------------------------------
* Function: test_scaleoffset_double
*
@@ -4701,10 +4784,10 @@ test_scaleoffset_double(hid_t file)
/* Initialize data */
for(i= 0;i< (size_t)size[0]; i++)
for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[i][j] = (HDrandom() % 10000000) / 10000000.0F;
+ orig_data[i][j] = (float)(HDrandom() % 10000000) / 10000000.0F;
/* even-numbered values are negtive */
- if((i*size[1]+j+1)%2 == 0)
+ if((i* size[1] + j + 1) % 2 == 0)
orig_data[i][j] = -orig_data[i][j];
}
@@ -4736,8 +4819,8 @@ test_scaleoffset_double(hid_t file)
for(j=0; j<(size_t)size[1]; j++) {
if(HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0F, -7.0F)) {
H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
goto error;
}
}
@@ -4754,12 +4837,12 @@ test_scaleoffset_double(hid_t file)
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
+ return FAIL;
+} /* end test_scaleoffset_double() */
+
-
/*-------------------------------------------------------------------------
* Function: test_scaleoffset_double_2
*
@@ -4832,10 +4915,10 @@ test_scaleoffset_double_2(hid_t file)
/* Initialize data of hyperslab */
for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[0][j] = (HDrandom() % 10000000) / 10000000.0F;
+ orig_data[0][j] = (float)(HDrandom() % 10000000) / 10000000.0F;
/* even-numbered values are negtive */
- if((j+1)%2 == 0)
+ if((j + 1) % 2 == 0)
orig_data[0][j] = -orig_data[0][j];
}
@@ -4867,8 +4950,8 @@ test_scaleoffset_double_2(hid_t file)
for(j=0; j<(size_t)size[1]; j++) {
if(HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0F, -7.0F)) {
H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j);
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j);
goto error;
}
}
@@ -4884,25 +4967,25 @@ test_scaleoffset_double_2(hid_t file)
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
-}
+ return FAIL;
+} /* end test_scaleoffset_double_2() */
+
-
/*-------------------------------------------------------------------------
* Function: test_multiopen
*
- * Purpose: Tests that a bug no longer exists. If a dataset is opened
- * twice and one of the handles is used to extend the dataset,
- * then the other handle should return the new size when
- * queried.
+ * Purpose: Tests that a bug no longer exists. If a dataset is opened
+ * twice and one of the handles is used to extend the dataset,
+ * then the other handle should return the new size when
+ * queried.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, June 9, 1998
*
*-------------------------------------------------------------------------
@@ -4910,10 +4993,10 @@ error:
static herr_t
test_multiopen (hid_t file)
{
- hid_t dcpl = -1, space = -1, dset1 = -1, dset2 = -1;
- hsize_t cur_size[1] = {10};
- static hsize_t max_size[1] = {H5S_UNLIMITED};
- hsize_t tmp_size[1];
+ hid_t dcpl = -1, space = -1, dset1 = -1, dset2 = -1;
+ hsize_t cur_size[1] = {10};
+ hsize_t tmp_size[1];
+ static hsize_t max_size[1] = {H5S_UNLIMITED};
TESTING("multi-open with extending");
@@ -4933,9 +5016,9 @@ test_multiopen (hid_t file)
if((space = H5Dget_space(dset2)) < 0) goto error;
if(H5Sget_simple_extent_dims(space, tmp_size, NULL) < 0) goto error;
if(cur_size[0] != tmp_size[0]) {
- H5_FAILED();
- printf(" Got %d instead of %d!\n", (int)tmp_size[0], (int)cur_size[0]);
- goto error;
+ H5_FAILED();
+ HDprintf(" Got %d instead of %d!\n", (int)tmp_size[0], (int)cur_size[0]);
+ goto error;
} /* end if */
if(H5Dclose(dset1) < 0) goto error;
@@ -4944,19 +5027,19 @@ test_multiopen (hid_t file)
if(H5Pclose(dcpl) < 0) goto error;
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
- H5Dclose(dset1);
- H5Dclose(dset2);
- H5Sclose(space);
- H5Pclose(dcpl);
+ H5Dclose(dset1);
+ H5Dclose(dset2);
+ H5Sclose(space);
+ H5Pclose(dcpl);
} H5E_END_TRY;
- return -1;
-}
+ return FAIL;
+} /* end test_multiopen() */
+
-
/*-------------------------------------------------------------------------
* Function: test_types
*
@@ -5040,7 +5123,7 @@ test_types(hid_t file)
/* Cleanup */
if(H5Gclose(grp) < 0) goto error;
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -5049,8 +5132,8 @@ test_types(hid_t file)
H5Sclose(space);
H5Dclose(dset);
} H5E_END_TRY;
- return -1;
-}
+ return FAIL;
+} /* end test_types() */
/* This message derives from H5Z */
const H5Z_class2_t H5Z_CAN_APPLY_TEST[1] = {{
@@ -5063,7 +5146,7 @@ const H5Z_class2_t H5Z_CAN_APPLY_TEST[1] = {{
filter_bogus, /* The actual filter function */
}};
-
+
/*-------------------------------------------------------------------------
* Function: test_can_apply
*
@@ -5096,30 +5179,30 @@ test_can_apply(hid_t file)
/* Create dcpl with special filter */
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't create dcpl\n",__LINE__);
+ HDprintf(" Line %d: Can't create dcpl\n",__LINE__);
goto error;
} /* end if */
if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) {
H5_FAILED();
- printf(" Line %d: Can't set chunk sizes\n",__LINE__);
+ HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__);
goto error;
} /* end if */
if(H5Zregister (H5Z_CAN_APPLY_TEST) < 0) {
H5_FAILED();
- printf(" Line %d: Can't register 'can apply' filter\n",__LINE__);
+ HDprintf(" Line %d: Can't register 'can apply' filter\n",__LINE__);
goto error;
}
/* The filter is mandate. */
if(H5Pset_filter(dcpl, H5Z_FILTER_CAN_APPLY_TEST, 0, (size_t)0, NULL) < 0) {
H5_FAILED();
- printf(" Line %d: Can't set bogus filter\n",__LINE__);
+ HDprintf(" Line %d: Can't set bogus filter\n",__LINE__);
goto error;
}
/* Create the data space */
if((sid = H5Screate_simple(2, dims, NULL)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't open dataspace\n",__LINE__);
+ HDprintf(" Line %d: Can't open dataspace\n",__LINE__);
goto error;
} /* end if */
@@ -5131,7 +5214,7 @@ test_can_apply(hid_t file)
} H5E_END_TRY;
if(dsid >=0) {
H5_FAILED();
- printf(" Line %d: Shouldn't have created dataset!\n",__LINE__);
+ HDprintf(" Line %d: Shouldn't have created dataset!\n",__LINE__);
H5Dclose(dsid);
goto error;
} /* end if */
@@ -5142,7 +5225,7 @@ test_can_apply(hid_t file)
} H5E_END_TRY;
if(dsid >=0) {
H5_FAILED();
- printf(" Line %d: Shouldn't have created dataset!\n",__LINE__);
+ HDprintf(" Line %d: Shouldn't have created dataset!\n",__LINE__);
H5Dclose(dsid);
goto error;
} /* end if */
@@ -5150,42 +5233,42 @@ test_can_apply(hid_t file)
/* Create new dataset */
if((dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't create dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't create dataset\n",__LINE__);
goto error;
} /* end if */
/* Write data */
if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) {
H5_FAILED();
- printf(" Line %d: Error writing dataset data\n",__LINE__);
+ HDprintf(" Line %d: Error writing dataset data\n",__LINE__);
goto error;
} /* end if */
/* Flush the file (to clear the cache) */
if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) {
H5_FAILED();
- printf(" Line %d: Error flushing file\n",__LINE__);
+ HDprintf(" Line %d: Error flushing file\n",__LINE__);
goto error;
} /* end if */
/* Query the dataset's size on disk */
if((dset_size=H5Dget_storage_size(dsid))==0) {
H5_FAILED();
- printf(" Line %d: Error querying dataset size\n",__LINE__);
+ HDprintf(" Line %d: Error querying dataset size\n",__LINE__);
goto error;
} /* end if */
/* Verify that the size indicates data is uncompressed */
if((H5Tget_size(H5T_NATIVE_INT)*dims[0]*dims[1])!=dset_size) {
H5_FAILED();
- printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size);
+ HDprintf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size);
goto error;
} /* end if */
/* Read data */
if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) {
H5_FAILED();
- printf(" Line %d: Error reading dataset data\n",__LINE__);
+ HDprintf(" Line %d: Error reading dataset data\n",__LINE__);
goto error;
} /* end if */
@@ -5195,10 +5278,10 @@ test_can_apply(hid_t file)
for(j=0; j<(size_t)dims[1]; j++) {
if(points[i][j] != check[i][j]) {
H5_FAILED();
- printf(" Line %d: Read different values than written.\n",__LINE__);
- printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
- printf(" At original: %d\n",points[i][j]);
- printf(" At returned: %d\n",check[i][j]);
+ HDprintf(" Line %d: Read different values than written.\n",__LINE__);
+ HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
+ HDprintf(" At original: %d\n",points[i][j]);
+ HDprintf(" At returned: %d\n",check[i][j]);
goto error;
} /* end if */
} /* end for */
@@ -5207,30 +5290,30 @@ test_can_apply(hid_t file)
/* Close dataset */
if(H5Dclose(dsid) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't close dataset\n",__LINE__);
goto error;
} /* end if */
/* Close dataspace */
if(H5Sclose(sid) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close dataspace\n",__LINE__);
+ HDprintf(" Line %d: Can't close dataspace\n",__LINE__);
goto error;
} /* end if */
/* Close dataset creation property list */
if(H5Pclose(dcpl) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close dcpl\n",__LINE__);
+ HDprintf(" Line %d: Can't close dcpl\n",__LINE__);
goto error;
} /* end if */
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
+ return FAIL;
} /* end test_can_apply() */
/* This message derives from H5Z */
@@ -5244,7 +5327,7 @@ const H5Z_class2_t H5Z_CAN_APPLY_TEST2[1] = {{
filter_bogus3, /* The actual filter function */
}};
-
+
/*-------------------------------------------------------------------------
* Function: test_can_apply2
*
@@ -5279,72 +5362,72 @@ test_can_apply2(hid_t file)
/* Create dcpl with special filter */
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't create dcpl\n",__LINE__);
+ HDprintf(" Line %d: Can't create dcpl\n",__LINE__);
goto error;
} /* end if */
if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) {
H5_FAILED();
- printf(" Line %d: Can't set chunk sizes\n",__LINE__);
+ HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__);
goto error;
} /* end if */
if(H5Zregister (H5Z_CAN_APPLY_TEST2) < 0) {
H5_FAILED();
- printf(" Line %d: Can't register 'can apply' filter\n",__LINE__);
+ HDprintf(" Line %d: Can't register 'can apply' filter\n",__LINE__);
goto error;
}
/* The filter is optional. */
if(H5Pset_filter(dcpl, H5Z_FILTER_CAN_APPLY_TEST2, H5Z_FLAG_OPTIONAL, (size_t)0, NULL) < 0) {
H5_FAILED();
- printf(" Line %d: Can't set bogus filter\n",__LINE__);
+ HDprintf(" Line %d: Can't set bogus filter\n",__LINE__);
goto error;
}
/* Create the data space */
if((sid = H5Screate_simple(2, dims, NULL)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't open dataspace\n",__LINE__);
+ HDprintf(" Line %d: Can't open dataspace\n",__LINE__);
goto error;
} /* end if */
/* Create new dataset */
if((dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME2, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't create dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't create dataset\n",__LINE__);
goto error;
} /* end if */
/* Write data */
if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) {
H5_FAILED();
- printf(" Line %d: Error writing dataset data\n",__LINE__);
+ HDprintf(" Line %d: Error writing dataset data\n",__LINE__);
goto error;
} /* end if */
/* Flush the file (to clear the cache) */
if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) {
H5_FAILED();
- printf(" Line %d: Error flushing file\n",__LINE__);
+ HDprintf(" Line %d: Error flushing file\n",__LINE__);
goto error;
} /* end if */
/* Query the dataset's size on disk */
if((dset_size=H5Dget_storage_size(dsid))==0) {
H5_FAILED();
- printf(" Line %d: Error querying dataset size\n",__LINE__);
+ HDprintf(" Line %d: Error querying dataset size\n",__LINE__);
goto error;
} /* end if */
/* Verify that the size indicates data is uncompressed */
if((H5Tget_size(H5T_NATIVE_DOUBLE)*dims[0]*dims[1])!=dset_size) {
H5_FAILED();
- printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size);
+ HDprintf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size);
goto error;
} /* end if */
/* Read data */
if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) {
H5_FAILED();
- printf(" Line %d: Error reading dataset data\n",__LINE__);
+ HDprintf(" Line %d: Error reading dataset data\n",__LINE__);
goto error;
} /* end if */
@@ -5354,10 +5437,10 @@ test_can_apply2(hid_t file)
for(j=0; j<(size_t)dims[1]; j++) {
if(points[i][j] != check[i][j]) {
H5_FAILED();
- printf(" Line %d: Read different values than written.\n",__LINE__);
- printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
- printf(" At original: %d\n",points[i][j]);
- printf(" At returned: %d\n",check[i][j]);
+ HDprintf(" Line %d: Read different values than written.\n",__LINE__);
+ HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
+ HDprintf(" At original: %d\n",points[i][j]);
+ HDprintf(" At returned: %d\n",check[i][j]);
goto error;
} /* end if */
} /* end for */
@@ -5366,34 +5449,34 @@ test_can_apply2(hid_t file)
/* Close dataset */
if(H5Dclose(dsid) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't close dataset\n",__LINE__);
goto error;
} /* end if */
/* Close dataspace */
if(H5Sclose(sid) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close dataspace\n",__LINE__);
+ HDprintf(" Line %d: Can't close dataspace\n",__LINE__);
goto error;
} /* end if */
/* Close dataset creation property list */
if(H5Pclose(dcpl) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close dcpl\n",__LINE__);
+ HDprintf(" Line %d: Can't close dcpl\n",__LINE__);
goto error;
} /* end if */
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
+ return FAIL;
} /* end test_can_apply2() */
-
+
/*-------------------------------------------------------------------------
* Function: test_can_apply_szip
*
@@ -5436,19 +5519,19 @@ file)
/* Create the data space */
if((sid = H5Screate_simple(2, dims, NULL)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't open dataspace\n",__LINE__);
+ HDprintf(" Line %d: Can't open dataspace\n",__LINE__);
goto error;
} /* end if */
/* Create dcpl with special filter */
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't create dcpl\n",__LINE__);
+ HDprintf(" Line %d: Can't create dcpl\n",__LINE__);
goto error;
} /* end if */
if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) {
H5_FAILED();
- printf(" Line %d: Can't set chunk sizes\n",__LINE__);
+ HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__);
goto error;
} /* end if */
@@ -5459,7 +5542,7 @@ file)
} H5E_END_TRY;
if(ret>=0) {
H5_FAILED();
- printf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__);
+ HDprintf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__);
goto error;
}
@@ -5470,7 +5553,7 @@ file)
} H5E_END_TRY;
if(ret>=0) {
H5_FAILED();
- printf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__);
+ HDprintf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__);
goto error;
}
@@ -5478,7 +5561,7 @@ file)
szip_pixels_per_block=2;
if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block) < 0) {
H5_FAILED();
- printf(" Line %d: Can't set szip filter\n",__LINE__);
+ HDprintf(" Line %d: Can't set szip filter\n",__LINE__);
goto error;
}
@@ -5490,47 +5573,47 @@ file)
} H5E_END_TRY;
if(dsid <=0) {
H5_FAILED();
- printf(" Line %d: Should have created dataset!\n",__LINE__);
+ HDprintf(" Line %d: Should have created dataset!\n",__LINE__);
goto error;
} /* end if */
/* Close dataset */
if(H5Dclose(dsid) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't close dataset\n",__LINE__);
goto error;
} /* end if */
/* Close dataspace */
if(H5Sclose(sid) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close dataspace\n",__LINE__);
+ HDprintf(" Line %d: Can't close dataspace\n",__LINE__);
goto error;
} /* end if */
/* Close dataset creation property list */
if(H5Pclose(dcpl) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close dcpl\n",__LINE__);
+ HDprintf(" Line %d: Can't close dcpl\n",__LINE__);
goto error;
} /* end if */
/* Create another data space */
if((sid = H5Screate_simple(2, dims2, NULL)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't open dataspace\n",__LINE__);
+ HDprintf(" Line %d: Can't open dataspace\n",__LINE__);
goto error;
} /* end if */
/* Create dcpl with special filter */
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't create dcpl\n",__LINE__);
+ HDprintf(" Line %d: Can't create dcpl\n",__LINE__);
goto error;
} /* end if */
if(H5Pset_chunk(dcpl, 2, chunk_dims2) < 0) {
H5_FAILED();
- printf(" Line %d: Can't set chunk sizes\n",__LINE__);
+ HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__);
goto error;
} /* end if */
@@ -5538,7 +5621,7 @@ file)
szip_pixels_per_block=32;
if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block) < 0) {
H5_FAILED();
- printf(" Line %d: Can't set szip filter\n",__LINE__);
+ HDprintf(" Line %d: Can't set szip filter\n",__LINE__);
goto error;
}
@@ -5549,7 +5632,7 @@ file)
} H5E_END_TRY;
if(dsid >=0) {
H5_FAILED();
- printf(" Line %d: Shouldn't have created dataset!\n",__LINE__);
+ HDprintf(" Line %d: Shouldn't have created dataset!\n",__LINE__);
H5Dclose(dsid);
goto error;
} /* end if */
@@ -5557,14 +5640,14 @@ file)
/* Close dataspace */
if(H5Sclose(sid) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close dataspace\n",__LINE__);
+ HDprintf(" Line %d: Can't close dataspace\n",__LINE__);
goto error;
} /* end if */
/* Close dataset creation property list */
if(H5Pclose(dcpl) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close dcpl\n",__LINE__);
+ HDprintf(" Line %d: Can't close dcpl\n",__LINE__);
goto error;
} /* end if */
@@ -5572,17 +5655,17 @@ file)
PASSED();
} else {
SKIPPED();
- puts(" Szip encoding is not enabled.");
+ HDputs(" Szip encoding is not enabled.");
}
#else /* H5_HAVE_FILTER_SZIP */
SKIPPED();
- puts(" Szip filter is not enabled.");
+ HDputs(" Szip filter is not enabled.");
#endif /* H5_HAVE_FILTER_SZIP */
- return 0;
+ return SUCCEED;
#ifdef H5_HAVE_FILTER_SZIP
error:
- return -1;
+ return FAIL;
#endif /* H5_HAVE_FILTER_SZIP */
} /* end test_can_apply_szip() */
@@ -5598,7 +5681,7 @@ const H5Z_class2_t H5Z_SET_LOCAL_TEST[1] = {{
filter_bogus2, /* The actual filter function */
}};
-
+
/*-------------------------------------------------------------------------
* Function: test_set_local
*
@@ -5642,57 +5725,57 @@ test_set_local(hid_t fapl)
/* Open file */
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't open file\n",__LINE__);
+ HDprintf(" Line %d: Can't open file\n",__LINE__);
goto error;
}
/* Create dcpl with special filter */
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't create dcpl\n",__LINE__);
+ HDprintf(" Line %d: Can't create dcpl\n",__LINE__);
goto error;
} /* end if */
if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) {
H5_FAILED();
- printf(" Line %d: Can't set chunk sizes\n",__LINE__);
+ HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__);
goto error;
} /* end if */
if(H5Zregister (H5Z_SET_LOCAL_TEST) < 0) {
H5_FAILED();
- printf(" Line %d: Can't register 'set local' filter\n",__LINE__);
+ HDprintf(" Line %d: Can't register 'set local' filter\n",__LINE__);
goto error;
}
if(H5Pset_filter(dcpl, H5Z_FILTER_SET_LOCAL_TEST, 0, (size_t)BOGUS2_PERM_NPARMS, cd_values) < 0) {
H5_FAILED();
- printf(" Line %d: Can't set bogus2 filter\n",__LINE__);
+ HDprintf(" Line %d: Can't set bogus2 filter\n",__LINE__);
goto error;
}
/* Create the data space */
if((sid = H5Screate_simple(2, dims, NULL)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't open dataspace\n",__LINE__);
+ HDprintf(" Line %d: Can't open dataspace\n",__LINE__);
goto error;
} /* end if */
/* Create new dataset */
if((dsid = H5Dcreate2(file, DSET_SET_LOCAL_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't create dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't create dataset\n",__LINE__);
goto error;
} /* end if */
/* Write data */
if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) {
H5_FAILED();
- printf(" Line %d: Error writing dataset data\n",__LINE__);
+ HDprintf(" Line %d: Error writing dataset data\n",__LINE__);
goto error;
} /* end if */
/* Close dataset */
if(H5Dclose(dsid) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't close dataset\n",__LINE__);
goto error;
} /* end if */
@@ -5700,77 +5783,77 @@ test_set_local(hid_t fapl)
/* (Shouldn't get modified by output filter) */
if((dsid = H5Dcreate2(file, DSET_SET_LOCAL_NAME_2, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't create dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't create dataset\n",__LINE__);
goto error;
} /* end if */
/* Write data */
if(H5Dwrite(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_dbl) < 0) {
H5_FAILED();
- printf(" Line %d: Error writing dataset data\n",__LINE__);
+ HDprintf(" Line %d: Error writing dataset data\n",__LINE__);
goto error;
} /* end if */
/* Close dataset */
if(H5Dclose(dsid) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't close dataset\n",__LINE__);
goto error;
} /* end if */
/* Close dataspace */
if(H5Sclose(sid) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close dataspace\n", __LINE__);
+ HDprintf(" Line %d: Can't close dataspace\n", __LINE__);
goto error;
} /* end if */
/* Close dataset creation property list */
if(H5Pclose(dcpl) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close dcpl\n", __LINE__);
+ HDprintf(" Line %d: Can't close dcpl\n", __LINE__);
goto error;
} /* end if */
/* Close file (flushes & empties cache) */
if(H5Fclose(file) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close file\n", __LINE__);
+ HDprintf(" Line %d: Can't close file\n", __LINE__);
goto error;
} /* end if */
/* Open file */
if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't open file\n", __LINE__);
+ HDprintf(" Line %d: Can't open file\n", __LINE__);
goto error;
}
/* Re-open dataset */
if((dsid = H5Dopen2(file, DSET_SET_LOCAL_NAME, H5P_DEFAULT)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't open dataset\n", __LINE__);
+ HDprintf(" Line %d: Can't open dataset\n", __LINE__);
goto error;
} /* end if */
/* Query the dataset's size on disk */
if((dset_size = H5Dget_storage_size(dsid)) == 0) {
H5_FAILED();
- printf(" Line %d: Error querying dataset size\n", __LINE__);
+ HDprintf(" Line %d: Error querying dataset size\n", __LINE__);
goto error;
} /* end if */
/* Verify that the size indicates data is uncompressed */
if((H5Tget_size(H5T_NATIVE_INT) * dims[0] * dims[1]) != dset_size) {
H5_FAILED();
- printf(" Line %d: Incorrect dataset size: %lu\n", __LINE__, (unsigned long)dset_size);
+ HDprintf(" Line %d: Incorrect dataset size: %lu\n", __LINE__, (unsigned long)dset_size);
goto error;
} /* end if */
/* Read data */
if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) {
H5_FAILED();
- printf(" Line %d: Error reading dataset data\n", __LINE__);
+ HDprintf(" Line %d: Error reading dataset data\n", __LINE__);
goto error;
} /* end if */
@@ -5780,10 +5863,10 @@ test_set_local(hid_t fapl)
for(j=0; j<dims[1]; j++) {
if((points[i][j]+(int)sizeof(int)) != check[i][j]) {
H5_FAILED();
- printf(" Line %d: Read different values than written.\n",__LINE__);
- printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
- printf(" At original: %d\n",points[i][j]);
- printf(" At returned: %d\n",check[i][j]);
+ HDprintf(" Line %d: Read different values than written.\n",__LINE__);
+ HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
+ HDprintf(" At original: %d\n",points[i][j]);
+ HDprintf(" At returned: %d\n",check[i][j]);
goto error;
} /* end if */
} /* end for */
@@ -5792,35 +5875,35 @@ test_set_local(hid_t fapl)
/* Close dataset */
if(H5Dclose(dsid) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close dataset\n", __LINE__);
+ HDprintf(" Line %d: Can't close dataset\n", __LINE__);
goto error;
} /* end if */
/* Re-open second dataset */
if((dsid = H5Dopen2(file, DSET_SET_LOCAL_NAME_2, H5P_DEFAULT)) < 0) {
H5_FAILED();
- printf(" Line %d: Can't open dataset\n", __LINE__);
+ HDprintf(" Line %d: Can't open dataset\n", __LINE__);
goto error;
} /* end if */
/* Query the dataset's size on disk */
if((dset_size = H5Dget_storage_size(dsid)) == 0) {
H5_FAILED();
- printf(" Line %d: Error querying dataset size\n", __LINE__);
+ HDprintf(" Line %d: Error querying dataset size\n", __LINE__);
goto error;
} /* end if */
/* Verify that the size indicates data is uncompressed */
if((H5Tget_size(H5T_NATIVE_DOUBLE) * dims[0] * dims[1]) != dset_size) {
H5_FAILED();
- printf(" Line %d: Incorrect dataset size: %lu\n", __LINE__, (unsigned long)dset_size);
+ HDprintf(" Line %d: Incorrect dataset size: %lu\n", __LINE__, (unsigned long)dset_size);
goto error;
} /* end if */
/* Read data */
if(H5Dread(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_dbl) < 0) {
H5_FAILED();
- printf(" Line %d: Error reading dataset data\n", __LINE__);
+ HDprintf(" Line %d: Error reading dataset data\n", __LINE__);
goto error;
} /* end if */
@@ -5830,12 +5913,12 @@ test_set_local(hid_t fapl)
for(j=0; j<dims[1]; j++) {
/* If the difference between two values is greater than 0.001%, they're
* considered not equal. */
- if(!DBL_REL_EQUAL(points_dbl[i][j],check_dbl[i][j],0.00001F)) {
+ if(!H5_DBL_REL_EQUAL(points_dbl[i][j], check_dbl[i][j], (double)0.00001F)) {
H5_FAILED();
- printf(" Line %d: Read different values than written.\n",__LINE__);
- printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
- printf(" At original: %f\n",points_dbl[i][j]);
- printf(" At returned: %f\n",check_dbl[i][j]);
+ HDprintf(" Line %d: Read different values than written.\n",__LINE__);
+ HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
+ HDprintf(" At original: %f\n",points_dbl[i][j]);
+ HDprintf(" At returned: %f\n",check_dbl[i][j]);
goto error;
} /* end if */
} /* end for */
@@ -5844,26 +5927,26 @@ test_set_local(hid_t fapl)
/* Close dataset */
if(H5Dclose(dsid) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close dataset\n",__LINE__);
+ HDprintf(" Line %d: Can't close dataset\n",__LINE__);
goto error;
} /* end if */
/* Close file */
if(H5Fclose(file) < 0) {
H5_FAILED();
- printf(" Line %d: Can't close file\n",__LINE__);
+ HDprintf(" Line %d: Can't close file\n",__LINE__);
goto error;
} /* end if */
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
+ return FAIL;
} /* end test_set_local() */
-
+
/*-------------------------------------------------------------------------
* Function: test_compare_dcpl
*
@@ -5935,7 +6018,7 @@ test_compare_dcpl(hid_t file)
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -5945,10 +6028,10 @@ error:
H5Pclose(dcpl1);
H5Pclose(dcpl2);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end test_compare_dcpl() */
-
+
/*-------------------------------------------------------------------------
* Function: test_copy_dcpl
*
@@ -6062,7 +6145,7 @@ test_copy_dcpl(hid_t file, hid_t fapl)
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -6077,10 +6160,10 @@ error:
H5Pclose(dcpl1_copy);
H5Pclose(dcpl2_copy);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end test_copy_dcpl() */
-
+
/*-------------------------------------------------------------------------
* Function: test_filter_delete
*
@@ -6152,7 +6235,7 @@ test_filter_delete(hid_t file)
} H5E_END_TRY;
if(ret >=0) {
H5_FAILED();
- printf(" Line %d: Shouldn't have deleted filter!\n",__LINE__);
+ HDprintf(" Line %d: Shouldn't have deleted filter!\n",__LINE__);
goto error;
} /* end if */
@@ -6162,7 +6245,7 @@ test_filter_delete(hid_t file)
} H5E_END_TRY;
if(ret >=0) {
H5_FAILED();
- printf(" Line %d: Shouldn't have deleted filter!\n",__LINE__);
+ HDprintf(" Line %d: Shouldn't have deleted filter!\n",__LINE__);
goto error;
} /* end if */
@@ -6194,7 +6277,7 @@ test_filter_delete(hid_t file)
#else
SKIPPED();
#endif
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -6203,11 +6286,11 @@ error:
H5Dclose(dsid);
H5Sclose(sid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end test_filter_delete() */
-
+
/*-------------------------------------------------------------------------
* Function: auxread_fdata
*
@@ -6260,7 +6343,7 @@ auxread_fdata(hid_t fid, const char *name)
if(nelmts) {
buf = (void *)HDmalloc((size_t)(nelmts * msize));
if(buf == NULL) {
- printf( "cannot read into memory\n" );
+ HDprintf( "cannot read into memory\n" );
goto error;
}
if(H5Dread(dset_id, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
@@ -6276,7 +6359,7 @@ auxread_fdata(hid_t fid, const char *name)
if(buf)
HDfree(buf);
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -6288,10 +6371,10 @@ error:
if(buf)
HDfree(buf);
} H5E_END_TRY;
- return -1;
-}
+ return FAIL;
+} /* end auxread_fdata() */
+
-
/*-------------------------------------------------------------------------
* Function: test_filters_endianess
*
@@ -6349,7 +6432,7 @@ test_filters_endianess(void)
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -6358,10 +6441,10 @@ error:
H5Sclose(sid);
H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end test_filters_endianess() */
-
+
/*-------------------------------------------------------------------------
* Function: test_zero_dims
*
@@ -6432,7 +6515,7 @@ test_zero_dims(hid_t file)
if(H5Sclose(s) < 0) FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -6440,10 +6523,10 @@ error:
H5Dclose(d);
H5Sclose(s);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end test_zero_dims() */
-
+
/*-------------------------------------------------------------------------
* Function: test_missing_chunk
*
@@ -6514,13 +6597,13 @@ test_missing_chunk(hid_t file)
for(u=0; u<MISSING_CHUNK_DIM; u++) {
if((u%10)>=5) {
if(rdata[u]!=911) {
- printf(" Line %d: Incorrect value, rdata[%u]=%d\n",__LINE__,(unsigned)u,rdata[u]);
+ HDprintf(" Line %d: Incorrect value, rdata[%u]=%d\n",__LINE__,(unsigned)u,rdata[u]);
TEST_ERROR;
} /* end if */
} /* end if */
else {
if(rdata[u]!=wdata[u]) {
- printf(" Line %d: Incorrect value, wdata[%u]=%d, rdata[%u]=%d\n",__LINE__,(unsigned)u,wdata[u],(unsigned)u,rdata[u]);
+ HDprintf(" Line %d: Incorrect value, wdata[%u]=%d, rdata[%u]=%d\n",__LINE__,(unsigned)u,wdata[u],(unsigned)u,rdata[u]);
TEST_ERROR;
} /* end if */
} /* end else */
@@ -6532,7 +6615,7 @@ test_missing_chunk(hid_t file)
if(H5Dclose(d) < 0) TEST_ERROR;
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -6540,10 +6623,10 @@ error:
H5Dclose(d);
H5Sclose(s);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end test_missing_chunk() */
-
+
/*-------------------------------------------------------------------------
* Function: test_random_chunks
*
@@ -6654,8 +6737,8 @@ test_random_chunks(hid_t fapl)
/* Verify that written and read data are the same */
for(i = 0; i < NPOINTS; i++)
if(rbuf[i] != wbuf[i]){
- printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]);
- printf(" coord[%u] = {%lu, %lu}\n", (unsigned)i, (unsigned long)coord[i][0], (unsigned long)coord[i][1]);
+ HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]);
+ HDprintf(" coord[%u] = {%lu, %lu}\n", (unsigned)i, (unsigned long)coord[i][0], (unsigned long)coord[i][1]);
TEST_ERROR;
} /* end if */
@@ -6744,7 +6827,7 @@ test_random_chunks(hid_t fapl)
/* Verify that written and read data are the same */
for(i = 0; i < NPOINTS; i++)
if(rbuf[i] != wbuf[i]){
- printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]);
+ HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]);
TEST_ERROR;
} /* end if */
@@ -6848,7 +6931,7 @@ test_deprec(hid_t file)
} H5E_END_TRY;
if(dataset >= 0) {
H5_FAILED();
- puts(" Library allowed overwrite of existing dataset.");
+ HDputs(" Library allowed overwrite of existing dataset.");
goto error;
}
@@ -6869,7 +6952,7 @@ test_deprec(hid_t file)
} H5E_END_TRY;
if(dataset >= 0) {
H5_FAILED();
- puts(" Opened a non-existent dataset.");
+ HDputs(" Opened a non-existent dataset.");
goto error;
}
@@ -6918,7 +7001,7 @@ test_deprec(hid_t file)
} H5E_END_TRY;
if(dataset >= 0) {
H5_FAILED();
- puts(" Opened a dataset with incorrect chunking parameters.");
+ HDputs(" Opened a dataset with incorrect chunking parameters.");
goto error;
}
@@ -6970,7 +7053,7 @@ test_deprec(hid_t file)
if(H5Zregister(H5Z_DEPREC) < 0) goto error;
if(H5Pset_filter(dcpl, H5Z_FILTER_DEPREC, 0, (size_t)0, NULL) < 0) goto error;
- puts("");
+ HDputs("");
if(test_filter_internal(file,DSET_DEPREC_NAME_FILTER,dcpl,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&deprec_size) < 0) goto error;
if(H5Pclose(dcpl) < 0) goto error;
@@ -7401,15 +7484,15 @@ test_big_chunks_bypass_cache(hid_t fapl)
for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++)
if(rdata1[i] != i) {
- printf(" Read different values than written in the 1st chunk.\n");
- printf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], i);
+ HDprintf(" Read different values than written in the 1st chunk.\n");
+ HDprintf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], i);
TEST_ERROR
} /* end if */
for(j = BYPASS_CHUNK_DIM / 2; j < BYPASS_DIM; j++)
if(rdata1[j] != fvalue) {
- printf(" Read different values than written in the 2nd chunk.\n");
- printf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], fvalue);
+ HDprintf(" Read different values than written in the 2nd chunk.\n");
+ HDprintf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], fvalue);
TEST_ERROR
} /* end if */
@@ -7439,8 +7522,8 @@ test_big_chunks_bypass_cache(hid_t fapl)
for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++)
if(rdata2[i] != i) {
- printf(" Read different values than written in the chunk.\n");
- printf(" At line %d and index %d, rdata2 = %d. It should be %d.\n", __LINE__, i, rdata2[i], i);
+ HDprintf(" Read different values than written in the chunk.\n");
+ HDprintf(" At line %d and index %d, rdata2 = %d. It should be %d.\n", __LINE__, i, rdata2[i], i);
TEST_ERROR
} /* end if */
@@ -7568,7 +7651,7 @@ test_chunk_expand(hid_t fapl)
size = sizeof(size_t);
if(size <= 4) {
SKIPPED();
- puts(" Current machine can't test for error");
+ HDputs(" Current machine can't test for error");
} /* end if */
else {
/* Register "expansion" filter */
@@ -8086,7 +8169,7 @@ typedef struct scatter_info_t {
for(k=0; k<(int)(sizeof(ARR[0][0])/sizeof(ARR[0][0][0])); k++) \
if(ARR[i][j][k] != EXP[i][j][k]) { \
H5_FAILED(); AT(); \
- printf(" " #ARR "[%d][%d][%d] == %d, " #EXP "[%d][%d][%d] == %d\n", i, j, k, ARR[i][j][k], i, j, k, EXP[i][j][k]); \
+ HDprintf(" " #ARR "[%d][%d][%d] == %d, " #EXP "[%d][%d][%d] == %d\n", i, j, k, ARR[i][j][k], i, j, k, EXP[i][j][k]); \
goto error; \
}
@@ -9171,8 +9254,8 @@ test_compact_dirty(hid_t fapl)
if(H5Fclose(fid) < 0)
TEST_ERROR
- PASSED();
- return 0;
+ PASSED();
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -9181,21 +9264,20 @@ error:
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* test_compact_dirty() */
-
+
/*-------------------------------------------------------------------------
* Function: main
*
- * Purpose: Tests the dataset interface (H5D)
+ * Purpose: Tests the dataset interface (H5D)
*
- * Return: Success: exit(0)
+ * Return: Success: exit(EXIT_SUCCESS)
+ * Failure: exit(EXIT_FAILURE)
*
- * Failure: exit(1)
- *
- * Programmer: Robb Matzke
- * Tuesday, December 9, 1997
+ * Programmer: Robb Matzke
+ * Tuesday, December 9, 1997
*
*-------------------------------------------------------------------------
*/
@@ -9245,11 +9327,11 @@ main(void)
/* Set the FAPL for the type of format */
if(new_format) {
- puts("\nTesting with new file format:");
+ HDputs("\nTesting with new file format:");
my_fapl = fapl2;
} /* end if */
else {
- puts("Testing with old file format:");
+ HDputs("Testing with old file format:");
my_fapl = fapl;
} /* end else */
@@ -9311,10 +9393,10 @@ main(void)
nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0);
nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0);
nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_idx_compatible() < 0 ? 1 : 0);
- nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_large_chunk_shrink(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_zero_dim_dset(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_idx_compatible() < 0 ? 1 : 0);
+ nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_large_chunk_shrink(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_zero_dim_dset(my_fapl) < 0 ? 1 : 0);
if(H5Fclose(file) < 0)
goto error;
@@ -9334,19 +9416,19 @@ main(void)
if(nerrors)
goto error;
- printf("All dataset tests passed.\n");
+ HDprintf("All dataset tests passed.\n");
#ifdef H5_HAVE_FILTER_SZIP
if (GetTestCleanup())
HDremove(NOENCODER_COPY_FILENAME);
#endif /* H5_HAVE_FILTER_SZIP */
h5_cleanup(FILENAME, fapl);
- return 0;
+ return EXIT_SUCCESS;
error:
nerrors = MAX(1, nerrors);
- printf("***** %d DATASET TEST%s FAILED! *****\n",
+ HDprintf("***** %d DATASET TEST%s FAILED! *****\n",
nerrors, 1 == nerrors ? "" : "S");
- return 1;
-}
+ return EXIT_FAILURE;
+} /* end main() */
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 41fb49d..0cdd416 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -21,7 +21,7 @@
#include "h5test.h"
/* Number of elements in each random test */
-#define NTESTELEM 10000
+#define NTESTELEM 10000
/* Epsilon for floating-point comparisons */
#define FP_EPSILON 0.000001F
@@ -30,7 +30,7 @@
* Offset from alinged memory returned by malloc(). This can be used to test
* that type conversions handle non-aligned buffers correctly.
*/
-#define ALIGNMENT 1
+#define ALIGNMENT 1
/*
* Define if you want to test alignment code on a machine that doesn't
@@ -58,7 +58,7 @@ const char *FILENAME[] = {
* endian. If local variable `endian' is H5T_ORDER_BE then the result will
* be I, otherwise the result will be Z-(I+1).
*/
-#define ENDIAN(Z,I,E) (H5T_ORDER_BE==E?(I):(Z)-((I)+1))
+#define ENDIAN(Z,I,E) (H5T_ORDER_BE==E?(I):(Z)-((I)+1))
typedef enum dtype_t {
INT_SCHAR, INT_UCHAR, INT_SHORT, INT_USHORT, INT_INT, INT_UINT,
@@ -92,13 +92,16 @@ static int skip_overflow_tests_g = 0;
#define TEST_DENORM 2
#define TEST_SPECIAL 3
+/* Temporary buffer sizes */
+#define TMP_BUF_DIM1 32
+#define TMP_BUF_DIM2 100
/* Don't use hardware conversions if set */
static int without_hardware_g = 0;
/* Allocates memory aligned on a certain boundary. */
-#define aligned_malloc(Z) ((void*)((char*)HDmalloc(ALIGNMENT+Z)+ALIGNMENT))
-#define aligned_free(M) HDfree((char*)(M)-ALIGNMENT)
+#define aligned_malloc(Z) ((void*)((char*)HDmalloc(ALIGNMENT+Z)+ALIGNMENT))
+#define aligned_free(M) HDfree((char*)(M)-ALIGNMENT)
/* Initialize source buffer of integer for integer->integer and integer->floating-point conversion test.
* This algorithm is mainly to avoid any casting and comparison between source and destination types
@@ -123,39 +126,39 @@ static int without_hardware_g = 0;
/*positive values, ascending order. VALUE1 starts from 00000001, to 00000010, until 10000000*/ \
/*VALUE2 ascends from 00000000, to 00000011, 00000111,..., until 11111111.*/ \
for(n=0; n<SRC_PREC; n++) { \
- if(value1<=SRC_MAX && value1>=SRC_MIN) { \
- memcpy(buf_p, &value1, SRC_SIZE); \
- memcpy(saved_p, &value1, SRC_SIZE); \
+ { \
+ HDmemcpy(buf_p, &value1, SRC_SIZE); \
+ HDmemcpy(saved_p, &value1, SRC_SIZE); \
buf_p += SRC_SIZE; \
saved_p += SRC_SIZE; \
} \
- if(value2<=SRC_MAX && value2>=SRC_MIN) { \
- memcpy(buf_p, &value2, SRC_SIZE); \
- memcpy(saved_p, &value2, SRC_SIZE); \
+ { \
+ HDmemcpy(buf_p, &value2, SRC_SIZE); \
+ HDmemcpy(saved_p, &value2, SRC_SIZE); \
buf_p += SRC_SIZE; \
saved_p += SRC_SIZE; \
} \
\
if(n<SRC_PREC-2) { \
- value1 <<= 1; \
- value2 = (value1 - 1) | value1; \
+ value1 = (TYPE)(value1 << 1); \
+ value2 = (TYPE)((value1 - 1) | value1); \
} else if(n==SRC_PREC-2) { /*to avoid overflow of negative values for signed integer*/ \
- value1 <<= 1; \
- value2 = (~value1) | value1; \
+ value1 = (TYPE)(value1 << 1); \
+ value2 = (TYPE)((~value1) | value1); \
} \
} \
\
/* negative values for signed; descending positive values for unsigned */ \
/* VALUE2 descends from 11111111 to 11111110, 11111100, ..., until 10000000. */ \
for(n=0; n<SRC_PREC-1; n++) { \
- if(value2<=SRC_MAX && value2>=SRC_MIN) { \
- memcpy(buf_p, &value2, SRC_SIZE); \
- memcpy(saved_p, &value2, SRC_SIZE); \
+ { \
+ HDmemcpy(buf_p, &value2, SRC_SIZE); \
+ HDmemcpy(saved_p, &value2, SRC_SIZE); \
buf_p += SRC_SIZE; \
saved_p += SRC_SIZE; \
} \
if(n<SRC_PREC-1) \
- value2 <<= 1; \
+ value2 = (TYPE)(value2 << 1); \
} \
}
@@ -238,15 +241,15 @@ static int without_hardware_g = 0;
value2 = -SRC_MIN; \
for(n=0; n<num_norm; n++) { \
if(value1<SRC_MAX) { /*positive*/ \
- memcpy(buf_p, &value1, SRC_SIZE); \
- memcpy(saved_p, &value1, SRC_SIZE); \
+ HDmemcpy(buf_p, &value1, SRC_SIZE); \
+ HDmemcpy(saved_p, &value1, SRC_SIZE); \
value1 *= multiply; \
buf_p += SRC_SIZE; \
saved_p += SRC_SIZE; \
} \
if(value2>-SRC_MAX) { /*negative*/ \
- memcpy(buf_p, &value2, SRC_SIZE); \
- memcpy(saved_p, &value2, SRC_SIZE); \
+ HDmemcpy(buf_p, &value2, SRC_SIZE); \
+ HDmemcpy(saved_p, &value2, SRC_SIZE); \
value2 *= multiply; \
buf_p += SRC_SIZE; \
saved_p += SRC_SIZE; \
@@ -254,14 +257,14 @@ static int without_hardware_g = 0;
} \
\
value1 = SRC_MAX; /*maximal value*/ \
- memcpy(buf_p, &value1, SRC_SIZE); \
- memcpy(saved_p, &value1, SRC_SIZE); \
+ HDmemcpy(buf_p, &value1, SRC_SIZE); \
+ HDmemcpy(saved_p, &value1, SRC_SIZE); \
buf_p += SRC_SIZE; \
saved_p += SRC_SIZE; \
\
value2 = -SRC_MAX; /*negative value*/ \
- memcpy(buf_p, &value2, SRC_SIZE); \
- memcpy(saved_p, &value2, SRC_SIZE); \
+ HDmemcpy(buf_p, &value2, SRC_SIZE); \
+ HDmemcpy(saved_p, &value2, SRC_SIZE); \
buf_p += SRC_SIZE; \
saved_p += SRC_SIZE; \
}
@@ -286,37 +289,37 @@ static int without_hardware_g = 0;
HDmemset(BUF, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
HDmemset(SAVED, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
\
- tmp1 = (unsigned char*)HDcalloc((size_t)1, (size_t)SRC_SIZE); \
- tmp2 = (unsigned char*)HDcalloc((size_t)1, (size_t)SRC_SIZE); \
+ tmp1 = (unsigned char*)HDcalloc((size_t)1, (size_t)SRC_SIZE); \
+ tmp2 = (unsigned char*)HDcalloc((size_t)1, (size_t)SRC_SIZE); \
\
buf_p = BUF; \
saved_p = SAVED; \
\
/*Denormalized values. Exponent is 0. Let mantissa starts from 00000001, 00000011, \
*00000111,..., until 11111111.*/ \
- memset(tmp1, 0, SRC_SIZE); \
- memset(tmp2, 0, SRC_SIZE); \
- H5T__bit_set (tmp2, SRC_PREC-1, (size_t)1, TRUE); /*the negative value*/ \
+ HDmemset(tmp1, 0, SRC_SIZE); \
+ HDmemset(tmp2, 0, SRC_SIZE); \
+ H5T__bit_set (tmp2, SRC_PREC-1, (size_t)1, TRUE); /*the negative value*/ \
for(n=0; n<SRC_MANT_DIG-1; n++) { \
- H5T__bit_set (tmp1, n, (size_t)1, TRUE); /*turn on 1 bit each time*/ \
+ H5T__bit_set (tmp1, n, (size_t)1, TRUE); /*turn on 1 bit each time*/ \
CHANGE_ORDER(tmp1, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
- memcpy(buf_p, tmp1, SRC_SIZE); \
- memcpy(saved_p, tmp1, SRC_SIZE); \
+ HDmemcpy(buf_p, tmp1, SRC_SIZE); \
+ HDmemcpy(saved_p, tmp1, SRC_SIZE); \
CHANGE_ORDER(tmp1, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
buf_p += SRC_SIZE; \
saved_p += SRC_SIZE; \
\
/*negative values*/ \
- H5T__bit_set (tmp2, n, (size_t)1, TRUE); \
+ H5T__bit_set (tmp2, n, (size_t)1, TRUE); \
CHANGE_ORDER(tmp2, SRC_ORDR, SRC_SIZE); \
- memcpy(buf_p, tmp2, SRC_SIZE); \
- memcpy(saved_p, tmp2, SRC_SIZE); \
+ HDmemcpy(buf_p, tmp2, SRC_SIZE); \
+ HDmemcpy(saved_p, tmp2, SRC_SIZE); \
CHANGE_ORDER(tmp2, SRC_ORDR, SRC_SIZE); \
buf_p += SRC_SIZE; \
saved_p += SRC_SIZE; \
} \
- HDfree(tmp1); \
- HDfree(tmp2); \
+ HDfree(tmp1); \
+ HDfree(tmp2); \
}
/* Allocate buffer and initialize it with floating-point special values, +/-0, +/-infinity,
@@ -338,50 +341,50 @@ static int without_hardware_g = 0;
SAVED = (unsigned char*)aligned_malloc( NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
HDmemset(BUF, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
HDmemset(SAVED, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
- value = (unsigned char*)HDcalloc(SRC_SIZE, sizeof(unsigned char)); \
+ value = (unsigned char*)HDcalloc(SRC_SIZE, sizeof(unsigned char)); \
\
buf_p = BUF; \
\
/* +0 */ \
- H5T__bit_set(value, (size_t)0, SRC_PREC, FALSE); \
- memcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
+ H5T__bit_set(value, (size_t)0, SRC_PREC, FALSE); \
+ HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
buf_p += SRC_SIZE; \
\
for(n=0; n<2; n++) { \
if(n==1) { \
memset(value, 0, SRC_SIZE*sizeof(unsigned char)); \
/* -0 */ \
- H5T__bit_set(value, (size_t)(SRC_PREC - 1), (size_t)1, TRUE); \
+ H5T__bit_set(value, (size_t)(SRC_PREC - 1), (size_t)1, TRUE); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE);/*change order for big endian*/ \
- HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
+ HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE);/*change back the order for bit operation*/ \
buf_p += SRC_SIZE; \
} \
\
/* +/-infinity */ \
- H5T__bit_set(value, (size_t)(SRC_MANT_DIG - 1), SRC_PREC-SRC_MANT_DIG, TRUE); \
+ H5T__bit_set(value, (size_t)(SRC_MANT_DIG - 1), SRC_PREC-SRC_MANT_DIG, TRUE); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
- HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
+ HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
buf_p += SRC_SIZE; \
\
/* +/-SNaN */ \
- H5T__bit_set(value, (size_t)0, (size_t)1, TRUE); \
+ H5T__bit_set(value, (size_t)0, (size_t)1, TRUE); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
- HDmemcpy(buf_p, value, SRC_SIZE * sizeof(unsigned char)); \
+ HDmemcpy(buf_p, value, SRC_SIZE * sizeof(unsigned char)); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
buf_p += SRC_SIZE; \
\
/* +/-QNaN */ \
- H5T__bit_set(value, (size_t)(SRC_MANT_DIG - 2), (size_t)1, TRUE); \
+ H5T__bit_set(value, (size_t)(SRC_MANT_DIG - 2), (size_t)1, TRUE); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \
- HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
+ HDmemcpy(buf_p, value, SRC_SIZE*sizeof(unsigned char)); \
CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change back the order for bit operation*/ \
buf_p += SRC_SIZE; \
} \
\
- HDmemcpy(SAVED, BUF, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
- HDfree(value); \
+ HDmemcpy(SAVED, BUF, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
+ HDfree(value); \
}
void some_dummy_func(float x);
@@ -391,13 +394,13 @@ static int my_isinf(int endian, unsigned char *val, size_t size,
size_t mpos, size_t msize, size_t epos, size_t esize);
/*-------------------------------------------------------------------------
- * Function: fpe_handler
+ * Function: fpe_handler
*
- * Purpose: Exit with 255
+ * Purpose: Exit with 255
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, July 6, 1998
*
* Modifications:
@@ -416,16 +419,16 @@ fpe_handler(int H5_ATTR_UNUSED signo)
HDexit(255);
}
-
+
/*-------------------------------------------------------------------------
- * Function: reset_hdf5
+ * Function: reset_hdf5
*
- * Purpose: Reset the hdf5 library. This causes statistics to be printed
- * and counters to be reset.
+ * Purpose: Reset the hdf5 library. This causes statistics to be printed
+ * and counters to be reset.
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, November 16, 1998
*
* Modifications:
@@ -458,19 +461,19 @@ reset_hdf5(void)
}
-
+
/*-------------------------------------------------------------------------
- * Function: except_func
+ * Function: except_func
*
- * Purpose: Gets called for all data type conversion exceptions.
+ * Purpose: Gets called for all data type conversion exceptions.
*
- * Return: H5T_CONV_ABORT: -1
+ * Return: H5T_CONV_ABORT: -1
*
* H5T_CONV_UNHANDLED 0
*
* H5T_CONV_HANDLED 1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* April 19, 2004
*
* Modifications:
@@ -479,7 +482,7 @@ reset_hdf5(void)
*/
static H5T_conv_ret_t
except_func(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5_ATTR_UNUSED dst_id, void H5_ATTR_UNUSED *src_buf,
- void *dst_buf, void *user_data)
+ void *dst_buf, void *user_data)
{
H5T_conv_ret_t ret = H5T_CONV_HANDLED;
@@ -506,19 +509,19 @@ except_func(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5
return ret;
}
-
+
/*-------------------------------------------------------------------------
- * Function: some_dummy_func
+ * Function: some_dummy_func
*
- * Purpose: A dummy function to help check for overflow.
+ * Purpose: A dummy function to help check for overflow.
*
- * Note: DO NOT DECLARE THIS FUNCTION STATIC OR THE COMPILER MIGHT
- * PROMOTE ARGUMENT `x' TO DOUBLE AND DEFEAT THE OVERFLOW
- * CHECKING.
+ * Note: DO NOT DECLARE THIS FUNCTION STATIC OR THE COMPILER MIGHT
+ * PROMOTE ARGUMENT `x' TO DOUBLE AND DEFEAT THE OVERFLOW
+ * CHECKING.
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, July 21, 1998
*
*-------------------------------------------------------------------------
@@ -526,21 +529,21 @@ except_func(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5
void
some_dummy_func(float x)
{
- char s[128];
+ char s[128];
- HDsnprintf(s, sizeof(s), "%g", x);
+ HDsnprintf(s, sizeof(s), "%g", (double)x);
}
-
+
/*-------------------------------------------------------------------------
- * Function: generates_sigfpe
+ * Function: generates_sigfpe
*
- * Purpose: Determines if SIGFPE is generated from overflows. We must be
- * able to fork() and waitpid() in order for this test to work
- * properly. Sets skip_overflow_tests_g to non-zero if they
- * would generate SIGBUS, zero otherwise.
+ * Purpose: Determines if SIGFPE is generated from overflows. We must be
+ * able to fork() and waitpid() in order for this test to work
+ * properly. Sets skip_overflow_tests_g to non-zero if they
+ * would generate SIGBUS, zero otherwise.
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, July 21, 1998
*
* Modifications:
@@ -551,38 +554,38 @@ static void
generates_sigfpe(void)
{
#if defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)
- pid_t pid;
- int status;
- size_t i, j;
- double d;
+ pid_t pid;
+ int status;
+ size_t i, j;
+ double d;
unsigned char *dp = (unsigned char*)&d;
- float f;
+ float f;
HDfflush(stdout);
HDfflush(stderr);
if ((pid=fork()) < 0) {
- HDperror("fork");
- HDexit(1);
+ HDperror("fork");
+ HDexit(EXIT_FAILURE);
} else if (0==pid) {
- for (i=0; i<2000; i++) {
- for(j = 0; j < sizeof(double); j++)
+ for (i=0; i<2000; i++) {
+ for(j = 0; j < sizeof(double); j++)
dp[j] = (unsigned char)HDrand();
- f = (float)d;
- some_dummy_func((float)f);
- }
- HDexit(0);
+ f = (float)d;
+ some_dummy_func((float)f);
+ }
+ HDexit(EXIT_SUCCESS);
}
while (pid!=waitpid(pid, &status, 0))
/*void*/;
if (WIFEXITED(status) && 0==WEXITSTATUS(status)) {
- HDputs("Floating-point overflow cases will be tested.");
- skip_overflow_tests_g = FALSE;
+ HDputs("Floating-point overflow cases will be tested.");
+ skip_overflow_tests_g = FALSE;
} else if (WIFSIGNALED(status) && SIGFPE==WTERMSIG(status)) {
- HDputs("Floating-point overflow cases cannot be safely tested.");
- skip_overflow_tests_g = TRUE;
- /* delete the core dump file that SIGFPE may have created */
- HDunlink("core");
+ HDputs("Floating-point overflow cases cannot be safely tested.");
+ skip_overflow_tests_g = TRUE;
+ /* delete the core dump file that SIGFPE may have created */
+ HDunlink("core");
}
#else
HDputs("Cannot determine if floating-point overflows generate a SIGFPE;");
@@ -592,7 +595,7 @@ generates_sigfpe(void)
#endif
}
-
+
/*-------------------------------------------------------------------------
* Function: test_hard_query
*
@@ -618,27 +621,27 @@ test_hard_query(void)
/* Verify the conversion from int to float is a hard conversion. */
if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != TRUE) {
H5_FAILED();
- printf("Can't query conversion function\n");
+ HDprintf("Can't query conversion function\n");
goto error;
- } /* end if */
+ }
/* Unregister the hard conversion from int to float. Verify the conversion
* is a soft conversion. */
- H5Tunregister(H5T_PERS_HARD, NULL, H5T_NATIVE_INT, H5T_NATIVE_FLOAT, H5T__conv_int_float);
+ H5Tunregister(H5T_PERS_HARD, NULL, H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (H5T_conv_t)((void (*) (void))H5T__conv_int_float));
if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != FALSE) {
H5_FAILED();
- printf("Can't query conversion function\n");
+ HDprintf("Can't query conversion function\n");
goto error;
- } /* end if */
+ }
/* Register the hard conversion from int to float. Verify the conversion
* is a hard conversion. */
- H5Tregister(H5T_PERS_HARD, "int_flt", H5T_NATIVE_INT, H5T_NATIVE_FLOAT, H5T__conv_int_float);
+ H5Tregister(H5T_PERS_HARD, "int_flt", H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (H5T_conv_t)((void (*) (void))H5T__conv_int_float));
if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != TRUE) {
H5_FAILED();
- printf("Can't query conversion function\n");
+ HDprintf("Can't query conversion function\n");
goto error;
- } /* end if */
+ }
PASSED();
@@ -655,18 +658,18 @@ error:
reset_hdf5();
return 1;
-} /* end test_hard_query() */
+}
+
-
/*-------------------------------------------------------------------------
- * Function: expt_handle
+ * Function: expt_handle
*
- * Purpose: Gets called from test_particular_fp_integer() for data type
+ * Purpose: Gets called from test_particular_fp_integer() for data type
* conversion exceptions.
*
- * Return: H5T_CONV_HANDLED 1
+ * Return: H5T_CONV_HANDLED 1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Sept 7, 2005
*
* Modifications:
@@ -675,7 +678,7 @@ error:
*/
static H5T_conv_ret_t
expt_handle(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5_ATTR_UNUSED dst_id, void H5_ATTR_UNUSED *src_buf,
- void *dst_buf, void *user_data)
+ void *dst_buf, void *user_data)
{
signed char fill_value1 = 7;
int fill_value2 = 13;
@@ -691,7 +694,7 @@ expt_handle(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5
return H5T_CONV_HANDLED;
}
-
+
/*-------------------------------------------------------------------------
* Function: test_particular_fp_integer
*
@@ -711,12 +714,6 @@ expt_handle(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5
* Return: Success: 0
*
* Failure: number of errors
- *
- * Programmer: Raymond Lu
- * Sept 7, 2005
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int test_particular_fp_integer(void)
@@ -732,7 +729,7 @@ static int test_particular_fp_integer(void)
float src_f = (float)INT_MAX;
int dst_i;
int fill_value = 13;
- int endian; /*endianess */
+ int endian; /*endianess */
unsigned int fails_this_test = 0;
size_t j;
@@ -740,7 +737,7 @@ static int test_particular_fp_integer(void)
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
H5_FAILED();
- printf("Can't create data transfer property list\n");
+ HDprintf("Can't create data transfer property list\n");
goto error;
}
@@ -751,25 +748,25 @@ static int test_particular_fp_integer(void)
buf1 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size1, dst_size1));
saved_buf1 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size1, dst_size1));
- memcpy(buf1, &src_d, src_size1);
- memcpy(saved_buf1, &src_d, src_size1);
+ HDmemcpy(buf1, &src_d, src_size1);
+ HDmemcpy(saved_buf1, &src_d, src_size1);
/* Register exception handling function and signal the destination is "signed char". */
flag = 1;
if(H5Pset_type_conv_cb(dxpl_id, expt_handle, &flag) < 0) {
H5_FAILED();
- printf("Can't register conversion callback\n");
+ HDprintf("Can't register conversion callback\n");
goto error;
}
/* Do conversion */
if(H5Tconvert(H5T_NATIVE_DOUBLE, H5T_NATIVE_SCHAR, (size_t)1, buf1, NULL, dxpl_id) < 0) {
H5_FAILED();
- printf("Can't convert data\n");
+ HDprintf("Can't convert data\n");
goto error;
}
- memcpy(&dst_c, buf1, dst_size1);
+ HDmemcpy(&dst_c, buf1, dst_size1);
/* Print errors */
if(dst_c != SCHAR_MAX) {
@@ -779,20 +776,20 @@ static int test_particular_fp_integer(void)
if(0 == fails_this_test++)
H5_FAILED();
- printf(" test double to signed char:\n");
- printf(" src = ");
+ HDprintf(" test double to signed char:\n");
+ HDprintf(" src = ");
for (j=0; j<src_size1; j++)
- printf(" %02x", saved_buf1[ENDIAN(src_size1, j, endian)]);
+ HDprintf(" %02x", saved_buf1[ENDIAN(src_size1, j, endian)]);
HDmemcpy(&x, saved_buf1, src_size1);
- printf(" %29.20e\n", x);
+ HDprintf(" %29.20e\n", x);
- printf(" dst = ");
+ HDprintf(" dst = ");
for (j=0; j<dst_size1; j++)
- printf(" %02x", buf1[ENDIAN(dst_size1, j, endian)]);
+ HDprintf(" %02x", buf1[ENDIAN(dst_size1, j, endian)]);
HDmemcpy(&y, buf1, dst_size1);
- printf(" %29d\n", y);
+ HDprintf(" %29d\n", y);
}
/* Test conversion from float (the value is INT_MAX) to int. */
@@ -809,11 +806,11 @@ static int test_particular_fp_integer(void)
/* Do conversion */
if(H5Tconvert(H5T_NATIVE_FLOAT, H5T_NATIVE_INT, (size_t)1, buf2, NULL, dxpl_id) < 0) {
H5_FAILED();
- printf("Can't convert data\n");
+ HDprintf("Can't convert data\n");
goto error;
}
- memcpy(&dst_i, buf2, dst_size2);
+ HDmemcpy(&dst_i, buf2, dst_size2);
/* Print errors */
if(dst_i != fill_value) {
@@ -823,20 +820,20 @@ static int test_particular_fp_integer(void)
if(0 == fails_this_test++)
H5_FAILED();
- printf(" test float to int:\n");
- printf(" src = ");
+ HDprintf(" test float to int:\n");
+ HDprintf(" src = ");
for (j=0; j<src_size2; j++)
- printf(" %02x", saved_buf2[ENDIAN(src_size2, j, endian)]);
+ HDprintf(" %02x", saved_buf2[ENDIAN(src_size2, j, endian)]);
HDmemcpy(&x, saved_buf2, src_size2);
- printf(" %29.20e\n", x);
+ HDprintf(" %29.20e\n", (double)x);
- printf(" dst = ");
+ HDprintf(" dst = ");
for (j=0; j<dst_size2; j++)
- printf(" %02x", buf2[ENDIAN(dst_size2, j, endian)]);
+ HDprintf(" %02x", buf2[ENDIAN(dst_size2, j, endian)]);
HDmemcpy(&y, buf2, dst_size2);
- printf(" %29d\n", y);
+ HDprintf(" %29d\n", y);
}
if(fails_this_test)
@@ -844,7 +841,7 @@ static int test_particular_fp_integer(void)
if(H5Pclose(dxpl_id) < 0) {
H5_FAILED();
- printf("Can't close property list\n");
+ HDprintf("Can't close property list\n");
goto error;
}
@@ -882,7 +879,7 @@ error:
return MAX((int)fails_this_test, 1);
}
-
+
/*-------------------------------------------------------------------------
* Function: test_derived_flt
*
@@ -909,11 +906,11 @@ test_derived_flt(void)
size_t src_size, dst_size;
unsigned char *buf=NULL, *saved_buf=NULL;
int *aligned=NULL;
- int endian; /*endianess */
+ int endian; /*endianess */
size_t nelmts = NTESTELEM;
unsigned int fails_this_test = 0;
- const size_t max_fails=40; /*max number of failures*/
- char str[256]; /*message string */
+ const size_t max_fails=40; /*max number of failures*/
+ char str[256]; /*message string */
unsigned int i, j;
TESTING("user-define and query functions of floating-point types");
@@ -922,25 +919,25 @@ test_derived_flt(void)
h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename);
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
H5_FAILED();
- printf("Can't create file\n");
+ HDprintf("Can't create file\n");
goto error;
}
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
H5_FAILED();
- printf("Can't create data transfer property list\n");
+ HDprintf("Can't create data transfer property list\n");
goto error;
}
if((tid1 = H5Tcopy(H5T_IEEE_F64LE)) < 0) {
H5_FAILED();
- printf("Can't copy data type\n");
+ HDprintf("Can't copy data type\n");
goto error;
}
if((tid2 = H5Tcopy(H5T_IEEE_F32LE)) < 0) {
H5_FAILED();
- printf("Can't copy data type\n");
+ HDprintf("Can't copy data type\n");
goto error;
}
@@ -964,44 +961,44 @@ test_derived_flt(void)
*-----------------------------------------------------------------------*/
if(H5Tset_fields(tid1, (size_t)44, (size_t)34, (size_t)10, (size_t)3, (size_t)31) < 0) {
H5_FAILED();
- printf("Can't set fields\n");
+ HDprintf("Can't set fields\n");
goto error;
}
if(H5Tset_offset(tid1, (size_t)3) < 0) {
H5_FAILED();
- printf("Can't set offset\n");
+ HDprintf("Can't set offset\n");
goto error;
}
if(H5Tset_precision(tid1, (size_t)42) < 0) {
H5_FAILED();
- printf("Can't set precision 1\n");
+ HDprintf("Can't set precision 1\n");
goto error;
}
if(H5Tset_size(tid1, (size_t)7) < 0) {
H5_FAILED();
- printf("Can't set size\n");
+ HDprintf("Can't set size\n");
goto error;
}
if(H5Tset_ebias(tid1, (size_t)511) < 0) {
H5_FAILED();
- printf("Can't set exponent bias\n");
+ HDprintf("Can't set exponent bias\n");
goto error;
}
if(H5Tset_pad(tid1, H5T_PAD_ZERO, H5T_PAD_ZERO) < 0) {
H5_FAILED();
- printf("Can't set padding\n");
+ HDprintf("Can't set padding\n");
goto error;
}
if(H5Tcommit2(file, "new float type 1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
H5_FAILED();
- printf("Can't set inpad\n");
+ HDprintf("Can't set inpad\n");
goto error;
}
if(H5Tclose(tid1) < 0) {
H5_FAILED();
- printf("Can't close datatype\n");
+ HDprintf("Can't close datatype\n");
goto error;
}
@@ -1009,33 +1006,33 @@ test_derived_flt(void)
FAIL_PUTS_ERROR("Can't open datatype")
if(H5Tget_fields(tid1, &spos, &epos, &esize, &mpos, &msize) < 0) {
H5_FAILED();
- printf("Can't get fields\n");
+ HDprintf("Can't get fields\n");
goto error;
}
if(spos != 44 || epos != 34 || esize != 10 || mpos != 3 || msize != 31) {
H5_FAILED();
- printf("Wrong field values\n");
+ HDprintf("Wrong field values\n");
goto error;
}
if(H5Tget_precision(tid1) != 42) {
H5_FAILED();
- printf("Can't get precision or wrong precision\n");
+ HDprintf("Can't get precision or wrong precision\n");
goto error;
}
if(H5Tget_offset(tid1)!=3) {
H5_FAILED();
- printf("Can't get offset or wrong offset\n");
+ HDprintf("Can't get offset or wrong offset\n");
goto error;
}
if((size = H5Tget_size(tid1))!=7) {
H5_FAILED();
- printf("Can't get size or wrong size\n");
+ HDprintf("Can't get size or wrong size\n");
goto error;
}
if(H5Tget_ebias(tid1)!=511) {
H5_FAILED();
- printf("Can't get exponent bias or wrong bias\n");
+ HDprintf("Can't get exponent bias or wrong bias\n");
goto error;
}
@@ -1058,13 +1055,13 @@ test_derived_flt(void)
* The mantissa is big enough to retain the integer's precision. */
if(H5Tconvert(H5T_NATIVE_INT, tid1, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
- printf("Can't convert data\n");
+ HDprintf("Can't convert data\n");
goto error;
}
/* Convert data from the derived floating-point type back to native integer. */
if(H5Tconvert(tid1, H5T_NATIVE_INT, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
- printf("Can't convert data\n");
+ HDprintf("Can't convert data\n");
goto error;
}
@@ -1078,26 +1075,26 @@ test_derived_flt(void)
/* Print errors */
if (0==fails_this_test++) {
- HDsnprintf(str, sizeof(str), "\nTesting random sw derived floating-point -> derived floating-point conversions");
- printf("%-70s", str);
- HDfflush(stdout);
+ HDsnprintf(str, sizeof(str), "\nTesting random sw derived floating-point -> derived floating-point conversions");
+ HDprintf("%-70s", str);
+ HDfflush(stdout);
H5_FAILED();
}
- printf(" test %u elmt %u: \n", 1, (unsigned)i);
+ HDprintf(" test %u elmt %u: \n", 1, (unsigned)i);
- printf(" src = ");
+ HDprintf(" src = ");
for (j=0; j<src_size; j++)
- printf(" %02x", saved_buf[i*src_size+ENDIAN(src_size, j, endian)]);
+ HDprintf(" %02x", saved_buf[i*src_size+ENDIAN(src_size, j, endian)]);
HDmemcpy(aligned, saved_buf+i*sizeof(int), sizeof(int));
- printf(" %29d\n", *aligned);
+ HDprintf(" %29d\n", *aligned);
- printf(" dst = ");
+ HDprintf(" dst = ");
for (j=0; j<src_size; j++)
- printf(" %02x", buf[i*src_size+ENDIAN(src_size, j, endian)]);
+ HDprintf(" %02x", buf[i*src_size+ENDIAN(src_size, j, endian)]);
HDmemcpy(aligned, buf+i*sizeof(int), sizeof(int));
- printf(" %29d\n", *aligned);
+ HDprintf(" %29d\n", *aligned);
if (fails_this_test>=max_fails) {
HDputs(" maximum failures reached, aborting test...");
@@ -1124,43 +1121,43 @@ test_derived_flt(void)
*--------------------------------------------------------------------------*/
if(H5Tset_fields(tid2, (size_t)23, (size_t)16, (size_t)7, (size_t)0, (size_t)16) < 0) {
H5_FAILED();
- printf("Can't set fields\n");
+ HDprintf("Can't set fields\n");
goto error;
}
if(H5Tset_offset(tid2, (size_t)0) < 0) {
H5_FAILED();
- printf("Can't set offset\n");
+ HDprintf("Can't set offset\n");
goto error;
}
if(H5Tset_precision(tid2, (size_t)24) < 0) {
H5_FAILED();
- printf("Can't set precision 2\n");
+ HDprintf("Can't set precision 2\n");
goto error;
}
if(H5Tset_size(tid2, (size_t)3) < 0) {
H5_FAILED();
- printf("Can't set size\n");
+ HDprintf("Can't set size\n");
goto error;
}
if(H5Tset_ebias(tid2, (size_t)63) < 0) {
H5_FAILED();
- printf("Can't set size\n");
+ HDprintf("Can't set size\n");
goto error;
}
if(H5Tset_pad(tid2, H5T_PAD_ZERO, H5T_PAD_ZERO) < 0) {
H5_FAILED();
- printf("Can't set padding\n");
+ HDprintf("Can't set padding\n");
goto error;
}
if(H5Tcommit2(file, "new float type 2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
H5_FAILED();
- printf("Can't set inpad\n");
+ HDprintf("Can't set inpad\n");
goto error;
}
if(H5Tclose(tid2) < 0) {
H5_FAILED();
- printf("Can't close datatype\n");
+ HDprintf("Can't close datatype\n");
goto error;
}
@@ -1168,33 +1165,33 @@ test_derived_flt(void)
FAIL_PUTS_ERROR("Can't open datatype")
if(H5Tget_fields(tid2, &spos, &epos, &esize, &mpos, &msize) < 0) {
H5_FAILED();
- printf("Can't get fields\n");
+ HDprintf("Can't get fields\n");
goto error;
}
if(spos != 23 || epos != 16 || esize != 7 || mpos != 0 || msize != 16) {
H5_FAILED();
- printf("Wrong field values\n");
+ HDprintf("Wrong field values\n");
goto error;
}
if(H5Tget_precision(tid2) != 24) {
H5_FAILED();
- printf("Can't get precision or wrong precision\n");
+ HDprintf("Can't get precision or wrong precision\n");
goto error;
}
if(H5Tget_offset(tid2)!=0) {
H5_FAILED();
- printf("Can't get offset or wrong offset\n");
+ HDprintf("Can't get offset or wrong offset\n");
goto error;
}
if((size = H5Tget_size(tid2))!=3) {
H5_FAILED();
- printf("Can't get size or wrong size\n");
+ HDprintf("Can't get size or wrong size\n");
goto error;
}
if(H5Tget_ebias(tid2)!=63) {
H5_FAILED();
- printf("Can't get exponent bias or wrong bias\n");
+ HDprintf("Can't get exponent bias or wrong bias\n");
goto error;
}
@@ -1218,13 +1215,13 @@ test_derived_flt(void)
* the precision and exponent power. */
if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
- printf("Can't convert data\n");
+ HDprintf("Can't convert data\n");
goto error;
}
/* Convert data from the 1st back to the 2nd derived floating-point type. */
if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
- printf("Can't convert data\n");
+ HDprintf("Can't convert data\n");
goto error;
}
@@ -1246,22 +1243,22 @@ test_derived_flt(void)
/* Print errors */
if (0==fails_this_test++) {
- HDsnprintf(str, sizeof(str), "\nTesting random sw derived floating-point -> derived floating-point conversions");
- printf("%-70s", str);
- HDfflush(stdout);
+ HDsnprintf(str, sizeof(str), "\nTesting random sw derived floating-point -> derived floating-point conversions");
+ HDprintf("%-70s", str);
+ HDfflush(stdout);
H5_FAILED();
}
- printf(" test %u elmt %u: \n", 1, (unsigned)i);
+ HDprintf(" test %u elmt %u: \n", 1, (unsigned)i);
- printf(" src = ");
+ HDprintf(" src = ");
for (j=0; j<src_size; j++)
- printf(" %02x", saved_buf[i*src_size+ENDIAN(src_size, j, endian)]);
- printf("\n");
+ HDprintf(" %02x", saved_buf[i*src_size+ENDIAN(src_size, j, endian)]);
+ HDprintf("\n");
- printf(" dst = ");
+ HDprintf(" dst = ");
for (j=0; j<src_size; j++)
- printf(" %02x", buf[i*src_size+ENDIAN(src_size, j, endian)]);
- printf("\n");
+ HDprintf(" %02x", buf[i*src_size+ENDIAN(src_size, j, endian)]);
+ HDprintf("\n");
if (fails_this_test>=max_fails) {
HDputs(" maximum failures reached, aborting test...");
@@ -1274,25 +1271,25 @@ test_derived_flt(void)
if(H5Tclose(tid1) < 0) {
H5_FAILED();
- printf("Can't close datatype\n");
+ HDprintf("Can't close datatype\n");
goto error;
}
if(H5Tclose(tid2) < 0) {
H5_FAILED();
- printf("Can't close datatype\n");
+ HDprintf("Can't close datatype\n");
goto error;
}
if(H5Pclose(dxpl_id) < 0) {
H5_FAILED();
- printf("Can't close property list\n");
+ HDprintf("Can't close property list\n");
goto error;
}
if(H5Fclose(file) < 0) {
H5_FAILED();
- printf("Can't close file\n");
+ HDprintf("Can't close file\n");
goto error;
} /* end if */
@@ -1301,7 +1298,7 @@ test_derived_flt(void)
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
- reset_hdf5(); /*print statistics*/
+ reset_hdf5(); /*print statistics*/
return 0;
@@ -1325,7 +1322,7 @@ test_derived_flt(void)
return MAX((int)fails_this_test, 1);
}
-
+
/*-------------------------------------------------------------------------
* Function: test_derived_integer
*
@@ -1350,11 +1347,11 @@ test_derived_integer(void)
char filename[1024];
size_t src_size, dst_size;
unsigned char *buf=NULL, *saved_buf=NULL;
- int endian; /*endianess */
+ int endian; /*endianess */
size_t nelmts = NTESTELEM;
unsigned int fails_this_test = 0;
- const size_t max_fails=40; /*max number of failures*/
- char str[256]; /*message string */
+ const size_t max_fails=40; /*max number of failures*/
+ char str[256]; /*message string */
unsigned int i, j;
TESTING("user-define and query functions of integer types");
@@ -1363,25 +1360,25 @@ test_derived_integer(void)
h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof filename);
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
H5_FAILED();
- printf("Can't create file\n");
+ HDprintf("Can't create file\n");
goto error;
}
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
H5_FAILED();
- printf("Can't create data transfer property list\n");
+ HDprintf("Can't create data transfer property list\n");
goto error;
}
if((tid1 = H5Tcopy(H5T_STD_I32LE)) < 0) {
H5_FAILED();
- printf("Can't copy data type\n");
+ HDprintf("Can't copy data type\n");
goto error;
}
if((tid2 = H5Tcopy(H5T_STD_U64LE)) < 0) {
H5_FAILED();
- printf("Can't copy data type\n");
+ HDprintf("Can't copy data type\n");
goto error;
}
@@ -1399,37 +1396,37 @@ test_derived_integer(void)
*--------------------------------------------------------------------------*/
if(H5Tset_offset(tid1, (size_t)0) < 0) {
H5_FAILED();
- printf("Can't set offset\n");
+ HDprintf("Can't set offset\n");
goto error;
}
if(H5Tset_size(tid1, (size_t)3) < 0) {
H5_FAILED();
- printf("Can't set size\n");
+ HDprintf("Can't set size\n");
goto error;
}
if(H5Tset_precision(tid1, (size_t)24) < 0) {
H5_FAILED();
- printf("Can't set precision\n");
+ HDprintf("Can't set precision\n");
goto error;
}
if(H5Tset_order(tid1, H5T_ORDER_BE) < 0) {
H5_FAILED();
- printf("Can't set order\n");
+ HDprintf("Can't set order\n");
goto error;
}
if(H5Tcommit2(file, "new integer type 1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
H5_FAILED();
- printf("Can't commit data type\n");
+ HDprintf("Can't commit data type\n");
goto error;
}
if(H5Tclose(tid1) < 0) {
H5_FAILED();
- printf("Can't close datatype\n");
+ HDprintf("Can't close datatype\n");
goto error;
}
@@ -1437,22 +1434,22 @@ test_derived_integer(void)
FAIL_PUTS_ERROR("Can't open datatype")
if(H5Tget_precision(tid1) != 24) {
H5_FAILED();
- printf("Can't get precision or wrong precision\n");
+ HDprintf("Can't get precision or wrong precision\n");
goto error;
}
if(H5Tget_offset(tid1) != 0) {
H5_FAILED();
- printf("Can't get offset or wrong offset\n");
+ HDprintf("Can't get offset or wrong offset\n");
goto error;
}
if(H5Tget_size(tid1) != 3) {
H5_FAILED();
- printf("Can't get size or wrong size\n");
+ HDprintf("Can't get size or wrong size\n");
goto error;
}
if(H5Tget_order(tid1)!=H5T_ORDER_BE) {
H5_FAILED();
- printf("Can't get order or wrong order\n");
+ HDprintf("Can't get order or wrong order\n");
goto error;
}
@@ -1466,31 +1463,31 @@ test_derived_integer(void)
*--------------------------------------------------------------------------*/
if(H5Tset_precision(tid2, (size_t)48) < 0) {
H5_FAILED();
- printf("Can't set precision\n");
+ HDprintf("Can't set precision\n");
goto error;
}
if(H5Tset_offset(tid2, (size_t)10) < 0) {
H5_FAILED();
- printf("Can't set offset\n");
+ HDprintf("Can't set offset\n");
goto error;
}
if(H5Tset_sign(tid2, H5T_SGN_2) < 0) {
H5_FAILED();
- printf("Can't set offset\n");
+ HDprintf("Can't set offset\n");
goto error;
}
if(H5Tcommit2(file, "new integer type 2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
H5_FAILED();
- printf("Can't commit data type\n");
+ HDprintf("Can't commit data type\n");
goto error;
}
if(H5Tclose(tid2) < 0) {
H5_FAILED();
- printf("Can't close datatype\n");
+ HDprintf("Can't close datatype\n");
goto error;
}
@@ -1498,22 +1495,22 @@ test_derived_integer(void)
FAIL_PUTS_ERROR("Can't open datatype")
if(H5Tget_precision(tid2) != 48) {
H5_FAILED();
- printf("Can't get precision or wrong precision\n");
+ HDprintf("Can't get precision or wrong precision\n");
goto error;
}
if(H5Tget_offset(tid2) != 10) {
H5_FAILED();
- printf("Can't get offset or wrong offset\n");
+ HDprintf("Can't get offset or wrong offset\n");
goto error;
}
if(H5Tget_size(tid2) != 8) {
H5_FAILED();
- printf("Can't get size or wrong size\n");
+ HDprintf("Can't get size or wrong size\n");
goto error;
}
if(H5Tget_sign(tid2)!=H5T_SGN_2) {
H5_FAILED();
- printf("Can't get sign or wrong sign\n");
+ HDprintf("Can't get sign or wrong sign\n");
goto error;
}
@@ -1537,13 +1534,13 @@ test_derived_integer(void)
* the 1st type's precision. */
if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
- printf("Can't convert data\n");
+ HDprintf("Can't convert data\n");
goto error;
}
/* Convert data from the 2nd back to the 1st derived integer type. */
if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
- printf("Can't convert data\n");
+ HDprintf("Can't convert data\n");
goto error;
}
@@ -1557,22 +1554,22 @@ test_derived_integer(void)
/* Print errors */
if (0==fails_this_test++) {
- HDsnprintf(str, sizeof(str), "\nTesting random sw derived integer -> derived integer conversions");
- printf("%-70s", str);
- HDfflush(stdout);
+ HDsnprintf(str, sizeof(str), "\nTesting random sw derived integer -> derived integer conversions");
+ HDprintf("%-70s", str);
+ HDfflush(stdout);
H5_FAILED();
}
- printf(" test %u elmt %u: \n", 1, (unsigned)i);
+ HDprintf(" test %u elmt %u: \n", 1, (unsigned)i);
- printf(" src = ");
+ HDprintf(" src = ");
for (j=0; j<src_size; j++)
- printf(" %02x", saved_buf[i*src_size+ENDIAN(src_size, j, endian)]);
- printf("\n");
+ HDprintf(" %02x", saved_buf[i*src_size+ENDIAN(src_size, j, endian)]);
+ HDprintf("\n");
- printf(" dst = ");
+ HDprintf(" dst = ");
for (j=0; j<src_size; j++)
- printf(" %02x", buf[i*src_size+ENDIAN(src_size, j, endian)]);
- printf("\n");
+ HDprintf(" %02x", buf[i*src_size+ENDIAN(src_size, j, endian)]);
+ HDprintf("\n");
if (fails_this_test>=max_fails) {
HDputs(" maximum failures reached, aborting test...");
@@ -1582,25 +1579,25 @@ test_derived_integer(void)
if(H5Tclose(tid1) < 0) {
H5_FAILED();
- printf("Can't close datatype\n");
+ HDprintf("Can't close datatype\n");
goto error;
}
if(H5Tclose(tid2) < 0) {
H5_FAILED();
- printf("Can't close datatype\n");
+ HDprintf("Can't close datatype\n");
goto error;
}
if(H5Pclose(dxpl_id) < 0) {
H5_FAILED();
- printf("Can't close property list\n");
+ HDprintf("Can't close property list\n");
goto error;
}
if(H5Fclose(file) < 0) {
H5_FAILED();
- printf("Can't close file\n");
+ HDprintf("Can't close file\n");
goto error;
} /* end if */
@@ -1612,7 +1609,7 @@ test_derived_integer(void)
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
- reset_hdf5(); /*print statistics*/
+ reset_hdf5(); /*print statistics*/
return 0;
@@ -1635,24 +1632,24 @@ test_derived_integer(void)
return MAX((int)fails_this_test, 1);
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_conv_int_1
+ * Function: test_conv_int_1
*
- * Purpose: Test conversion of integer values from SRC to DST.
- * These types should be any combination of:
+ * Purpose: Test conversion of integer values from SRC to DST.
+ * These types should be any combination of:
*
- * H5T_NATIVE_SCHAR H5T_NATIVE_UCHAR
- * H5T_NATIVE_SHORT H5T_NATIVE_USHORT
- * H5T_NATIVE_INT H5T_NATIVE_UINT
- * H5T_NATIVE_LONG H5T_NATIVE_ULONG
- * H5T_NATIVE_LLONG H5T_NATIVE_ULLONG
+ * H5T_NATIVE_SCHAR H5T_NATIVE_UCHAR
+ * H5T_NATIVE_SHORT H5T_NATIVE_USHORT
+ * H5T_NATIVE_INT H5T_NATIVE_UINT
+ * H5T_NATIVE_LONG H5T_NATIVE_ULONG
+ * H5T_NATIVE_LLONG H5T_NATIVE_ULLONG
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, November 16, 1998
*
* Modifications:
@@ -1662,121 +1659,121 @@ test_derived_integer(void)
static int
test_conv_int_1(const char *name, hid_t src, hid_t dst)
{
- size_t nelmts=0; /*num values per test */
- const size_t max_fails=8; /*max number of failures*/
- size_t fails_all_tests=0; /*number of failures */
- size_t fails_this_test; /*fails for this test */
- char str[256]; /*hello string */
- dtype_t src_type, dst_type; /*data types */
- const char *src_type_name=NULL; /*source type name */
- const char *dst_type_name=NULL; /*destination type name */
- int endian; /*machine endianess */
- size_t src_size, dst_size; /*type sizes */
- unsigned char *buf=NULL; /*buffer for conversion */
- unsigned char *saved=NULL; /*original values */
- size_t j, k; /*counters */
- unsigned char *hw=NULL; /*hardware conv result */
- unsigned char src_bits[32]; /*src value in LE order */
- unsigned char dst_bits[32]; /*dest value in LE order*/
- size_t src_nbits; /*source length in bits */
- size_t dst_nbits; /*dst length in bits */
+ size_t nelmts=0; /*num values per test */
+ const size_t max_fails=8; /*max number of failures*/
+ size_t fails_all_tests=0; /*number of failures */
+ size_t fails_this_test; /*fails for this test */
+ char str[256]; /*hello string */
+ dtype_t src_type, dst_type; /*data types */
+ const char *src_type_name=NULL; /*source type name */
+ const char *dst_type_name=NULL; /*destination type name */
+ int endian; /*machine endianess */
+ size_t src_size, dst_size; /*type sizes */
+ unsigned char *buf=NULL; /*buffer for conversion */
+ unsigned char *saved=NULL; /*original values */
+ size_t j, k; /*counters */
+ unsigned char *hw=NULL; /*hardware conv result */
+ unsigned char src_bits[32]; /*src value in LE order */
+ unsigned char dst_bits[32]; /*dest value in LE order*/
+ size_t src_nbits; /*source length in bits */
+ size_t dst_nbits; /*dst length in bits */
H5T_sign_t src_sign; /*source sign type */
H5T_sign_t dst_sign; /*dst sign type */
- void *aligned=NULL; /*aligned temp buffer */
- signed char hw_char;
- unsigned char hw_uchar;
- short hw_short;
- unsigned short hw_ushort;
- int hw_int;
- unsigned hw_uint;
- long hw_long;
- unsigned long hw_ulong;
- long long hw_llong;
- unsigned long long hw_ullong;
+ void *aligned=NULL; /*aligned temp buffer */
+ signed char hw_char;
+ unsigned char hw_uchar;
+ short hw_short;
+ unsigned short hw_ushort;
+ int hw_int;
+ unsigned hw_uint;
+ long hw_long;
+ unsigned long hw_ulong;
+ long long hw_llong;
+ unsigned long long hw_ullong;
/* What are the names of the source and destination types */
if (H5Tequal(src, H5T_NATIVE_SCHAR)) {
- src_type_name = "signed char";
- src_type = INT_SCHAR;
+ src_type_name = "signed char";
+ src_type = INT_SCHAR;
} else if (H5Tequal(src, H5T_NATIVE_UCHAR)) {
- src_type_name = "unsigned char";
- src_type = INT_UCHAR;
+ src_type_name = "unsigned char";
+ src_type = INT_UCHAR;
} else if (H5Tequal(src, H5T_NATIVE_SHORT)) {
- src_type_name = "short";
- src_type = INT_SHORT;
+ src_type_name = "short";
+ src_type = INT_SHORT;
} else if (H5Tequal(src, H5T_NATIVE_USHORT)) {
- src_type_name = "unsigned short";
- src_type = INT_USHORT;
+ src_type_name = "unsigned short";
+ src_type = INT_USHORT;
} else if (H5Tequal(src, H5T_NATIVE_INT)) {
- src_type_name = "int";
- src_type = INT_INT;
+ src_type_name = "int";
+ src_type = INT_INT;
} else if (H5Tequal(src, H5T_NATIVE_UINT)) {
- src_type_name = "unsigned int";
- src_type = INT_UINT;
+ src_type_name = "unsigned int";
+ src_type = INT_UINT;
} else if (H5Tequal(src, H5T_NATIVE_LONG)) {
- src_type_name = "long";
- src_type = INT_LONG;
+ src_type_name = "long";
+ src_type = INT_LONG;
} else if (H5Tequal(src, H5T_NATIVE_ULONG)) {
- src_type_name = "unsigned long";
- src_type = INT_ULONG;
+ src_type_name = "unsigned long";
+ src_type = INT_ULONG;
} else if (H5Tequal(src, H5T_NATIVE_LLONG)) {
- src_type_name = "long long";
- src_type = INT_LLONG;
+ src_type_name = "long long";
+ src_type = INT_LLONG;
} else if (H5Tequal(src, H5T_NATIVE_ULLONG)) {
- src_type_name = "unsigned long long";
- src_type = INT_ULLONG;
+ src_type_name = "unsigned long long";
+ src_type = INT_ULLONG;
} else {
- src_type_name = "UNKNOWN";
- src_type = OTHER;
+ src_type_name = "UNKNOWN";
+ src_type = OTHER;
}
if (H5Tequal(dst, H5T_NATIVE_SCHAR)) {
- dst_type_name = "signed char";
- dst_type = INT_SCHAR;
+ dst_type_name = "signed char";
+ dst_type = INT_SCHAR;
} else if (H5Tequal(dst, H5T_NATIVE_UCHAR)) {
- dst_type_name = "unsigned char";
- dst_type = INT_UCHAR;
+ dst_type_name = "unsigned char";
+ dst_type = INT_UCHAR;
} else if (H5Tequal(dst, H5T_NATIVE_SHORT)) {
- dst_type_name = "short";
- dst_type = INT_SHORT;
+ dst_type_name = "short";
+ dst_type = INT_SHORT;
} else if (H5Tequal(dst, H5T_NATIVE_USHORT)) {
- dst_type_name = "unsigned short";
- dst_type = INT_USHORT;
+ dst_type_name = "unsigned short";
+ dst_type = INT_USHORT;
} else if (H5Tequal(dst, H5T_NATIVE_INT)) {
- dst_type_name = "int";
- dst_type = INT_INT;
+ dst_type_name = "int";
+ dst_type = INT_INT;
} else if (H5Tequal(dst, H5T_NATIVE_UINT)) {
- dst_type_name = "unsigned int";
- dst_type = INT_UINT;
+ dst_type_name = "unsigned int";
+ dst_type = INT_UINT;
} else if (H5Tequal(dst, H5T_NATIVE_LONG)) {
- dst_type_name = "long";
- dst_type = INT_LONG;
+ dst_type_name = "long";
+ dst_type = INT_LONG;
} else if (H5Tequal(dst, H5T_NATIVE_ULONG)) {
- dst_type_name = "unsigned long";
- dst_type = INT_ULONG;
+ dst_type_name = "unsigned long";
+ dst_type = INT_ULONG;
} else if (H5Tequal(dst, H5T_NATIVE_LLONG)) {
- dst_type_name = "long long";
- dst_type = INT_LLONG;
+ dst_type_name = "long long";
+ dst_type = INT_LLONG;
} else if (H5Tequal(dst, H5T_NATIVE_ULLONG)) {
- dst_type_name = "unsigned long long";
- dst_type = INT_ULLONG;
+ dst_type_name = "unsigned long long";
+ dst_type = INT_ULLONG;
} else {
- dst_type_name = "UNKNOWN";
- dst_type = OTHER;
+ dst_type_name = "UNKNOWN";
+ dst_type = OTHER;
}
/* Sanity checks */
if (OTHER==src_type || OTHER==dst_type) {
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, src_type_name, dst_type_name);
- printf("%-70s", str);
- H5_FAILED();
- HDputs(" Unknown data type.");
- goto error;
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
+ name, src_type_name, dst_type_name);
+ HDprintf("%-70s", str);
+ H5_FAILED();
+ HDputs(" Unknown data type.");
+ goto error;
} else {
HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, src_type_name, dst_type_name);
- printf("%-70s", str);
+ HDprintf("%-70s", str);
HDfflush(stdout);
fails_this_test=0;
}
@@ -2459,44 +2456,44 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
/* Print errors */
if (0==fails_this_test++)
H5_FAILED();
- printf(" elmt %u\n", (unsigned)j);
+ HDprintf(" elmt %u\n", (unsigned)j);
- printf(" src = ");
+ HDprintf(" src = ");
for (k=0; k<src_size; k++)
- printf(" %02x", saved[j*src_size+ENDIAN(src_size, k, endian)]);
- printf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), "");
+ HDprintf(" %02x", saved[j*src_size+ENDIAN(src_size, k, endian)]);
+ HDprintf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), "");
switch (src_type) {
case INT_SCHAR:
HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
- printf(" %29d\n", (int)*((signed char*)aligned));
+ HDprintf(" %29d\n", (int)*((signed char*)aligned));
break;
case INT_UCHAR:
HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- printf(" %29u\n", (unsigned)*((unsigned char*)aligned));
+ HDprintf(" %29u\n", (unsigned)*((unsigned char*)aligned));
break;
case INT_SHORT:
HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- printf(" %29hd\n", *((short*)aligned));
+ HDprintf(" %29hd\n", *((short*)aligned));
break;
case INT_USHORT:
HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- printf(" %29hu\n", *((unsigned short*)aligned));
+ HDprintf(" %29hu\n", *((unsigned short*)aligned));
break;
case INT_INT:
HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- printf(" %29d\n", *((int*)aligned));
+ HDprintf(" %29d\n", *((int*)aligned));
break;
case INT_UINT:
HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- printf(" %29u\n", *((unsigned*)aligned));
+ HDprintf(" %29u\n", *((unsigned*)aligned));
break;
case INT_LONG:
HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- printf(" %29ld\n", *((long*)aligned));
+ HDprintf(" %29ld\n", *((long*)aligned));
break;
case INT_ULONG:
HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- printf(" %29lu\n", *((unsigned long*)aligned));
+ HDprintf(" %29lu\n", *((unsigned long*)aligned));
break;
case INT_LLONG:
HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
@@ -2515,42 +2512,42 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
break;
}
- printf(" dst = ");
+ HDprintf(" dst = ");
for (k=0; k<dst_size; k++)
- printf(" %02x", buf[j*dst_size+ENDIAN(dst_size, k, endian)]);
- printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
+ HDprintf(" %02x", buf[j*dst_size+ENDIAN(dst_size, k, endian)]);
+ HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
switch (dst_type) {
case INT_SCHAR:
HDmemcpy(aligned, buf+j*sizeof(signed char), sizeof(signed char));
- printf(" %29d\n", (int)*((signed char*)aligned));
+ HDprintf(" %29d\n", (int)*((signed char*)aligned));
break;
case INT_UCHAR:
HDmemcpy(aligned, buf+j*sizeof(unsigned char), sizeof(unsigned char));
- printf(" %29u\n", (unsigned)*((unsigned char*)aligned));
+ HDprintf(" %29u\n", (unsigned)*((unsigned char*)aligned));
break;
case INT_SHORT:
HDmemcpy(aligned, buf+j*sizeof(short), sizeof(short));
- printf(" %29hd\n", *((short*)aligned));
+ HDprintf(" %29hd\n", *((short*)aligned));
break;
case INT_USHORT:
HDmemcpy(aligned, buf+j*sizeof(unsigned short), sizeof(unsigned short));
- printf(" %29hu\n", *((unsigned short*)aligned));
+ HDprintf(" %29hu\n", *((unsigned short*)aligned));
break;
case INT_INT:
HDmemcpy(aligned, buf+j*sizeof(int), sizeof(int));
- printf(" %29d\n", *((int*)aligned));
+ HDprintf(" %29d\n", *((int*)aligned));
break;
case INT_UINT:
HDmemcpy(aligned, buf+j*sizeof(unsigned), sizeof(unsigned));
- printf(" %29u\n", *((unsigned*)aligned));
+ HDprintf(" %29u\n", *((unsigned*)aligned));
break;
case INT_LONG:
HDmemcpy(aligned, buf+j*sizeof(long), sizeof(long));
- printf(" %29ld\n", *((long*)aligned));
+ HDprintf(" %29ld\n", *((long*)aligned));
break;
case INT_ULONG:
HDmemcpy(aligned, buf+j*sizeof(unsigned long), sizeof(unsigned long));
- printf(" %29lu\n", *((unsigned long*)aligned));
+ HDprintf(" %29lu\n", *((unsigned long*)aligned));
break;
case INT_LLONG:
HDmemcpy(aligned, buf+j*sizeof(long long), sizeof(long long));
@@ -2569,40 +2566,40 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
break;
}
- printf(" ans = ");
+ HDprintf(" ans = ");
for (k=0; k<dst_size; k++)
- printf(" %02x", hw[ENDIAN(dst_size, k, endian)]);
- printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
+ HDprintf(" %02x", hw[ENDIAN(dst_size, k, endian)]);
+ HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
switch (dst_type) {
case INT_SCHAR:
- printf(" %29d\n", (int)*((signed char*)hw));
+ HDprintf(" %29d\n", (int)*((signed char*)((void *)hw)));
break;
case INT_UCHAR:
- printf(" %29u\n", (unsigned)*((unsigned char*)hw));
+ HDprintf(" %29u\n", (unsigned)*((unsigned char*)((void *)hw)));
break;
case INT_SHORT:
- printf(" %29hd\n", *((short*)hw));
+ HDprintf(" %29hd\n", *((short*)((void *)hw)));
break;
case INT_USHORT:
- printf(" %29hu\n", *((unsigned short*)hw));
+ HDprintf(" %29hu\n", *((unsigned short*)((void *)hw)));
break;
case INT_INT:
- printf(" %29d\n", *((int*)hw));
+ HDprintf(" %29d\n", *((int*)((void *)hw)));
break;
case INT_UINT:
- printf(" %29u\n", *((unsigned*)hw));
+ HDprintf(" %29u\n", *((unsigned*)((void *)hw)));
break;
case INT_LONG:
- printf(" %29ld\n", *((long*)hw));
+ HDprintf(" %29ld\n", *((long*)((void *)hw)));
break;
case INT_ULONG:
- printf(" %29lu\n", *((unsigned long*)hw));
+ HDprintf(" %29lu\n", *((unsigned long*)((void *)hw)));
break;
case INT_LLONG:
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)hw));
+ HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)((void *)hw)));
break;
case INT_ULLONG:
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)hw));
+ HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)((void *)hw)));
break;
case FLT_FLOAT:
case FLT_DOUBLE:
@@ -2630,7 +2627,7 @@ done:
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
- reset_hdf5(); /*print statistics*/
+ reset_hdf5(); /*print statistics*/
return (int)fails_all_tests;
@@ -2643,23 +2640,23 @@ error:
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
- reset_hdf5(); /*print statistics*/
+ reset_hdf5(); /*print statistics*/
return MAX((int)fails_all_tests, 1);
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_conv_int_2
+ * Function: test_conv_int_2
*
- * Purpose: Tests overlap calculates in H5T__conv_i_i(), which should be
- * the same as for H5T__conv_f_f() and H5T__conv_s_s().
+ * Purpose: Tests overlap calculates in H5T__conv_i_i(), which should be
+ * the same as for H5T__conv_f_f() and H5T__conv_s_s().
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Friday, April 30, 1999
*
* Modifications:
@@ -2669,47 +2666,50 @@ error:
static int
test_conv_int_2(void)
{
- int i, j;
- hid_t src_type, dst_type;
- char buf[32*100];
+ int i, j;
+ hid_t src_type, dst_type;
+ char *buf;
- printf("%-70s", "Testing overlap calculations");
+ HDprintf("%-70s", "Testing overlap calculations");
HDfflush(stdout);
- HDmemset(buf, 0, sizeof buf);
- for (i=1; i<=32; i++) {
- for (j=1; j<=32; j++) {
-
- /* Source type */
- src_type = H5Tcopy(H5T_NATIVE_CHAR);
- H5Tset_size(src_type, (size_t)i);
-
- /* Destination type */
- dst_type = H5Tcopy(H5T_NATIVE_CHAR);
- H5Tset_size(dst_type, (size_t)j);
-
- /*
- * Conversion. If overlap calculations aren't right then an
- * assertion will fail in H5T__conv_i_i()
- */
- H5Tconvert(src_type, dst_type, (size_t)100, buf, NULL, H5P_DEFAULT);
- H5Tclose(src_type);
- H5Tclose(dst_type);
- }
+ buf = (char *)HDcalloc(TMP_BUF_DIM1, TMP_BUF_DIM2);
+ HDassert(buf);
+
+ for(i = 1; i <= TMP_BUF_DIM1; i++) {
+ for(j = 1; j <= TMP_BUF_DIM1; j++) {
+
+ /* Source type */
+ src_type = H5Tcopy(H5T_NATIVE_CHAR);
+ H5Tset_size(src_type, (size_t)i);
+
+ /* Destination type */
+ dst_type = H5Tcopy(H5T_NATIVE_CHAR);
+ H5Tset_size(dst_type, (size_t)j);
+
+ /*
+ * Conversion. If overlap calculations aren't right then an
+ * assertion will fail in H5T__conv_i_i()
+ */
+ H5Tconvert(src_type, dst_type, (size_t)TMP_BUF_DIM2, buf, NULL, H5P_DEFAULT);
+ H5Tclose(src_type);
+ H5Tclose(dst_type);
+ }
}
PASSED();
+ HDfree(buf);
return 0;
}
-
+
/*-------------------------------------------------------------------------
- * Function: my_isnan
+ * Function: my_isnan
*
- * Purpose: Determines whether VAL points to NaN.
+ * Purpose: Determines whether VAL points to NaN.
*
- * Return: TRUE or FALSE
+ * Return: TRUE or FALSE
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, July 6, 1998
*
* Modifications:
@@ -2723,21 +2723,21 @@ my_isnan(dtype_t type, void *val)
char s[256];
if (FLT_FLOAT==type) {
- float x;
- HDmemcpy(&x, val, sizeof(float));
- retval = (x!=x);
+ float x;
+ HDmemcpy(&x, val, sizeof(float));
+ retval = (x!=x);
} else if (FLT_DOUBLE==type) {
- double x;
- HDmemcpy(&x, val, sizeof(double));
- retval = (x!=x);
+ double x;
+ HDmemcpy(&x, val, sizeof(double));
+ retval = (x!=x);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
} else if (FLT_LDOUBLE==type) {
- long double x;
- HDmemcpy(&x, val, sizeof(long double));
- retval = (x!=x);
+ long double x;
+ HDmemcpy(&x, val, sizeof(long double));
+ retval = (x!=x);
#endif
} else {
- return 0;
+ return 0;
}
/*
@@ -2745,42 +2745,42 @@ my_isnan(dtype_t type, void *val)
* the result contains a NaN string.
*/
if (!retval) {
- if (FLT_FLOAT==type) {
- float x;
+ if (FLT_FLOAT==type) {
+ float x;
- HDmemcpy(&x, val, sizeof(float));
- HDsnprintf(s, sizeof(s), "%g", x);
- } else if (FLT_DOUBLE==type) {
- double x;
+ HDmemcpy(&x, val, sizeof(float));
+ HDsnprintf(s, sizeof(s), "%g", (double)x);
+ } else if (FLT_DOUBLE==type) {
+ double x;
- HDmemcpy(&x, val, sizeof(double));
- HDsnprintf(s, sizeof(s), "%g", x);
+ HDmemcpy(&x, val, sizeof(double));
+ HDsnprintf(s, sizeof(s), "%g", x);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
- } else if (FLT_LDOUBLE==type) {
- long double x;
+ } else if (FLT_LDOUBLE==type) {
+ long double x;
- HDmemcpy(&x, val, sizeof(long double));
- HDsnprintf(s, sizeof(s), "%Lg", x);
+ HDmemcpy(&x, val, sizeof(long double));
+ HDsnprintf(s, sizeof(s), "%Lg", x);
#endif
- } else {
- return 0;
- }
- if (HDstrstr(s, "NaN") || HDstrstr(s, "NAN") || HDstrstr(s, "nan"))
- retval = 1;
+ } else {
+ return 0;
+ }
+ if (HDstrstr(s, "NaN") || HDstrstr(s, "NAN") || HDstrstr(s, "nan"))
+ retval = 1;
}
return retval;
}
-
+
/*-------------------------------------------------------------------------
- * Function: my_isinf
+ * Function: my_isinf
*
- * Purpose: Determines whether VAL points to +/-infinity.
+ * Purpose: Determines whether VAL points to +/-infinity.
*
- * Return: TRUE or FALSE
+ * Return: TRUE or FALSE
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Monday, June 20, 2005
*
* Modifications:
@@ -2809,70 +2809,70 @@ my_isinf(int endian, unsigned char *val, size_t size,
return retval;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_conv_flt_1
+ * Function: test_conv_flt_1
*
- * Purpose: Test conversion of floating point values from SRC to
- * DST. These types should be H5T_NATIVE_FLOAT,
- * H5T_NATIVE_DOUBLE, or H5T_NATIVE_LDOUBLE.
+ * Purpose: Test conversion of floating point values from SRC to
+ * DST. These types should be H5T_NATIVE_FLOAT,
+ * H5T_NATIVE_DOUBLE, or H5T_NATIVE_LDOUBLE.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, June 23, 1998
*
* Modifications:
- * Albert Cheng, Apr 16, 2004
- * Check for underflow condition. If the src number is
- * smaller than the dst MIN float number, consider it okay
- * if the converted sw and hw dst are both less than or
- * equal to the dst MIN float number.
+ * Albert Cheng, Apr 16, 2004
+ * Check for underflow condition. If the src number is
+ * smaller than the dst MIN float number, consider it okay
+ * if the converted sw and hw dst are both less than or
+ * equal to the dst MIN float number.
*
*-------------------------------------------------------------------------
*/
static int
test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
{
- dtype_t src_type, dst_type; /*data types */
- size_t nelmts=0; /*num values per test */
- const size_t max_fails=8; /*max number of failures*/
- size_t fails_all_tests=0; /*number of failures */
- size_t fails_this_test; /*fails for this test */
- const char *src_type_name = NULL; /*source type name */
- const char *dst_type_name = NULL; /*destination type name */
- size_t src_size, dst_size; /*type sizes */
- unsigned char *buf = NULL; /*buffer for conversion */
- unsigned char *saved = NULL; /*original values */
- char str[256]; /*hello string */
- void *aligned=NULL; /*aligned buffer */
- float hw_f; /*hardware-converted */
- double hw_d; /*hardware-converted */
+ dtype_t src_type, dst_type; /*data types */
+ size_t nelmts=0; /*num values per test */
+ const size_t max_fails=8; /*max number of failures*/
+ size_t fails_all_tests=0; /*number of failures */
+ size_t fails_this_test; /*fails for this test */
+ const char *src_type_name = NULL; /*source type name */
+ const char *dst_type_name = NULL; /*destination type name */
+ size_t src_size, dst_size; /*type sizes */
+ unsigned char *buf = NULL; /*buffer for conversion */
+ unsigned char *saved = NULL; /*original values */
+ char str[256]; /*hello string */
+ void *aligned=NULL; /*aligned buffer */
+ float hw_f; /*hardware-converted */
+ double hw_d; /*hardware-converted */
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- long double hw_ld; /*hardware-converted */
+ long double hw_ld; /*hardware-converted */
#endif
- unsigned char *hw=NULL; /*ptr to hardware-conv'd*/
- int underflow; /*underflow occurred */
- int overflow; /*overflow occurred */
- int uflow=0; /*underflow debug counters*/
- size_t j, k; /*counters */
- int sendian; /* source type endianess */
- int dendian; /* Destination type endianess */
- size_t dst_ebias; /* Destination type's exponent bias */
- size_t src_epos; /* Source type's exponent position */
- size_t src_esize; /* Source type's exponent size */
- size_t dst_epos; /* Destination type's exponent position */
- size_t dst_esize; /* Destination type's exponent size */
- size_t dst_mpos; /* Destination type's mantissa position */
- size_t dst_msize; /* Destination type's mantissa size */
- size_t src_nbits; /* source length in bits */
- size_t dst_nbits; /* dst length in bits */
+ unsigned char *hw=NULL; /*ptr to hardware-conv'd*/
+ int underflow; /*underflow occurred */
+ int overflow = 0; /*overflow occurred */
+ int uflow=0; /*underflow debug counters*/
+ size_t j, k; /*counters */
+ int sendian; /* source type endianess */
+ int dendian; /* Destination type endianess */
+ size_t dst_ebias; /* Destination type's exponent bias */
+ size_t src_epos; /* Source type's exponent position */
+ size_t src_esize; /* Source type's exponent size */
+ size_t dst_epos; /* Destination type's exponent position */
+ size_t dst_esize; /* Destination type's exponent size */
+ size_t dst_mpos; /* Destination type's mantissa position */
+ size_t dst_msize; /* Destination type's mantissa size */
+ size_t src_nbits; /* source length in bits */
+ size_t dst_nbits; /* dst length in bits */
#ifdef HANDLE_SIGFPE
- pid_t child_pid; /*process ID of child */
- int status; /*child exit status */
+ pid_t child_pid; /*process ID of child */
+ int status; /*child exit status */
/*
* Some systems generage SIGFPE during floating point overflow and we
@@ -2883,22 +2883,22 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
HDfflush(stdout);
HDfflush(stderr);
if ((child_pid=fork()) < 0) {
- HDperror("fork");
- return 1;
+ HDperror("fork");
+ return 1;
} else if (child_pid>0) {
- while (child_pid!=waitpid(child_pid, &status, 0)) /*void*/;
- if (WIFEXITED(status) && 255==WEXITSTATUS(status)) {
- return 0; /*child exit after catching SIGFPE*/
- } else if (WIFEXITED(status)) {
- return WEXITSTATUS(status);
- } else if (WIFSIGNALED(status)) {
- HDsnprintf(str, sizeof(str), " Child caught signal %d.", WTERMSIG(status));
- HDputs(str);
- return 1; /*child exit after catching non-SIGFPE signal */
- } else {
- HDputs(" Child didn't exit normally.");
- return 1;
- }
+ while (child_pid!=waitpid(child_pid, &status, 0)) /*void*/;
+ if (WIFEXITED(status) && 255==WEXITSTATUS(status)) {
+ return 0; /*child exit after catching SIGFPE*/
+ } else if (WIFEXITED(status)) {
+ return WEXITSTATUS(status);
+ } else if (WIFSIGNALED(status)) {
+ HDsnprintf(str, sizeof(str), " Child caught signal %d.", WTERMSIG(status));
+ HDputs(str);
+ return 1; /*child exit after catching non-SIGFPE signal */
+ } else {
+ HDputs(" Child didn't exit normally.");
+ return 1;
+ }
}
#endif
@@ -2910,35 +2910,35 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
/* What are the names of the source and destination types */
if (H5Tequal(src, H5T_NATIVE_FLOAT)) {
- src_type_name = "float";
- src_type = FLT_FLOAT;
+ src_type_name = "float";
+ src_type = FLT_FLOAT;
} else if (H5Tequal(src, H5T_NATIVE_DOUBLE)) {
- src_type_name = "double";
- src_type = FLT_DOUBLE;
+ src_type_name = "double";
+ src_type = FLT_DOUBLE;
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
} else if (H5Tequal(src, H5T_NATIVE_LDOUBLE)) {
- src_type_name = "long double";
- src_type = FLT_LDOUBLE;
+ src_type_name = "long double";
+ src_type = FLT_LDOUBLE;
#endif
} else {
- src_type_name = "UNKNOWN";
- src_type = OTHER;
+ src_type_name = "UNKNOWN";
+ src_type = OTHER;
}
if (H5Tequal(dst, H5T_NATIVE_FLOAT)) {
- dst_type_name = "float";
- dst_type = FLT_FLOAT;
+ dst_type_name = "float";
+ dst_type = FLT_FLOAT;
} else if (H5Tequal(dst, H5T_NATIVE_DOUBLE)) {
- dst_type_name = "double";
- dst_type = FLT_DOUBLE;
+ dst_type_name = "double";
+ dst_type = FLT_DOUBLE;
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
} else if (H5Tequal(dst, H5T_NATIVE_LDOUBLE)) {
- dst_type_name = "long double";
- dst_type = FLT_LDOUBLE;
+ dst_type_name = "long double";
+ dst_type = FLT_LDOUBLE;
#endif
} else {
- dst_type_name = "UNKNOWN";
- dst_type = OTHER;
+ dst_type_name = "UNKNOWN";
+ dst_type = OTHER;
}
/* Sanity checks */
@@ -2946,22 +2946,22 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
HDputs("Sizeof(float)==sizeof(double) - some tests may not be sensible.");
if (OTHER==src_type || OTHER==dst_type) {
if(!strcmp(name, "noop"))
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, src_type_name, dst_type_name);
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
+ name, src_type_name, dst_type_name);
else if(run_test==TEST_SPECIAL)
- HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions",
- name, src_type_name, dst_type_name);
+ HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions",
+ name, src_type_name, dst_type_name);
else if(run_test==TEST_NORMAL)
- HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions",
- name, src_type_name, dst_type_name);
+ HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions",
+ name, src_type_name, dst_type_name);
else if(run_test==TEST_DENORM)
- HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions",
- name, src_type_name, dst_type_name);
+ HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions",
+ name, src_type_name, dst_type_name);
- printf("%-70s", str);
- H5_FAILED();
- HDputs(" Unknown data type.");
- goto error;
+ HDprintf("%-70s", str);
+ H5_FAILED();
+ HDputs(" Unknown data type.");
+ goto error;
} else {
if(!strcmp(name, "noop"))
HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
@@ -2976,7 +2976,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions",
name, src_type_name, dst_type_name);
- printf("%-70s", str);
+ HDprintf("%-70s", str);
HDfflush(stdout);
fails_this_test = 0;
}
@@ -3090,8 +3090,8 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
if (FLT_FLOAT==dst_type) {
hw_f = (float)(*((double*)aligned));
hw = (unsigned char*)&hw_f;
- underflow = HDfabs(*((double*)aligned)) < FLT_MIN;
- overflow = HDfabs(*((double*)aligned)) > FLT_MAX;
+ underflow = HDfabs(*((double*)aligned)) < (double)FLT_MIN;
+ overflow = HDfabs(*((double*)aligned)) > (double)FLT_MAX;
} else if (FLT_DOUBLE==dst_type) {
hw_d = *((double*)aligned);
hw = (unsigned char*)&hw_d;
@@ -3105,12 +3105,12 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
} else {
HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double));
if (FLT_FLOAT==dst_type) {
- hw_f = *((long double*)aligned);
+ hw_f = (float)*((long double*)aligned);
hw = (unsigned char*)&hw_f;
underflow = HDfabsl(*((long double*)aligned)) < FLT_MIN;
overflow = HDfabsl(*((long double*)aligned)) > FLT_MAX;
} else if (FLT_DOUBLE==dst_type) {
- hw_d = *((long double*)aligned);
+ hw_d = (double)*((long double*)aligned);
hw = (unsigned char*)&hw_d;
underflow = HDfabsl(*((long double*)aligned)) < DBL_MIN;
overflow = HDfabsl(*((long double*)aligned)) > DBL_MAX;
@@ -3193,18 +3193,18 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
* the SGI compiler assigns the dst's maximal value.
*/
{
- double check_mant[2];
- int check_expo[2];
+ double check_mant[2];
+ int check_expo[2];
if (FLT_FLOAT==dst_type) {
float x;
HDmemcpy(&x, &buf[j*dst_size], sizeof(float));
if (underflow &&
HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN)
- continue; /* all underflowed, no error */
+ continue; /* all underflowed, no error */
if (overflow && my_isinf(dendian, buf+j*sizeof(float),
dst_size, dst_mpos, dst_msize, dst_epos, dst_esize))
- continue; /* all overflowed, no error */
+ continue; /* all overflowed, no error */
check_mant[0] = HDfrexpf(x, check_expo+0);
check_mant[1] = HDfrexpf(hw_f, check_expo+1);
} else if (FLT_DOUBLE==dst_type) {
@@ -3212,10 +3212,10 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
HDmemcpy(&x, &buf[j*dst_size], sizeof(double));
if (underflow &&
HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN)
- continue; /* all underflowed, no error */
+ continue; /* all underflowed, no error */
if (overflow && my_isinf(dendian, buf+j*sizeof(double),
dst_size, dst_mpos, dst_msize, dst_epos, dst_esize))
- continue; /* all overflowed, no error */
+ continue; /* all overflowed, no error */
check_mant[0] = HDfrexp(x, check_expo+0);
check_mant[1] = HDfrexp(hw_d, check_expo+1);
#if H5_SIZEOF_LONG_DOUBLE !=0 && (H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE)
@@ -3223,15 +3223,15 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
long double x;
HDmemcpy(&x, &buf[j*dst_size], sizeof(long double));
/* dst is largest float, no need to check underflow. */
- check_mant[0] = HDfrexpl(x, check_expo+0);
- check_mant[1] = HDfrexpl(hw_ld, check_expo+1);
+ check_mant[0] = (double)HDfrexpl(x, check_expo+0);
+ check_mant[1] = (double)HDfrexpl(hw_ld, check_expo+1);
#endif
}
/* Special check for denormalized values */
if(check_expo[0]<(-(int)dst_ebias) || check_expo[1]<(-(int)dst_ebias)) {
- int expo_diff=check_expo[0]-check_expo[1];
- int valid_bits=(int)((dst_ebias+dst_msize)+MIN(check_expo[0],check_expo[1]))-1;
- double epsilon=1.0F;
+ int expo_diff = check_expo[0] - check_expo[1];
+ int valid_bits = (int)((dst_ebias + dst_msize) + (size_t)MIN(check_expo[0], check_expo[1])) - 1;
+ double epsilon = 1.0F;
/* Re-scale the mantissas based on any exponent difference */
if(expo_diff!=0)
@@ -3245,8 +3245,8 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
continue;
} /* end if */
else {
- if (check_expo[0]==check_expo[1] &&
- HDfabs(check_mant[0]-check_mant[1])<FP_EPSILON)
+ if(check_expo[0] == check_expo[1] &&
+ HDfabs(check_mant[0] - check_mant[1]) < (double)FP_EPSILON)
continue;
} /* end else */
}
@@ -3258,20 +3258,20 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
H5_WARNING();
}
}
- printf(" elmt %u\n", (unsigned)j);
+ HDprintf(" elmt %u\n", (unsigned)j);
- printf(" src =");
+ HDprintf(" src =");
for (k=0; k<src_size; k++)
- printf(" %02x", saved[j*src_size+ENDIAN(src_size,k,sendian)]);
- printf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), "");
+ HDprintf(" %02x", saved[j*src_size+ENDIAN(src_size,k,sendian)]);
+ HDprintf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), "");
if (FLT_FLOAT==src_type) {
float x;
HDmemcpy(&x, &saved[j*src_size], sizeof(float));
- printf(" %29.20e\n", x);
+ HDprintf(" %29.20e\n", (double)x);
} else if (FLT_DOUBLE==src_type) {
double x;
HDmemcpy(&x, &saved[j*src_size], sizeof(double));
- printf(" %29.20e\n", x);
+ HDprintf(" %29.20e\n", x);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
} else {
long double x;
@@ -3280,18 +3280,18 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
#endif
}
- printf(" dst =");
+ HDprintf(" dst =");
for (k=0; k<dst_size; k++)
- printf(" %02x", buf[j*dst_size+ENDIAN(dst_size,k,dendian)]);
- printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
+ HDprintf(" %02x", buf[j*dst_size+ENDIAN(dst_size,k,dendian)]);
+ HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
if (FLT_FLOAT==dst_type) {
float x;
HDmemcpy(&x, &buf[j*dst_size], sizeof(float));
- printf(" %29.20e\n", x);
+ HDprintf(" %29.20e\n", (double)x);
} else if (FLT_DOUBLE==dst_type) {
double x;
HDmemcpy(&x, &buf[j*dst_size], sizeof(double));
- printf(" %29.20e\n", x);
+ HDprintf(" %29.20e\n", x);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
} else {
long double x;
@@ -3300,14 +3300,14 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
#endif
}
- printf(" ans =");
+ HDprintf(" ans =");
for (k=0; k<dst_size; k++)
- printf(" %02x", hw[ENDIAN(dst_size,k,dendian)]);
- printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
+ HDprintf(" %02x", hw[ENDIAN(dst_size,k,dendian)]);
+ HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
if (FLT_FLOAT==dst_type)
- printf(" %29.20e\n", hw_f);
+ HDprintf(" %29.20e\n", (double)hw_f);
else if (FLT_DOUBLE==dst_type)
- printf(" %29.20e\n", hw_d);
+ HDprintf(" %29.20e\n", hw_d);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
else
HDfprintf(stdout," %29.20Le\n", hw_ld);
@@ -3338,7 +3338,7 @@ done:
if(run_test==TEST_NOOP || run_test==TEST_NORMAL)
HDexit(MIN((int)fails_all_tests, 254));
else if(run_test==TEST_DENORM || run_test==TEST_SPECIAL)
- HDexit(0);
+ HDexit(EXIT_SUCCESS);
HDassert(0 && "Should not reach this point!");
return 1;
#else
@@ -3364,7 +3364,7 @@ error:
if(run_test==TEST_NOOP || run_test==TEST_NORMAL)
HDexit(MIN(MAX((int)fails_all_tests, 1), 254));
else if(run_test==TEST_DENORM || run_test==TEST_SPECIAL)
- HDexit(1);
+ HDexit(EXIT_FAILURE);
HDassert(0 && "Should not reach this point!");
return 1;
#else
@@ -3380,24 +3380,24 @@ error:
#endif
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_conv_int_fp
+ * Function: test_conv_int_fp
*
- * Purpose: Test conversion between integer and float values
+ * Purpose: Test conversion between integer and float values
* from SRC to DST. These types should be any combination of:
*
- * H5T_NATIVE_SCHAR H5T_NATIVE_FLOAT
- * H5T_NATIVE_SHORT H5T_NATIVE_DOUBLE
- * H5T_NATIVE_INT H5T_NATIVE_LDOUBLE
- * H5T_NATIVE_LONG
- * H5T_NATIVE_LLONG
+ * H5T_NATIVE_SCHAR H5T_NATIVE_FLOAT
+ * H5T_NATIVE_SHORT H5T_NATIVE_DOUBLE
+ * H5T_NATIVE_INT H5T_NATIVE_LDOUBLE
+ * H5T_NATIVE_LONG
+ * H5T_NATIVE_LLONG
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Thursday, November 6, 2003
*
* Modifications:
@@ -3412,143 +3412,143 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
H5T_conv_except_func_t op; /*returned callback function for conversion exception*/
void *user_data; /*returned pointer to user data passed in to the callback*/
hbool_t except_set = FALSE; /*whether user's exception handling is set*/
- size_t nelmts=0; /*num values per test */
- const size_t max_fails=40; /*max number of failures*/
- size_t fails_all_tests=0; /*number of failures */
- size_t fails_this_test; /*fails for this test */
- char str[256]; /*hello string */
- dtype_t src_type; /*data types */
- dtype_t dst_type; /*data types */
- const char *src_type_name=NULL; /*source type name */
- const char *dst_type_name=NULL; /*destination type name */
- int sendian; /*source endianess */
- int dendian; /*destination endianess */
- size_t src_size, dst_size; /*type sizes */
- unsigned char *buf=NULL; /*buffer for conversion */
- unsigned char *saved=NULL; /*original values */
- size_t j, k; /*counters */
- unsigned char *hw=NULL; /*hardware conv result */
- unsigned char src_bits[32]; /*src value in LE order */
- unsigned char dst_bits[32]; /*dest value in LE order*/
- size_t src_nbits; /*source length in bits */
- size_t dst_nbits; /*dst length in bits */
- void *aligned=NULL; /*aligned temp buffer */
- float hw_float=0;
- double hw_double=0;
- long double hw_ldouble=0;
- signed char hw_schar=0;
- unsigned char hw_uchar=0;
- short hw_short=0;
- unsigned short hw_ushort=0;
- int hw_int=0;
- unsigned hw_uint=0;
- long hw_long=0;
- unsigned long hw_ulong=0;
- long long hw_llong=0;
- unsigned long long hw_ullong=0;
+ size_t nelmts=0; /*num values per test */
+ const size_t max_fails=40; /*max number of failures*/
+ size_t fails_all_tests=0; /*number of failures */
+ size_t fails_this_test; /*fails for this test */
+ char str[256]; /*hello string */
+ dtype_t src_type; /*data types */
+ dtype_t dst_type; /*data types */
+ const char *src_type_name=NULL; /*source type name */
+ const char *dst_type_name=NULL; /*destination type name */
+ int sendian; /*source endianess */
+ int dendian; /*destination endianess */
+ size_t src_size, dst_size; /*type sizes */
+ unsigned char *buf=NULL; /*buffer for conversion */
+ unsigned char *saved=NULL; /*original values */
+ size_t j, k; /*counters */
+ unsigned char *hw=NULL; /*hardware conv result */
+ unsigned char src_bits[32]; /*src value in LE order */
+ unsigned char dst_bits[32]; /*dest value in LE order*/
+ size_t src_nbits; /*source length in bits */
+ size_t dst_nbits; /*dst length in bits */
+ void *aligned=NULL; /*aligned temp buffer */
+ float hw_float=0;
+ double hw_double=0;
+ long double hw_ldouble=0;
+ signed char hw_schar=0;
+ unsigned char hw_uchar=0;
+ short hw_short=0;
+ unsigned short hw_ushort=0;
+ int hw_int=0;
+ unsigned hw_uint=0;
+ long hw_long=0;
+ unsigned long hw_ulong=0;
+ long long hw_llong=0;
+ unsigned long long hw_ullong=0;
/* What is the name of the source type */
if (H5Tequal(src, H5T_NATIVE_SCHAR)) {
- src_type_name = "signed char";
- src_type = INT_SCHAR;
+ src_type_name = "signed char";
+ src_type = INT_SCHAR;
} else if (H5Tequal(src, H5T_NATIVE_UCHAR)) {
- src_type_name = "unsigned char";
- src_type = INT_UCHAR;
+ src_type_name = "unsigned char";
+ src_type = INT_UCHAR;
} else if (H5Tequal(src, H5T_NATIVE_SHORT)) {
- src_type_name = "short";
- src_type = INT_SHORT;
+ src_type_name = "short";
+ src_type = INT_SHORT;
} else if (H5Tequal(src, H5T_NATIVE_USHORT)) {
- src_type_name = "unsigned short";
- src_type = INT_USHORT;
+ src_type_name = "unsigned short";
+ src_type = INT_USHORT;
} else if (H5Tequal(src, H5T_NATIVE_INT)) {
- src_type_name = "int";
- src_type = INT_INT;
+ src_type_name = "int";
+ src_type = INT_INT;
} else if (H5Tequal(src, H5T_NATIVE_UINT)) {
- src_type_name = "unsigned int";
- src_type = INT_UINT;
+ src_type_name = "unsigned int";
+ src_type = INT_UINT;
} else if (H5Tequal(src, H5T_NATIVE_LONG)) {
- src_type_name = "long";
- src_type = INT_LONG;
+ src_type_name = "long";
+ src_type = INT_LONG;
} else if (H5Tequal(src, H5T_NATIVE_ULONG)) {
- src_type_name = "unsigned long";
- src_type = INT_ULONG;
+ src_type_name = "unsigned long";
+ src_type = INT_ULONG;
} else if (H5Tequal(src, H5T_NATIVE_LLONG)) {
- src_type_name = "long long";
- src_type = INT_LLONG;
+ src_type_name = "long long";
+ src_type = INT_LLONG;
} else if (H5Tequal(src, H5T_NATIVE_ULLONG)) {
- src_type_name = "unsigned long long";
- src_type = INT_ULLONG;
+ src_type_name = "unsigned long long";
+ src_type = INT_ULLONG;
} else if (H5Tequal(src, H5T_NATIVE_FLOAT)) {
- src_type_name = "float";
- src_type = FLT_FLOAT;
+ src_type_name = "float";
+ src_type = FLT_FLOAT;
} else if (H5Tequal(src, H5T_NATIVE_DOUBLE)) {
- src_type_name = "double";
- src_type = FLT_DOUBLE;
+ src_type_name = "double";
+ src_type = FLT_DOUBLE;
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
} else if (H5Tequal(src, H5T_NATIVE_LDOUBLE)) {
- src_type_name = "long double";
- src_type = FLT_LDOUBLE;
+ src_type_name = "long double";
+ src_type = FLT_LDOUBLE;
#endif
} else {
- src_type_name = "UNKNOWN";
- src_type = OTHER;
+ src_type_name = "UNKNOWN";
+ src_type = OTHER;
}
/* What is the name of the destination type */
if (H5Tequal(dst, H5T_NATIVE_SCHAR)) {
- dst_type_name = "signed char";
- dst_type = INT_SCHAR;
+ dst_type_name = "signed char";
+ dst_type = INT_SCHAR;
} else if (H5Tequal(dst, H5T_NATIVE_UCHAR)) {
- dst_type_name = "unsigned char";
- dst_type = INT_UCHAR;
+ dst_type_name = "unsigned char";
+ dst_type = INT_UCHAR;
} else if (H5Tequal(dst, H5T_NATIVE_SHORT)) {
- dst_type_name = "short";
- dst_type = INT_SHORT;
+ dst_type_name = "short";
+ dst_type = INT_SHORT;
} else if (H5Tequal(dst, H5T_NATIVE_USHORT)) {
- dst_type_name = "unsigned short";
- dst_type = INT_USHORT;
+ dst_type_name = "unsigned short";
+ dst_type = INT_USHORT;
} else if (H5Tequal(dst, H5T_NATIVE_INT)) {
- dst_type_name = "int";
- dst_type = INT_INT;
+ dst_type_name = "int";
+ dst_type = INT_INT;
} else if (H5Tequal(dst, H5T_NATIVE_UINT)) {
- dst_type_name = "unsigned int";
- dst_type = INT_UINT;
+ dst_type_name = "unsigned int";
+ dst_type = INT_UINT;
} else if (H5Tequal(dst, H5T_NATIVE_LONG)) {
- dst_type_name = "long";
- dst_type = INT_LONG;
+ dst_type_name = "long";
+ dst_type = INT_LONG;
} else if (H5Tequal(dst, H5T_NATIVE_ULONG)) {
- dst_type_name = "unsigned long";
- dst_type = INT_ULONG;
+ dst_type_name = "unsigned long";
+ dst_type = INT_ULONG;
} else if (H5Tequal(dst, H5T_NATIVE_LLONG)) {
- dst_type_name = "long long";
- dst_type = INT_LLONG;
+ dst_type_name = "long long";
+ dst_type = INT_LLONG;
} else if (H5Tequal(dst, H5T_NATIVE_ULLONG)) {
- dst_type_name = "unsigned long long";
- dst_type = INT_ULLONG;
+ dst_type_name = "unsigned long long";
+ dst_type = INT_ULLONG;
} else if (H5Tequal(dst, H5T_NATIVE_FLOAT)) {
- dst_type_name = "float";
- dst_type = FLT_FLOAT;
+ dst_type_name = "float";
+ dst_type = FLT_FLOAT;
} else if (H5Tequal(dst, H5T_NATIVE_DOUBLE)) {
- dst_type_name = "double";
- dst_type = FLT_DOUBLE;
+ dst_type_name = "double";
+ dst_type = FLT_DOUBLE;
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
} else if (H5Tequal(dst, H5T_NATIVE_LDOUBLE)) {
- dst_type_name = "long double";
- dst_type = FLT_LDOUBLE;
+ dst_type_name = "long double";
+ dst_type = FLT_LDOUBLE;
#endif
} else {
- dst_type_name = "UNKNOWN";
- dst_type = OTHER;
+ dst_type_name = "UNKNOWN";
+ dst_type = OTHER;
}
/* Sanity checks */
if (OTHER==src_type || OTHER==dst_type) {
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, src_type_name, dst_type_name);
- printf("%-70s", str);
- H5_FAILED();
- HDputs(" Unknown data type.");
- goto error;
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
+ name, src_type_name, dst_type_name);
+ HDprintf("%-70s", str);
+ H5_FAILED();
+ HDputs(" Unknown data type.");
+ goto error;
}
if ((INT_SCHAR==src_type || INT_UCHAR==src_type || INT_SHORT==src_type ||
@@ -3560,12 +3560,12 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
&& FLT_LDOUBLE!=dst_type
#endif
)) {
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, src_type_name, dst_type_name);
- printf("%-70s", str);
- H5_FAILED();
- HDputs(" 1. Not an integer-float conversion.");
- goto error;
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
+ name, src_type_name, dst_type_name);
+ HDprintf("%-70s", str);
+ H5_FAILED();
+ HDputs(" 1. Not an integer-float conversion.");
+ goto error;
}
if ((FLT_FLOAT==src_type || FLT_DOUBLE==src_type
@@ -3577,12 +3577,12 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
&& INT_USHORT!=dst_type && INT_INT!=dst_type && INT_UINT!=dst_type
&& INT_LONG!=dst_type && INT_ULONG!=dst_type && INT_LLONG!=dst_type
&& INT_ULLONG!=dst_type)) {
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, src_type_name, dst_type_name);
- printf("%-70s", str);
- H5_FAILED();
- HDputs(" 2. Not a float-integer conversion.");
- goto error;
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
+ name, src_type_name, dst_type_name);
+ HDprintf("%-70s", str);
+ H5_FAILED();
+ HDputs(" 2. Not a float-integer conversion.");
+ goto error;
}
if (INT_SCHAR==src_type || INT_UCHAR==src_type || INT_SHORT==src_type ||
@@ -3591,7 +3591,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
INT_ULLONG==src_type) {
HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, src_type_name, dst_type_name);
- printf("%-70s", str);
+ HDprintf("%-70s", str);
HDfflush(stdout);
fails_this_test=0;
} else {
@@ -3604,7 +3604,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
else
HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions",
name, src_type_name, dst_type_name);
- printf("%-70s", str);
+ HDprintf("%-70s", str);
HDfflush(stdout);
fails_this_test=0;
}
@@ -4213,10 +4213,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
*/
#if H5_SIZEOF_LONG_DOUBLE !=0
if(dendian==H5T_ORDER_LE && dst_type==FLT_LDOUBLE) {
- unsigned int q;
- for(q=dst_nbits/8; q<dst_size; q++) {
- buf[j*dst_size+q] = 0x00;
- }
+ size_t q;
+
+ for(q = dst_nbits / 8; q < dst_size; q++)
+ buf[j * dst_size + q] = 0x00;
}
#endif
@@ -4341,46 +4341,44 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
H5_WARNING();
}
}
+ HDprintf(" elmt %u: \n", (unsigned)j);
- printing:
- printf(" elmt %u: \n", (unsigned)j);
-
- printf(" src = ");
+ HDprintf(" src = ");
for (k=0; k<src_size; k++)
- printf(" %02x", saved[j*src_size+ENDIAN(src_size, k, sendian)]);
- printf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), "");
+ HDprintf(" %02x", saved[j*src_size+ENDIAN(src_size, k, sendian)]);
+ HDprintf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), "");
switch (src_type) {
case INT_SCHAR:
HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
- printf(" %29d\n", (int)*((signed char*)aligned));
+ HDprintf(" %29d\n", (int)*((signed char*)aligned));
break;
case INT_UCHAR:
HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- printf(" %29u\n", (unsigned)*((unsigned char*)aligned));
+ HDprintf(" %29u\n", (unsigned)*((unsigned char*)aligned));
break;
case INT_SHORT:
HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- printf(" %29hd\n", *((short*)aligned));
+ HDprintf(" %29hd\n", *((short*)aligned));
break;
case INT_USHORT:
HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- printf(" %29hu\n", *((unsigned short*)aligned));
+ HDprintf(" %29hu\n", *((unsigned short*)aligned));
break;
case INT_INT:
HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- printf(" %29d\n", *((int*)aligned));
+ HDprintf(" %29d\n", *((int*)aligned));
break;
case INT_UINT:
HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- printf(" %29u\n", *((unsigned*)aligned));
+ HDprintf(" %29u\n", *((unsigned*)aligned));
break;
case INT_LONG:
HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- printf(" %29ld\n", *((long*)aligned));
+ HDprintf(" %29ld\n", *((long*)aligned));
break;
case INT_ULONG:
HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- printf(" %29lu\n", *((unsigned long*)aligned));
+ HDprintf(" %29lu\n", *((unsigned long*)aligned));
break;
case INT_LLONG:
HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
@@ -4392,16 +4390,16 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
break;
case FLT_FLOAT:
HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float));
- printf(" %29f\n", *((float*)aligned));
+ HDprintf(" %29f\n", (double)*((float*)aligned));
break;
case FLT_DOUBLE:
HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double));
- printf(" %29f\n", *((double*)aligned));
+ HDprintf(" %29f\n", *((double*)aligned));
break;
#if H5_SIZEOF_LONG_DOUBLE !=0
case FLT_LDOUBLE:
HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double));
- printf(" %29Lf\n", *((long double*)aligned));
+ HDprintf(" %29Lf\n", *((long double*)aligned));
break;
#endif
case OTHER:
@@ -4410,42 +4408,42 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
break;
}
- printf(" dst = ");
+ HDprintf(" dst = ");
for (k=0; k<dst_size; k++)
- printf(" %02x", buf[j*dst_size+ENDIAN(dst_size, k, dendian)]);
- printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
+ HDprintf(" %02x", buf[j*dst_size+ENDIAN(dst_size, k, dendian)]);
+ HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
switch (dst_type) {
case INT_SCHAR:
HDmemcpy(aligned, buf+j*sizeof(signed char), sizeof(signed char));
- printf(" %29d\n", (int)*((signed char*)aligned));
+ HDprintf(" %29d\n", (int)*((signed char*)aligned));
break;
case INT_UCHAR:
HDmemcpy(aligned, buf+j*sizeof(unsigned char), sizeof(unsigned char));
- printf(" %29u\n", (unsigned)*((unsigned char*)aligned));
+ HDprintf(" %29u\n", (unsigned)*((unsigned char*)aligned));
break;
case INT_SHORT:
HDmemcpy(aligned, buf+j*sizeof(short), sizeof(short));
- printf(" %29hd\n", *((short*)aligned));
+ HDprintf(" %29hd\n", *((short*)aligned));
break;
case INT_USHORT:
HDmemcpy(aligned, buf+j*sizeof(unsigned short), sizeof(unsigned short));
- printf(" %29hu\n", *((unsigned short*)aligned));
+ HDprintf(" %29hu\n", *((unsigned short*)aligned));
break;
case INT_INT:
HDmemcpy(aligned, buf+j*sizeof(int), sizeof(int));
- printf(" %29d\n", *((int*)aligned));
+ HDprintf(" %29d\n", *((int*)aligned));
break;
case INT_UINT:
HDmemcpy(aligned, buf+j*sizeof(unsigned), sizeof(unsigned));
- printf(" %29u\n", *((unsigned*)aligned));
+ HDprintf(" %29u\n", *((unsigned*)aligned));
break;
case INT_LONG:
HDmemcpy(aligned, buf+j*sizeof(long), sizeof(long));
- printf(" %29ld\n", *((long*)aligned));
+ HDprintf(" %29ld\n", *((long*)aligned));
break;
case INT_ULONG:
HDmemcpy(aligned, buf+j*sizeof(unsigned long), sizeof(unsigned long));
- printf(" %29lu\n", *((unsigned long*)aligned));
+ HDprintf(" %29lu\n", *((unsigned long*)aligned));
break;
case INT_LLONG:
HDmemcpy(aligned, buf+j*sizeof(long long), sizeof(long long));
@@ -4457,16 +4455,16 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
break;
case FLT_FLOAT:
HDmemcpy(aligned, buf+j*sizeof(float), sizeof(float));
- printf(" %29f\n", *((float*)aligned));
+ HDprintf(" %29f\n", (double)*((float*)aligned));
break;
case FLT_DOUBLE:
HDmemcpy(aligned, buf+j*sizeof(double), sizeof(double));
- printf(" %29f\n", *((double*)aligned));
+ HDprintf(" %29f\n", *((double*)aligned));
break;
#if H5_SIZEOF_LONG_DOUBLE !=0
case FLT_LDOUBLE:
HDmemcpy(aligned, buf+j*sizeof(long double), sizeof(long double));
- printf(" %29Lf\n", *((long double*)aligned));
+ HDprintf(" %29Lf\n", *((long double*)aligned));
break;
#endif
case OTHER:
@@ -4475,50 +4473,50 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
break;
}
- printf(" ans = ");
+ HDprintf(" ans = ");
for (k=0; k<dst_size; k++)
- printf(" %02x", hw[ENDIAN(dst_size, k, dendian)]);
- printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
+ HDprintf(" %02x", hw[ENDIAN(dst_size, k, dendian)]);
+ HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
switch (dst_type) {
case INT_SCHAR:
- printf(" %29d\n", (int)*((signed char*)hw));
+ HDprintf(" %29d\n", (int)*((signed char*)((void *)hw)));
break;
case INT_UCHAR:
- printf(" %29u\n", (unsigned)*((unsigned char*)hw));
+ HDprintf(" %29u\n", (unsigned)*((unsigned char*)((void *)hw)));
break;
case INT_SHORT:
- printf(" %29hd\n", *((short*)hw));
+ HDprintf(" %29hd\n", *((short*)((void *)hw)));
break;
case INT_USHORT:
- printf(" %29hu\n", *((unsigned short*)hw));
+ HDprintf(" %29hu\n", *((unsigned short*)((void *)hw)));
break;
case INT_INT:
- printf(" %29d\n", *((int*)hw));
+ HDprintf(" %29d\n", *((int*)((void *)hw)));
break;
case INT_UINT:
- printf(" %29u\n", *((unsigned int*)hw));
+ HDprintf(" %29u\n", *((unsigned int*)((void *)hw)));
break;
case INT_LONG:
- printf(" %29ld\n", *((long*)hw));
+ HDprintf(" %29ld\n", *((long*)((void *)hw)));
break;
case INT_ULONG:
- printf(" %29lu\n", *((unsigned long*)hw));
+ HDprintf(" %29lu\n", *((unsigned long*)((void *)hw)));
break;
case INT_LLONG:
- printf(" %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)hw));
+ HDfprintf(stdout, " %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)((void *)hw)));
break;
case INT_ULLONG:
- printf(" %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)hw));
+ HDfprintf(stdout, " %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)((void *)hw)));
break;
case FLT_FLOAT:
- printf(" %29f\n", *((float*)hw));
+ HDprintf(" %29f\n", (double)*((float*)((void *)hw)));
break;
case FLT_DOUBLE:
- printf(" %29f\n", *((double*)hw));
+ HDprintf(" %29f\n", *((double*)((void *)hw)));
break;
#if H5_SIZEOF_LONG_DOUBLE !=0
case FLT_LDOUBLE:
- printf(" %29Lf\n", *((long double*)hw));
+ HDprintf(" %29Lf\n", *((long double*)((void *)hw)));
break;
#endif
case OTHER:
@@ -4551,7 +4549,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
- reset_hdf5(); /*print statistics*/
+ reset_hdf5(); /*print statistics*/
/* If the source is normalized floating values, treat the failures as error;
* if it is denormalized or special floating values, treat the failure as warning.*/
@@ -4569,7 +4567,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
- reset_hdf5(); /*print statistics*/
+ reset_hdf5(); /*print statistics*/
if(run_test==TEST_NORMAL)
return MAX((int)fails_all_tests, 1);
@@ -4579,19 +4577,19 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
}
}
-
+
/*-------------------------------------------------------------------------
- * Function: overflows
+ * Function: overflows
*
- * Purpose: When convert from float or double to any integer type,
+ * Purpose: When convert from float or double to any integer type,
* check if overflow occurs.
*
*
- * Return: TRUE: overflow happens
+ * Return: TRUE: overflow happens
*
* FALSE: no overflow
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Monday, Nov 17, 2003
*
* Modifications:
@@ -4671,15 +4669,15 @@ done:
return ret_value;
}
-
+
/*-------------------------------------------------------------------------
- * Function: run_integer_tests
+ * Function: run_integer_tests
*
- * Purpose: Runs all integer tests.
+ * Purpose: Runs all integer tests.
*
- * Return: Number of errors
+ * Return: Number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, November 24, 1998
*
* Modifications:
@@ -4689,7 +4687,7 @@ done:
static int
run_integer_tests(const char *name)
{
- int nerrors = 0;
+ int nerrors = 0;
nerrors += test_conv_int_1(name, H5T_NATIVE_SCHAR, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_SCHAR, H5T_NATIVE_SHORT);
@@ -4834,15 +4832,15 @@ run_integer_tests(const char *name)
return nerrors;
}
-
+
/*-------------------------------------------------------------------------
- * Function: run_fp_tests
+ * Function: run_fp_tests
*
- * Purpose: Runs all floating-point tests.
+ * Purpose: Runs all floating-point tests.
*
- * Return: Number of errors
+ * Return: Number of errors
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Tuesday, March 22, 2005
*
* Modifications:
@@ -4852,7 +4850,7 @@ run_integer_tests(const char *name)
static int
run_fp_tests(const char *name)
{
- int nerrors = 0;
+ int nerrors = 0;
if(!strcmp(name, "noop")) {
nerrors += test_conv_flt_1("noop", TEST_NOOP, H5T_NATIVE_FLOAT, H5T_NATIVE_FLOAT);
@@ -4879,7 +4877,24 @@ run_fp_tests(const char *name)
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_FLOAT, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_DOUBLE, H5T_NATIVE_LDOUBLE);
+#ifndef H5_DISABLE_SOME_LDOUBLE_CONV
nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_LDOUBLE, H5T_NATIVE_FLOAT);
+#else
+ {
+ char str[256]; /*string */
+
+ HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions",
+ name, "long double", "float");
+ HDprintf("%-70s", str);
+ SKIPPED();
+#if H5_SIZEOF_LONG_DOUBLE!=0
+ HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu.");
+#else
+ HDputs(" Test skipped due to disabled long double.");
+#endif
+ }
+#endif
+
nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_LDOUBLE, H5T_NATIVE_DOUBLE);
#endif
@@ -4889,23 +4904,39 @@ run_fp_tests(const char *name)
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_FLOAT, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_DOUBLE, H5T_NATIVE_LDOUBLE);
+#ifndef H5_DISABLE_SOME_LDOUBLE_CONV
nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_FLOAT);
nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_DOUBLE);
+#else
+ {
+ char str[256]; /*string */
+
+ HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions",
+ name, "long double", "float or double");
+ HDprintf("%-70s", str);
+ SKIPPED();
+#if H5_SIZEOF_LONG_DOUBLE!=0
+ HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu.");
+#else
+ HDputs(" Test skipped due to disabled long double.");
+#endif
+ }
+#endif
#endif
done:
return nerrors;
}
-
+
/*-------------------------------------------------------------------------
- * Function: run_int_fp_conv
+ * Function: run_int_fp_conv
*
- * Purpose: Runs all integer-float tests.
+ * Purpose: Runs all integer-float tests.
*
- * Return: Number of errors
+ * Return: Number of errors
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Monday, November 10, 2003
*
* Modifications:
@@ -4915,7 +4946,7 @@ done:
static int
run_int_fp_conv(const char *name)
{
- int nerrors = 0;
+ int nerrors = 0;
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_SCHAR, H5T_NATIVE_FLOAT);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_SCHAR, H5T_NATIVE_DOUBLE);
@@ -4959,16 +4990,16 @@ run_int_fp_conv(const char *name)
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_INT, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_UINT, H5T_NATIVE_LDOUBLE);
#if H5_SIZEOF_LONG!=H5_SIZEOF_INT
-#ifndef H5_LONG_TO_LDOUBLE_SPECIAL
+#if !defined(H5_LONG_TO_LDOUBLE_SPECIAL) && !defined(H5_DISABLE_SOME_LDOUBLE_CONV)
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LONG, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULONG, H5T_NATIVE_LDOUBLE);
#else
{
- char str[256]; /*string */
+ char str[256]; /*string */
HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "(unsigned) long", "long double");
- printf("%-70s", str);
+ HDprintf("%-70s", str);
SKIPPED();
#if H5_SIZEOF_LONG_DOUBLE!=0
HDputs(" Test skipped due to the special algorithm of hardware conversion.");
@@ -4983,11 +5014,11 @@ run_int_fp_conv(const char *name)
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LLONG, H5T_NATIVE_LDOUBLE);
#else /* H5_LLONG_TO_LDOUBLE_CORRECT */
{
- char str[256]; /*hello string */
+ char str[256]; /*hello string */
HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "long long", "long double");
- printf("%-70s", str);
+ HDprintf("%-70s", str);
SKIPPED();
HDputs(" Test skipped due to compiler error in handling conversion.");
}
@@ -4996,11 +5027,11 @@ run_int_fp_conv(const char *name)
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULLONG, H5T_NATIVE_LDOUBLE);
#else /* H5_LLONG_TO_LDOUBLE_CORRECT */
{
- char str[256]; /*hello string */
+ char str[256]; /*hello string */
HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "unsigned long long", "long double");
- printf("%-70s", str);
+ HDprintf("%-70s", str);
SKIPPED();
HDputs(" Test skipped due to compiler not handling conversion.");
}
@@ -5011,15 +5042,15 @@ run_int_fp_conv(const char *name)
return nerrors;
}
-
+
/*-------------------------------------------------------------------------
- * Function: run_fp_int_conv
+ * Function: run_fp_int_conv
*
- * Purpose: Runs all float-integer tests.
+ * Purpose: Runs all float-integer tests.
*
- * Return: Number of errors
+ * Return: Number of errors
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Monday, November 10, 2003
*
* Modifications:
@@ -5029,7 +5060,7 @@ run_int_fp_conv(const char *name)
static int
run_fp_int_conv(const char *name)
{
- int nerrors = 0;
+ int nerrors = 0;
int test_values;
for(test_values = TEST_NORMAL; test_values <= TEST_SPECIAL; test_values++) {
@@ -5052,15 +5083,15 @@ run_fp_int_conv(const char *name)
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_UINT);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_UINT);
-#if H5_SIZEOF_LONG != H5_SIZEOF_INT
+#if H5_SIZEOF_LONG!=H5_SIZEOF_INT
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_LONG);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_LONG);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_ULONG);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_ULONG);
-#endif /* H5_SIZEOF_LONG != H5_SIZEOF_INT */
+#endif
-#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
+#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG
if(!strcmp(name, "hw")) { /* Hardware conversion */
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_LLONG);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_LLONG);
@@ -5070,81 +5101,109 @@ run_fp_int_conv(const char *name)
}
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_ULLONG);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_ULLONG);
-#endif /* H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG */
+#endif
-#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
+#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+ if(test_values != TEST_SPECIAL) {
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT);
+ } else {
+#ifndef H5_DISABLE_SOME_LDOUBLE_CONV
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR);
- nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR);
- nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT);
- nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT);
- nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT);
- nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT);
-#if H5_SIZEOF_LONG != H5_SIZEOF_INT && H5_SIZEOF_LONG_DOUBLE != 0
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT);
+#else
+ char str[256]; /*string */
+
+ HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions",
+ name, "long double", "signed and unsigned char, short, int, long");
+ HDprintf("%-70s", str);
+ SKIPPED();
+#if H5_SIZEOF_LONG_DOUBLE!=0
+ HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu.");
+#else
+ HDputs(" Test skipped due to disabled long double.");
+#endif
+#endif
+ }
+#if H5_SIZEOF_LONG!=H5_SIZEOF_INT && H5_SIZEOF_LONG_DOUBLE!=0
#ifndef H5_LDOUBLE_TO_LONG_SPECIAL
- nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG);
- nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG);
-#else /* H5_LDOUBLE_TO_LONG_SPECIAL */
+ if(test_values != TEST_SPECIAL && test_values != TEST_NORMAL) {
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG);
+ } else {
+#ifndef H5_DISABLE_SOME_LDOUBLE_CONV
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG);
+#endif
+ }
+#else
{
- char str[256]; /*string */
+ char str[256]; /*string */
HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "long double", "(unsigned) long");
- printf("%-70s", str);
+ HDprintf("%-70s", str);
SKIPPED();
-#if H5_SIZEOF_LONG_DOUBLE != 0
+#if H5_SIZEOF_LONG_DOUBLE!=0
HDputs(" Test skipped due to the special algorithm of hardware conversion.");
-#else /* H5_SIZEOF_LONG_DOUBLE */
+#else
HDputs(" Test skipped due to disabled long double.");
-#endif /* H5_SIZEOF_LONG_DOUBLE */
+#endif
}
-#endif /* H5_LDOUBLE_TO_LONG_SPECIAL */
-
-#endif /*H5_SIZEOF_LONG != H5_SIZEOF_INT && H5_SIZEOF_LONG_DOUBLE != 0 */
+#endif
+#endif /*H5_SIZEOF_LONG!=H5_SIZEOF_INT && H5_SIZEOF_LONG_DOUBLE!=0 */
-#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG && H5_SIZEOF_LONG_DOUBLE != 0
+#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG && H5_SIZEOF_LONG_DOUBLE!=0
#ifdef H5_LDOUBLE_TO_LLONG_ACCURATE
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LLONG);
#else /*H5_LDOUBLE_TO_LLONG_ACCURATE*/
{
- char str[256]; /*string */
+ char str[256]; /*string */
HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "long double", "long long");
- printf("%-70s", str);
+ HDprintf("%-70s", str);
SKIPPED();
-#if H5_SIZEOF_LONG_DOUBLE != 0
+#if H5_SIZEOF_LONG_DOUBLE!=0
HDputs(" Test skipped due to hardware conversion error.");
-#else /* H5_SIZEOF_LONG_DOUBLE != 0 */
+#else
HDputs(" Test skipped due to disabled long double.");
-#endif /* H5_SIZEOF_LONG_DOUBLE != 0 */
+#endif
}
#endif /*H5_LDOUBLE_TO_LLONG_ACCURATE*/
#if defined(H5_LDOUBLE_TO_LLONG_ACCURATE)
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULLONG);
#else /*H5_LDOUBLE_TO_LLONG_ACCURATE*/
{
- char str[256]; /*string */
+ char str[256]; /*string */
HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "long double", "unsigned long long");
- printf("%-70s", str);
+ HDprintf("%-70s", str);
SKIPPED();
-#if H5_SIZEOF_LONG_DOUBLE != 0
+#if H5_SIZEOF_LONG_DOUBLE!=0
HDputs(" Test skipped due to hardware conversion error.");
-#else /* H5_SIZEOF_LONG_DOUBLE != 0 */
+#else
HDputs(" Test skipped due to disabled long double.");
-#endif /* H5_SIZEOF_LONG_DOUBLE !=0 */
+#endif
}
#endif /*H5_LDOUBLE_TO_LLONG_ACCURATE*/
-
-#endif /* H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG && H5_SIZEOF_LONG_DOUBLE != 0 */
-#endif /* H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE */
+#endif
+#endif
} /* end for */
return nerrors;
-} /* end run_fp_int_conv() */
+}
+
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -5168,7 +5227,7 @@ run_fp_int_conv(const char *name)
int
main(void)
{
- unsigned long nerrors = 0;
+ unsigned long nerrors = 0;
/* Set the random # seed */
HDsrandom((unsigned)HDtime(NULL));
@@ -5176,41 +5235,41 @@ main(void)
reset_hdf5();
if (ALIGNMENT)
- printf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT);
+ HDprintf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT);
/* Do the tests */
/* Test H5Tcompiler_conv() for querying hard conversion. */
- nerrors += test_hard_query();
+ nerrors += (unsigned long)test_hard_query();
/* Test user-define, query functions and software conversion
* for user-defined floating-point types */
- nerrors += test_derived_flt();
+ nerrors += (unsigned long)test_derived_flt();
/* Test user-define, query functions and software conversion
* for user-defined integer types */
- nerrors += test_derived_integer();
+ nerrors += (unsigned long)test_derived_integer();
/* Does floating point overflow generate a SIGFPE? */
generates_sigfpe();
/* Test degenerate cases */
- nerrors += run_fp_tests("noop");
+ nerrors += (unsigned long)run_fp_tests("noop");
/* Test hardware floating-point conversion functions */
- nerrors += run_fp_tests("hard");
+ nerrors += (unsigned long)run_fp_tests("hard");
/* Test hardware integer conversion functions */
- nerrors += run_integer_tests("hard");
+ nerrors += (unsigned long)run_integer_tests("hard");
/* Test hardware integer-float conversion functions */
- nerrors += run_int_fp_conv("hard");
+ nerrors += (unsigned long)run_int_fp_conv("hard");
/* Test hardware float-integer conversion functions */
- nerrors += run_fp_int_conv("hard");
+ nerrors += (unsigned long)run_fp_int_conv("hard");
/* Test a few special values for hardware float-integer conversions */
- nerrors += test_particular_fp_integer();
+ nerrors += (unsigned long)test_particular_fp_integer();
/*----------------------------------------------------------------------
* Software tests
@@ -5224,17 +5283,17 @@ main(void)
reset_hdf5();
/* Test software floating-point conversion functions */
- nerrors += run_fp_tests("soft");
+ nerrors += (unsigned long)run_fp_tests("soft");
/* Test software integer conversion functions */
- nerrors += test_conv_int_2();
- nerrors += run_integer_tests("soft");
+ nerrors += (unsigned long)test_conv_int_2();
+ nerrors += (unsigned long)run_integer_tests("soft");
/* Test software float-integer conversion functions */
- nerrors += run_fp_int_conv("soft");
+ nerrors += (unsigned long)run_fp_int_conv("soft");
/* Test software integer-float conversion functions */
- nerrors += run_int_fp_conv("soft");
+ nerrors += (unsigned long)run_int_fp_conv("soft");
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
@@ -5245,11 +5304,11 @@ main(void)
h5_restore_err();
if (nerrors) {
- printf("***** %lu FAILURE%s! *****\n",
+ HDprintf("***** %lu FAILURE%s! *****\n",
nerrors, 1==nerrors?"":"S");
- HDexit(1);
+ HDexit(EXIT_FAILURE);
}
- printf("All data type tests passed.\n");
+ HDprintf("All data type tests passed.\n");
return 0;
}
diff --git a/test/dtransform.c b/test/dtransform.c
index b2dcd6f..f022699 100644
--- a/test/dtransform.c
+++ b/test/dtransform.c
@@ -465,7 +465,7 @@ test_poly(const hid_t dxpl_id_polynomial)
for(row = 0; row < ROWS; row++)
for(col = 0; col < COLS; col++) {
windchillC = (int) ((5.0f / 9.0f) * (windchillFfloat[row][col] - 32));
- polyflres[row][col] = (float) ((2.0f + windchillC) * ((windchillC - 8.0f) / 2.0f));
+ polyflres[row][col] = ((2.0f + (float)windchillC) * (((float)windchillC - 8.0f) / 2.0f));
}
TESTING("data transform, polynomial transform (int->float)")
@@ -744,7 +744,7 @@ test_getset(const hid_t dxpl_id_c_to_f)
HDfree(ptrgetTest);
ptrgetTest = NULL;
- TESTING("data transform, read after reseting of transform property")
+ TESTING("data transform, read after resetting of transform property")
if(H5Pset_data_transform(dxpl_id_c_to_f, simple) < 0)
TEST_ERROR
diff --git a/test/enum.c b/test/enum.c
index 4e20713..588e9b3 100644
--- a/test/enum.c
+++ b/test/enum.c
@@ -374,7 +374,7 @@ test_tr2(hid_t file)
E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED};
c_e1 data2[10];
- TESTING("O(log N) converions");
+ TESTING("O(log N) conversions");
if((cwg = H5Gcreate2(file, "test_tr2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
diff --git a/test/err_compat.c b/test/err_compat.c
index eee150b..4860a3c 100644
--- a/test/err_compat.c
+++ b/test/err_compat.c
@@ -469,7 +469,7 @@ main(void)
char filename[1024];
const char *FUNC_main="main";
- fprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There're supposed to be some error messages\n");
+ fprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There are supposed to be some error messages\n");
fapl = h5_fileaccess();
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
diff --git a/test/error_test.c b/test/error_test.c
index a952449..580234a 100644
--- a/test/error_test.c
+++ b/test/error_test.c
@@ -12,10 +12,10 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* October 14, 2001
*
- * Purpose: Tests the error API routines.
+ * Purpose: Tests the error API routines.
*/
#include "h5test.h"
#include "H5srcdir.h"
@@ -23,7 +23,7 @@
#ifdef H5_USE_16_API
int main(void)
{
- HDfprintf(stderr, "Test skipped because backward compatbility with v1.6 is configured in\n");
+ HDfprintf(stderr, "Test skipped because backward compatibility with v1.6 is configured in\n");
return 0;
}
#else /* H5_USE_16_API */
@@ -38,7 +38,7 @@ const char *FILENAME[] = {
#define DIM0 100
#define DIM1 200
-int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1];
+int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1];
hid_t ERR_CLS;
hid_t ERR_CLS2;
@@ -80,37 +80,35 @@ hid_t ERR_MIN_GETNUM;
static herr_t custom_print_cb(unsigned n, const H5E_error2_t *err_desc,
void *client_data);
-
+
/*-------------------------------------------------------------------------
- * Function: test_error
- *
- * Purpose: Test error API functions
+ * Function: test_error
*
- * Return: Success: 0
+ * Purpose: Test error API functions
*
- * 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;
- hsize_t dims[2];
+ 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;
@@ -170,18 +169,14 @@ test_error(hid_t file)
return -1;
} /* end test_error() */
-
+
/*-------------------------------------------------------------------------
- * Function: init_error
- *
- * Purpose: Initialize error information.
+ * Function: init_error
*
- * Return: Success: 0
+ * Purpose: Initialize error information.
*
- * 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,52 +237,48 @@ init_error(void)
return 0;
error:
- if(cls_name)
+ if (cls_name)
HDfree(cls_name);
- if(msg)
+ if (msg)
HDfree(msg);
return -1;
} /* end init_error() */
-
+
/*-------------------------------------------------------------------------
- * Function: error_stack
- *
- * Purpose: Manipulates current error stack.
- *
- * Return: Success: 0
+ * Function: error_stack
*
- * Failure: -1
+ * Purpose: Manipulates current error stack.
*
- * Programmer: Raymond Lu
- * July 14, 2003
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
static herr_t
error_stack(void)
{
- int err_num;
+ 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", err_num);
+ "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;
@@ -296,18 +287,14 @@ error:
return -1;
} /* end error_stack() */
-
+
/*-------------------------------------------------------------------------
* 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
- *
- * Purpose: Test long error description handling
+ * Function: test_long_desc
*
- * Return: Success: 0
+ * Purpose: Test long error description handling
*
- * 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++)
- long_desc[u] = 'A' + (u % 26);
+ 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;
@@ -419,43 +405,39 @@ error:
return -1;
} /* end dump_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",
- indent, "", n, err_desc->file_name,
- err_desc->func_name, err_desc->line);
+ indent, "", n, err_desc->file_name,
+ err_desc->func_name, err_desc->line);
HDfprintf(stream, "%*sclass: %s\n", indent * 2, "", cls);
HDfprintf(stream, "%*smajor: %s\n", indent * 2, "", maj);
HDfprintf(stream, "%*sminor: %s\n", indent * 2, "", min);
@@ -466,56 +448,60 @@ error:
return -1;
} /* end custom_print_cb() */
-
+
/*-------------------------------------------------------------------------
- * Function: test_create
+ * Function: test_create
*
- * Purpose: Test creating an empty error stack
+ * Purpose: Test creating an empty error stack
*
- * Return: Success: 0
- * Failure: -1
- *
- * 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 */
- int 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 */
- int 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.*/
+ /* Try to close error stack copy. Should fail because
+ * 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
- *
- * Purpose: Closes error information.
- *
- * Return: Success: 0
+ * Function: close_error
*
- * Failure: -1
+ * Purpose: Closes error information.
*
- * 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;
@@ -618,21 +606,17 @@ error:
return -1;
} /* end close_error() */
-
+
/*-------------------------------------------------------------------------
- * Function: test_filter_error
+ * Function: test_filter_error
*
- * 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.
+ * 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
- *
- * Purpose: Test error API.
+ * Function: main
*
- * 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
+ /* 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/extend.c b/test/extend.c
index a52e598..e5c3cb3 100644
--- a/test/extend.c
+++ b/test/extend.c
@@ -290,7 +290,7 @@ main (void)
if(nerrors) {
printf("***** %d FAILURE%s! *****\n", nerrors, (1 == nerrors) ? "" : "S");
- exit(1);
+ exit(EXIT_FAILURE);
} /* end if */
printf("All extend tests passed.\n");
diff --git a/test/file_image.c b/test/file_image.c
index a6ec984..2018973 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -547,7 +547,7 @@ test_core(void)
VERIFY(fapl >= 0, "fapl creation failed");
/* Set up the core VFD */
- ret = H5Pset_fapl_core(fapl, 0, 0);
+ ret = H5Pset_fapl_core(fapl, (size_t)0, 0);
VERIFY(ret >= 0, "setting core driver in fapl failed");
tmp = h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
@@ -629,7 +629,8 @@ test_core(void)
VERIFY(ret == 0, "fstat failed");
size = (size_t)sb.st_size;
file_image = (unsigned char *)HDmalloc(size);
- HDread(fd, file_image, size);
+ if(HDread(fd, file_image, size) < 0)
+ FAIL_PUTS_ERROR("unable to read from file descriptor");
ret = HDclose(fd);
VERIFY(ret == 0, "close failed");
@@ -928,7 +929,6 @@ test_get_file_image_error_rejection(void)
void * image_ptr = NULL;
int data[100];
int i;
- int result;
hid_t fapl_id = -1;
hid_t file_id = -1;
hid_t dset_id = -1;
@@ -1281,7 +1281,7 @@ main(void)
h5_reset();
- printf("Testing File Image Functionality.\n");
+ HDprintf("Testing File Image Functionality.\n");
errors += test_properties();
errors += test_callbacks();
@@ -1337,12 +1337,12 @@ main(void)
h5_restore_err();
if(errors) {
- printf("***** %d File Image TEST%s FAILED! *****\n",
+ HDprintf("***** %d File Image TEST%s FAILED! *****\n",
errors, errors > 1 ? "S" : "");
return 1;
}
- printf("All File Image tests passed.\n");
+ HDprintf("All File Image tests passed.\n");
return 0;
}
diff --git a/test/fillval.c b/test/fillval.c
index 525dc0e..5b95de9 100644
--- a/test/fillval.c
+++ b/test/fillval.c
@@ -621,11 +621,11 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout)
if((dset9 = H5Dopen2(file, "dset9", H5P_DEFAULT)) < 0) goto error;
if((dcpl = H5Dget_create_plist(dset9)) < 0) goto error;
if(H5Pget_fill_value(dcpl, comp_type_id, &rd_c) < 0) goto error;
- if( rd_c.a!=0 || rd_c.y != fill_ctype.y || rd_c.x != 0 || rd_c.z != '\0') {
+ if(!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 || rd_c.z != '\0') {
H5_FAILED();
puts(" Got wrong fill value");
printf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n",
- rd_c.a, rd_c.y, rd_c.x, rd_c.z);
+ (double)rd_c.a, rd_c.y, rd_c.x, rd_c.z);
}
if(H5Dclose(dset9) < 0) goto error;
if(H5Pclose(dcpl) < 0) goto error;
@@ -694,11 +694,11 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout)
if((dset8 = H5Dopen2(file, "dset8", H5P_DEFAULT)) < 0) goto error;
if((dcpl = H5Dget_create_plist(dset8)) < 0) goto error;
if(H5Pget_fill_value(dcpl, comp_type_id, &rd_c) < 0) goto error;
- if(rd_c.a != 0 || rd_c.y != fill_ctype.y || rd_c.x != 0 || rd_c.z!='\0') {
+ if(!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 || rd_c.z != '\0') {
H5_FAILED();
puts(" Got wrong fill value");
printf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n",
- rd_c.a, rd_c.y, rd_c.x, rd_c.z);
+ (double)rd_c.a, rd_c.y, rd_c.x, rd_c.z);
}
if(H5Dclose(dset8) < 0) goto error;
if(H5Pclose(dcpl) < 0) goto error;
@@ -762,15 +762,17 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
comp_datatype *buf_c=NULL;
H5D_space_status_t allocation;
- if(datatype==H5T_INTEGER)
+ if(datatype == H5T_INTEGER) {
fillval = *(int*)_fillval;
- else if(datatype==H5T_COMPOUND) {
- fill_c.a=((comp_datatype*)_fillval)->a;
+ }
+ else if(datatype == H5T_COMPOUND) {
+ fill_c.a=((comp_datatype*)_fillval)->a;
fill_c.x=((comp_datatype*)_fillval)->x;
fill_c.y=((comp_datatype*)_fillval)->y;
fill_c.z=((comp_datatype*)_fillval)->z;
- } else {
- puts("Invalid type for test");
+ }
+ else {
+ HDputs("Invalid type for test");
goto error;
}
@@ -787,7 +789,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
goto error;
for (i=0; i<1000; i++) {
for (j=0; j<5; j++)
- hs_offset[j] = rand() % cur_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % cur_size[j];
if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL,
one, NULL) < 0) goto error;
@@ -806,20 +808,21 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
goto error;
}
/* case for compound datatype */
- } else if(datatype==H5T_COMPOUND) {
+ }
+ else if(datatype==H5T_COMPOUND) {
if(H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT,
&rd_c) < 0) goto error;
- if(fill_time!=H5D_FILL_TIME_NEVER && (rd_c.a!=fill_c.a ||
- rd_c.x!=fill_c.x || rd_c.y!=fill_c.y ||
- rd_c.z!=fill_c.z)) {
+ if(fill_time != H5D_FILL_TIME_NEVER && (!H5_FLT_ABS_EQUAL(rd_c.a, fill_c.a) ||
+ rd_c.x != fill_c.x || !H5_DBL_ABS_EQUAL(rd_c.y, fill_c.y) ||
+ rd_c.z != fill_c.z)) {
H5_FAILED();
HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__);
HDfprintf(stdout," Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %f, %d, %f, %c"
"Fill value: %f, %d, %f, %c\n",
hs_offset[0], hs_offset[1],
hs_offset[2], hs_offset[3],
- hs_offset[4], rd_c.a, rd_c.x, rd_c.y, rd_c.z,
- fill_c.a, fill_c.x, fill_c.y, fill_c.z);
+ hs_offset[4], (double)rd_c.a, rd_c.x, rd_c.y, rd_c.z,
+ (double)fill_c.a, fill_c.x, fill_c.y, fill_c.z);
goto error;
}
}
@@ -828,10 +831,10 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
/* Select all odd data locations in the file dataset */
for (i=0, nelmts=1; i<5; i++) {
- hs_size[i] = cur_size[i]/2;
- hs_offset[i] = 0;
- hs_stride[i] = 2;
- nelmts *= hs_size[i];
+ hs_size[i] = cur_size[i]/2;
+ hs_offset[i] = 0;
+ hs_stride[i] = 2;
+ nelmts *= hs_size[i];
}
if((mspace=H5Screate_simple(5, hs_size, hs_size)) < 0) goto error;
if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride,
@@ -843,7 +846,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
if(datatype==H5T_INTEGER) {
/*check for overflow*/
HDassert((nelmts * sizeof(int)) == (hsize_t)((size_t)(nelmts * sizeof(int))));
- buf = HDmalloc((size_t)(nelmts * sizeof(int)));
+ buf = (int *)HDmalloc((size_t)(nelmts * sizeof(int)));
if(H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, buf) < 0)
goto error;
@@ -877,8 +880,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
/* Verify values, except if no fill value written */
if(fill_time != H5D_FILL_TIME_NEVER) {
for(u = 0; u < nelmts; u++) {
- if(buf_c[u].a != fill_c.a || buf_c[u].x != fill_c.x ||
- buf_c[u].y != fill_c.y || buf_c[u].z != fill_c.z) {
+ if(!H5_FLT_ABS_EQUAL(buf_c[u].a, fill_c.a) || buf_c[u].x != fill_c.x ||
+ !H5_DBL_ABS_EQUAL(buf_c[u].y, fill_c.y) || buf_c[u].z != fill_c.z) {
H5_FAILED();
HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__);
HDfprintf(stdout," Elmt={%Hu, %Hu, %Hu, %Hu, %Hu}, read: %f, %d, %f, %c"
@@ -886,8 +889,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
hs_offset[0], hs_offset[1],
hs_offset[2], hs_offset[3],
hs_offset[4],
- buf_c[u].a, buf_c[u].x, buf_c[u].y, buf_c[u].z,
- fill_c.a, fill_c.x, fill_c.y, fill_c.z);
+ (double)buf_c[u].a, buf_c[u].x, buf_c[u].y, buf_c[u].z,
+ (double)fill_c.a, fill_c.x, fill_c.y, fill_c.z);
goto error;
} /* end if */
} /* end for */
@@ -936,7 +939,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
goto error;
for(i = 0; i < 1000; i++) {
for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = rand() % cur_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % cur_size[j];
odd += (int)(hs_offset[j]%2);
} /* end for */
if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
@@ -991,8 +994,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
should_be_c.y=buf_c[0].y;
should_be_c.z=buf_c[0].z;
}
- if( rd_c.a!=should_be_c.a || rd_c.x!=should_be_c.x ||
- rd_c.y!=should_be_c.y || rd_c.z!=should_be_c.z) {
+ if(!H5_FLT_ABS_EQUAL(rd_c.a, should_be_c.a) || rd_c.x != should_be_c.x ||
+ !H5_DBL_ABS_EQUAL(rd_c.y, should_be_c.y) || rd_c.z != should_be_c.z) {
H5_FAILED();
HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__);
printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f,%d,%f,%c "
@@ -1000,7 +1003,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
(long)hs_offset[0], (long)hs_offset[1],
(long)hs_offset[2], (long)hs_offset[3],
(long)hs_offset[4],
- rd_c.a, rd_c.x, rd_c.y, rd_c.z, should_be_c.a,
+ (double)rd_c.a, rd_c.x, rd_c.y, rd_c.z, (double)should_be_c.a,
should_be_c.x,should_be_c.y,should_be_c.z);
goto error;
}
@@ -1010,8 +1013,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
should_be_c.x=buf_c[0].x;
should_be_c.y=buf_c[0].y;
should_be_c.z=buf_c[0].z;
- if( rd_c.a!=should_be_c.a || rd_c.x!=should_be_c.x ||
- rd_c.y!=should_be_c.y || rd_c.z!=should_be_c.z) {
+ if(!H5_FLT_ABS_EQUAL(rd_c.a, should_be_c.a) || rd_c.x != should_be_c.x ||
+ !H5_DBL_ABS_EQUAL(rd_c.y, should_be_c.y) || rd_c.z != should_be_c.z) {
H5_FAILED();
HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__);
printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f,%d,%f,%c "
@@ -1019,7 +1022,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
(long)hs_offset[0], (long)hs_offset[1],
(long)hs_offset[2], (long)hs_offset[3],
(long)hs_offset[4],
- rd_c.a, rd_c.x, rd_c.y, rd_c.z, should_be_c.a,
+ (double)rd_c.a, rd_c.x, rd_c.y, rd_c.z, (double)should_be_c.a,
should_be_c.x,should_be_c.y,should_be_c.z);
goto error;
}
@@ -1089,17 +1092,23 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout)
}
h5_fixname(base_name, fapl, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5D_CHUNKED==layout) {
- if(H5Pset_chunk(dcpl, 5, ch_size) < 0) goto error;
- } else if(H5D_COMPACT==layout) {
- if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) goto error;
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+
+ if(H5D_CHUNKED == layout) {
+ if(H5Pset_chunk(dcpl, 5, ch_size) < 0)
+ goto error;
+ }
+ else if(H5D_COMPACT == layout) {
+ if(H5Pset_layout(dcpl, H5D_COMPACT) < 0)
+ goto error;
}
- if((ctype_id=create_compound_type()) < 0) goto error;
+ if((ctype_id = create_compound_type()) < 0)
+ goto error;
/* I. Test H5D_ALLOC_TIME_LATE space allocation cases */
if(H5D_COMPACT != layout) {
@@ -1436,9 +1445,11 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
int (*verify_rtn)(unsigned, const hsize_t *, const void *, const void *);
int (*release_rtn)(void *);
size_t val_size; /* Size of element */
- void *val_rd, *should_be, *init_val, *odd_val, *even_val;
+ void *val_rd, *odd_val;
+ const void *init_val, *should_be, *even_val;
int val_rd_i, init_val_i = 9999;
- comp_vl_datatype val_rd_c, init_val_c = {87, "baz", "mumble", 129};
+ comp_vl_datatype init_val_c = {87, "baz", "mumble", 129};
+ comp_vl_datatype val_rd_c;
void *buf = NULL;
unsigned odd; /* Whether an odd or even coord. was read */
unsigned i, j; /* Local index variables */
@@ -1493,7 +1504,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
for(i = 0; i < 1000; i++) {
/* Set offset for random element */
for(j = 0; j < 5; j++)
- hs_offset[j] = rand() % start_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % start_size[j];
/* Select the random element */
if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR
@@ -1546,7 +1557,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
for(i = 0; i < 1000; i++) {
/* Set offset for random element */
for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = rand() % start_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % start_size[j];
odd += (unsigned)(hs_offset[j] % 2);
} /* end for */
@@ -1584,7 +1595,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
for(i = 0; i < 1000; i++) {
/* Set offset for random element */
for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = rand() % extend_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % extend_size[j];
if(hs_offset[j] >= start_size[j])
odd = 1;
else
@@ -1623,7 +1634,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
for(i = 0; i < 1000; i++) {
/* Set offset for random element */
for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = rand() % max_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % max_size[j];
if(hs_offset[j] >= start_size[j])
odd = 1;
else
@@ -1664,7 +1675,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
for(i = 0; i < 1000; i++) {
/* Set offset for random element */
for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = rand() % extend_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % extend_size[j];
if(hs_offset[j] >= start_size[j])
odd = 1;
else
@@ -1757,7 +1768,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
for(i = 0; i < 1000; i++) {
/* Set offset for random element */
for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = rand() % extend_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % extend_size[j];
if(hs_offset[j] >= start_size[j])
odd = 1;
else
@@ -1888,7 +1899,7 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout)
hsize_t nelmts;
nelmts = max_size[0]*max_size[1]*max_size[2]*max_size[3]*max_size[4];
- if((fd=HDopen(FILE_NAME_RAW, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0 ||
+ if((fd = HDopen(FILE_NAME_RAW, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0 ||
HDclose(fd) < 0) goto error;
if(H5Pset_external(dcpl, FILE_NAME_RAW, (off_t)0, (hsize_t)nelmts*sizeof(int)) < 0)
goto error;
@@ -1976,19 +1987,10 @@ test_compatible(void)
hsize_t dims[2], one[2]={1,1};
hsize_t hs_offset[2]={3,4};
H5D_fill_value_t status;
- char *srcdir = getenv("srcdir"); /*where the src code is located*/
- char testfile[512]=""; /* test file name */
+ const char *testfile = H5_get_srcdir_filename(FILE_COMPATIBLE); /* Corrected test file name */
TESTING("contiguous dataset compatibility with v. 1.4");
- /* Generate correct name for test file by prepending the source path */
- if(srcdir && ((strlen(srcdir) + strlen(FILE_COMPATIBLE) + 1) <
- sizeof(testfile))) {
- HDstrcpy(testfile, srcdir);
- HDstrcat(testfile, "/");
- }
- HDstrcat(testfile, FILE_COMPATIBLE);
-
if((file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
printf(" Could not open file %s. Try set $srcdir to point at the "
"source directory of test\n", testfile);
@@ -2366,8 +2368,6 @@ test_partalloc(hid_t fapl, const char *base_name)
* Programmer: Robb Matzke
* Thursday, October 1, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -2375,7 +2375,7 @@ main(int argc, char *argv[])
{
int nerrors=0, argno, test_contig=1, test_chunk=1, test_compact=1;
hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */
- hbool_t new_format; /* Whether to use the new format or not */
+ unsigned new_format; /* Whether to use the new format or not */
if(argc >= 2) {
test_contig = test_chunk = test_compact = 0;
@@ -2387,8 +2387,8 @@ main(int argc, char *argv[])
else if(!strcmp(argv[argno], "compact"))
test_compact =1;
else {
- fprintf(stderr, "usage: %s [contiguous] [chunked] [compact]\n", argv[0]);
- exit(1);
+ HDfprintf(stderr, "usage: %s [contiguous] [chunked] [compact]\n", argv[0]);
+ HDexit(EXIT_FAILURE);
}
} /* end for */
} /* end if */
@@ -2451,15 +2451,15 @@ main(int argc, char *argv[])
if(nerrors)
goto error;
- puts("All fill value tests passed.");
+ HDputs("All fill value tests passed.");
if(h5_cleanup(FILENAME, fapl))
HDremove(FILE_NAME_RAW);
- return 0;
+ HDexit(EXIT_SUCCESS);
error:
- puts("***** FILL VALUE TESTS FAILED *****");
- return 1;
+ HDputs("***** FILL VALUE TESTS FAILED *****");
+ HDexit(EXIT_FAILURE);
}
diff --git a/test/filter_fail.c b/test/filter_fail.c
index ef8ba1c..d47705f 100644
--- a/test/filter_fail.c
+++ b/test/filter_fail.c
@@ -348,8 +348,8 @@ error:
* Purpose: Tests the library's behavior when a mandate filter returns
* failure.
*
- * Return: Success: exit(0)
- * Failure: exit(1)
+ * Return: Success: exit(EXIT_SUCCESS)
+ * Failure: exit(EXIT_FAILURE)
*
* Programmer: Raymond Lu
* 25 August 2010
@@ -405,6 +405,6 @@ error:
if (nerrors) {
printf("***** %u FAILURE%s! *****\n",
nerrors, 1==nerrors?"":"S");
- HDexit(1);
+ HDexit(EXIT_FAILURE);
}
}
diff --git a/test/flush1.c b/test/flush1.c
index f31384e..d910d14 100644
--- a/test/flush1.c
+++ b/test/flush1.c
@@ -18,7 +18,7 @@
* Purpose: This is the first half of a two-part test that makes sure
* that a file can be read after an application crashes as long
* as the file was flushed first. We simulate a crash by
- * calling _exit(0) since this doesn't flush HDF5 caches but
+ * calling _exit(EXIT_SUCCESS) since this doesn't flush HDF5 caches but
* still exits with success.
*/
#include "h5test.h"
@@ -33,19 +33,16 @@ const char *FILENAME[] = {
static double the_data[100][100];
/*-------------------------------------------------------------------------
- * Function: create_file
+ * Function: create_file
*
- * Purpose: Creates files used in part 1 of the test
+ * Purpose: Creates files and datasets used in part 1 of the test
*
- * Return: Success: 0
- *
- * Failure: 1
+ * Return: Success: a valid file ID
+ * Failure: -1
*
* Programmer: Leon Arber
* Sept. 26, 2006
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static hid_t
diff --git a/test/flush2.c b/test/flush2.c
index 2f07120..e80674c 100644
--- a/test/flush2.c
+++ b/test/flush2.c
@@ -147,10 +147,6 @@ error:
* Programmer: Robb Matzke
* Friday, October 23, 1998
*
- * Modifications:
- * Leon Arber
- * Sept. 26, 2006, expand to check for case where the was file not flushed.
- *
*-------------------------------------------------------------------------
*/
int
diff --git a/test/freespace.c b/test/freespace.c
index 3d33669..3e2d372 100644
--- a/test/freespace.c
+++ b/test/freespace.c
@@ -212,7 +212,7 @@ TEST_sect_init_cls(H5FS_section_class_t *cls, void *_udata)
init_flags = (unsigned *)_udata;
cls->flags |= *init_flags;
- return(ret_value);
+ return ret_value;
} /* TEST_sect_init_cls() */
/*
@@ -236,7 +236,7 @@ TEST_sect_can_merge(const H5FS_section_info_t *_sect1,
/* Check if second section adjoins first section */
ret_value = H5F_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr);
- return(ret_value);
+ return ret_value;
} /* TEST_sect_can_merge() */
/*
@@ -266,9 +266,9 @@ TEST_sect_merging(H5FS_section_info_t *_sect1, H5FS_section_info_t *_sect2,
/* Get rid of second section */
if(TEST_sect_free((H5FS_section_info_t *)sect2) < 0)
- TEST_ERROR
+ TEST_ERROR
error:
- return(ret_value);
+ return ret_value;
} /* TEST_sect_merging() */
/*
@@ -280,7 +280,7 @@ TEST_sect_free(H5FS_section_info_t *sect)
/* Release the section */
HDfree(sect);
- return(0);
+ return 0;
} /* TEST_sect_free() */
/*
@@ -297,18 +297,18 @@ TEST_sect_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
const TEST_free_section_t *sect = (const TEST_free_section_t *)_sect;
haddr_t end, eoa;
- if (can_shrink == NULL)
- return(FALSE);
+ if(can_shrink == NULL)
+ return FALSE;
end = sect->sect_info.addr + sect->sect_info.size;
eoa = TEST_get_eoa();
if (end == eoa)
- *can_shrink = TRUE;
+ *can_shrink = TRUE;
else
- *can_shrink = FALSE;
+ *can_shrink = FALSE;
- return((htri_t)*can_shrink);
+ return (htri_t)*can_shrink;
} /* TEST_sect_can_shrink() */
/*
@@ -323,14 +323,14 @@ TEST_sect_shrinking(H5FS_section_info_t **_sect, void *_udata)
/* address of the section is faked, so, doesn't need to do anything */
/* just free the section node */
if (*can_shrink) {
- if (TEST_sect_free((H5FS_section_info_t *)*sect) < 0)
- TEST_ERROR
- *sect = NULL;
- return(TRUE);
- }
+ if (TEST_sect_free((H5FS_section_info_t *)*sect) < 0)
+ TEST_ERROR
+ *sect = NULL;
+ return TRUE;
+ } /* end if */
error:
- return(FALSE);
+ return FALSE;
}
@@ -357,7 +357,7 @@ TEST_sects_cb(H5FS_section_info_t *_sect, void *_udata)
static haddr_t
TEST_get_eoa(void)
{
- return(g_eoa);
+ return g_eoa;
}
/* supporting routine for shrinking */
@@ -429,10 +429,10 @@ check_stats(const H5F_t *f, const H5FS_t *frsp, frspace_state_t *state)
} /* end if */
/* All tests passed */
- return(0);
+ return 0;
error:
- return(1);
+ return 1;
} /* check_stats() */
/*
@@ -491,8 +491,8 @@ test_fs_create(hid_t fapl)
if(!H5F_addr_defined(fs_addr))
TEST_ERROR
- if (frsp->nclasses != nclasses)
- TEST_ERROR
+ if(frsp->nclasses != nclasses)
+ TEST_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
if(check_stats(f, frsp, &state))
@@ -517,7 +517,7 @@ test_fs_create(hid_t fapl)
if(!H5F_addr_defined(fs_addr))
TEST_ERROR
if (frsp->nclasses != nclasses)
- TEST_ERROR
+ TEST_ERROR
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
@@ -543,15 +543,15 @@ test_fs_create(hid_t fapl)
PASSED()
- return(0);
+ return 0;
error:
H5E_BEGIN_TRY {
if(frsp)
- H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
- H5Fclose(file);
+ H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
+ H5Fclose(file);
} H5E_END_TRY;
- return(1);
+ return 1;
} /* test_fs_create() */
@@ -789,7 +789,7 @@ test_fs_sect_add(hid_t fapl)
/* Delete free space manager */
if(H5FS_delete(f, H5P_DATASET_XFER_DEFAULT, fs_addr) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file */
@@ -828,13 +828,13 @@ test_fs_sect_add(hid_t fapl)
init_flags = 0;
if(NULL == (frsp = H5FS_create(f, H5P_DATASET_XFER_DEFAULT, &fs_addr,
&cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(!H5F_addr_defined(fs_addr))
TEST_ERROR
if(NULL == (sect_node = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/*
* Add section A
@@ -854,21 +854,21 @@ test_fs_sect_add(hid_t fapl)
TEST_ERROR
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Free the section node(s) */
if(TEST_sect_free((H5FS_section_info_t *)sect_node) < 0)
- TEST_ERROR
+ TEST_ERROR
sect_node = NULL;
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
if(H5FS_delete(f, H5P_DATASET_XFER_DEFAULT, fs_addr) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file */
@@ -877,17 +877,17 @@ test_fs_sect_add(hid_t fapl)
PASSED()
- return(0);
+ return 0;
error:
H5E_BEGIN_TRY {
if(sect_node)
TEST_sect_free((H5FS_section_info_t *)sect_node);
if(frsp)
- H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
- H5Fclose(file);
+ H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
+ H5Fclose(file);
} H5E_END_TRY;
- return(1);
+ return 1;
} /* test_fs_sect_add() */
@@ -958,7 +958,7 @@ test_fs_sect_find(hid_t fapl)
if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp,
(hsize_t)TEST_SECT_SIZE30, (H5FS_section_info_t **)&node)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if (node_found) TEST_ERROR
@@ -967,7 +967,7 @@ test_fs_sect_find(hid_t fapl)
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
frsp = NULL;
PASSED()
@@ -977,24 +977,24 @@ test_fs_sect_find(hid_t fapl)
/* reopen the free-space manager */
if(NULL == (frsp = H5FS_open(f, H5P_DATASET_XFER_DEFAULT, fs_addr, nclasses,
test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(!H5F_addr_defined(fs_addr))
TEST_ERROR
if (frsp->nclasses != nclasses)
- TEST_ERROR
+ TEST_ERROR
/*
* Add section A
*/
if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += sect_node1->sect_info.size;
@@ -1009,13 +1009,13 @@ test_fs_sect_find(hid_t fapl)
* Add section C
*/
if(NULL == (sect_node3 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
init_sect_node(sect_node3, (haddr_t)(TEST_SECT_ADDR200), (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node3,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
state.tot_space += sect_node3->sect_info.size;
state.tot_sect_count += 1;
@@ -1028,13 +1028,13 @@ test_fs_sect_find(hid_t fapl)
* Add section B
*/
if(NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
state.tot_space += sect_node2->sect_info.size;
state.tot_sect_count += 1;
@@ -1047,13 +1047,13 @@ test_fs_sect_find(hid_t fapl)
* Add section D
*/
if(NULL == (sect_node4 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
init_sect_node(sect_node4, (haddr_t)TEST_SECT_ADDR300, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node4,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
state.tot_space += sect_node4->sect_info.size;
state.tot_sect_count += 1;
@@ -1064,38 +1064,38 @@ test_fs_sect_find(hid_t fapl)
if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp,
(hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if (!node_found) TEST_ERROR
if ((node->sect_info.addr != TEST_SECT_ADDR100) || (node->sect_info.size != TEST_SECT_SIZE50))
- TEST_ERROR
+ TEST_ERROR
if(TEST_sect_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ TEST_ERROR
/* remove sections A, C and D */
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node3) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node4) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Free the section node(s) */
if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
- TEST_ERROR
+ TEST_ERROR
sect_node1 = NULL;
if(TEST_sect_free((H5FS_section_info_t *)sect_node3) < 0)
- TEST_ERROR
+ TEST_ERROR
sect_node3 = NULL;
if(TEST_sect_free((H5FS_section_info_t *)sect_node4) < 0)
- TEST_ERROR
+ TEST_ERROR
sect_node4 = NULL;
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
frsp = NULL;
PASSED()
@@ -1105,24 +1105,24 @@ test_fs_sect_find(hid_t fapl)
/* reopen the free-space manager */
if(NULL == (frsp = H5FS_open(f, H5P_DATASET_XFER_DEFAULT, fs_addr, nclasses,
test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(!H5F_addr_defined(fs_addr))
TEST_ERROR
if (frsp->nclasses != nclasses)
- TEST_ERROR
+ TEST_ERROR
/*
* Add section A
*/
if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += sect_node1->sect_info.size;
@@ -1136,13 +1136,13 @@ test_fs_sect_find(hid_t fapl)
* Add section B
*/
if(NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR200, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
state.tot_space += sect_node2->sect_info.size;
state.tot_sect_count += 1;
@@ -1153,28 +1153,29 @@ test_fs_sect_find(hid_t fapl)
if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp,
(hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
- if (!node_found) TEST_ERROR
+ if (!node_found)
+ TEST_ERROR
if ((node->sect_info.addr != TEST_SECT_ADDR200) || (node->sect_info.size < TEST_SECT_SIZE50))
- TEST_ERROR
+ TEST_ERROR
if(TEST_sect_free((H5FS_section_info_t *)node) < 0)
- TEST_ERROR
+ TEST_ERROR
node = NULL;
/* remove sections A */
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Free the section node(s) */
if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
- TEST_ERROR
+ TEST_ERROR
sect_node1 = NULL;
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
frsp = NULL;
PASSED()
@@ -1189,19 +1190,19 @@ test_fs_sect_find(hid_t fapl)
if(!H5F_addr_defined(fs_addr))
TEST_ERROR
if (frsp->nclasses != nclasses)
- TEST_ERROR
+ TEST_ERROR
/*
* Add section A
*/
if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
HDmemset(&state, 0, sizeof(frspace_state_t));
state.tot_space += sect_node1->sect_info.size;
@@ -1213,27 +1214,27 @@ test_fs_sect_find(hid_t fapl)
if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp,
(hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if (node_found) TEST_ERROR
/* remove sections A */
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Free the section node(s) */
if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
- TEST_ERROR
+ TEST_ERROR
sect_node1 = NULL;
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
if(H5FS_delete(f, H5P_DATASET_XFER_DEFAULT, fs_addr) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file */
@@ -1242,7 +1243,7 @@ test_fs_sect_find(hid_t fapl)
PASSED()
- return(0);
+ return 0;
error:
H5E_BEGIN_TRY {
@@ -1254,9 +1255,9 @@ error:
TEST_sect_free((H5FS_section_info_t *)sect_node4);
if(frsp)
H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
- H5Fclose(file);
+ H5Fclose(file);
} H5E_END_TRY;
- return(1);
+ return 1;
} /* test_fs_sect_find() */
@@ -1709,7 +1710,7 @@ test_fs_sect_merge(hid_t fapl)
PASSED()
- return(0);
+ return 0;
error:
H5E_BEGIN_TRY {
@@ -1718,10 +1719,10 @@ error:
if(sect_node2)
TEST_sect_free((H5FS_section_info_t *)sect_node2);
if(frsp)
- H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
- H5Fclose(file);
+ H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
+ H5Fclose(file);
} H5E_END_TRY;
- return(1);
+ return 1;
} /* test_fs_sect_merge() */
/*
@@ -1839,14 +1840,14 @@ test_fs_sect_shrink(hid_t fapl)
* Re-add section A that allow shrinking and its section class type defines "can_shrink"
*/
if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t))))
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
can_shrink = FALSE;
if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1,
H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* should have nothing in free-space */
HDmemset(&state, 0, sizeof(frspace_state_t));
@@ -1857,18 +1858,18 @@ test_fs_sect_shrink(hid_t fapl)
/* section A should not be there in free-space */
if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp,
(hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if (node_found) TEST_ERROR
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
if(H5FS_delete(f, H5P_DATASET_XFER_DEFAULT, fs_addr) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file */
@@ -1943,7 +1944,8 @@ test_fs_sect_shrink(hid_t fapl)
(hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
- if (node_found) TEST_ERROR
+ if (node_found)
+ TEST_ERROR
if(check_stats(f, frsp, &state))
TEST_ERROR
@@ -2043,7 +2045,8 @@ test_fs_sect_shrink(hid_t fapl)
(hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
- if (node_found) TEST_ERROR
+ if (node_found)
+ TEST_ERROR
/* section A should not be there in free-space */
if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp,
@@ -2068,15 +2071,15 @@ test_fs_sect_shrink(hid_t fapl)
PASSED()
- return(0);
+ return 0;
error:
H5E_BEGIN_TRY {
if(frsp)
- H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
- H5Fclose(file);
+ H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
+ H5Fclose(file);
} H5E_END_TRY;
- return(1);
+ return 1;
} /* test_sect_shrink() */
/*
@@ -2176,8 +2179,8 @@ test_fs_sect_change_class(hid_t fapl)
TEST_ERROR
if (H5FS_sect_change_class(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1,
- TEST_FSPACE_SECT_TYPE_NONE) < 0)
- TEST_ERROR
+ TEST_FSPACE_SECT_TYPE_NONE) < 0)
+ TEST_ERROR
state.serial_sect_count += 1;
state.ghost_sect_count -=1;
@@ -2340,7 +2343,7 @@ test_fs_sect_change_class(hid_t fapl)
PASSED()
- return(0);
+ return 0;
error:
H5E_BEGIN_TRY {
@@ -2349,10 +2352,10 @@ error:
if(sect_node2)
TEST_sect_free((H5FS_section_info_t *)sect_node2);
if(frsp)
- H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
- H5Fclose(file);
+ H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
+ H5Fclose(file);
} H5E_END_TRY;
- return(1);
+ return 1;
} /* test_sect_change_class() */
@@ -2714,15 +2717,15 @@ test_fs_sect_extend(hid_t fapl)
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
- return(0);
+ return 0;
error:
H5E_BEGIN_TRY {
if(frsp)
- H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
- H5Fclose(file);
+ H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
+ H5Fclose(file);
} H5E_END_TRY;
- return(1);
+ return 1;
} /* test_sect_extend() */
@@ -2815,24 +2818,24 @@ test_fs_sect_iterate(hid_t fapl)
PASSED()
- return(0);
+ return 0;
error:
H5E_BEGIN_TRY {
if(frsp)
- H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
- H5Fclose(file);
+ H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
+ H5Fclose(file);
} H5E_END_TRY;
- return(1);
+ return 1;
} /* test_fs_sect_iterate() */
int
main(void)
{
- hid_t fapl = -1; /* File access property list for data files */
- unsigned nerrors = 0; /* Cumulative error count */
- const char *env_h5_drvr = NULL; /* File Driver value from environment */
+ hid_t fapl = -1; /* File access property list for data files */
+ unsigned nerrors = 0; /* Cumulative error count */
+ const char *env_h5_drvr = NULL; /* File Driver value from environment */
/* Get the VFD to use */
env_h5_drvr = HDgetenv("HDF5_DRIVER");
@@ -2841,11 +2844,16 @@ main(void)
h5_reset();
- fapl = h5_fileaccess();
+ if((fapl = h5_fileaccess()) < 0) {
+ nerrors++;
+ PUTS_ERROR("Can't get VFD-dependent fapl")
+ } /* end if */
/* make sure alignment is not set for tests to succeed */
- if(H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)1) < 0)
- TEST_ERROR
+ if(H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)1) < 0) {
+ nerrors++;
+ PUTS_ERROR("Can't set alignment")
+ } /* end if */
nerrors += test_fs_create(fapl);
nerrors += test_fs_sect_add(fapl);
@@ -2861,16 +2869,17 @@ main(void)
if(nerrors)
goto error;
- puts("All free-space tests passed.");
+ HDputs("All free-space tests passed.");
h5_cleanup(FILENAME, fapl);
- return (0);
+ HDexit(EXIT_SUCCESS);
error:
- puts("*** TESTS FAILED ***");
+ HDputs("*** TESTS FAILED ***");
H5E_BEGIN_TRY {
H5Pclose(fapl);
} H5E_END_TRY;
- return (1);
+
+ HDexit(EXIT_FAILURE);
} /* main() */
diff --git a/test/gen_bogus.c b/test/gen_bogus.c
index ac272ef..4ebde43 100644
--- a/test/gen_bogus.c
+++ b/test/gen_bogus.c
@@ -19,8 +19,8 @@
* datasets that have "bogus" messages in their object header.
*/
-#include "H5private.h"
#include "hdf5.h"
+#include "H5private.h"
#include "H5Oprivate.h"
#ifdef H5O_ENABLE_BOGUS
@@ -149,3 +149,4 @@ error:
#endif /* H5O_ENABLE_BOGUS */
return 1;
}
+
diff --git a/test/gen_cross.c b/test/gen_cross.c
index 35f5ef2..f7a1938 100644
--- a/test/gen_cross.c
+++ b/test/gen_cross.c
@@ -26,7 +26,6 @@
* worth keeping around for now.
*/
-#include <stdio.h>
#include "h5test.h"
#define H5FILE_NAME "data.h5"
@@ -79,7 +78,7 @@ int create_szip_dsets_float(hid_t fid, hid_t fsid, hid_t msid);
int create_shuffle_dsets_float(hid_t fid, hid_t fsid, hid_t msid);
int create_nbit_dsets_float(hid_t fid, hid_t fsid, hid_t msid);
-
+
/*-------------------------------------------------------------------------
* Function: create_normal_dset
*
@@ -98,9 +97,9 @@ int create_nbit_dsets_float(hid_t fid, hid_t fsid, hid_t msid);
int
create_normal_dset(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t dataset; /* file and dataset handles */
- hid_t dcpl;
- float data[NX][NY]; /* data to write */
+ hid_t dataset = -1; /* file and dataset handles */
+ hid_t dcpl = -1;
+ float data[NX][NY]; /* data to write */
float fillvalue = -2.2f;
int i, j;
@@ -108,8 +107,8 @@ create_normal_dset(hid_t fid, hid_t fsid, hid_t msid)
* Data and output buffer initialization.
*/
for (j = 0; j < NX; j++) {
- for (i = 0; i < NY; i++)
- data[j][i] = ((float)(i + j + 1)) / 3;
+ for (i = 0; i < NY; i++)
+ data[j][i] = ((float)(i + j + 1)) / 3;
}
/*
* 1/3 2/3 3/3 4/3 5/3 6/3
@@ -143,7 +142,7 @@ create_normal_dset(hid_t fid, hid_t fsid, hid_t msid)
if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
- /*
+ /*
* Close dataset
*/
if(H5Dclose(dataset) < 0)
@@ -163,7 +162,7 @@ create_normal_dset(hid_t fid, hid_t fsid, hid_t msid)
if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
TEST_ERROR
- /*
+ /*
* Close dataset
*/
if(H5Dclose(dataset) < 0)
@@ -186,7 +185,7 @@ error:
return -1;
}
-
+
/*-------------------------------------------------------------------------
* Function: create_scale_offset_dsets_float
*
@@ -205,9 +204,9 @@ error:
int
create_scale_offset_dsets_float(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t dataset; /* dataset handles */
- hid_t dcpl;
- float data[NX][NY]; /* data to write */
+ hid_t dataset = -1; /* dataset handles */
+ hid_t dcpl = -1;
+ float data[NX][NY]; /* data to write */
float fillvalue = -2.2f;
hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
int i, j;
@@ -277,7 +276,7 @@ error:
return -1;
}
-
+
/*-------------------------------------------------------------------------
* Function: create_scale_offset_dsets_double
*
@@ -296,9 +295,9 @@ error:
int
create_scale_offset_dsets_double(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t dataset; /* dataset handles */
- hid_t dcpl;
- double data[NX][NY]; /* data to write */
+ hid_t dataset = -1; /* dataset handles */
+ hid_t dcpl = -1;
+ double data[NX][NY]; /* data to write */
double fillvalue = -2.2f;
hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
int i, j;
@@ -307,8 +306,8 @@ create_scale_offset_dsets_double(hid_t fid, hid_t fsid, hid_t msid)
* Data and output buffer initialization.
*/
for (j = 0; j < NX; j++) {
- for (i = 0; i < NY; i++)
- data[j][i] = ((double)(i + j + 1))/3;
+ for (i = 0; i < NY; i++)
+ data[j][i] = ((double)(i + j + 1))/3;
}
/*
@@ -368,7 +367,7 @@ error:
return -1;
}
-
+
/*-------------------------------------------------------------------------
* Function: create_scale_offset_dset_char
*
@@ -387,9 +386,9 @@ error:
int
create_scale_offset_dsets_char(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t dataset; /* dataset handles */
- hid_t dcpl;
- char data[NX][NY]; /* data to write */
+ hid_t dataset = -1; /* dataset handles */
+ hid_t dcpl = -1;
+ char data[NX][NY]; /* data to write */
char fillvalue = -2;
hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
int i, j;
@@ -399,7 +398,7 @@ create_scale_offset_dsets_char(hid_t fid, hid_t fsid, hid_t msid)
*/
for (j = 0; j < NX; j++) {
for (i = 0; i < NY; i++)
- data[j][i] = i + j;
+ data[j][i] = (char)(i + j);
}
/*
* 0 1 2 3 4 5
@@ -467,7 +466,7 @@ error:
return -1;
}
-
+
/*-------------------------------------------------------------------------
* Function: create_scale_offset_dset_short
*
@@ -486,9 +485,9 @@ error:
int
create_scale_offset_dsets_short(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t dataset; /* dataset handles */
- hid_t dcpl;
- short data[NX][NY]; /* data to write */
+ hid_t dataset = -1; /* dataset handles */
+ hid_t dcpl = -1;
+ short data[NX][NY]; /* data to write */
short fillvalue = -2;
hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
int i, j;
@@ -498,7 +497,7 @@ create_scale_offset_dsets_short(hid_t fid, hid_t fsid, hid_t msid)
*/
for (j = 0; j < NX; j++) {
for (i = 0; i < NY; i++)
- data[j][i] = i + j;
+ data[j][i] = (short)(i + j);
}
/*
* 0 1 2 3 4 5
@@ -566,7 +565,7 @@ error:
return -1;
}
-
+
/*-------------------------------------------------------------------------
* Function: create_scale_offset_dset_int
*
@@ -585,9 +584,9 @@ error:
int
create_scale_offset_dsets_int(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t dataset; /* dataset handles */
- hid_t dcpl;
- int data[NX][NY]; /* data to write */
+ hid_t dataset = -1; /* dataset handles */
+ hid_t dcpl = -1;
+ int data[NX][NY]; /* data to write */
int fillvalue = -2;
hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
int i, j;
@@ -596,8 +595,8 @@ create_scale_offset_dsets_int(hid_t fid, hid_t fsid, hid_t msid)
* Data and output buffer initialization.
*/
for (j = 0; j < NX; j++) {
- for (i = 0; i < NY; i++)
- data[j][i] = i + j;
+ for (i = 0; i < NY; i++)
+ data[j][i] = i + j;
}
/*
* 0 1 2 3 4 5
@@ -665,7 +664,7 @@ error:
return -1;
}
-
+
/*-------------------------------------------------------------------------
* Function: create_scale_offset_dset_long_long
*
@@ -685,9 +684,9 @@ error:
int
create_scale_offset_dsets_long_long(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t dataset; /* dataset handles */
- hid_t dcpl;
- long long data[NX][NY]; /* data to write */
+ hid_t dataset = -1; /* dataset handles */
+ hid_t dcpl = -1;
+ long long data[NX][NY]; /* data to write */
long long fillvalue = -2;
hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
int i, j;
@@ -765,7 +764,7 @@ error:
return -1;
}
-
+
/*-------------------------------------------------------------------------
* Function: create_fletcher_dsets_float
*
@@ -784,9 +783,9 @@ error:
int
create_fletcher_dsets_float(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t dataset; /* dataset handles */
- hid_t dcpl;
- float data[NX][NY]; /* data to write */
+ hid_t dataset = -1; /* dataset handles */
+ hid_t dcpl = -1;
+ float data[NX][NY]; /* data to write */
float fillvalue = -2.2f;
hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
int i, j;
@@ -856,7 +855,7 @@ error:
return -1;
}
-
+
/*-------------------------------------------------------------------------
* Function: create_deflate_dsets_float
*
@@ -876,9 +875,9 @@ int
create_deflate_dsets_float(hid_t fid, hid_t fsid, hid_t msid)
{
#ifdef H5_HAVE_FILTER_DEFLATE
- hid_t dataset; /* dataset handles */
- hid_t dcpl;
- float data[NX][NY]; /* data to write */
+ hid_t dataset = -1; /* dataset handles */
+ hid_t dcpl = -1;
+ float data[NX][NY]; /* data to write */
float fillvalue = -2.2f;
hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
int i, j;
@@ -957,7 +956,7 @@ error:
}
#ifdef H5_HAVE_FILTER_SZIP
-
+
/*-------------------------------------------------------------------------
* Function: create_szip_dsets_float
*
@@ -1049,7 +1048,7 @@ error:
}
#endif /* H5_HAVE_FILTER_SZIP */
-
+
/*-------------------------------------------------------------------------
* Function: create_shuffle_dsets_float
*
@@ -1068,9 +1067,9 @@ error:
int
create_shuffle_dsets_float(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t dataset; /* dataset handles */
- hid_t dcpl;
- float data[NX][NY]; /* data to write */
+ hid_t dataset = -1; /* dataset handles */
+ hid_t dcpl = -1;
+ float data[NX][NY]; /* data to write */
float fillvalue = -2.2f;
hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
int i, j;
@@ -1140,7 +1139,7 @@ error:
return -1;
}
-
+
/*-------------------------------------------------------------------------
* Function: create_nbit_dsets_float
*
@@ -1159,11 +1158,11 @@ error:
int
create_nbit_dsets_float(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t dataset; /* dataset handles */
- hid_t datatype;
- hid_t dcpl;
+ hid_t dataset = -1; /* dataset handles */
+ hid_t datatype = -1;
+ hid_t dcpl = -1;
size_t precision, offset;
- float data[NX][NY]; /* data to write */
+ float data[NX][NY]; /* data to write */
float fillvalue = -2.2f;
hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
int i, j;
@@ -1225,7 +1224,7 @@ create_nbit_dsets_float(hid_t fid, hid_t fsid, hid_t msid)
TEST_ERROR
/* Now create a dataset with a big-endian type */
- if(H5Tset_order(datatype, H5T_ORDER_BE) < 0)
+ if(H5Tset_order(datatype, H5T_ORDER_BE) < 0)
TEST_ERROR
if((dataset = H5Dcreate2(fid, DATASETNAME23, datatype, fsid,
H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
@@ -1252,14 +1251,14 @@ error:
return -1;
}
-
+
/*-------------------------------------------------------------------------
* Function: main
*
* Purpose: Create a file for cross_read.c test.
*
- * Return: Success: exit(0)
- * Failure: exit(1)
+ * Return: Success: exit(EXIT_SUCCESS)
+ * Failure: exit(EXIT_FAILURE)
*
* Programmer: Raymond Lu
* Some time ago
diff --git a/test/gen_deflate.c b/test/gen_deflate.c
index 5a81b9f..3409a81 100644
--- a/test/gen_deflate.c
+++ b/test/gen_deflate.c
@@ -12,16 +12,18 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Thursday, November 14, 2002
*
- * Purpose: Create a dataset compressed with the deflate filter.
- * This program is used to create the test file `tdeflate.h5' which has
- * a dataset compressed with the "deflate" I/O filter. This dataset will
- * be used to verify the correct behavior of the library when a filter is
- * not available for a dataset which requires it.
+ * Purpose: Create a dataset compressed with the deflate filter.
+ * This program is used to create the test file `tdeflate.h5'
+ * which has a dataset compressed with the "deflate" I/O filter.
+ * This dataset will be used to verify the correct behavior of
+ * the library when a filter is not available for a dataset which
+ * requires it.
*/
-#include "hdf5.h"
+
+#include "h5test.h"
#define TESTFILE "deflate.h5"
@@ -32,80 +34,86 @@
#define CHUNK_DIM1 50
#define CHUNK_DIM2 50
-/* Dataset data */
-int data[SPACE_DIM1][SPACE_DIM2];
/*-------------------------------------------------------------------------
* Function: main
*
- * Purpose:
- *
- * Return: Success:
- *
- * Failure:
+ * Return: EXIT_SUCCESS/EXIT_FAILURE
*
* Programmer: Quincey Koziol
* Thursday, November 14, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
main(void)
{
- hid_t file, space, dset, dcpl;
- hsize_t dims[SPACE_RANK]={SPACE_DIM1,SPACE_DIM2};
- hsize_t chunk_dims[SPACE_RANK]={CHUNK_DIM1,CHUNK_DIM2};
- size_t i,j; /* Local index variables */
+ hid_t fid = -1, sid = -1, did = -1, dcpl_id = -1;
+ hsize_t dims[SPACE_RANK] = {SPACE_DIM1, SPACE_DIM2};
+ hsize_t chunk_dims[SPACE_RANK] = {CHUNK_DIM1, CHUNK_DIM2};
+ size_t i,j; /* Local index variables */
+ int *data = NULL; /* Dataset data */
/* Initialize the data */
/* (Try for something easily compressible) */
- for(i=0; i<SPACE_DIM1; i++)
- for(j=0; j<SPACE_DIM2; j++)
- data[i][j] = (int)(j % 5);
+ if(NULL == (data = (int *)HDmalloc(SPACE_DIM1 * SPACE_DIM2 * sizeof(int))))
+ TEST_ERROR
+
+ for(i = 0; i < SPACE_DIM1; i++)
+ for(j = 0; j < SPACE_DIM2; j++)
+ data[(i * SPACE_DIM2) + j] = (int)(j % 5);
/* Create the file */
- file = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if(file<0)
- printf("file<0!\n");
+ if((fid = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create the dataspace */
- space = H5Screate_simple(SPACE_RANK, dims, NULL);
- if(space<0)
- printf("space<0!\n");
+ if((sid = H5Screate_simple(SPACE_RANK, dims, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Create the dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
- if(dcpl<0)
- printf("dcpl<0!\n");
+ if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
/* Set up for deflated data */
- if(H5Pset_chunk(dcpl, 2, chunk_dims)<0)
- printf("H5Pset_chunk() failed!\n");
- if(H5Pset_deflate(dcpl, 9)<0)
- printf("H5Pset_deflate() failed!\n");
+ if(H5Pset_chunk(dcpl_id, 2, chunk_dims) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_deflate(dcpl_id, 9) < 0)
+ FAIL_STACK_ERROR
/* Create the compressed dataset */
- dset = H5Dcreate2(file, "Dataset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- if(dset<0)
- printf("dset<0!\n");
+ if((did = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Write the data to the dataset */
- if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data)<0)
- printf("H5Dwrite() failed!\n");
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ FAIL_STACK_ERROR
/* Close everything */
- if(H5Pclose(dcpl)<0)
- printf("H5Pclose() failed!\n");
- if(H5Dclose(dset)<0)
- printf("H5Dclose() failed!\n");
- if(H5Sclose(space)<0)
- printf("H5Sclose() failed!\n");
- if(H5Fclose(file)<0)
- printf("H5Fclose() failed!\n");
-
- return 0;
-}
+ if(H5Pclose(dcpl_id) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
+
+ HDfree(data);
+
+ return EXIT_SUCCESS;
+
+error:
+ if(data)
+ HDfree(data);
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl_id);
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ return EXIT_FAILURE;
+} /* end main() */
diff --git a/test/gen_file_image.c b/test/gen_file_image.c
index 97342a4..9607cc2 100644
--- a/test/gen_file_image.c
+++ b/test/gen_file_image.c
@@ -12,13 +12,13 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Friday, March 30, 2012
*
- * Purpose: Create a simple file for use with the file image tests.
+ * Purpose: Create a simple file for use with the file image tests.
*
*/
-#include "hdf5.h"
+#include "h5test.h"
#define TESTFILE "file_image_core_test.h5"
@@ -27,18 +27,11 @@
#define SPACE_DIM1 128
#define SPACE_DIM2 32
-/* Dataset data */
-int data[SPACE_DIM1][SPACE_DIM2];
-
/*-------------------------------------------------------------------------
* Function: main
*
- * Purpose:
- *
- * Return: Success:
- *
- * Failure:
+ * Return: EXIT_SUCCESS/EXIT_FAILURE
*
* Programmer: Quincey Koziol
* Friday, March 30, 2012
@@ -48,42 +41,54 @@ int data[SPACE_DIM1][SPACE_DIM2];
int
main(void)
{
- hid_t file, space, dset;
+ hid_t fid = -1, sid = -1, did = -1;
hsize_t dims[SPACE_RANK] = {SPACE_DIM1, SPACE_DIM2};
- size_t i, j; /* Local index variables */
+ size_t i,j; /* Local index variables */
+ int *data = NULL; /* Dataset data */
/* Initialize the data */
+ if(NULL == (data = (int *)HDmalloc(SPACE_DIM1 * SPACE_DIM2 * sizeof(int))))
+ TEST_ERROR
+
for(i = 0; i < SPACE_DIM1; i++)
for(j = 0; j < SPACE_DIM2; j++)
- data[i][j] = (int)(j % 5);
+ data[(i * SPACE_DIM2) + j] = (int)(j % 5);
/* Create the file */
- file = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if(file < 0)
- printf("file < 0!\n");
+ if((fid = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Create the dataspace */
- space = H5Screate_simple(SPACE_RANK, dims, NULL);
- if(space < 0)
- printf("space < 0!\n");
+ if((sid = H5Screate_simple(SPACE_RANK, dims, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Create the compressed dataset */
- dset = H5Dcreate2(file, "Dataset1", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if(dset < 0)
- printf("dset < 0!\n");
+ if((did = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Write the data to the dataset */
- if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
- printf("H5Dwrite() failed!\n");
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ FAIL_STACK_ERROR
/* Close everything */
- if(H5Dclose(dset) < 0)
- printf("H5Dclose() failed!\n");
- if(H5Sclose(space) < 0)
- printf("H5Sclose() failed!\n");
- if(H5Fclose(file) < 0)
- printf("H5Fclose() failed!\n");
+ if(H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
+
+ return EXIT_SUCCESS;
+
+error:
+ if(data)
+ HDfree(data);
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Fclose(fid);
+ } H5E_END_TRY;
- return 0;
-}
+ return EXIT_FAILURE;
+} /* end main() */
diff --git a/test/getname.c b/test/getname.c
index 18a8c4d..842f6db 100644
--- a/test/getname.c
+++ b/test/getname.c
@@ -2431,6 +2431,7 @@ test_obj_ref(hid_t fapl)
hsize_t dims1[] = {SPACE1_DIM1};
hobj_ref_t wbuf[SPACE1_DIM1]; /* Buffer to write to disk */
int tu32[SPACE1_DIM1]; /* Int data */
+ ssize_t namelen; /* Length of the name */
int i; /* counting variables */
char buf[100];
@@ -2573,96 +2574,104 @@ test_obj_ref(hid_t fapl)
TESTING("getting path to normal dataset in root group");
if((dataset2 = H5Rdereference(dataset, H5R_OBJECT, &wbuf[0])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(i == 9))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(namelen == 9))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(i == 9))) TEST_ERROR
+
+ /* Check H5Rget_name returns the correct length of the name when name is NULL */
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 0);
+ if(namelen != 9) TEST_ERROR
+ /* Make sure size parameter is ignored */
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 200);
+ if(namelen != 9) TEST_ERROR
+
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(namelen == 9))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to dataset in /Group1");
if((dataset2 = H5Rdereference(dataset, H5R_OBJECT, &wbuf[1])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(i == 16))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(namelen == 16))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(i == 16))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(namelen == 16))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to /Group1");
if((group = H5Rdereference(dataset, H5R_OBJECT, &wbuf[2])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(group, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(group, (char*)buf, sizeof(buf));
if(H5Gclose(group) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1") == 0) &&(i == 7))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1") == 0) &&(namelen == 7))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[2], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1") == 0) &&(i == 7))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[2], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1") == 0) &&(namelen == 7))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to datatype in /Group1");
if((tid1 = H5Rdereference(dataset, H5R_OBJECT, &wbuf[3])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(tid1, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(tid1, (char*)buf, sizeof(buf));
if(H5Tclose(tid1) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(i == 17))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(namelen == 17))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[3], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(i == 17))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[3], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(namelen == 17))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to dataset in nested group");
if((dataset2 = H5Rdereference(dataset, H5R_OBJECT, &wbuf[4])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(i == 23))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(namelen == 23))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(i == 23))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(namelen == 23))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to nested group");
if((group = H5Rdereference(dataset, H5R_OBJECT, &wbuf[5])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(group, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(group, (char*)buf, sizeof(buf));
if(H5Gclose(group) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(i == 14))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(namelen == 14))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[5], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(i == 14))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[5], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(namelen == 14))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to dataset created via hard link");
if((dataset2 = H5Rdereference(dataset, H5R_OBJECT, &wbuf[6])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(i == 16))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(namelen == 16))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[6], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(i == 16))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[6], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(namelen == 16))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to root group");
if((group = H5Rdereference(dataset, H5R_OBJECT, &wbuf[7])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(group, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(group, (char*)buf, sizeof(buf));
if(H5Gclose(group) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/") == 0) &&(i == 1))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/") == 0) &&(namelen == 1))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[7], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/") == 0) &&(i == 1))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[7], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/") == 0) &&(namelen == 1))) TEST_ERROR
PASSED()
/* Now we mount fid2 at /Group2 and look for dataset4. It shouldn't be found */
@@ -2672,12 +2681,12 @@ test_obj_ref(hid_t fapl)
TESTING("getting path to dataset hidden by a mounted file");
if((dataset2 = H5Rdereference(dataset, H5R_OBJECT, &wbuf[4])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(i != 0) TEST_ERROR
+ if(namelen != 0) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf));
- if(i != 0) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf));
+ if(namelen != 0) TEST_ERROR
PASSED()
/* Now we try unlinking dataset2 from the file and searching for it. It shouldn't be found */
@@ -2688,12 +2697,12 @@ test_obj_ref(hid_t fapl)
TESTING("getting path to dataset that has been unlinked");
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(i != 0) TEST_ERROR
+ if(namelen != 0) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf));
- if(i != 0) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf));
+ if(namelen != 0) TEST_ERROR
PASSED()
/* Close disk dataspace */
@@ -2814,7 +2823,12 @@ test_reg_ref(hid_t fapl)
/* Get name of the dataset the first region reference points to using H5Rget_name */
TESTING("H5Rget_name to get name from region reference(hyperslab)");
*buf1 = '\0';
- name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[0], (char*)buf1, NAME_BUF_SIZE);
+
+ /* Check H5Rget_name returns the correct length of the name when name is NULL */
+ name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[0], NULL, 0);
+ if(name_size1 != 7) TEST_ERROR
+
+ name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[0], (char*)buf1, NAME_BUF_SIZE );
if(!((HDstrcmp(buf1, "/MATRIX") == 0) &&(name_size1 == 7))) TEST_ERROR
PASSED()
diff --git a/test/gheap.c b/test/gheap.c
index c120b87..393b4d2 100644
--- a/test/gheap.c
+++ b/test/gheap.c
@@ -15,9 +15,9 @@
* Programmer: Robb Matzke <matzke@llnl.gov>
* Tuesday, March 31, 1998
*
- * Purpose: Tests the global heap. The global heap is the set of all
- * collections but the collections are not related to one
- * another by anything that appears in the file format.
+ * Purpose: Tests the global heap. The global heap is the set of all
+ * collections but the collections are not related to one
+ * another by anything that appears in the file format.
*/
#include "h5test.h"
#include "H5private.h"
@@ -32,6 +32,9 @@
* GHEAP_REPEATED_ERR_LIM errors, and suppress the rest */
#define GHEAP_REPEATED_ERR_LIM 20
+/* Number of heap objects to test */
+#define GHEAP_TEST_NOBJS 1024
+
#define GHEAP_REPEATED_ERR(MSG) \
{ \
nerrors++; \
@@ -52,18 +55,18 @@ const char *FILENAME[] = {
NULL
};
-
+
/*-------------------------------------------------------------------------
- * Function: test_1
+ * Function: test_1
*
- * Purpose: Writes a sequence of objects to the global heap where each
- * object is larger than the one before.
+ * Purpose: Writes a sequence of objects to the global heap where each
+ * object is larger than the one before.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, March 31, 1998
*
* Modifications:
@@ -73,27 +76,31 @@ const char *FILENAME[] = {
static int
test_1 (hid_t fapl)
{
- hid_t file = -1;
- H5F_t *f = NULL;
- H5HG_t obj[1024];
- uint8_t out[1024];
- uint8_t in[1024];
- int i;
- size_t size;
- herr_t status;
- int nerrors = 0;
- char filename[1024];
+ hid_t file = -1;
+ H5F_t *f = NULL;
+ H5HG_t *obj = NULL;
+ uint8_t out[GHEAP_TEST_NOBJS];
+ uint8_t in[GHEAP_TEST_NOBJS];
+ size_t u;
+ size_t size;
+ herr_t status;
+ int nerrors = 0;
+ char filename[1024];
TESTING("monotonically increasing lengths");
+ /* Allocate buffer for H5HG_t */
+ if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * GHEAP_TEST_NOBJS)))
+ goto error;
+
/* Open a clean file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
if(NULL == (f = (H5F_t *)H5I_object(file))) {
- H5_FAILED();
- puts(" Unable to create file");
- goto error;
+ H5_FAILED();
+ puts(" Unable to create file");
+ goto error;
}
/*
@@ -101,40 +108,44 @@ test_1 (hid_t fapl)
* a clean file, the addresses allocated for the collections should also
* be monotonically increasing.
*/
- for(i = 0; i < 1024; i++) {
- size = i + 1;
- HDmemset(out, 'A' + i % 26, size);
- H5Eclear2(H5E_DEFAULT);
- status = H5HG_insert(f, H5P_DATASET_XFER_DEFAULT, size, out, obj + i);
- if(status < 0) {
- H5_FAILED();
- puts(" Unable to insert object into global heap");
- nerrors++;
- } else if(i && H5F_addr_gt(obj[i - 1].addr, obj[i].addr)) {
- H5_FAILED();
- puts(" Collection addresses are not monotonically increasing");
- nerrors++;
- }
+ for(u = 0; u < GHEAP_TEST_NOBJS; u++) {
+ size = u + 1;
+ HDmemset(out, (int)('A' + u % 26), size);
+ H5Eclear2(H5E_DEFAULT);
+ status = H5HG_insert(f, H5P_DATASET_XFER_DEFAULT, size, out, obj + u);
+ if(status < 0) {
+ H5_FAILED();
+ puts(" Unable to insert object into global heap");
+ nerrors++;
+ } else if(u && H5F_addr_gt(obj[u - 1].addr, obj[u].addr)) {
+ H5_FAILED();
+ puts(" Collection addresses are not monotonically increasing");
+ nerrors++;
+ }
}
/*
* Now try to read each object back.
*/
- for(i = 0; i < 1024; i++) {
- size = i + 1;
- HDmemset(out, 'A' + i % 26, size);
- H5Eclear2(H5E_DEFAULT);
- if(NULL == H5HG_read(f, H5P_DATASET_XFER_DEFAULT, obj + i, in, NULL)) {
- H5_FAILED();
- puts(" Unable to read object");
- nerrors++;
- } else if(HDmemcmp(in, out, size)) {
- H5_FAILED();
- puts(" Value read doesn't match value written");
- nerrors++;
- }
+ for(u = 0; u < GHEAP_TEST_NOBJS; u++) {
+ size = u + 1;
+ HDmemset(out, (int)('A' + u % 26), size);
+ H5Eclear2(H5E_DEFAULT);
+ if(NULL == H5HG_read(f, H5P_DATASET_XFER_DEFAULT, obj + u, in, NULL)) {
+ H5_FAILED();
+ puts(" Unable to read object");
+ nerrors++;
+ } else if(HDmemcmp(in, out, size)) {
+ H5_FAILED();
+ puts(" Value read doesn't match value written");
+ nerrors++;
+ }
}
+ /* Release buffer */
+ HDfree(obj);
+ obj = NULL;
+
if(H5Fclose(file) < 0) goto error;
if(nerrors) goto error;
@@ -145,21 +156,23 @@ error:
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
+ if(obj)
+ HDfree(obj);
return MAX(1, nerrors);
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_2
+ * Function: test_2
*
- * Purpose: Writes a sequence of objects to the global heap where each
- * object is smaller than the one before.
+ * Purpose: Writes a sequence of objects to the global heap where each
+ * object is smaller than the one before.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, March 31, 1998
*
* Modifications:
@@ -169,62 +182,71 @@ error:
static int
test_2 (hid_t fapl)
{
- hid_t file = -1;
- H5F_t *f = NULL;
- H5HG_t obj[1024];
- uint8_t out[1024];
- uint8_t in[1024];
- int i;
- size_t size;
- int nerrors = 0;
- char filename[1024];
+ hid_t file = -1;
+ H5F_t *f = NULL;
+ H5HG_t *obj = NULL;
+ uint8_t out[GHEAP_TEST_NOBJS];
+ uint8_t in[GHEAP_TEST_NOBJS];
+ size_t u;
+ size_t size;
+ int nerrors = 0;
+ char filename[1024];
TESTING("monotonically decreasing lengths");
+ /* Allocate buffer for H5HG_t */
+ if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * GHEAP_TEST_NOBJS)))
+ goto error;
+
/* Open a clean file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
if(NULL == (f = (H5F_t *)H5I_object(file))) {
- H5_FAILED();
- puts(" Unable to create file");
- goto error;
+ H5_FAILED();
+ puts(" Unable to create file");
+ goto error;
}
/*
* Write the objects, monotonically decreasing in length.
*/
- for (i=0; i<1024; i++) {
- size = 1024-i;
- memset (out, 'A'+i%26, size);
- H5Eclear2(H5E_DEFAULT);
- if (H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i)<0) {
- H5_FAILED();
- puts(" Unable to insert object into global heap");
- nerrors++;
- }
+ for(u = 0; u < GHEAP_TEST_NOBJS; u++) {
+ size = GHEAP_TEST_NOBJS - u;
+ HDmemset(out, (int)('A' + u % 26), size);
+ H5Eclear2(H5E_DEFAULT);
+ if (H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj + u) < 0) {
+ H5_FAILED();
+ puts(" Unable to insert object into global heap");
+ nerrors++;
+ }
}
/*
* Now try to read each object back.
*/
- for (i=0; i<1024; i++) {
- size = 1024-i;
- memset (out, 'A'+i%26, size);
- H5Eclear2(H5E_DEFAULT);
- if (NULL==H5HG_read (f, H5P_DATASET_XFER_DEFAULT, obj+i, in, NULL)) {
- H5_FAILED();
- puts(" Unable to read object");
- nerrors++;
- } else if (memcmp (in, out, size)) {
- H5_FAILED();
- puts(" Value read doesn't match value written");
- nerrors++;
- }
+ for(u = 0; u < GHEAP_TEST_NOBJS; u++) {
+ size = GHEAP_TEST_NOBJS - u;
+ HDmemset(out, (int)('A' + u % 26), size);
+ H5Eclear2(H5E_DEFAULT);
+ if(NULL == H5HG_read(f, H5P_DATASET_XFER_DEFAULT, obj + u, in, NULL)) {
+ H5_FAILED();
+ puts(" Unable to read object");
+ nerrors++;
+ } else if (memcmp (in, out, size)) {
+ H5_FAILED();
+ puts(" Value read doesn't match value written");
+ nerrors++;
+ }
}
+ /* Release buffer */
+ HDfree(obj);
+ obj = NULL;
+
if (H5Fclose(file)<0) goto error;
if (nerrors) goto error;
+
PASSED();
return 0;
@@ -232,21 +254,23 @@ test_2 (hid_t fapl)
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
+ if(obj)
+ HDfree(obj);
return MAX(1, nerrors);
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_3
+ * Function: test_3
*
- * Purpose: Creates a few global heap objects and then removes them all.
- * The collection should also be removed.
+ * Purpose: Creates a few global heap objects and then removes them all.
+ * The collection should also be removed.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, March 31, 1998
*
* Modifications:
@@ -256,53 +280,62 @@ test_2 (hid_t fapl)
static int
test_3 (hid_t fapl)
{
- hid_t file = -1;
- H5F_t *f = NULL;
- H5HG_t obj[1024];
- uint8_t out[1024];
- int i;
- size_t size;
- herr_t status;
- int nerrors = 0;
- char filename[1024];
+ hid_t file = -1;
+ H5F_t *f = NULL;
+ H5HG_t *obj = NULL;
+ uint8_t out[GHEAP_TEST_NOBJS];
+ size_t u;
+ size_t size;
+ herr_t status;
+ int nerrors = 0;
+ char filename[1024];
TESTING("complete object removal");
+ /* Allocate buffer for H5HG_t */
+ if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * GHEAP_TEST_NOBJS)))
+ goto error;
+
/* Open a clean file */
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
if(NULL == (f = (H5F_t *)H5I_object(file))) {
- H5_FAILED();
- puts(" Unable to create file");
- goto error;
+ H5_FAILED();
+ puts(" Unable to create file");
+ goto error;
}
/* Create some stuff */
- for (i=0; i<1024; i++) {
- size = i%30+100;
- memset (out, 'A'+i%26, size);
- H5Eclear2(H5E_DEFAULT);
- status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i);
- if (status<0) {
- H5_FAILED();
- puts(" Unable to insert object into global heap");
- nerrors++;
- }
+ for(u = 0; u < GHEAP_TEST_NOBJS; u++) {
+ size = u % 30 + 100;
+ HDmemset(out, (int)('A' + u % 26), size);
+ H5Eclear2(H5E_DEFAULT);
+ status = H5HG_insert(f, H5P_DATASET_XFER_DEFAULT, size, out, obj + u);
+ if (status<0) {
+ H5_FAILED();
+ puts(" Unable to insert object into global heap");
+ nerrors++;
+ }
}
/* Remove everything */
- for (i=0; i<1024; i++) {
- status = H5HG_remove (f, H5P_DATASET_XFER_DEFAULT, obj+i);
- if (status<0) {
- H5_FAILED();
- puts(" Unable to remove object");
- nerrors++;
- }
+ for(u = 0; u < GHEAP_TEST_NOBJS; u++) {
+ status = H5HG_remove(f, H5P_DATASET_XFER_DEFAULT, obj + u);
+ if (status<0) {
+ H5_FAILED();
+ puts(" Unable to remove object");
+ nerrors++;
+ }
}
+ /* Release buffer */
+ HDfree(obj);
+ obj = NULL;
+
if (H5Fclose(file)<0) goto error;
if (nerrors) goto error;
+
PASSED();
return 0;
@@ -310,22 +343,24 @@ test_3 (hid_t fapl)
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
+ if(obj)
+ HDfree(obj);
return MAX(1, nerrors);
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_4
+ * Function: test_4
*
- * Purpose: Tests the H5HG_remove() feature by writing lots of objects
- * and occassionally removing some. When we're done they're all
- * removed.
+ * Purpose: Tests the H5HG_remove() feature by writing lots of objects
+ * and occassionally removing some. When we're done they're all
+ * removed.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, March 31, 1998
*
* Modifications:
@@ -335,59 +370,68 @@ test_3 (hid_t fapl)
static int
test_4 (hid_t fapl)
{
- hid_t file = -1;
- H5F_t *f = NULL;
- H5HG_t obj[1024];
- uint8_t out[1024];
- int i;
- size_t size;
- herr_t status;
- int nerrors = 0;
- char filename[1024];
+ hid_t file = -1;
+ H5F_t *f = NULL;
+ H5HG_t *obj = NULL;
+ uint8_t out[GHEAP_TEST_NOBJS];
+ size_t u;
+ size_t size;
+ herr_t status;
+ int nerrors = 0;
+ char filename[1024];
TESTING("partial object removal");
+ /* Allocate buffer for H5HG_t */
+ if(NULL == (obj = (H5HG_t *)HDmalloc(sizeof(H5HG_t) * GHEAP_TEST_NOBJS)))
+ goto error;
+
/* Open a clean file */
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
if(NULL == (f = (H5F_t *)H5I_object(file))) {
- H5_FAILED();
- puts(" Unable to create file");
- goto error;
+ H5_FAILED();
+ puts(" Unable to create file");
+ goto error;
}
- for (i=0; i<1024; i++) {
- /* Insert */
- size = i%30+100;
- memset (out, 'A'+i%26, size);
- H5Eclear2(H5E_DEFAULT);
- status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i);
- if (status<0) {
- H5_FAILED();
- puts(" Unable to insert object into global heap");
- nerrors++;
- }
-
- /*
- * Remove every third one beginning with the second, but after the
- * next one has already been inserted. That is, insert A, B, C;
- * remove B, insert D, E, F; remove E; etc.
- */
- if (1==i%3) {
- H5Eclear2(H5E_DEFAULT);
- status = H5HG_remove (f, H5P_DATASET_XFER_DEFAULT, obj+i-1);
- if (status<0) {
- H5_FAILED();
- puts(" Unable to remove object");
- nerrors++;
- }
- memset (obj+i-1, 0, sizeof *obj);
- }
+ for(u = 0; u < GHEAP_TEST_NOBJS; u++) {
+ /* Insert */
+ size = u % 30 + 100;
+ HDmemset(out, (int)('A' + u % 26), size);
+ H5Eclear2(H5E_DEFAULT);
+ status = H5HG_insert(f, H5P_DATASET_XFER_DEFAULT, size, out, obj + u);
+ if (status<0) {
+ H5_FAILED();
+ puts(" Unable to insert object into global heap");
+ nerrors++;
+ }
+
+ /*
+ * Remove every third one beginning with the second, but after the
+ * next one has already been inserted. That is, insert A, B, C;
+ * remove B, insert D, E, F; remove E; etc.
+ */
+ if(1 == (u % 3)) {
+ H5Eclear2(H5E_DEFAULT);
+ status = H5HG_remove(f, H5P_DATASET_XFER_DEFAULT, obj + u - 1);
+ if (status<0) {
+ H5_FAILED();
+ puts(" Unable to remove object");
+ nerrors++;
+ }
+ HDmemset(obj + u - 1, 0, sizeof *obj);
+ }
}
+ /* Release buffer */
+ HDfree(obj);
+ obj = NULL;
+
if (H5Fclose(file)<0) goto error;
if (nerrors) goto error;
+
PASSED();
return 0;
@@ -395,23 +439,25 @@ test_4 (hid_t fapl)
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
+ if(obj)
+ HDfree(obj);
return MAX(1, nerrors);
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_ooo_indices
+ * Function: test_ooo_indices
*
- * Purpose: Tests that indices can be stored out of order. This can
+ * Purpose: Tests that indices can be stored out of order. This can
* happen when the indices "wrap around" due to many
* insertions and deletions (for example, from rewriting a
* VL dataset).
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Neil Fortner
+ * Programmer: Neil Fortner
* Monday, October 26, 2009
*
* Modifications:
@@ -421,13 +467,13 @@ test_4 (hid_t fapl)
static int
test_ooo_indices(hid_t fapl)
{
- hid_t file = -1;
- H5F_t *f = NULL;
- unsigned i, j;
- H5HG_t *obj = NULL;
- herr_t status;
- int nerrors=0;
- char filename[1024];
+ hid_t file = -1;
+ H5F_t *f = NULL;
+ unsigned i, j;
+ H5HG_t *obj = NULL;
+ herr_t status;
+ int nerrors=0;
+ char filename[1024];
TESTING("out of order indices");
@@ -498,8 +544,10 @@ test_ooo_indices(hid_t fapl)
if (H5Fclose(file)<0) goto error;
if (nerrors) goto error;
+
HDfree(obj);
obj = NULL;
+
PASSED();
return 0;
@@ -512,17 +560,17 @@ test_ooo_indices(hid_t fapl)
return MAX(1, nerrors);
} /* end test_ooo_indices */
-
+
/*-------------------------------------------------------------------------
- * Function: main
+ * Function: main
*
- * Purpose: Tests global heap.
+ * Purpose: Tests global heap.
*
- * Return: Success: zero
+ * Return: Success: zero
*
- * Failure: non-zero
+ * Failure: non-zero
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, March 31, 1998
*
* Modifications:
@@ -532,8 +580,8 @@ test_ooo_indices(hid_t fapl)
int
main (void)
{
- int nerrors=0;
- hid_t fapl;
+ int nerrors=0;
+ hid_t fapl;
h5_reset();
fapl = h5_fileaccess();
@@ -547,8 +595,8 @@ main (void)
/* Verify symbol table messages are cached */
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
- if (nerrors) goto error;
-
+ if (nerrors)
+ goto error;
puts("All global heap tests passed.");
h5_cleanup(FILENAME, fapl);
return 0;
@@ -557,3 +605,4 @@ main (void)
puts("*** TESTS FAILED ***");
return 1;
}
+
diff --git a/test/h5test.c b/test/h5test.c
index faeca34..fb582ff 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -549,7 +549,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
printf("*** Hint ***\n"
"You can use environment variable HDF5_PARAPREFIX to "
"run parallel test files in a\n"
- "different directory or to add file type prefix. E.g.,\n"
+ "different directory or to add file type prefix. e.g.,\n"
" HDF5_PARAPREFIX=pfs:/PFS/user/me\n"
" export HDF5_PARAPREFIX\n"
"*** End of Hint ***\n");
diff --git a/test/h5test.h b/test/h5test.h
index 69e6f31..b331044 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -20,8 +20,13 @@
#ifndef _H5TEST_H
#define _H5TEST_H
+/*
+ * Include required headers. This file tests internal library functions,
+ * so we include the private headers here.
+ */
#include "hdf5.h"
#include "H5private.h"
+#include "H5Eprivate.h"
/*
* Predefined test verbosity levels.
diff --git a/test/hyperslab.c b/test/hyperslab.c
index 9d2cb2d..feb96bd 100644
--- a/test/hyperslab.c
+++ b/test/hyperslab.c
@@ -11,110 +11,108 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Robb Matzke <matzke@llnl.gov>
- * Friday, October 10, 1997
+/* Programmer: Robb Matzke <matzke@llnl.gov>
+ * Friday, October 10, 1997
*
- * Purpose: Hyperslab operations are rather complex, so this file
- * attempts to test them extensively so we can be relatively
- * sure they really work. We only test 1d, 2d, and 3d cases
- * because testing general dimensionalities would require us to
- * rewrite much of the hyperslab stuff.
+ * Purpose: Hyperslab operations are rather complex, so this file
+ * attempts to test them extensively so we can be relatively
+ * sure they really work. We only test 1d, 2d, and 3d cases
+ * because testing general dimensionalities would require us to
+ * rewrite much of the hyperslab stuff.
*/
#include "h5test.h"
-#include "H5private.h"
-#include "H5Eprivate.h"
#include "H5VMprivate.h"
-#define TEST_SMALL 0x0001
-#define TEST_MEDIUM 0x0002
+#define TEST_SMALL 0x0001
+#define TEST_MEDIUM 0x0002
-#define VARIABLE_SRC 0
-#define VARIABLE_DST 1
-#define VARIABLE_BOTH 2
+#define VARIABLE_SRC 0
+#define VARIABLE_DST 1
+#define VARIABLE_BOTH 2
#define ARRAY_FILL_SIZE 4
#define ARRAY_OFFSET_NDIMS 3
-
+
/*-------------------------------------------------------------------------
- * Function: init_full
+ * Function: init_full
*
- * Purpose: Initialize full array.
+ * Purpose: Initialize full array.
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
- * Friday, October 10, 1997
+ * Programmer: Robb Matzke
+ * Friday, October 10, 1997
*
*-------------------------------------------------------------------------
*/
static unsigned
init_full(uint8_t *array, size_t nx, size_t ny, size_t nz)
{
- uint8_t acc = 128;
- unsigned total = 0;
- size_t i, j, k;
+ uint8_t acc = 128;
+ unsigned total = 0;
+ size_t i, j, k;
for(i = 0; i < nx; i++)
- for(j = 0; j < ny; j++)
- for(k = 0; k < nz; k++) {
- total += acc;
- *array = acc;
- acc++;
- array++;
- } /* end for */
+ for(j = 0; j < ny; j++)
+ for(k = 0; k < nz; k++) {
+ total += acc;
+ *array = acc;
+ acc++;
+ array++;
+ } /* end for */
return total;
} /* end init_full() */
-
+
/*-------------------------------------------------------------------------
- * Function: print_array
+ * Function: print_array
*
- * Purpose: Prints the values in an array
+ * Purpose: Prints the values in an array
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
- * Friday, October 10, 1997
+ * Programmer: Robb Matzke
+ * Friday, October 10, 1997
*
*-------------------------------------------------------------------------
*/
static void
print_array(uint8_t *array, size_t nx, size_t ny, size_t nz)
{
- size_t i, j, k;
+ size_t i, j, k;
for(i = 0; i < nx; i++) {
- if(nz > 1)
- printf("i=%lu:\n", (unsigned long)i);
- else
- printf("%03lu:", (unsigned long)i);
-
- for(j = 0; j < ny; j++) {
- if(nz > 1)
- printf("%03lu:", (unsigned long)j);
- for(k = 0; k < nz; k++)
- printf(" %3d", *array++);
- if(nz > 1)
- printf("\n");
- } /* end for */
- printf("\n");
+ if(nz > 1)
+ printf("i=%lu:\n", (unsigned long)i);
+ else
+ printf("%03lu:", (unsigned long)i);
+
+ for(j = 0; j < ny; j++) {
+ if(nz > 1)
+ printf("%03lu:", (unsigned long)j);
+ for(k = 0; k < nz; k++)
+ printf(" %3d", *array++);
+ if(nz > 1)
+ printf("\n");
+ } /* end for */
+ printf("\n");
} /* end for */
} /* end print_array() */
-
+
/*-------------------------------------------------------------------------
- * Function: print_ref
+ * Function: print_ref
*
- * Purpose: Prints the reference value
+ * Purpose: Prints the reference value
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure:
+ * Failure:
*
- * Programmer: Robb Matzke
- * Friday, October 10, 1997
+ * Programmer: Robb Matzke
+ * Friday, October 10, 1997
*
*-------------------------------------------------------------------------
*/
@@ -131,37 +129,37 @@ print_ref(size_t nx, size_t ny, size_t nz)
} /* end if */
} /* end print_ref() */
-
+
/*-------------------------------------------------------------------------
- * Function: test_fill
+ * Function: test_fill
*
- * Purpose: Tests the H5VM_hyper_fill() function.
+ * Purpose: Tests the H5VM_hyper_fill() function.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
static herr_t
test_fill(size_t nx, size_t ny, size_t nz,
- size_t di, size_t dj, size_t dk,
- size_t ddx, size_t ddy, size_t ddz)
+ size_t di, size_t dj, size_t dk,
+ size_t ddx, size_t ddy, size_t ddz)
{
- uint8_t *dst = NULL; /*destination array */
- hsize_t hs_size[3]; /*hyperslab size */
- hsize_t dst_size[3]; /*destination total size */
+ uint8_t *dst = NULL; /*destination array */
+ hsize_t hs_size[3]; /*hyperslab size */
+ hsize_t dst_size[3]; /*destination total size */
hsize_t dst_offset[3]; /*offset of hyperslab in dest */
- unsigned ref_value; /*reference value */
- unsigned acc; /*accumulator */
- size_t i, j, k, dx, dy, dz; /*counters */
+ unsigned ref_value; /*reference value */
+ unsigned acc; /*accumulator */
+ size_t i, j, k, dx, dy, dz; /*counters */
size_t u, v, w;
- unsigned ndims; /*hyperslab dimensionality */
- char dim[64], s[256]; /*temp string */
- unsigned fill_value; /*fill value */
+ unsigned ndims; /*hyperslab dimensionality */
+ char dim[64], s[256]; /*temp string */
+ unsigned fill_value; /*fill value */
/*
* Dimensionality.
@@ -190,7 +188,7 @@ test_fill(size_t nx, size_t ny, size_t nz,
/* Allocate array */
if(NULL == (dst = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz)))
TEST_ERROR
-
+
init_full(dst, nx, ny, nz);
for(i = 0; i < nx; i += di) {
@@ -221,7 +219,7 @@ test_fill(size_t nx, size_t ny, size_t nz,
for(v = (size_t)dst_offset[1]; v < dst_offset[1] + dy; v++)
for(w = (size_t)dst_offset[2]; w < dst_offset[2] + dz; w++)
ref_value -= dst[u * ny * nz + v * nz + w];
- ref_value += fill_value * dx * dy * dz;
+ ref_value += fill_value * (unsigned)dx * (unsigned)dy * (unsigned)dz;
/* Fill the hyperslab with some value */
H5VM_hyper_fill(ndims, hs_size, dst_size, dst_offset, dst, fill_value);
@@ -279,52 +277,52 @@ error:
return FAIL;
} /* end test_fill() */
-
+
/*-------------------------------------------------------------------------
- * Function: test_copy
+ * Function: test_copy
*
- * Purpose: Tests H5VM_hyper_copy().
+ * Purpose: Tests H5VM_hyper_copy().
*
- * The NX, NY, and NZ arguments are the size for the source and
- * destination arrays. You may pass zero for NZ or for NY and
- * NZ to test the 2-d and 1-d cases respectively.
+ * The NX, NY, and NZ arguments are the size for the source and
+ * destination arrays. You may pass zero for NZ or for NY and
+ * NZ to test the 2-d and 1-d cases respectively.
*
- * A hyperslab is copied from/to (depending on MODE) various
- * places in SRC and DST beginning at 0,0,0 and increasing
- * location by DI,DJ,DK in the x, y, and z directions.
+ * A hyperslab is copied from/to (depending on MODE) various
+ * places in SRC and DST beginning at 0,0,0 and increasing
+ * location by DI,DJ,DK in the x, y, and z directions.
*
- * For each hyperslab location, various sizes of hyperslabs are
- * tried beginning with 1x1x1 and increasing the size in each
- * dimension by DDX,DDY,DDZ.
+ * For each hyperslab location, various sizes of hyperslabs are
+ * tried beginning with 1x1x1 and increasing the size in each
+ * dimension by DDX,DDY,DDZ.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Friday, October 10, 1997
+ * Programmer: Robb Matzke
+ * Friday, October 10, 1997
*
*-------------------------------------------------------------------------
*/
static herr_t
test_copy(int mode,
- size_t nx, size_t ny, size_t nz,
- size_t di, size_t dj, size_t dk,
- size_t ddx, size_t ddy, size_t ddz)
+ size_t nx, size_t ny, size_t nz,
+ size_t di, size_t dj, size_t dk,
+ size_t ddx, size_t ddy, size_t ddz)
{
- uint8_t *src = NULL; /*source array */
- uint8_t *dst = NULL; /*destination array */
- hsize_t hs_size[3]; /*hyperslab size */
- hsize_t dst_size[3]; /*destination total size */
- hsize_t src_size[3]; /*source total size */
- hsize_t dst_offset[3]; /*offset of hyperslab in dest */
+ uint8_t *src = NULL; /*source array */
+ uint8_t *dst = NULL; /*destination array */
+ hsize_t hs_size[3]; /*hyperslab size */
+ hsize_t dst_size[3]; /*destination total size */
+ hsize_t src_size[3]; /*source total size */
+ hsize_t dst_offset[3]; /*offset of hyperslab in dest */
hsize_t src_offset[3]; /*offset of hyperslab in source */
- unsigned ref_value; /*reference value */
- unsigned acc; /*accumulator */
- hsize_t i, j, k, dx, dy, dz; /*counters */
+ unsigned ref_value; /*reference value */
+ unsigned acc; /*accumulator */
+ hsize_t i, j, k, dx, dy, dz; /*counters */
hsize_t u, v, w;
- unsigned ndims; /*hyperslab dimensionality */
- char dim[64], s[256]; /*temp string */
+ unsigned ndims; /*hyperslab dimensionality */
+ char dim[64], s[256]; /*temp string */
const char *sub;
/*
@@ -493,7 +491,7 @@ test_copy(int mode,
(unsigned long)dy,
(unsigned long)dz);
print_ref(nx, ny, nz);
- printf("\n Destination array is:\n");
+ printf("\n Destination array is:\n");
print_array(dst, nx, ny, nz);
} /* end if */
goto error;
@@ -535,7 +533,7 @@ test_copy(int mode,
(unsigned long)dy,
(unsigned long)dz);
print_ref(nx, ny, nz);
- printf("\n Destination array is:\n");
+ printf("\n Destination array is:\n");
print_array(dst, nx, ny, nz);
} /* end if */
goto error;
@@ -563,38 +561,38 @@ error:
return FAIL;
} /* end test_copy() */
-
+
/*-------------------------------------------------------------------------
- * Function: test_multifill
+ * Function: test_multifill
*
- * Purpose: Tests the H5VM_stride_copy() function by using it to fill a
- * hyperslab by replicating a multi-byte sequence. This might
- * be useful to initialize an array of structs with a default
- * struct value, or to initialize an array of floating-point
- * values with a default bit-pattern.
+ * Purpose: Tests the H5VM_stride_copy() function by using it to fill a
+ * hyperslab by replicating a multi-byte sequence. This might
+ * be useful to initialize an array of structs with a default
+ * struct value, or to initialize an array of floating-point
+ * values with a default bit-pattern.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
static herr_t
test_multifill(size_t nx)
{
- hsize_t size;
- hsize_t src_stride;
- hsize_t dst_stride;
- char s[64];
+ hsize_t size;
+ hsize_t src_stride;
+ hsize_t dst_stride;
+ char s[64];
struct a_struct {
int left;
double mid;
int right;
} fill, *src = NULL, *dst = NULL;
- hsize_t i, j;
+ hsize_t i, j;
printf("%-70s", "Testing multi-byte fill value");
fflush(stdout);
@@ -615,7 +613,7 @@ test_multifill(size_t nx)
} /* end for */
/*
- * Describe the fill value. The zero stride says to read the same thing
+ * Describe the fill value. The zero stride says to read the same thing
* over and over again.
*/
fill.left = 55555555;
@@ -642,7 +640,7 @@ test_multifill(size_t nx)
for(i = 0; i < nx; i++) {
if(dst[i].left != 3333333)
sprintf(s, "bad dst[%lu].left", (unsigned long)i);
- else if(!DBL_ABS_EQUAL(dst[i].mid, fill.mid))
+ else if(!H5_DBL_ABS_EQUAL(dst[i].mid, fill.mid))
/* Check if two DOUBLE values are equal. If their difference
* is smaller than the EPSILON value for double, they are
* considered equal. See the definition in h5test.h.
@@ -684,32 +682,32 @@ error:
return FAIL;
} /* end test_multifill() */
-
+
/*-------------------------------------------------------------------------
- * Function: test_endian
+ * Function: test_endian
*
- * Purpose: Tests the H5VM_stride_copy() function by using it to copy an
- * array of integers and swap the byte ordering from little
- * endian to big endian or vice versa depending on the hardware.
+ * Purpose: Tests the H5VM_stride_copy() function by using it to copy an
+ * array of integers and swap the byte ordering from little
+ * endian to big endian or vice versa depending on the hardware.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
static herr_t
test_endian(size_t nx)
{
- uint8_t *src = NULL; /*source array */
- uint8_t *dst = NULL; /*destination array */
- hssize_t src_stride[2]; /*source strides */
- hssize_t dst_stride[2]; /*destination strides */
- hsize_t size[2]; /*size vector */
- hsize_t i, j;
+ uint8_t *src = NULL; /*source array */
+ uint8_t *dst = NULL; /*destination array */
+ hssize_t src_stride[2]; /*source strides */
+ hssize_t dst_stride[2]; /*destination strides */
+ hsize_t size[2]; /*size vector */
+ hsize_t i, j;
printf("%-70s", "Testing endian conversion by stride");
fflush(stdout);
@@ -747,7 +745,7 @@ test_endian(size_t nx)
printf(" i=%lu, j=%lu\n", (unsigned long)i, (unsigned long)j);
printf(" Source array is:\n");
print_array(src, nx, (size_t)4, (size_t)1);
- printf("\n Result is:\n");
+ printf("\n Result is:\n");
print_array(dst, nx, (size_t)4, (size_t)1);
} /* end if */
goto error;
@@ -771,31 +769,31 @@ error:
return FAIL;
} /* end test_endian() */
-
+
/*-------------------------------------------------------------------------
- * Function: test_transpose
+ * Function: test_transpose
*
- * Purpose: Copy a 2d array from here to there and transpose the elements
- * as it's copied.
+ * Purpose: Copy a 2d array from here to there and transpose the elements
+ * as it's copied.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Saturday, October 11, 1997
+ * Programmer: Robb Matzke
+ * Saturday, October 11, 1997
*
*-------------------------------------------------------------------------
*/
static herr_t
test_transpose(size_t nx, size_t ny)
{
- int *src = NULL;
- int *dst = NULL;
- hsize_t src_stride[2], dst_stride[2];
- hsize_t size[2];
- char s[256];
- hsize_t i, j;
+ int *src = NULL;
+ int *dst = NULL;
+ hsize_t src_stride[2], dst_stride[2];
+ hsize_t size[2];
+ char s[256];
+ hsize_t i, j;
sprintf(s, "Testing 2d transpose by stride %4lux%-lud", (unsigned long)nx,
(unsigned long)ny);
@@ -817,8 +815,8 @@ test_transpose(size_t nx, size_t ny)
size[1] = ny;
src_stride[0] = 0;
src_stride[1] = sizeof(*src);
- dst_stride[0] = (ssize_t)((1 - nx * ny) * sizeof(*src));
- dst_stride[1] = (ssize_t)(nx * sizeof(*src));
+ dst_stride[0] = (hsize_t)((1 - nx * ny) * sizeof(*src));
+ dst_stride[1] = (hsize_t)(nx * sizeof(*src));
/* Copy and transpose */
if(nx == ny)
@@ -843,7 +841,7 @@ test_transpose(size_t nx, size_t ny)
printf(" %6d", src[i * ny + j]);
printf("\n");
} /* end for */
- printf("\n Destination is:\n");
+ printf("\n Destination is:\n");
for (i = 0; i < ny; i++) {
printf("%3lu:", (unsigned long)i);
for(j = 0; j < nx; j++)
@@ -872,35 +870,35 @@ error:
return FAIL;
} /* end test_transpose() */
-
+
/*-------------------------------------------------------------------------
- * Function: test_sub_super
+ * Function: test_sub_super
*
- * Purpose: Tests H5VM_stride_copy() to reduce the resolution of an image
- * by copying half the pixels in the X and Y directions. Then
- * we use the small image and duplicate every pixel to result in
- * a 2x2 square.
+ * Purpose: Tests H5VM_stride_copy() to reduce the resolution of an image
+ * by copying half the pixels in the X and Y directions. Then
+ * we use the small image and duplicate every pixel to result in
+ * a 2x2 square.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Monday, October 13, 1997
+ * Programmer: Robb Matzke
+ * Monday, October 13, 1997
*
*-------------------------------------------------------------------------
*/
static herr_t
test_sub_super(size_t nx, size_t ny)
{
- uint8_t *full = NULL; /*original image */
- uint8_t *half = NULL; /*image at 1/2 resolution */
- uint8_t *twice = NULL; /*2x2 pixels */
- hsize_t src_stride[4]; /*source stride info */
- hsize_t dst_stride[4]; /*destination stride info */
- hsize_t size[4]; /*number of sample points */
- hsize_t i, j;
- char s[256];
+ uint8_t *full = NULL; /*original image */
+ uint8_t *half = NULL; /*image at 1/2 resolution */
+ uint8_t *twice = NULL; /*2x2 pixels */
+ hsize_t src_stride[4]; /*source stride info */
+ hsize_t dst_stride[4]; /*destination stride info */
+ hsize_t size[4]; /*number of sample points */
+ hsize_t i, j;
+ char s[256];
sprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ",
(unsigned long)(2 * nx), (unsigned long)(2 * ny),
@@ -921,7 +919,7 @@ test_sub_super(size_t nx, size_t ny)
/* Setup */
size[0] = nx;
size[1] = ny;
- src_stride[0] = (ssize_t)(2 * ny);
+ src_stride[0] = (hsize_t)(2 * ny);
src_stride[1] = 2;
dst_stride[0] = 0;
dst_stride[1] = 1;
@@ -942,7 +940,7 @@ test_sub_super(size_t nx, size_t ny)
(unsigned long)i, (unsigned long)j);
printf(" full is:\n");
print_array(full, 2 * nx, 2 * ny, (size_t)1);
- printf("\n half is:\n");
+ printf("\n half is:\n");
print_array(half, nx, ny, (size_t)1);
} /* end if */
goto error;
@@ -970,9 +968,9 @@ test_sub_super(size_t nx, size_t ny)
src_stride[1] = 1;
src_stride[2] = 0;
src_stride[3] = 0;
- dst_stride[0] = (ssize_t)(2 * ny);
- dst_stride[1] = (ssize_t)(2 * sizeof(uint8_t) - 4 * ny);
- dst_stride[2] = (ssize_t)(2 * ny - 2 * sizeof(uint8_t));
+ dst_stride[0] = (hsize_t)(2 * ny);
+ dst_stride[1] = (hsize_t)(2 * sizeof(uint8_t) - 4 * ny);
+ dst_stride[2] = (hsize_t)(2 * ny - 2 * sizeof(uint8_t));
dst_stride[3] = sizeof(uint8_t);
/* Copy */
@@ -1005,7 +1003,7 @@ test_sub_super(size_t nx, size_t ny)
AT();
printf(" %s\n Half is:\n", s);
print_array(half, nx, ny, (size_t)1);
- printf("\n Twice is:\n");
+ printf("\n Twice is:\n");
print_array(twice, 2 * nx, 2 * ny, (size_t)1);
} /* end if */
goto error;
@@ -1032,20 +1030,20 @@ error:
return FAIL;
} /* test_sub_super() */
-
+
/*-------------------------------------------------------------------------
- * Function: test_array_fill
+ * Function: test_array_fill
*
- * Purpose: Tests H5VM_array_fill routine by copying a multibyte value
+ * Purpose: Tests H5VM_array_fill routine by copying a multibyte value
* (an array of ints, in our case) into all the elements of an
* array.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Quincey Koziol
- * Monday, April 21, 2003
+ * Programmer: Quincey Koziol
+ * Monday, April 21, 2003
*
*-------------------------------------------------------------------------
*/
@@ -1054,8 +1052,8 @@ test_array_fill(size_t lo, size_t hi)
{
int *dst = NULL; /* Destination */
int src[ARRAY_FILL_SIZE]; /* Source to duplicate */
- size_t u, v, w; /* Local index variables */
- char s[256];
+ size_t u, v, w; /* Local index variables */
+ char s[256];
sprintf(s, "array filling %4lu-%-4lu elements", (unsigned long)lo,(unsigned long)hi);
TESTING(s);
@@ -1093,20 +1091,20 @@ error:
return FAIL;
} /* end test_array_fill() */
-
+
/*-------------------------------------------------------------------------
- * Function: test_array_offset_n_calc
+ * Function: test_array_offset_n_calc
*
- * Purpose: Tests H5VM_array_offset and H5VM_array_calc routines by comparing
+ * Purpose: Tests H5VM_array_offset and H5VM_array_calc routines by comparing
* computed array offsets against calculated ones and then going
* back to the coordinates from the offset and checking those.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Quincey Koziol
- * Monday, April 21, 2003
+ * Programmer: Quincey Koziol
+ * Monday, April 21, 2003
*
*-------------------------------------------------------------------------
*/
@@ -1116,11 +1114,11 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
hsize_t *a = NULL;
hsize_t *temp_a; /* Array for stored calculated offsets */
hsize_t off; /* Offset in array */
- size_t u, v, w; /* Local index variables */
+ size_t u, v, w; /* Local index variables */
hsize_t dims[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of array to check */
hsize_t coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates to check offset of */
hsize_t new_coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of offset */
- char s[256];
+ char s[256];
sprintf(s, "array offset %4lux%4lux%4lu elements", (unsigned long)z,(unsigned long)y,(unsigned long)x);
TESTING(s);
@@ -1142,9 +1140,9 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
/* Check offsets */
for(u = 0; u < n; u++) {
/* Get random coordinate */
- coords[0] = (hssize_t)(HDrandom() % z);
- coords[1] = (hssize_t)(HDrandom() % y);
- coords[2] = (hssize_t)(HDrandom() % x);
+ coords[0] = (hsize_t)((size_t)HDrandom() % z);
+ coords[1] = (hsize_t)((size_t)HDrandom() % y);
+ coords[2] = (hsize_t)((size_t)HDrandom() % x);
/* Get offset of coordinate */
off = H5VM_array_offset(ARRAY_OFFSET_NDIMS, dims, coords);
@@ -1178,29 +1176,29 @@ error:
return FAIL;
} /* end test_array_offset_n_calc() */
-
+
/*-------------------------------------------------------------------------
- * Function: main
+ * Function: main
*
- * Purpose: Test various hyperslab operations. Give the words
- * `small' and/or `medium' on the command line or only `small'
- * is assumed.
+ * Purpose: Test various hyperslab operations. Give the words
+ * `small' and/or `medium' on the command line or only `small'
+ * is assumed.
*
- * Return: Success: exit(0)
+ * Return: Success: exit(EXIT_SUCCESS)
*
- * Failure: exit(non-zero)
+ * Failure: exit(EXIT_FAILURE)
*
- * Programmer: Robb Matzke
- * Friday, October 10, 1997
+ * Programmer: Robb Matzke
+ * Friday, October 10, 1997
*
*-------------------------------------------------------------------------
*/
int
main(int argc, char *argv[])
{
- herr_t status;
- int nerrors = 0;
- unsigned size_of_test;
+ herr_t status;
+ int nerrors = 0;
+ unsigned size_of_test;
/* Parse arguments or assume `small' & `medium' */
if(1 == argc)
@@ -1215,7 +1213,7 @@ main(int argc, char *argv[])
size_of_test |= TEST_MEDIUM;
else {
printf("unrecognized argument: %s\n", argv[i]);
- HDexit(1);
+ HDexit(EXIT_FAILURE);
} /* end else */
} /* end for */
} /* end else */
@@ -1435,7 +1433,7 @@ main(int argc, char *argv[])
== nerrors ? "" : "S");
if(HDisatty(1))
printf("(Redirect output to a pager or a file to see debug output)\n");
- HDexit(1);
+ HDexit(EXIT_FAILURE);
} /* end if */
printf("All hyperslab tests passed.\n");
diff --git a/test/istore.c b/test/istore.c
index f488a41..e91a59b 100644
--- a/test/istore.c
+++ b/test/istore.c
@@ -11,24 +11,22 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Robb Matzke <matzke@llnl.gov>
- * Wednesday, October 15, 1997
+/* Programmer: Robb Matzke <matzke@llnl.gov>
+ * Wednesday, October 15, 1997
*
- * Purpose: Tests various aspects of indexed raw data storage.
+ * Purpose: Tests various aspects of indexed raw data storage.
*/
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
+#define H5F_PACKAGE /*suppress error about including H5Fpkg */
#include "h5test.h"
-#include "H5private.h"
+
#include "H5Dprivate.h"
-#include "H5Eprivate.h"
#include "H5Iprivate.h"
#include "H5Pprivate.h"
#include "H5Fpkg.h"
#include "H5Gprivate.h"
#include "H5Oprivate.h"
-#include "H5Pprivate.h"
#include "H5VMprivate.h"
const char *FILENAME[] = {
@@ -37,9 +35,9 @@ const char *FILENAME[] = {
};
-#define TEST_SMALL 0x0001
-#define TEST_MEDIUM 0x0002
-#define TEST_LARGE 0x0004
+#define TEST_SMALL 0x0001
+#define TEST_MEDIUM 0x0002
+#define TEST_LARGE 0x0004
/* The datatype of the dataset operated on by this test */
#define TEST_DATATYPE H5T_NATIVE_UCHAR
@@ -50,19 +48,19 @@ const char *FILENAME[] = {
hsize_t chunk_dims[H5O_LAYOUT_NDIMS];
hsize_t zero[H5O_LAYOUT_NDIMS];
-
+
/*-------------------------------------------------------------------------
- * Function: is_sparse
+ * Function: is_sparse
*
- * Purpose: Determines if the file system of the current working
- * directory supports holes.
+ * Purpose: Determines if the file system of the current working
+ * directory supports holes.
*
- * Return: Success: Non-zero if holes are supported; zero
- * otherwise.
+ * Return: Success: Non-zero if holes are supported; zero
+ * otherwise.
*
- * Failure: zero
+ * Failure: zero
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, July 15, 1998
*
*-------------------------------------------------------------------------
@@ -70,10 +68,10 @@ hsize_t zero[H5O_LAYOUT_NDIMS];
static int
is_sparse(void)
{
- int fd;
- h5_stat_t sb;
+ int fd;
+ h5_stat_t sb;
- if ((fd=HDopen("x.h5", O_RDWR|O_TRUNC|O_CREAT, 0666)) < 0) return 0;
+ if ((fd = HDopen("x.h5", O_RDWR|O_TRUNC|O_CREAT, H5_POSIX_CREATE_MODE_RW)) < 0) return 0;
if (HDlseek(fd, (off_t)(1024*1024), SEEK_SET)!=1024*1024) return 0;
if (5!=HDwrite(fd, "hello", (size_t)5)) return 0;
if (HDclose(fd) < 0) return 0;
@@ -86,16 +84,16 @@ is_sparse(void)
#endif
}
-
+
/*-------------------------------------------------------------------------
- * Function: print_array
+ * Function: print_array
*
- * Purpose: Prints the values in an array
+ * Purpose: Prints the values in an array
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
- * Friday, October 10, 1997
+ * Programmer: Robb Matzke
+ * Friday, October 10, 1997
*
* Modifications:
*
@@ -104,41 +102,41 @@ is_sparse(void)
static void
print_array(uint8_t *array, size_t nx, size_t ny, size_t nz)
{
- size_t i, j, k;
+ size_t i, j, k;
for (i = 0; i < nx; i++) {
- if (nz > 1) {
- fprintf(stderr,"i=%lu:\n", (unsigned long)i);
- } else {
- fprintf(stderr,"%03lu:", (unsigned long)i);
- }
-
- for (j = 0; j < ny; j++) {
- if (nz > 1)
- fprintf(stderr,"%03lu:", (unsigned long)j);
- for (k = 0; k < nz; k++) {
- fprintf(stderr," %3d", *array++);
- }
- if (nz > 1)
- fprintf(stderr,"\n");
- }
- fprintf(stderr,"\n");
+ if (nz > 1) {
+ fprintf(stderr,"i=%lu:\n", (unsigned long)i);
+ } else {
+ fprintf(stderr,"%03lu:", (unsigned long)i);
+ }
+
+ for (j = 0; j < ny; j++) {
+ if (nz > 1)
+ fprintf(stderr,"%03lu:", (unsigned long)j);
+ for (k = 0; k < nz; k++) {
+ fprintf(stderr," %3d", *array++);
+ }
+ if (nz > 1)
+ fprintf(stderr,"\n");
+ }
+ fprintf(stderr,"\n");
}
}
-
+
/*-------------------------------------------------------------------------
- * Function: new_object
+ * Function: new_object
*
- * Purpose: Creates a new object that refers to a indexed storage of raw
- * data. No raw data is stored.
+ * Purpose: Creates a new object that refers to a indexed storage of raw
+ * data. No raw data is stored.
*
- * Return: Success: ID of dataset
+ * Return: Success: ID of dataset
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Robb Matzke
- * Wednesday, October 15, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 15, 1997
*
* Modifications:
* Converted to use datasets instead of directly messing with
@@ -182,19 +180,19 @@ error:
return -1;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_create
+ * Function: test_create
*
- * Purpose: Creates a named object that refers to indexed storage of raw
- * data. No raw data is stored.
+ * Purpose: Creates a named object that refers to indexed storage of raw
+ * data. No raw data is stored.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Wednesday, October 15, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 15, 1997
*
* Modifications:
*
@@ -217,9 +215,9 @@ test_create(hid_t f, const char *prefix)
dims[u] = my_chunk_dims[u] = 2;
/* Create chunked dataset of this dimensionality */
- HDsnprintf(name, sizeof name, "%s_%02u", prefix, u);
- if ((dataset=new_object(f, name, (int)u, dims, my_chunk_dims)) < 0)
- return FAIL;
+ HDsnprintf(name, sizeof name, "%s_%02u", prefix, u);
+ if((dataset = new_object(f, name, (int)u, dims, my_chunk_dims)) < 0)
+ return FAIL;
/* Close dataset created */
if(H5Dclose(dataset) < 0)
@@ -230,20 +228,20 @@ test_create(hid_t f, const char *prefix)
return SUCCEED;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_extend
+ * Function: test_extend
*
- * Purpose: Creates an empty object and then writes to it in such a way
- * as to always extend the object's domain without creating
- * holes and without causing the object to become concave.
+ * Purpose: Creates an empty object and then writes to it in such a way
+ * as to always extend the object's domain without creating
+ * holes and without causing the object to become concave.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Wednesday, October 15, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 15, 1997
*
* Modifications:
*
@@ -251,35 +249,35 @@ test_create(hid_t f, const char *prefix)
*/
static herr_t
test_extend(hid_t f, const char *prefix,
- size_t nx, size_t ny, size_t nz)
+ size_t nx, size_t ny, size_t nz)
{
hid_t dataset; /* Dataset ID */
hid_t fspace; /* Dataset's file dataspace */
hid_t mspace; /* Dataset's memory dataspace */
- size_t i, j, k, ctr;
- int ndims;
- uint8_t *buf = NULL, *check = NULL, *whole = NULL;
- char dims[64], s[256], name[256];
- hsize_t offset[3];
- hsize_t max_corner[3];
- hsize_t size[3];
- hsize_t whole_size[3];
- hsize_t nelmts;
+ size_t i, j, k, ctr;
+ int ndims;
+ uint8_t *buf = NULL, *check = NULL, *whole = NULL;
+ char dims[64], s[256], name[256];
+ hsize_t offset[3];
+ hsize_t max_corner[3];
+ hsize_t size[3];
+ hsize_t whole_size[3];
+ hsize_t nelmts;
if (!nz) {
- if (!ny) {
- ndims = 1;
- ny = nz = 1;
- sprintf(dims, "%lu", (unsigned long) nx);
- } else {
- ndims = 2;
- nz = 1;
- sprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
- }
+ if (!ny) {
+ ndims = 1;
+ ny = nz = 1;
+ sprintf(dims, "%lu", (unsigned long) nx);
} else {
- ndims = 3;
- sprintf(dims, "%lux%lux%lu",
- (unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
+ ndims = 2;
+ nz = 1;
+ sprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
+ }
+ } else {
+ ndims = 3;
+ sprintf(dims, "%lux%lux%lu",
+ (unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
}
sprintf(s, "istore extend: %s", dims);
@@ -298,57 +296,57 @@ test_extend(hid_t f, const char *prefix,
/* Build the new empty object */
sprintf(name, "%s_%s", prefix, dims);
if ((dataset=new_object(f, name, ndims, whole_size, whole_size)) < 0) {
- fprintf(stderr," Cannot create %u-d object `%s'\n", ndims, name);
- goto error;
+ fprintf(stderr," Cannot create %u-d object `%s'\n", ndims, name);
+ goto error;
}
/* Get dataset's dataspace */
if((fspace=H5Dget_space(dataset)) < 0) TEST_ERROR;
for (ctr = 0;
- H5VM_vector_lt_u((unsigned)ndims, max_corner, whole_size);
- ctr++) {
-
- /* Size and location */
- if (0 == ctr) {
- offset[0] = offset[1] = offset[2] = 0;
- size[0] = size[1] = size[2] = 1;
- nelmts = 1;
- } else {
- for (i=0, nelmts=1; i<(size_t)ndims; i++) {
- if (ctr % (size_t)ndims == i) {
- offset[i] = max_corner[i];
- size[i] = MIN(1, whole_size[i] - offset[i]);
- } else {
- offset[i] = 0;
- size[i] = max_corner[i];
- }
- nelmts *= size[i];
- }
- }
+ H5VM_vector_lt_u((unsigned)ndims, max_corner, whole_size);
+ ctr++) {
+
+ /* Size and location */
+ if (0 == ctr) {
+ offset[0] = offset[1] = offset[2] = 0;
+ size[0] = size[1] = size[2] = 1;
+ nelmts = 1;
+ } else {
+ for (i=0, nelmts=1; i<(size_t)ndims; i++) {
+ if (ctr % (size_t)ndims == i) {
+ offset[i] = max_corner[i];
+ size[i] = MIN(1, whole_size[i] - offset[i]);
+ } else {
+ offset[i] = 0;
+ size[i] = max_corner[i];
+ }
+ nelmts *= size[i];
+ }
+ }
#if 0
- if (0 == ctr)
- fprintf(stderr,"\n");
- fprintf(stderr," Insert: ctr=%lu, corner=(%ld", (unsigned long)ctr, (long)offset[0]);
- if (ndims > 1)
- fprintf(stderr,",%ld", (long)offset[1]);
- if (ndims > 2)
- fprintf(stderr,",%ld", (long)offset[2]);
- fprintf(stderr,"), size=(%lu", (unsigned long)size[0]);
- if (ndims > 1)
- fprintf(stderr,",%lu", (unsigned long)size[1]);
- if (ndims > 2)
- fprintf(stderr,",%lu", (unsigned long)size[2]);
- fprintf(stderr,"), %lu element%s", (unsigned long)nelmts, 1 == nelmts ? "" : "s");
- if (0 == nelmts)
- fprintf(stderr," *SKIPPED*");
- fprintf(stderr,"\n");
+ if (0 == ctr)
+ fprintf(stderr,"\n");
+ fprintf(stderr," Insert: ctr=%lu, corner=(%ld", (unsigned long)ctr, (long)offset[0]);
+ if (ndims > 1)
+ fprintf(stderr,",%ld", (long)offset[1]);
+ if (ndims > 2)
+ fprintf(stderr,",%ld", (long)offset[2]);
+ fprintf(stderr,"), size=(%lu", (unsigned long)size[0]);
+ if (ndims > 1)
+ fprintf(stderr,",%lu", (unsigned long)size[1]);
+ if (ndims > 2)
+ fprintf(stderr,",%lu", (unsigned long)size[2]);
+ fprintf(stderr,"), %lu element%s", (unsigned long)nelmts, 1 == nelmts ? "" : "s");
+ if (0 == nelmts)
+ fprintf(stderr," *SKIPPED*");
+ fprintf(stderr,"\n");
#endif
- /* Fill the source array */
- if (0 == nelmts) continue;
- HDmemset(buf, (signed)(128+ctr), (size_t)nelmts);
+ /* Fill the source array */
+ if (0 == nelmts) continue;
+ HDmemset(buf, (signed)(128+ctr), (size_t)nelmts);
/* Create dataspace for selection in memory */
if((mspace=H5Screate_simple(1,&nelmts,NULL)) < 0) TEST_ERROR;
@@ -356,72 +354,72 @@ test_extend(hid_t f, const char *prefix,
/* Select region in file dataspace */
if(H5Sselect_hyperslab(fspace,H5S_SELECT_SET,offset,NULL,size,NULL) < 0) TEST_ERROR;
- /* Write to disk */
- if (H5Dwrite(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, buf) < 0) {
- H5_FAILED();
- fprintf(stderr," Write failed: ctr=%lu\n", (unsigned long)ctr);
- goto error;
- }
-
- /* Read from disk */
- HDmemset(check, 0xff, (size_t)nelmts);
- if (H5Dread(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, check) < 0) {
- H5_FAILED();
- fprintf(stderr," Read failed: ctr=%lu\n", (unsigned long)ctr);
- goto error;
- }
- if (HDmemcmp(buf, check, (size_t)nelmts)) {
- H5_FAILED();
- fprintf(stderr," Read check failed: ctr=%lu\n", (unsigned long)ctr);
- fprintf(stderr," Wrote:\n");
- print_array(buf, (size_t)size[0], (size_t)size[1],
- (size_t)size[2]);
- fprintf(stderr," Read:\n");
- print_array(check, (size_t)size[0], (size_t)size[1],
- (size_t)size[2]);
- goto error;
- }
+ /* Write to disk */
+ if (H5Dwrite(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, buf) < 0) {
+ H5_FAILED();
+ fprintf(stderr," Write failed: ctr=%lu\n", (unsigned long)ctr);
+ goto error;
+ }
+
+ /* Read from disk */
+ HDmemset(check, 0xff, (size_t)nelmts);
+ if (H5Dread(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, check) < 0) {
+ H5_FAILED();
+ fprintf(stderr," Read failed: ctr=%lu\n", (unsigned long)ctr);
+ goto error;
+ }
+ if (HDmemcmp(buf, check, (size_t)nelmts)) {
+ H5_FAILED();
+ fprintf(stderr," Read check failed: ctr=%lu\n", (unsigned long)ctr);
+ fprintf(stderr," Wrote:\n");
+ print_array(buf, (size_t)size[0], (size_t)size[1],
+ (size_t)size[2]);
+ fprintf(stderr," Read:\n");
+ print_array(check, (size_t)size[0], (size_t)size[1],
+ (size_t)size[2]);
+ goto error;
+ }
/* Close memory dataspace */
if(H5Sclose(mspace) < 0) TEST_ERROR;
- /* Write to `whole' buffer for later checking */
- H5VM_hyper_copy((unsigned)ndims, size,
- whole_size, offset, whole, /*dst*/
- size, H5VM_ZERO, buf); /*src*/
+ /* Write to `whole' buffer for later checking */
+ H5VM_hyper_copy((unsigned)ndims, size,
+ whole_size, offset, whole, /*dst*/
+ size, H5VM_ZERO, buf); /*src*/
- /* Update max corner */
- for (i=0; i<(size_t)ndims; i++)
- max_corner[i] = MAX(max_corner[i], offset[i]+size[i]);
+ /* Update max corner */
+ for (i=0; i<(size_t)ndims; i++)
+ max_corner[i] = MAX(max_corner[i], offset[i]+size[i]);
}
/* Now read the entire array back out and check it */
HDmemset(buf, 0xff, nx * ny * nz);
if (H5Dread(dataset, TEST_DATATYPE, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) {
- H5_FAILED();
- fprintf(stderr," Read failed for whole array.\n");
- goto error;
+ H5_FAILED();
+ fprintf(stderr," Read failed for whole array.\n");
+ goto error;
}
for (i=0; i<nx; i++) {
- for (j=0; j<ny; j++) {
- for (k=0; k<nz; k++) {
- if (whole[i*ny*nz + j*nz + k] != buf[i*ny*nz + j*nz + k]) {
- H5_FAILED();
- fprintf(stderr," Check failed at i=%lu", (unsigned long)i);
- if (ndims > 1) {
- fprintf(stderr,", j=%lu", (unsigned long)j);
- }
- if (ndims > 2) {
- fprintf(stderr,", k=%lu", (unsigned long)k);
- }
- fprintf(stderr,"\n Check array is:\n");
- print_array(whole, nx, ny, nz);
- fprintf(stderr," Value read is:\n");
- print_array(buf, nx, ny, nz);
- goto error;
- }
- }
- }
+ for (j=0; j<ny; j++) {
+ for (k=0; k<nz; k++) {
+ if (whole[i*ny*nz + j*nz + k] != buf[i*ny*nz + j*nz + k]) {
+ H5_FAILED();
+ fprintf(stderr," Check failed at i=%lu", (unsigned long)i);
+ if (ndims > 1) {
+ fprintf(stderr,", j=%lu", (unsigned long)j);
+ }
+ if (ndims > 2) {
+ fprintf(stderr,", k=%lu", (unsigned long)k);
+ }
+ fprintf(stderr,"\n Check array is:\n");
+ print_array(whole, nx, ny, nz);
+ fprintf(stderr," Value read is:\n");
+ print_array(buf, nx, ny, nz);
+ goto error;
+ }
+ }
+ }
}
/* Close dataset's dataspace */
@@ -445,19 +443,19 @@ error:
return FAIL;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_sparse
+ * Function: test_sparse
*
- * Purpose: Creates a sparse matrix consisting of NBLOCKS randomly placed
- * blocks each of size NX,NY,NZ.
+ * Purpose: Creates a sparse matrix consisting of NBLOCKS randomly placed
+ * blocks each of size NX,NY,NZ.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: FAIL
+ * Failure: FAIL
*
- * Programmer: Robb Matzke
- * Wednesday, October 22, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 22, 1997
*
* Modifications:
*
@@ -465,34 +463,34 @@ error:
*/
static herr_t
test_sparse(hid_t f, const char *prefix, size_t nblocks,
- size_t nx, size_t ny, size_t nz, int skip_test)
+ size_t nx, size_t ny, size_t nz, int skip_test)
{
hid_t dataset; /* Dataset ID */
hid_t fspace; /* Dataset's file dataspace */
hid_t mspace; /* Dataset's memory dataspace */
- int ndims;
- hsize_t ctr;
- char dims[64], s[256], name[256];
- hsize_t offset[3];
- hsize_t size[3], total = 0;
- uint8_t *buf = NULL;
- hsize_t whole_size[3]; /* Size of dataset's dataspace */
+ int ndims;
+ hsize_t ctr;
+ char dims[64], s[256], name[256];
+ hsize_t offset[3];
+ hsize_t size[3], total = 0;
+ uint8_t *buf = NULL;
+ hsize_t whole_size[3]; /* Size of dataset's dataspace */
size_t u; /* Local index variable */
if (!nz) {
- if (!ny) {
- ndims = 1;
- ny = nz = 1;
- sprintf(dims, "%lu", (unsigned long) nx);
- } else {
- ndims = 2;
- nz = 1;
- sprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
- }
+ if (!ny) {
+ ndims = 1;
+ ny = nz = 1;
+ sprintf(dims, "%lu", (unsigned long) nx);
} else {
- ndims = 3;
- sprintf(dims, "%lux%lux%lu",
- (unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
+ ndims = 2;
+ nz = 1;
+ sprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
+ }
+ } else {
+ ndims = 3;
+ sprintf(dims, "%lux%lux%lu",
+ (unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
}
sprintf(s, "istore sparse: %s", dims);
@@ -516,8 +514,8 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks,
/* Build the new empty object */
sprintf(name, "%s_%s", prefix, dims);
if ((dataset=new_object(f, name, ndims, whole_size, chunk_dims)) < 0) {
- printf(" Cannot create %u-d object `%s'\n", ndims, name);
- goto error;
+ printf(" Cannot create %u-d object `%s'\n", ndims, name);
+ goto error;
}
/* Get dataset's dataspace */
@@ -527,36 +525,36 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks,
if((mspace=H5Screate_simple(ndims,size,NULL)) < 0) TEST_ERROR;
for (ctr=0; ctr<nblocks; ctr++) {
- offset[0] = (hsize_t)(HDrandom() % (TEST_SPARSE_SIZE-nx));
- offset[1] = (hsize_t)(HDrandom() % (TEST_SPARSE_SIZE-ny));
- offset[2] = (hsize_t)(HDrandom() % (TEST_SPARSE_SIZE-nz));
+ offset[0] = (hsize_t)(HDrandom() % (int)(TEST_SPARSE_SIZE-nx));
+ offset[1] = (hsize_t)(HDrandom() % (int)(TEST_SPARSE_SIZE-ny));
+ offset[2] = (hsize_t)(HDrandom() % (int)(TEST_SPARSE_SIZE-nz));
/* Select region in file dataspace */
if(H5Sselect_hyperslab(fspace,H5S_SELECT_SET,offset,NULL,size,NULL) < 0) TEST_ERROR;
- /* write to disk */
- if (H5Dwrite(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, buf) < 0) {
- H5_FAILED();
- printf(" Write failed: ctr=%lu\n", (unsigned long)ctr);
- printf(" offset=(%lu", (unsigned long) (offset[0]));
- if (ndims > 1)
- printf(",%lu", (unsigned long) (offset[1]));
- if (ndims > 2)
- printf(",%lu", (unsigned long) (offset[2]));
- printf("), size=(%lu", (unsigned long) (size[0]));
- if (ndims > 1)
- printf(",%lu", (unsigned long) (size[1]));
- if (ndims > 2)
- printf(",%lu", (unsigned long) (size[2]));
- printf(")\n");
- goto error;
- }
- total += nx * ny * nz;
+ /* write to disk */
+ if (H5Dwrite(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, buf) < 0) {
+ H5_FAILED();
+ printf(" Write failed: ctr=%lu\n", (unsigned long)ctr);
+ printf(" offset=(%lu", (unsigned long) (offset[0]));
+ if (ndims > 1)
+ printf(",%lu", (unsigned long) (offset[1]));
+ if (ndims > 2)
+ printf(",%lu", (unsigned long) (offset[2]));
+ printf("), size=(%lu", (unsigned long) (size[0]));
+ if (ndims > 1)
+ printf(",%lu", (unsigned long) (size[1]));
+ if (ndims > 2)
+ printf(",%lu", (unsigned long) (size[2]));
+ printf(")\n");
+ goto error;
+ }
+ total += nx * ny * nz;
#if 0
- HDfprintf(stderr,"ctr: ctr=%Zu, total=%Zu\n", ctr, total);
+ HDfprintf(stderr,"ctr: ctr=%Zu, total=%Zu\n", ctr, total);
#endif
- /* We don't test reading yet.... */
+ /* We don't test reading yet.... */
}
/* Close memory dataspace */
@@ -577,18 +575,18 @@ error:
return FAIL;
}
-
+
/*-------------------------------------------------------------------------
- * Function: main
+ * Function: main
*
- * Purpose: Tests indexed storage stuff.
+ * Purpose: Tests indexed storage stuff.
*
- * Return: Success: exit(0)
+ * Return: Success: exit(EXIT_SUCCESS)
*
- * Failure: exit(non-zero)
+ * Failure: exit(EXIT_FAILURE)
*
- * Programmer: Robb Matzke
- * Wednesday, October 15, 1997
+ * Programmer: Robb Matzke
+ * Wednesday, October 15, 1997
*
* Modifications:
*
@@ -597,12 +595,12 @@ error:
int
main(int argc, char *argv[])
{
- hid_t fapl=-1, file=-1, fcpl=-1;
- herr_t status;
- int nerrors = 0;
- unsigned size_of_test;
+ hid_t fapl=-1, file=-1, fcpl=-1;
+ herr_t status;
+ int nerrors = 0;
+ unsigned size_of_test;
unsigned u; /* Local index variable */
- char filename[1024];
+ char filename[1024];
int skip_test = 0;
int has_sparse_support = 0;
@@ -610,7 +608,7 @@ main(int argc, char *argv[])
if (1 == argc) {
size_of_test = TEST_SMALL | TEST_MEDIUM | TEST_LARGE;
} else {
- int i;
+ int i;
for (i = 1, size_of_test = 0; i < argc; i++) {
if (!strcmp(argv[i], "small")) {
size_of_test |= TEST_SMALL;
@@ -621,7 +619,7 @@ main(int argc, char *argv[])
} else {
printf("unrecognized argument: %s\n", argv[i]);
#if 0
- exit(1);
+ exit(EXIT_FAILURE);
#endif
}
}
@@ -656,7 +654,7 @@ main(int argc, char *argv[])
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) {
printf("Cannot create file %s; test aborted\n", filename);
- exit(1);
+ exit(EXIT_FAILURE);
}
/* Initialize chunk dimensions */
@@ -724,7 +722,7 @@ main(int argc, char *argv[])
if (nerrors) {
printf("***** %d I-STORE TEST%s FAILED! *****\n",
nerrors, 1 == nerrors ? "" : "S");
- exit(1);
+ exit(EXIT_FAILURE);
}
printf("All i-store tests passed.\n");
diff --git a/test/lheap.c b/test/lheap.c
index a0c1f89..4b851e8 100644
--- a/test/lheap.c
+++ b/test/lheap.c
@@ -34,36 +34,32 @@ const char *FILENAME[] = {
/*-------------------------------------------------------------------------
- * Function: main
+ * Function: main
*
- * Purpose: Create a file, create a local heap, write data into the local
- * heap, close the file, open the file, read data out of the
- * local heap, close the file.
+ * Purpose: Create a file, create a local heap, write data into the local
+ * heap, close the file, open the file, read data out of the
+ * local heap, close the file.
*
- * Return: Success: zero
+ * Return: EXIT_SUCCESS/EXIT_FAILURE
*
- * Failure: non-zero
- *
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, November 24, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
main(void)
{
- hid_t fapl=H5P_DEFAULT; /*file access properties */
- hid_t file=-1; /*hdf5 file */
- H5F_t *f=NULL; /*hdf5 file pointer */
- char filename[1024]; /*file name */
- haddr_t heap_addr; /*local heap address */
- H5HL_t *heap = NULL; /*local heap */
- size_t obj[NOBJS]; /*offsets within the heap */
- int i, j; /*miscellaneous counters */
- char buf[1024]; /*the value to store */
- const char *s; /*value to read */
+ hid_t fapl = H5P_DEFAULT; /* file access properties */
+ hid_t file = -1; /* hdf5 file */
+ H5F_t *f = NULL; /* hdf5 file pointer */
+ char filename[1024]; /* file name */
+ haddr_t heap_addr; /* local heap address */
+ H5HL_t *heap = NULL; /* local heap */
+ size_t obj[NOBJS]; /* offsets within the heap */
+ int i, j; /* miscellaneous counters */
+ char buf[1024]; /* the value to store */
+ const char *s; /* value to read */
/* Reset library */
h5_reset();
@@ -75,17 +71,17 @@ main(void)
*/
TESTING("local heap write");
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
- goto error;
+ if(FAIL == (file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)))
+ goto error;
if(NULL == (f = (H5F_t *)H5I_object(file))) {
- H5_FAILED();
- H5Eprint2(H5E_DEFAULT, stdout);
- goto error;
+ H5_FAILED();
+ H5Eprint2(H5E_DEFAULT, stdout);
+ goto error;
}
if(H5HL_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)0, &heap_addr/*out*/) < 0) {
- H5_FAILED();
- H5Eprint2(H5E_DEFAULT, stdout);
- goto error;
+ H5_FAILED();
+ H5Eprint2(H5E_DEFAULT, stdout);
+ goto error;
}
if (NULL == (heap = H5HL_protect(f, H5P_DATASET_XFER_DEFAULT, heap_addr, H5AC_WRITE))) {
H5_FAILED();
@@ -100,17 +96,18 @@ main(void)
buf[j] = '\0';
if((size_t)(-1) == (obj[i] = H5HL_insert(f, H5P_DATASET_XFER_DEFAULT, heap, strlen(buf) + 1, buf))) {
- H5_FAILED();
- H5Eprint2(H5E_DEFAULT, stdout);
- goto error;
- }
+ H5_FAILED();
+ H5Eprint2(H5E_DEFAULT, stdout);
+ goto error;
+ }
}
- if(H5HL_unprotect(heap) < 0) {
+ if(FAIL == H5HL_unprotect(heap)) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
- if (H5Fclose(file)<0) goto error;
+ if (FAIL == H5Fclose(file))
+ goto error;
PASSED();
/*
@@ -119,7 +116,8 @@ main(void)
TESTING("local heap read");
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) goto error;
+ if(FAIL == (file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)))
+ goto error;
if(NULL == (f = (H5F_t *)H5I_object(file))) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
@@ -128,11 +126,11 @@ main(void)
for(i = 0; i < NOBJS; i++) {
sprintf(buf, "%03d-", i);
for(j = 4; j < i; j++)
- buf[j] = '0' + j % 10;
+ buf[j] = (char)('0' + j % 10);
if(j > 4)
buf[j] = '\0';
- if (NULL == (heap = H5HL_protect(f, H5P_DATASET_XFER_DEFAULT, heap_addr, H5AC_READ))) {
+ if(NULL == (heap = H5HL_protect(f, H5P_DATASET_XFER_DEFAULT, heap_addr, H5AC_READ))) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
@@ -146,20 +144,21 @@ main(void)
if (strcmp(s, buf)) {
H5_FAILED();
- printf(" i=%d, heap offset=%lu\n", i, (unsigned long)(obj[i]));
- printf(" got: \"%s\"\n", s);
- printf(" ans: \"%s\"\n", buf);
+ HDprintf(" i=%d, heap offset=%lu\n", i, (unsigned long)(obj[i]));
+ HDprintf(" got: \"%s\"\n", s);
+ HDprintf(" ans: \"%s\"\n", buf);
goto error;
}
- if(H5HL_unprotect(heap) < 0) {
+ if(FAIL == H5HL_unprotect(heap)) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
}
- if (H5Fclose(file)<0) goto error;
+ if (FAIL == H5Fclose(file))
+ goto error;
PASSED();
/* Check opening existing file non-default sizes of lengths and addresses */
@@ -171,12 +170,14 @@ main(void)
if(file >= 0){
if((dset = H5Dopen2(file, "/Dataset1", H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dclose(dset) < 0) TEST_ERROR
- if(H5Fclose(file) < 0) TEST_ERROR
+ if(H5Dclose(dset) < 0)
+ TEST_ERROR
+ if(H5Fclose(file) < 0)
+ TEST_ERROR
}
else {
H5_FAILED();
- printf("***cannot open the pre-created non-default sizes test file (%s)\n",
+ HDprintf("***cannot open the pre-created non-default sizes test file (%s)\n",
testfile);
goto error;
} /* end else */
@@ -186,16 +187,16 @@ main(void)
/* Verify symbol table messages are cached */
if(h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR
- puts("All local heap tests passed.");
+ HDputs("All local heap tests passed.");
h5_cleanup(FILENAME, fapl);
- return 0;
+ return EXIT_SUCCESS;
error:
- puts("*** TESTS FAILED ***");
+ HDputs("*** TESTS FAILED ***");
H5E_BEGIN_TRY {
- H5Fclose(file);
+ H5Fclose(file);
} H5E_END_TRY;
- return 1;
+ return EXIT_FAILURE;
}
diff --git a/test/links.c b/test/links.c
index 8bf321a..595f44b 100644
--- a/test/links.c
+++ b/test/links.c
@@ -12,10 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
- * Friday, April 10, 1998
- *
- * Purpose: Tests hard, soft (symbolic) & external links.
+ * Purpose: Tests hard, soft (symbolic) & external links.
*/
/*
@@ -27,9 +24,9 @@
#include "h5test.h"
#include "H5srcdir.h"
-#include "H5Gpkg.h" /* Groups */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Lprivate.h" /* Links */
+#include "H5Gpkg.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
/* File for external link test. Created with gen_udlinks.c */
#define LINKED_FILE "be_extlink2.h5"
@@ -54,55 +51,55 @@ const char *FILENAME[] = {
"links6", /* 9 */
"links7", /* 10 */
"links8", /* 11 */
- "extlinks0", /* 12: main files */
- TMPDIR "extlinks0", /* 13: */
- "extlinks1", /* 14: target files */
- TMPDIR "extlinks1", /* 15: */
- "extlinks2", /* 16: */
- TMPDIR "extlinks2", /* 17: */
- "extlinks3", /* 18: */
- TMPDIR "extlinks3", /* 19: */
- "extlinks4", /* 20: */
- TMPDIR "extlinks4", /* 21: */
- "extlinks5", /* 22: */
- TMPDIR "extlinks6", /* 23: */
- "extlinks7", /* 24: */
- TMPDIR "extlinks7", /* 25: */
- TMPDIR "extlinks8", /* 26: */
- "extlinks9", /* 27: */
- TMPDIR "extlinks9", /* 28: */
- "extlinks10", /* 29: */ /* TESTS for windows */
- TMPDIR "extlinks10",/* 30: */
- TMPDIR "extlinks11",/* 31: */
- TMPDIR "extlinks12",/* 32: */
- "extlinks13", /* 33: */
- TMPDIR "extlinks13",/* 34: */
- TMPDIR "extlinks14",/* 35: */
- TMPDIR "extlinks15",/* 36: */
- "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */
- "extlinks16B", /* 38: */
- "extlinks17", /* 39: */
- "extlinks18A", /* 40: */
- "extlinks18B", /* 41: */
- "extlinks19A", /* 42: */
- "extlinks19B", /* 43: */
- "extlinks20", /* 44: */
- "extlinks21A", /* 45: Files for symlink() tests*/
- TMPDIR2 "extlinks21B",/* 46: */
- TMPDIR2 "extlinks21C",/* 47: */
- "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */
- TMPDIR "extlinks21D",/* 49: */
- TMPDIR "extlinks21E",/* 50: */
- "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */
+ "extlinks0", /* 12: main files */
+ TMPDIR "extlinks0", /* 13: */
+ "extlinks1", /* 14: target files */
+ TMPDIR "extlinks1", /* 15: */
+ "extlinks2", /* 16: */
+ TMPDIR "extlinks2", /* 17: */
+ "extlinks3", /* 18: */
+ TMPDIR "extlinks3", /* 19: */
+ "extlinks4", /* 20: */
+ TMPDIR "extlinks4", /* 21: */
+ "extlinks5", /* 22: */
+ TMPDIR "extlinks6", /* 23: */
+ "extlinks7", /* 24: */
+ TMPDIR "extlinks7", /* 25: */
+ TMPDIR "extlinks8", /* 26: */
+ "extlinks9", /* 27: */
+ TMPDIR "extlinks9", /* 28: */
+ "extlinks10", /* 29: */ /* TESTS for windows */
+ TMPDIR "extlinks10", /* 30: */
+ TMPDIR "extlinks11", /* 31: */
+ TMPDIR "extlinks12", /* 32: */
+ "extlinks13", /* 33: */
+ TMPDIR "extlinks13", /* 34: */
+ TMPDIR "extlinks14", /* 35: */
+ TMPDIR "extlinks15", /* 36: */
+ "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */
+ "extlinks16B", /* 38: */
+ "extlinks17", /* 39: */
+ "extlinks18A", /* 40: */
+ "extlinks18B", /* 41: */
+ "extlinks19A", /* 42: */
+ "extlinks19B", /* 43: */
+ "extlinks20", /* 44: */
+ "extlinks21A", /* 45: Files for symlink() tests*/
+ TMPDIR2 "extlinks21B", /* 46: */
+ TMPDIR2 "extlinks21C", /* 47: */
+ "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */
+ TMPDIR "extlinks21D", /* 49: */
+ TMPDIR "extlinks21E", /* 50: */
+ "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */
NULL
};
-#define FAMILY_SIZE 1024
+#define FAMILY_SIZE 1024
#define CORE_INCREMENT 1024
-#define NUM40 40
+#define NUM40 40
/* do not do check_all_closed() for "ext*" files and "tmp/ext*" */
-#define EXTSTOP 12
+#define EXTSTOP 12
#define LINK_BUF_SIZE 1024
#define NAME_BUF_SIZE 1024
@@ -134,7 +131,7 @@ const char *FILENAME[] = {
#define H5L_DIM1 100
#define H5L_DIM2 100
-#define FILTER_FILESIZE_MAX_FRACTION 0.9F
+#define FILTER_FILESIZE_MAX_FRACTION (double)0.9F
/* Creation order macros */
#define CORDER_GROUP_NAME "corder_group"
@@ -307,8 +304,10 @@ typedef struct {
const obj_visit_t *info; /* Pointer to the object visit structure to use */
} ovisit_ud_t;
+static hid_t dcpl_g; /* for [un]minimized dataset object headers */
+
+
-
/*-------------------------------------------------------------------------
* Function: fix_ext_filename
*
@@ -316,43 +315,32 @@ typedef struct {
* path name of Unix and Windows.
*
* Return: void
- *
- * Programmer: Raymond Lu
- * 14 Jan. 2009
*-------------------------------------------------------------------------
*/
static void
fix_ext_filename(char *path_name, char *cwd, const char *file_name)
{
HDstrcpy(path_name, cwd);
-
HDstrcat(path_name, "/");
HDstrcat(path_name, file_name);
}
-
+
/*-------------------------------------------------------------------------
- * Function: mklinks
+ * Function: mklinks
*
- * Purpose: Build a file with assorted links.
- *
- * Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Friday, August 14, 1998
- *
- * Modifications:
+ * Purpose: Build a file with assorted links.
*
+ * Return: Success: 0
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static int
mklinks(hid_t fapl, hbool_t new_format)
{
- hid_t file, scalar, grp, d1;
- hsize_t size[1] = {1};
- char filename[NAME_BUF_SIZE];
+ hid_t file, scalar, grp, d1;
+ hsize_t size[1] = {1};
+ char filename[NAME_BUF_SIZE];
if(new_format)
TESTING("link creation (w/new group format)")
@@ -369,7 +357,7 @@ mklinks(hid_t fapl, hbool_t new_format)
if(H5Gclose(grp) < 0) TEST_ERROR
/* Create a dataset */
- if((d1 = H5Dcreate2(file, "d1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((d1 = H5Dcreate2(file, "d1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Dclose(d1) < 0) TEST_ERROR
/* Create a hard link */
@@ -389,38 +377,31 @@ mklinks(hid_t fapl, hbool_t new_format)
if(H5Fclose(file) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
+ return FAIL;
}
-
+
/*-------------------------------------------------------------------------
* Function: new_links
*
* Purpose: Build a file with assorted links for different locations.
*
* Return: Success: 0
- *
* Failure: -1
- *
- * Programmer: Raymond Lu
- * Friday, April 19, 2002
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
new_links(hid_t fapl, hbool_t new_format)
{
- hid_t file_a, file_b=(-1);
- hid_t grp1_a=(-1), grp1_b=(-1), grp2_a=(-1), grp2_b=(-1);
- hid_t scalar=(-1);
- hid_t dset1=(-1), dset2=(-1);
- char filename[NAME_BUF_SIZE];
- hsize_t size[1] = {1};
+ hid_t file_a, file_b=(-1);
+ hid_t grp1_a=(-1), grp1_b=(-1), grp2_a=(-1), grp2_b=(-1);
+ hid_t scalar=(-1);
+ hid_t dset1=(-1), dset2=(-1);
+ char filename[NAME_BUF_SIZE];
+ hsize_t size[1] = {1};
if(new_format)
TESTING("H5Lcreate functions (w/new group format)")
@@ -443,8 +424,8 @@ new_links(hid_t fapl, hbool_t new_format)
if((grp2_b = H5Gcreate2(file_b, "grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Create datasets */
- if((dset1 = H5Dcreate2(file_a, "dataset1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((dset2 = H5Dcreate2(grp1_a, "dataset2", H5T_NATIVE_INT, scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((dset1 = H5Dcreate2(file_a, "dataset1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((dset2 = H5Dcreate2(grp1_a, "dataset2", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
/* Create links within a file. Both of source and destination use
* H5L_SAME_LOC. Both hard and soft links should fail. */
@@ -478,50 +459,43 @@ new_links(hid_t fapl, hbool_t new_format)
if(H5Fclose(file_b) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
- H5Sclose(scalar);
- H5Dclose(dset1);
- H5Dclose(dset2);
- H5Gclose(grp1_a);
- H5Gclose(grp2_a);
- H5Gclose(grp1_b);
- H5Gclose(grp2_b);
- H5Fclose(file_a);
- H5Fclose(file_b);
- } H5E_END_TRY;
- return -1;
+ H5Sclose(scalar);
+ H5Dclose(dset1);
+ H5Dclose(dset2);
+ H5Gclose(grp1_a);
+ H5Gclose(grp2_a);
+ H5Gclose(grp1_b);
+ H5Gclose(grp2_b);
+ H5Fclose(file_a);
+ H5Fclose(file_b);
+ } H5E_END_TRY;
+ return FAIL;
}
-
+
/*-------------------------------------------------------------------------
- * Function: cklinks
- *
- * Purpose: Open the file created in the first step and check that the
- * links look correct.
+ * Function: cklinks
*
- * Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Friday, August 14, 1998
- *
- * Modifications:
+ * Purpose: Open the file created in the first step and check that the
+ * links look correct.
*
+ * Return: Success: 0
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static int
cklinks(hid_t fapl, hbool_t new_format)
{
- hid_t file;
- H5O_info_t oinfo1, oinfo2;
- H5L_info_t linfo2;
- char linkval[LINK_BUF_SIZE];
- char filename[NAME_BUF_SIZE];
- herr_t status;
+ hid_t file;
+ H5O_info_t oinfo1, oinfo2;
+ H5L_info_t linfo2;
+ char linkval[LINK_BUF_SIZE];
+ char filename[NAME_BUF_SIZE];
+ herr_t status;
if(new_format)
TESTING("link queries (w/new group format)")
@@ -536,91 +510,110 @@ cklinks(hid_t fapl, hbool_t new_format)
if(H5Oget_info_by_name(file, "d1", &oinfo1, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5Oget_info_by_name(file, "grp1/hard", &oinfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5O_TYPE_DATASET != oinfo2.type) {
- H5_FAILED();
- printf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
- TEST_ERROR
+ H5_FAILED();
+ HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
+ TEST_ERROR
} /* end if */
if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) {
- H5_FAILED();
- HDputs(" Hard link test failed. Link seems not to point to the ");
- HDputs(" expected file location.");
- TEST_ERROR
+ H5_FAILED();
+ HDputs(" Hard link test failed. Link seems not to point to the ");
+ HDputs(" expected file location.");
+ TEST_ERROR
} /* end if */
+ if(H5Lexists(file, "/", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
if(H5Lexists(file, "grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
+ if(H5Lexists(file, "/grp1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
+ if(H5Lexists(file, "/grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
+ H5E_BEGIN_TRY {
+ status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(status >= 0) {
+ H5_FAILED();
+ HDputs(" H5Lexists() should have failed for a path with missing components.");
+ TEST_ERROR
+ } /* end if */
+ H5E_BEGIN_TRY {
+ status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(status >= 0) {
+ H5_FAILED();
+ HDputs(" H5Lexists() should have failed for a path with missing components.");
+ TEST_ERROR
+ } /* end if */
/* Symbolic link */
if(H5Oget_info_by_name(file, "grp1/soft", &oinfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5O_TYPE_DATASET != oinfo2.type) {
- H5_FAILED();
- printf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
- TEST_ERROR
+ H5_FAILED();
+ HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
+ TEST_ERROR
} /* end if */
if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) {
- H5_FAILED();
- HDputs(" Soft link test failed. Link seems not to point to the ");
- HDputs(" expected file location.");
- TEST_ERROR
+ H5_FAILED();
+ HDputs(" Soft link test failed. Link seems not to point to the ");
+ HDputs(" expected file location.");
+ TEST_ERROR
} /* end if */
if(H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(HDstrcmp(linkval, "/d1")) {
- H5_FAILED();
- HDputs(" Soft link test failed. Wrong link value");
- TEST_ERROR
+ H5_FAILED();
+ HDputs(" Soft link test failed. Wrong link value");
+ TEST_ERROR
} /* end if */
if(H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
/* Dangling link */
H5E_BEGIN_TRY {
- status = H5Oget_info_by_name(file, "grp1/dangle", &oinfo2, H5P_DEFAULT);
+ status = H5Oget_info_by_name(file, "grp1/dangle", &oinfo2, H5P_DEFAULT);
} H5E_END_TRY;
if(status >= 0) {
- H5_FAILED();
- HDputs(" H5Oget_info_by_name() should have failed for a dangling link.");
- TEST_ERROR
+ H5_FAILED();
+ HDputs(" H5Oget_info_by_name() should have failed for a dangling link.");
+ TEST_ERROR
} /* end if */
if(H5Lget_info(file, "grp1/dangle", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5L_TYPE_SOFT != linfo2.type) {
- H5_FAILED();
- printf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__);
- TEST_ERROR
+ H5_FAILED();
+ HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__);
+ TEST_ERROR
} /* end if */
if(H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) {
- H5_FAILED();
- printf(" %d: Can't retrieve link value\n", __LINE__);
- TEST_ERROR
+ H5_FAILED();
+ HDprintf(" %d: Can't retrieve link value\n", __LINE__);
+ TEST_ERROR
} /* end if */
if(HDstrcmp(linkval, "foobar")) {
- H5_FAILED();
- HDputs(" Dangling link test failed. Wrong link value");
- TEST_ERROR
+ H5_FAILED();
+ HDputs(" Dangling link test failed. Wrong link value");
+ TEST_ERROR
} /* end if */
if(H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
/* Recursive link */
H5E_BEGIN_TRY {
- status = H5Oget_info_by_name(file, "grp1/recursive", &oinfo2, H5P_DEFAULT);
+ status = H5Oget_info_by_name(file, "grp1/recursive", &oinfo2, H5P_DEFAULT);
} H5E_END_TRY;
if(status >= 0) {
- H5_FAILED();
- HDputs(" H5Oget_info_by_name() should have failed for a recursive link.");
- TEST_ERROR
+ H5_FAILED();
+ HDputs(" H5Oget_info_by_name() should have failed for a recursive link.");
+ TEST_ERROR
} /* end if */
if(H5Lget_info(file, "grp1/recursive", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5L_TYPE_SOFT != linfo2.type) {
- H5_FAILED();
- printf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__);
- TEST_ERROR
+ H5_FAILED();
+ HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__);
+ TEST_ERROR
} /* end if */
if(H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) {
- H5_FAILED();
- printf(" %d: Can't retrieve link value\n", __LINE__);
- TEST_ERROR
+ H5_FAILED();
+ HDprintf(" %d: Can't retrieve link value\n", __LINE__);
+ TEST_ERROR
} /* end if */
if(HDstrcmp(linkval, "/grp1/recursive")) {
- H5_FAILED();
- HDputs(" Recursive link test failed. Wrong link value");
- TEST_ERROR
+ H5_FAILED();
+ HDputs(" Recursive link test failed. Wrong link value");
+ TEST_ERROR
} /* end if */
/* Non-existent link */
@@ -630,13 +623,13 @@ cklinks(hid_t fapl, hbool_t new_format)
if(H5Fclose(file) < 0) FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
+ return FAIL;
}
-
+
/*-------------------------------------------------------------------------
* Function: ck_new_links
*
@@ -644,20 +637,15 @@ error:
* links look correct.
*
* Return: Success: 0
- *
* Failure: -1
- *
- * Programmer: Raymond Lu
- * Thursday, April 25, 2002
- *
*-------------------------------------------------------------------------
*/
static int
ck_new_links(hid_t fapl, hbool_t new_format)
{
- hid_t file;
- H5O_info_t oi_dset, oi_hard1, oi_hard2;
- char filename[NAME_BUF_SIZE];
+ hid_t file;
+ H5O_info_t oi_dset, oi_hard1, oi_hard2;
+ char filename[NAME_BUF_SIZE];
if(new_format)
TESTING("new link queries (w/new group format)")
@@ -669,62 +657,52 @@ ck_new_links(hid_t fapl, hbool_t new_format)
if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* Get hard link info */
- if(H5Oget_info_by_name(file, "/grp1/dataset2", &oi_dset, H5P_DEFAULT) < 0)
- TEST_ERROR
- if(H5Oget_info_by_name(file, "/grp1/hard1", &oi_hard1, H5P_DEFAULT) < 0)
- TEST_ERROR
- if(H5Oget_info_by_name(file, "/grp2/hard2", &oi_hard2, H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Oget_info_by_name(file, "/grp1/dataset2", &oi_dset, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name(file, "/grp1/hard1", &oi_hard1, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name(file, "/grp2/hard2", &oi_hard2, H5P_DEFAULT) < 0) TEST_ERROR
/* Check hard links */
if(H5O_TYPE_DATASET != oi_hard1.type || H5O_TYPE_DATASET != oi_hard2.type) {
- H5_FAILED();
- printf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
- TEST_ERROR
+ H5_FAILED();
+ HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
+ TEST_ERROR
}
if(H5F_addr_ne(oi_dset.addr, oi_hard1.addr) || H5F_addr_ne(oi_dset.addr, oi_hard2.addr)) {
- H5_FAILED();
- HDputs(" Hard link test failed. Link seems not to point to the ");
- HDputs(" expected file location.");
- TEST_ERROR
+ H5_FAILED();
+ HDputs(" Hard link test failed. Link seems not to point to the ");
+ HDputs(" expected file location.");
+ TEST_ERROR
}
/* Cleanup */
if(H5Fclose(file) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
+ return FAIL;
}
-
+
/*-------------------------------------------------------------------------
* Function: long_links
*
* Purpose: Build a file with long names
*
* Return: Success: 0
- *
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Saturday, April 16, 2005
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
long_links(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group ID */
- hid_t gid2 = (-1); /* Datatype ID */
- char *objname = NULL; /* Name of object [Long] */
- size_t u; /* Local index variable */
- char filename[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t gid2 = -1; /* Datatype ID */
+ char *objname = NULL; /* Name of object [Long] */
+ size_t u; /* Local index variable */
+ char filename[NAME_BUF_SIZE];
if(new_format)
TESTING("long names for objects & links (w/new group format)")
@@ -763,42 +741,35 @@ long_links(hid_t fapl, hbool_t new_format)
HDfree(objname);
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
- H5Gclose (gid2);
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid2);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
HDfree(objname);
- return -1;
+ return FAIL;
}
-
+
/*-------------------------------------------------------------------------
* Function: toomany
*
* Purpose: Build a file with too many symbolic links
*
* Return: Success: 0
- *
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Tuesday, August 9, 2005
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
toomany(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1), gid2 = (-1); /* Group IDs */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE];
if(new_format)
TESTING("too many links (w/new group format)")
@@ -888,9 +859,9 @@ toomany(hid_t fapl, hbool_t new_format)
gid = H5Gopen2(fid, "soft17", H5P_DEFAULT);
} H5E_END_TRY;
if(gid >= 0) {
- H5_FAILED();
- HDputs(" Should have failed for sequence of too many nested links.");
- TEST_ERROR
+ H5_FAILED();
+ HDputs(" Should have failed for sequence of too many nested links.");
+ TEST_ERROR
} /* end if */
/* Open object through lesser soft link */
@@ -911,18 +882,18 @@ toomany(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end toomany() */
-
+
/*-------------------------------------------------------------------------
* Function: test_lcpl
*
@@ -930,26 +901,20 @@ toomany(hid_t fapl, hbool_t new_format)
*
* Return: Success: 0
* Failure: number of errors
- *
- * Programmer: James Laird
- * Monday, January 30, 2006
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
test_lcpl(hid_t fapl, hbool_t new_format)
{
- hid_t file_id=-1;
- hid_t group_id=-1;
- hid_t space_id=-1;
- hid_t dset_id=-1;
- hid_t type_id=-1;
- hid_t lcpl_id=-1;
- H5L_info_t linfo;
- char filename[1024];
- hsize_t dims[2];
+ hid_t file_id = -1;
+ hid_t group_id = -1;
+ hid_t space_id = -1;
+ hid_t dset_id = -1;
+ hid_t type_id = -1;
+ hid_t lcpl_id = -1;
+ H5L_info_t linfo;
+ char filename[1024];
+ hsize_t dims[2];
if(new_format)
TESTING("link creation property lists (w/new group format)")
@@ -987,7 +952,7 @@ test_lcpl(hid_t fapl, hbool_t new_format)
if((space_id=H5Screate_simple(2 ,dims, NULL)) < 0) TEST_ERROR
/* Create a dataset using the default LCPL */
- if((dset_id = H5Dcreate2(file_id, "/dataset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((dset_id = H5Dcreate2(file_id, "/dataset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Dclose(dset_id) < 0) TEST_ERROR
/* Check that its character encoding is the default */
@@ -1016,7 +981,7 @@ test_lcpl(hid_t fapl, hbool_t new_format)
if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
/* Create a dataset using the new LCPL */
- if((dset_id = H5Dcreate2(file_id, "/dataset2", H5T_NATIVE_INT, space_id, lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((dset_id = H5Dcreate2(file_id, "/dataset2", H5T_NATIVE_INT, space_id, lcpl_id, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Dclose(dset_id) < 0) TEST_ERROR
/* Check that its character encoding is UTF-8 */
@@ -1068,7 +1033,7 @@ test_lcpl(hid_t fapl, hbool_t new_format)
if(H5Fclose(file_id) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -1082,29 +1047,22 @@ error:
return 1;
} /* end test_lcpl() */
-
+
/*-------------------------------------------------------------------------
* Function: test_move
*
* Purpose: Tests H5Lmove()
*
* Return: Success: 0
- *
* Failure: number of errors
- *
- * Programmer: James Laird
- * Friday, March 30, 2006
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
test_move(hid_t fapl, hbool_t new_format)
{
- hid_t file_a, file_b=(-1);
- hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1);
- char filename[1024];
+ hid_t file_a = -1, file_b = -1;
+ hid_t grp_1 = -1, grp_2 = -1, grp_move = -1, moved_grp = -1;
+ char filename[1024];
if(new_format)
TESTING("H5Lmove (w/new group format)")
@@ -1113,11 +1071,9 @@ test_move(hid_t fapl, hbool_t new_format)
/* Create two new files */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
+ if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
+ if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create groups in first file */
if((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -1125,99 +1081,75 @@ test_move(hid_t fapl, hbool_t new_format)
if((grp_move = H5Gcreate2(grp_1, "group_move", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Create hard, soft and external links. */
- if(H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
- if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
- if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Move a group within the file. Both of source and destination use
* H5L_SAME_LOC. Should fail. */
H5E_BEGIN_TRY {
- if(H5Lmove(H5L_SAME_LOC, "group_move", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT)
- !=FAIL) TEST_ERROR
+ if(H5Lmove(H5L_SAME_LOC, "group_move", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR
} H5E_END_TRY;
/* Move a group across files. Should fail. */
H5E_BEGIN_TRY {
- if(H5Lmove(grp_1, "group_move", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT)
- !=FAIL) TEST_ERROR
+ if(H5Lmove(grp_1, "group_move", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) !=FAIL) TEST_ERROR
} H5E_END_TRY;
/* Move a soft link across files. Should succeed. */
- if(H5Lmove(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
- if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE)
- TEST_ERROR
+ if(H5Lmove(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) TEST_ERROR
/* Move an external link across files. Should succeed. */
- if(H5Lmove(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
- if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE)
- TEST_ERROR
+ if(H5Lmove(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) TEST_ERROR
/* Move a group across groups in the same file while renaming it. */
- if(H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Open the group just moved to the new location. */
if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- if( H5Gclose(moved_grp) < 0)
- TEST_ERROR
+ FAIL_STACK_ERROR
+ if( H5Gclose(moved_grp) < 0) TEST_ERROR
/* Verify that the group is no longer in the original location */
H5E_BEGIN_TRY {
moved_grp = H5Gopen2(grp_1, "group_move", H5P_DEFAULT);
} H5E_END_TRY;
if(moved_grp >= 0) {
- H5_FAILED();
- HDputs(" Group still in original location?");
- TEST_ERROR
+ H5_FAILED();
+ HDputs(" Group still in original location?");
+ TEST_ERROR
} /* end if */
/* Use H5Lmove to rename a group without moving it. */
- if(H5Lmove(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lmove(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Open the group. */
- if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0)
- TEST_ERROR
+ if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(moved_grp) < 0) TEST_ERROR
/* Use H5Lmove to move a group without renaming it. */
- if(H5Lmove(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lmove(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Open the group . */
- if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0)
- TEST_ERROR
+ if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(moved_grp) < 0) TEST_ERROR
/* Move the group while giving long paths. */
- if(H5Lmove(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lmove(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Open the group just moved to the new location. */
- if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0)
- TEST_ERROR
+ if(H5Gclose(moved_grp) < 0) TEST_ERROR
/* Verify that the group is in no previous locations */
H5E_BEGIN_TRY {
- if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) >= 0)
- FAIL_STACK_ERROR
- if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) >= 0)
- FAIL_STACK_ERROR
- if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) >= 0)
- FAIL_STACK_ERROR
- if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) >= 0)
- FAIL_STACK_ERROR
+ if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR
+ if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR
+ if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR
+ if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR
} H5E_END_TRY;
H5Gclose(grp_1);
@@ -1227,44 +1159,37 @@ test_move(hid_t fapl, hbool_t new_format)
H5Fclose(file_b);
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5_FAILED();
H5E_BEGIN_TRY {
- H5Gclose(grp_1);
- H5Gclose(grp_2);
- H5Gclose(grp_move);
+ H5Gclose(grp_1);
+ H5Gclose(grp_2);
+ H5Gclose(grp_move);
H5Gclose(moved_grp);
- H5Fclose(file_a);
- H5Fclose(file_b);
+ H5Fclose(file_a);
+ H5Fclose(file_b);
} H5E_END_TRY;
return 1;
}
-
+
/*-------------------------------------------------------------------------
* Function: test_copy
*
* Purpose: Tests H5Lcopy()
*
* Return: Success: 0
- *
* Failure: number of errors
- *
- * Programmer: James Laird
- * Friday, March 30, 2006
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
test_copy(hid_t fapl, hbool_t new_format)
{
- hid_t file_a, file_b=(-1);
- hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1);
- char filename[1024];
+ hid_t file_a = -1, file_b = -1;
+ hid_t grp_1 = -1, grp_2 = -1, grp_move = -1, moved_grp = -1;
+ char filename[1024];
if(new_format)
TESTING("H5Lcopy (w/new group format)")
@@ -1273,11 +1198,9 @@ test_copy(hid_t fapl, hbool_t new_format)
/* Create two new files */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
+ if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
+ if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create groups in first file */
if((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -1285,111 +1208,76 @@ test_copy(hid_t fapl, hbool_t new_format)
if((grp_move = H5Gcreate2(grp_1, "group_copy", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Create hard, soft and external links. */
- if(H5Lcreate_hard(grp_1, "group_copy", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
- if(H5Lcreate_soft("/group1/group_copy", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
- if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lcreate_hard(grp_1, "group_copy", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft("/group1/group_copy", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Copy a group within the file. Both of source and destination use
* H5L_SAME_LOC. Should fail. */
H5E_BEGIN_TRY {
- if(H5Lcopy(H5L_SAME_LOC, "group_copy", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT)
- !=FAIL) TEST_ERROR
+ if(H5Lcopy(H5L_SAME_LOC, "group_copy", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) !=FAIL) TEST_ERROR
} H5E_END_TRY;
/* Copy a group across files. Should fail. */
H5E_BEGIN_TRY {
- if(H5Lcopy(grp_1, "group_copy", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT)
- !=FAIL) TEST_ERROR
+ if(H5Lcopy(grp_1, "group_copy", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) !=FAIL) TEST_ERROR
} H5E_END_TRY;
/* Copy a soft link across files. Should succeed. */
- if(H5Lcopy(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
- if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE)
- TEST_ERROR
+ if(H5Lcopy(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) TEST_ERROR
/* Copy an external link across files. Should succeed. */
- if(H5Lcopy(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
- if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE)
- TEST_ERROR
+ if(H5Lcopy(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) TEST_ERROR
/* Move a group across groups in the same file while renaming it. */
- if(H5Lcopy(grp_1, "group_copy", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lcopy(grp_1, "group_copy", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Open the group just moved to the new location. */
- if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0)
- TEST_ERROR
+ if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(moved_grp) < 0) TEST_ERROR
/* Verify that the group is also in the original location */
- if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0)
- TEST_ERROR
+ if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(moved_grp) < 0) TEST_ERROR
/* Use H5Lcopy to create a group in the same location with a different name. */
- if(H5Lcopy(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lcopy(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Open the group. */
- if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0)
- TEST_ERROR
+ if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(moved_grp) < 0) TEST_ERROR
/* Verify that the group is also in the original location */
- if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0)
- TEST_ERROR
+ if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(moved_grp) < 0) TEST_ERROR
/* Use H5Lcopy to copy to a different location with the same name. */
- if(H5Lcopy(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lcopy(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Open the group . */
- if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0)
- TEST_ERROR
+ if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(moved_grp) < 0) TEST_ERROR
/* Verify that the group is still in the previous location */
- if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0)
- TEST_ERROR
+ if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(moved_grp) < 0) TEST_ERROR
/* Copy the group while giving long paths. */
- if(H5Lcopy(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lcopy(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Open the group just moved to the new location. */
- if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0)
- TEST_ERROR
+ if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(moved_grp) < 0) TEST_ERROR
/* Verify that the group is still in all previous original locations */
- if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0)
- TEST_ERROR
- if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0)
- TEST_ERROR
- if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0)
- TEST_ERROR
- if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
- if(H5Gclose(moved_grp) < 0)
- TEST_ERROR
+ if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(moved_grp) < 0) TEST_ERROR
+ if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(moved_grp) < 0) TEST_ERROR
+ if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(moved_grp) < 0) TEST_ERROR
+ if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(moved_grp) < 0) TEST_ERROR
H5Gclose(grp_1);
H5Gclose(grp_2);
@@ -1398,22 +1286,22 @@ test_copy(hid_t fapl, hbool_t new_format)
H5Fclose(file_b);
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5_FAILED();
H5E_BEGIN_TRY {
- H5Gclose(grp_1);
- H5Gclose(grp_2);
- H5Gclose(grp_move);
+ H5Gclose(grp_1);
+ H5Gclose(grp_2);
+ H5Gclose(grp_move);
H5Gclose(moved_grp);
- H5Fclose(file_a);
- H5Fclose(file_b);
+ H5Fclose(file_a);
+ H5Fclose(file_b);
} H5E_END_TRY;
return 1;
}
-
+
/*-------------------------------------------------------------------------
* Function: test_move_preserves
*
@@ -1422,12 +1310,6 @@ test_copy(hid_t fapl, hbool_t new_format)
*
* Return: Success: 0
* Failure: number of errors
- *
- * Programmer: James Laird
- * Monday, January 30, 2006
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -1575,20 +1457,20 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format)
if(H5Fclose(file_id) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
- H5Pclose(fcpl_id);
- H5Pclose(lcpl_id);
- H5Pclose(lcpl2_id);
+ H5Pclose(fcpl_id);
+ H5Pclose(lcpl_id);
+ H5Pclose(lcpl2_id);
H5Gclose(group_id);
H5Fclose(file_id);
} H5E_END_TRY;
return 1;
} /* end test_move_preserves() */
-
+
/*-------------------------------------------------------------------------
* Function: test_deprec
*
@@ -1596,12 +1478,6 @@ error:
*
* Return: Success: 0
* Failure: number of errors
- *
- * Programmer: James Laird
- * Wednesday, April 26 2006
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
#ifndef H5_NO_DEPRECATED_SYMBOLS
@@ -1611,7 +1487,7 @@ test_deprec(hid_t fapl, hbool_t new_format)
hid_t file_id = -1;
hid_t group1_id = -1;
hid_t group2_id = -1;
- H5G_stat_t sb_hard1, sb_hard2, sb_soft1, sb_soft2;
+ H5G_stat_t sb_hard1, sb_hard2, sb_soft1, sb_soft2;
H5G_obj_t obj_type; /* Object type */
hsize_t num_objs; /* Number of objects in a group */
char filename[1024];
@@ -1727,7 +1603,7 @@ test_deprec(hid_t fapl, hbool_t new_format)
if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -1739,34 +1615,27 @@ error:
} /* end test_deprec() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_root
*
* Purpose: Build a file with external link to root group in external file
*
* Return: Success: 0
- *
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Wednesday, May 25, 2005
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_root(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1), gid2 = (-1); /* Group IDs */
- H5L_info_t linfo; /* Link information */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename1[NAME_BUF_SIZE];
- char filename2[NAME_BUF_SIZE];
- const char *file; /* File from external link */
- const char *path; /* Path from external link */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ H5L_info_t linfo; /* Link information */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename1[NAME_BUF_SIZE];
+ char filename2[NAME_BUF_SIZE];
+ const char *file; /* File from external link */
+ const char *path; /* Path from external link */
if(new_format)
TESTING("external link to root (w/new group format)")
@@ -1795,21 +1664,21 @@ external_link_root(hid_t fapl, hbool_t new_format)
/* Check information for external link */
if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error;
if(H5L_TYPE_EXTERNAL != linfo.type) {
- H5_FAILED();
- HDputs(" Unexpected object type - should have been an external link");
- goto error;
+ H5_FAILED();
+ HDputs(" Unexpected object type - should have been an external link");
+ goto error;
}
if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR
if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR
if(HDstrcmp(file, filename1)) {
- H5_FAILED();
- HDputs(" External link file name incorrect");
- goto error;
+ H5_FAILED();
+ HDputs(" External link file name incorrect");
+ goto error;
}
if(HDstrcmp(path, "/")) {
- H5_FAILED();
- HDputs(" External link path incorrect");
- goto error;
+ H5_FAILED();
+ HDputs(" External link path incorrect");
+ goto error;
}
/* Create external link to object in first file */
@@ -1819,28 +1688,27 @@ external_link_root(hid_t fapl, hbool_t new_format)
/* Check information for external link */
if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error;
if(H5L_TYPE_EXTERNAL != linfo.type) {
- H5_FAILED();
- HDputs(" Unexpected object type - should have been an external link");
- goto error;
+ H5_FAILED();
+ HDputs(" Unexpected object type - should have been an external link");
+ goto error;
}
if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR
if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR
if(HDstrcmp(file, filename1)) {
- H5_FAILED();
- HDputs(" External link file name incorrect");
- goto error;
+ H5_FAILED();
+ HDputs(" External link file name incorrect");
+ goto error;
}
if(HDstrcmp(path, "/")) {
- H5_FAILED();
- HDputs(" External link path incorrect");
- goto error;
+ H5_FAILED();
+ HDputs(" External link path incorrect");
+ goto error;
}
/* Close and re-open file to ensure that data is written to disk */
if(H5Fclose(fid) < 0) TEST_ERROR
if((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
-
/* Open object through external link */
if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
@@ -1912,18 +1780,18 @@ external_link_root(hid_t fapl, hbool_t new_format)
H5F_sfile_assert_num(0);
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid2);
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid2);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_root() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_path
*
@@ -1931,24 +1799,17 @@ external_link_root(hid_t fapl, hbool_t new_format)
* external file
*
* Return: Success: 0
- *
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Tuesday, July 26, 2005
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_path(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1), gid2 = (-1); /* Group IDs */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename1[NAME_BUF_SIZE];
- char filename2[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename1[NAME_BUF_SIZE];
+ char filename2[NAME_BUF_SIZE];
if(new_format)
TESTING("external link to object on path (w/new group format)")
@@ -2020,18 +1881,18 @@ external_link_path(hid_t fapl, hbool_t new_format)
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid2);
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid2);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_path() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_mult
*
@@ -2039,26 +1900,19 @@ external_link_path(hid_t fapl, hbool_t new_format)
* external file links
*
* Return: Success: 0
- *
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Tuesday, July 26, 2005
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_mult(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1), fid2 = (-1); /* File IDs */
- hid_t gid = (-1), gid2 = (-1); /* Group IDs */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- filename4[NAME_BUF_SIZE]; /* Names of files to externally link across */
+ hid_t fid = -1, fid2 = -1; /* File IDs */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE],
+ filename4[NAME_BUF_SIZE]; /* Names of files to externally link across */
if(new_format)
TESTING("external links across multiple files (w/new group format)")
@@ -2184,44 +2038,37 @@ external_link_mult(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid2);
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid2);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_mult() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_self
*
* Purpose: Build a file with external link to itself
*
* Return: Success: 0
- *
* Failure: -1
- *
- * Programmer: James Laird
- * Wednesday, July 12, 2006
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_self(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1), gid2 = (-1); /* Group IDs */
- hid_t lcpl_id = (-1); /* Link Creation Property List ID */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename1[NAME_BUF_SIZE];
- char filename2[NAME_BUF_SIZE];
- char filename3[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t lcpl_id = -1; /* Link Creation Property List ID */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename1[NAME_BUF_SIZE];
+ char filename2[NAME_BUF_SIZE];
+ char filename3[NAME_BUF_SIZE];
if(new_format)
TESTING("external link to self (w/new group format)")
@@ -2282,8 +2129,8 @@ external_link_self(hid_t fapl, hbool_t new_format)
/* Complicate things. Use this file as an intermediate file in a chain
- * of external links that will go: file2 -> file1 -> file1 -> file3
- */
+ * of external links that will go: file2 -> file1 -> file1 -> file3
+ */
/* Create file2 with an external link to file1 */
if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
@@ -2307,7 +2154,6 @@ external_link_self(hid_t fapl, hbool_t new_format)
/* Close file1 */
if(H5Fclose(fid) < 0) TEST_ERROR
-
/* Re-open file2 and traverse through file1 (with its recursive extlink) to file3 */
if((fid=H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
@@ -2332,19 +2178,19 @@ external_link_self(hid_t fapl, hbool_t new_format)
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Pclose(lcpl_id);
- H5Fclose(fid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Pclose(lcpl_id);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_self() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_pingpong
*
@@ -2372,11 +2218,11 @@ external_link_self(hid_t fapl, hbool_t new_format)
static int
external_link_pingpong(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1), gid2 = (-1); /* Group IDs */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1), gid2 = (-1); /* Group IDs */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
if(new_format)
TESTING("external links back and forth (w/new group format)")
@@ -2388,7 +2234,7 @@ external_link_pingpong(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
/* Create first file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external links for chain */
if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -2403,7 +2249,7 @@ external_link_pingpong(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
/* Create second file */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external links for chain */
if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -2415,7 +2261,7 @@ external_link_pingpong(hid_t fapl, hbool_t new_format)
/* Open first file */
- if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
/* Open object through external link */
if((gid = H5Gopen2(fid, "link1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
@@ -2436,7 +2282,6 @@ external_link_pingpong(hid_t fapl, hbool_t new_format)
/* Close first file */
if(H5Fclose(fid) < 0) TEST_ERROR
-
/* Open first file again and check on object created */
if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
@@ -2455,18 +2300,18 @@ external_link_pingpong(hid_t fapl, hbool_t new_format)
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_pingpong() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_toomany
*
@@ -2494,24 +2339,17 @@ external_link_pingpong(hid_t fapl, hbool_t new_format)
* file1:/link17 -> file2: /final
*
* Return: Success: 0
- *
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, August 8, 2005
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_toomany(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1), gid2 = (-1); /* Group IDs */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
if(new_format)
TESTING("too many external links (w/new group format)")
@@ -2546,7 +2384,7 @@ external_link_toomany(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
/* Create second file */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external links for chain */
if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -2567,16 +2405,16 @@ external_link_toomany(hid_t fapl, hbool_t new_format)
/* Open first file */
- if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
/* Open object through external link */
H5E_BEGIN_TRY {
gid = H5Gopen2(fid, "link1", H5P_DEFAULT);
} H5E_END_TRY;
if (gid >= 0) {
- H5_FAILED();
- printf("%d: Should have failed for sequence of too many nested links.", __LINE__);
- goto error;
+ H5_FAILED();
+ HDprintf("%d: Should have failed for sequence of too many nested links.", __LINE__);
+ goto error;
}
/* Open object through external link */
@@ -2598,20 +2436,19 @@ external_link_toomany(hid_t fapl, hbool_t new_format)
/* Close first file */
if(H5Fclose(fid) < 0) TEST_ERROR
-
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid2);
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid2);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_toomany() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_dangling
*
@@ -2619,25 +2456,18 @@ external_link_toomany(hid_t fapl, hbool_t new_format)
* missing files and missing objects.
*
* Return: Success: 0
- *
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Tuesday, August 9, 2005
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_dangling(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- hid_t rid = (-1); /* Root Group ID */
- hid_t status = (-1); /* Status */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ hid_t rid = -1; /* Root Group ID */
+ hid_t status = -1; /* Status */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
if(new_format)
TESTING("dangling external links (w/new group format)")
@@ -2649,7 +2479,7 @@ external_link_dangling(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
/* Create first file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create dangling external links */
if(H5Lcreate_external("missing", "/missing", fid, "no_file", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -2659,26 +2489,26 @@ external_link_dangling(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
/* Create second file (for dangling object test) */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Close file */
if(H5Fclose(fid) < 0) TEST_ERROR
/* Open first file */
- if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
/* Get root group ID */
- if((rid=H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) TEST_ERROR;
+ if((rid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) TEST_ERROR;
/* Open object through dangling file external link */
H5E_BEGIN_TRY {
gid = H5Gopen2(fid, "no_file", H5P_DEFAULT);
} H5E_END_TRY;
if (gid >= 0) {
- H5_FAILED();
- HDputs(" Should have failed for sequence of too many nested links.");
- goto error;
+ H5_FAILED();
+ HDputs(" Should have failed for sequence of too many nested links.");
+ goto error;
}
/* Open object through dangling object external link */
@@ -2686,9 +2516,9 @@ external_link_dangling(hid_t fapl, hbool_t new_format)
gid = H5Gopen2(fid, "no_object", H5P_DEFAULT);
} H5E_END_TRY;
if (gid >= 0) {
- H5_FAILED();
- HDputs(" Should have failed for sequence of too many nested links.");
- goto error;
+ H5_FAILED();
+ HDputs(" Should have failed for sequence of too many nested links.");
+ goto error;
}
/* Try to get name of object by index through dangling file external link */
@@ -2708,47 +2538,41 @@ external_link_dangling(hid_t fapl, hbool_t new_format)
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_dangling() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_prefix
*
* Purpose: 1. target link: "extlinks2"
- * 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks2"
- * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp"
- * Should be able to access the target file in tmp directory via the prefix set
- * by H5Pset_elink_prefix()
+ * 2. main file: "extlinks0"
+ * 3. target file: "tmp/extlinks2"
+ * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp"
+ * Should be able to access the target file in tmp directory via the prefix set
+ * by H5Pset_elink_prefix()
*
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Vailin Choi
- * Feb 19, 2008
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_prefix(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- hid_t gapl_id = (-1);
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ hid_t gapl_id = -1;
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE];
if(new_format)
TESTING("external links via H5Pset_elink_prefix()(w/new group format)")
@@ -2762,14 +2586,14 @@ external_link_prefix(hid_t fapl, hbool_t new_format)
/* create tmp directory and get current working directory path */
if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
+ TEST_ERROR
/* set up name for target file: "tmp/extlinks2" */
h5_fixname(FILENAME[17], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -2777,7 +2601,7 @@ external_link_prefix(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file (without the absolute path) */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -2793,9 +2617,9 @@ external_link_prefix(hid_t fapl, hbool_t new_format)
/* should be able to find the target file from pathnames set via H5Pset_elink_prefix() */
if (gid < 0) {
- H5_FAILED();
- HDputs(" Should have found the file in tmp directory.");
- goto error;
+ H5_FAILED();
+ HDputs(" Should have found the file in tmp directory.");
+ goto error;
}
/* closing for main file */
@@ -2803,45 +2627,39 @@ external_link_prefix(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_prefix() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_abs_mainpath: test 3
*
* Purpose: 1. target link: "extlinks3"
- * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: "<cur drive>:/CWD/tmp/extlinks0"
- * 3. target file: "tmp/extlinks3"
- * Should be able to access the target file via the main file's absolute path
+ * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: "<cur drive>:/CWD/tmp/extlinks0"
+ * 3. target file: "tmp/extlinks3"
+ * Should be able to access the target file via the main file's absolute path
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Vailin Choi
- * Feb 19, 2008
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE],
+ tmpname[NAME_BUF_SIZE],
+ cwdpath[NAME_BUF_SIZE];
if(new_format)
TESTING("external links via main file's absolute path (w/new group format)")
@@ -2859,7 +2677,7 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
/*
* set up name for main file:
- * Linux: "/CWD/tmp/extlinks0"
+ * Linux: "/CWD/tmp/extlinks0"
* Window: "<cur drive>:/CWD/tmp/extlinks0"
*/
fix_ext_filename(tmpname, cwdpath, FILENAME[13]);
@@ -2887,9 +2705,9 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
/* should be able to find the target file from absolute path set for main file */
if(gid < 0) {
- H5_FAILED();
- HDputs(" Should have found the file in tmp directory.");
- goto error;
+ H5_FAILED();
+ HDputs(" Should have found the file in tmp directory.");
+ goto error;
}
/* closing for main file */
@@ -2897,43 +2715,37 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_abs_mainpath() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_rel_mainpath: test 4
*
- * Purpose: 1. target link: "extlinks4"
- * 2. main file: "tmp/extlinks0"
- * 3. target file: "tmp/extlinks4"
- * Should be able to access the target file via the main file's CWD+relative path
+ * Purpose: 1. target link: "extlinks4"
+ * 2. main file: "tmp/extlinks0"
+ * 3. target file: "tmp/extlinks4"
+ * Should be able to access the target file via the main file's CWD+relative path
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Vailin Choi
- * Feb 19, 2008
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_rel_mainpath(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE];
if(new_format)
TESTING("external links via main file's CWD + relative path(w/new group format)")
@@ -2952,8 +2764,8 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[21], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -2961,7 +2773,7 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format)
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -2973,9 +2785,9 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format)
/* should be able to find the target file from the main file's relative pathname */
if (gid < 0) {
- H5_FAILED();
- HDputs(" Should have found the file in current working directory");
- goto error;
+ H5_FAILED();
+ HDputs(" Should have found the file in current working directory");
+ goto error;
}
/* closing for main file */
@@ -2983,45 +2795,37 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_rel_mainpath() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_cwd: test 5
*
* Purpose: 1. target link: "extlinks5"
- * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: "<cur drive>:/CWD/tmp/extlinks0"
- * 2. target file: "extlinks5"
- * Should be able to access the target file in the current working directory
- *
+ * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: "<cur drive>:/CWD/tmp/extlinks0"
+ * 3. target file: "extlinks5"
+ * Should be able to access the target file in the current working directory
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Vailin Choi
- * Feb 19, 2008
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_cwd(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
-
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE],
+ tmpname[NAME_BUF_SIZE],
+ cwdpath[NAME_BUF_SIZE];
if(new_format)
TESTING("external links via current working directory(w/new group format)")
@@ -3037,7 +2841,7 @@ external_link_cwd(hid_t fapl, hbool_t new_format)
/*
* set up name for main file:
- * Linux: "/CWD/tmp/extlinks0"
+ * Linux: "/CWD/tmp/extlinks0"
* Windows: "<cur drive>:/CWD/tmp/extlinks0"
*/
fix_ext_filename(tmpname, cwdpath, FILENAME[13]);
@@ -3065,9 +2869,9 @@ external_link_cwd(hid_t fapl, hbool_t new_format)
/* should be able to find the target file from the current working directory */
if(gid < 0) {
- H5_FAILED();
- HDputs(" Should have found the file in current working directory");
- goto error;
+ H5_FAILED();
+ HDputs(" Should have found the file in current working directory");
+ goto error;
}
/* closing for main file */
@@ -3075,46 +2879,39 @@ external_link_cwd(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_cwd() */
-
/*-------------------------------------------------------------------------
* Function: external_link_abstar: test 6
*
* Purpose: 1. target link: Linux:"/CWD/tmp/extlinks6"; Windows:"<cur drive>:/CWD/tmp/extlinks6"
- * 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks6"
- * Should be able to access the target file's absolute path
+ * 2. main file: "extlinks0"
+ * 3. target file: "tmp/extlinks6"
+ * Should be able to access the target file's absolute path
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Vailin Choi
- * Feb. 20, 2008
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_abstar(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group IDs */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE],
+ tmpname[NAME_BUF_SIZE],
+ cwdpath[NAME_BUF_SIZE];
if(new_format)
TESTING("external links via target's absolute path (w/new group format)")
@@ -3131,7 +2928,7 @@ external_link_abstar(hid_t fapl, hbool_t new_format)
/*
* set up name for external linked target file:
* Linux: "/CWD/tmp/extlinks6"
- * Windows: "<cur drive>:/CWD/tmp/extlinks6"
+ * Windows: "<cur drive>:/CWD/tmp/extlinks6"
*/
fix_ext_filename(tmpname, cwdpath, FILENAME[23]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
@@ -3147,7 +2944,6 @@ external_link_abstar(hid_t fapl, hbool_t new_format)
if(H5Gclose(gid) < 0) TEST_ERROR
if(H5Fclose(fid) < 0) TEST_ERROR
-
/* Create the main file */
if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
@@ -3161,9 +2957,9 @@ external_link_abstar(hid_t fapl, hbool_t new_format)
/* should be able to find the target file with abolute path */
if(gid < 0) {
- H5_FAILED();
- HDputs(" Should have found the file in tmp directory.");
- goto error;
+ H5_FAILED();
+ HDputs(" Should have found the file in tmp directory.");
+ goto error;
}
/* closing for main file */
@@ -3171,44 +2967,38 @@ external_link_abstar(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_abstar() */
/*-------------------------------------------------------------------------
* Function: external_link_abstar_cur: test 7
*
* Purpose: 1. target link: Linux: "/CWD/tmp/extlinks7"; Windows: "<cur drive>:/CWD/tmp/extlinks7"
- * 2. main file: "extlinks0"
- * 3. target file: "extlinks7"
- * Should be able to access the target file via the main file's CWD.
+ * 2. main file: "extlinks0"
+ * 3. target file: "extlinks7"
+ * Should be able to access the target file via the main file's CWD.
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Vailin Choi
- * Feb. 20, 2008
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_abstar_cur(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group IDs */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE],
+ tmpname[NAME_BUF_SIZE],
+ cwdpath[NAME_BUF_SIZE];
if(new_format)
TESTING("external links via main file's CWD (w/new group format)")
@@ -3228,7 +3018,7 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format)
/*
* set up name for external linked target file:
* Linux: "/CWD/tmp/extlinks7"
- * Windows: "<cur drive>:/CWD/tmp/extlinks7"
+ * Windows: "<cur drive>:/CWD/tmp/extlinks7"
*/
fix_ext_filename(tmpname, cwdpath, FILENAME[25]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
@@ -3241,7 +3031,6 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format)
if(H5Gclose(gid) < 0) TEST_ERROR
if(H5Fclose(fid) < 0) TEST_ERROR
-
/* Create the main file */
if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
@@ -3255,9 +3044,9 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format)
/* should be able to find the target file from main file's current working directory */
if (gid < 0) {
- H5_FAILED();
- HDputs(" Should have found the file in current working directory.");
- goto error;
+ H5_FAILED();
+ HDputs(" Should have found the file in current working directory.");
+ goto error;
}
/* closing for main file */
@@ -3265,42 +3054,36 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_abstar_cur() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_reltar: test 8
*
* Purpose: 1. target link: Linux:"tmp/extlinks8"
- * 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks8"
- * Should be able to access the target file via the main file's CWD+ target's relative path
+ * 2. main file: "extlinks0"
+ * 3. target file: "tmp/extlinks8"
+ * Should be able to access the target file via the main file's CWD+ target's relative path
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Vailin Choi
- * Feb. 20, 2008
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_reltar(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE];
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group IDs */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE];
if(new_format)
TESTING("external links via main file's CWD + target's relative path(w/new group format)")
@@ -3311,8 +3094,7 @@ external_link_reltar(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
/* create tmp directory */
- if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
+ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR
/* set up name for target file name: "tmp/extlinks8" */
/* set up name for external linked target file: "tmp/extlinks8" */
@@ -3335,9 +3117,9 @@ external_link_reltar(hid_t fapl, hbool_t new_format)
/* Open object through external link */
if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) {
- H5_FAILED();
- HDputs(" Should have found the file in tmp directory.");
- goto error;
+ H5_FAILED();
+ HDputs(" Should have found the file in tmp directory.");
+ goto error;
} /* end if */
/* closing for main file */
@@ -3345,45 +3127,39 @@ external_link_reltar(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_reltar() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_chdir: test 9
*
* Purpose:
- * 1. target link: "extlinks9"
- * 2. main file: "extlinks0"
- * 3. target file" "tmp/extlinks9"
- * 3. chdir "tmp"
- * Should be able to access the target file in current working directory
+ * 1. target link: "extlinks9"
+ * 2. main file: "extlinks0"
+ * 3. target file" "tmp/extlinks9"
+ * 3. chdir "tmp"
+ * Should be able to access the target file in current working directory
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Vailin Choi
- * Feb. 20, 2008
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_chdir(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE];
if(new_format)
TESTING("external links via chdir and found in current working directory (w/new group format)")
@@ -3396,8 +3172,7 @@ external_link_chdir(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[27], fapl, filename2, sizeof filename2);
/* create tmp directory */
- if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
+ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR
/* set up name for target file name ("tmp/extlinks9") */
h5_fixname(FILENAME[28], fapl, filename3, sizeof filename3);
@@ -3410,9 +3185,8 @@ external_link_chdir(hid_t fapl, hbool_t new_format)
if(H5Gclose(gid) < 0) TEST_ERROR
if(H5Fclose(fid) < 0) TEST_ERROR
-
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -3432,9 +3206,9 @@ external_link_chdir(hid_t fapl, hbool_t new_format)
* main file's current working directory + pathname of external linked targetfile
*/
if (gid < 0) {
- H5_FAILED();
- HDputs(" Should have found the file in tmp directory.");
- goto error;
+ H5_FAILED();
+ HDputs(" Should have found the file in tmp directory.");
+ goto error;
}
/* closing for main file */
@@ -3442,62 +3216,56 @@ external_link_chdir(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_chdir() */
-
+
/*-------------------------------------------------------------------------
* Function: external_set_elink_fapl1: test 10
*
* Purpose: To verify that the external linked target file with physical layout
- * different from the parent can be successfully opened.
- *
- * 1. target link: "extlinks16"
- * 2. target file: "extlinks16"
- * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: "<cur drive>:/CWD/tmp/extlinks0"
- * 4. Create target file A to be a "family" file: extlinks16A
- * 4. Create target file B to be a "multi" file: extlinks16B
- * 5. Create external link from main file to target file A: ext_linkA->extlinks16A:/A
- * 5. Create external link from main file to target file B: ext_linkB->extlinks16B:/B
- * 6. Should succeed in opening the target object: ext_extA
- * 6. Should succeed in opening the target object: ext_extB
+ * different from the parent can be successfully opened.
+ *
+ * 1. target link: "extlinks16"
+ * 2. target file: "extlinks16"
+ * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: "<cur drive>:/CWD/tmp/extlinks0"
+ * 4. Create target file A to be a "family" file: extlinks16A
+ * 4. Create target file B to be a "multi" file: extlinks16B
+ * 5. Create external link from main file to target file A: ext_linkA->extlinks16A:/A
+ * 5. Create external link from main file to target file B: ext_linkB->extlinks16B:/B
+ * 6. Should succeed in opening the target object: ext_extA
+ * 6. Should succeed in opening the target object: ext_extB
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Vailin Choi
- * Sept. 12, 2008
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
{
- hid_t fid=(-1);
- hid_t fidA=(-1), fidB=(-1);
- hid_t gidA=(-1), gidB=(-1);
- hid_t oidA=(-1), oidB=(-1);
- char filename1[NAME_BUF_SIZE],
- filename2A[NAME_BUF_SIZE],
- filename2B[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
- hid_t fam_fapl=-1, multi_fapl=-1;
- hid_t lapl_idA=-1, lapl_idB=-1;
- H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
- hid_t memb_fapl[H5FD_MEM_NTYPES];
- char sv[H5FD_MEM_NTYPES][500];
- const char *memb_name[H5FD_MEM_NTYPES];
- haddr_t memb_addr[H5FD_MEM_NTYPES];
+ hid_t fid=(-1);
+ hid_t fidA=(-1), fidB=(-1);
+ hid_t gidA=(-1), gidB=(-1);
+ hid_t oidA=(-1), oidB=(-1);
+ char filename1[NAME_BUF_SIZE],
+ filename2A[NAME_BUF_SIZE],
+ filename2B[NAME_BUF_SIZE],
+ tmpname[NAME_BUF_SIZE],
+ cwdpath[NAME_BUF_SIZE];
+ hid_t fam_fapl=-1, multi_fapl=-1;
+ hid_t lapl_idA=-1, lapl_idB=-1;
+ hid_t memb_fapl[H5FD_MEM_NTYPES];
+ char sv[H5FD_MEM_NTYPES][64];
+ H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
+ const char *memb_name[H5FD_MEM_NTYPES];
+ haddr_t memb_addr[H5FD_MEM_NTYPES];
if(new_format)
TESTING("H5Pset/get_elink_fapl() with different physical layouts (w/new group format)")
@@ -3505,11 +3273,11 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
TESTING("H5Pset/get_elink_fapl() with different physical layouts")
if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
- TEST_ERROR
+ TEST_ERROR
/*
* set up name for main file:
- * Linux: "/CWD/tmp/extlinks0"
+ * Linux: "/CWD/tmp/extlinks0"
* Windows: "<cur drive>:/CWD/tmp/extlinks0"
*/
fix_ext_filename(tmpname, cwdpath, FILENAME[13]);
@@ -3517,8 +3285,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
/* create "family" fapl */
fam_fapl = h5_fileaccess();
- if(H5Pset_fapl_family(fam_fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
- TEST_ERROR;
+ if(H5Pset_fapl_family(fam_fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) TEST_ERROR;
/* set up name for external linked target file A: "extlinks16A" */
/* set up name for target file A: "extlinks16A" */
@@ -3532,8 +3299,8 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
HDmemset(sv, 0, sizeof sv);
for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) {
- memb_map[mt] = H5FD_MEM_SUPER;
- memb_fapl[mt] = H5P_DEFAULT;
+ memb_map[mt] = H5FD_MEM_SUPER;
+ memb_fapl[mt] = H5P_DEFAULT;
} /* end for */
memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
@@ -3541,34 +3308,33 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP;
memb_map[H5FD_MEM_LHEAP] = H5FD_MEM_LHEAP;
- sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's');
+ HDsnprintf(sv[H5FD_MEM_SUPER], sizeof(sv[H5FD_MEM_SUPER]), "%%s-%c.h5", 's');
memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER];
memb_addr[H5FD_MEM_SUPER] = 0;
- sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b');
+ HDsnprintf(sv[H5FD_MEM_BTREE], sizeof(sv[H5FD_MEM_BTREE]), "%%s-%c.h5", 'b');
memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE];
memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/6;
- sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r');
+ HDsnprintf(sv[H5FD_MEM_DRAW], sizeof(sv[H5FD_MEM_DRAW]), "%%s-%c.h5", 'r');
memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW];
memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/3;
- sprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g');
+ HDsnprintf(sv[H5FD_MEM_GHEAP], sizeof(sv[H5FD_MEM_GHEAP]), "%%s-%c.h5", 'g');
memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP];
memb_addr[H5FD_MEM_GHEAP] = HADDR_MAX/2;
- sprintf(sv[H5FD_MEM_LHEAP], "%%s-%c.h5", 'l');
+ HDsnprintf(sv[H5FD_MEM_LHEAP], sizeof(sv[H5FD_MEM_LHEAP]), "%%s-%c.h5", 'l');
memb_name[H5FD_MEM_LHEAP] = sv[H5FD_MEM_LHEAP];
memb_addr[H5FD_MEM_LHEAP] = (HADDR_MAX/3)*2;
- sprintf(sv[H5FD_MEM_OHDR], "%%s-%c.h5", 'o');
+ HDsnprintf(sv[H5FD_MEM_OHDR], sizeof(sv[H5FD_MEM_OHDR]), "%%s-%c.h5", 'o');
memb_name[H5FD_MEM_OHDR] = sv[H5FD_MEM_OHDR];
memb_addr[H5FD_MEM_OHDR] = (HADDR_MAX/6)*5;
/* create "multi" fapl */
multi_fapl = h5_fileaccess();
- if(H5Pset_fapl_multi(multi_fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0)
- TEST_ERROR;
+ if(H5Pset_fapl_multi(multi_fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0) TEST_ERROR;
/* set up name for external linked target file B: "extlinks16B" */
/* set up name for target file B: "extlinks16B" */
@@ -3592,11 +3358,9 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file A:/A */
- if(H5Lcreate_external(filename2A, "/A", fid, "ext_linkA", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lcreate_external(filename2A, "/A", fid, "ext_linkA", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Create external link to target file B:/B */
- if(H5Lcreate_external(filename2B, "/B", fid, "ext_linkB", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lcreate_external(filename2B, "/B", fid, "ext_linkB", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Set file access property list for link access to use the family driver */
if((lapl_idA = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR
@@ -3607,9 +3371,9 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
/* should succeed in opening the target object A in the current working directory */
if (oidA < 0) {
- H5_FAILED();
- HDputs(" Should succeed in opening family target file A in current working directory");
- goto error;
+ H5_FAILED();
+ HDputs(" Should succeed in opening family target file A in current working directory");
+ goto error;
}
/* Set file access property list for link access to use the multi driver */
@@ -3621,9 +3385,9 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
/* should succeed in opening the target object B in the current working directory */
if (oidB < 0) {
- H5_FAILED();
- HDputs(" Should succeed in opening multi target file B in current working directory");
- goto error;
+ H5_FAILED();
+ HDputs(" Should succeed in opening multi target file B in current working directory");
+ goto error;
}
/* closing */
@@ -3636,67 +3400,61 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Pclose (lapl_idA);
- H5Pclose (lapl_idB);
- H5Pclose (fam_fapl);
- H5Pclose (multi_fapl);
- H5Gclose (gidA);
- H5Gclose (gidB);
- H5Oclose (oidA);
- H5Oclose (oidB);
- H5Fclose (fid);
- } H5E_END_TRY;
- return -1;
+ H5Pclose (lapl_idA);
+ H5Pclose (lapl_idB);
+ H5Pclose (fam_fapl);
+ H5Pclose (multi_fapl);
+ H5Gclose (gidA);
+ H5Gclose (gidB);
+ H5Oclose (oidA);
+ H5Oclose (oidB);
+ H5Fclose (fid);
+ } H5E_END_TRY;
+ return FAIL;
} /* end external_set_elink_fapl1() */
-
+
/*-------------------------------------------------------------------------
* Function: external_set_elink_fapl2: test 11
*
* Purpose: To verify that processing done to the external linked target object is
- * correctly handled when the parent and target files have the same
- * physical layout but different access methods.
- *
- * 1. target link: "extlinks17"
- * 2. target file: "extlinks17"
- * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: "<cur drive>:/CWD/tmp/extlinks0"
- * 4. Create target file to be a "core" file:/A/Dataset
- * 5. Create external link from main file to target file:ext_link->target file:/A/Dataset
- * 6. Set the file access property list of the link access to use "core" file without
- * backing store
- * 6. Should succeed in opening the target dataset: ext_link
- * 7. Write data to the target dataset
- * 8. On closing, the file size of target should be the same as before since
- * it is opened without backing store.
+ * correctly handled when the parent and target files have the same
+ * physical layout but different access methods.
+ *
+ * 1. target link: "extlinks17"
+ * 2. target file: "extlinks17"
+ * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: "<cur drive>:/CWD/tmp/extlinks0"
+ * 4. Create target file to be a "core" file:/A/Dataset
+ * 5. Create external link from main file to target file:ext_link->target file:/A/Dataset
+ * 6. Set the file access property list of the link access to use "core" file without
+ * backing store
+ * 7. Should succeed in opening the target dataset: ext_link
+ * 8. Write data to the target dataset
+ * 9. On closing, the file size of target should be the same as before since
+ * it is opened without backing store.
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Vailin Choi
- * Sept. 12, 2008
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- hid_t core_fapl = -1, space = -1, dset = -1, did = -1, dapl_id = -1, dcpl = -1;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
- hsize_t dims[2];
- int points[NUM40][NUM40];
- h5_stat_size_t filesize, new_filesize;
- int i, j, n;
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group IDs */
+ hid_t core_fapl = -1, space = -1, dset = -1, did = -1, dapl_id = -1, dcpl = -1;
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE],
+ tmpname[NAME_BUF_SIZE],
+ cwdpath[NAME_BUF_SIZE];
+ hsize_t dims[2];
+ int points[NUM40][NUM40];
+ int i, j, n;
+ h5_stat_size_t filesize, new_filesize;
if(new_format)
TESTING("H5Pset/get_elink_fapl() with same physical layout (w/new group format)")
@@ -3704,11 +3462,11 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
TESTING("H5Pset/get_elink_fapl() with same physical layout")
if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
- TEST_ERROR
+ TEST_ERROR
/*
* set up name for main file:
- * Linux: "/CWD/tmp/extlinks0"
+ * Linux: "/CWD/tmp/extlinks0"
* Windows: "<cur drive>:/CWD/tmp/extlinks0"
*/
fix_ext_filename(tmpname, cwdpath, FILENAME[13]);
@@ -3716,8 +3474,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
/* create fapl for the target file to be a "core" file */
core_fapl = h5_fileaccess();
- if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0)
- TEST_ERROR
+ if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0) TEST_ERROR
/* set up name for external linked target file: "extlinks17" */
/* set up name for target file: "extlinks17" */
@@ -3732,12 +3489,15 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+ if (dcpl_g == H5P_DEFAULT)
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ else
+ dcpl = H5Pcopy(dcpl_g);
+ if (0 > dcpl) TEST_ERROR;
if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) TEST_ERROR;
/* create "Dataset" in group "A" of target file */
- if((dset = H5Dcreate2(gid, "Dataset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- TEST_ERROR
+ if((dset = H5Dcreate2(gid, "Dataset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Pclose(dcpl) < 0) TEST_ERROR
@@ -3753,12 +3513,10 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file: ext_link->extlinks17:/A/Dataset */
- if(H5Lcreate_external(filename2, "/A/Dataset", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lcreate_external(filename2, "/A/Dataset", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* create fapl to be a "core" file without backing store */
- if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, FALSE) < 0)
- TEST_ERROR
+ if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, FALSE) < 0) TEST_ERROR
/* Set file access property list for link access to use the "core" driver */
if((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR
@@ -3767,9 +3525,9 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
/* try to open the external linked target dataset */
did = H5Dopen2(fid, "ext_link", dapl_id);
if(did < 0) {
- H5_FAILED();
- HDputs(" Should succeed in opening the target dataset");
- goto error;
+ H5_FAILED();
+ HDputs(" Should succeed in opening the target dataset");
+ goto error;
}
/* Initialize the dataset */
@@ -3778,8 +3536,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
points[i][j] = n++;
/* Write the data to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
- TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR
if(H5Pclose(dapl_id) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
@@ -3793,60 +3550,53 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
if(H5Pclose(core_fapl) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Pclose(dcpl);
- H5Sclose(space);
- H5Dclose(dset);
- H5Pclose(core_fapl);
- H5Pclose(dapl_id);
- H5Dclose(did);
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Pclose(dcpl);
+ H5Sclose(space);
+ H5Dclose(dset);
+ H5Pclose(core_fapl);
+ H5Pclose(dapl_id);
+ H5Dclose(did);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_set_elink_fapl2() */
-
+
/*-------------------------------------------------------------------------
* Function: external_set_elink_fapl3: test 12
*
* Purpose: To verify that the file access property list for link access is
- * set and closed correctly.
- *
- * 1. Create fapl for core driver
- * 2. Create fapl for stdio driver
- * 3. Set link access's fapl to use stdio driver
- * 4. Verify that link access's fapl is the stdio driver
- * 5. Reset the link access' fapl to use core driver
- * 6. H5Pcopy() the link access
- * 7. Get the fapl property value of the original link access
- * 8. Close the original link access
- * 9. H5Pclose() fapl should fail since closing in step #8 should also close its fapl
- * 10. Verify that the copied link access's fapl is the core driver
- * 11. Get the fapl property value of the copied link access
- * 12. H5Premove() the fapl property from the copied link access
- * 13. H5Pclose() fapl set in the copied link access should fail since the
- * removal in #12 should also close its fapl
+ * set and closed correctly.
+ *
+ * 1. Create fapl for core driver
+ * 2. Create fapl for stdio driver
+ * 3. Set link access's fapl to use stdio driver
+ * 4. Verify that link access's fapl is the stdio driver
+ * 5. Reset the link access' fapl to use core driver
+ * 6. H5Pcopy() the link access
+ * 7. Get the fapl property value of the original link access
+ * 8. Close the original link access
+ * 9. H5Pclose() fapl should fail since closing in step #8 should also close its fapl
+ * 10. Verify that the copied link access's fapl is the core driver
+ * 11. Get the fapl property value of the copied link access
+ * 12. H5Premove() the fapl property from the copied link access
+ * 13. H5Pclose() fapl set in the copied link access should fail since the
+ * removal in #12 should also close its fapl
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Vailin Choi
- * Sept. 12, 2008
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_set_elink_fapl3(hbool_t new_format)
{
- hid_t core_fapl = -1, stdio_fapl = -1;
- hid_t lapl_id = -1, new_lapl_id = -1, l_fapl = -1, out_fapl;
- int ret;
+ hid_t core_fapl = -1, stdio_fapl = -1;
+ hid_t lapl_id = -1, new_lapl_id = -1, l_fapl = -1, out_fapl;
if(new_format)
TESTING("H5Pset/get_fapl() (w/new group format)")
@@ -3855,12 +3605,10 @@ external_set_elink_fapl3(hbool_t new_format)
/* create fapl for the target file to be a "core" file */
core_fapl = h5_fileaccess();
- if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0)
- TEST_ERROR
+ if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0) TEST_ERROR
stdio_fapl = h5_fileaccess();
- if(H5Pset_fapl_stdio(stdio_fapl) < 0)
- TEST_ERROR
+ if(H5Pset_fapl_stdio(stdio_fapl) < 0) TEST_ERROR
/* Set file access property list for link access to use the "stdio" driver */
if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR
@@ -3881,11 +3629,8 @@ external_set_elink_fapl3(hbool_t new_format)
if(H5Pget(lapl_id, "external link fapl", &out_fapl) < 0) TEST_ERROR
if(H5Pclose(lapl_id) < 0) TEST_ERROR
- /* Try closing out_fapl should fail since H5Pclose(lapl_id) should also close its fapl */
- H5E_BEGIN_TRY {
- ret = H5Pclose(out_fapl);
- } H5E_END_TRY;
- if(ret != FAIL) TEST_ERROR
+ /* Try closing out_fapl, should succeed since H5Pget() should clone its fapl */
+ if(H5Pclose(out_fapl) < 0) TEST_ERROR
/* Verify that the driver for the copied link's fapl is the "core" driver */
if((l_fapl = H5Pget_elink_fapl(new_lapl_id)) < 0) TEST_ERROR
@@ -3895,11 +3640,8 @@ external_set_elink_fapl3(hbool_t new_format)
if(H5Pget(new_lapl_id, "external link fapl", &out_fapl) < 0) TEST_ERROR
if(H5Premove(new_lapl_id, "external link fapl") < 0) TEST_ERROR
- /* Try closing out_fapl should fail since the property is removed from new_lapl_id */
- H5E_BEGIN_TRY {
- ret = H5Pclose(out_fapl);
- } H5E_END_TRY;
- if(ret != FAIL) TEST_ERROR
+ /* Try closing out_fapl, should succeed since H5Pget() should clone its fapl */
+ if(H5Pclose(out_fapl) < 0) TEST_ERROR
if(H5Pclose(l_fapl) < 0) TEST_ERROR
if(H5Pclose(new_lapl_id) < 0) TEST_ERROR
@@ -3907,20 +3649,20 @@ external_set_elink_fapl3(hbool_t new_format)
if(H5Pclose(stdio_fapl) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Pclose(l_fapl);
- H5Pclose(lapl_id);
- H5Pclose(new_lapl_id);
- H5Pclose(core_fapl);
- H5Pclose(stdio_fapl);
+ H5Pclose(l_fapl);
+ H5Pclose(lapl_id);
+ H5Pclose(new_lapl_id);
+ H5Pclose(core_fapl);
+ H5Pclose(stdio_fapl);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_set_elink_fapl3() */
-
+
/*-------------------------------------------------------------------------
* Function: external_set_elink_acc_flags
*
@@ -3928,12 +3670,6 @@ external_set_elink_fapl3(hbool_t new_format)
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Neil Fortner
- * Jan. 5, 2009
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -4035,9 +3771,9 @@ external_set_elink_acc_flags(hid_t fapl, hbool_t new_format)
if(H5Pclose(gapl) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
H5Gclose(group);
H5Gclose(subgroup);
@@ -4045,10 +3781,10 @@ external_set_elink_acc_flags(hid_t fapl, hbool_t new_format)
H5Fclose(file2);
H5Pclose(gapl);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_set_elink_acc_flags() */
-
+
/*-------------------------------------------------------------------------
* Function: external_set_elink_cb
*
@@ -4056,12 +3792,6 @@ external_set_elink_acc_flags(hid_t fapl, hbool_t new_format)
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Neil Fortner
- * Jan. 5, 2009
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
/* User data structure for callback function */
@@ -4099,7 +3829,7 @@ external_set_elink_cb_cb(const char *parent_file, const char *parent_group,
if (op_data->code == 2)
*flags = H5F_ACC_DEFAULT;
- return 0;
+ return SUCCEED;
}
/* Main test function */
@@ -4108,7 +3838,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format)
{
hid_t file1 = -1, file2 = -1, group = -1, gapl = -1, fam_fapl = -1, ret_fapl = -1, base_driver;
set_elink_cb_t op_data,
- *op_data_p;
+ *op_data_p;
H5L_elink_traverse_t cb;
char filename1[NAME_BUF_SIZE],
filename2[NAME_BUF_SIZE];
@@ -4124,7 +3854,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format)
op_data.target_file = filename2;
/* Core file driver has issues when used as the member file driver for a family file */
/* Family file driver cannot be used with family or multi drivers for member files */
- /* Also disable parallel member drivers, because H5F_HAS_FEATURE(H5FD_FEAT_HAS_MPI)
+ /* Also disable parallel member drivers, because H5F_HAS_FEATURE(H5FD_FEAT_HAS_MPI)
would report FALSE, causing problems */
base_driver = H5Pget_driver(fapl);
op_data.base_fapl = (base_driver == H5FD_FAMILY || base_driver == H5FD_MULTI
@@ -4201,9 +3931,9 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format)
if(H5Pclose(gapl) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
H5Gclose(group);
H5Fclose(file1);
@@ -4212,10 +3942,10 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format)
H5Pclose(ret_fapl);
H5Pclose(fam_fapl);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_set_elink_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: external_reset_register
*
@@ -4224,12 +3954,6 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format)
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Neil Fortner
- * Apr. 9, 2009
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -4267,47 +3991,41 @@ external_reset_register(void)
if(HDremove(filename) != 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_reset_register() */
-
+
#ifdef H5_HAVE_WINDOW_PATH
/*-------------------------------------------------------------------------
* Function: external_link_win1
*
* Purpose:
- * 1. target link: "/CWD/tmp/extlinks10"
- * 2. main file: "extlinks0"
- * 3. target file: "extlinks10"
- * Should be able to find the target file via main file's current drive/rel path
+ * 1. target link: "/CWD/tmp/extlinks10"
+ * 2. main file: "extlinks0"
+ * 3. target file: "extlinks10"
+ * Should be able to find the target file via main file's current drive/rel path
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Vailin Choi
- * April 15, 2008
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_win1(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE],
+ tmpname[NAME_BUF_SIZE],
+ cwdpath[NAME_BUF_SIZE];
if(new_format)
TESTING("external links via main file's current drive/rel path(windows)(w/new group format)")
@@ -4337,7 +4055,6 @@ external_link_win1(hid_t fapl, hbool_t new_format)
if(H5Gclose(gid) < 0) TEST_ERROR
if(H5Fclose(fid) < 0) TEST_ERROR
-
/* Create the main file */
if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
@@ -4351,9 +4068,9 @@ external_link_win1(hid_t fapl, hbool_t new_format)
/* should be able to find the target file via main file's CWD*/
if(gid < 0) {
- H5_FAILED();
- HDputs(" Should have found the file in CWD.");
- goto error;
+ H5_FAILED();
+ HDputs(" Should have found the file in CWD.");
+ goto error;
}
/* closing for main file */
@@ -4361,46 +4078,40 @@ external_link_win1(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_win1() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_win2
*
* Purpose:
- * 1. target link: "/CWD/tmp/extlinks11"
- * 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks11"
- * Should be able to access the target file directly (rel drive/abs path)
+ * 1. target link: "/CWD/tmp/extlinks11"
+ * 2. main file: "extlinks0"
+ * 3. target file: "tmp/extlinks11"
+ * Should be able to access the target file directly (rel drive/abs path)
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Vailin Choi
- * April 15, 2008
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_win2(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE],
+ tmpname[NAME_BUF_SIZE],
+ cwdpath[NAME_BUF_SIZE];
if(new_format)
TESTING("external links via target's rel drive/abs path directly(windows)(w/new group format)")
@@ -4445,9 +4156,9 @@ external_link_win2(hid_t fapl, hbool_t new_format)
/* should be able to find the target file directly */
if(gid < 0) {
- H5_FAILED();
- HDputs(" Should have found the file in tmp.");
- goto error;
+ H5_FAILED();
+ HDputs(" Should have found the file in tmp.");
+ goto error;
}
/* closing for main file */
@@ -4455,46 +4166,40 @@ external_link_win2(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_win2() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_win3
*
* Purpose:
- * 1. target link: "<cur drive>:tmp/extlinks12"
- * 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks12"
- * Should be able to access the target file directly (abs drive/rel path)
+ * 1. target link: "<cur drive>:tmp/extlinks12"
+ * 2. main file: "extlinks0"
+ * 3. target file: "tmp/extlinks12"
+ * Should be able to access the target file directly (abs drive/rel path)
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Vailin Choi
- * April i15 2008
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_win3(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- int drive=0;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ int drive = 0;
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE],
+ tmpname[NAME_BUF_SIZE];
if(new_format)
TESTING("external links via target's abs drive/rel path directly (windows)(w/new group format)")
@@ -4510,7 +4215,7 @@ external_link_win3(hid_t fapl, hbool_t new_format)
/* set up name for target link: "<drive-letter>:tmp/extlinks12" */
drive = HDgetdrive();
- sprintf(tmpname, "%c:%s", (drive+'A'-1), FILENAME[32]);
+ HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[32]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
/* set up name for target file: "tmp/extlinks12" */
@@ -4538,9 +4243,9 @@ external_link_win3(hid_t fapl, hbool_t new_format)
/* should be able to find the target file directly */
if (gid < 0) {
- H5_FAILED();
- HDputs(" Should have found the file in tmp.");
- goto error;
+ H5_FAILED();
+ HDputs(" Should have found the file in tmp.");
+ goto error;
}
/* closing for main file */
@@ -4548,45 +4253,39 @@ external_link_win3(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_win3() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_win4
*
* Purpose:
- * 1. target link: "<cur drive>:extlinks13"
- * 2. main file: "<cur-drive>:tmp/extlinks0"
- * 3. target file: tmp/extlinks13
- * Should be able to access the target file via main file's abs drive/rel path
+ * 1. target link: "<cur drive>:extlinks13"
+ * 2. main file: "<cur-drive>:tmp/extlinks0"
+ * 3. target file: tmp/extlinks13
+ * Should be able to access the target file via main file's abs drive/rel path
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Vailin Choi
- * April 15, 2008
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_win4(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- int drive=0;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ int drive=0;
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE],
+ tmpname[NAME_BUF_SIZE];
if(new_format)
TESTING("external links via main file's abs drive/rel path (windows)(w/new group format)")
@@ -4595,27 +4294,26 @@ external_link_win4(hid_t fapl, hbool_t new_format)
/* set up name for main file: "<drive-letter>:tmp/extlinks0" */
drive = HDgetdrive();
- sprintf(tmpname, "%c:%s", (drive+'A'-1), FILENAME[13]);
+ HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[13]);
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
/* set up name for target link: "<drive-letter>:extlinks13" */
- sprintf(tmpname, "%c:%s", (drive+'A'-1), FILENAME[33]);
+ HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[33]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
/* set up name for target file: "tmp/extlinks13" */
h5_fixname(FILENAME[34], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
if(H5Fclose(fid) < 0) TEST_ERROR
-
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -4627,9 +4325,9 @@ external_link_win4(hid_t fapl, hbool_t new_format)
/* should be able to find the target file via main file's absolute drive/relative path */
if (gid < 0) {
- H5_FAILED();
- HDputs(" Should have found the file in CWD.");
- goto error;
+ H5_FAILED();
+ HDputs(" Should have found the file in CWD.");
+ goto error;
}
/* closing for main file */
@@ -4637,47 +4335,41 @@ external_link_win4(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_win4() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_win5
*
* Purpose:
- * 1. target link: "<cur drive+1>:tmp/extlinks14"
- * 2. main file: "/CWD/extlinks0"
- * 3. target file: "tmp/extlinks14"
- * Should be able to access the target file via main file's relative drive/absolute path
+ * 1. target link: "<cur drive+1>:tmp/extlinks14"
+ * 2. main file: "/CWD/extlinks0"
+ * 3. target file: "tmp/extlinks14"
+ * Should be able to access the target file via main file's relative drive/absolute path
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Vailin Choi
- * April 15, 2008
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_win5(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- int drive=0;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ int drive=0;
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE],
+ tmpname[NAME_BUF_SIZE],
+ cwdpath[NAME_BUF_SIZE];
if(new_format)
TESTING("external links via main file's rel drive/abs path (windows)(w/new group format)")
@@ -4699,7 +4391,7 @@ external_link_win5(hid_t fapl, hbool_t new_format)
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
/* set up name for target link: "<drive-letter+1>:tmp/extlinks14" */
- sprintf(tmpname, "%c:%s", (drive+'A'-1), FILENAME[35]);
+ HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[35]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
/* set up name for target file: "tmp/extlinks14" */
@@ -4713,7 +4405,6 @@ external_link_win5(hid_t fapl, hbool_t new_format)
if(H5Gclose(gid) < 0) TEST_ERROR
if(H5Fclose(fid) < 0) TEST_ERROR
-
/* Create the main file */
if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
@@ -4727,9 +4418,9 @@ external_link_win5(hid_t fapl, hbool_t new_format)
/* should be able to find the target file via main file's rel drive/abs path */
if(gid < 0) {
- H5_FAILED();
- HDputs(" Should have found the file in CWD.");
- goto error;
+ H5_FAILED();
+ HDputs(" Should have found the file in CWD.");
+ goto error;
}
/* closing for main file */
@@ -4737,46 +4428,40 @@ external_link_win5(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_win5() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_win6
*
* Purpose:
- * 1. target link: "<cur drive+1>:tmp/extlinks15"
- * 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks15"
- * Should be able to access the target file via target's current drive/rel path
+ * 1. target link: "<cur drive+1>:tmp/extlinks15"
+ * 2. main file: "extlinks0"
+ * 3. target file: "tmp/extlinks15"
+ * Should be able to access the target file via target's current drive/rel path
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Vailin Choi
- * April 15, 2008
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_win6(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- int drive=0;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ int drive=0;
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE],
+ tmpname[NAME_BUF_SIZE];
if(new_format)
TESTING("external links via target's current drive/rel path (windows)(w/new group format)")
@@ -4796,23 +4481,22 @@ external_link_win6(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
/* set up name for target link: "<drive-letter+1>:tmp/extlinks15" */
- sprintf(tmpname, "%c:%s", (drive+'A'-1), FILENAME[36]);
+ HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[36]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
/* set up name for target file: "tmp/extlinks15" */
h5_fixname(FILENAME[36], fapl, filename3, sizeof filename3);
/* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* closing for target file */
if(H5Gclose(gid) < 0) TEST_ERROR
if(H5Fclose(fid) < 0) TEST_ERROR
-
/* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link to target file */
if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -4824,9 +4508,9 @@ external_link_win6(hid_t fapl, hbool_t new_format)
/* should be able to find the target file via target file's rel path in current drive */
if (gid < 0) {
- H5_FAILED();
- HDputs(" Should have found the file in tmp.");
- goto error;
+ H5_FAILED();
+ HDputs(" Should have found the file in tmp.");
+ goto error;
}
/* closing for main file */
@@ -4834,17 +4518,17 @@ external_link_win6(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_win6() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_win7
*
@@ -4852,7 +4536,7 @@ external_link_win6(hid_t fapl, hbool_t new_format)
* 1. UNC target link: "\\127.0.01\c$/tmp/extlinks10"
* 2. main file: "extlinks0"
* 3. target file: "extlinks15"
- * Should be able to find the target file via main file's local host/main drive/rel path
+ * Should be able to find the target file via main file's local host/main drive/rel path
*
* Return: Success: 0
* Failure: -1
@@ -4861,8 +4545,8 @@ external_link_win6(hid_t fapl, hbool_t new_format)
static int
external_link_win7(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
char filename1[NAME_BUF_SIZE],
filename2[NAME_BUF_SIZE],
filename3[NAME_BUF_SIZE],
@@ -4897,7 +4581,6 @@ external_link_win7(hid_t fapl, hbool_t new_format)
if(H5Gclose(gid) < 0) TEST_ERROR
if(H5Fclose(fid) < 0) TEST_ERROR
-
/* Create the main file */
if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
@@ -4921,17 +4604,17 @@ external_link_win7(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_win7() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_win8
*
@@ -4939,7 +4622,7 @@ external_link_win7(hid_t fapl, hbool_t new_format)
* 1. Long UNC target link: "\\?\<cur drive>:\CWD\extlinks10"
* 2. main file: "extlinks0"
* 3. target file: "extlinks10"
- * Should be able to access the target file directly (abs drive/abs path)
+ * Should be able to access the target file directly (abs drive/abs path)
*
* Return: Success: 0
* Failure: -1
@@ -4949,9 +4632,9 @@ external_link_win7(hid_t fapl, hbool_t new_format)
static int
external_link_win8(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- int drive=0;
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ int drive = 0;
char filename1[NAME_BUF_SIZE],
filename2[NAME_BUF_SIZE],
filename3[NAME_BUF_SIZE],
@@ -4966,16 +4649,14 @@ external_link_win8(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
- TEST_ERROR
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR
/* create tmp directory */
- if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
+ if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR
/* set up name for target link: "<drive-letter>:\CWD\extlinks10" */
drive = HDgetdrive();
- sprintf(tmpname, "\\\\?\\%c:%s\\%s", (drive+'A'-1), &cwdpath[2], FILENAME[30]);
+ HDsnprintf(tmpname, sizeof(tmpname), "\\\\?\\%c:%s\\%s", (drive+'A'-1), &cwdpath[2], FILENAME[30]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
/* set up name for target file: "extlinks10" */
@@ -4989,7 +4670,6 @@ external_link_win8(hid_t fapl, hbool_t new_format)
if(H5Gclose(gid) < 0) TEST_ERROR
if(H5Fclose(fid) < 0) TEST_ERROR
-
/* Create the main file */
if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
@@ -5013,17 +4693,17 @@ external_link_win8(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_win8() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_win9
*
@@ -5031,7 +4711,7 @@ external_link_win8(hid_t fapl, hbool_t new_format)
* 1. Long UNC target link: "\\?\UNC\127.0.01\c$/tmp/extlinks10"
* 2. main file: "extlinks0"
* 3. target file: "extlinks15"
- * Should be able to find the target file via main file's local host/main drive/rel path
+ * Should be able to find the target file via main file's local host/main drive/rel path
*
* Return: Success: 0
* Failure: -1
@@ -5040,13 +4720,13 @@ external_link_win8(hid_t fapl, hbool_t new_format)
static int
external_link_win9(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
char filename1[NAME_BUF_SIZE],
filename2[NAME_BUF_SIZE],
filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
+ tmpname[NAME_BUF_SIZE],
+ cwdpath[NAME_BUF_SIZE];
if(new_format)
TESTING("external links via main file's Long UNC local host/main drive/rel path(windows)(w/new group format)")
@@ -5056,8 +4736,7 @@ external_link_win9(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
- TEST_ERROR
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR
/* set up name for target link: "\\?\UNC\127.0.0.1\c$/tmp/extlinks10" */
HDstrcpy(tmpname, "\\\\?\\UNC\127.0.0.1\\c$"); /* absolute path */
@@ -5076,7 +4755,6 @@ external_link_win9(hid_t fapl, hbool_t new_format)
if(H5Gclose(gid) < 0) TEST_ERROR
if(H5Fclose(fid) < 0) TEST_ERROR
-
/* Create the main file */
if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
@@ -5100,19 +4778,19 @@ external_link_win9(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_win9() */
#endif /* H5_HAVE_WINDOW_PATH */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_recursive
*
@@ -5120,20 +4798,14 @@ external_link_win9(hid_t fapl, hbool_t new_format)
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, August 15, 2005
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_recursive(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE]; /* Names of files to externally link across */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ char filename1[NAME_BUF_SIZE]; /* Names of files to externally link across */
if(new_format)
TESTING("recursive external links (w/new group format)")
@@ -5144,7 +4816,7 @@ external_link_recursive(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1);
/* Create first file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create recursive external links */
if(H5Lcreate_external(filename1, "/recursive", fid, "recursive", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -5152,36 +4824,34 @@ external_link_recursive(hid_t fapl, hbool_t new_format)
/* Close file */
if(H5Fclose(fid) < 0) TEST_ERROR
-
/* Open file */
- if((fid=H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* Open object through dangling file external link */
H5E_BEGIN_TRY {
gid = H5Gopen2(fid, "recursive", H5P_DEFAULT);
} H5E_END_TRY;
if (gid >= 0) {
- H5_FAILED();
- HDputs(" Should have failed for recursive external links.");
- goto error;
+ H5_FAILED();
+ HDputs(" Should have failed for recursive external links.");
+ goto error;
}
/* Close first file */
if(H5Fclose(fid) < 0) TEST_ERROR
-
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_recursive() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_query
*
@@ -5190,25 +4860,19 @@ external_link_recursive(hid_t fapl, hbool_t new_format)
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, August 15, 2005
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_link_query(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
const char *file_name; /* Name of the file the external link points to */
const char *object_name; /* Name of the object the external link points to */
- H5O_info_t oi; /* Object information */
+ H5O_info_t oi; /* Object information */
H5L_info_t li; /* Link information */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE], /* Names of files to externally link across */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE], /* Names of files to externally link across */
query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */
if(new_format)
@@ -5221,7 +4885,7 @@ external_link_query(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
/* Create first file, with external link to object in second file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create external link */
/* (add a few extra '/'s to make certain library normalizes external link object names) */
@@ -5231,16 +4895,16 @@ external_link_query(hid_t fapl, hbool_t new_format)
if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR
if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR
if (H5L_TYPE_EXTERNAL != li.type) {
- H5_FAILED();
- HDputs(" Unexpected link class - should have been an external link");
- goto error;
+ H5_FAILED();
+ HDputs(" Unexpected link class - should have been an external link");
+ goto error;
}
/* Close file */
if(H5Fclose(fid) < 0) TEST_ERROR
/* Create second file to point to */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create object to link to */
if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -5249,7 +4913,6 @@ external_link_query(hid_t fapl, hbool_t new_format)
/* Close file */
if(H5Fclose(fid) < 0) TEST_ERROR
-
/* Open first file */
if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
@@ -5257,9 +4920,9 @@ external_link_query(hid_t fapl, hbool_t new_format)
if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR
if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR
if(H5L_TYPE_EXTERNAL != li.type) {
- H5_FAILED();
- HDputs(" Unexpected link class - should have been an external link");
- goto error;
+ H5_FAILED();
+ HDputs(" Unexpected link class - should have been an external link");
+ goto error;
}
/* Get information for external link. It should be two strings right after each other */
@@ -5275,9 +4938,9 @@ external_link_query(hid_t fapl, hbool_t new_format)
/* Query information about object that external link points to */
if(H5Oget_info_by_name(fid, "src", &oi, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5O_TYPE_GROUP != oi.type) {
- H5_FAILED();
- HDputs(" Unexpected object type - should have been a group");
- goto error;
+ H5_FAILED();
+ HDputs(" Unexpected object type - should have been a group");
+ goto error;
}
/* Close first file */
@@ -5288,30 +4951,30 @@ external_link_query(hid_t fapl, hbool_t new_format)
/* Make sure that bogus cases trigger errors in H5Lunpack_elink_val */
H5E_BEGIN_TRY {
- if(H5Lunpack_elink_val(query_buf, li.u.val_size - 1, NULL, NULL, NULL) >= 0) TEST_ERROR
+ if(H5Lunpack_elink_val(query_buf, li.u.val_size - 1, NULL, NULL, NULL) >= 0) TEST_ERROR
} H5E_END_TRY
H5E_BEGIN_TRY {
- if(H5Lunpack_elink_val(query_buf, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR
+ if(H5Lunpack_elink_val(query_buf, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR
} H5E_END_TRY
H5E_BEGIN_TRY {
- if(H5Lunpack_elink_val(NULL, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR
+ if(H5Lunpack_elink_val(NULL, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR
} H5E_END_TRY
H5E_BEGIN_TRY {
- if(H5Lunpack_elink_val(NULL, (size_t)1000, NULL, NULL, NULL) >= 0) TEST_ERROR
+ if(H5Lunpack_elink_val(NULL, (size_t)1000, NULL, NULL, NULL) >= 0) TEST_ERROR
} H5E_END_TRY
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_query() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_unlink_compact
*
@@ -5319,19 +4982,15 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Wednesday, January 18, 2006
- *
*-------------------------------------------------------------------------
*/
static int
external_link_unlink_compact(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1), gid2 = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
if(new_format)
TESTING("unlinking external link in compact group (w/new group format)")
@@ -5361,9 +5020,6 @@ external_link_unlink_compact(hid_t fapl, hbool_t new_format)
/* Close file */
if(H5Fclose(fid) < 0) TEST_ERROR
-
-/* Unlink external link */
-
/* Open first file */
if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
@@ -5386,18 +5042,18 @@ external_link_unlink_compact(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_unlink_compact() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_unlink_dense
*
@@ -5405,25 +5061,21 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Wednesday, January 18, 2006
- *
*-------------------------------------------------------------------------
*/
static int
external_link_unlink_dense(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gcpl = (-1); /* Group creation property list ID */
- hid_t gid = (-1), gid2 = (-1); /* Group IDs */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
- unsigned nmsgs; /* Number of messages in group's header */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- unsigned u; /* Local index variable */
+ hid_t fid = -1; /* File ID */
+ hid_t gcpl = -1; /* Group creation property list ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
+ unsigned nmsgs; /* Number of messages in group's header */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ unsigned u; /* Local index variable */
if(new_format)
TESTING("unlinking external link in dense group (w/new group format)")
@@ -5459,7 +5111,7 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format)
/* Create enough objects in the root group to change it into a "dense" group */
for(u = 0; u < max_compact; u++) {
- sprintf(objname, "filler %u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %u", u);
if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Gclose(gid2) < 0) TEST_ERROR
} /* end for */
@@ -5488,9 +5140,6 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format)
/* Close file */
if(H5Fclose(fid) < 0) TEST_ERROR
-
-/* Unlink external link */
-
/* Open first file */
if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
@@ -5502,7 +5151,7 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format)
/* Remove enough objects in the root group to change it into a "compact" group */
for(u = 0; u < ((max_compact - min_dense) + 1); u++) {
- sprintf(objname, "filler %u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %u", u);
if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
} /* end for */
@@ -5532,18 +5181,18 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_unlink_dense() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_move
*
@@ -5551,20 +5200,16 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, December 5, 2005
- *
*-------------------------------------------------------------------------
*/
static int
external_link_move(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1), gid2 = (-1); /* Group IDs */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
if(new_format)
TESTING("move external link (w/new group format)")
@@ -5594,9 +5239,7 @@ external_link_move(hid_t fapl, hbool_t new_format)
/* Close file */
if(H5Fclose(fid) < 0) TEST_ERROR
-
/* Move external link to different name within same group */
-
/* Open first file */
if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
@@ -5680,7 +5323,6 @@ external_link_move(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
/* Move external link back to original group */
-
/* Open first file */
if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
@@ -5723,18 +5365,18 @@ external_link_move(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_move() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_ride
*
@@ -5743,25 +5385,21 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Wednesday, January 18, 2006
- *
*-------------------------------------------------------------------------
*/
static int
external_link_ride(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gcpl = (-1); /* Group creation property list ID */
- hid_t gid = (-1), gid2 = (-1); /* Group IDs */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
- unsigned nmsgs; /* Number of messages in group's header */
- unsigned max_compact; /* Maximum # of links to store in group compactly */
- unsigned min_dense; /* Minimum # of links to store in group "densely" */
- unsigned u; /* Local index variable */
+ hid_t fid = -1; /* File ID */
+ hid_t gcpl = -1; /* Group creation property list ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
+ unsigned nmsgs; /* Number of messages in group's header */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ unsigned u; /* Local index variable */
if(new_format)
TESTING("external link along for the ride (w/new group format)")
@@ -5787,7 +5425,7 @@ external_link_ride(hid_t fapl, hbool_t new_format)
/* Create enough objects in the root group to change it into a "dense" group */
for(u = 0; u < (max_compact + 1); u++) {
- sprintf(objname, "filler %u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %u", u);
if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Gclose(gid2) < 0) TEST_ERROR
} /* end for */
@@ -5856,7 +5494,7 @@ external_link_ride(hid_t fapl, hbool_t new_format)
/* Remove enough objects in the root group to change it into a "compact" group */
for(u = 0; u < ((max_compact - min_dense) + 3); u++) {
- sprintf(objname, "filler %u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %u", u);
if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
} /* end for */
@@ -5908,19 +5546,19 @@ external_link_ride(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
H5Pclose(gcpl);
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_ride() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_closing
*
@@ -5929,10 +5567,6 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: James Laird
- * Wednesday, August 16, 2006
- *
*-------------------------------------------------------------------------
*/
static int
@@ -5942,11 +5576,11 @@ external_link_closing(hid_t fapl, hbool_t new_format)
hid_t gid=(-1), tid=(-1), tid2=(-1), sid=(-1), did=(-1);
hid_t lcpl_id=(-1);
hsize_t dims[2];
- char filename1[NAME_BUF_SIZE],
+ char filename1[NAME_BUF_SIZE],
filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- filename4[NAME_BUF_SIZE], /* Names of files to externally link across */
- buf[NAME_BUF_SIZE]; /* misc. buffer */
+ filename3[NAME_BUF_SIZE],
+ filename4[NAME_BUF_SIZE], /* Names of files to externally link across */
+ buf[NAME_BUF_SIZE]; /* misc. buffer */
H5L_info_t li;
H5O_info_t oi;
hobj_ref_t obj_ref;
@@ -5996,7 +5630,7 @@ external_link_closing(hid_t fapl, hbool_t new_format)
/* Test creating each kind of object */
if((gid = H5Gcreate2(fid1, "elink/elink/elink/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Tcommit2(fid1, "elink/elink/elink/type1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
/* Close objects */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -6136,7 +5770,7 @@ external_link_closing(hid_t fapl, hbool_t new_format)
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -6150,10 +5784,10 @@ error:
H5Fclose(fid2);
H5Fclose(fid1);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* external_link_closing() */
-
+
/*-------------------------------------------------------------------------
* Function: ext_link_endian
*
@@ -6163,39 +5797,22 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: James Laird
- * Tuesday, June 6, 2006
- *
*-------------------------------------------------------------------------
*/
static int
external_link_endian(hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1), gid2 = (-1); /* Group IDs */
- hid_t lapl_id = (-1); /* Prop List ID */
- char * srcdir = getenv("srcdir"); /* The source directory */
- char pathbuf[NAME_BUF_SIZE]; /* Path to the files */
- char namebuf[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t lapl_id = -1; /* Prop List ID */
+ const char *pathbuf = H5_get_srcdir(); /* Path to the files */
+ const char *namebuf;
if(new_format)
TESTING("endianness of external links (w/new group format)")
else
TESTING("endianness of external links")
- /*
- * Create the name of the file to open (in case we are using the --srcdir
- * option and the file is in a different directory from this test).
- */
- if (srcdir && ((HDstrlen(srcdir) + 2) < sizeof(pathbuf)) )
- {
- HDstrcpy(pathbuf, srcdir);
- HDstrcat(pathbuf, "/");
- }
- else
- HDstrcpy(pathbuf, "");
-
/* Create a link access property list with the path to the srcdir */
if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR
if(H5Pset_elink_prefix(lapl_id, pathbuf) < 0) TEST_ERROR
@@ -6234,18 +5851,18 @@ external_link_endian(hbool_t new_format)
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
}
-
+
/*-------------------------------------------------------------------------
* Function: external_link_strong
*
@@ -6254,20 +5871,16 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, March 5, 2007
- *
*-------------------------------------------------------------------------
*/
static int
external_link_strong(hid_t fapl, hbool_t new_format)
{
- hid_t my_fapl; /* File access property list */
+ hid_t my_fapl = (-1); /* File access property list */
hid_t fid1 = (-1), fid2 = (-1); /* File ID */
hid_t gid1 = (-1), gid2 = (-1); /* Group IDs */
char objname[NAME_BUF_SIZE]; /* Object name */
- char filename1[NAME_BUF_SIZE],
+ char filename1[NAME_BUF_SIZE],
filename2[NAME_BUF_SIZE];
if(new_format)
@@ -6312,21 +5925,25 @@ external_link_strong(hid_t fapl, hbool_t new_format)
if(H5Gclose(gid2) < 0) TEST_ERROR
if(H5Fclose(fid2) < 0) TEST_ERROR
+ /* Close fapl */
+ if(H5Pclose(my_fapl) < 0) TEST_ERROR
+
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
+ H5Pclose(my_fapl);
H5Gclose(fapl);
H5Gclose(gid2);
H5Gclose(gid1);
H5Fclose(fid2);
H5Fclose(fid1);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_strong() */
-
+
/*-------------------------------------------------------------------------
* Function: external_symlink
*
@@ -6335,10 +5952,6 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Nov. 23, 2009
- *
*-------------------------------------------------------------------------
*/
static int
@@ -6347,17 +5960,17 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
#ifdef H5_HAVE_SYMLINK
hid_t file1 = -1, file2 = -1, file3 = -1, file4 = -1, file5 = -1;
hid_t group2 = -1, group3 = -1, group4 = -1, group5 = -1;
- char filename1[NAME_BUF_SIZE],
- filename2a[NAME_BUF_SIZE],
- filename2b[NAME_BUF_SIZE],
- filename3a[NAME_BUF_SIZE],
- filename3b[NAME_BUF_SIZE],
- filename4a[NAME_BUF_SIZE],
- filename4b[NAME_BUF_SIZE],
- filename5a[NAME_BUF_SIZE],
- filename5b[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
+ char filename1[NAME_BUF_SIZE],
+ filename2a[NAME_BUF_SIZE],
+ filename2b[NAME_BUF_SIZE],
+ filename3a[NAME_BUF_SIZE],
+ filename3b[NAME_BUF_SIZE],
+ filename4a[NAME_BUF_SIZE],
+ filename4b[NAME_BUF_SIZE],
+ filename5a[NAME_BUF_SIZE],
+ filename5b[NAME_BUF_SIZE],
+ tmpname[NAME_BUF_SIZE],
+ cwdpath[NAME_BUF_SIZE];
hbool_t have_posix_compat_vfd; /* Whether VFD used is compatible w/POSIX I/O calls */
#endif /* H5_HAVE_SYMLINK */
@@ -6413,7 +6026,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[50], fapl, filename5a, sizeof(filename5a));
h5_fixname(FILENAME[51], fapl, filename5b, sizeof(filename5b));
-
/* Create file #1 in current directory */
if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
@@ -6423,7 +6035,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
/* Close file #1 */
if(H5Fclose(file1) < 0) TEST_ERROR
-
/* Create file #2 in tmp directory #2 */
if((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
if(H5Fclose(file2) < 0) TEST_ERROR
@@ -6443,7 +6054,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
/* Close file #2 */
if(H5Fclose(file2) < 0) TEST_ERROR
-
/* Create file #3 in temp. directory #2 */
if((file3 = H5Fcreate(filename3a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
@@ -6459,7 +6069,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
/* Close file #3 */
if(H5Fclose(file3) < 0) TEST_ERROR
-
/* Create file #4 in temporary directory #1 */
if((file4 = H5Fcreate(filename4b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
@@ -6475,7 +6084,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
/* Close file #4 */
if(H5Fclose(file4) < 0) TEST_ERROR
-
/* Create file #5 in temporary directory #1 */
if((file5 = H5Fcreate(filename5a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
@@ -6486,7 +6094,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
/* Close file #5 */
if(H5Fclose(file5) < 0) TEST_ERROR
-
/* Actual tests... */
/* Reopen file #1 */
@@ -6511,17 +6118,16 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
/* Close file #1 */
if(H5Fclose(file1) < 0) TEST_ERROR
-
PASSED();
} /* end if */
else {
- SKIPPED();
- HDputs(" Current VFD doesn't support POSIX I/O calls");
+ SKIPPED();
+ HDputs(" Current VFD doesn't support POSIX I/O calls");
} /* end else */
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
H5Gclose(group5);
H5Gclose(group4);
@@ -6533,16 +6139,16 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
H5Fclose(file2);
H5Fclose(file1);
} H5E_END_TRY;
- return -1;
+ return FAIL;
#else /* H5_HAVE_SYMLINK */
SKIPPED();
HDputs(" Current file system or operating system doesn't support symbolic links");
- return 0;
+ return SUCCEED;
#endif /* H5_HAVE_SYMLINK */
} /* end external_symlink() */
-
+
/*-------------------------------------------------------------------------
* Function: external_copy_invalid_object
*
@@ -6553,18 +6159,14 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Neil Fortner
- * Wednesday, March 3, 2010
- *
*-------------------------------------------------------------------------
*/
static int
external_copy_invalid_object(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group ID */
- hid_t ocpyplid = (-1); /* Object copy plist ID */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t ocpyplid = -1; /* Object copy plist ID */
char filename[NAME_BUF_SIZE];
if(new_format)
@@ -6603,7 +6205,7 @@ external_copy_invalid_object(hid_t fapl, hbool_t new_format)
if(H5Pclose(ocpyplid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -6612,10 +6214,10 @@ error:
H5Pclose(ocpyplid);
} H5E_END_TRY
- return -1;
+ return FAIL;
} /* end external_copy_invalid_object */
-
+
/*-------------------------------------------------------------------------
* Function: external_dont_fail_to_source
*
@@ -6625,18 +6227,14 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Neil Fortner
- * Wednesday, March 3, 2010
- *
*-------------------------------------------------------------------------
*/
static int
external_dont_fail_to_source(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group ID */
- hid_t oid = (-1); /* Object ID */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t oid = -1; /* Object ID */
char filename[NAME_BUF_SIZE];
if(new_format)
@@ -6667,7 +6265,7 @@ external_dont_fail_to_source(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -6676,10 +6274,10 @@ error:
H5Fclose(fid);
} H5E_END_TRY
- return -1;
+ return FAIL;
} /* end external_dont_fail_to_source */
-
+
/*-------------------------------------------------------------------------
* Function: external_file_cache
*
@@ -6689,21 +6287,17 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Neil Fortner
- * Thursday, January 13, 2011
- *
*-------------------------------------------------------------------------
*/
static int
external_file_cache(hid_t fapl, hbool_t new_format)
{
- hid_t my_fapl = (-1); /* Temporary FAPL */
- hid_t fid1 = (-1); /* File ID */
- hid_t fid2 = (-1); /* File ID */
- hid_t fid3 = (-1); /* File ID */
- hid_t fid4 = (-1); /* File ID */
- hid_t oid = (-1); /* Object ID */
+ hid_t my_fapl = -1; /* Temporary FAPL */
+ hid_t fid1 = -1; /* File ID */
+ hid_t fid2 = -1; /* File ID */
+ hid_t fid3 = -1; /* File ID */
+ hid_t fid4 = -1; /* File ID */
+ hid_t oid = -1; /* Object ID */
unsigned efc_size;
char filename1[NAME_BUF_SIZE];
char filename2[NAME_BUF_SIZE];
@@ -6722,333 +6316,229 @@ external_file_cache(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[3], fapl, filename4, sizeof filename4);
/* Verify that the default EFC size is 0 */
- if(H5Pget_elink_file_cache_size(fapl, &efc_size) < 0)
- TEST_ERROR
+ if(H5Pget_elink_file_cache_size(fapl, &efc_size) < 0) TEST_ERROR
if(efc_size != 0)
FAIL_PUTS_ERROR("default external file cache size is not 0")
/* Copy FAPL and enable external file caching */
- if((my_fapl = H5Pcopy(fapl)) < 0)
- TEST_ERROR
- if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0)
- TEST_ERROR
+ if((my_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR
+ if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) TEST_ERROR
/* Verify that the external file cache size has been set */
- if(H5Pget_elink_file_cache_size(my_fapl, &efc_size) < 0)
- TEST_ERROR
+ if(H5Pget_elink_file_cache_size(my_fapl, &efc_size) < 0) TEST_ERROR
if(efc_size != 8)
FAIL_PUTS_ERROR("external file cache size different from expected")
-
- /*
- * Test 1: One file caches another
- */
+ /* Test 1: One file caches another */
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- TEST_ERROR
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
/* Create link */
- if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT,
- H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close file 2 */
- if(H5Fclose(fid2) < 0)
- TEST_ERROR
+ if(H5Fclose(fid2) < 0) TEST_ERROR
/* Verify that only 1 file is open */
H5F_sfile_assert_num(1);
/* Open and close the target of the external link */
- if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
- TEST_ERROR
- if(H5Oclose(oid) < 0)
- TEST_ERROR
+ if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Oclose(oid) < 0) TEST_ERROR
/* Verify that both files are now open */
H5F_sfile_assert_num(2);
/* Close file 1 */
- if(H5Fclose(fid1) < 0)
- TEST_ERROR
+ if(H5Fclose(fid1) < 0) TEST_ERROR
/* Verify that both files are now closed */
H5F_sfile_assert_num(0);
-
- /*
- * Test 2: One file caches another, release parent's EFC
- */
+ /* Test 2: One file caches another, release parent's EFC */
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- TEST_ERROR
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
/* Create link */
- if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT,
- H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close file 2 */
- if(H5Fclose(fid2) < 0)
- TEST_ERROR
+ if(H5Fclose(fid2) < 0) TEST_ERROR
/* Verify that only 1 file is open */
H5F_sfile_assert_num(1);
/* Open and close the target of the external link */
- if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
- TEST_ERROR
- if(H5Oclose(oid) < 0)
- TEST_ERROR
+ if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Oclose(oid) < 0) TEST_ERROR
/* Verify that both files are now open */
H5F_sfile_assert_num(2);
/* Release file 1's EFC */
- if(H5Fclear_elink_file_cache(fid1) < 0)
- TEST_ERROR
+ if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR
/* Verify that only the parent file is now open */
H5F_sfile_assert_num(1);
/* Close file 1 */
- if(H5Fclose(fid1) < 0)
- TEST_ERROR
+ if(H5Fclose(fid1) < 0) TEST_ERROR
/* Verify that both files are now closed */
H5F_sfile_assert_num(0);
-
- /*
- * Test 3: "Y" shaped tree
- */
+ /* Test 3: "Y" shaped tree */
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- TEST_ERROR
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- TEST_ERROR
- if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- TEST_ERROR
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+ if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+ if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
/* Create links */
- if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT,
- H5P_DEFAULT) < 0)
- TEST_ERROR
- if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT,
- H5P_DEFAULT) < 0)
- TEST_ERROR
- if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT,
- H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close files 2-4 */
- if(H5Fclose(fid2) < 0)
- TEST_ERROR
- if(H5Fclose(fid3) < 0)
- TEST_ERROR
- if(H5Fclose(fid4) < 0)
- TEST_ERROR
+ if(H5Fclose(fid2) < 0) TEST_ERROR
+ if(H5Fclose(fid3) < 0) TEST_ERROR
+ if(H5Fclose(fid4) < 0) TEST_ERROR
/* Verify that only 1 file is open */
H5F_sfile_assert_num(1);
/* Open and close one branch of the tree */
- if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0)
- TEST_ERROR
- if(H5Oclose(oid) < 0)
- TEST_ERROR
+ if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Oclose(oid) < 0) TEST_ERROR
/* Verify that files 2 and 3 are now open */
H5F_sfile_assert_num(3);
/* Open and close the other branch of the tree */
- if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0)
- TEST_ERROR
- if(H5Oclose(oid) < 0)
- TEST_ERROR
+ if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Oclose(oid) < 0) TEST_ERROR
/* Verify that all files are now open */
H5F_sfile_assert_num(4);
/* Close file 1 */
- if(H5Fclose(fid1) < 0)
- TEST_ERROR
+ if(H5Fclose(fid1) < 0) TEST_ERROR
/* Verify that all files are now closed */
H5F_sfile_assert_num(0);
-
- /*
- * Test 4: "Y" shaped tree, release parent's EFC
- */
+ /* Test 4: "Y" shaped tree, release parent's EFC */
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- TEST_ERROR
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- TEST_ERROR
- if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- TEST_ERROR
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+ if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+ if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
/* Create links */
- if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT,
- H5P_DEFAULT) < 0)
- TEST_ERROR
- if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT,
- H5P_DEFAULT) < 0)
- TEST_ERROR
- if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT,
- H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close files 2-4 */
- if(H5Fclose(fid2) < 0)
- TEST_ERROR
- if(H5Fclose(fid3) < 0)
- TEST_ERROR
- if(H5Fclose(fid4) < 0)
- TEST_ERROR
+ if(H5Fclose(fid2) < 0) TEST_ERROR
+ if(H5Fclose(fid3) < 0) TEST_ERROR
+ if(H5Fclose(fid4) < 0) TEST_ERROR
/* Verify that only 1 file is open */
H5F_sfile_assert_num(1);
/* Open and close one branch of the tree */
- if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0)
- TEST_ERROR
- if(H5Oclose(oid) < 0)
- TEST_ERROR
+ if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Oclose(oid) < 0) TEST_ERROR
/* Verify that files 2 and 3 are now open */
H5F_sfile_assert_num(3);
/* Open and close the other branch of the tree */
- if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0)
- TEST_ERROR
- if(H5Oclose(oid) < 0)
- TEST_ERROR
+ if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Oclose(oid) < 0) TEST_ERROR
/* Verify that all files are now open */
H5F_sfile_assert_num(4);
/* Release file 1's EFC */
- if(H5Fclear_elink_file_cache(fid1) < 0)
- TEST_ERROR
+ if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR
/* Verify that only file 1 is now open */
H5F_sfile_assert_num(1);
/* Close file 1 */
- if(H5Fclose(fid1) < 0)
- TEST_ERROR
+ if(H5Fclose(fid1) < 0) TEST_ERROR
/* Verify that all files are now closed */
H5F_sfile_assert_num(0);
- /*
- * Test 5: 3 file cycle
- */
+ /* Test 5: 3 file cycle */
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- TEST_ERROR
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- TEST_ERROR
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+ if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
/* Create links */
- if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT,
- H5P_DEFAULT) < 0)
- TEST_ERROR
- if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT,
- H5P_DEFAULT) < 0)
- TEST_ERROR
- if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT,
- H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close files 2-3 */
- if(H5Fclose(fid2) < 0)
- TEST_ERROR
- if(H5Fclose(fid3) < 0)
- TEST_ERROR
+ if(H5Fclose(fid2) < 0) TEST_ERROR
+ if(H5Fclose(fid3) < 0) TEST_ERROR
/* Verify that only 1 file is open */
H5F_sfile_assert_num(1);
/* Open and close one complete cycle */
- if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0)
- TEST_ERROR
- if(H5Oclose(oid) < 0)
- TEST_ERROR
+ if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Oclose(oid) < 0) TEST_ERROR
/* Verify that all files are now open */
H5F_sfile_assert_num(3);
/* Close file 1 */
- if(H5Fclose(fid1) < 0)
- TEST_ERROR
+ if(H5Fclose(fid1) < 0) TEST_ERROR
/* Verify that all files are now closed */
H5F_sfile_assert_num(0);
-
- /*
- * Test 6: 3 file cycle, release parent's EFC
- */
+ /* Test 6: 3 file cycle, release parent's EFC */
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- TEST_ERROR
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- TEST_ERROR
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+ if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
/* Create links */
- if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT,
- H5P_DEFAULT) < 0)
- TEST_ERROR
- if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT,
- H5P_DEFAULT) < 0)
- TEST_ERROR
- if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT,
- H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close files 2-3 */
- if(H5Fclose(fid2) < 0)
- TEST_ERROR
- if(H5Fclose(fid3) < 0)
- TEST_ERROR
+ if(H5Fclose(fid2) < 0) TEST_ERROR
+ if(H5Fclose(fid3) < 0) TEST_ERROR
/* Verify that only 1 file is open */
H5F_sfile_assert_num(1);
/* Open and close one complete cycle */
- if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0)
- TEST_ERROR
- if(H5Oclose(oid) < 0)
- TEST_ERROR
+ if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Oclose(oid) < 0) TEST_ERROR
/* Verify that all files are now open */
H5F_sfile_assert_num(3);
/* Release file 1's EFC */
- if(H5Fclear_elink_file_cache(fid1) < 0)
- TEST_ERROR
+ if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR
/* Verify that only file 1 is now open */
H5F_sfile_assert_num(1);
/* Close file 1 */
- if(H5Fclose(fid1) < 0)
- TEST_ERROR
+ if(H5Fclose(fid1) < 0) TEST_ERROR
/* Verify that all files are now closed */
H5F_sfile_assert_num(0);
@@ -7057,7 +6547,7 @@ external_file_cache(hid_t fapl, hbool_t new_format)
H5Pclose(my_fapl);
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -7069,10 +6559,10 @@ error:
H5Pclose(my_fapl);
} H5E_END_TRY
- return -1;
+ return FAIL;
} /* end external_file_cache */
-
+
/*-------------------------------------------------------------------------
* Function: external_open_twice
*
@@ -7081,21 +6571,17 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Neil Fortner
- * Saturday, April 30, 2011
- *
*-------------------------------------------------------------------------
*/
static int
external_open_twice(hid_t fapl, hbool_t new_format)
{
- hid_t fid1 = (-1); /* File ID */
- hid_t fid2 = (-1); /* File ID */
- hid_t oid1 = (-1); /* Object ID */
- hid_t oid2 = (-1); /* Object ID */
- hid_t type = (-1); /* Datatype ID */
- hid_t space = (-1); /* Dataspace ID */
+ hid_t fid1 = -1; /* File ID */
+ hid_t fid2 = -1; /* File ID */
+ hid_t oid1 = -1; /* Object ID */
+ hid_t oid2 = -1; /* Object ID */
+ hid_t type = -1; /* Datatype ID */
+ hid_t space = -1; /* Dataspace ID */
char filename1[NAME_BUF_SIZE];
char filename2[NAME_BUF_SIZE];
@@ -7108,192 +6594,123 @@ external_open_twice(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
-
- /*
- * Test 1: Open root group twice
- */
+ /* Test 1: Open root group twice */
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create link */
- if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT,
- H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close file 2 */
- if(H5Fclose(fid2) < 0)
- TEST_ERROR
+ if(H5Fclose(fid2) < 0) TEST_ERROR
/* Open the target of the external link twice */
- if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
- TEST_ERROR
- if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
- TEST_ERROR
+ if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR
+ if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR
- /* Close both objects, in the reverse opening order (necessary to duplicate
- * bug */
- if(H5Oclose(oid2) < 0)
- TEST_ERROR
- if(H5Oclose(oid1) < 0)
- TEST_ERROR
+ /* Close both objects, in the reverse opening order (necessary to duplicate bug */
+ if(H5Oclose(oid2) < 0) TEST_ERROR
+ if(H5Oclose(oid1) < 0) TEST_ERROR
/* Close file 1 */
- if(H5Fclose(fid1) < 0)
- TEST_ERROR
+ if(H5Fclose(fid1) < 0) TEST_ERROR
/* Verify that both files are now closed */
H5F_sfile_assert_num(0);
-
- /*
- * Test 2: Open group twice
- */
+ /* Test 2: Open group twice */
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create target group */
- if((oid1 = H5Gcreate2(fid2, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT))
- < 0)
- TEST_ERROR
- if(H5Gclose(oid1) < 0)
- TEST_ERROR
+ if((oid1 = H5Gcreate2(fid2, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(oid1) < 0) TEST_ERROR
/* Create link */
- if(H5Lcreate_external(filename2, "/group", fid1, "link_to_2", H5P_DEFAULT,
- H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lcreate_external(filename2, "/group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close file 2 */
- if(H5Fclose(fid2) < 0)
- TEST_ERROR
+ if(H5Fclose(fid2) < 0) TEST_ERROR
/* Open the target of the external link twice */
- if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
- TEST_ERROR
- if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
- TEST_ERROR
+ if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR
+ if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR
- /* Close both objects, in the reverse opening order (necessary to duplicate
- * bug */
- if(H5Oclose(oid2) < 0)
- TEST_ERROR
- if(H5Oclose(oid1) < 0)
- TEST_ERROR
+ /* Close both objects, in the reverse opening order (necessary to duplicate bug */
+ if(H5Oclose(oid2) < 0) TEST_ERROR
+ if(H5Oclose(oid1) < 0) TEST_ERROR
/* Close file 1 */
- if(H5Fclose(fid1) < 0)
- TEST_ERROR
+ if(H5Fclose(fid1) < 0) TEST_ERROR
/* Verify that both files are now closed */
H5F_sfile_assert_num(0);
-
- /*
- * Test 3: Open dataset twice
- */
+ /* Test 3: Open dataset twice */
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create target dataset */
- if((space = H5Screate(H5S_SCALAR)) < 0)
- TEST_ERROR
- if((oid1 = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, space, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT)) < 0)
- TEST_ERROR
- if(H5Dclose(oid1) < 0)
- TEST_ERROR
- if(H5Sclose(space) < 0)
- TEST_ERROR
+ if((space = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR
+ if((oid1 = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dclose(oid1) < 0) TEST_ERROR
+ if(H5Sclose(space) < 0) TEST_ERROR
/* Create link */
- if(H5Lcreate_external(filename2, "/dset", fid1, "link_to_2", H5P_DEFAULT,
- H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lcreate_external(filename2, "/dset", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close file 2 */
- if(H5Fclose(fid2) < 0)
- TEST_ERROR
+ if(H5Fclose(fid2) < 0) TEST_ERROR
/* Open the target of the external link twice */
- if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
- TEST_ERROR
- if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
- TEST_ERROR
+ if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR
+ if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR
- /* Close both objects, in the reverse opening order (necessary to duplicate
- * bug */
- if(H5Oclose(oid2) < 0)
- TEST_ERROR
- if(H5Oclose(oid1) < 0)
- TEST_ERROR
+ /* Close both objects, in the reverse opening order (necessary to duplicate bug */
+ if(H5Oclose(oid2) < 0) TEST_ERROR
+ if(H5Oclose(oid1) < 0) TEST_ERROR
/* Close file 1 */
- if(H5Fclose(fid1) < 0)
- TEST_ERROR
+ if(H5Fclose(fid1) < 0) TEST_ERROR
/* Verify that both files are now closed */
H5F_sfile_assert_num(0);
-
- /*
- * Test 4: Open datatype twice
- */
+ /* Test 4: Open datatype twice */
/* Create files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create target datatype */
- if((type = H5Tcopy(H5T_NATIVE_INT)) < 0)
- TEST_ERROR
- if(H5Tcommit2(fid2, "dtype", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)
- < 0)
- TEST_ERROR
- if(H5Tclose(type) < 0)
- TEST_ERROR
+ if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if(H5Tcommit2(fid2, "dtype", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Tclose(type) < 0) TEST_ERROR
/* Create link */
- if(H5Lcreate_external(filename2, "/dtype", fid1, "link_to_2", H5P_DEFAULT,
- H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lcreate_external(filename2, "/dtype", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close file 2 */
- if(H5Fclose(fid2) < 0)
- TEST_ERROR
+ if(H5Fclose(fid2) < 0) TEST_ERROR
/* Open the target of the external link twice */
- if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
- TEST_ERROR
- if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
- TEST_ERROR
+ if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR
+ if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR
- /* Close both objects, in the reverse opening order (necessary to duplicate
- * bug */
- if(H5Oclose(oid2) < 0)
- TEST_ERROR
- if(H5Oclose(oid1) < 0)
- TEST_ERROR
+ /* Close both objects, in the reverse opening order (necessary to duplicate bug */
+ if(H5Oclose(oid2) < 0) TEST_ERROR
+ if(H5Oclose(oid1) < 0) TEST_ERROR
/* Close file 1 */
- if(H5Fclose(fid1) < 0)
- TEST_ERROR
+ if(H5Fclose(fid1) < 0) TEST_ERROR
/* Verify that both files are now closed */
H5F_sfile_assert_num(0);
-
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -7305,10 +6722,10 @@ error:
H5Sclose(space);
} H5E_END_TRY
- return -1;
+ return FAIL;
} /* end external_open_twice() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_with_committed_datatype
*
@@ -7331,25 +6748,24 @@ error:
static int
external_link_with_committed_datatype(hid_t fapl, hbool_t new_format)
{
- hid_t fid1 = -1, fid2 = -1; /* File IDs */
- hid_t gid1 = -1, gid2 = -1; /* Group IDs */
- hid_t tid = -1; /* Datatype ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t sid2 = -1; /* Dataspace ID */
- hid_t aid = -1; /* Attribute ID */
- hid_t atid = -1; /* Attribute's datatype ID */
- hid_t did = -1; /* Dataset ID */
- hid_t dtid = -1; /* Dataset's datatype ID */
- hid_t dcpl = -1; /* Dataset creation property list */
- int wdata = 99; /* Attribute data written */
- int rdata = 0; /* Attribute data read */
- int wbuf[60]; /* Data buffer for writing */
- int rbuf[60]; /* Data buffer for reading */
- int i; /* Local index variable */
- char filename1[NAME_BUF_SIZE]; /* File name for main file */
- char filename2[NAME_BUF_SIZE]; /* File name for target file */
- hsize_t dims[2] = {5, 12}; /* Dimension sizes */
- hsize_t chunks[2] = {3, 7}; /* Chunk sizes */
+ hid_t fid1 = -1, fid2 = -1; /* File IDs */
+ hid_t gid1 = -1, gid2 = -1; /* Group IDs */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t sid2 = -1; /* Dataspace ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t atid = -1; /* Attribute's datatype ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t dtid = -1; /* Dataset's datatype ID */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ int wdata = 99; /* Attribute data written */
+ int wbuf[60]; /* Data buffer for writing */
+ int rbuf[60]; /* Data buffer for reading */
+ int i; /* Local index variable */
+ char filename1[NAME_BUF_SIZE]; /* File name for main file */
+ char filename2[NAME_BUF_SIZE]; /* File name for target file */
+ hsize_t dims[2] = {5, 12}; /* Dimension sizes */
+ hsize_t chunks[2] = {3, 7}; /* Chunk sizes */
if(new_format)
TESTING("attach committed datatype to external group's attribute/dataset(w/new group format)")
@@ -7360,206 +6776,157 @@ external_link_with_committed_datatype(hid_t fapl, hbool_t new_format)
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
-
/* Main file */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
/* Create external link from main file to target file */
- if(H5Lcreate_external(filename2, "target_group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0)
- FAIL_STACK_ERROR
-
+ if(H5Lcreate_external(filename2, "target_group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Create target file */
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
/* Create group in target file */
- if((gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if((gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Close the group */
- if(H5Gclose(gid2) < 0)
- FAIL_STACK_ERROR
+ if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid2) < 0)
- FAIL_STACK_ERROR
+ if(H5Fclose(fid2) < 0) FAIL_STACK_ERROR
/* Open the group which is externally linked to target file */
- if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Create a copy of integer datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
- FAIL_STACK_ERROR
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR
/* Commit the datatype to the main file root group */
- if(H5Tcommit2(fid1, "myDatatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
- FAIL_STACK_ERROR
+ if(H5Tcommit2(fid1, "myDatatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Create dataspace */
- if((sid = H5Screate(H5S_SCALAR)) < 0)
- FAIL_STACK_ERROR
+ if((sid = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR
/* Attach an attribute with the committed datatype to the group */
- if((aid = H5Acreate2(gid1, "myAttribute", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if((aid = H5Acreate2(gid1, "myAttribute", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Write data to the attribute */
- if(H5Awrite(aid, tid, &wdata) < 0)
- FAIL_STACK_ERROR
+ if(H5Awrite(aid, tid, &wdata) < 0) FAIL_STACK_ERROR
/* Get the attribute's datatype */
- if((atid = H5Aget_type(aid)) < 0)
- FAIL_STACK_ERROR
+ if((atid = H5Aget_type(aid)) < 0) FAIL_STACK_ERROR
/* Verify the datatype is not committed */
- if(H5Tcommitted(atid) == TRUE)
- FAIL_STACK_ERROR
+ if(H5Tcommitted(atid) == TRUE) FAIL_STACK_ERROR
/* Close the attribute */
- if(H5Aclose(aid) < 0)
- FAIL_STACK_ERROR
+ if(H5Aclose(aid) < 0) FAIL_STACK_ERROR
/* Create a chunked dataset */
- if((sid2 = H5Screate_simple(2, dims, NULL)) < 0)
- FAIL_STACK_ERROR
+ if((sid2 = H5Screate_simple(2, dims, NULL)) < 0) FAIL_STACK_ERROR
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 2, chunks) < 0)
- FAIL_STACK_ERROR
+ if (dcpl_g == H5P_DEFAULT)
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ else
+ dcpl = H5Pcopy(dcpl_g);
+ if (0 > dcpl) FAIL_STACK_ERROR
+ if(H5Pset_chunk(dcpl, 2, chunks) < 0) FAIL_STACK_ERROR
/* Initialize data buffers */
for(i = 0; i < 60; i++) {
- wbuf[i] = i;
- rbuf[i] = 0;
+ wbuf[i] = i;
+ rbuf[i] = 0;
}
/* Create a dataset with the committed datatype in the group */
- if((did = H5Dcreate2(gid1, "myDataset", tid, sid2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if((did = H5Dcreate2(gid1, "myDataset", tid, sid2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Write to the dataset */
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
- FAIL_STACK_ERROR
+ if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) FAIL_STACK_ERROR
/* Get the dataset's datatype */
- if((dtid = H5Dget_type(did)) < 0)
- FAIL_STACK_ERROR
+ if((dtid = H5Dget_type(did)) < 0) FAIL_STACK_ERROR
/* Verify the datatype is not committed */
- if(H5Tcommitted(dtid) == TRUE)
- FAIL_STACK_ERROR
+ if(H5Tcommitted(dtid) == TRUE) FAIL_STACK_ERROR
/* Close the dataset */
- if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ if(H5Dclose(did) < 0) FAIL_STACK_ERROR
/* Close the dataset creation property list */
- if(H5Pclose(dcpl) < 0)
- FAIL_STACK_ERROR
+ if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
/* Close the dataspaces */
- if(H5Sclose(sid) < 0)
- FAIL_STACK_ERROR
- if(H5Sclose(sid2) < 0)
- FAIL_STACK_ERROR
+ if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
+ if(H5Sclose(sid2) < 0) FAIL_STACK_ERROR
/* Close the datatypes */
- if(H5Tclose(tid) < 0)
- FAIL_STACK_ERROR
- if(H5Tclose(atid) < 0)
- FAIL_STACK_ERROR
- if(H5Tclose(dtid) < 0)
- FAIL_STACK_ERROR
+ if(H5Tclose(tid) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(atid) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(dtid) < 0) FAIL_STACK_ERROR
/* Close the group */
- if(H5Gclose(gid1) < 0)
- FAIL_STACK_ERROR
+ if(H5Gclose(gid1) < 0) FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid1) < 0)
- FAIL_STACK_ERROR
-
+ if(H5Fclose(fid1) < 0) FAIL_STACK_ERROR
/* Open the mainfile */
- if((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0)
- FAIL_STACK_ERROR
+ if((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
/* Open the committed datatype in the mainfile */
- if((tid = H5Topen2(fid1, "myDatatype", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if((tid = H5Topen2(fid1, "myDatatype", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Verify the datatype is committed */
- if(H5Tcommitted(tid) == FALSE)
- FAIL_STACK_ERROR
+ if(H5Tcommitted(tid) == FALSE) FAIL_STACK_ERROR
/* Open the group which is externally linked to target file */
- if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Open the attribute attached to the group */
- if((aid = H5Aopen(gid1, "myAttribute", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if((aid = H5Aopen(gid1, "myAttribute", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Get the attribute's datatype */
- if((atid = H5Aget_type(aid)) < 0)
- FAIL_STACK_ERROR
+ if((atid = H5Aget_type(aid)) < 0) FAIL_STACK_ERROR
/* Verify the attribute's datatype is not committed */
- if(H5Tcommitted(atid) == TRUE)
- FAIL_STACK_ERROR
+ if(H5Tcommitted(atid) == TRUE) FAIL_STACK_ERROR
/* Close the attribute */
- if(H5Aclose(aid) < 0)
- FAIL_STACK_ERROR
+ if(H5Aclose(aid) < 0) FAIL_STACK_ERROR
/* Delete the attribute */
- if(H5Adelete(gid1, "myAttribute") < 0)
- FAIL_STACK_ERROR
+ if(H5Adelete(gid1, "myAttribute") < 0) FAIL_STACK_ERROR
/* Open the dataset in the group */
- if((did = H5Dopen2(gid1, "myDataset", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if((did = H5Dopen2(gid1, "myDataset", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Get the dataset's datatype */
- if((dtid = H5Dget_type(did)) < 0)
- FAIL_STACK_ERROR
+ if((dtid = H5Dget_type(did)) < 0) FAIL_STACK_ERROR
/* Verify the dataset's datatype is not committed */
- if(H5Tcommitted(dtid) == TRUE)
- FAIL_STACK_ERROR
+ if(H5Tcommitted(dtid) == TRUE) FAIL_STACK_ERROR
/* Read the dataset */
- if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
- FAIL_STACK_ERROR
+ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) FAIL_STACK_ERROR
/* Compare the data read should be the same as wbuf */
- if(HDmemcmp(wbuf, rbuf, sizeof(wbuf)) != 0)
- FAIL_STACK_ERROR
+ if(HDmemcmp(wbuf, rbuf, sizeof(wbuf)) != 0) FAIL_STACK_ERROR
/* Close the dataset */
- if(H5Dclose(did) < 0)
- FAIL_STACK_ERROR
+ if(H5Dclose(did) < 0) FAIL_STACK_ERROR
/* Close the group */
- if(H5Gclose(gid1) < 0)
- FAIL_STACK_ERROR
+ if(H5Gclose(gid1) < 0) FAIL_STACK_ERROR
/* Close the datatypes */
- if(H5Tclose(tid) < 0)
- FAIL_STACK_ERROR
- if(H5Tclose(atid) < 0)
- FAIL_STACK_ERROR
- if(H5Tclose(dtid) < 0)
- FAIL_STACK_ERROR
+ if(H5Tclose(tid) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(atid) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(dtid) < 0) FAIL_STACK_ERROR
/* Close the file */
if(H5Fclose(fid1) < 0)
FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -7578,13 +6945,13 @@ error:
H5Aclose(atid);
H5Aclose(dtid);
- H5Pclose(dcpl);
+ H5Pclose(dcpl);
} H5E_END_TRY
- return -1;
+ return FAIL;
} /* end external_link_with_committed_datatype() */
-
+
/*-------------------------------------------------------------------------
* Function: ud_hard_links
*
@@ -7593,10 +6960,6 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: James Laird
- * Tuesday, June 6, 2006
- *
*-------------------------------------------------------------------------
*/
/* Callback functions for UD hard links. */
@@ -7662,7 +7025,7 @@ done:
case H5I_ERROR_STACK:
case H5I_NTYPES:
default:
- return -1;
+ return FAIL;
} /* end switch */
} /* end if */
@@ -7678,7 +7041,7 @@ UD_hard_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
hid_t ret_value = -1;
if(udata_size != sizeof(haddr_t))
- return -1;
+ return FAIL;
addr = *((const haddr_t *) udata);
@@ -7749,7 +7112,7 @@ done:
case H5I_ERROR_STACK:
case H5I_NTYPES:
default:
- return -1;
+ return FAIL;
} /* end switch */
} /* end if */
@@ -7771,12 +7134,12 @@ const H5L_class_t UD_hard_class[1] = {{
static int
ud_hard_links(hid_t fapl)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1), gid2 = (-1); /* Group IDs */
- H5L_info_t li; /* Link information */
- char objname[NAME_BUF_SIZE]; /* Object name */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ H5L_info_t li; /* Link information */
+ char objname[NAME_BUF_SIZE]; /* Object name */
h5_stat_size_t empty_size; /* Size of an empty file */
- char filename[NAME_BUF_SIZE];
+ char filename[NAME_BUF_SIZE];
TESTING("user-defined hard link (w/new group format)")
@@ -7810,7 +7173,6 @@ ud_hard_links(hid_t fapl)
if(H5Gclose(gid) < 0) TEST_ERROR
-
/* Create a user-defined "hard link" to the group using the address we got
* from H5Lget_info */
if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), (size_t)sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -7848,9 +7210,9 @@ ud_hard_links(hid_t fapl)
/* UD hard links have no query function, thus return a "link length" of 0 */
if(li.u.val_size != 0) TEST_ERROR
if(UD_HARD_TYPE != li.type) {
- H5_FAILED();
- HDputs(" Unexpected link class - should have been a UD hard link");
- goto error;
+ H5_FAILED();
+ HDputs(" Unexpected link class - should have been a UD hard link");
+ goto error;
} /* end if */
/* Unlink the group pointed to by the UD link. It shouldn't be
@@ -7877,18 +7239,18 @@ ud_hard_links(hid_t fapl)
if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end ud_hard_links() */
-
+
/*-------------------------------------------------------------------------
* Function: UD_rereg_traverse
*
@@ -7897,10 +7259,6 @@ ud_hard_links(hid_t fapl)
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: James Laird
- * Tuesday, June 6, 2006
- *
*-------------------------------------------------------------------------
*/
/* A traversal function that ignores any udata and simply opens an object
@@ -7917,7 +7275,7 @@ UD_rereg_traverse(const char H5_ATTR_UNUSED * link_name, hid_t cur_group,
return ret_value;
error:
- return -1;
+ return FAIL;
} /* end UD_rereg_traverse() */
/* This link class has the same ID number as the UD hard links but
@@ -7937,23 +7295,23 @@ const H5L_class_t UD_rereg_class[1] = {{
static int
ud_link_reregister(hid_t fapl)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1), gid2 = (-1); /* Group IDs */
- H5L_info_t li; /* Link information */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];
- h5_stat_size_t empty_size; /* Size of an empty file */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ H5L_info_t li; /* Link information */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE];
+ h5_stat_size_t empty_size; /* Size of an empty file */
TESTING("registering a new class for existing UD links (w/new group format)")
/* Set up filename and create file*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Get the size of the empty file for reference */
if(H5Fclose(fid) < 0) TEST_ERROR
- if((empty_size=h5_get_file_size(filename, fapl))<0) TEST_ERROR
+ if((empty_size = h5_get_file_size(filename, fapl))<0) TEST_ERROR
if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
@@ -7992,9 +7350,9 @@ ud_link_reregister(hid_t fapl)
/* Verify that we can't create any new links of this type */
H5E_BEGIN_TRY {
- if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address),
+ if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address),
sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) >= 0)
- TEST_ERROR
+ TEST_ERROR
} H5E_END_TRY
/* Register a new kind of link with the same ID number */
@@ -8062,18 +7420,18 @@ ud_link_reregister(hid_t fapl)
if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end ud_link_reregister() */
-
+
/*-------------------------------------------------------------------------
* Function: ud_callbacks
*
@@ -8082,10 +7440,6 @@ ud_link_reregister(hid_t fapl)
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: James Laird
- * Tuesday, June 6, 2006
- *
*-------------------------------------------------------------------------
*/
/* Callback functions for UD "callback" links. */
@@ -8103,10 +7457,10 @@ UD_cb_create(const char * link_name, hid_t loc_group, const void *udata,
if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR
if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR
- return 0;
+ return SUCCEED;
error:
- return -1;
+ return FAIL;
} /* end UD_cb_create() */
static hid_t
@@ -8130,7 +7484,7 @@ UD_cb_traverse(const char * link_name, hid_t cur_group, const void *udata,
return ret_value;
error:
- return -1;
+ return FAIL;
} /* end UD_cb_traverse() */
/* Callback for when the link is moved or renamed */
@@ -8146,10 +7500,10 @@ UD_cb_move(const char *new_name, hid_t new_loc, const void *udata,
if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR
if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR
- return 0;
+ return SUCCEED;
error:
- return -1;
+ return FAIL;
} /* end UD_cb_move() */
/* Callback for when the link is deleted. Also called during move */
@@ -8165,10 +7519,10 @@ UD_cb_delete(const char *link_name, hid_t file, const void *udata,
if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR
if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR
- return 0;
+ return SUCCEED;
error:
- return -1;
+ return FAIL;
} /* end UD_cb_delete() */
/* Callback for when the link is queried */
@@ -8192,7 +7546,7 @@ UD_cb_query(const char * link_name, const void *udata, size_t udata_size,
return 16;
error:
- return -1;
+ return FAIL;
} /* end UD_cb_query() */
const H5L_class_t UD_cb_class[1] = {{
@@ -8210,12 +7564,12 @@ const H5L_class_t UD_cb_class[1] = {{
static int
ud_callbacks(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group ID */
- hid_t lcpl = (-1); /* Link Creation PL */
- H5L_info_t li; /* Link information */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t lcpl = -1; /* Link Creation PL */
+ H5L_info_t li; /* Link information */
char ud_target_name[] = UD_CB_TARGET; /* Link target name */
- char filename[NAME_BUF_SIZE];
+ char filename[NAME_BUF_SIZE];
char query_buf[NAME_BUF_SIZE];
if(new_format)
@@ -8238,8 +7592,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format)
* no problems. */
if(H5Lregister(UD_hard_class) < 0) TEST_ERROR
- /* Register user-defined link class. This is the one we'll actually
- * be using. */
+ /* Register user-defined link class. This is the one we'll actually be using. */
if(H5Lregister(UD_cb_class) < 0) TEST_ERROR
/* Check that registered link classes are, and unregistered ones aren't */
@@ -8262,9 +7615,9 @@ ud_callbacks(hid_t fapl, hbool_t new_format)
if (H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR
if(li.u.val_size != 16) TEST_ERROR
if (UD_CB_TYPE != li.type) {
- H5_FAILED();
- HDputs(" Unexpected link class - should have been a UD hard link");
- goto error;
+ H5_FAILED();
+ HDputs(" Unexpected link class - should have been a UD hard link");
+ goto error;
}
/* Fill the query buffer */
@@ -8281,7 +7634,6 @@ ud_callbacks(hid_t fapl, hbool_t new_format)
/* Remove UD link */
if(H5Ldelete(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
-
/* Test that the callbacks don't work if the link class is not registered */
/* Create a new link. Just for fun, give it a non-default character
@@ -8319,18 +7671,18 @@ ud_callbacks(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
- H5Pclose (lcpl);
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Pclose (lcpl);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end ud_callbacks() */
-
+
/*-------------------------------------------------------------------------
* Function: lapl_udata
*
@@ -8339,10 +7691,6 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: James Laird
- * Tuesday, June 6, 2006
- *
*-------------------------------------------------------------------------
*/
static hid_t
@@ -8357,13 +7705,12 @@ UD_plist_traverse(const char H5_ATTR_UNUSED * link_name, hid_t cur_group,
/* Get the name of the target from the property list. */
if(H5Pget(lapl_id, DEST_PROP_NAME, target) < 0) TEST_ERROR
- if((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0)
- TEST_ERROR
+ if((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0) TEST_ERROR
return ret_value;
error:
- return -1;
+ return FAIL;
} /* end UD_plist_traverse() */
const H5L_class_t UD_plist_class[1] = {{
@@ -8381,12 +7728,12 @@ const H5L_class_t UD_plist_class[1] = {{
static int
lapl_udata(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1), gid2 = (-1); /* Group IDs */
- hid_t plist_id = (-1); /* Property List ID */
- char group_a_name[NAME_BUF_SIZE];
- char group_b_name[NAME_BUF_SIZE];
- char filename[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t plist_id = -1; /* Property List ID */
+ char group_a_name[NAME_BUF_SIZE];
+ char group_b_name[NAME_BUF_SIZE];
+ char filename[NAME_BUF_SIZE];
if(new_format)
TESTING("user data passed through lapl (w/new group format)")
@@ -8457,19 +7804,19 @@ lapl_udata(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Pclose (plist_id);
- H5Gclose (gid);
- H5Gclose (gid2);
- H5Fclose (fid);
+ H5Pclose (plist_id);
+ H5Gclose (gid);
+ H5Gclose (gid2);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end lapl_udata() */
-
+
/*-------------------------------------------------------------------------
* Function: ud_link_errors
*
@@ -8478,10 +7825,6 @@ lapl_udata(hid_t fapl, hbool_t new_format)
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: James Laird
- * Tuesday, June 6, 2006
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -8489,10 +7832,9 @@ UD_cbsucc_create(const char H5_ATTR_UNUSED * link_name, hid_t H5_ATTR_UNUSED loc
const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id)
{
/* Check to make sure that this "soft link" has a target */
- if(udata_size < 1 || !udata)
- return -1;
+ if(udata_size < 1 || !udata) return FAIL;
- return 0;
+ return SUCCEED;
} /* end UD_cbsucc_create() */
static hid_t
@@ -8509,7 +7851,7 @@ UD_cbsucc_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
return ret_value;
error:
- return -1;
+ return FAIL;
} /* end UD_cbsucc_traverse() */
/* Failure callback for when the link is moved or renamed */
@@ -8518,7 +7860,7 @@ UD_cbfail_move(const char H5_ATTR_UNUSED *new_name, hid_t H5_ATTR_UNUSED new_loc
const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size)
{
/* This traversal function will always fail. */
- return -1;
+ return FAIL;
} /* end UD_cbfail_move() */
/* SuccessCallback for when the link is moved or renamed */
@@ -8527,7 +7869,7 @@ UD_cbsucc_move(const char H5_ATTR_UNUSED *new_name, hid_t H5_ATTR_UNUSED new_loc
const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size)
{
/* This traversal function will always succeed. */
- return 0;
+ return SUCCEED;
} /* end UD_cbsucc_move() */
/* Callback for when the link is deleted. Also called during move */
@@ -8536,7 +7878,7 @@ UD_cbsucc_delete(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED file
const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size)
{
/* This callback will always succeed */
- return 0;
+ return SUCCEED;
} /* end UD_cbsucc_delete() */
/* Callback for when the link is deleted. Also called during move */
@@ -8546,7 +7888,7 @@ UD_cbfail_delete(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED file
{
/* This traversal function will always fail. */
/* Note: un-deletable links are in general a very bad idea! */
- return -1;
+ return FAIL;
} /* end UD_cbfail_delete() */
/* Callback for when the link is queried */
@@ -8555,7 +7897,7 @@ UD_cbfail_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATTR_UNUSED
size_t H5_ATTR_UNUSED udata_size, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNUSED buf_size)
{
/* This traversal function will always fail. */
- return -1;
+ return FAIL;
} /* end UD_cbfail_query() */
/* Callback for when the link is queried */
@@ -8568,10 +7910,9 @@ UD_cbfail_on_write_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATT
* fails
*/
- if(buf != NULL)
- return -1;
+ if(buf != NULL) return FAIL;
- return 0;
+ return SUCCEED;
} /* end UD_cbfail_on_write_query() */
/* Callback for when the link is queried */
@@ -8678,12 +8019,12 @@ const H5L_class_t UD_error4_class[1] = {{
static int
ud_link_errors(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char group_name[NAME_BUF_SIZE];
- char filename[NAME_BUF_SIZE];
- char query_buf[NAME_BUF_SIZE];
- H5L_info_t li; /* Link information */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ char group_name[NAME_BUF_SIZE];
+ char filename[NAME_BUF_SIZE];
+ char query_buf[NAME_BUF_SIZE];
+ H5L_info_t li; /* Link information */
if(new_format)
TESTING("user-defined link error conditions (w/new group format)")
@@ -8696,10 +8037,10 @@ ud_link_errors(hid_t fapl, hbool_t new_format)
/* Try to register some invalid link classes */
H5E_BEGIN_TRY {
- if(H5Lregister(UD_error1_class) >= 0) TEST_ERROR
- if(H5Lregister(UD_error2_class) >= 0) TEST_ERROR
- if(H5Lregister(UD_error3_class) >= 0) TEST_ERROR
- if(H5Lregister(UD_error4_class) >= 0) TEST_ERROR
+ if(H5Lregister(UD_error1_class) >= 0) TEST_ERROR
+ if(H5Lregister(UD_error2_class) >= 0) TEST_ERROR
+ if(H5Lregister(UD_error3_class) >= 0) TEST_ERROR
+ if(H5Lregister(UD_error4_class) >= 0) TEST_ERROR
} H5E_END_TRY
/* Register the UD plist class. */
@@ -8714,10 +8055,8 @@ ud_link_errors(hid_t fapl, hbool_t new_format)
/* Try to create internally defined links with H5Lcreate_ud */
H5E_BEGIN_TRY {
- if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_HARD, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) >= 0)
- TEST_ERROR
- if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_SOFT, "str", (size_t)4, H5P_DEFAULT, H5P_DEFAULT) >= 0)
- TEST_ERROR
+ if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_HARD, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR
+ if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_SOFT, "str", (size_t)4, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR
} H5E_END_TRY
/* Create a user-defined link to the group. */
@@ -8785,17 +8124,17 @@ ud_link_errors(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end ud_link_errors() */
-
+
/*-------------------------------------------------------------------------
* Function: lapl_nlinks
*
@@ -8803,28 +8142,21 @@ error:
* by the user using the Link Access Property List.
*
* Return: Success: 0
- *
* Failure: -1
- *
- * Programmer: James Laird
- * Tuesday, June 6, 2006
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
lapl_nlinks(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1), gid2 = (-1); /* Group IDs */
- hid_t plist = (-1); /* lapl ID */
- hid_t tid = (-1), sid = (-1), did = (-1); /* Other IDs */
- hid_t gapl = (-1), dapl = (-1), tapl = (-1); /* Other property lists */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];
- size_t nlinks; /* nlinks for H5Pset_nlinks */
- hsize_t dims[2];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t plist = -1; /* lapl ID */
+ hid_t tid = -1, sid = -1, did = -1; /* Other IDs */
+ hid_t gapl = -1, dapl = -1, tapl = -1; /* Other property lists */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE];
+ size_t nlinks; /* nlinks for H5Pset_nlinks */
+ hsize_t dims[2];
if(new_format)
TESTING("adjusting nlinks with LAPL (w/new group format)")
@@ -8839,7 +8171,7 @@ lapl_nlinks(hid_t fapl, hbool_t new_format)
/* Create file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create group with short name in file (used as target for links) */
if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -8868,7 +8200,7 @@ lapl_nlinks(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
/* Open file */
- if((fid=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
/* Create LAPL with higher-than-usual nlinks value */
/* Create a non-default lapl with udata set to point to the first group */
@@ -8910,9 +8242,9 @@ lapl_nlinks(hid_t fapl, hbool_t new_format)
gid = H5Oopen(fid, "soft5", plist);
} H5E_END_TRY;
if (gid >= 0) {
- H5_FAILED();
- HDputs(" Should have failed for sequence of too many nested links.");
- goto error;
+ H5_FAILED();
+ HDputs(" Should have failed for sequence of too many nested links.");
+ goto error;
}
/* Open object through lesser soft link */
@@ -8922,7 +8254,6 @@ lapl_nlinks(hid_t fapl, hbool_t new_format)
if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
if(HDstrcmp(objname, "/soft4")) TEST_ERROR
-
/* Test other functions that should use a LAPL */
nlinks = 20;
if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR
@@ -8955,7 +8286,6 @@ lapl_nlinks(hid_t fapl, hbool_t new_format)
/* Close plist */
if(H5Pclose(plist) < 0) TEST_ERROR
-
/* Create a datatype and dataset as targets inside the group */
if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
if(H5Tcommit2(gid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -8964,7 +8294,7 @@ lapl_nlinks(hid_t fapl, hbool_t new_format)
dims[0] = 2;
dims[1] = 2;
if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
- if((did = H5Dcreate2(gid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate2(gid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
/* Close group */
@@ -9014,25 +8344,25 @@ lapl_nlinks(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Pclose(gapl);
- H5Pclose(dapl);
- H5Pclose(tapl);
- H5Dclose(did);
- H5Sclose(sid);
- H5Tclose(tid);
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Pclose(plist);
- H5Fclose(fid);
- } H5E_END_TRY;
- return -1;
+ H5Pclose(gapl);
+ H5Pclose(dapl);
+ H5Pclose(tapl);
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Tclose(tid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Pclose(plist);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+ return FAIL;
} /* end lapl_nlinks() */
-
+
/*-------------------------------------------------------------------------
* Function: linkinfo
*
@@ -9040,21 +8370,17 @@ lapl_nlinks(hid_t fapl, hbool_t new_format)
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: James Laird
- * Tuesday, June 6, 2006
- *
*-------------------------------------------------------------------------
*/
static int
linkinfo(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group ID */
- hid_t tid = (-1); /* Type ID */
- hid_t sid = (-1), did = -(1); /* Dataspace and dataset IDs */
- H5L_info_t li; /* Link information */
- char filename[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t tid = -1; /* Type ID */
+ hid_t sid = -1, did = -1; /* Dataspace and dataset IDs */
+ H5L_info_t li; /* Link information */
+ char filename[NAME_BUF_SIZE];
if(new_format)
TESTING("link type field in H5Lget_info (w/new group format)")
@@ -9076,7 +8402,7 @@ linkinfo(hid_t fapl, hbool_t new_format)
if(H5Lcreate_soft("group", fid, "softlink", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR
- if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
if(H5Lcreate_external("file_name", "obj_path", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -9107,19 +8433,19 @@ linkinfo(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
- error:
+error:
H5E_BEGIN_TRY {
- H5Tclose (tid);
- H5Dclose (did);
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Tclose (tid);
+ H5Dclose (did);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end linkinfo() */
-
+
/*-------------------------------------------------------------------------
* Function: check_all_closed
*
@@ -9132,10 +8458,6 @@ linkinfo(hid_t fapl, hbool_t new_format)
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: James Laird
- * Thursday, August 17, 2006
- *
*-------------------------------------------------------------------------
*/
static int
@@ -9155,8 +8477,7 @@ check_all_closed(hid_t fapl, hbool_t new_format, int stopat)
* To check this, try to create every file used in this test. If
* a file is already open, creating it will fail.
*/
- for(x=0; FILENAME[x] != NULL && x < stopat; x++)
- {
+ for(x=0; FILENAME[x] != NULL && x < stopat; x++) {
h5_fixname(FILENAME[x], fapl, filename, sizeof filename);
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
@@ -9164,17 +8485,15 @@ check_all_closed(hid_t fapl, hbool_t new_format, int stopat)
}
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end check_all_closed() */
-
-
/*-------------------------------------------------------------------------
* Function: build_visit_file
*
@@ -9182,10 +8501,6 @@ error:
*
* Return: Success: >0, File ID for file built
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Saturday, November 24, 2007
- *
*-------------------------------------------------------------------------
*/
static hid_t
@@ -9193,9 +8508,9 @@ build_visit_file(hid_t fapl)
{
hid_t fid = -1; /* File ID */
hid_t gid = -1, gid2 = -1; /* Group IDs */
- hid_t sid = (-1); /* Dataspace ID */
- hid_t did = (-1); /* Dataset ID */
- hid_t tid = (-1); /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t tid = -1; /* Datatype ID */
char filename[NAME_BUF_SIZE];
char pathname[1024]; /* Path of external link file */
char *srcdir = getenv("srcdir"); /* where the src code is located */
@@ -9215,7 +8530,6 @@ build_visit_file(hid_t fapl)
if(H5Gclose(gid2) < 0) TEST_ERROR
if(H5Gclose(gid) < 0) TEST_ERROR
-
/* Create soft links to groups created */
if(H5Lcreate_soft("/Group1", fid, "/soft_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
if(H5Lcreate_soft("/Group1/Group2", fid, "/soft_two", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -9223,7 +8537,6 @@ build_visit_file(hid_t fapl)
/* Create dangling soft link */
if(H5Lcreate_soft("nowhere", fid, "/soft_dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
-
/* Create hard links to all groups */
if(H5Lcreate_hard(fid, "/", fid, "hard_zero", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
if(H5Lcreate_hard(fid, "/Group1", fid, "hard_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -9234,14 +8547,6 @@ build_visit_file(hid_t fapl)
if(H5Lcreate_hard(fid, "/", fid, "/Group1/Group2/hard_zero", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Create external link to existing file */
- pathname[0] = '\0';
- /* Generate correct name for test file by prepending the source path */
- if(srcdir && ((HDstrlen(srcdir) + HDstrlen(LINKED_FILE) + 1) < sizeof(pathname))) {
- HDstrcpy(pathname, srcdir);
- HDstrcat(pathname, "/");
- }
- HDstrcat(pathname, LINKED_FILE);
-
if(H5Lcreate_external(pathname, "/group", fid, "/ext_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Create dangling external link to non-existent file */
@@ -9250,13 +8555,13 @@ build_visit_file(hid_t fapl)
/* Create dataset in each group */
if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR
- if((did = H5Dcreate2(fid, "/Dataset_zero", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate2(fid, "/Dataset_zero", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- if((did = H5Dcreate2(fid, "/Group1/Dataset_one", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate2(fid, "/Group1/Dataset_one", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- if((did = H5Dcreate2(fid, "/Group1/Group2/Dataset_two", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate2(fid, "/Group1/Group2/Dataset_two", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
if(H5Sclose(sid) < 0) TEST_ERROR
@@ -9280,10 +8585,10 @@ error:
H5E_BEGIN_TRY {
H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end build_visit_file() */
-
+
/*-------------------------------------------------------------------------
* Function: visit_link_cb
*
@@ -9291,15 +8596,10 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Saturday, November 24, 2007
- *
*-------------------------------------------------------------------------
*/
static int
-visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t *linfo,
- void *_op_data)
+visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t *linfo, void *_op_data)
{
lvisit_ud_t *op_data = (lvisit_ud_t *)_op_data;
@@ -9313,7 +8613,7 @@ visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t
return(H5_ITER_CONT);
} /* end visit_link_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: link_visit
*
@@ -9321,10 +8621,6 @@ visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Saturday, November 24, 2007
- *
*-------------------------------------------------------------------------
*/
static int
@@ -9354,7 +8650,6 @@ link_visit(hid_t fapl, hbool_t new_format)
if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
-
/* Visit all the links reachable from each internal group */
if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
udata.idx = 0;
@@ -9368,22 +8663,21 @@ link_visit(hid_t fapl, hbool_t new_format)
if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
-
/* Close file created */
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
H5Gclose(gid);
H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end link_visit() */
-
+
/*-------------------------------------------------------------------------
* Function: link_visit_by_name
*
@@ -9391,10 +8685,6 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Saturday, November 24, 2007
- *
*-------------------------------------------------------------------------
*/
static int
@@ -9424,7 +8714,6 @@ link_visit_by_name(hid_t fapl, hbool_t new_format)
if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
-
/* Visit all the links reachable from each internal group */
udata.idx = 0;
udata.info = lvisit1;
@@ -9446,22 +8735,21 @@ link_visit_by_name(hid_t fapl, hbool_t new_format)
if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
-
/* Close file created */
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
H5Gclose(gid);
H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end link_visit_by_name() */
-
+
/*-------------------------------------------------------------------------
* Function: visit_obj_cb
*
@@ -9469,15 +8757,10 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Sunday, November 25, 2007
- *
*-------------------------------------------------------------------------
*/
static int
-visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t *oinfo,
- void *_op_data)
+visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t *oinfo, void *_op_data)
{
ovisit_ud_t *op_data = (ovisit_ud_t *)_op_data;
@@ -9491,7 +8774,7 @@ visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t *
return(H5_ITER_CONT);
} /* end visit_obj_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: obj_visit
*
@@ -9499,10 +8782,6 @@ visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t *
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Sunday, November 25, 2007
- *
*-------------------------------------------------------------------------
*/
static int
@@ -9532,7 +8811,6 @@ obj_visit(hid_t fapl, hbool_t new_format)
if(H5Ovisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
-
/* Visit all the objects reachable from each internal group */
if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
udata.idx = 0;
@@ -9546,22 +8824,21 @@ obj_visit(hid_t fapl, hbool_t new_format)
if(H5Ovisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
-
/* Close file created */
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
H5Gclose(gid);
H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end obj_visit() */
-
+
/*-------------------------------------------------------------------------
* Function: obj_visit_by_name
*
@@ -9569,10 +8846,6 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Sunday, November 25, 2007
- *
*-------------------------------------------------------------------------
*/
static int
@@ -9602,7 +8875,6 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format)
if(H5Ovisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
-
/* Visit all the objects reachable from each internal group */
udata.idx = 0;
udata.info = new_format ? ovisit1_new : ovisit1_old;
@@ -9614,7 +8886,6 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format)
if(H5Ovisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
-
udata.idx = 0;
udata.info = new_format ? ovisit2_new : ovisit2_old;
if(H5Ovisit_by_name(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
@@ -9625,37 +8896,31 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format)
if(H5Ovisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
-
/* Close file created */
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
H5Gclose(gid);
H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end obj_visit_by_name() */
-
+
/*-------------------------------------------------------------------------
* Function: visit_obj_stop_cb
*
* Purpose: Callback routine for visiting objects in a file
*
* Return: 1 (H5_ITER_STOP)
- *
- * Programmer: Neil Fortner
- * Sunday, November 2, 2008
- *
*-------------------------------------------------------------------------
*/
static int
-visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name, const H5O_info_t H5_ATTR_UNUSED *oinfo,
- void *_op_data)
+visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name, const H5O_info_t H5_ATTR_UNUSED *oinfo, void *_op_data)
{
unsigned *op_data = (unsigned *)_op_data;
@@ -9665,7 +8930,7 @@ visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name
return(H5_ITER_STOP);
} /* end visit_obj_stop_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: obj_visit_stop
*
@@ -9674,10 +8939,6 @@ visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Neil Fortner
- * Sunday, November 2, 2008
- *
*-------------------------------------------------------------------------
*/
static int
@@ -9715,16 +8976,16 @@ obj_visit_stop(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end obj_visit_stop() */
-
+
/*-------------------------------------------------------------------------
* Function: link_filters
*
@@ -9733,10 +8994,6 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Neil Fortner
- * Tuesday, June 16, 2009
- *
*-------------------------------------------------------------------------
*/
static enum {
@@ -9749,14 +9006,11 @@ static enum {
static htri_t link_filter_can_apply(hid_t dcpl_id, hid_t type_id, hid_t space_id)
{
- if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0)
- return -1;
+ if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0) return -1;
- if(link_filter_state >= LFS_ENCODED)
- return 1;
+ if(link_filter_state >= LFS_ENCODED) return 1;
- if(link_filter_state != LFS_INIT)
- return -1;
+ if(link_filter_state != LFS_INIT) return -1;
link_filter_state = LFS_CAN_APPLY_CALLED;
@@ -9765,14 +9019,11 @@ static htri_t link_filter_can_apply(hid_t dcpl_id, hid_t type_id, hid_t space_id
static herr_t link_filter_set_local(hid_t dcpl_id, hid_t type_id, hid_t space_id)
{
- if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0)
- return -1;
+ if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0) return -1;
- if(link_filter_state >= LFS_ENCODED)
- return 0;
+ if(link_filter_state >= LFS_ENCODED) return 0;
- if(link_filter_state != LFS_CAN_APPLY_CALLED)
- return -1;
+ if(link_filter_state != LFS_CAN_APPLY_CALLED) return -1;
link_filter_state = LFS_SET_LOCAL_CALLED;
@@ -9783,19 +9034,16 @@ static size_t link_filter_filter(unsigned int flags, size_t cd_nelmts,
const unsigned int cd_values[], size_t nbytes, size_t H5_ATTR_UNUSED *buf_size,
void H5_ATTR_UNUSED **buf)
{
- if(flags & H5Z_FLAG_OPTIONAL || cd_nelmts != 1 || cd_values[0] != 2112)
- return 0;
+ if(flags & H5Z_FLAG_OPTIONAL || cd_nelmts != 1 || cd_values[0] != 2112) return 0;
- if(link_filter_state == LFS_DECODED)
- return nbytes;
+ if(link_filter_state == LFS_DECODED) return nbytes;
if(flags & H5Z_FLAG_REVERSE) {
- if(link_filter_state != LFS_ENCODED)
- return 0;
+ if(link_filter_state != LFS_ENCODED) return 0;
link_filter_state = LFS_DECODED;
- } else {
- if(link_filter_state < LFS_SET_LOCAL_CALLED)
- return 0;
+ }
+ else {
+ if(link_filter_state < LFS_SET_LOCAL_CALLED) return 0;
link_filter_state = LFS_ENCODED;
} /* end else */
@@ -9816,7 +9064,7 @@ link_filters(hid_t fapl, hbool_t new_format)
int nfilters = 0;
H5Z_class2_t filter_class;
char name_out[24];
- char filename[NAME_BUF_SIZE];
+ char filename[NAME_BUF_SIZE];
htri_t tri_ret;
herr_t status;
@@ -9834,8 +9082,7 @@ link_filters(hid_t fapl, hbool_t new_format)
/* Set up filename and create file*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
+ if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create gcpl, force use of dense storage */
if((gcpl1 = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
@@ -9863,8 +9110,7 @@ link_filters(hid_t fapl, hbool_t new_format)
filter_class.set_local = link_filter_set_local;
filter_class.filter = link_filter_filter;
if(H5Zregister(&filter_class) < 0) TEST_ERROR
- if(H5Pset_filter(gcpl1, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0)
- TEST_ERROR
+ if(H5Pset_filter(gcpl1, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) TEST_ERROR
nfilters++;
/* Test various other filter functions for use on gcpl's */
@@ -9872,14 +9118,10 @@ link_filters(hid_t fapl, hbool_t new_format)
if(H5Pall_filters_avail(gcpl1) != TRUE) TEST_ERROR
/* Create a group using this filter, add some soft links to it */
- if((gid1 = H5Gcreate2(fid, "group1", H5P_DEFAULT, gcpl1, H5P_DEFAULT)) < 0)
- TEST_ERROR
- if(H5Lcreate_soft("/", gid1, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
- if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
- if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
+ if((gid1 = H5Gcreate2(fid, "group1", H5P_DEFAULT, gcpl1, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Lcreate_soft("/", gid1, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close file and group */
if(H5Gclose(gid1) < 0) TEST_ERROR
@@ -9903,12 +9145,10 @@ link_filters(hid_t fapl, hbool_t new_format)
if(H5Pclose(gcpl2) < 0) TEST_ERROR
/* Add another soft link */
- if(H5Lcreate_soft("/", gid1, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lcreate_soft("/", gid1, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Copy the group */
- if(H5Ocopy(fid, "group1", fid, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Ocopy(fid, "group1", fid, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
if((gid2 = H5Gopen2(fid, "group2", H5P_DEFAULT)) <0) TEST_ERROR
/* Verify that all links have been copied */
@@ -9937,10 +9177,8 @@ link_filters(hid_t fapl, hbool_t new_format)
/* Reopen file and group, add 2 links */
if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
if((gid1 = H5Gopen2(fid, "group1", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
- if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
+ if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close file and group */
if(H5Gclose(gid1) < 0) TEST_ERROR
@@ -9951,34 +9189,27 @@ link_filters(hid_t fapl, hbool_t new_format)
/* Test H5Pget_filter_by_id2 and H5Pget_filter2 */
if(H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out,
- &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0)
- TEST_ERROR
+ &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) TEST_ERROR
if(flags_out != 0 || cd_value_out != cd_value
|| HDstrcmp(filter_class.name, name_out)
|| filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED
- | H5Z_FILTER_CONFIG_DECODE_ENABLED))
- TEST_ERROR
+ | H5Z_FILTER_CONFIG_DECODE_ENABLED)) TEST_ERROR
if(H5Pget_filter2(gcpl2, (unsigned)(nfilters - 1), &flags_out, &cd_nelmts,
- &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0)
- TEST_ERROR
+ &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) TEST_ERROR
if(flags_out != 0 || cd_value_out != cd_value
|| HDstrcmp(filter_class.name, name_out)
|| filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED
- | H5Z_FILTER_CONFIG_DECODE_ENABLED))
- TEST_ERROR
+ | H5Z_FILTER_CONFIG_DECODE_ENABLED)) TEST_ERROR
/* Test H5Pmodify_filter */
cd_value++;
- if(H5Pmodify_filter(gcpl2, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0)
- TEST_ERROR
+ if(H5Pmodify_filter(gcpl2, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) TEST_ERROR
if(H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out,
- &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0)
- TEST_ERROR
+ &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) TEST_ERROR
if(flags_out != 0 || cd_value_out != cd_value
|| HDstrcmp(filter_class.name, name_out)
|| filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED
- | H5Z_FILTER_CONFIG_DECODE_ENABLED))
- TEST_ERROR
+ | H5Z_FILTER_CONFIG_DECODE_ENABLED)) TEST_ERROR
/* Test H5Premove_filter */
if(H5Premove_filter(gcpl2, H5Z_FILTER_RESERVED + 42) < 0) TEST_ERROR
@@ -10004,8 +9235,7 @@ link_filters(hid_t fapl, hbool_t new_format)
if(H5Pset_create_intermediate_group(lcpl, (unsigned)TRUE) < 0) TEST_ERROR
/* Create new group, with missing intermediate groups, in compressed group */
- if((gid1 = H5Gcreate2(fid, "group1/group2/group3/group4", lcpl, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- TEST_ERROR
+ if((gid1 = H5Gcreate2(fid, "group1/group2/group3/group4", lcpl, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Close LCPL ID */
if(H5Pclose(lcpl) < 0) TEST_ERROR
@@ -10033,7 +9263,6 @@ link_filters(hid_t fapl, hbool_t new_format)
/* Close file */
if(H5Fclose(fid) < 0) TEST_ERROR
-
/* Now create the same file with and without deflate, and verify that the
* file size is smaller with deflate */
/* But only if the deflate filter is available */
@@ -10047,8 +9276,7 @@ link_filters(hid_t fapl, hbool_t new_format)
if(H5Pset_link_phase_change(fcpl, 2, 2) < 0) TEST_ERROR
/* Create file */
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
- TEST_ERROR
+ if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR
/* Create links in file */
if(H5Lcreate_soft("/", fid, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", H5P_DEFAULT, H5P_DEFAULT) < 0)
@@ -10066,8 +9294,7 @@ link_filters(hid_t fapl, hbool_t new_format)
if(H5Pset_deflate(fcpl, 6) < 0) TEST_ERROR
/* Recreate the same file with the deflate filter */
- if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
- TEST_ERROR
+ if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR
if(H5Lcreate_soft("/", fid, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
if(H5Lcreate_soft("/", fid, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", H5P_DEFAULT, H5P_DEFAULT) < 0)
@@ -10080,16 +9307,14 @@ link_filters(hid_t fapl, hbool_t new_format)
filesize_filtered = h5_get_file_size(filename, fapl);
/* Check that the file size is smaller with the filter */
- if((double)filesize_filtered
- > ((double)filesize_unfiltered * FILTER_FILESIZE_MAX_FRACTION))
- TEST_ERROR
+ if((double)filesize_filtered > ((double)filesize_unfiltered * FILTER_FILESIZE_MAX_FRACTION)) TEST_ERROR
/* Close */
if(H5Pclose(fcpl) < 0) TEST_ERROR
} /* end if */
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -10101,10 +9326,10 @@ error:
H5Pclose(gcpl2);
H5Pclose(fcpl);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end link_filters() */
-
+
/*-------------------------------------------------------------------------
* Function: obj_exists
*
@@ -10112,19 +9337,15 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Tuesday, February 2, 2010
- *
*-------------------------------------------------------------------------
*/
static int
obj_exists(hid_t fapl, hbool_t new_format)
{
- char filename[NAME_BUF_SIZE]; /* Buffer for file name */
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group ID */
- herr_t status; /* Generic return value */
+ char filename[NAME_BUF_SIZE]; /* Buffer for file name */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ herr_t status; /* Generic return value */
if(new_format)
TESTING("object exists (w/new group format)")
@@ -10134,8 +9355,7 @@ obj_exists(hid_t fapl, hbool_t new_format)
/* Set up filename and create file*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
/* Hard links */
/* Verify that H5Oexists_by_name() fails for non-existent link in root group */
@@ -10145,13 +9365,11 @@ obj_exists(hid_t fapl, hbool_t new_format)
if(status >= 0) TEST_ERROR
/* Create a group, as a destination for testing */
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() succeeds for hard linked object */
- if(TRUE != H5Oexists_by_name(fid, "group", H5P_DEFAULT))
- TEST_ERROR
+ if(TRUE != H5Oexists_by_name(fid, "group", H5P_DEFAULT)) TEST_ERROR
/* Verify that H5Oexists_by_name() fails for non-existent link in non-root group */
H5E_BEGIN_TRY {
@@ -10159,240 +9377,205 @@ obj_exists(hid_t fapl, hbool_t new_format)
} H5E_END_TRY
if(status >= 0) TEST_ERROR
-
/* Soft links */
/* Create dangling soft-link in root group */
if(H5Lcreate_soft("dangle", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in root group */
- if(FALSE != H5Oexists_by_name(fid, "soft1", H5P_DEFAULT))
- TEST_ERROR
+ if(FALSE != H5Oexists_by_name(fid, "soft1", H5P_DEFAULT)) TEST_ERROR
/* Create soft-link in root group that points to object */
if(H5Lcreate_soft("/group", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns TRUE for soft-link in root group that points to object */
- if(TRUE != H5Oexists_by_name(fid, "soft2", H5P_DEFAULT))
- TEST_ERROR
+ if(TRUE != H5Oexists_by_name(fid, "soft2", H5P_DEFAULT)) TEST_ERROR
/* Create dangling soft-link in non-root group */
if(H5Lcreate_soft("dangle", fid, "group/soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in non-root group */
- if(FALSE != H5Oexists_by_name(fid, "group/soft1", H5P_DEFAULT))
- TEST_ERROR
+ if(FALSE != H5Oexists_by_name(fid, "group/soft1", H5P_DEFAULT)) TEST_ERROR
/* Create soft-link in non-root group that points to object */
if(H5Lcreate_soft("/group", fid, "group/soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns TRUE for soft-link in non-root group that points to object */
- if(TRUE != H5Oexists_by_name(fid, "group/soft2", H5P_DEFAULT))
- TEST_ERROR
-
+ if(TRUE != H5Oexists_by_name(fid, "group/soft2", H5P_DEFAULT)) TEST_ERROR
/* External links */
/* Create dangling (file doesn't exist) external link in root group */
if(H5Lcreate_external("nofile", "dangle", fid, "external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in root group */
- if(FALSE != H5Oexists_by_name(fid, "external1", H5P_DEFAULT))
- TEST_ERROR
+ if(FALSE != H5Oexists_by_name(fid, "external1", H5P_DEFAULT)) TEST_ERROR
/* Create dangling (object doesn't exist) external link in root group */
if(H5Lcreate_external(filename, "dangle", fid, "external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in root group */
- if(FALSE != H5Oexists_by_name(fid, "external2", H5P_DEFAULT))
- TEST_ERROR
+ if(FALSE != H5Oexists_by_name(fid, "external2", H5P_DEFAULT)) TEST_ERROR
/* Create external link in root group that points to object */
if(H5Lcreate_external(filename, "group", fid, "external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify that H5Oexists_by_name() returns TRUE for external link in root group that points to object */
- if(TRUE != H5Oexists_by_name(fid, "external3", H5P_DEFAULT))
- TEST_ERROR
+ if(TRUE != H5Oexists_by_name(fid, "external3", H5P_DEFAULT)) TEST_ERROR
/* Create dangling (file doesn't exist) external link in non-root group */
if(H5Lcreate_external("nofile", "dangle", fid, "group/external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in non-root group */
- if(FALSE != H5Oexists_by_name(fid, "group/external1", H5P_DEFAULT))
- TEST_ERROR
+ if(FALSE != H5Oexists_by_name(fid, "group/external1", H5P_DEFAULT)) TEST_ERROR
/* Create dangling (object doesn't exist) external link in non-root group */
if(H5Lcreate_external(filename, "dangle", fid, "group/external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in non-root group */
- if(FALSE != H5Oexists_by_name(fid, "group/external2", H5P_DEFAULT))
- TEST_ERROR
+ if(FALSE != H5Oexists_by_name(fid, "group/external2", H5P_DEFAULT)) TEST_ERROR
/* Create external link in non-root group that points to object */
if(H5Lcreate_external(filename, "group", fid, "group/external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify that H5Oexists_by_name() returns TRUE for external link in non-root group that points to object */
- if(TRUE != H5Oexists_by_name(fid, "group/external3", H5P_DEFAULT))
- TEST_ERROR
-
+ if(TRUE != H5Oexists_by_name(fid, "group/external3", H5P_DEFAULT)) TEST_ERROR
/* Soft->External links */
/* Create soft-link in root group that points to dangling (file doesn't exist) external link */
if(H5Lcreate_soft("external1", fid, "soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "soft-elink1", H5P_DEFAULT))
- TEST_ERROR
+ if(FALSE != H5Oexists_by_name(fid, "soft-elink1", H5P_DEFAULT)) TEST_ERROR
/* Create soft-link in root group that points to dangling (object doesn't exist) external link */
if(H5Lcreate_soft("external2", fid, "soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "soft-elink2", H5P_DEFAULT))
- TEST_ERROR
+ if(FALSE != H5Oexists_by_name(fid, "soft-elink2", H5P_DEFAULT)) TEST_ERROR
/* Create soft-link in root group that points to external link that points to object */
if(H5Lcreate_soft("external3", fid, "soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns TRUE */
- if(TRUE != H5Oexists_by_name(fid, "soft-elink3", H5P_DEFAULT))
- TEST_ERROR
+ if(TRUE != H5Oexists_by_name(fid, "soft-elink3", H5P_DEFAULT)) TEST_ERROR
/* Create soft-link in root group that points to dangling (file doesn't exist) external link in non-root group */
if(H5Lcreate_soft("group/external1", fid, "soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "soft-elink4", H5P_DEFAULT))
- TEST_ERROR
+ if(FALSE != H5Oexists_by_name(fid, "soft-elink4", H5P_DEFAULT)) TEST_ERROR
/* Create soft-link in root group that points to dangling (object doesn't exist) external link in non-root group */
if(H5Lcreate_soft("group/external2", fid, "soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "soft-elink5", H5P_DEFAULT))
- TEST_ERROR
+ if(FALSE != H5Oexists_by_name(fid, "soft-elink5", H5P_DEFAULT)) TEST_ERROR
/* Create soft-link in root group that points to external link in non-root group that points to object */
if(H5Lcreate_soft("group/external3", fid, "soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns TRUE */
- if(TRUE != H5Oexists_by_name(fid, "soft-elink6", H5P_DEFAULT))
- TEST_ERROR
+ if(TRUE != H5Oexists_by_name(fid, "soft-elink6", H5P_DEFAULT)) TEST_ERROR
/* Create soft-link in non-root group that points to dangling (file doesn't exist) external link */
if(H5Lcreate_soft("/external1", fid, "group/soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "group/soft-elink1", H5P_DEFAULT))
- TEST_ERROR
+ if(FALSE != H5Oexists_by_name(fid, "group/soft-elink1", H5P_DEFAULT)) TEST_ERROR
/* Create soft-link in non-root group that points to dangling (object doesn't exist) external link */
if(H5Lcreate_soft("/external2", fid, "group/soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "group/soft-elink2", H5P_DEFAULT))
- TEST_ERROR
+ if(FALSE != H5Oexists_by_name(fid, "group/soft-elink2", H5P_DEFAULT)) TEST_ERROR
/* Create soft-link in non-root group that points to external link that points to object */
if(H5Lcreate_soft("/external3", fid, "group/soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns TRUE */
- if(TRUE != H5Oexists_by_name(fid, "group/soft-elink3", H5P_DEFAULT))
- TEST_ERROR
+ if(TRUE != H5Oexists_by_name(fid, "group/soft-elink3", H5P_DEFAULT)) TEST_ERROR
/* Create soft-link in non-root group that points to dangling (file doesn't exist) external link in non-root group */
if(H5Lcreate_soft("/group/external1", fid, "group/soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "group/soft-elink4", H5P_DEFAULT))
- TEST_ERROR
+ if(FALSE != H5Oexists_by_name(fid, "group/soft-elink4", H5P_DEFAULT)) TEST_ERROR
/* Create soft-link in non-root group that points to dangling (object doesn't exist) external link in non-root group */
if(H5Lcreate_soft("/group/external2", fid, "group/soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "group/soft-elink5", H5P_DEFAULT))
- TEST_ERROR
+ if(FALSE != H5Oexists_by_name(fid, "group/soft-elink5", H5P_DEFAULT)) TEST_ERROR
/* Create soft-link in non-root group that points to external link in non-root group that points to object */
if(H5Lcreate_soft("/group/external3", fid, "group/soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Verify that H5Oexists_by_name() returns TRUE */
- if(TRUE != H5Oexists_by_name(fid, "group/soft-elink6", H5P_DEFAULT))
- TEST_ERROR
-
+ if(TRUE != H5Oexists_by_name(fid, "group/soft-elink6", H5P_DEFAULT)) TEST_ERROR
/* External->Soft links */
/* Create external link in root group that points to dangling soft link in root group */
if(H5Lcreate_external(filename, "soft1", fid, "elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "elink-soft1", H5P_DEFAULT))
- TEST_ERROR
+ if(FALSE != H5Oexists_by_name(fid, "elink-soft1", H5P_DEFAULT)) TEST_ERROR
/* Create external link in root group that points to soft link in root group that points to object */
if(H5Lcreate_external(filename, "soft2", fid, "elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify that H5Oexists_by_name() returns TRUE */
- if(TRUE != H5Oexists_by_name(fid, "elink-soft2", H5P_DEFAULT))
- TEST_ERROR
+ if(TRUE != H5Oexists_by_name(fid, "elink-soft2", H5P_DEFAULT)) TEST_ERROR
/* Create external link in root group that points to dangling soft link in non-root group */
if(H5Lcreate_external(filename, "group/soft1", fid, "elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "elink-soft3", H5P_DEFAULT))
- TEST_ERROR
+ if(FALSE != H5Oexists_by_name(fid, "elink-soft3", H5P_DEFAULT)) TEST_ERROR
/* Create external link in root group that points to soft link in root group that points to object */
if(H5Lcreate_external(filename, "group/soft2", fid, "elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify that H5Oexists_by_name() returns TRUE */
- if(TRUE != H5Oexists_by_name(fid, "elink-soft4", H5P_DEFAULT))
- TEST_ERROR
+ if(TRUE != H5Oexists_by_name(fid, "elink-soft4", H5P_DEFAULT)) TEST_ERROR
/* Create external link in non-root group that points to dangling soft link in root group */
if(H5Lcreate_external(filename, "soft1", fid, "group/elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "group/elink-soft1", H5P_DEFAULT))
- TEST_ERROR
+ if(FALSE != H5Oexists_by_name(fid, "group/elink-soft1", H5P_DEFAULT)) TEST_ERROR
/* Create external link in non-root group that points to soft link in root group that points to object */
if(H5Lcreate_external(filename, "soft2", fid, "group/elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify that H5Oexists_by_name() returns TRUE */
- if(TRUE != H5Oexists_by_name(fid, "group/elink-soft2", H5P_DEFAULT))
- TEST_ERROR
+ if(TRUE != H5Oexists_by_name(fid, "group/elink-soft2", H5P_DEFAULT)) TEST_ERROR
/* Create external link in non-root group that points to dangling soft link in non-root group */
if(H5Lcreate_external(filename, "group/soft1", fid, "group/elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify that H5Oexists_by_name() returns FALSE */
- if(FALSE != H5Oexists_by_name(fid, "group/elink-soft3", H5P_DEFAULT))
- TEST_ERROR
+ if(FALSE != H5Oexists_by_name(fid, "group/elink-soft3", H5P_DEFAULT)) TEST_ERROR
/* Create external link in non-root group that points to soft link in non-root group that points to object */
if(H5Lcreate_external(filename, "group/soft2", fid, "group/elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify that H5Oexists_by_name() returns TRUE */
- if(TRUE != H5Oexists_by_name(fid, "group/elink-soft4", H5P_DEFAULT))
- TEST_ERROR
-
+ if(TRUE != H5Oexists_by_name(fid, "group/elink-soft4", H5P_DEFAULT)) TEST_ERROR
/* Close file created */
if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
H5Gclose(gid);
H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end obj_exists() */
-
+
/*-------------------------------------------------------------------------
* Function: corder_create_empty
*
@@ -10400,19 +9583,15 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, October 30, 2006
- *
*-------------------------------------------------------------------------
*/
static int
corder_create_empty(hid_t fapl)
{
- hid_t file_id = (-1); /* File ID */
- hid_t group_id = (-1); /* Group ID */
- hid_t gcpl_id = (-1); /* Group creation property list ID */
- unsigned crt_order_flags; /* Status of creation order info for GCPL */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ unsigned crt_order_flags; /* Status of creation order info for GCPL */
herr_t ret; /* Generic return value */
char filename[NAME_BUF_SIZE];/* File name */
@@ -10434,9 +9613,9 @@ corder_create_empty(hid_t fapl)
ret = H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_INDEXED);
} H5E_END_TRY;
if(ret > 0) {
- H5_FAILED();
- HDputs(" H5Pset_link_create_order() should have failed for a creation order index with no tracking.");
- TEST_ERROR
+ H5_FAILED();
+ HDputs(" H5Pset_link_create_order() should have failed for a creation order index with no tracking.");
+ TEST_ERROR
} /* end if */
/* Set creation order tracking & indexing on group */
@@ -10461,7 +9640,6 @@ corder_create_empty(hid_t fapl)
/* Close the file */
if(H5Fclose(file_id) < 0) TEST_ERROR
-
/* Re-open the file */
if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
@@ -10488,7 +9666,7 @@ corder_create_empty(hid_t fapl)
if(H5Fclose(file_id) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -10496,10 +9674,10 @@ error:
H5Gclose(group_id);
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end corder_create_empty() */
-
+
/*-------------------------------------------------------------------------
* Function: corder_create_compact
*
@@ -10508,21 +9686,17 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, October 30, 2006
- *
*-------------------------------------------------------------------------
*/
static int
corder_create_compact(hid_t fapl)
{
- hid_t file_id = (-1); /* File ID */
- hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */
- hid_t gcpl_id = (-1); /* Group creation property list ID */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
+ hid_t gcpl_id = -1; /* Group 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" */
- unsigned nlinks; /* Number of link messages in group's header */
+ unsigned nlinks; /* Number of link messages in group's header */
char objname[NAME_BUF_SIZE]; /* Object name */
char filename[NAME_BUF_SIZE];/* File name */
unsigned u; /* Local index variable */
@@ -10552,7 +9726,7 @@ corder_create_compact(hid_t fapl)
/* Create several links, but keep group in compact form */
for(u = 0; u < max_compact; u++) {
- sprintf(objname, "filler %u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %u", u);
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Gclose(group_id2) < 0) TEST_ERROR
@@ -10572,7 +9746,6 @@ corder_create_compact(hid_t fapl)
/* Close the file */
if(H5Fclose(file_id) < 0) TEST_ERROR
-
/* Re-open the file */
if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
@@ -10591,7 +9764,7 @@ corder_create_compact(hid_t fapl)
H5L_info_t linfo; /* Link information */
/* Retrieve information for link */
- sprintf(objname, "filler %u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %u", u);
if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify creation order of link */
@@ -10606,7 +9779,7 @@ corder_create_compact(hid_t fapl)
if(H5Fclose(file_id) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -10614,10 +9787,10 @@ error:
H5Gclose(group_id);
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end corder_create_compact() */
-
+
/*-------------------------------------------------------------------------
* Function: corder_create_dense
*
@@ -10626,21 +9799,17 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, October 30, 2006
- *
*-------------------------------------------------------------------------
*/
static int
corder_create_dense(hid_t fapl)
{
- hid_t file_id = (-1); /* File ID */
- hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */
- hid_t gcpl_id = (-1); /* Group creation property list ID */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
+ hid_t gcpl_id = -1; /* Group 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" */
- unsigned nlinks; /* Number of link messages in group's header */
+ unsigned nlinks; /* Number of link messages in group's header */
hsize_t name_count; /* # of records in name index */
hsize_t corder_count; /* # of records in creation order index */
char objname[NAME_BUF_SIZE]; /* Object name */
@@ -10672,7 +9841,7 @@ corder_create_dense(hid_t fapl)
/* Create several links, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
- sprintf(objname, "filler %u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %u", u);
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Gclose(group_id2) < 0) TEST_ERROR
@@ -10684,7 +9853,7 @@ corder_create_dense(hid_t fapl)
} /* end for */
/* Create another link, to push group into dense form */
- sprintf(objname, "filler %u", max_compact);
+ HDsnprintf(objname, sizeof(objname), "filler %u", max_compact);
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Gclose(group_id2) < 0) TEST_ERROR
@@ -10706,7 +9875,6 @@ corder_create_dense(hid_t fapl)
/* Close the file */
if(H5Fclose(file_id) < 0) TEST_ERROR
-
/* Re-open the file */
if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
@@ -10724,7 +9892,7 @@ corder_create_dense(hid_t fapl)
H5L_info_t linfo; /* Link information */
/* Retrieve information for link */
- sprintf(objname, "filler %u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %u", u);
if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify creation order of link */
@@ -10739,7 +9907,7 @@ corder_create_dense(hid_t fapl)
if(H5Fclose(file_id) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -10747,10 +9915,10 @@ error:
H5Gclose(group_id);
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end corder_create_dense() */
-
+
/*-------------------------------------------------------------------------
* Function: corder_transition
*
@@ -10759,25 +9927,21 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, October 30, 2006
- *
*-------------------------------------------------------------------------
*/
static int
corder_transition(hid_t fapl)
{
- hid_t file_id = (-1); /* File ID */
- hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */
- hid_t gcpl_id = (-1); /* Group creation property list ID */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
+ hid_t gcpl_id = -1; /* Group 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" */
- unsigned nlinks; /* Number of link messages in group's header */
+ unsigned nlinks; /* Number of link messages in group's header */
hsize_t name_count; /* # of records in name index */
hsize_t corder_count; /* # of records in creation order index */
- h5_stat_size_t empty_size; /* Size of empty file */
- h5_stat_size_t file_size; /* Size of file after operating on it */
+ h5_stat_size_t empty_size; /* Size of empty file */
+ h5_stat_size_t file_size; /* Size of file after operating on it */
char objname[NAME_BUF_SIZE]; /* Object name */
char filename[NAME_BUF_SIZE];/* File name */
unsigned u; /* Local index variable */
@@ -10817,7 +9981,6 @@ corder_transition(hid_t fapl)
/* Get the size of the file with an empty group */
if((empty_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR
-
/* Re-open the file */
if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
@@ -10826,13 +9989,13 @@ corder_transition(hid_t fapl)
/* Create several links, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
- sprintf(objname, "filler %u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %u", u);
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Gclose(group_id2) < 0) TEST_ERROR
} /* end for */
/* Create another link, to push group into dense form */
- sprintf(objname, "filler %u", max_compact);
+ HDsnprintf(objname, sizeof(objname), "filler %u", max_compact);
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Gclose(group_id2) < 0) TEST_ERROR
@@ -10847,7 +10010,7 @@ corder_transition(hid_t fapl)
/* Delete several links from group, until it resumes compact form */
for(u = max_compact; u >= min_dense; u--) {
- sprintf(objname, "filler %u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %u", u);
if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify state of group */
@@ -10861,7 +10024,7 @@ corder_transition(hid_t fapl)
} /* end for */
/* Delete another link, to push group into compact form */
- sprintf(objname, "filler %u", (min_dense - 1));
+ HDsnprintf(objname, sizeof(objname), "filler %u", (min_dense - 1));
if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify state of group */
@@ -10872,7 +10035,7 @@ corder_transition(hid_t fapl)
/* Re-add links to get back into dense form */
for(u = (min_dense - 1); u < (max_compact + 1); u++) {
- sprintf(objname, "filler %u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %u", u);
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Gclose(group_id2) < 0) TEST_ERROR
} /* end for */
@@ -10892,7 +10055,6 @@ corder_transition(hid_t fapl)
/* Close the file */
if(H5Fclose(file_id) < 0) TEST_ERROR
-
/* Re-open the file */
if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
@@ -10910,7 +10072,7 @@ corder_transition(hid_t fapl)
/* Delete several links from group, until it resumes compact form */
for(u = max_compact; u >= min_dense; u--) {
- sprintf(objname, "filler %u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %u", u);
if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify state of group */
@@ -10924,7 +10086,7 @@ corder_transition(hid_t fapl)
} /* end for */
/* Delete another link, to push group into compact form */
- sprintf(objname, "filler %u", (min_dense - 1));
+ HDsnprintf(objname, sizeof(objname), "filler %u", (min_dense - 1));
if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify state of group */
@@ -10935,7 +10097,7 @@ corder_transition(hid_t fapl)
/* Re-add links to get back into dense form */
for(u = (min_dense - 1); u < (max_compact + 1); u++) {
- sprintf(objname, "filler %u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %u", u);
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Gclose(group_id2) < 0) TEST_ERROR
} /* end for */
@@ -10951,10 +10113,10 @@ corder_transition(hid_t fapl)
/* Delete all the links */
for(u = max_compact; u > 0; u--) {
- sprintf(objname, "filler %u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %u", u);
if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
} /* end for */
- sprintf(objname, "filler %u", (unsigned)0);
+ HDsnprintf(objname, sizeof(objname), "filler %u", (unsigned)0);
if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR
/* Close the group */
@@ -10968,7 +10130,7 @@ corder_transition(hid_t fapl)
if(file_size != empty_size) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -10976,10 +10138,10 @@ error:
H5Gclose(group_id);
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end corder_transition() */
-
+
/*-------------------------------------------------------------------------
* Function: corder_delete
*
@@ -10989,25 +10151,21 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, October 30, 2006
- *
*-------------------------------------------------------------------------
*/
static int
corder_delete(hid_t fapl)
{
- hid_t file_id = (-1); /* File ID */
- hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */
- hid_t gcpl_id = (-1); /* Group creation property list ID */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
+ hid_t gcpl_id = -1; /* Group 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" */
hsize_t name_count; /* # of records in name index */
hsize_t corder_count; /* # of records in creation order index */
- hbool_t reopen_file; /* Whether to re-open the file before deleting group */
- h5_stat_size_t empty_size; /* Size of empty file */
- h5_stat_size_t file_size; /* Size of file after operating on it */
+ unsigned reopen_file; /* Whether to re-open the file before deleting group */
+ h5_stat_size_t empty_size; /* Size of empty file */
+ h5_stat_size_t file_size; /* Size of file after operating on it */
char objname[NAME_BUF_SIZE]; /* Object name */
char filename[NAME_BUF_SIZE];/* File name */
unsigned u; /* Local index variable */
@@ -11019,6 +10177,8 @@ corder_delete(hid_t fapl)
for(reopen_file = FALSE; reopen_file <= TRUE; reopen_file++) {
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+
+ /* Creating file with latest format will enable paged aggregation with persistent fs */
if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
/* Close file */
@@ -11052,7 +10212,7 @@ corder_delete(hid_t fapl)
/* Create links until the group is in dense form */
for(u = 0; u < max_compact * 2; u++) {
- sprintf(objname, "filler %u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %u", u);
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
if(H5Gclose(group_id2) < 0) FAIL_STACK_ERROR
} /* end for */
@@ -11095,7 +10255,7 @@ corder_delete(hid_t fapl)
} /* end for */
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -11103,25 +10263,21 @@ error:
H5Gclose(group_id);
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end corder_delete() */
-
+
/*-------------------------------------------------------------------------
* Function: link_info_by_idx_check
*
* Purpose: Support routine for link_info_by_idx, to verify the link
* info is correct for a link
*
- * Note: This routine assumes that the links have been inserted in the
+ * Note: This routine assumes that the links have been inserted in the
* group in alphabetical order.
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Tuesday, November 7, 2006
- *
*-------------------------------------------------------------------------
*/
static int
@@ -11134,7 +10290,7 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n,
H5L_info_t linfo; /* Link info struct */
/* Make link value for increasing/native order queries */
- sprintf(valname, "value %02u", (unsigned)n);
+ HDsnprintf(valname, sizeof(valname), "value %02u", (unsigned)n);
/* Verify the link information for first link, in increasing creation order */
HDmemset(&linfo, 0, sizeof(linfo));
@@ -11265,7 +10421,7 @@ error:
return(-1);
} /* end link_info_by_idx_check() */
-
+
/*-------------------------------------------------------------------------
* Function: link_info_by_idx
*
@@ -11274,20 +10430,16 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, November 6, 2006
- *
*-------------------------------------------------------------------------
*/
static int
link_info_by_idx(hid_t fapl)
{
- hid_t file_id = (-1); /* File ID */
- hid_t group_id = (-1); /* Group ID */
- hid_t gcpl_id = (-1); /* Group creation property list ID */
- hbool_t hard_link; /* Create hard or soft link? */
- hbool_t use_index; /* Use index on creation order values */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ unsigned hard_link; /* Create hard or soft link? */
+ unsigned use_index; /* Use index on creation order values */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
H5L_info_t linfo; /* Link info struct */
@@ -11296,6 +10448,7 @@ link_info_by_idx(hid_t fapl)
char filename[NAME_BUF_SIZE];/* File name */
char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
unsigned u; /* Local index variable */
+ ssize_t name_len; /* Length of name */
herr_t ret; /* Generic return value */
/* Loop over creating hard or soft links */
@@ -11337,18 +10490,18 @@ link_info_by_idx(hid_t fapl)
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
H5E_BEGIN_TRY {
- ret = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
} H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ if(name_len >= 0) TEST_ERROR
/* Create several links, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
/* Make name for link */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Check for creating hard or soft link */
if(hard_link) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
/* Create hard link, with group object */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -11356,7 +10509,7 @@ link_info_by_idx(hid_t fapl)
} /* end if */
else {
/* Make value for link */
- sprintf(valname, "value %02u", u);
+ HDsnprintf(valname, sizeof(valname), "value %02u", u);
/* Create soft link */
if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -11379,18 +10532,18 @@ link_info_by_idx(hid_t fapl)
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
H5E_BEGIN_TRY {
- ret = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
} H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ if(name_len >= 0) TEST_ERROR
/* Create more links, to push group into dense form */
for(; u < (max_compact * 2); u++) {
/* Make name for link */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Check for creating hard or soft link */
if(hard_link) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
/* Create hard link, with group object */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -11398,7 +10551,7 @@ link_info_by_idx(hid_t fapl)
} /* end if */
else {
/* Make value for link */
- sprintf(valname, "value %02u", u);
+ HDsnprintf(valname, sizeof(valname), "value %02u", u);
/* Create soft link */
if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -11421,9 +10574,9 @@ link_info_by_idx(hid_t fapl)
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
H5E_BEGIN_TRY {
- ret = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
} H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ if(name_len >= 0) TEST_ERROR
/* Close the group */
if(H5Gclose(group_id) < 0) TEST_ERROR
@@ -11438,7 +10591,7 @@ link_info_by_idx(hid_t fapl)
} /* end for */
} /* end for */
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -11446,10 +10599,10 @@ error:
H5Gclose(group_id);
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end link_info_by_idx() */
-
+
/*-------------------------------------------------------------------------
* Function: link_info_by_idx_old
*
@@ -11458,18 +10611,14 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Tuesday, November 7, 2006
- *
*-------------------------------------------------------------------------
*/
static int
link_info_by_idx_old(hid_t fapl)
{
- hid_t file_id = (-1); /* File ID */
- hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */
- hbool_t hard_link; /* Create hard or soft link? */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
+ unsigned hard_link; /* Create hard or soft link? */
H5L_info_t linfo; /* Link info struct */
char objname[NAME_BUF_SIZE]; /* Object name */
char valname[NAME_BUF_SIZE]; /* Link value name */
@@ -11478,6 +10627,7 @@ link_info_by_idx_old(hid_t fapl)
char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
char tmpval[NAME_BUF_SIZE]; /* Temporary link value */
unsigned u; /* Local index variable */
+ ssize_t name_len; /* Length of name */
herr_t ret; /* Generic return value */
/* Loop over creating hard or soft links */
@@ -11497,7 +10647,7 @@ link_info_by_idx_old(hid_t fapl)
/* Create several links */
for(u = 0; u < CORDER_NLINKS; u++) {
/* Make name for link */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Check for creating hard or soft link */
if(hard_link) {
@@ -11515,7 +10665,7 @@ link_info_by_idx_old(hid_t fapl)
} /* end if */
else {
/* Make value for link */
- sprintf(valname, "value %02u", u);
+ HDsnprintf(valname, sizeof(valname), "value %02u", u);
/* Create soft link */
if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -11527,10 +10677,10 @@ link_info_by_idx_old(hid_t fapl)
unsigned dec_u = CORDER_NLINKS - (u + 1); /* Decreasing mapped index */
/* Make link name for increasing/native order queries */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Make link value for increasing/native order queries */
- sprintf(valname, "value %02u", u);
+ HDsnprintf(valname, sizeof(valname), "value %02u", u);
/* Verify link information (in increasing order) */
if(hard_link) {
@@ -11563,10 +10713,10 @@ link_info_by_idx_old(hid_t fapl)
/* Make link name for decreasing order queries */
- sprintf(objname, "filler %02u", dec_u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u);
/* Make link value for decreasing order queries */
- sprintf(valname, "value %02u", dec_u);
+ HDsnprintf(valname, sizeof(valname), "value %02u", dec_u);
/* Verify link information (in decreasing order) */
if(hard_link) {
@@ -11589,9 +10739,9 @@ link_info_by_idx_old(hid_t fapl)
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
H5E_BEGIN_TRY {
- ret = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
} H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ if(name_len >= 0) TEST_ERROR
/* Verify state of group */
if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR
@@ -11605,17 +10755,17 @@ link_info_by_idx_old(hid_t fapl)
PASSED();
} /* end for */
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
H5Gclose(group_id);
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end link_info_by_idx_old() */
-
+
/*-------------------------------------------------------------------------
* Function: delete_by_idx
*
@@ -11624,21 +10774,17 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Tuesday, November 14, 2006
- *
*-------------------------------------------------------------------------
*/
static int
delete_by_idx(hid_t fapl)
{
- hid_t file_id = (-1); /* File ID */
- hid_t group_id = (-1); /* Group ID */
- hid_t gcpl_id = (-1); /* Group creation property list ID */
- H5_index_t idx_type; /* Type of index to operate on */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ H5_index_t idx_type; /* Type of index to operate on */
H5_iter_order_t order; /* Order within in the index */
- hbool_t use_index; /* Use index on creation order values */
+ unsigned use_index; /* Use index on creation order values */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
H5L_info_t linfo; /* Link info struct */
@@ -11700,10 +10846,8 @@ delete_by_idx(hid_t fapl)
/* Query the group creation properties */
if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
-
/* Delete links from one end */
-
/* Check for deletion on empty group */
H5E_BEGIN_TRY {
ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT);
@@ -11718,10 +10862,10 @@ delete_by_idx(hid_t fapl)
/* Create several links, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
/* Make name for link */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -11759,9 +10903,9 @@ delete_by_idx(hid_t fapl)
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
if(order == H5_ITER_INC)
- sprintf(objname, "filler %02u", (u + 1));
+ HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1));
else
- sprintf(objname, "filler %02u", (max_compact - (u + 2)));
+ HDsnprintf(objname, sizeof(objname), "filler %02u", (max_compact - (u + 2)));
if(HDstrcmp(objname, tmpname)) TEST_ERROR
} /* end for */
@@ -11773,10 +10917,10 @@ delete_by_idx(hid_t fapl)
/* Create more links, to push group into dense form */
for(u = 0; u < (max_compact * 2); u++) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
/* Make name for link */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -11815,9 +10959,9 @@ delete_by_idx(hid_t fapl)
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
if(order == H5_ITER_INC)
- sprintf(objname, "filler %02u", (u + 1));
+ HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1));
else
- sprintf(objname, "filler %02u", ((max_compact * 2) - (u + 2)));
+ HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - (u + 2)));
if(HDstrcmp(objname, tmpname)) TEST_ERROR
} /* end for */
@@ -11834,16 +10978,14 @@ delete_by_idx(hid_t fapl)
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
-
/* Delete links in middle */
-
/* Create more links, to push group into dense form */
for(u = 0; u < (max_compact * 2); u++) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
/* Make name for link */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -11876,9 +11018,9 @@ delete_by_idx(hid_t fapl)
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
if(order == H5_ITER_INC)
- sprintf(objname, "filler %02u", ((u * 2) + 1));
+ HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1));
else
- sprintf(objname, "filler %02u", ((max_compact * 2) - ((u * 2) + 2)));
+ HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 2)));
if(HDstrcmp(objname, tmpname)) TEST_ERROR
} /* end for */
@@ -11901,9 +11043,9 @@ delete_by_idx(hid_t fapl)
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
if(order == H5_ITER_INC)
- sprintf(objname, "filler %02u", ((u * 2) + 3));
+ HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3));
else
- sprintf(objname, "filler %02u", ((max_compact * 2) - ((u * 2) + 4)));
+ HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 4)));
if(HDstrcmp(objname, tmpname)) TEST_ERROR
} /* end for */
@@ -11914,8 +11056,6 @@ delete_by_idx(hid_t fapl)
if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
-
-
/* Close the group */
if(H5Gclose(group_id) < 0) TEST_ERROR
@@ -11930,7 +11070,7 @@ delete_by_idx(hid_t fapl)
} /* end for */
} /* end for */
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -11938,10 +11078,10 @@ error:
H5Gclose(group_id);
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end delete_by_idx() */
-
+
/*-------------------------------------------------------------------------
* Function: delete_by_idx_old
*
@@ -11950,17 +11090,13 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Wednesday, November 15, 2006
- *
*-------------------------------------------------------------------------
*/
static int
delete_by_idx_old(hid_t fapl)
{
- hid_t file_id = (-1); /* File ID */
- hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
H5L_info_t linfo; /* Link info struct */
H5_iter_order_t order; /* Order within in the index */
char objname[NAME_BUF_SIZE]; /* Object name */
@@ -11985,10 +11121,8 @@ delete_by_idx_old(hid_t fapl)
/* Create group to operate on */
if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
/* Delete links from one end */
-
/* Check for deletion in empty group */
H5E_BEGIN_TRY {
ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT);
@@ -12000,7 +11134,7 @@ delete_by_idx_old(hid_t fapl)
H5O_info_t oi; /* Buffer for querying object's info */
/* Make name for link */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create group */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -12046,9 +11180,9 @@ delete_by_idx_old(hid_t fapl)
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
if(order == H5_ITER_INC)
- sprintf(objname, "filler %02u", (u + 1));
+ HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1));
else
- sprintf(objname, "filler %02u", dec_u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u);
if(HDstrcmp(objname, tmpname)) TEST_ERROR
} /* end for */
@@ -12064,16 +11198,14 @@ delete_by_idx_old(hid_t fapl)
/* Verify state of group */
if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR
-
/* Delete links in middle */
-
/* Create several links */
for(u = 0; u < CORDER_NLINKS; u++) {
H5O_info_t oi; /* Buffer for querying object's info */
/* Make name for link */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create group */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -12107,9 +11239,9 @@ delete_by_idx_old(hid_t fapl)
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
if(order == H5_ITER_INC)
- sprintf(objname, "filler %02u", ((u * 2) + 1));
+ HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1));
else
- sprintf(objname, "filler %02u", dec_u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u);
if(HDstrcmp(objname, tmpname)) TEST_ERROR
} /* end for */
@@ -12134,9 +11266,9 @@ delete_by_idx_old(hid_t fapl)
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
if(order == H5_ITER_INC)
- sprintf(objname, "filler %02u", ((u * 2) + 3));
+ HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3));
else
- sprintf(objname, "filler %02u", dec_u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u);
if(HDstrcmp(objname, tmpname)) TEST_ERROR
} /* end for */
@@ -12155,7 +11287,7 @@ delete_by_idx_old(hid_t fapl)
PASSED();
} /* end for */
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -12163,10 +11295,10 @@ error:
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end delete_by_idx_old() */
-
+
/*-------------------------------------------------------------------------
* Function: link_iterate_cb
*
@@ -12174,10 +11306,6 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, November 20, 2006
- *
*-------------------------------------------------------------------------
*/
static int
@@ -12186,14 +11314,14 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info,
{
link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */
char objname[NAME_BUF_SIZE]; /* Object name */
- H5L_info_t my_info; /* Local link info */
+ H5L_info_t my_info; /* Local link info */
/* Increment # of times the callback was called */
op_data->ncalled++;
/* Get the link information directly to compare */
if(H5Lget_info(group_id, link_name, &my_info, H5P_DEFAULT) < 0)
- return(H5_ITER_ERROR);
+ return H5_ITER_ERROR;
/* Check more things for link iteration (vs. group iteration) */
if(info) {
@@ -12201,31 +11329,31 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info,
/* (if we are operating in increasing or decreasing order) */
if(op_data->order != H5_ITER_NATIVE)
if(info->corder != op_data->curr)
- return(H5_ITER_ERROR);
+ return H5_ITER_ERROR;
/* Compare link info structs */
if(info->type != my_info.type)
- return(H5_ITER_ERROR);
+ return H5_ITER_ERROR;
if(info->corder_valid != my_info.corder_valid)
- return(H5_ITER_ERROR);
+ return H5_ITER_ERROR;
if(info->corder != my_info.corder)
- return(H5_ITER_ERROR);
+ return H5_ITER_ERROR;
if(info->cset != my_info.cset)
- return(H5_ITER_ERROR);
+ return H5_ITER_ERROR;
if(H5F_addr_ne(info->u.address, my_info.u.address))
- return(H5_ITER_ERROR);
+ return H5_ITER_ERROR;
} /* end if */
/* Verify name of link */
- sprintf(objname, "filler %02u", (unsigned)my_info.corder);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", (unsigned)my_info.corder);
if(HDstrcmp(link_name, objname))
- return(H5_ITER_ERROR);
+ return H5_ITER_ERROR;
/* Check if we've visited this link before */
if((size_t)op_data->curr >= op_data->max_visit)
- return(H5_ITER_ERROR);
+ return H5_ITER_ERROR;
if(op_data->visited[op_data->curr])
- return(H5_ITER_ERROR);
+ return H5_ITER_ERROR;
op_data->visited[op_data->curr] = TRUE;
/* Advance to next value, in correct direction */
@@ -12237,13 +11365,13 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info,
/* Check for stopping in the middle of iterating */
if(op_data->stop > 0)
if(--op_data->stop == 0)
- return(CORDER_ITER_STOP);
+ return CORDER_ITER_STOP;
- return(H5_ITER_CONT);
+ return H5_ITER_CONT;
} /* end link_iterate_cb() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
-
+
/*-------------------------------------------------------------------------
* Function: group_iterate_cb
*
@@ -12252,20 +11380,16 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info,
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, November 20, 2006
- *
*-------------------------------------------------------------------------
*/
static int
group_iterate_cb(hid_t group_id, const char *link_name, void *_op_data)
{
- return(link_iterate_cb(group_id, link_name, NULL, _op_data));
+ return link_iterate_cb(group_id, link_name, NULL, _op_data);
} /* end group_iterate_cb() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
+
/*-------------------------------------------------------------------------
* Function: link_iterate_fail_cb
*
@@ -12274,20 +11398,16 @@ group_iterate_cb(hid_t group_id, const char *link_name, void *_op_data)
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, November 20, 2006
- *
*-------------------------------------------------------------------------
*/
static int
link_iterate_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *link_name,
const H5L_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data)
{
- return(H5_ITER_ERROR);
+ return H5_ITER_ERROR;
} /* end link_iterate_fail_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: link_iterate_check
*
@@ -12295,10 +11415,6 @@ link_iterate_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *l
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, November 20, 2006
- *
*-------------------------------------------------------------------------
*/
static int
@@ -12326,7 +11442,6 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
for(v = 0; v < max_links; v++)
if(iter_info->visited[v] == FALSE) TEST_ERROR
-
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Iterate over links in group, with H5Giterate */
iter_info->nskipped = (unsigned)(gskip = 0);
@@ -12343,13 +11458,12 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
if(iter_info->visited[v] == FALSE) TEST_ERROR
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/* Skip over some links in group */
iter_info->nskipped = (unsigned)(skip = max_links / 2);
iter_info->order = order;
iter_info->stop = -1;
iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? skip : ((max_links - 1) - skip);
+ iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip));
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
if(H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR
@@ -12374,14 +11488,13 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
if(nvisit != (max_links / 2)) TEST_ERROR
} /* end else */
-
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Skip over some links in group, with H5Giterate */
- iter_info->nskipped = gskip = max_links / 2;
+ iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2));
iter_info->order = order;
iter_info->stop = -1;
iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - gskip);
+ iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
if(H5Giterate(group_id, ".", &gskip, group_iterate_cb, iter_info) < 0) TEST_ERROR
@@ -12407,7 +11520,6 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
} /* end else */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/* Iterate over links in group, stopping in the middle */
iter_info->nskipped = (unsigned)(skip = 0);
iter_info->order = order;
@@ -12419,10 +11531,9 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
if(ret != CORDER_ITER_STOP) TEST_ERROR
if(iter_info->ncalled != 3) TEST_ERROR
-
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Iterate over links in group, stopping in the middle, with H5Giterate() */
- iter_info->nskipped = gskip = 0;
+ iter_info->nskipped = (unsigned)(gskip = 0);
iter_info->order = order;
iter_info->stop = 3;
iter_info->ncalled = 0;
@@ -12433,7 +11544,6 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
if(iter_info->ncalled != 3) TEST_ERROR
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/* Check for iteration routine indicating failure */
skip = 0;
H5E_BEGIN_TRY {
@@ -12442,13 +11552,13 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
if(ret >= 0) TEST_ERROR
/* Success */
- return(0);
+ return SUCCEED;
error:
- return(-1);
+ return FAIL;
} /* end link_iterate_check() */
-
+
/*-------------------------------------------------------------------------
* Function: link_iterate
*
@@ -12466,12 +11576,12 @@ error:
static int
link_iterate(hid_t fapl)
{
- hid_t file_id = (-1); /* File ID */
- hid_t group_id = (-1); /* Group ID */
- hid_t gcpl_id = (-1); /* Group creation property list ID */
+ hid_t file_id = (-1); /* File ID */
+ hid_t group_id = (-1); /* Group ID */
+ hid_t gcpl_id = (-1); /* Group creation property list ID */
H5_index_t idx_type; /* Type of index to operate on */
H5_iter_order_t order; /* Order within in the index */
- hbool_t use_index; /* Use index on creation order values */
+ unsigned use_index; /* Use index on creation order values */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
char objname[NAME_BUF_SIZE]; /* Object name */
@@ -12553,17 +11663,16 @@ link_iterate(hid_t fapl)
/* Create group with creation order tracking on */
if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
-
/* Check for iteration on empty group */
/* (should be OK) */
if(H5Literate(group_id, idx_type, order, NULL, link_iterate_cb, NULL) < 0) TEST_ERROR
/* Create several links, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
/* Make name for link */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -12583,13 +11692,12 @@ link_iterate(hid_t fapl)
/* Test iteration over links in compact group */
if(link_iterate_check(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR
-
/* Create more links, to push group into dense form */
for(; u < (max_compact * 2); u++) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
/* Make name for link */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -12628,7 +11736,7 @@ link_iterate(hid_t fapl)
if(visited)
HDfree(visited);
- return 0;
+ return SUCCEED;
error:
/* Free resources */
@@ -12641,10 +11749,10 @@ error:
if(visited)
HDfree(visited);
- return -1;
+ return FAIL;
} /* end link_iterate() */
-
+
/*-------------------------------------------------------------------------
* Function: link_iterate_old_cb
*
@@ -12652,52 +11760,47 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, November 20, 2006
- *
*-------------------------------------------------------------------------
*/
static int
-link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *info,
- void *_op_data)
+link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, void *_op_data)
{
link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */
char objname[NAME_BUF_SIZE]; /* Object name */
- H5L_info_t my_info; /* Local link info */
+ H5L_info_t my_info; /* Local link info */
/* Increment # of times the callback was called */
op_data->ncalled++;
/* Get the link information directly to compare */
if(H5Lget_info(group_id, link_name, &my_info, H5P_DEFAULT) < 0)
- return(H5_ITER_ERROR);
+ return H5_ITER_ERROR;
/* Check more things for link iteration (vs. group iteration) */
if(info) {
/* Compare link info structs */
if(info->type != my_info.type)
- return(H5_ITER_ERROR);
+ return H5_ITER_ERROR;
if(info->corder_valid != my_info.corder_valid)
- return(H5_ITER_ERROR);
+ return H5_ITER_ERROR;
if(info->corder != my_info.corder)
- return(H5_ITER_ERROR);
+ return H5_ITER_ERROR;
if(info->cset != my_info.cset)
- return(H5_ITER_ERROR);
+ return H5_ITER_ERROR;
if(H5F_addr_ne(info->u.address, my_info.u.address))
- return(H5_ITER_ERROR);
+ return H5_ITER_ERROR;
} /* end if */
/* Verify name of link */
- sprintf(objname, "filler %02u", (info ? (unsigned)op_data->curr : (unsigned)((op_data->ncalled - 1) + op_data->nskipped)));
+ HDsnprintf(objname, sizeof(objname), "filler %02u", (info ? (unsigned)op_data->curr : (unsigned)((op_data->ncalled - 1) + op_data->nskipped)));
if(HDstrcmp(link_name, objname))
- return(H5_ITER_ERROR);
+ return H5_ITER_ERROR;
/* Check if we've visited this link before */
if((size_t)op_data->curr >= op_data->max_visit)
- return(H5_ITER_ERROR);
+ return H5_ITER_ERROR;
if(op_data->visited[op_data->curr])
- return(H5_ITER_ERROR);
+ return H5_ITER_ERROR;
op_data->visited[op_data->curr] = TRUE;
/* Advance to next value, in correct direction */
@@ -12709,13 +11812,13 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf
/* Check for stopping in the middle of iterating */
if(op_data->stop > 0)
if(--op_data->stop == 0)
- return(CORDER_ITER_STOP);
+ return CORDER_ITER_STOP;
- return(H5_ITER_CONT);
+ return H5_ITER_CONT;
} /* end link_iterate_old_cb() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
-
+
/*-------------------------------------------------------------------------
* Function: group_iterate_old_cb
*
@@ -12724,20 +11827,16 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, November 20, 2006
- *
*-------------------------------------------------------------------------
*/
static int
group_iterate_old_cb(hid_t group_id, const char *link_name, void *_op_data)
{
- return(link_iterate_old_cb(group_id, link_name, NULL, _op_data));
+ return link_iterate_old_cb(group_id, link_name, NULL, _op_data);
} /* end group_iterate_old_cb() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
+
/*-------------------------------------------------------------------------
* Function: link_iterate_old_check
*
@@ -12745,15 +11844,10 @@ group_iterate_old_cb(hid_t group_id, const char *link_name, void *_op_data)
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, November 20, 2006
- *
*-------------------------------------------------------------------------
*/
static int
-link_iterate_old_check(hid_t group_id, H5_iter_order_t order,
- unsigned max_links, link_iter_info_t *iter_info)
+link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links, link_iter_info_t *iter_info)
{
unsigned v; /* Local index variable */
hsize_t skip; /* # of links to skip in group */
@@ -12776,10 +11870,9 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order,
for(v = 0; v < max_links; v++)
if(iter_info->visited[v] == FALSE) TEST_ERROR
-
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Iterate over links in group, with H5Giterate */
- iter_info->nskipped = gskip = 0;
+ iter_info->nskipped = (unsigned)(gskip = 0);
iter_info->order = order;
iter_info->stop = -1;
iter_info->ncalled = 0;
@@ -12793,13 +11886,12 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order,
if(iter_info->visited[v] == FALSE) TEST_ERROR
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/* Skip over some links in group */
iter_info->nskipped = (unsigned)(skip = max_links / 2);
iter_info->order = order;
iter_info->stop = -1;
iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? skip : ((max_links - 1) - skip);
+ iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip));
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
if(H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR
@@ -12824,14 +11916,13 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order,
if(nvisit != (max_links / 2)) TEST_ERROR
} /* end else */
-
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Skip over some links in group, with H5Giterate */
- iter_info->nskipped = gskip = max_links / 2;
+ iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2));
iter_info->order = order;
iter_info->stop = -1;
iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - gskip);
+ iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
if(H5Giterate(group_id, ".", &gskip, group_iterate_old_cb, iter_info) < 0) TEST_ERROR
@@ -12857,7 +11948,6 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order,
} /* end else */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/* Iterate over links in group, stopping in the middle */
iter_info->nskipped = (unsigned)(skip = 0);
iter_info->order = order;
@@ -12869,10 +11959,9 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order,
if(ret != CORDER_ITER_STOP) TEST_ERROR
if(iter_info->ncalled != 3) TEST_ERROR
-
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Iterate over links in group, stopping in the middle, with H5Giterate() */
- iter_info->nskipped = gskip = 0;
+ iter_info->nskipped = (unsigned)(gskip = 0);
iter_info->order = order;
iter_info->stop = 3;
iter_info->ncalled = 0;
@@ -12883,7 +11972,6 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order,
if(iter_info->ncalled != 3) TEST_ERROR
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/* Check for iteration routine indicating failure */
skip = 0;
H5E_BEGIN_TRY {
@@ -12906,13 +11994,13 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order,
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Success */
- return(0);
+ return SUCCEED;
error:
- return(-1);
+ return FAIL;
} /* end link_iterate_old_check() */
-
+
/*-------------------------------------------------------------------------
* Function: link_iterate_old
*
@@ -12920,17 +12008,13 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Tuesday, November 14, 2006
- *
*-------------------------------------------------------------------------
*/
static int
link_iterate_old(hid_t fapl)
{
- hid_t file_id = (-1); /* File ID */
- hid_t group_id = (-1); /* Group ID */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
H5_iter_order_t order; /* Order within in the index */
char objname[NAME_BUF_SIZE]; /* Object name */
char filename[NAME_BUF_SIZE];/* File name */
@@ -12966,17 +12050,16 @@ link_iterate_old(hid_t fapl)
/* Create group with creation order tracking on */
if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
/* Check for iteration on empty group */
/* (should be OK) */
if(H5Literate(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_cb, NULL) < 0) TEST_ERROR
/* Create several links */
for(u = 0; u < CORDER_NLINKS; u++) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
/* Make name for link */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -13004,7 +12087,6 @@ link_iterate_old(hid_t fapl)
/* Test iteration over links in group */
if(link_iterate_old_check(group_id, order, u, &iter_info) < 0) TEST_ERROR
-
/* Close the group */
if(H5Gclose(group_id) < 0) TEST_ERROR
@@ -13018,7 +12100,7 @@ link_iterate_old(hid_t fapl)
if(visited)
HDfree(visited);
- return 0;
+ return SUCCEED;
error:
/* Free resources */
@@ -13030,10 +12112,10 @@ error:
if(visited)
HDfree(visited);
- return -1;
+ return FAIL;
} /* end link_iterate_old() */
-
+
/*-------------------------------------------------------------------------
* Function: open_by_idx_check
*
@@ -13041,19 +12123,14 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Tuesday, November 21, 2006
- *
*-------------------------------------------------------------------------
*/
static int
open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id,
- H5_index_t idx_type, H5_iter_order_t order, unsigned max_links,
- haddr_t *objno)
+ H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, haddr_t *objno)
{
char mntname[NAME_BUF_SIZE]; /* Link value */
- hid_t group_id = (-1); /* ID of group to test */
+ hid_t group_id = -1; /* ID of group to test */
H5O_info_t oi; /* Buffer for querying object's info */
haddr_t mnt_root_addr; /* Address of root group in file to mount */
hid_t obj_id; /* ID of object opened */
@@ -13094,10 +12171,7 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id,
} /* end for */
} /* end for */
-
- /*
- * Verify opening correct object by index when file mounting is present
- */
+ /* Verify opening correct object by index when file mounting is present */
/* Get the address of the root group in the file to mount */
if(H5Oget_info(mount_file_id, &oi) < 0) TEST_ERROR
@@ -13105,7 +12179,7 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id,
/* Mount a file over a group in main group */
mnt_idx = 2;
- sprintf(mntname, "/%s/filler %02u", CORDER_GROUP_NAME, mnt_idx);
+ HDsnprintf(mntname, sizeof(mntname), "/%s/filler %02u", CORDER_GROUP_NAME, mnt_idx);
if(H5Fmount(main_group_id, mntname, mount_file_id, H5P_DEFAULT) < 0) TEST_ERROR
/* Open the object that the file is mounted on */
@@ -13124,15 +12198,14 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id,
/* Unmount the file */
if(H5Funmount(main_group_id, mntname) < 0) TEST_ERROR
-
/* Success */
- return(0);
+ return SUCCEED;
error:
- return(-1);
+ return FAIL;
} /* end open_by_idx_check() */
-
+
/*-------------------------------------------------------------------------
* Function: open_by_idx
*
@@ -13141,32 +12214,28 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Tuesday, November 21, 2006
- *
*-------------------------------------------------------------------------
*/
static int
open_by_idx(hid_t fapl)
{
- hid_t file_id = (-1); /* File ID */
- hid_t mount_file_id = (-1); /* File ID for file to mount */
- hid_t group_id = (-1); /* Group ID */
- hid_t soft_group_id = (-1); /* Group ID for soft links */
- hid_t gcpl_id = (-1); /* Group creation property list ID */
- H5_index_t idx_type; /* Type of index to operate on */
+ hid_t file_id = -1; /* File ID */
+ hid_t mount_file_id = -1; /* File ID for file to mount */
+ hid_t group_id = -1; /* Group ID */
+ hid_t soft_group_id = -1; /* Group ID for soft links */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ H5_index_t idx_type; /* Type of index to operate on */
H5_iter_order_t order; /* Order within in the index */
- hbool_t use_index; /* Use index on creation order values */
+ unsigned use_index; /* Use index on creation order values */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
H5O_info_t oi; /* Buffer for querying object's info */
char filename[NAME_BUF_SIZE];/* File name */
char objname[NAME_BUF_SIZE]; /* Object name */
- char valname[NAME_BUF_SIZE]; /* Link value */
+ char valname[2 * NAME_BUF_SIZE]; /* Link value */
haddr_t *objno = NULL; /* Addresses of the objects created */
unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t ret; /* Generic return value */
/* Create group creation property list */
if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
@@ -13244,20 +12313,18 @@ open_by_idx(hid_t fapl)
/* Create group with creation order tracking on for soft links */
if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
-
/* Try to open on object in an empty group */
H5E_BEGIN_TRY {
ret = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT);
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
-
/* Create several links, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
/* Make name for link */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -13270,7 +12337,7 @@ open_by_idx(hid_t fapl)
if(H5Gclose(group_id2) < 0) TEST_ERROR
/* Create soft link in another group, to objects in main group */
- sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname);
+ HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname);
if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
} /* end for */
@@ -13286,13 +12353,12 @@ open_by_idx(hid_t fapl)
/* Verify opening objects by index */
if(open_by_idx_check(group_id, soft_group_id, mount_file_id, idx_type, order, u, objno) < 0) TEST_ERROR
-
/* Create more links, to push group into dense form */
for(; u < (max_compact * 2); u++) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
/* Make name for link */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -13305,7 +12371,7 @@ open_by_idx(hid_t fapl)
if(H5Gclose(group_id2) < 0) TEST_ERROR
/* Create soft link in another group, to objects in main group */
- sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname);
+ HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname);
if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
} /* end for */
@@ -13321,7 +12387,6 @@ open_by_idx(hid_t fapl)
/* Verify opening objects by index */
if(open_by_idx_check(group_id, soft_group_id, mount_file_id, idx_type, order, u, objno) < 0) TEST_ERROR
-
/* Close the groups */
if(H5Gclose(group_id) < 0) TEST_ERROR
if(H5Gclose(soft_group_id) < 0) TEST_ERROR
@@ -13344,7 +12409,7 @@ open_by_idx(hid_t fapl)
if(objno)
HDfree(objno);
- return 0;
+ return SUCCEED;
error:
/* Free resources */
@@ -13359,10 +12424,10 @@ error:
if(objno)
HDfree(objno);
- return -1;
+ return FAIL;
} /* end open_by_idx() */
-
+
/*-------------------------------------------------------------------------
* Function: open_by_idx_old
*
@@ -13371,27 +12436,23 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Tuesday, November 21, 2006
- *
*-------------------------------------------------------------------------
*/
static int
open_by_idx_old(hid_t fapl)
{
- hid_t file_id = (-1); /* File ID */
- hid_t mount_file_id = (-1); /* File ID for file to mount */
- hid_t group_id = (-1); /* Group ID */
- hid_t soft_group_id = (-1); /* Group ID for soft links */
+ hid_t file_id = -1; /* File ID */
+ hid_t mount_file_id = -1; /* File ID for file to mount */
+ hid_t group_id = -1; /* Group ID */
+ hid_t soft_group_id = -1; /* Group ID for soft links */
H5_iter_order_t order; /* Order within in the index */
H5O_info_t oi; /* Buffer for querying object's info */
char filename[NAME_BUF_SIZE];/* File name */
char objname[NAME_BUF_SIZE]; /* Object name */
- char valname[NAME_BUF_SIZE]; /* Link value */
+ char valname[2 * NAME_BUF_SIZE]; /* Link value */
haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */
unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t ret; /* Generic return value */
/* Create file to mount */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
@@ -13428,13 +12489,12 @@ open_by_idx_old(hid_t fapl)
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
-
/* Create several links */
for(u = 0; u < CORDER_NLINKS; u++) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
/* Make name for link */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -13447,7 +12507,7 @@ open_by_idx_old(hid_t fapl)
if(H5Gclose(group_id2) < 0) TEST_ERROR
/* Create soft link in another group, to objects in main group */
- sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname);
+ HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname);
if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
} /* end for */
@@ -13469,7 +12529,6 @@ open_by_idx_old(hid_t fapl)
/* Verify opening objects by index */
if(open_by_idx_check(group_id, soft_group_id, mount_file_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR
-
/* Close the groups */
if(H5Gclose(group_id) < 0) TEST_ERROR
if(H5Gclose(soft_group_id) < 0) TEST_ERROR
@@ -13483,7 +12542,7 @@ open_by_idx_old(hid_t fapl)
/* Close the file for mounting */
if(H5Fclose(mount_file_id) < 0) TEST_ERROR
- return 0;
+ return SUCCEED;
error:
/* Free resources */
@@ -13494,10 +12553,10 @@ error:
H5Fclose(mount_file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end open_by_idx_old() */
-
+
/*-------------------------------------------------------------------------
* Function: object_info_check
*
@@ -13505,10 +12564,6 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Sunday, November 26, 2006
- *
*-------------------------------------------------------------------------
*/
static int
@@ -13516,7 +12571,7 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type,
H5_iter_order_t order, unsigned max_links, haddr_t *objno)
{
char objname[NAME_BUF_SIZE]; /* Object name */
- hid_t group_id = (-1); /* ID of group to test */
+ hid_t group_id = -1; /* ID of group to test */
H5O_info_t oinfo; /* Buffer for querying object's info */
unsigned u, v; /* Local index variables */
@@ -13531,7 +12586,7 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type,
/* Open each object in group by name and check that it's the correct one */
for(u = 0; u < max_links; u++) {
/* Make name for link */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Query the object's information, by name */
if(H5Oget_info_by_name(group_id, objname, &oinfo, H5P_DEFAULT) < 0) TEST_ERROR
@@ -13562,13 +12617,13 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type,
} /* end for */
/* Success */
- return(0);
+ return SUCCEED;
error:
- return(-1);
+ return FAIL;
} /* end object_info_check() */
-
+
/*-------------------------------------------------------------------------
* Function: object_info
*
@@ -13577,29 +12632,25 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Sunday, November 26, 2006
- *
*-------------------------------------------------------------------------
*/
static int
object_info(hid_t fapl)
{
- hid_t file_id = (-1); /* File ID */
- hid_t group_id = (-1); /* Group ID */
- hid_t soft_group_id = (-1); /* Group ID for soft links */
- hid_t gcpl_id = (-1); /* Group creation property list ID */
- hid_t space_id = (-1); /* Dataspace ID (for attributes) */
- H5_index_t idx_type; /* Type of index to operate on */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ hid_t soft_group_id = -1; /* Group ID for soft links */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ hid_t space_id = -1; /* Dataspace ID (for attributes) */
+ H5_index_t idx_type; /* Type of index to operate on */
H5_iter_order_t order; /* Order within in the index */
- hbool_t use_index; /* Use index on creation order values */
+ unsigned use_index; /* Use index on creation order values */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
H5O_info_t oinfo; /* Buffer for querying object's info */
char filename[NAME_BUF_SIZE];/* File name */
char objname[NAME_BUF_SIZE]; /* Object name */
- char valname[NAME_BUF_SIZE]; /* Link value */
+ char valname[2 * NAME_BUF_SIZE]; /* Link value */
char attrname[NAME_BUF_SIZE]; /* Attribute name */
haddr_t *objno = NULL; /* Addresses of the objects created */
herr_t ret; /* Generic return value */
@@ -13689,11 +12740,11 @@ object_info(hid_t fapl)
/* Create several links, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
hid_t attr_id; /* Attribute ID */
/* Make name for link */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -13705,7 +12756,7 @@ object_info(hid_t fapl)
/* Create attributes on new object */
for(v = 0; v < u; v++) {
/* Make name for attribute */
- sprintf(attrname, "attr %02u", v);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", v);
/* Create attribute */
if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -13718,7 +12769,7 @@ object_info(hid_t fapl)
if(H5Gclose(group_id2) < 0) TEST_ERROR
/* Create soft link in another group, to objects in main group */
- sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname);
+ HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname);
if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
} /* end for */
@@ -13737,11 +12788,11 @@ object_info(hid_t fapl)
/* Create more links, to push group into dense form */
for(; u < (max_compact * 2); u++) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
hid_t attr_id; /* Attribute ID */
/* Make name for link */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -13753,7 +12804,7 @@ object_info(hid_t fapl)
/* Create attributes on new object */
for(v = 0; v < u; v++) {
/* Make name for attribute */
- sprintf(attrname, "attr %02u", v);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", v);
/* Create attribute */
if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -13766,7 +12817,7 @@ object_info(hid_t fapl)
if(H5Gclose(group_id2) < 0) TEST_ERROR
/* Create soft link in another group, to objects in main group */
- sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname);
+ HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname);
if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
} /* end for */
@@ -13801,7 +12852,7 @@ object_info(hid_t fapl)
if(objno)
HDfree(objno);
- return 0;
+ return SUCCEED;
error:
/* Free resources */
@@ -13816,10 +12867,10 @@ error:
if(objno)
HDfree(objno);
- return -1;
+ return FAIL;
} /* end object_info() */
-
+
/*-------------------------------------------------------------------------
* Function: object_info_old
*
@@ -13827,24 +12878,20 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Sunday, November 26, 2006
- *
*-------------------------------------------------------------------------
*/
static int
object_info_old(hid_t fapl)
{
- hid_t file_id = (-1); /* File ID */
- hid_t group_id = (-1); /* Group ID */
- hid_t soft_group_id = (-1); /* Group ID for soft links */
- hid_t space_id = (-1); /* Dataspace ID (for attributes) */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ hid_t soft_group_id = -1; /* Group ID for soft links */
+ hid_t space_id = -1; /* Dataspace ID (for attributes) */
H5_iter_order_t order; /* Order within in the index */
H5O_info_t oinfo; /* Buffer for querying object's info */
char filename[NAME_BUF_SIZE];/* File name */
char objname[NAME_BUF_SIZE]; /* Object name */
- char valname[NAME_BUF_SIZE]; /* Link value */
+ char valname[2 * NAME_BUF_SIZE]; /* Link value */
char attrname[NAME_BUF_SIZE]; /* Attribute name */
haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */
herr_t ret; /* Generic return value */
@@ -13877,7 +12924,6 @@ object_info_old(hid_t fapl)
/* Create old-style group for soft links */
if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
/* Check for out of bound query by index on empty group */
H5E_BEGIN_TRY {
ret = H5Oget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5P_DEFAULT);
@@ -13886,11 +12932,11 @@ object_info_old(hid_t fapl)
/* Create several links */
for(u = 0; u < CORDER_NLINKS; u++) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
hid_t attr_id; /* Attribute ID */
/* Make name for link */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -13902,7 +12948,7 @@ object_info_old(hid_t fapl)
/* Create attributes on new object */
for(v = 0; v < u; v++) {
/* Make name for attribute */
- sprintf(attrname, "attr %02u", v);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", v);
/* Create attribute */
if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -13915,7 +12961,7 @@ object_info_old(hid_t fapl)
if(H5Gclose(group_id2) < 0) TEST_ERROR
/* Create soft link in another group, to objects in main group */
- sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname);
+ HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname);
if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
} /* end for */
@@ -13937,7 +12983,6 @@ object_info_old(hid_t fapl)
/* Verify querying objects by name */
if(object_info_check(group_id, soft_group_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR
-
/* Close the groups */
if(H5Gclose(group_id) < 0) TEST_ERROR
if(H5Gclose(soft_group_id) < 0) TEST_ERROR
@@ -13951,7 +12996,7 @@ object_info_old(hid_t fapl)
/* Free resources */
if(H5Sclose(space_id) < 0) TEST_ERROR
- return 0;
+ return SUCCEED;
error:
/* Free resources */
@@ -13962,10 +13007,10 @@ error:
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end object_info_old() */
-
+
/*-------------------------------------------------------------------------
* Function: group_info
*
@@ -13974,29 +13019,25 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, November 27, 2006
- *
*-------------------------------------------------------------------------
*/
static int
group_info(hid_t fapl)
{
- hid_t file_id = (-1); /* File ID */
- hid_t group_id = (-1); /* Group ID */
- hid_t soft_group_id = (-1); /* Group ID for soft links */
- hid_t gcpl_id = (-1); /* Group creation property list ID */
- H5_index_t idx_type; /* Type of index to operate on */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ hid_t soft_group_id = -1; /* Group ID for soft links */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ H5_index_t idx_type; /* Type of index to operate on */
H5_iter_order_t order; /* Order within in the index */
- hbool_t use_index; /* Use index on creation order values */
+ unsigned use_index; /* Use index on creation order values */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
H5G_info_t grp_info; /* Buffer for querying object's info */
char filename[NAME_BUF_SIZE];/* File name */
char objname[NAME_BUF_SIZE]; /* Object name */
char objname2[NAME_BUF_SIZE]; /* Object name */
- char valname[NAME_BUF_SIZE]; /* Link value */
+ char valname[2 * NAME_BUF_SIZE]; /* Link value */
herr_t ret; /* Generic return value */
unsigned u, v; /* Local index variables */
@@ -14069,7 +13110,6 @@ group_info(hid_t fapl)
/* Create group with creation order tracking on for soft links */
if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
-
/* Check for out of bound query by index on empty group */
H5E_BEGIN_TRY {
ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT);
@@ -14078,15 +13118,14 @@ group_info(hid_t fapl)
/* Create several links, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
- hid_t group_id2, group_id3; /* Group IDs */
+ hid_t group_id2, group_id3; /* Group IDs */
/* Make name for link */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
-
/* Retrieve group's information */
if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR
@@ -14111,11 +13150,10 @@ group_info(hid_t fapl)
if(grp_info.max_corder != 0) TEST_ERROR
if(grp_info.nlinks != 0) TEST_ERROR
-
/* Create objects in new group created */
for(v = 0; v <= u; v++) {
/* Make name for link */
- sprintf(objname2, "filler %02u", v);
+ HDsnprintf(objname2, sizeof(objname2), "filler %02u", v);
/* Create hard link, with group object */
if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -14124,7 +13162,6 @@ group_info(hid_t fapl)
if(H5Gclose(group_id3) < 0) TEST_ERROR
} /* end for */
-
/* Retrieve group's information */
if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR
@@ -14149,7 +13186,6 @@ group_info(hid_t fapl)
if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
-
/* Retrieve group's information */
if(order != H5_ITER_NATIVE) {
if(order == H5_ITER_INC) {
@@ -14168,7 +13204,6 @@ group_info(hid_t fapl)
/* Close group created */
if(H5Gclose(group_id2) < 0) TEST_ERROR
-
/* Retrieve main group's information */
if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR
@@ -14193,9 +13228,8 @@ group_info(hid_t fapl)
if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
-
/* Create soft link in another group, to objects in main group */
- sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname);
+ HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname);
if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Retrieve soft link group's information, by name */
@@ -14216,18 +13250,16 @@ group_info(hid_t fapl)
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
-
/* Create more links, to push group into dense form */
for(; u < (max_compact * 2); u++) {
- hid_t group_id2, group_id3; /* Group IDs */
+ hid_t group_id2, group_id3; /* Group IDs */
/* Make name for link */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
-
/* Retrieve group's information */
if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR
@@ -14252,11 +13284,10 @@ group_info(hid_t fapl)
if(grp_info.max_corder != 0) TEST_ERROR
if(grp_info.nlinks != 0) TEST_ERROR
-
/* Create objects in new group created */
for(v = 0; v <= u; v++) {
/* Make name for link */
- sprintf(objname2, "filler %02u", v);
+ HDsnprintf(objname2, sizeof(objname2), "filler %02u", v);
/* Create hard link, with group object */
if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -14265,7 +13296,6 @@ group_info(hid_t fapl)
if(H5Gclose(group_id3) < 0) TEST_ERROR
} /* end for */
-
/* Retrieve group's information */
if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR
@@ -14290,7 +13320,6 @@ group_info(hid_t fapl)
if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
-
/* Retrieve group's information */
if(order != H5_ITER_NATIVE) {
if(order == H5_ITER_INC) {
@@ -14309,7 +13338,6 @@ group_info(hid_t fapl)
/* Close group created */
if(H5Gclose(group_id2) < 0) TEST_ERROR
-
/* Retrieve main group's information */
if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR
@@ -14334,9 +13362,8 @@ group_info(hid_t fapl)
if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
-
/* Create soft link in another group, to objects in main group */
- sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname);
+ HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname);
if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Retrieve soft link group's information, by name */
@@ -14357,7 +13384,6 @@ group_info(hid_t fapl)
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
-
/* Close the groups */
if(H5Gclose(group_id) < 0) TEST_ERROR
if(H5Gclose(soft_group_id) < 0) TEST_ERROR
@@ -14373,7 +13399,7 @@ group_info(hid_t fapl)
/* Free resources */
if(H5Pclose(gcpl_id) < 0) TEST_ERROR
- return 0;
+ return SUCCEED;
error:
/* Free resources */
@@ -14384,10 +13410,10 @@ error:
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end group_info() */
-
+
/*-------------------------------------------------------------------------
* Function: group_info_old
*
@@ -14396,24 +13422,20 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, November 27, 2006
- *
*-------------------------------------------------------------------------
*/
static int
group_info_old(hid_t fapl)
{
- hid_t file_id = (-1); /* File ID */
- hid_t group_id = (-1); /* Group ID */
- hid_t soft_group_id = (-1); /* Group ID for soft links */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ hid_t soft_group_id = -1; /* Group ID for soft links */
H5_iter_order_t order; /* Order within in the index */
H5G_info_t grp_info; /* Buffer for querying object's info */
char filename[NAME_BUF_SIZE];/* File name */
char objname[NAME_BUF_SIZE]; /* Object name */
char objname2[NAME_BUF_SIZE]; /* Object name */
- char valname[NAME_BUF_SIZE]; /* Link value */
+ char valname[2 * NAME_BUF_SIZE]; /* Link value */
herr_t ret; /* Generic return value */
unsigned u, v; /* Local index variables */
@@ -14440,7 +13462,6 @@ group_info_old(hid_t fapl)
/* Create old-style group for soft links */
if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
/* Check for out of bound query by index on empty group */
H5E_BEGIN_TRY {
ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT);
@@ -14449,15 +13470,14 @@ group_info_old(hid_t fapl)
/* Create several links */
for(u = 0; u < CORDER_NLINKS; u++) {
- hid_t group_id2, group_id3; /* Group IDs */
+ hid_t group_id2, group_id3; /* Group IDs */
/* Make name for link */
- sprintf(objname, "filler %02u", u);
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Create hard link, with group object */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
/* Retrieve group's information */
if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR
@@ -14482,11 +13502,10 @@ group_info_old(hid_t fapl)
if(grp_info.max_corder != 0) TEST_ERROR
if(grp_info.nlinks != 0) TEST_ERROR
-
/* Create objects in new group created */
for(v = 0; v <= u; v++) {
/* Make name for link */
- sprintf(objname2, "filler %02u", v);
+ HDsnprintf(objname2, sizeof(objname2), "filler %02u", v);
/* Create hard link, with group object */
if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -14495,7 +13514,6 @@ group_info_old(hid_t fapl)
if(H5Gclose(group_id3) < 0) TEST_ERROR
} /* end for */
-
/* Retrieve group's information */
if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR
@@ -14520,7 +13538,6 @@ group_info_old(hid_t fapl)
if(grp_info.max_corder != 0) TEST_ERROR
if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
-
/* Retrieve group's information */
if(order != H5_ITER_NATIVE) {
if(order == H5_ITER_INC) {
@@ -14539,7 +13556,6 @@ group_info_old(hid_t fapl)
/* Close group created */
if(H5Gclose(group_id2) < 0) TEST_ERROR
-
/* Retrieve main group's information */
if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR
@@ -14564,9 +13580,8 @@ group_info_old(hid_t fapl)
if(grp_info.max_corder != 0) TEST_ERROR
if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
-
/* Create soft link in another group, to objects in main group */
- sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname);
+ HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname);
if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Retrieve soft link group's information, by name */
@@ -14593,7 +13608,6 @@ group_info_old(hid_t fapl)
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
-
/* Close the groups */
if(H5Gclose(group_id) < 0) TEST_ERROR
if(H5Gclose(soft_group_id) < 0) TEST_ERROR
@@ -14604,7 +13618,7 @@ group_info_old(hid_t fapl)
PASSED();
} /* end for */
- return 0;
+ return SUCCEED;
error:
/* Free resources */
@@ -14614,10 +13628,10 @@ error:
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end group_info_old() */
-
+
/*-------------------------------------------------------------------------
* Function: timestamps
*
@@ -14626,20 +13640,16 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Saturday, March 3, 2007
- *
*-------------------------------------------------------------------------
*/
static int
timestamps(hid_t fapl)
{
- hid_t file_id = (-1); /* File ID */
- hid_t group_id = (-1); /* Group ID */
- hid_t group_id2 = (-1); /* Group ID */
- hid_t gcpl_id = (-1); /* Group creation property list ID */
- hid_t gcpl_id2 = (-1); /* Group creation property list ID */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ hid_t group_id2 = -1; /* Group ID */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ hid_t gcpl_id2 = -1; /* Group creation property list ID */
H5O_info_t oinfo, oinfo2; /* Object info for groups created */
char filename[NAME_BUF_SIZE];/* File name */
hbool_t track_times; /* The object timestamp setting */
@@ -14665,7 +13675,6 @@ timestamps(hid_t fapl)
/* Check default timestamp information */
if(track_times != FALSE) TEST_ERROR
-
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
@@ -14718,7 +13727,6 @@ timestamps(hid_t fapl)
/* Close the file */
if(H5Fclose(file_id) < 0) TEST_ERROR
-
/* Re-open the file */
if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
@@ -14767,7 +13775,7 @@ timestamps(hid_t fapl)
PASSED();
- return 0;
+ return SUCCEED;
error:
/* Free resources */
@@ -14777,31 +13785,26 @@ error:
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end timestamps() */
-
+
/*-------------------------------------------------------------------------
- * Function: main
- *
- * Purpose: Test links
- *
- * Return: Success: exit(0)
- *
- * Failure: exit(non-zero)
+ * Function: main
*
- * Programmer: Robb Matzke
- * Friday, August 14, 1998
+ * Purpose: Test links
*
+ * Return: Success: exit(EXIT_SUCCESS)
+ * Failure: exit(EXIT_FAILURE)
*-------------------------------------------------------------------------
*/
int
main(void)
{
- hid_t fapl, fapl2; /* File access property lists */
- int nerrors = 0;
- hbool_t new_format; /* Whether to use the new format or not */
- hbool_t efc; /* Whether to use the external file cache */
+ hid_t fapl = -1, fapl2 = -1; /* File access property lists */
+ int nerrors = 0;
+ unsigned new_format; /* Whether to use the new format or not */
+ unsigned efc; /* Whether to use the external file cache */
const char *env_h5_drvr; /* File Driver value from environment */
env_h5_drvr = HDgetenv("HDF5_DRIVER");
@@ -14822,10 +13825,14 @@ main(void)
hid_t my_fapl;
/* Check for FAPL to use */
- if(new_format)
+ if(new_format) {
my_fapl = fapl2;
- else
+ HDprintf("\n--Testing with 'new format'--\n");
+ }
+ else {
my_fapl = fapl;
+ HDprintf("\n--Testing with 'old format'--\n");
+ }
/* General tests... (on both old & new format groups */
nerrors += mklinks(my_fapl, new_format) < 0 ? 1 : 0;
@@ -14845,30 +13852,29 @@ main(void)
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* tests for external link */
- /* Test external file cache first, so it sees the default efc setting on
- * the fapl */
+ /* Test external file cache first, so it sees the default efc setting on the fapl
+ */
nerrors += external_file_cache(my_fapl, new_format) < 0 ? 1 : 0;
/* This test cannot run with the EFC because it assumes that an
- * intermediate file is not held open */
+ * intermediate file is not held open
+ */
nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0;
/* This test cannot run with the EFC because the EFC cannot currently
- * reopen a cached file with a different intent */
+ * reopen a cached file with a different intent
+ */
nerrors += external_set_elink_acc_flags(my_fapl, new_format) < 0 ? 1 : 0;
- /* Try external link tests both with and without the external file cache
- */
+ /* Try external link tests both with and without the external file cache */
for(efc = FALSE; efc <= TRUE; efc++) {
if(efc) {
- if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0)
- TEST_ERROR
- printf("\n---Testing with external file cache---\n");
+ if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) TEST_ERROR
+ HDprintf("\n---Testing with external file cache---\n");
} /* end if */
else {
- if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0)
- TEST_ERROR
- printf("\n---Testing without external file cache---\n");
+ if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) TEST_ERROR
+ HDprintf("\n---Testing without external file cache---\n");
} /* end else */
nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0;
@@ -14914,13 +13920,13 @@ main(void)
nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0;
} /* end for */
/* These tests assume that external links are a form of UD links,
- * so assume that everything that passed for external links
- * above has already been tested for UD links.
- */
+ * so assume that everything that passed for external links
+ * above has already been tested for UD links.
+ */
if(new_format == TRUE) {
nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */
nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */
@@ -14947,10 +13953,11 @@ main(void)
/* New group revision feature tests */
nerrors += corder_create_empty(fapl2) < 0 ? 1 : 0;
+
/* XXX: when creation order indexing is fully working, go back and add checks
-* to these tests to make certain that the creation order values are
-* correct.
-*/
+ * to these tests to make certain that the creation order values are
+ * correct.
+ */
nerrors += corder_create_compact(fapl2) < 0 ? 1 : 0;
nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0;
nerrors += corder_transition(fapl2) < 0 ? 1 : 0;
@@ -14986,11 +13993,10 @@ main(void)
/* Results */
if(nerrors) {
- printf("***** %d LINK TEST%s FAILED! *****\n",
- nerrors, 1 == nerrors ? "" : "S");
- HDexit(1);
+ HDprintf("***** %d LINK TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
+ HDexit(EXIT_FAILURE);
}
- printf("All link tests passed.\n");
+ HDprintf("All link tests passed.\n");
/* clean up symlink created by external link tests */
HDremove(SYMLINK1);
@@ -15000,7 +14006,7 @@ main(void)
HDrmdir(TMPDIR);
HDrmdir(TMPDIR2);
- return 0;
+ return SUCCEED;
error:
HDputs("*** TESTS FAILED ***");
diff --git a/test/links_env.c b/test/links_env.c
index ef6c5e5..470ef9a 100644
--- a/test/links_env.c
+++ b/test/links_env.c
@@ -136,8 +136,8 @@ external_link_env(hid_t fapl, hbool_t new_format)
*
* Purpose: Test external link with environment variable HDF5_EXT_PREFIX
*
- * Return: Success: exit(0)
- * Failure: exit(non-zero)
+ * Return: Success: exit(EXIT_SUCCESS)
+ * Failure: exit(EXIT_FAILURE)
*
* Programmer: Vailin Choi; Nov 2010
*
@@ -171,11 +171,11 @@ main(void)
/* Results */
if(nerrors) {
- printf("***** %d External Link (HDF5_EXT_PREFIX) test%s FAILED! *****\n",
+ HDprintf("***** %d External Link (HDF5_EXT_PREFIX) test%s FAILED! *****\n",
nerrors, 1 == nerrors ? "" : "s");
- exit(1);
+ HDexit(EXIT_FAILURE);
}
- printf("All external Link (HDF5_EXT_PREFIX) tests passed.\n");
+ HDprintf("All external Link (HDF5_EXT_PREFIX) tests passed.\n");
/* clean up tmp directory created by external link tests */
HDrmdir(TMPDIR);
@@ -183,6 +183,6 @@ main(void)
return 0;
error:
- puts("*** TESTS FAILED ***");
+ HDputs("*** TESTS FAILED ***");
return 1;
}
diff --git a/test/mf.c b/test/mf.c
index 7608c09..7703ef4 100644
--- a/test/mf.c
+++ b/test/mf.c
@@ -64,9 +64,9 @@ const char *FILENAME[] = {
};
typedef enum {
- TEST_NORMAL, /* size of aggregator is >= alignment size */
- TEST_AGGR_SMALL, /* size of aggregator is smaller than alignment size */
- TEST_NTESTS /* The number of test types, must be last */
+ TEST_NORMAL, /* size of aggregator is >= alignment size */
+ TEST_AGGR_SMALL, /* size of aggregator is smaller than alignment size */
+ TEST_NTESTS /* The number of test types, must be last */
} test_type_t;
typedef struct frspace_state_t {
@@ -107,9 +107,6 @@ static unsigned test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t
/*
* Verify statistics for the free-space manager
*
- * Modifications:
- * Vailin Choi; July 2012
- * To ensure "f" and "frsp" are valid pointers
*/
static int
check_stats(const H5F_t *f, const H5FS_t *frsp, frspace_state_t *state)
@@ -125,22 +122,22 @@ check_stats(const H5F_t *f, const H5FS_t *frsp, frspace_state_t *state)
if(frspace_stats.tot_space != state->tot_space) {
HDfprintf(stdout, "frspace_stats.tot_space = %Hu, state->tot_space = %Zu\n",
- frspace_stats.tot_space, state->tot_space);
+ frspace_stats.tot_space, state->tot_space);
TEST_ERROR
} /* end if */
if(frspace_stats.tot_sect_count != state->tot_sect_count) {
HDfprintf(stdout, "frspace_stats.tot_sect_count = %Hu, state->tot_sect_count = %Hu\n",
- frspace_stats.tot_sect_count, state->tot_sect_count);
+ frspace_stats.tot_sect_count, state->tot_sect_count);
TEST_ERROR
} /* end if */
if(frspace_stats.serial_sect_count != state->serial_sect_count) {
HDfprintf(stdout, "frspace_stats.serial_sect_count = %Hu, state->serial_sect_count = %Hu\n",
- frspace_stats.serial_sect_count, state->serial_sect_count);
+ frspace_stats.serial_sect_count, state->serial_sect_count);
TEST_ERROR
} /* end if */
if(frspace_stats.ghost_sect_count != state->ghost_sect_count) {
HDfprintf(stdout, "frspace_stats.ghost_sect_count = %Hu, state->ghost_sect_count = %Hu\n",
- frspace_stats.ghost_sect_count, state->ghost_sect_count);
+ frspace_stats.ghost_sect_count, state->ghost_sect_count);
TEST_ERROR
} /* end if */
@@ -152,13 +149,15 @@ error:
} /* check_stats() */
/*
+ *-------------------------------------------------------------------------
* To verify that blocks are allocated from file allocation
*
* Set up:
- * Turn off using meta/small data aggregator
- * There is nothing in free-space manager
+ * Turn off using meta/small data aggregator
+ * There is nothing in free-space manager
*
* Allocate two blocks which should be from file allocation
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_eoa(const char *env_h5_drvr, hid_t fapl)
@@ -287,6 +286,7 @@ error:
} /* test_mf_eoa() */
/*
+ *-------------------------------------------------------------------------
* To verify that an allocated block from file allocation is shrunk.
*
* Set up:
@@ -302,6 +302,7 @@ error:
* Test 4: Allocate a block of 30 from file allocation
* H5MF_try_shrink() the block by 20 from the end: succeed
*
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
@@ -310,9 +311,9 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
hid_t fapl_new = -1; /* copy of fapl */
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
- h5_stat_size_t file_size, new_file_size; /* file size */
+ h5_stat_size_t file_size = 0, new_file_size; /* file size */
H5FD_mem_t type;
- haddr_t addr;
+ haddr_t addr = 0;
haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF;
hsize_t ma_size=0, new_ma_size=0;
hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
@@ -567,6 +568,7 @@ error:
} /* test_mf_eoa_shrink() */
/*
+ *-------------------------------------------------------------------------
* To verify that an allocated block from file allocation is extended.
*
* Set up:
@@ -578,6 +580,7 @@ error:
*
* Test 2: Allocate a block of 30
* H5MF_try_extend() the block of size 20 by 50: fail
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
@@ -766,6 +769,7 @@ error:
} /* test_mf_eoa_extend() */
/*
+ *-------------------------------------------------------------------------
* To verify that temporary blocks are allocated correctly
*
* Set up:
@@ -785,6 +789,7 @@ error:
* space fails
* - Check that allocating another 1/2 of the file as normal address
* space fails
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_tmp(const char *env_h5_drvr, hid_t fapl)
@@ -942,10 +947,12 @@ error:
} /* test_mf_tmp() */
/*
+ *-------------------------------------------------------------------------
* To verify that the free-space manager is created or opened
*
* Set up:
* Turn off using meta/small data aggregator
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_fs_start(hid_t fapl)
@@ -1034,6 +1041,7 @@ error:
/*
+ *-------------------------------------------------------------------------
* To verify that a block is allocated/freed from/to the free-space manager
*
* Set up:
@@ -1057,10 +1065,7 @@ error:
* The block is allocated from file allocation
* Deallocate the block which will be returned to free-space manager
* (the space is shrunk and freed since it is at end of file)
- *
- * Modifications:
- * Vailin Choi; July 2012
- * Initialize the new field "allow_eoa_shrink_only" for user data.
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_fs_alloc_free(hid_t fapl)
@@ -1379,6 +1384,7 @@ error:
/*
+ *-------------------------------------------------------------------------
* To verify that a block allocated from the free-space manager can be extended
*
* Set up:
@@ -1414,10 +1420,7 @@ error:
* Try to extend the allocated block by 50 from the free-space_manager:
* Fail: section A does not adjoin section B (70+20 != address of section B) even though
* the requested-size (50) equal to size of section B (50)
- *
- * Modifications:
- * Vailin Choi; July 2012
- * Initialize the new field "allow_eoa_shrink_only" for user data.
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_fs_extend(hid_t fapl)
@@ -1936,6 +1939,7 @@ error:
} /* test_mf_fs_extend() */
/*
+ *-------------------------------------------------------------------------
* To verify that an aggregator is absorbed into a section.
*
* Test 1: To aborb the aggregator onto the beginning of the section
@@ -1958,10 +1962,7 @@ error:
* which will absorb meta_aggr to the section:
* section size + remaining size of aggregator is > aggr->alloc_size,
* section is allowed to absorb an aggregator (allow_sect_absorb is true)
- *
- * Modifications:
- * Vailin Choi; July 2012
- * Initialize the new field "allow_eoa_shrink_only" for user data.
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl)
@@ -2145,6 +2146,7 @@ error:
} /* test_mf_fs_absorb() */
/*
+ *-------------------------------------------------------------------------
* To verify that blocks are allocated from the aggregator
*
* Allocate first block (30) from meta_aggr: (nothing in the aggregator)
@@ -2159,6 +2161,7 @@ error:
* Result:
* The second block of 50 is allocated from meta_aggr
* There is space of 1968 left in meta_aggr
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl)
@@ -2269,6 +2272,7 @@ error:
} /* test_mf_aggr_alloc1() */
/*
+ *-------------------------------------------------------------------------
* To verify that blocks are allocated from the aggregator
*
* Allocate first block (30) from meta_aggr: (nothing in the aggregator)
@@ -2290,6 +2294,7 @@ error:
* A block of request-size is extended via file allocation and is merged with meta_aggr
* The block of 2058 is allocated out of meta_aggr
* There is space of 1968 left in meta_aggr
+ *-------------------------------------------------------------------------
*/
static unsigned
test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl)
diff --git a/test/mount.c b/test/mount.c
index d2c0d21..6b41caf 100644
--- a/test/mount.c
+++ b/test/mount.c
@@ -192,7 +192,7 @@ test_illegal(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- puts(" Mounting a file on itself should have failed.");
+ HDputs(" Mounting a file on itself should have failed.");
TEST_ERROR
} /* end if */
@@ -208,7 +208,7 @@ test_illegal(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- puts(" Mounting two files at one mount point should have failed.");
+ HDputs(" Mounting two files at one mount point should have failed.");
TEST_ERROR
} /* end if */
if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR
@@ -227,7 +227,7 @@ test_illegal(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- puts(" Mounting same file opened twice at one mount point should have failed.");
+ HDputs(" Mounting same file opened twice at one mount point should have failed.");
TEST_ERROR
} /* end if */
if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR
@@ -240,7 +240,7 @@ test_illegal(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- puts(" Creating a cycle with mount points should have failed.");
+ HDputs(" Creating a cycle with mount points should have failed.");
TEST_ERROR
} /* end if */
if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR
@@ -423,7 +423,7 @@ test_hide(hid_t fapl)
} H5E_END_TRY;
if(grp >= 0) {
H5_FAILED();
- puts(" Name is still accessible under mount point.");
+ HDputs(" Name is still accessible under mount point.");
TEST_ERROR
} /* end if */
@@ -434,7 +434,7 @@ test_hide(hid_t fapl)
if(H5Oget_info_by_name(file1, "/file1", &oi2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) {
H5_FAILED();
- puts(" Hard link failed for hidden object.");
+ HDputs(" Hard link failed for hidden object.");
TEST_ERROR
} /* end if */
@@ -503,7 +503,7 @@ test_assoc(hid_t fapl)
if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) {
H5_FAILED();
- puts(" Association failed.");
+ HDputs(" Association failed.");
TEST_ERROR
} /* end if */
@@ -628,7 +628,7 @@ test_move(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- puts(" Moving an object across files should't have been possible");
+ HDputs(" Moving an object across files should't have been possible");
TEST_ERROR
} /* end if */
@@ -834,7 +834,7 @@ test_unlink(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- puts(" Incorrect traversal from mount point!");
+ HDputs(" Incorrect traversal from mount point!");
TEST_ERROR
} /* end if */
@@ -851,7 +851,7 @@ test_unlink(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- puts(" Traversal through mount point should not have worked!");
+ HDputs(" Traversal through mount point should not have worked!");
TEST_ERROR
} /* end if */
H5E_BEGIN_TRY {
@@ -859,7 +859,7 @@ test_unlink(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- puts(" Traversal through mount point should not have worked!");
+ HDputs(" Traversal through mount point should not have worked!");
TEST_ERROR
} /* end if */
@@ -873,7 +873,7 @@ test_unlink(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- printf(" %d: Unmount by name should not have been allowed!\n",__LINE__);
+ HDprintf(" %d: Unmount by name should not have been allowed!\n",__LINE__);
TEST_ERROR
} /* end if */
H5E_BEGIN_TRY {
@@ -881,7 +881,7 @@ test_unlink(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- printf(" %d: Unmount by name should not have been allowed!\n",__LINE__);
+ HDprintf(" %d: Unmount by name should not have been allowed!\n",__LINE__);
TEST_ERROR
} /* end if */
if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR
@@ -1005,7 +1005,7 @@ test_interlink(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- puts(" Interfile hard link should not have been allowed!");
+ HDputs(" Interfile hard link should not have been allowed!");
TEST_ERROR
} /* end if */
@@ -1015,7 +1015,7 @@ test_interlink(hid_t fapl)
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
- puts(" Interfile renaming should not have been allowed!");
+ HDputs(" Interfile renaming should not have been allowed!");
TEST_ERROR
} /* end if */
@@ -1033,7 +1033,7 @@ test_interlink(hid_t fapl)
} H5E_END_TRY;
if(dset >= 0) {
H5_FAILED();
- puts(" Dataset and shared type must be in the same file!");
+ HDputs(" Dataset and shared type must be in the same file!");
TEST_ERROR
} /* end if */
@@ -1172,7 +1172,7 @@ test_close(hid_t fapl)
if(H5Fclose(file1) < 0) FAIL_STACK_ERROR
if(H5Oget_info_by_name(file2, "/mnt1", &oinfo, H5P_DEFAULT) < 0) {
H5_FAILED();
- puts(" File1 contents are not accessible!");
+ HDputs(" File1 contents are not accessible!");
TEST_ERROR
} /* end if */
if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
@@ -4379,13 +4379,13 @@ main(void)
if (nerrors) goto error;
- puts("All mount tests passed.");
+ HDputs("All mount tests passed.");
h5_cleanup(FILENAME, fapl);
return 0;
error:
- puts("***** MOUNT ERRORS *****");
+ HDputs("***** MOUNT ERRORS *****");
return 1;
}
diff --git a/test/mtime.c b/test/mtime.c
index 4cf1be3..1928a17 100644
--- a/test/mtime.c
+++ b/test/mtime.c
@@ -112,7 +112,7 @@ main(void)
puts(" Modification times will be mantained in the file but");
puts(" cannot be queried on this system. See H5O_mtime_decode().");
return 0;
- } else if(HDfabs(HDdifftime(now, oi1.ctime)) > 60.0F) {
+ } else if(HDfabs(HDdifftime(now, oi1.ctime)) > (double)60.0F) {
H5_FAILED();
tm = HDlocaltime(&(oi1.ctime));
HDstrftime((char*)buf1, sizeof buf1, "%Y-%m-%d %H:%M:%S", tm);
@@ -145,7 +145,7 @@ main(void)
if(oi1.ctime != MTIME1) {
H5_FAILED();
/* If this fails, examine H5Omtime.c. Modification time is very
- * system dependant (e.g., on Windows DST must be hardcoded). */
+ * system dependent (e.g., on Windows DST must be hardcoded). */
puts(" Old modification time incorrect");
goto error;
}
diff --git a/test/pool.c b/test/pool.c
index 6baf0be..f26362d 100644
--- a/test/pool.c
+++ b/test/pool.c
@@ -669,7 +669,7 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
/* Shuffle pointers to free */
for(u = 0; u < MPOOL_NUM_RANDOM; u++) {
- swap_idx = (size_t)(HDrandom() % (MPOOL_NUM_RANDOM - u)) + u;
+ swap_idx = (size_t)(HDrandom() % (int)(MPOOL_NUM_RANDOM - u)) + u;
swap_ptr = spc[u];
spc[u] = spc[swap_idx];
spc[swap_idx] = swap_ptr;
diff --git a/test/tarray.c b/test/tarray.c
index a32b5b8..eb71ad6 100644
--- a/test/tarray.c
+++ b/test/tarray.c
@@ -13,7 +13,7 @@
/***********************************************************
*
-* Test program: tarray
+* Test program: tarray
*
* Test the Array Datatype functionality
*
@@ -22,51 +22,75 @@
#include "testhdf5.h"
#include "H5srcdir.h"
-#include "hdf5.h"
-
#define FILENAME "tarray1.h5"
#define TESTFILE "tarrold.h5"
/* 1-D array datatype */
-#define ARRAY1_RANK 1
-#define ARRAY1_DIM1 4
+#define ARRAY1_RANK 1
+#define ARRAY1_DIM1 4
/* 3-D array datatype */
-#define ARRAY2_RANK 3
-#define ARRAY2_DIM1 3
-#define ARRAY2_DIM2 4
-#define ARRAY2_DIM3 5
+#define ARRAY2_RANK 3
+#define ARRAY2_DIM1 3
+#define ARRAY2_DIM2 4
+#define ARRAY2_DIM3 5
/* 2-D array datatype */
-#define ARRAY3_RANK 2
-#define ARRAY3_DIM1 6
-#define ARRAY3_DIM2 3
+#define ARRAY3_RANK 2
+#define ARRAY3_DIM1 6
+#define ARRAY3_DIM2 3
/* 1-D dataset with fixed dimensions */
-#define SPACE1_RANK 1
-#define SPACE1_DIM1 4
+#define SPACE1_RANK 1
+#define SPACE1_DIM1 4
-/****************************************************************
-**
-** test_array_atomic_1d(): Test basic array datatype code.
-** Tests 1-D array of atomic datatypes
-**
-****************************************************************/
+/* Parameters used with the test_array_bkg() test */
+#define FIELDNAME "ArrayofStructures"
+#define LENGTH 5
+#define ALEN 10
+#define RANK 1
+#define NMAX 100
+
+/* Struct used with test_array_bkg() test */
+typedef struct
+{
+ int nsubfields;
+ char *name[NMAX];
+ size_t offset[NMAX];
+ hid_t datatype[NMAX];
+
+} CmpDTSinfo;
+
+/* Forward declarations for custom vlen memory manager functions */
+void *test_array_alloc_custom(size_t size, void *info);
+void test_array_free_custom(void *mem, void *info);
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_atomic_1d
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests 1-D array of atomic datatypes.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_atomic_1d(void)
{
- int wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- int rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- int i,j; /* counting variables */
- herr_t ret; /* Generic return value */
+ int wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ int rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ int i,j; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array of Atomic Datatypes Functionality\n"));
@@ -165,36 +189,41 @@ test_array_atomic_1d(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_array_atomic_1d() */
-/****************************************************************
-**
-** test_array_funcs(): Test some type functions that are and
-** aren't supposed to work with array type.
-**
-****************************************************************/
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_funcs
+ *
+ * Purpose: Test some type functions that are and aren't supposed to
+ * work with array type.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_funcs(void)
{
- hid_t type; /* Datatype ID */
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int size;
- H5T_pad_t inpad;
- H5T_norm_t norm;
- H5T_cset_t cset;
- H5T_str_t strpad;
- herr_t ret; /* Generic return value */
+ hid_t type; /* Datatype ID */
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ size_t size;
+ H5T_pad_t inpad;
+ H5T_norm_t norm;
+ H5T_cset_t cset;
+ H5T_str_t strpad;
+ herr_t ret; /* Generic return value */
/* Create a datatype to refer to */
type = H5Tarray_create2(H5T_IEEE_F32BE, ARRAY1_RANK, tdims1);
CHECK(type, FAIL, "H5Tarray_create2");
size=H5Tget_precision(type);
- CHECK(size, FAIL, "H5Tget_precision");
+ CHECK(size, 0, "H5Tget_precision");
size=H5Tget_size(type);
- CHECK(size, FAIL, "H5Tget_size");
+ CHECK(size, 0, "H5Tget_size");
size=H5Tget_ebias(type);
- CHECK(size, FAIL, "H5Tget_ebias");
+ CHECK(size, 0, "H5Tget_ebias");
ret=H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE);
CHECK(ret, FAIL, "H5Tset_pad");
@@ -221,29 +250,34 @@ test_array_funcs(void)
/* Close datatype */
ret = H5Tclose(type);
CHECK(ret, FAIL, "H5Tclose");
-} /* end test_array_funcs */
+} /* end test_array_funcs() */
-/****************************************************************
-**
-** test_array_atomic_3d(): Test basic array datatype code.
-** Tests 3-D array of atomic datatypes
-**
-****************************************************************/
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_atomic_3d
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests 3-D array of atomic datatypes.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_atomic_3d(void)
{
int wdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information to write */
int rdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information read in */
- hid_t fid; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid; /* Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims2[] = {ARRAY2_DIM1,ARRAY2_DIM2,ARRAY2_DIM3};
- int ndims; /* Array rank for reading */
- hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */
- int i,j,k,l; /* counting variables */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims2[] = {ARRAY2_DIM1,ARRAY2_DIM2,ARRAY2_DIM3};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */
+ int i,j,k,l; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 3-D Array of Atomic Datatypes Functionality\n"));
@@ -347,31 +381,36 @@ test_array_atomic_3d(void)
} /* end test_array_atomic_3d() */
-/****************************************************************
-**
-** test_array_array_atomic(): Test basic array datatype code.
-** Tests 1-D array 2-D arrays of atomic datatypes
-**
-****************************************************************/
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_array_atomic
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests 1-D array 2-D arrays of atomic datatypes.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_array_atomic(void)
{
int wdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information to write */
int rdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information read in */
- hid_t fid; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid1; /* 1-D array Datatype ID */
- hid_t tid2; /* 2-D array Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- hsize_t tdims2[] = {ARRAY3_DIM1,ARRAY3_DIM2};
- int ndims1; /* Array rank for reading */
- int ndims2; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */
- int i,j,k,l; /* counting variables */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid1; /* 1-D array Datatype ID */
+ hid_t tid2; /* 2-D array Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ hsize_t tdims2[] = {ARRAY3_DIM1,ARRAY3_DIM2};
+ int ndims1; /* Array rank for reading */
+ int ndims2; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */
+ int i,j,k,l; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array 2-D Arrays of Atomic Datatypes Functionality\n"));
@@ -501,12 +540,17 @@ test_array_array_atomic(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_array_array_atomic() */
-/****************************************************************
-**
-** test_array_compound_atomic(): Test basic array datatype code.
-** Tests 1-D array of compound datatypes (with no array fields)
-**
-****************************************************************/
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_compound_atomic
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests 1-D array of compound datatypes (with no array fields).
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_compound_atomic(void)
{
@@ -514,23 +558,24 @@ test_array_compound_atomic(void)
int i;
float f;
} s1_t;
- s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* Compound Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- int nmemb; /* Number of compound members */
- char *mname; /* Name of compound field */
- size_t off; /* Offset of compound field */
- hid_t mtid; /* Datatype ID for field */
- int i,j; /* counting variables */
- herr_t ret; /* Generic return value */
+
+ s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* Compound Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ int nmemb; /* Number of compound members */
+ char *mname; /* Name of compound field */
+ size_t off; /* Offset of compound field */
+ hid_t mtid; /* Datatype ID for field */
+ int i,j; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array of Compound Atomic Datatypes Functionality\n"));
@@ -539,7 +584,7 @@ test_array_compound_atomic(void)
for(i = 0; i < SPACE1_DIM1; i++)
for(j = 0; j < ARRAY1_DIM1; j++) {
wdata[i][j].i = i * 10 + j;
- wdata[i][j].f = (float)(i * 2.5F + j);
+ wdata[i][j].f = (float)i * 2.5F + (float)j;
} /* end for */
/* Create file */
@@ -632,7 +677,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);
@@ -651,7 +696,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);
@@ -683,8 +728,8 @@ test_array_compound_atomic(void)
TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n", (int)i, (int)j, (int)wdata[i][j].i, (int)i, (int)j, (int)rdata[i][j].i);
continue;
} /* end if */
- if(!FLT_ABS_EQUAL(wdata[i][j].f, rdata[i][j].f)) {
- TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].f=%f, rdata[%d][%d].f=%f\n", (int)i, (int)j, wdata[i][j].f, (int)i, (int)j, rdata[i][j].f);
+ if(!H5_FLT_ABS_EQUAL(wdata[i][j].f, rdata[i][j].f)) {
+ TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].f=%f, rdata[%d][%d].f=%f\n", (int)i, (int)j, (double)wdata[i][j].f, (int)i, (int)j, (double)rdata[i][j].f);
continue;
} /* end if */
} /* end for */
@@ -702,12 +747,17 @@ test_array_compound_atomic(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_array_compound_atomic() */
-/****************************************************************
-**
-** test_array_compound_array(): Test basic array datatype code.
-** Tests 1-D array of compound datatypes (with array fields)
-**
-****************************************************************/
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_compound_array
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests 1-D array of compound datatypes (with array fields).
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_compound_array(void)
{
@@ -715,25 +765,26 @@ test_array_compound_array(void)
int i;
float f[ARRAY1_DIM1];
} s1_t;
- s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* Compound Datatype ID */
- hid_t tid3; /* Nested Array Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- int nmemb; /* Number of compound members */
- char *mname; /* Name of compound field */
- size_t off; /* Offset of compound field */
- hid_t mtid; /* Datatype ID for field */
- H5T_class_t mclass; /* Datatype class for field */
- int i,j,k; /* counting variables */
- herr_t ret; /* Generic return value */
+
+ s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* Compound Datatype ID */
+ hid_t tid3; /* Nested Array Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ int nmemb; /* Number of compound members */
+ char *mname; /* Name of compound field */
+ size_t off; /* Offset of compound field */
+ hid_t mtid; /* Datatype ID for field */
+ H5T_class_t mclass; /* Datatype class for field */
+ int i,j,k; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array of Compound Array Datatypes Functionality\n"));
@@ -743,7 +794,7 @@ test_array_compound_array(void)
for(j=0; j<ARRAY1_DIM1; j++) {
wdata[i][j].i=i*10+j;
for(k=0; k<ARRAY1_DIM1; k++)
- wdata[i][j].f[k]=(float)(i * 10.0F + j * 2.5F + k);
+ wdata[i][j].f[k] = (float)i * 10.0F + (float)j * 2.5F + (float)k;
} /* end for */
/* Create file */
@@ -844,7 +895,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);
@@ -863,7 +914,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);
@@ -926,8 +977,8 @@ test_array_compound_array(void)
continue;
} /* end if */
for(k=0; k<ARRAY1_DIM1; k++)
- if(!FLT_ABS_EQUAL(wdata[i][j].f[k],rdata[i][j].f[k])) {
- TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].f[%d]=%f, rdata[%d][%d].f[%d]=%f\n",(int)i,(int)j,(int)k,wdata[i][j].f[k],(int)i,(int)j,(int)k,rdata[i][j].f[k]);
+ if(!H5_FLT_ABS_EQUAL(wdata[i][j].f[k],rdata[i][j].f[k])) {
+ TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].f[%d]=%f, rdata[%d][%d].f[%d]=%f\n",(int)i,(int)j,(int)k,(double)wdata[i][j].f[k],(int)i,(int)j,(int)k,(double)rdata[i][j].f[k]);
continue;
} /* end if */
} /* end for */
@@ -947,9 +998,6 @@ test_array_compound_array(void)
} /* end test_array_compound_array() */
-void *test_array_alloc_custom(size_t size, void *info);
-void test_array_free_custom(void *mem, void *info);
-
/****************************************************************
**
** test_array_alloc_custom(): Test VL datatype custom memory
@@ -958,80 +1006,113 @@ void test_array_free_custom(void *mem, void *info);
** allocated.
**
****************************************************************/
-void *test_array_alloc_custom(size_t size, void *info)
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_alloc_custom
+ *
+ * Purpose: Memory allocator for testing VL datatype custom memory
+ * allocation routines.
+ *
+ * This routine just uses malloc to allocate the memory and
+ * increments the amount of memory allocated.
+ *
+ * Return:
+ *
+ * Success: A memory buffer
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+test_array_alloc_custom(size_t size, void *info)
{
- void *ret_value=NULL; /* Pointer to return */
- int *mem_used=(int *)info; /* Get the pointer to the memory used */
- size_t extra; /* Extra space needed */
+ void *ret_value = NULL; /* Pointer to return */
+ size_t *mem_used = (size_t *)info; /* Pointer to the memory used */
+ size_t extra; /* Extra space needed */
/*
* This weird contortion is required on the DEC Alpha to keep the
* alignment correct - QAK
*/
- extra=MAX(sizeof(void *),sizeof(size_t));
+ extra = MAX(sizeof(void *), sizeof(size_t));
- if((ret_value=HDmalloc(extra+size))!=NULL) {
- *(size_t *)ret_value=size;
- *mem_used+=size;
+ if((ret_value = HDmalloc(extra+size)) != NULL) {
+ *(size_t *)ret_value = size;
+ *mem_used += size;
} /* end if */
- ret_value=((unsigned char *)ret_value)+extra;
- return(ret_value);
-}
-/****************************************************************
-**
-** test_array_free_custom(): Test VL datatype custom memory
-** allocation routines. This routine just uses free to
-** release the memory and decrements the amount of memory
-** allocated.
-**
-****************************************************************/
-void test_array_free_custom(void *_mem, void *info)
+ ret_value = ((unsigned char *)ret_value) + extra;
+ return ret_value;
+} /* end test_array_alloc_custom() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_free_custom
+ *
+ * Purpose: Memory free function for testing VL datatype custom memory
+ * allocation routines.
+ *
+ * This routine just uses free to free the memory and
+ * decrements the amount of memory allocated.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+test_array_free_custom(void *_mem, void *info)
{
- unsigned char *mem;
- int *mem_used=(int *)info; /* Get the pointer to the memory used */
- size_t extra; /* Extra space needed */
+ unsigned char *mem = NULL; /* Pointer to mem to be freed */
+ size_t *mem_used = (size_t *)info; /* Pointer to the memory used */
+ size_t extra; /* Extra space needed */
/*
* This weird contortion is required on the DEC Alpha to keep the
* alignment correct - QAK
*/
- extra=MAX(sizeof(void *),sizeof(size_t));
+ extra = MAX(sizeof(void *), sizeof(size_t));
- if(_mem!=NULL) {
- mem=((unsigned char *)_mem)-extra;
- *mem_used-=*(size_t *)mem;
+ if(_mem != NULL) {
+ mem = ((unsigned char *)_mem) - extra;
+ *mem_used -= *(size_t *)((void *)mem);
HDfree(mem);
} /* end if */
-}
-/****************************************************************
-**
-** test_array_vlen_atomic(): Test basic array datatype code.
-** Tests 1-D array of atomic VL datatypes
-**
-****************************************************************/
+ return;
+} /* end test_array_free_custom() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_vlen_atomic
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests 1-D array of atomic VL datatypes.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_vlen_atomic(void)
{
- hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* VL Datatype ID */
- hid_t tid3; /* Atomic Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- H5T_class_t mclass; /* Datatype class for VL */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t size; /* Number of bytes which will be used */
- int mem_used=0; /* Memory used during allocation */
- int i,j,k; /* counting variables */
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* VL Datatype ID */
+ hid_t tid3; /* Atomic Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ H5T_class_t mclass; /* Datatype class for VL */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t size; /* Number of bytes which will be used */
+ size_t mem_used=0; /* Memory used during allocation */
+ int i,j,k; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array of Atomic Variable-Length Datatypes Functionality\n"));
@@ -1039,10 +1120,10 @@ test_array_vlen_atomic(void)
/* Initialize array data to write */
for(i=0; i<SPACE1_DIM1; i++)
for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].p=HDmalloc((i+j+1)*sizeof(unsigned int));
- wdata[i][j].len=i+j+1;
+ wdata[i][j].p=HDmalloc((size_t)(i+j+1) * sizeof(unsigned int));
+ wdata[i][j].len = (size_t)(i+j+1);
for(k=0; k<(i+j+1); k++)
- ((unsigned int *)wdata[i][j].p)[k]=i*100+j*10+k;
+ ((unsigned int *)wdata[i][j].p)[k] = (unsigned int)(i*100+j*10+k);
} /* end for */
/* Create file */
@@ -1215,34 +1296,39 @@ test_array_vlen_atomic(void)
} /* end test_array_vlen_atomic() */
-/****************************************************************
-**
-** test_array_vlen_array(): Test basic array datatype code.
-** Tests 1-D array of 1-D array VL datatypes
-**
-****************************************************************/
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_vlen_array
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests 1-D array of 1-D array VL datatypes.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_vlen_array(void)
{
- hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
- hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* VL Datatype ID */
- hid_t tid3; /* Nested Array Datatype ID */
- hid_t tid4; /* Atomic Datatype ID */
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- H5T_class_t mclass; /* Datatype class for VL */
- hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t size; /* Number of bytes which will be used */
- int mem_used=0; /* Memory used during allocation */
- int i,j,k,l; /* Index variables */
- herr_t ret; /* Generic return value */
+ hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* VL Datatype ID */
+ hid_t tid3; /* Nested Array Datatype ID */
+ hid_t tid4; /* Atomic Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ H5T_class_t mclass; /* Datatype class for VL */
+ hid_t xfer_pid; /* Dataset transfer property list ID */
+ hsize_t size; /* Number of bytes which will be used */
+ size_t mem_used=0; /* Memory used during allocation */
+ int i,j,k,l; /* Index variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Array of 1-D Array Variable-Length Datatypes Functionality\n"));
@@ -1250,12 +1336,12 @@ test_array_vlen_array(void)
/* Initialize array data to write */
for(i=0; i<SPACE1_DIM1; i++)
for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].p=HDmalloc((i+j+1)*(sizeof(unsigned int)*ARRAY1_DIM1));
- wdata[i][j].len=i+j+1;
+ wdata[i][j].p = HDmalloc((size_t)(i+j+1) * sizeof(unsigned int) * (size_t)ARRAY1_DIM1);
+ wdata[i][j].len = (size_t)(i+j+1);
for(k=0; k<(i+j+1); k++)
for(l=0; l<ARRAY1_DIM1; l++)
- ((unsigned int *)wdata[i][j].p)[k*ARRAY1_DIM1+l]=i*1000+j*100+k*10+l;
- } /* end for */
+ ((unsigned int *)wdata[i][j].p)[k*ARRAY1_DIM1+l] = (unsigned int)(i*1000+j*100+k*10+l);
+ }
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1465,28 +1551,18 @@ test_array_vlen_array(void)
} /* end test_array_vlen_array() */
-#define FIELDNAME "ArrayofStructures"
-#define LENGTH 5
-#define ALEN 10
-#define RANK 1
-#define NMAX 100
-
-typedef struct
-{
- int nsubfields;
- char *name[NMAX];
- size_t offset[NMAX];
- hid_t datatype[NMAX];
-
-} CmpDTSinfo;
-
-/****************************************************************
-**
-** test_array_bkg(): Test basic array datatype code.
-** Tests reading compound datatype with array fields and
-** writing partial fields.
-**
-****************************************************************/
+
+/*-------------------------------------------------------------------------
+ * Function: test_array_bkg
+ *
+ * Purpose: Test basic array datatype code.
+ * Tests reading compound datatype with array fields and
+ * writing partial fields.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_array_bkg(void)
{
@@ -1503,19 +1579,17 @@ test_array_bkg(void)
int i, j;
unsigned ndims[3] = {1,1,1};
- typedef struct
- {
- int a[ALEN];
- float b[ALEN];
- double c[ALEN];
+ typedef struct {
+ int a[ALEN];
+ float b[ALEN];
+ double c[ALEN];
} CmpField;
CmpField cf[LENGTH];
CmpField cfr[LENGTH];
- CmpDTSinfo dtsinfo;
+ CmpDTSinfo *dtsinfo = NULL;
- typedef struct
- {
+ typedef struct {
float b[ALEN];
} fld_t;
@@ -1527,42 +1601,43 @@ test_array_bkg(void)
/* Initialize the data */
/* ------------------- */
- for (i = 0; i < LENGTH; i++)
- {
- for (j = 0; j < ALEN; j++)
- {
- cf[i].a[j] = 100*(i+1) + j;
- cf[i].b[j] = (float)(100.0F*(i+1) + 0.01F*j);
- cf[i].c[j] = (double)(100.0F*(i+1) + 0.02F*j);
- }
- }
+ dtsinfo = (CmpDTSinfo *)HDmalloc(sizeof(CmpDTSinfo));
+ CHECK_PTR(dtsinfo, "HDmalloc");
+ HDmemset(dtsinfo, 0, sizeof(CmpDTSinfo));
+ for (i = 0; i < LENGTH; i++) {
+ for (j = 0; j < ALEN; j++) {
+ cf[i].a[j] = 100 * (i + 1) + j;
+ cf[i].b[j] = 100.0F * ((float)i + 1.0F) + 0.01F * (float)j;
+ cf[i].c[j] = (double)(100.0F * ((float)i + 1.0F) + 0.02F * (float)j);
+ } /* end for */
+ } /* end for */
/* Set the number of data members */
/* ------------------------------ */
- dtsinfo.nsubfields = 3;
+ dtsinfo->nsubfields = 3;
/* Initialize the offsets */
/* ----------------------- */
- dtsinfo.offset[0] = HOFFSET(CmpField, a);
- dtsinfo.offset[1] = HOFFSET(CmpField, b);
- dtsinfo.offset[2] = HOFFSET(CmpField, c);
+ dtsinfo->offset[0] = HOFFSET(CmpField, a);
+ dtsinfo->offset[1] = HOFFSET(CmpField, b);
+ dtsinfo->offset[2] = HOFFSET(CmpField, c);
/* Initialize the data type IDs */
/* ---------------------------- */
- dtsinfo.datatype[0] = H5T_NATIVE_INT;
- dtsinfo.datatype[1] = H5T_NATIVE_FLOAT;
- dtsinfo.datatype[2] = H5T_NATIVE_DOUBLE;
+ dtsinfo->datatype[0] = H5T_NATIVE_INT;
+ dtsinfo->datatype[1] = H5T_NATIVE_FLOAT;
+ dtsinfo->datatype[2] = H5T_NATIVE_DOUBLE;
/* Initialize the names of data members */
/* ------------------------------------ */
- for (i = 0; i < dtsinfo.nsubfields; i++)
- dtsinfo.name[i] = (char *)HDcalloc((size_t)20, sizeof(char));
+ for (i = 0; i < dtsinfo->nsubfields; i++)
+ dtsinfo->name[i] = (char *)HDcalloc((size_t)20, sizeof(char));
- strcpy(dtsinfo.name[0], "One");
- strcpy(dtsinfo.name[1], "Two");
- strcpy(dtsinfo.name[2], "Three");
+ HDstrcpy(dtsinfo->name[0], "One");
+ HDstrcpy(dtsinfo->name[1], "Two");
+ HDstrcpy(dtsinfo->name[2], "Three");
/* Create file */
@@ -1583,17 +1658,16 @@ test_array_bkg(void)
/* Add members to the compound data type */
/* -------------------------------------- */
- for ( i = 0; i < dtsinfo.nsubfields; i++)
- {
- array_dt = H5Tarray_create2(dtsinfo.datatype[i], ndims[i], dima);
+ for ( i = 0; i < dtsinfo->nsubfields; i++) {
+ array_dt = H5Tarray_create2(dtsinfo->datatype[i], ndims[i], dima);
CHECK(array_dt, FAIL, "H5Tarray_create2");
- status = H5Tinsert (type, dtsinfo.name[i], dtsinfo.offset[i], array_dt);
+ status = H5Tinsert (type, dtsinfo->name[i], dtsinfo->offset[i], array_dt);
CHECK(status, FAIL, "H5Tinsert");
status = H5Tclose(array_dt);
CHECK(status, FAIL, "H5Tclose");
- }
+ } /* end for */
/* Create the dataset */
/* ------------------ */
@@ -1615,23 +1689,23 @@ test_array_bkg(void)
if(cf[i].a[j]!=cfr[i].a[j]) {
TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]);
continue;
- }
- if(!FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) {
- TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].b[j],(int)i,(int)j,(float)cfr[i].b[j]);
+ } /* end if */
+ if(!H5_FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) {
+ TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].b[j],(int)i,(int)j,(double)cfr[i].b[j]);
continue;
- }
- if(!DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) {
- TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].c[j],(int)i,(int)j,(float)cfr[i].c[j]);
+ } /* end if */
+ if(!H5_DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) {
+ TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].c[j],(int)i,(int)j,(double)cfr[i].c[j]);
continue;
- }
- }
- }
+ } /* end if */
+ } /* end for */
+ } /* end for */
/* Release memory resources */
/* ------------------------ */
- for (i = 0; i < dtsinfo.nsubfields; i++)
- HDfree(dtsinfo.name[i]);
+ for (i = 0; i < dtsinfo->nsubfields; i++)
+ HDfree(dtsinfo->name[i]);
/* Release IDs */
@@ -1649,9 +1723,9 @@ test_array_bkg(void)
CHECK(status, FAIL, "H5Fclose");
-/******************************/
-/* Reopen the file and update */
-/******************************/
+ /******************************/
+ /* Reopen the file and update */
+ /******************************/
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -1672,7 +1746,7 @@ test_array_bkg(void)
/* -------------------------------- */
for (i=0; i< LENGTH; i++)
for (j = 0; j < ALEN; j++)
- cf[i].b[j]=fld[i].b[j] = 1.313F;
+ cf[i].b[j] = fld[i].b[j] = 1.313F;
status = H5Dwrite (dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, fld);
CHECK(status, FAIL, "H5Dwrite");
@@ -1683,10 +1757,10 @@ test_array_bkg(void)
for (i=0; i< LENGTH; i++)
for (j = 0; j < ALEN; j++)
- if(!FLT_ABS_EQUAL(fld[i].b[j],fldr[i].b[j])) {
- TestErrPrintf("Field data doesn't match, fld[%d].b[%d]=%f, fldr[%d].b[%d]=%f\n",(int)i,(int)j,(float)fld[i].b[j],(int)i,(int)j,(float)fldr[i].b[j]);
+ if(!H5_FLT_ABS_EQUAL(fld[i].b[j],fldr[i].b[j])) {
+ TestErrPrintf("Field data doesn't match, fld[%d].b[%d]=%f, fldr[%d].b[%d]=%f\n",(int)i,(int)j,(double)fld[i].b[j],(int)i,(int)j,(double)fldr[i].b[j]);
continue;
- }
+ } /* end if */
status = H5Tclose (type);
CHECK(status, FAIL, "H5Tclose");
@@ -1708,17 +1782,17 @@ test_array_bkg(void)
if(cf[i].a[j]!=cfr[i].a[j]) {
TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]);
continue;
- }
- if(!FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) {
- TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].b[j],(int)i,(int)j,(float)cfr[i].b[j]);
+ } /* end if */
+ if(!H5_FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) {
+ TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].b[j],(int)i,(int)j,(double)cfr[i].b[j]);
continue;
- }
- if(!DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) {
- TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].c[j],(int)i,(int)j,(float)cfr[i].c[j]);
+ } /* end if */
+ if(!H5_DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) {
+ TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].c[j],(int)i,(int)j,(double)cfr[i].c[j]);
continue;
- }
- }
- }
+ } /* end if */
+ } /* end for */
+ } /* end for */
status = H5Dclose(dataset);
CHECK(status, FAIL, "H5Dclose");
@@ -1729,9 +1803,9 @@ test_array_bkg(void)
status = H5Fclose(fid);
CHECK(status, FAIL, "H5Fclose");
-/****************************************************/
-/* Reopen the file and print out all the data again */
-/****************************************************/
+ /****************************************************/
+ /* Reopen the file and print out all the data again */
+ /****************************************************/
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -1745,7 +1819,7 @@ test_array_bkg(void)
/* Reset the data to read in */
/* ------------------------- */
- memset(cfr, 0, sizeof(CmpField)*LENGTH);
+ HDmemset(cfr, 0, sizeof(CmpField)*LENGTH);
status = H5Dread(dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, cfr);
CHECK(status, FAIL, "H5Dread");
@@ -1757,17 +1831,17 @@ test_array_bkg(void)
if(cf[i].a[j]!=cfr[i].a[j]) {
TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]);
continue;
- }
- if(!FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) {
- TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].b[j],(int)i,(int)j,(float)cfr[i].b[j]);
+ } /* end if */
+ if(!H5_FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) {
+ TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].b[j],(int)i,(int)j,(double)cfr[i].b[j]);
continue;
- }
- if(!DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) {
- TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].c[j],(int)i,(int)j,(float)cfr[i].c[j]);
+ } /* end if */
+ if(!H5_DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) {
+ TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].c[j],(int)i,(int)j,(double)cfr[i].c[j]);
continue;
- }
- }
- }
+ } /* end if */
+ } /* end for */
+ } /* end for */
status = H5Dclose(dataset);
CHECK(status, FAIL, "H5Dclose");
@@ -1777,35 +1851,42 @@ test_array_bkg(void)
status = H5Fclose(fid);
CHECK(status, FAIL, "H5Fclose");
+
+ HDfree(dtsinfo);
} /* end test_array_bkg() */
-/****************************************************************
-**
-** test_compat(): Test array datatype compatibility code.
-** Reads file containing old version of datatype object header
-** messages for compound datatypes and verifies reading the older
-** version of the is working correctly.
-**
-****************************************************************/
+
+/*-------------------------------------------------------------------------
+ * Function: test_compat
+ *
+ * Purpose: Test array datatype compatibility code.
+ *
+ * Reads file containing old version of datatype object header
+ * messages for compound datatypes and verifies reading the older
+ * version of the is working correctly.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
static void
test_compat(void)
{
- char testfile[512]=""; /* Character buffer for corrected test file name */
- char *srcdir = getenv("srcdir"); /* Pointer to the directory the source code is located within */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t tid1; /* Array Datatype ID */
- hid_t tid2; /* Datatype ID */
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int ndims; /* Array rank for reading */
- hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
- H5T_class_t mclass; /* Datatype class for VL */
- int nmemb; /* Number of compound members */
- char *mname; /* Name of compound field */
- size_t off; /* Offset of compound field */
- hid_t mtid; /* Datatype ID for field */
- int i; /* Index variables */
- herr_t ret; /* Generic return value */
+ const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* Datatype ID */
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int ndims; /* Array rank for reading */
+ hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
+ H5T_class_t mclass; /* Datatype class for VL */
+ int nmemb; /* Number of compound members */
+ char *mname; /* Name of compound field */
+ size_t off; /* Offset of compound field */
+ hid_t mtid; /* Datatype ID for field */
+ int i; /* Index variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Array Datatypes Compatibility Functionality\n"));
@@ -1819,12 +1900,6 @@ test_compat(void)
* changed, follow the instructions in gen_old_array.c for regenerating
* the tarrold.h5 file.
*/
- /* Generate the correct name for the test file, by prepending the source path */
- if (srcdir && ((strlen(srcdir) + strlen(TESTFILE) + 1) < sizeof(testfile))) {
- strcpy(testfile, srcdir);
- strcat(testfile, "/");
- }
- strcat(testfile, TESTFILE);
/* Open the testfile */
fid1 = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
@@ -1850,7 +1925,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);
@@ -1869,7 +1944,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);
@@ -1888,7 +1963,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);
@@ -1932,7 +2007,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);
@@ -1951,7 +2026,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);
@@ -1996,7 +2071,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);
@@ -2041,7 +2116,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);
@@ -2069,17 +2144,22 @@ test_compat(void)
/* Close the file */
ret = H5Fclose(fid1);
CHECK_I(ret, "H5Fclose");
- }
+ } /* end if */
else
printf("***cannot open the pre-created compound datatype test file (%s)\n",testfile);
} /* end test_compat() */
-/****************************************************************
-**
-** test_array(): Main array datatype testing routine.
-**
-****************************************************************/
+
+/*-------------------------------------------------------------------------
+ * Function: test_array
+ *
+ * Purpose: Main array datatype testing routine.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
void
test_array(void)
{
@@ -2087,39 +2167,38 @@ test_array(void)
MESSAGE(5, ("Testing Array Datatypes\n"));
/* These tests use the same file... */
- test_array_atomic_1d(); /* Test 1-D array of atomic datatypes */
- test_array_atomic_3d(); /* Test 3-D array of atomic datatypes */
- test_array_array_atomic(); /* Test 1-D array of 2-D arrays of atomic datatypes */
- test_array_compound_atomic(); /* Test 1-D array of compound datatypes (with no array fields) */
- test_array_compound_array(); /* Test 1-D array of compound datatypes (with array fields) */
- test_array_vlen_atomic(); /* Test 1-D array of atomic VL datatypes */
- test_array_vlen_array(); /* Test 1-D array of 1-D array VL datatypes */
- test_array_funcs(); /* Test type functions with array types */
+ test_array_atomic_1d(); /* Test 1-D array of atomic datatypes */
+ test_array_atomic_3d(); /* Test 3-D array of atomic datatypes */
+ test_array_array_atomic(); /* Test 1-D array of 2-D arrays of atomic datatypes */
+ test_array_compound_atomic(); /* Test 1-D array of compound datatypes (with no array fields) */
+ test_array_compound_array(); /* Test 1-D array of compound datatypes (with array fields) */
+ test_array_vlen_atomic(); /* Test 1-D array of atomic VL datatypes */
+ test_array_vlen_array(); /* Test 1-D array of 1-D array VL datatypes */
+ test_array_funcs(); /* Test type functions with array types */
- test_array_bkg(); /* Read compound datatype with array fields and background fields read */
+ test_array_bkg(); /* Read compound datatype with array fields and background fields read */
/* This test uses a custom file */
- test_compat(); /* Test compatibility changes for compound datatype fields */
-} /* test_array() */
+ test_compat(); /* Test compatibility changes for compound datatype fields */
+
+} /* end test_array() */
/*-------------------------------------------------------------------------
- * Function: cleanup_array
+ * Function: cleanup_array
*
- * Purpose: Cleanup temporary test files
+ * Purpose: Cleanup temporary test files
*
- * Return: none
+ * Return: void
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* June 8, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
cleanup_array(void)
{
remove(FILENAME);
-}
+} /* end cleanup_array() */
diff --git a/test/tattr.c b/test/tattr.c
index beb7c57..b252dbd 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -20,8 +20,6 @@
*************************************************************/
#include "testhdf5.h"
-#include "h5test.h"
-#include "hdf5.h"
/*
* This file needs to access private information from the H5O package.
@@ -152,8 +150,14 @@ typedef struct {
static herr_t attr_op1(hid_t loc_id, const char *name, const H5A_info_t *ainfo,
void *op_data);
+/* Global dcpl ID, can be re-set as a generated dcpl for various operations
+ * across multiple tests.
+ * e.g., minimized dataset object headers
+ */
+static hid_t dcpl_g = H5P_DEFAULT;
+
+
-
/****************************************************************
**
** test_attr_basic_write(): Test basic H5A (attribute) code.
@@ -163,20 +167,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;
- 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"));
@@ -190,7 +195,7 @@ test_attr_basic_write(hid_t fapl)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a dataset */
- dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Create dataspace for attribute */
@@ -226,8 +231,8 @@ test_attr_basic_write(hid_t fapl)
CHECK(attr, FAIL, "H5Acreate2");
/* Try to create the same attribute again (should fail) */
- ret = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Acreate2");
+ ret_id = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Acreate2");
/* Write attribute information */
ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data1);
@@ -276,7 +281,7 @@ test_attr_basic_write(hid_t fapl)
if(attr_name_size > 0) {
attr_name = (char*)HDcalloc((size_t)(attr_name_size + 1), sizeof(char));
- CHECK(attr_name, NULL, "HDcalloc");
+ CHECK_PTR(attr_name, "HDcalloc");
if(attr_name) {
ret = (herr_t)H5Aget_name(attr, (size_t)(attr_name_size + 1), attr_name);
@@ -312,7 +317,7 @@ test_attr_basic_write(hid_t fapl)
if(attr_name_size > 0) {
attr_name = (char*)HDcalloc((size_t)(attr_name_size+1), sizeof(char));
- CHECK(attr_name, NULL, "HDcalloc");
+ CHECK_PTR(attr_name, "HDcalloc");
if(attr_name) {
ret = (herr_t)H5Aget_name(attr2, (size_t)(attr_name_size + 1), attr_name);
@@ -364,8 +369,8 @@ test_attr_basic_write(hid_t fapl)
VERIFY(attr_size, (ATTR2_DIM1 * ATTR2_DIM2 * sizeof(int)), "H5Aget_storage_size");
/* Try to create the same attribute again (should fail) */
- ret = H5Acreate2(group, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Acreate2");
+ ret_id = H5Acreate2(group, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Acreate2");
/* Write attribute information */
ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data2);
@@ -392,7 +397,7 @@ test_attr_basic_write(hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_basic_write() */
-
+
/****************************************************************
**
** test_attr_basic_read(): Test basic H5A (attribute) code.
@@ -401,15 +406,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"));
@@ -483,7 +488,7 @@ test_attr_basic_read(hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_basic_read() */
-
+
/****************************************************************
**
** test_attr_flush(): Test H5A (attribute) code for performing
@@ -499,7 +504,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"));
@@ -510,7 +515,7 @@ test_attr_flush(hid_t fapl)
spc = H5Screate(H5S_SCALAR);
CHECK(spc, FAIL, "H5Screate");
- set = H5Dcreate2(fil, DSET1_NAME, H5T_NATIVE_DOUBLE, spc, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ set = H5Dcreate2(fil, DSET1_NAME, H5T_NATIVE_DOUBLE, spc, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(set, FAIL, "H5Dcreate2");
att = H5Acreate2(set, ATTR1_NAME, H5T_NATIVE_DOUBLE, spc, H5P_DEFAULT, H5P_DEFAULT);
@@ -519,8 +524,8 @@ test_attr_flush(hid_t fapl)
ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata);
CHECK(ret, FAIL, "H5Awrite");
- if(!DBL_ABS_EQUAL(rdata,0.0F))
- TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,0.0F);
+ if(!H5_DBL_ABS_EQUAL(rdata, H5_DOUBLE(0.0)))
+ TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,(double)0.0F);
ret=H5Fflush(fil, H5F_SCOPE_GLOBAL);
CHECK(ret, FAIL, "H5Fflush");
@@ -528,8 +533,8 @@ test_attr_flush(hid_t fapl)
ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata);
CHECK(ret, FAIL, "H5Awrite");
- if(!DBL_ABS_EQUAL(rdata,0.0F))
- TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,0.0F);
+ if(!H5_DBL_ABS_EQUAL(rdata, H5_DOUBLE(0.0)))
+ TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,(double)0.0F);
ret=H5Awrite(att, H5T_NATIVE_DOUBLE, &wdata);
CHECK(ret, FAIL, "H5Awrite");
@@ -537,7 +542,7 @@ test_attr_flush(hid_t fapl)
ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata);
CHECK(ret, FAIL, "H5Awrite");
- if(!DBL_ABS_EQUAL(rdata,wdata))
+ if(!H5_DBL_ABS_EQUAL(rdata,wdata))
TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,wdata);
ret=H5Sclose(spc);
@@ -550,7 +555,7 @@ test_attr_flush(hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_flush() */
-
+
/****************************************************************
**
** test_attr_plist(): Test Attribute Creation Property Lists
@@ -562,12 +567,12 @@ 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 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"));
@@ -581,7 +586,7 @@ test_attr_plist(hid_t fapl)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a dataset */
- dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Create dataspace for attribute */
@@ -663,7 +668,7 @@ test_attr_plist(hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_plist() */
-
+
/****************************************************************
**
** test_attr_compound_write(): Test H5A (attribute) code.
@@ -674,13 +679,14 @@ 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 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};
- herr_t ret; /* Generic return value */
+ 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"));
@@ -694,7 +700,7 @@ test_attr_compound_write(hid_t fapl)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a dataset */
- dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Close dataset's dataspace */
@@ -723,8 +729,8 @@ test_attr_compound_write(hid_t fapl)
CHECK(attr, FAIL, "H5Acreate2");
/* Try to create the same attribute again (should fail) */
- ret = H5Acreate2(dataset, ATTR4_NAME, tid1, sid2, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Acreate2");
+ ret_id = H5Acreate2(dataset, ATTR4_NAME, tid1, sid2, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Acreate2");
/* Write complex attribute data */
ret = H5Awrite(attr, tid1, attr_data4);
@@ -751,7 +757,7 @@ test_attr_compound_write(hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_compound_write() */
-
+
/****************************************************************
**
** test_attr_compound_read(): Test basic H5A (attribute) code.
@@ -760,11 +766,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 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 */
@@ -776,10 +782,10 @@ test_attr_compound_read(hid_t fapl)
size_t offset; /* Attribute datatype field offset */
hid_t field; /* Attribute field datatype */
struct attr4_struct read_data4[ATTR4_DIM1][ATTR4_DIM2]; /* Buffer for reading 4th attribute */
- size_t name_len; /* Length of attribute name */
+ 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"));
@@ -828,7 +834,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);
@@ -842,7 +848,7 @@ test_attr_compound_read(hid_t fapl)
t_class = H5Tget_class(field);
VERIFY(t_class, H5T_INTEGER, "H5Tget_class");
order = H5Tget_order(field);
- VERIFY(order, H5Tget_order(H5T_NATIVE_INT), "H5Tget_order");
+ VERIFY_TYPE(order, H5Tget_order(H5T_NATIVE_INT), H5T_order_t, "%d", "H5Tget_order");
size = H5Tget_size(field);
VERIFY(size, H5Tget_size(H5T_NATIVE_INT), "H5Tget_size");
H5Tclose(field);
@@ -851,7 +857,7 @@ test_attr_compound_read(hid_t fapl)
t_class = H5Tget_class(field);
VERIFY(t_class, H5T_FLOAT, "H5Tget_class");
order = H5Tget_order(field);
- VERIFY(order, H5Tget_order(H5T_NATIVE_DOUBLE), "H5Tget_order");
+ VERIFY_TYPE(order, H5Tget_order(H5T_NATIVE_DOUBLE), H5T_order_t, "%d", "H5Tget_order");
size = H5Tget_size(field);
VERIFY(size, H5Tget_size(H5T_NATIVE_DOUBLE), "H5Tget_size");
H5Tclose(field);
@@ -860,7 +866,7 @@ test_attr_compound_read(hid_t fapl)
t_class = H5Tget_class(field);
VERIFY(t_class, H5T_INTEGER, "H5Tget_class");
order = H5Tget_order(field);
- VERIFY(order, H5Tget_order(H5T_NATIVE_SCHAR), "H5Tget_order");
+ VERIFY_TYPE(order, H5Tget_order(H5T_NATIVE_SCHAR), H5T_order_t, "%d", "H5Tget_order");
size = H5Tget_size(field);
VERIFY(size, H5Tget_size(H5T_NATIVE_SCHAR), "H5Tget_size");
H5Tclose(field);
@@ -876,7 +882,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);
@@ -901,7 +907,7 @@ test_attr_compound_read(hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_compound_read() */
-
+
/****************************************************************
**
** test_attr_scalar_write(): Test scalar H5A (attribute) writing code.
@@ -911,11 +917,12 @@ 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 dataset; /* Dataset ID */
+ hid_t sid1,sid2; /* Dataspace ID */
hid_t attr; /* Attribute ID */
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- herr_t ret; /* Generic return value */
+ 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"));
@@ -929,7 +936,7 @@ test_attr_scalar_write(hid_t fapl)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a dataset */
- dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Create dataspace for attribute */
@@ -941,8 +948,8 @@ test_attr_scalar_write(hid_t fapl)
CHECK(attr, FAIL, "H5Acreate2");
/* Try to create the same attribute again (should fail) */
- ret = H5Acreate2(dataset, ATTR5_NAME, H5T_NATIVE_FLOAT, sid2, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Acreate2");
+ ret_id = H5Acreate2(dataset, ATTR5_NAME, H5T_NATIVE_FLOAT, sid2, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Acreate2");
/* Write attribute information */
ret = H5Awrite(attr, H5T_NATIVE_FLOAT, &attr_data5);
@@ -966,7 +973,7 @@ test_attr_scalar_write(hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_scalar_write() */
-
+
/****************************************************************
**
** test_attr_scalar_read(): Test scalar H5A (attribute) reading code.
@@ -976,13 +983,13 @@ 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 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"));
@@ -1009,9 +1016,9 @@ test_attr_scalar_read(hid_t fapl)
CHECK(ret, FAIL, "H5Aread");
/* Verify the floating-poing value in this way to avoid compiler warning. */
- if(!FLT_ABS_EQUAL(rdata, attr_data5))
- printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n",
- "H5Aread", attr_data5, rdata, (int)__LINE__, __FILE__);
+ 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__);
/* Get the attribute's dataspace */
sid = H5Aget_space(attr);
@@ -1037,7 +1044,7 @@ test_attr_scalar_read(hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_scalar_read() */
-
+
/****************************************************************
**
** test_attr_mult_write(): Test basic H5A (attribute) code.
@@ -1048,14 +1055,15 @@ 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 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};
- herr_t ret; /* Generic return value */
+ 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"));
@@ -1069,7 +1077,7 @@ test_attr_mult_write(hid_t fapl)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a dataset */
- dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Close dataset's dataspace */
@@ -1085,8 +1093,8 @@ test_attr_mult_write(hid_t fapl)
CHECK(attr, FAIL, "H5Acreate2");
/* Try to create the same attribute again (should fail) */
- ret = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Acreate2");
+ ret_id = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Acreate2");
/* Write 1st attribute data */
ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data1);
@@ -1109,8 +1117,8 @@ test_attr_mult_write(hid_t fapl)
CHECK(attr, FAIL, "H5Acreate2");
/* Try to create the same attribute again (should fail) */
- ret = H5Acreate2(dataset, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Acreate2");
+ ret_id = H5Acreate2(dataset, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Acreate2");
/* Write 2nd attribute information */
ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data2);
@@ -1133,8 +1141,8 @@ test_attr_mult_write(hid_t fapl)
CHECK(attr, FAIL, "H5Acreate2");
/* Try to create the same attribute again (should fail) */
- ret = H5Acreate2(dataset, ATTR3_NAME, H5T_NATIVE_DOUBLE, sid2, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Acreate2");
+ ret_id = H5Acreate2(dataset, ATTR3_NAME, H5T_NATIVE_DOUBLE, sid2, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Acreate2");
/* Write 3rd attribute information */
ret = H5Awrite(attr, H5T_NATIVE_DOUBLE, attr_data3);
@@ -1157,7 +1165,7 @@ test_attr_mult_write(hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_mult_write() */
-
+
/****************************************************************
**
** test_attr_mult_read(): Test basic H5A (attribute) code.
@@ -1166,11 +1174,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 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 */
@@ -1181,10 +1189,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 */
- size_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"));
@@ -1223,7 +1231,7 @@ test_attr_mult_read(hid_t fapl)
t_class = H5Tget_class(type);
VERIFY(t_class, H5T_INTEGER, "H5Tget_class");
order = H5Tget_order(type);
- VERIFY(order, H5Tget_order(H5T_NATIVE_INT), "H5Tget_order");
+ VERIFY_TYPE(order, H5Tget_order(H5T_NATIVE_INT), H5T_order_t, "%d", "H5Tget_order");
size = H5Tget_size(type);
VERIFY(size, H5Tget_size(H5T_NATIVE_INT), "H5Tget_size");
H5Tclose(type);
@@ -1278,7 +1286,7 @@ test_attr_mult_read(hid_t fapl)
t_class = H5Tget_class(type);
VERIFY(t_class, H5T_INTEGER, "H5Tget_class");
order = H5Tget_order(type);
- VERIFY(order, H5Tget_order(H5T_NATIVE_INT), "H5Tget_order");
+ VERIFY_TYPE(order, H5Tget_order(H5T_NATIVE_INT), H5T_order_t, "%d", "H5Tget_order");
size = H5Tget_size(type);
VERIFY(size, H5Tget_size(H5T_NATIVE_INT), "H5Tget_size");
H5Tclose(type);
@@ -1336,7 +1344,7 @@ test_attr_mult_read(hid_t fapl)
t_class = H5Tget_class(type);
VERIFY(t_class, H5T_FLOAT, "H5Tget_class");
order = H5Tget_order(type);
- VERIFY(order, H5Tget_order(H5T_NATIVE_DOUBLE), "H5Tget_order");
+ VERIFY_TYPE(order, H5Tget_order(H5T_NATIVE_DOUBLE), H5T_order_t, "%d", "H5Tget_order");
size = H5Tget_size(type);
VERIFY(size, H5Tget_size(H5T_NATIVE_DOUBLE), "H5Tget_size");
H5Tclose(type);
@@ -1349,7 +1357,7 @@ test_attr_mult_read(hid_t fapl)
for(i = 0; i < ATTR3_DIM1; i++)
for(j = 0; j < ATTR3_DIM2; j++)
for(k = 0; k < ATTR3_DIM3; k++)
- if(!DBL_ABS_EQUAL(attr_data3[i][j][k], read_data3[i][j][k]))
+ if(!H5_DBL_ABS_EQUAL(attr_data3[i][j][k], read_data3[i][j][k]))
TestErrPrintf("%d: attribute data different: attr_data3[%d][%d][%d]=%f, read_data3[%d][%d][%d]=%f\n", __LINE__, i, j, k, attr_data3[i][j][k], i, j, k, read_data3[i][j][k]);
/* Verify Name */
@@ -1379,7 +1387,7 @@ test_attr_mult_read(hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_mult_read() */
-
+
/****************************************************************
**
** attr_op1(): Attribute operator
@@ -1419,7 +1427,7 @@ attr_op1(hid_t H5_ATTR_UNUSED loc_id, const char *name, const H5A_info_t H5_ATTR
return(ret);
} /* end attr_op1() */
-
+
/****************************************************************
**
** test_attr_iterate(): Test H5A (attribute) iterator code.
@@ -1428,12 +1436,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 file; /* HDF5 File ID */
hid_t dataset; /* Dataset ID */
- hid_t sid; /* Dataspace 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"));
@@ -1447,7 +1455,7 @@ test_attr_iterate(hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Create a new dataset */
- dataset = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Close dataspace */
@@ -1491,7 +1499,7 @@ test_attr_iterate(hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_iterate() */
-
+
/****************************************************************
**
** test_attr_delete(): Test H5A (attribute) code for deleting objects.
@@ -1500,13 +1508,13 @@ test_attr_iterate(hid_t fapl)
static void
test_attr_delete(hid_t fapl)
{
- hid_t fid1; /* HDF5 File 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 */
- size_t name_len; /* Length of attribute name */
+ 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"));
@@ -1611,7 +1619,7 @@ test_attr_delete(hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_delete() */
-
+
/****************************************************************
**
** test_attr_dtype_shared(): Test H5A (attribute) code for using
@@ -1631,7 +1639,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"));
@@ -1672,7 +1680,7 @@ test_attr_dtype_shared(hid_t fapl)
CHECK(space_id, FAIL, "H5Screate");
/* Create dataset */
- dset_id = H5Dcreate2(file_id, DSET1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dset_id = H5Dcreate2(file_id, DSET1_NAME, type_id, space_id, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(dset_id, FAIL, "H5Dcreate2");
/* Check reference count on named datatype */
@@ -1788,7 +1796,7 @@ test_attr_dtype_shared(hid_t fapl)
VERIFY(filesize, empty_filesize, "h5_get_file_size");
} /* test_attr_dtype_shared() */
-
+
/****************************************************************
**
** test_attr_duplicate_ids(): Test operations with more than
@@ -1798,17 +1806,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 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 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"));
@@ -1826,7 +1834,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);
+ dcpl_g, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Create dataspace for attribute */
@@ -2033,7 +2041,7 @@ test_attr_duplicate_ids(hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_duplicate_ids() */
-
+
/****************************************************************
**
** test_attr_dense_verify(): Test basic H5A (attribute) code.
@@ -2043,12 +2051,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();
@@ -2072,7 +2080,7 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr)
/* Re-open all the attributes by index and verify the data */
for(u = 0; u < max_attr; u++) {
- size_t name_len; /* Length of attribute name */
+ ssize_t name_len; /* Length of attribute name */
char check_name[ATTR_NAME_LEN]; /* Buffer for checking attribute names */
/* Open attribute */
@@ -2103,7 +2111,7 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr)
return(-1);
} /* test_attr_dense_verify() */
-
+
/****************************************************************
**
** test_attr_dense_create(): Test basic H5A (attribute) code.
@@ -2113,19 +2121,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 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 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"));
@@ -2152,7 +2160,7 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Query the group creation properties */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Create a dataset */
@@ -2234,7 +2242,7 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl)
VERIFY(filesize, empty_filesize, "h5_get_file_size");
} /* test_attr_dense_create() */
-
+
/****************************************************************
**
** test_attr_dense_open(): Test basic H5A (attribute) code.
@@ -2244,19 +2252,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 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 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"));
@@ -2283,7 +2291,7 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Query the group creation properties */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Enable creation order tracking on attributes, so creation order tests work */
@@ -2373,7 +2381,7 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl)
VERIFY(filesize, empty_filesize, "h5_get_file_size");
} /* test_attr_dense_open() */
-
+
/****************************************************************
**
** test_attr_dense_delete(): Test basic H5A (attribute) code.
@@ -2383,15 +2391,15 @@ 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 */
@@ -2551,7 +2559,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
VERIFY(filesize, empty_filesize, "h5_get_file_size");
} /* test_attr_dense_delete() */
-
+
/****************************************************************
**
** test_attr_dense_rename(): Test basic H5A (attribute) code.
@@ -2561,22 +2569,22 @@ 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 */
unsigned use_corder; /* Track creation order or not */
- 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"));
@@ -2613,11 +2621,11 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
/* Using creation order or not */
for(use_corder = FALSE; use_corder <= TRUE; use_corder++) {
- if(use_corder) {
+ if(use_corder) {
ret = H5Pset_attr_creation_order(dcpl, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED);
CHECK(ret, FAIL, "H5Pset_attr_creation_order");
}
-
+
/* Create a dataset */
dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
@@ -2640,7 +2648,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
/* Close attribute */
ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
-
+
/* Rename attribute */
sprintf(new_attrname, "new attr %02u", u);
@@ -2673,7 +2681,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
/* Close dataspace */
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
-
+
/* Close property list */
ret = H5Pclose(dcpl);
CHECK(ret, FAIL, "H5Pclose");
@@ -2727,7 +2735,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
VERIFY(filesize, empty_filesize, "h5_get_file_size");
} /* test_attr_dense_rename() */
-
+
/****************************************************************
**
** test_attr_dense_unlink(): Test basic H5A (attribute) code.
@@ -2737,15 +2745,15 @@ 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 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 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 */
@@ -2857,7 +2865,7 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl)
VERIFY(filesize, empty_filesize, "h5_get_file_size");
} /* test_attr_dense_unlink() */
-
+
/****************************************************************
**
** test_attr_dense_limits(): Test basic H5A (attribute) code.
@@ -2869,17 +2877,17 @@ 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 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 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"));
@@ -2906,7 +2914,7 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Query the group creation properties */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Change limits on compact/dense attribute storage */
@@ -3022,7 +3030,7 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl)
VERIFY(filesize, empty_filesize, "h5_get_file_size");
} /* test_attr_dense_limits() */
-
+
/****************************************************************
**
** test_attr_dense_dup_ids(): Test operations with multiple ID
@@ -3032,13 +3040,13 @@ 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 fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
hid_t gid1, gid2; /* Group ID */
- hid_t sid, sid2; /* Dataspace 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 */
+ 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 */
@@ -3046,9 +3054,9 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
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"));
@@ -3073,7 +3081,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Query the group creation properties */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Create a dataset */
@@ -3545,7 +3553,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_dense_dup_ids() */
-
+
/****************************************************************
**
** test_attr_big(): Test basic H5A (attribute) code.
@@ -3603,7 +3611,7 @@ test_attr_big(hid_t fcpl, hid_t fapl)
CHECK(big_sid, FAIL, "H5Screate_simple");
/* Query the group creation properties */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Retrieve limits for compact/dense attribute storage */
@@ -3815,7 +3823,7 @@ test_attr_big(hid_t fcpl, hid_t fapl)
VERIFY(filesize, empty_filesize, "h5_get_file_size");
} /* test_attr_big() */
-
+
/****************************************************************
**
** test_attr_null_space(): Test basic H5A (attribute) code.
@@ -3869,7 +3877,7 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
CHECK(null_sid, FAIL, "H5Screate");
/* Create a dataset */
- dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
@@ -4033,7 +4041,7 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
VERIFY(filesize, empty_filesize, "h5_get_file_size");
} /* test_attr_null_space() */
-
+
/****************************************************************
**
** test_attr_deprec(): Test basic H5A (attribute) code.
@@ -4062,7 +4070,7 @@ test_attr_deprec(hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Create a dataset */
- dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
@@ -4142,7 +4150,7 @@ test_attr_deprec(hid_t fcpl, hid_t fapl)
#endif /* H5_NO_DEPRECATED_SYMBOLS */
} /* test_attr_deprec() */
-
+
/****************************************************************
**
** test_attr_many(): Test basic H5A (attribute) code.
@@ -4271,7 +4279,7 @@ test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Sclose");
} /* test_attr_many() */
-
+
/****************************************************************
**
** test_attr_corder_create_empty(): Test basic H5A (attribute) code.
@@ -4298,7 +4306,7 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl)
CHECK(fid, FAIL, "H5Fcreate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Get creation order indexing on object */
@@ -4387,7 +4395,7 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_corder_create_basic() */
-
+
/****************************************************************
**
** test_attr_corder_create_compact(): Test basic H5A (attribute) code.
@@ -4421,7 +4429,7 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl)
CHECK(fid, FAIL, "H5Fcreate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Set attribute creation order tracking & indexing for object */
@@ -4585,7 +4593,7 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_corder_create_compact() */
-
+
/****************************************************************
**
** test_attr_corder_create_dense(): Test basic H5A (attribute) code.
@@ -4621,7 +4629,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl)
CHECK(fid, FAIL, "H5Fcreate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Set attribute creation order tracking & indexing for object */
@@ -4812,7 +4820,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* test_attr_corder_create_dense() */
-
+
/****************************************************************
**
** test_attr_corder_create_reopen(): Test basic H5A (attribute) code.
@@ -4920,7 +4928,7 @@ test_attr_corder_create_reopen(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Sclose");
} /* test_attr_corder_create_reopen() */
-
+
/****************************************************************
**
** test_attr_corder_transition(): Test basic H5A (attribute) code.
@@ -4956,7 +4964,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
CHECK(fid, FAIL, "H5Fcreate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Set attribute creation order tracking & indexing for object */
@@ -5326,7 +5334,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Sclose");
} /* test_attr_corder_transition() */
-
+
/****************************************************************
**
** test_attr_corder_delete(): Test basic H5A (attribute) code.
@@ -5349,7 +5357,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl)
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 */
- hbool_t reopen_file; /* Whether to re-open the file before deleting group */
+ unsigned reopen_file; /* Whether to re-open the file before deleting group */
char attrname[NAME_BUF_SIZE]; /* Name of attribute */
#ifdef LATER
h5_stat_size_t empty_size; /* Size of empty file */
@@ -5367,7 +5375,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Set attribute creation order tracking & indexing for object */
@@ -5527,7 +5535,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Sclose");
} /* test_attr_corder_delete() */
-
+
/*-------------------------------------------------------------------------
* Function: attr_info_by_idx_check
*
@@ -5571,7 +5579,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n,
/* Verify the name for new link, in increasing creation order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_name_by_idx");
if(HDstrcmp(attrname, tmpname))
TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__);
@@ -5596,7 +5604,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n,
/* Verify the name for new link, in increasing native order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_name_by_idx");
if(HDstrcmp(attrname, tmpname))
TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__);
@@ -5617,7 +5625,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n,
/* Verify the name for new link, in increasing creation order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_name_by_idx");
if(HDstrcmp(attrname, tmpname))
TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__);
@@ -5637,7 +5645,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n,
/* Verify the name for new link, in increasing name order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = H5Aget_name_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_name_by_idx");
if(HDstrcmp(attrname, tmpname))
TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__);
@@ -5662,7 +5670,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n,
/* Verify the name for new link, in increasing name order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = H5Aget_name_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(obj_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_name_by_idx");
if(HDstrcmp(attrname, tmpname))
TestErrPrintf("Line %d: attribute name size wrong!\n", __LINE__);
@@ -5674,7 +5682,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n,
return(-1);
} /* end attr_info_by_idx_check() */
-
+
/****************************************************************
**
** test_attr_info_by_idx(): Test basic H5A (attribute) code.
@@ -5698,7 +5706,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
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 */
- hbool_t use_index; /* Use index on creation order values */
+ unsigned use_index; /* Use index on creation order values */
char attrname[NAME_BUF_SIZE]; /* Name of attribute */
char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */
unsigned curr_dset; /* Current dataset to work on */
@@ -5710,7 +5718,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Query the attribute creation properties */
@@ -5771,7 +5779,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Check for query on non-existant attribute */
ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &ainfo, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aget_info_by_idx");
- ret = H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aget_name_by_idx");
/* Create attributes, up to limit of compact form */
@@ -5808,7 +5816,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(ret, FAIL, "H5Aget_info_by_idx");
ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &ainfo, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aget_info_by_idx");
- ret = H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aget_name_by_idx");
/* Create more attributes, to push into dense form */
@@ -5858,7 +5866,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(ret, FAIL, "H5Aget_info_by_idx");
ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &ainfo, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aget_info_by_idx");
- ret = H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aget_name_by_idx");
} /* end for */
@@ -5884,7 +5892,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Sclose");
} /* test_attr_info_by_idx() */
-
+
/****************************************************************
**
** test_attr_delete_by_idx(): Test basic H5A (attribute) code.
@@ -5910,7 +5918,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
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 */
- hbool_t use_index; /* Use index on creation order values */
+ unsigned use_index; /* Use index on creation order values */
char attrname[NAME_BUF_SIZE]; /* Name of attribute */
char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */
unsigned curr_dset; /* Current dataset to work on */
@@ -5922,7 +5930,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Query the attribute creation properties */
@@ -5930,9 +5938,9 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Pget_attr_phase_change");
/* Loop over operating on different indices on link fields */
- for(idx_type = H5_INDEX_NAME; idx_type <=H5_INDEX_CRT_ORDER; idx_type++) {
+ for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) {
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) {
+ for(order = H5_ITER_INC; order <= H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) {
/* Loop over using index for creation order value */
for(use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
@@ -6085,7 +6093,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Verify the name for first attribute in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
if(order == H5_ITER_INC)
sprintf(attrname, "attr %02u", (u + 1));
else
@@ -6210,7 +6218,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Verify the name for first attribute in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
if(order == H5_ITER_INC)
sprintf(attrname, "attr %02u", (u + 1));
else
@@ -6321,7 +6329,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Verify the name for first attribute in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
if(order == H5_ITER_INC)
sprintf(attrname, "attr %02u", ((u * 2) + 1));
else
@@ -6370,7 +6378,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Verify the name for first attribute in appropriate order */
HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
- ret = H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
if(order == H5_ITER_INC)
sprintf(attrname, "attr %02u", ((u * 2) + 3));
else
@@ -6416,7 +6424,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Sclose");
} /* test_attr_delete_by_idx() */
-
+
/****************************************************************
**
** attr_iterate2_cb(): Revised attribute operator
@@ -6490,7 +6498,7 @@ HDfprintf(stderr, "op_data->curr = %Hd\n", op_data->curr);
} /* end attr_iterate2_cb() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
-
+
/****************************************************************
**
** attr_iterate1_cb(): Attribute operator
@@ -6503,7 +6511,7 @@ attr_iterate1_cb(hid_t loc_id, const char *attr_name, void *_op_data)
} /* end attr_iterate1_cb() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
+
/*-------------------------------------------------------------------------
* Function: attr_iterate2_fail_cb
*
@@ -6525,7 +6533,7 @@ attr_iterate2_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *
return(H5_ITER_ERROR);
} /* end attr_iterate2_fail_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: attr_iterate_check
*
@@ -6825,7 +6833,7 @@ attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id,
return(-1);
} /* end attr_iterate_check() */
-
+
/****************************************************************
**
** test_attr_iterate2(): Test basic H5A (attribute) code.
@@ -6853,7 +6861,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
attr_iter_info_t iter_info; /* Iterator info */
hbool_t *visited = NULL; /* Array of flags for visiting links */
hsize_t idx; /* Start index for iteration */
- hbool_t use_index; /* Use index on creation order values */
+ 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 */
unsigned curr_dset; /* Current dataset to work on */
@@ -6865,7 +6873,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Query the attribute creation properties */
@@ -6875,13 +6883,13 @@ 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 */
- for(idx_type = H5_INDEX_NAME; idx_type <=H5_INDEX_CRT_ORDER; idx_type++) {
+ for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) {
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) {
+ for(order = H5_ITER_INC; order <= H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) {
/* Loop over using index for creation order value */
for(use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
@@ -7129,7 +7137,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
HDfree(visited);
} /* test_attr_iterate2() */
-
+
/*-------------------------------------------------------------------------
* Function: attr_open_by_idx_check
*
@@ -7189,7 +7197,7 @@ attr_open_by_idx_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
return(-1);
} /* end attr_open_by_idx_check() */
-
+
/****************************************************************
**
** test_attr_open_by_idx(): Test basic H5A (attribute) code.
@@ -7214,10 +7222,11 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
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 */
- hbool_t use_index; /* Use index on creation order values */
+ unsigned use_index; /* Use index on creation order values */
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 */
/* Create dataspace for dataset & attributes */
@@ -7225,7 +7234,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Query the attribute creation properties */
@@ -7233,9 +7242,9 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Pget_attr_phase_change");
/* Loop over operating on different indices on link fields */
- for(idx_type = H5_INDEX_NAME; idx_type <=H5_INDEX_CRT_ORDER; idx_type++) {
+ for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) {
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) {
+ for(order = H5_ITER_INC; order <= H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) {
/* Loop over using index for creation order value */
for(use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
@@ -7312,8 +7321,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test");
/* Check for opening an attribute on an object with no attributes */
- ret = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen_by_idx");
+ ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen_by_idx");
/* Create attributes, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
@@ -7345,8 +7354,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test");
/* Check for out of bound opening an attribute on an object */
- ret = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen_by_idx");
+ ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen_by_idx");
/* Test opening attributes by index stored compactly */
ret = attr_open_by_idx_check(my_dataset, idx_type, order, u);
@@ -7418,8 +7427,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
} /* end if */
/* Check for out of bound opening an attribute on an object */
- ret = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen_by_idx");
+ ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen_by_idx");
/* Test opening attributes by index stored compactly */
ret = attr_open_by_idx_check(my_dataset, idx_type, order, u);
@@ -7450,7 +7459,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Sclose");
} /* test_attr_open_by_idx() */
-
+
/*-------------------------------------------------------------------------
* Function: attr_open_check
*
@@ -7536,7 +7545,7 @@ attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id,
return(-1);
} /* end attr_open_check() */
-
+
/****************************************************************
**
** test_attr_open_by_name(): Test basic H5A (attribute) code.
@@ -7559,11 +7568,12 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
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 */
- hbool_t use_index; /* Use index on creation order values */
+ 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 */
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 */
/* Create dataspace for dataset & attributes */
@@ -7571,7 +7581,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Query the attribute creation properties */
@@ -7633,14 +7643,14 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test");
/* Check for opening a non-existant attribute on an object with no attributes */
- ret = H5Aopen(my_dataset, "foo", H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen");
+ ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen");
- ret = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen_by_name");
+ ret_id = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen_by_name");
- ret = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen_by_name");
+ ret_id = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen_by_name");
/* Create attributes, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
@@ -7672,14 +7682,14 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test");
/* Check for opening a non-existant attribute on an object with compact attribute storage */
- ret = H5Aopen(my_dataset, "foo", H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen");
+ ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen");
- ret = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen_by_name");
+ ret_id = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen_by_name");
- ret = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen_by_name");
+ ret_id = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen_by_name");
/* Test opening attributes stored compactly */
ret = attr_open_check(fid, dsetname, my_dataset, u);
@@ -7754,14 +7764,14 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
} /* end if */
/* Check for opening a non-existant attribute on an object with dense attribute storage */
- ret = H5Aopen(my_dataset, "foo", H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen");
+ ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen");
- ret = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen_by_name");
+ ret_id = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen_by_name");
- ret = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT);
- VERIFY(ret, FAIL, "H5Aopen_by_name");
+ ret_id = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(ret_id, FAIL, "H5Aopen_by_name");
/* Test opening attributes stored compactly */
ret = attr_open_check(fid, dsetname, my_dataset, u);
@@ -7790,7 +7800,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Sclose");
} /* test_attr_open_by_name() */
-
+
/****************************************************************
**
** test_attr_create_by_name(): Test basic H5A (attribute) code.
@@ -7813,7 +7823,7 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
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 */
- hbool_t use_index; /* Use index on creation order values */
+ 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 */
unsigned curr_dset; /* Current dataset to work on */
@@ -7825,7 +7835,7 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Query the attribute creation properties */
@@ -8038,7 +8048,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
htri_t is_shared; /* Is attributes shared? */
hsize_t shared_refcount; /* Reference count of shared attribute */
unsigned attr_value; /* Attribute value */
- unsigned big_value[SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3]; /* 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 */
@@ -8049,8 +8059,10 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
/* Output message about test being performed */
MESSAGE(5, ("Testing Writing Shared & Unshared Attributes in Compact & Dense Storage\n"));
- /* Initialize "big" attribute data */
- HDmemset(big_value, 1, sizeof(big_value));
+ /* Allocate & initialize "big" attribute data */
+ big_value = (unsigned *)HDmalloc((size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3) * sizeof(unsigned));
+ CHECK_PTR(big_value, "HDmalloc");
+ HDmemset(big_value, 1, sizeof(unsigned) * (size_t)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3));
/* Create dataspace for dataset */
sid = H5Screate(H5S_SCALAR);
@@ -8124,7 +8136,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
} /* end if */
/* Set up to query the object creation properties */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Create datasets */
diff --git a/test/tcheck_version.c b/test/tcheck_version.c
index 02f6eb6..c2b454f 100644
--- a/test/tcheck_version.c
+++ b/test/tcheck_version.c
@@ -63,7 +63,7 @@ parse(int ac, char **av)
pt = *(++av);
if (*pt != '-') {
fprintf(stderr, "Unknown option(%s). Aborted.\n", *av);
- exit(1);
+ exit(EXIT_FAILURE);
}else{
switch(*(++pt)) {
case 't': /* option -t */
@@ -79,15 +79,15 @@ parse(int ac, char **av)
break;
default:
fprintf(stderr, "Unknown -v parameter (%s). Aborted.\n", *av);
- exit(1);
+ exit(EXIT_FAILURE);
}
break;
case 'h': /* help page */
showhelp();
- exit(0);
+ exit(EXIT_SUCCESS);
default:
fprintf(stderr, "Unknown option(%s). Aborted.\n", *av);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
}
diff --git a/test/testfiles/err_compat_1 b/test/testfiles/err_compat_1
index d471e13..e8ea044 100644
--- a/test/testfiles/err_compat_1
+++ b/test/testfiles/err_compat_1
@@ -1,5 +1,5 @@
Testing error API H5Eset/get_auto Testing error API based on data I/O All error API tests passed.
- This program tests the Error API compatible with HDF5 version (number). There're supposed to be some error messages
+ This program tests the Error API compatible with HDF5 version (number). There are supposed to be some error messages
********* Print error stack in HDF5 default way *********
HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#000: (file name) line (number) in main(): Error test failed
@@ -54,6 +54,6 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#001: (file name) line (number) in test_error2(): H5Dwrite shouldn't succeed
major: Error API
minor: Write failed
- #002: (file name) line (number) in H5Dwrite(): not a dataset
+ #002: (file name) line (number) in H5Dwrite(): dset_id is not a dataset ID
major: Invalid arguments to routine
minor: Inappropriate type
diff --git a/test/testfiles/err_compat_2 b/test/testfiles/err_compat_2
index 75e8769..467ba4c 100644
--- a/test/testfiles/err_compat_2
+++ b/test/testfiles/err_compat_2
@@ -1 +1 @@
-Test skipped because backward compatbility with v1.6 is NOT configured in
+Test skipped because backward compatibility with v1.6 is NOT configured in
diff --git a/test/testfiles/error_test_2 b/test/testfiles/error_test_2
index 6852f6f..85bc2e7 100644
--- a/test/testfiles/error_test_2
+++ b/test/testfiles/error_test_2
@@ -1 +1 @@
-Test skipped because backward compatbility with v1.6 is configured in
+Test skipped because backward compatibility with v1.6 is configured in