diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2022-04-13 21:17:29 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2022-04-13 21:17:29 (GMT) |
commit | cabc39c3e197e2591449d2604bfee26465fb60e1 (patch) | |
tree | d5f39f5f5965584bf9bf49646a2af617adfd3e4e /tools/test/h5diff | |
parent | 7355f4c505092a7a85474b47f18d5206028e2c95 (diff) | |
parent | ab69f5df770ee3cc6cd6c81d905a5317b894a002 (diff) | |
download | hdf5-feature/coding_standards.zip hdf5-feature/coding_standards.tar.gz hdf5-feature/coding_standards.tar.bz2 |
Merge branch 'develop' into feature/coding_standardsfeature/coding_standards
Diffstat (limited to 'tools/test/h5diff')
33 files changed, 3025 insertions, 2182 deletions
diff --git a/tools/test/h5diff/CMakeLists.txt b/tools/test/h5diff/CMakeLists.txt index cb4397f..f74db0f 100644 --- a/tools/test/h5diff/CMakeLists.txt +++ b/tools/test/h5diff/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.10) +cmake_minimum_required (VERSION 3.12) project (HDF5_TOOLS_TEST_H5DIFF C) # -------------------------------------------------------------------- @@ -6,11 +6,18 @@ project (HDF5_TOOLS_TEST_H5DIFF C) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (h5diffgentest ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/h5diffgentest.c) - target_include_directories (h5diffgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5diffgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5diffgentest STATIC) target_link_libraries (h5diffgentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5diffgentest PROPERTIES FOLDER generator/tools) + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_H5DIFF_FORMAT h5diffgentest) + endif () + #add_test (NAME h5diffgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diffgentest>) endif () @@ -23,11 +30,18 @@ if (BUILD_SHARED_LIBS) set (H5DIFF_TOOL_PLUGIN_LIB_TARGET ${H5DIFF_TOOL_PLUGIN_LIB_CORENAME}) add_library (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_diff.c) - target_include_directories (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} SHARED) - target_link_libraries (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + target_link_libraries (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} ${H5DIFF_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_H5DIFF_PLUGIN_FORMAT ${H5DIFF_TOOL_PLUGIN_LIB_TARGET}) + endif () + # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") #----------------------------------------------------------------------------- @@ -43,4 +57,6 @@ if (BUILD_SHARED_LIBS) ) endif () -include (CMakeTests.cmake) +if (HDF5_TEST_TOOLS) + include (CMakeTests.cmake) +endif () diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 93dfd72..8e01605 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -5,7 +5,7 @@ # 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. +# distribution tree, or in https://www.hdfgroup.org/licenses. # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # @@ -66,8 +66,10 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/non_comparables2.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tudfilter.h5 ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tudfilter2.h5 - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/diff_strings1.h5 - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/diff_strings2.h5 + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_strings1.h5 + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_strings2.h5 + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_eps1.h5 + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_eps2.h5 # tools/testfiles/vds ${HDF5_TOOLS_DIR}/testfiles/vds/1_a.h5 ${HDF5_TOOLS_DIR}/testfiles/vds/1_b.h5 @@ -94,6 +96,17 @@ ${HDF5_TOOLS_DIR}/testfiles/vds/5_vds.h5 # tools/testfiles ${HDF5_TOOLS_DIR}/testfiles/tvlstr.h5 + #STD_REF_OBJ files + ${HDF5_TOOLS_DIR}/testfiles/trefer_attr.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_compat.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_ext1.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_ext2.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_grp.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_obj_del.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_obj.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_param.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_reg_1d.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_reg.h5 ) set (LIST_OTHER_TEST_FILES @@ -201,6 +214,7 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_56.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_57.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_58.txt + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_58_ref.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_59.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_500.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_501.txt @@ -279,9 +293,11 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_80.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_800.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_801.txt + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_830.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_90.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8625.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8639.txt + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_reg.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_ud.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_udfail.err ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_udfail.txt @@ -289,6 +305,7 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_v2.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_v3.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_vlstr.txt + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_eps.txt ) set (LIST_WIN_TEST_FILES @@ -325,9 +342,10 @@ # Overwrite system dependent files (Windows) and not VS2015 # set (COPY_WINDOWS_FILES false) - if (MINGW) - set (COPY_WINDOWS_FILES true) - endif () + # MinGW tests may depend on host system + #if (MINGW) + # set (COPY_WINDOWS_FILES true) + #endif () if (WIN32 AND MSVC_VERSION LESS 1900) set (COPY_WINDOWS_FILES true) endif () @@ -350,12 +368,6 @@ endif () add_custom_target(h5diff_files ALL COMMENT "Copying files needed by h5diff tests" DEPENDS ${h5diff_files_list}) - if (NOT BUILD_SHARED_LIBS) - set (tgt_ext "") - else () - set (tgt_ext "-shared") - endif () - ############################################################################## ############################################################################## ### T H E T E S T S M A C R O S ### @@ -363,9 +375,18 @@ ############################################################################## macro (ADD_H5_TEST resultfile resultcode) + if (HDF5_TEST_SERIAL) + ADD_SH5_TEST (${resultfile} ${resultcode} ${ARGN}) + endif () + if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL) + ADD_PH5_TEST (${resultfile} ${resultcode} ${ARGN}) + endif () + endmacro () + + macro (ADD_SH5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DIFF-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_ext}> ${ARGN}) + add_test (NAME H5DIFF-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_file_ext}> ${ARGN}) set_tests_properties (H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (${resultcode}) set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") @@ -378,7 +399,7 @@ NAME H5DIFF-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5diff${tgt_ext}>" + -D "TEST_PROGRAM=$<TARGET_FILE:h5diff${tgt_file_ext}>" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -391,15 +412,12 @@ set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () endif () - if (H5_HAVE_PARALLEL) - ADD_PH5_TEST (${resultfile} ${resultcode} ${ARGN}) - endif () endmacro () macro (ADD_PH5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME MPI_TEST_H5DIFF-${resultfile} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:ph5diff> ${MPIEXEC_POSTFLAGS} ${ARGN}) + add_test (NAME MPI_TEST_H5DIFF-${resultfile} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:ph5diff${tgt_file_ext}> ${MPIEXEC_POSTFLAGS} ${ARGN}) set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/PAR/testfiles") if (${resultcode}) set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") @@ -411,7 +429,7 @@ add_test ( NAME MPI_TEST_H5DIFF-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$<TARGET_FILE:ph5diff>;${MPIEXEC_POSTFLAGS}" + -D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$<TARGET_FILE:ph5diff${tgt_file_ext}>;${MPIEXEC_POSTFLAGS}" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/PAR/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -426,13 +444,13 @@ if (last_test) set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () - set (last_test "PH5DIFF-${resultfile}") + set (last_test "MPI_TEST_H5DIFF-${resultfile}") endif () endmacro () macro (ADD_H5_UD_TEST testname resultcode resultfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) - if (${resultcode} EQUAL 2) + if ("${resultcode}" STREQUAL "2") add_test ( NAME H5DIFF_UD-${testname} COMMAND "${CMAKE_COMMAND}" @@ -530,8 +548,11 @@ set (ATTR_VERBOSE_LEVEL_FILE1 h5diff_attr_v_level1.h5) set (ATTR_VERBOSE_LEVEL_FILE2 h5diff_attr_v_level2.h5) # strings - set (STRINGS1 diff_strings1.h5) - set (STRINGS2 diff_strings2.h5) + set (STRINGS1 h5diff_strings1.h5) + set (STRINGS2 h5diff_strings2.h5) + # epsilon + set (EPS1 h5diff_eps1.h5) + set (EPS2 h5diff_eps2.h5) # VDS tests set (FILEV1 1_vds.h5) @@ -903,6 +924,8 @@ h5diff_800.out.err h5diff_801.out h5diff_801.out.err + h5diff_830.out + h5diff_830.out.err h5diff_8625.out h5diff_8625.out.err h5diff_8639.out @@ -917,6 +940,8 @@ h5diff_v3.out.err h5diff_vlstr.out h5diff_vlstr.out.err + h5diff_eps.out + h5diff_eps.out.err ) set_tests_properties (H5DIFF-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (last_test) @@ -1044,7 +1069,10 @@ ADD_H5_TEST (h5diff_56 1 -v ${FILE4} ${FILE4} dset6a dset6b) ADD_H5_TEST (h5diff_57 0 -v ${FILE4} ${FILE4} dset7a dset7b) # 5.8 (region reference) -ADD_H5_TEST (h5diff_58 1 -v ${FILE7} ${FILE8} refreg) +ADD_H5_TEST (h5diff_58 1 -v2 ${FILE7} ${FILE8} refreg) +ADD_H5_TEST (h5diff_58_ref 1 -v2 ${FILE7} ${FILE8} /g1/reference2D) +# STD_REF_OBJ +ADD_H5_TEST (h5diff_reg 0 -v2 trefer_attr.h5 trefer_ext2.h5 Dataset3 Dataset3) # test for both dset and attr with same type but with different size # ( HDDFV-7942 ) @@ -1095,6 +1123,9 @@ ADD_H5_TEST (h5diff_609 0 -d 200 ${FILE1} ${FILE2} g1/dset3 g1/dset4) # 6.10: number smaller than smallest difference ADD_H5_TEST (h5diff_610 1 -d 1 ${FILE1} ${FILE2} g1/dset3 g1/dset4) +# eps: number smaller than epsilon +ADD_H5_TEST (h5diff_eps 0 -v3 -d 1e-16 ${EPS1} ${EPS2}) + # ############################################################################## # # -p # ############################################################################## @@ -1247,7 +1278,7 @@ ADD_H5_TEST (h5diff_208 0 -c ${FILE19} ${FILE20}) ADD_H5_TEST (h5diff_220 1 -c non_comparables1.h5 non_comparables2.h5 /g1) # comparable dataset with non-comparable attribute and other comparable attributes. -# Also test non-compatible attributes with different type, dimention, rank. +# Also test non-compatible attributes with different type, dimension, rank. # All the rest comparables should display differences. ADD_H5_TEST (h5diff_221 1 -c non_comparables1.h5 non_comparables2.h5 /g2) @@ -1407,7 +1438,7 @@ ADD_H5_TEST (h5diff_475 1 -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_ # ############################################################################## -# # test for group diff recursivly +# # test for group diff recursively # ############################################################################## # root ADD_H5_TEST (h5diff_500 1 -v ${GRP_RECURSE_FILE1} ${GRP_RECURSE_FILE2} / /) @@ -1480,11 +1511,9 @@ ADD_H5_TEST (h5diff_484 0 -v --exclude-path "/dset3" ${EXCLUDE_FILE1_1} ${EXCLUD # Only one file contains unique objs. Common objs are same. # (HDFFV-7837) # -ADD_H5_TEST (h5diff_485 0 -v --exclude-path "/group1" h5diff_exclude3-1.h5 h5diff_exclude3-2.h5) -ADD_H5_TEST (h5diff_486 0 -v --exclude-path "/group1" h5diff_exclude3-2.h5 h5diff_exclude3-1.h5) -ADD_H5_TEST (h5diff_487 1 -v --exclude-path "/group1/dset" h5diff_exclude3-1.h5 h5diff_exclude3-2.h5) - - +ADD_H5_TEST (h5diff_485 0 -v --exclude-path "/group1" ${EXCLUDE_FILE3_1} ${EXCLUDE_FILE3_2}) +ADD_H5_TEST (h5diff_486 0 -v --exclude-path "/group1" ${EXCLUDE_FILE3_2} ${EXCLUDE_FILE3_1}) +ADD_H5_TEST (h5diff_487 1 -v --exclude-path "/group1/dset" ${EXCLUDE_FILE3_1} ${EXCLUDE_FILE3_2}) # ############################################################################## # # diff various multiple vlen and fixed strings in a compound type dataset @@ -1518,13 +1547,17 @@ ADD_H5_TEST (h5diff_646 1 -v --use-system-epsilon -p 0.05 ${FILE1} ${FILE2} /g1/ # ############################################################################## # # Test array variances # ############################################################################## -# -# Test with -d , -p and --use-system-epsilon. ADD_H5_TEST (h5diff_800 1 -v ${FILE7} ${FILE8} /g1/array /g1/array) ADD_H5_TEST (h5diff_801 1 -v ${FILE7} ${FILE8A} /g1/array /g1/array) # ############################################################################## -# VDS tests +# # dataset subsets +# ############################################################################## +#serial only +ADD_SH5_TEST (h5diff_830 1 --enable-error-stack -v ${FILE7} ${FILE8} /g1/array3D[0,0,0;2,2,1;2,2,2;] /g1/array3D[0,0,0;2,2,1;2,2,2;]) + +# ############################################################################## +# # VDS tests # ############################################################################## ADD_H5_TEST (h5diff_v1 0 -v ${FILEV1} ${FILEV2}) ADD_H5_TEST (h5diff_v2 0 -r ${FILEV1} ${FILEV2}) @@ -1533,7 +1566,7 @@ ADD_H5_TEST (h5diff_v3 0 -c ${FILEV1} ${FILEV2}) ############################################################################## ### P L U G I N T E S T S ############################################################################## -if (BUILD_SHARED_LIBS) +if (BUILD_SHARED_LIBS AND HDF5_TEST_SERIAL) ADD_H5_UD_TEST (h5diff_plugin_test 0 h5diff_ud -v tudfilter.h5 tudfilter2.h5) ADD_H5_UD_TEST (h5diff_plugin_fail 2 h5diff_udfail -v tudfilter.h5 tudfilter2.h5) endif () diff --git a/tools/test/h5diff/Makefile.am b/tools/test/h5diff/Makefile.am index 3a88573..17af61b 100644 --- a/tools/test/h5diff/Makefile.am +++ b/tools/test/h5diff/Makefile.am @@ -6,7 +6,7 @@ # 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. +# distribution tree, or in https://www.hdfgroup.org/licenses. # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. ## diff --git a/tools/test/h5diff/dynlib_diff.c b/tools/test/h5diff/dynlib_diff.c index 571452e..433522d 100644 --- a/tools/test/h5diff/dynlib_diff.c +++ b/tools/test/h5diff/dynlib_diff.c @@ -5,7 +5,7 @@ * 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. * + * distribution tree, or in https://www.hdfgroup.org/licenses. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -17,25 +17,33 @@ #include <stdio.h> #include "H5PLextern.h" -#define H5Z_FILTER_DYNLIBUD 300 -#define MULTIPLIER 3 +#define H5Z_FILTER_DYNLIBUD 300 +#define MULTIPLIER 3 -static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); +static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, + size_t nbytes, size_t *buf_size, void **buf); /* This message derives from H5Z */ const H5Z_class2_t H5Z_DYNLIBUD[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIBUD, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dynlibud", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DYNLIBUD, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "dynlibud", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + H5Z_filter_dynlibud, /* The actual filter function */ }}; -H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} -const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;} +H5PL_type_t +H5PLget_plugin_type(void) +{ + return H5PL_TYPE_FILTER; +} +const void * +H5PLget_plugin_info(void) +{ + return H5Z_DYNLIBUD; +} /*------------------------------------------------------------------------- * Function: H5Z_filter_dynlibud @@ -51,39 +59,37 @@ const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;} *------------------------------------------------------------------------- */ static size_t -H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, - size_t *buf_size, void **buf) +H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, + size_t *buf_size, void **buf) { - char *int_ptr = (char *)*buf; /* Pointer to the data values */ - size_t buf_left = *buf_size; /* Amount of data buffer left to process */ + char * int_ptr = (char *)*buf; /* Pointer to the data values */ + size_t buf_left = *buf_size; /* Amount of data buffer left to process */ /* Check for the correct number of parameters */ - if(cd_nelmts > 0) - return(0); + if (cd_nelmts > 0) + return (0); /* Assignment to eliminate unused parameter warning. */ - cd_values = cd_values; + (void)cd_values; - if(flags & H5Z_FLAG_REVERSE) { /*read*/ + if (flags & H5Z_FLAG_REVERSE) { /*read*/ /* Subtract the original value with MULTIPLIER */ - while(buf_left > 0) { + while (buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp - MULTIPLIER; + *int_ptr = (int8_t)(temp - MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); - } /* end while */ - } /* end if */ + } /* end while */ + } /* end if */ else { /*write*/ /* Add the original value with MULTIPLIER */ - while(buf_left > 0) { + while (buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp + MULTIPLIER; + *int_ptr = (int8_t)(temp + MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ - } /* end else */ + } /* end else */ return nbytes; } /* end H5Z_filter_dynlibud() */ - diff --git a/tools/test/h5diff/h5diff_plugin.sh.in b/tools/test/h5diff/h5diff_plugin.sh.in index 341cba5..28f723e 100644 --- a/tools/test/h5diff/h5diff_plugin.sh.in +++ b/tools/test/h5diff/h5diff_plugin.sh.in @@ -6,7 +6,7 @@ # 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. +# distribution tree, or in https://www.hdfgroup.org/licenses. # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # @@ -135,30 +135,30 @@ CLEAN_TESTFILES_AND_TESTDIR() # -h print help page while [ $# -gt 0 ]; do case "$1" in - -p) # reset the tool name and bin to run ph5diff tests - TESTNAME=ph5diff - H5DIFF=../../src/h5diff/ph5diff # The tool name - H5DIFF_BIN=`pwd`/$H5DIFF # The path of the tool binary - pmode=yes - shift - ;; + -p) # reset the tool name and bin to run ph5diff tests + TESTNAME=ph5diff + H5DIFF=../../src/h5diff/ph5diff # The tool name + H5DIFF_BIN=`pwd`/$H5DIFF # The path of the tool binary + pmode=yes + shift + ;; -h) # print help page - echo "$0 [-p] [-h]" - echo " -p run ph5diff tests" - echo " -h print help page" - shift - exit 0 - ;; + echo "$0 [-p] [-h]" + echo " -p run ph5diff tests" + echo " -h print help page" + shift + exit 0 + ;; *) # unknown option echo "$0: Unknown option ($1)" - exit 1 - ;; + exit 1 + ;; esac done # RUNSERIAL is used. Check if it can return exit code from executalbe correctly. if [ -n "$RUNSERIAL_NOEXITCODE" ]; then - echo "***Warning*** Serial Exit Code is not passed back to shell corretly." + echo "***Warning*** Serial Exit Code is not passed back to shell correctly." echo "***Warning*** Exit code checking is skipped." h5haveexitcode=no fi @@ -218,23 +218,25 @@ TOOLTEST() { # Run test. TESTING $H5DIFF $@ ( - #echo "#############################" - #echo "Expected output for '$H5DIFF $@'" - #echo "#############################" - cd $TESTDIR - eval $ENVCMD $RUNCMD $H5DIFF_BIN "$@" + #echo "#############################" + #echo "Expected output for '$H5DIFF $@'" + #echo "#############################" + cd $TESTDIR + eval $ENVCMD $RUNCMD $H5DIFF_BIN "$@" ) >$actual 2>$actual_err EXIT_CODE=$? + # save actual and actual_err in case they are needed later. cp $actual $actual_sav STDOUT_FILTER $actual cp $actual_err $actual_err_sav STDERR_FILTER $actual_err cat $actual_err >> $actual + # don't add exit code check in pmode, as it causes failure. (exit code # is from mpirun not tool) # if any problem occurs relate to an exit code, it will be caught in - # serial mode, so the test is fullfilled. + # serial mode, so the test is fulfilled. if test $h5haveexitcode = 'yes' -a -z "$pmode"; then echo "EXIT CODE: $EXIT_CODE" >> $actual fi @@ -260,27 +262,29 @@ TOOLTEST() { actual_sorted=actual_sorted sort $expect -o $expect_sorted sort $actual -o $actual_sorted + # remove "EXIT CODE:" line from expect file. test for exit code # is done by serial mode. grep -v "EXIT CODE:" $expect_sorted > $expect_sorted.noexit mv $expect_sorted.noexit $expect_sorted - if $CMP $expect_sorted $actual_sorted; then - echo " PASSED" - else - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - if test yes = "$verbose"; then - echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)" - $DIFF $expect_sorted $actual_sorted |sed 's/^/ /' - echo "====The actual output ($actual_sav)" - sed 's/^/ /' < $actual_sav - echo "====The actual stderr ($actual_err_sav)" - sed 's/^/ /' < $actual_err_sav - echo "====End of actual stderr ($actual_err_sav)" - echo "" + + if $CMP $expect_sorted $actual_sorted; then + echo " PASSED" + else + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + if test yes = "$verbose"; then + echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)" + $DIFF $expect_sorted $actual_sorted |sed 's/^/ /' + echo "====The actual output ($actual_sav)" + sed 's/^/ /' < $actual_sav + echo "====The actual stderr ($actual_err_sav)" + sed 's/^/ /' < $actual_err_sav + echo "====End of actual stderr ($actual_err_sav)" + echo "" + fi fi fi - fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then @@ -306,22 +310,24 @@ TOOLTEST_ERR() { # Run test. TESTING $H5DIFF $@ ( - #echo "#############################" - #echo "Expected output for '$H5DIFF $@'" - #echo "#############################" - cd $TESTDIR - eval $ENVCMD $RUNCMD $H5DIFF_BIN "$@" + #echo "#############################" + #echo "Expected output for '$H5DIFF $@'" + #echo "#############################" + cd $TESTDIR + eval $ENVCMD $RUNCMD $H5DIFF_BIN "$@" ) >$actual 2>$actual_err EXIT_CODE=$? + # save actual and actual_err in case they are needed later. cp $actual $actual_sav STDOUT_FILTER $actual cp $actual_err $actual_err_sav STDERR_FILTER $actual_err + # don't add exit code check in pmode, as it causes failure. (exit code # is from mpirun not tool) # if any problem occurs relate to an exit code, it will be caught in - # serial mode, so the test is fullfilled. + # serial mode, so the test is fulfilled. if test $h5haveexitcode = 'yes' -a -z "$pmode"; then echo "EXIT CODE: $EXIT_CODE" >> $actual fi @@ -348,23 +354,24 @@ TOOLTEST_ERR() { sort $expect_err -o $expect_sorted sort $actual_err -o $actual_sorted mv $expect_sorted.noexit $expect_sorted - if $CMP $expect_sorted $actual_sorted; then - echo " PASSED" - else - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - if test yes = "$verbose"; then - echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)" - $DIFF $expect_sorted $actual_sorted |sed 's/^/ /' - echo "====The actual output ($actual_sav)" - sed 's/^/ /' < $actual_sav - echo "====The actual stderr ($actual_err_sav)" - sed 's/^/ /' < $actual_err_sav - echo "====End of actual stderr ($actual_err_sav)" - echo "" + + if $CMP $expect_sorted $actual_sorted; then + echo " PASSED" + else + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + if test yes = "$verbose"; then + echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)" + $DIFF $expect_sorted $actual_sorted |sed 's/^/ /' + echo "====The actual output ($actual_sav)" + sed 's/^/ /' < $actual_sav + echo "====The actual stderr ($actual_err_sav)" + sed 's/^/ /' < $actual_err_sav + echo "====End of actual stderr ($actual_err_sav)" + echo "" + fi fi fi - fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index d60e393..5e0f830 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -6,7 +6,7 @@ * 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. * + * distribution tree, or in https://www.hdfgroup.org/licenses. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -31,75 +31,78 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024); * * Purpose: generate files for h5diff testing * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: November 12, 2003 * *------------------------------------------------------------------------- */ -#define FILE1 "h5diff_basic1.h5" -#define FILE2 "h5diff_basic2.h5" -#define FILE3 "h5diff_types.h5" -#define FILE4 "h5diff_dtypes.h5" -#define FILE5 "h5diff_attr1.h5" -#define FILE6 "h5diff_attr2.h5" -#define FILE6a "h5diff_attr3.h5" -#define FILE7 "h5diff_dset1.h5" -#define FILE8 "h5diff_dset2.h5" -#define FILE8A "h5diff_dset3.h5" -#define FILE9 "h5diff_hyper1.h5" -#define FILE10 "h5diff_hyper2.h5" -#define FILE11 "h5diff_empty.h5" -#define FILE12 "h5diff_links.h5" -#define FILE13 "h5diff_softlinks.h5" -#define FILE14 "h5diff_linked_softlink.h5" -#define FILE15 "h5diff_extlink_src.h5" -#define FILE16 "h5diff_extlink_trg.h5" -#define FILE17 "h5diff_ext2softlink_src.h5" -#define FILE18 "h5diff_ext2softlink_trg.h5" -#define FILE19 "h5diff_dset_zero_dim_size1.h5" -#define FILE20 "h5diff_dset_zero_dim_size2.h5" -#define FILE21 "h5diff_dset_idx1.h5" -#define FILE22 "h5diff_dset_idx2.h5" -#define DANGLE_LINK_FILE1 "h5diff_danglelinks1.h5" -#define DANGLE_LINK_FILE2 "h5diff_danglelinks2.h5" -#define GRP_RECURSE_FILE1 "h5diff_grp_recurse1.h5" -#define GRP_RECURSE_FILE2 "h5diff_grp_recurse2.h5" +#define FILE1 "h5diff_basic1.h5" +#define FILE2 "h5diff_basic2.h5" +#define FILE3 "h5diff_types.h5" +#define FILE4 "h5diff_dtypes.h5" +#define FILE5 "h5diff_attr1.h5" +#define FILE6 "h5diff_attr2.h5" +#define FILE6a "h5diff_attr3.h5" +#define FILE7 "h5diff_dset1.h5" +#define FILE8 "h5diff_dset2.h5" +#define FILE8A "h5diff_dset3.h5" +#define FILE9 "h5diff_hyper1.h5" +#define FILE10 "h5diff_hyper2.h5" +#define FILE11 "h5diff_empty.h5" +#define FILE12 "h5diff_links.h5" +#define FILE13 "h5diff_softlinks.h5" +#define FILE14 "h5diff_linked_softlink.h5" +#define FILE15 "h5diff_extlink_src.h5" +#define FILE16 "h5diff_extlink_trg.h5" +#define FILE17 "h5diff_ext2softlink_src.h5" +#define FILE18 "h5diff_ext2softlink_trg.h5" +#define FILE19 "h5diff_dset_zero_dim_size1.h5" +#define FILE20 "h5diff_dset_zero_dim_size2.h5" +#define FILE21 "h5diff_dset_idx1.h5" +#define FILE22 "h5diff_dset_idx2.h5" +#define DANGLE_LINK_FILE1 "h5diff_danglelinks1.h5" +#define DANGLE_LINK_FILE2 "h5diff_danglelinks2.h5" +#define GRP_RECURSE_FILE1 "h5diff_grp_recurse1.h5" +#define GRP_RECURSE_FILE2 "h5diff_grp_recurse2.h5" /* same structure via external links through files */ -#define GRP_RECURSE1_EXT "h5diff_grp_recurse_ext1.h5" -#define GRP_RECURSE2_EXT1 "h5diff_grp_recurse_ext2-1.h5" -#define GRP_RECURSE2_EXT2 "h5diff_grp_recurse_ext2-2.h5" -#define GRP_RECURSE2_EXT3 "h5diff_grp_recurse_ext2-3.h5" +#define GRP_RECURSE1_EXT "h5diff_grp_recurse_ext1.h5" +#define GRP_RECURSE2_EXT1 "h5diff_grp_recurse_ext2-1.h5" +#define GRP_RECURSE2_EXT2 "h5diff_grp_recurse_ext2-2.h5" +#define GRP_RECURSE2_EXT3 "h5diff_grp_recurse_ext2-3.h5" /* same structure, same obj name with different value */ -#define EXCLUDE_FILE1_1 "h5diff_exclude1-1.h5" -#define EXCLUDE_FILE1_2 "h5diff_exclude1-2.h5" +#define EXCLUDE_FILE1_1 "h5diff_exclude1-1.h5" +#define EXCLUDE_FILE1_2 "h5diff_exclude1-2.h5" /* different structure and obj names */ -#define EXCLUDE_FILE2_1 "h5diff_exclude2-1.h5" -#define EXCLUDE_FILE2_2 "h5diff_exclude2-2.h5" +#define EXCLUDE_FILE2_1 "h5diff_exclude2-1.h5" +#define EXCLUDE_FILE2_2 "h5diff_exclude2-2.h5" /* only one file has unique objs */ -#define EXCLUDE_FILE3_1 "h5diff_exclude3-1.h5" -#define EXCLUDE_FILE3_2 "h5diff_exclude3-2.h5" +#define EXCLUDE_FILE3_1 "h5diff_exclude3-1.h5" +#define EXCLUDE_FILE3_2 "h5diff_exclude3-2.h5" /* compound type with multiple vlen string types */ -#define COMP_VL_STRS_FILE "h5diff_comp_vl_strs.h5" -/* attribute compre with verbose level */ +#define COMP_VL_STRS_FILE "h5diff_comp_vl_strs.h5" +/* attribute compare with verbose level */ #define ATTR_VERBOSE_LEVEL_FILE1 "h5diff_attr_v_level1.h5" #define ATTR_VERBOSE_LEVEL_FILE2 "h5diff_attr_v_level2.h5" /* file containing valid/invalid enum value mix */ #define ENUM_INVALID_VALUES "h5diff_enum_invalid_values.h5" /* file with container types (array,vlen) with multiple compounds */ -#define COMPS_COMPLEX1 "compounds_array_vlen1.h5" -#define COMPS_COMPLEX2 "compounds_array_vlen2.h5" +#define COMPS_COMPLEX1 "compounds_array_vlen1.h5" +#define COMPS_COMPLEX2 "compounds_array_vlen2.h5" /* non-comparable dataset and attribute */ #define NON_COMPARBLES1 "non_comparables1.h5" #define NON_COMPARBLES2 "non_comparables2.h5" /* string dataset and attribute */ -#define DIFF_STRINGS1 "diff_strings1.h5" -#define DIFF_STRINGS2 "diff_strings2.h5" +#define DIFF_STRINGS1 "h5diff_strings1.h5" +#define DIFF_STRINGS2 "h5diff_strings2.h5" +/* double dataset and epsilon */ +#define DIFF_EPS1 "h5diff_eps1.h5" +#define DIFF_EPS2 "h5diff_eps2.h5" #define UIMAX 4294967295u /*Maximum value for a variable of type unsigned int */ #define STR_SIZE 3 -#define GBLL ((unsigned long long) 1024 * 1024 *1024 ) +#define GBLL ((unsigned long long)1024 * 1024 * 1024) #define MY_LINKCLASS 187 @@ -109,79 +112,82 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024); #define SPACE1_DIM2 0 /* Error macros */ -#define AT() HDprintf("ERROR at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); -#define PROGRAM_ERROR {AT(); goto error;} +#define AT() HDprintf("ERROR at %s:%d in %s()...\n", __FILE__, __LINE__, __func__); +#define PROGRAM_ERROR \ + do { \ + AT(); \ + goto error; \ + } while (0) /* A UD link traversal function. Shouldn't actually be called. */ static hid_t -UD_traverse(H5_ATTR_UNUSED const char * link_name, H5_ATTR_UNUSED hid_t cur_group, - H5_ATTR_UNUSED const void * udata, H5_ATTR_UNUSED size_t udata_size, H5_ATTR_UNUSED hid_t lapl_id, - H5_ATTR_UNUSED hid_t dxpl_id) +UD_traverse(H5_ATTR_UNUSED const char *link_name, H5_ATTR_UNUSED hid_t cur_group, + H5_ATTR_UNUSED const void *udata, H5_ATTR_UNUSED size_t udata_size, H5_ATTR_UNUSED hid_t lapl_id, + H5_ATTR_UNUSED hid_t dxpl_id) { return -1; } const H5L_class_t UD_link_class[1] = {{ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)MY_LINKCLASS, /* Link type id number */ - "UD link class", /* name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_traverse, /* The actual traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ + (H5L_type_t)MY_LINKCLASS, /* Link type id number */ + "UD link class", /* name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_traverse, /* The actual traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ }}; - /*------------------------------------------------------------------------- * prototypes *------------------------------------------------------------------------- */ /* tests called in main() */ -static int test_basic(const char *fname1, const char *fname2, const char *fname3); -static int test_types(const char *fname); -static int test_datatypes(const char *fname); -static int test_attributes(const char *fname, int make_diffs); -static int test_datasets(const char *fname, int make_diffs); -static int test_special_datasets(const char *fname, int make_diffs); -static int test_hyperslab(const char *fname, int make_diffs); -static int test_link_name(const char *fname1); -static int test_soft_links(const char *fname1); -static int test_linked_softlinks(const char *fname1); -static int test_external_links(const char *fname1, const char *fname2); -static int test_ext2soft_links(const char *fname1, const char *fname2); -static int test_dangle_links(const char *fname1, const char *fname2); -static int test_group_recurse(const char *fname1, const char *fname2); -static int test_group_recurse2(void); -static int test_exclude_obj1(const char *fname1, const char *fname2); -static int test_exclude_obj2(const char *fname1, const char *fname2); -static int test_exclude_obj3(const char *fname1, const char *fname2); -static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new); -static int test_attributes_verbose_level(const char *fname1, const char *fname2); -static int test_enums(const char *fname); -static void test_comps_array(const char *fname, const char *dset, - const char *attr, int diff, int is_file_new); -static void test_comps_vlen(const char *fname, const char *dset, - const char *attr, int diff, int is_file_new); -static void test_comps_array_vlen(const char *fname, const char *dset, - const char *attr, int diff, int is_file_new); -static void test_comps_vlen_arry(const char *fname, const char *dset, - const char *attr, int diff, int is_file_new); +static int test_basic(const char *fname1, const char *fname2, const char *fname3); +static int test_types(const char *fname); +static int test_datatypes(const char *fname); +static int test_attributes(const char *fname, int make_diffs); +static int test_datasets(const char *fname, int make_diffs); +static int test_special_datasets(const char *fname, int make_diffs); +static int test_hyperslab(const char *fname, int make_diffs); +static int test_link_name(const char *fname1); +static int test_soft_links(const char *fname1); +static int test_linked_softlinks(const char *fname1); +static int test_external_links(const char *fname1, const char *fname2); +static int test_ext2soft_links(const char *fname1, const char *fname2); +static int test_dangle_links(const char *fname1, const char *fname2); +static int test_group_recurse(const char *fname1, const char *fname2); +static int test_group_recurse2(void); +static int test_exclude_obj1(const char *fname1, const char *fname2); +static int test_exclude_obj2(const char *fname1, const char *fname2); +static int test_exclude_obj3(const char *fname1, const char *fname2); +static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new); +static int test_attributes_verbose_level(const char *fname1, const char *fname2); +static int test_enums(const char *fname); +static void test_comps_array(const char *fname, const char *dset, const char *attr, int diff, + int is_file_new); +static void test_comps_vlen(const char *fname, const char *dset, const char *attr, int diff, int is_file_new); +static void test_comps_array_vlen(const char *fname, const char *dset, const char *attr, int diff, + int is_file_new); +static void test_comps_vlen_arry(const char *fname, const char *dset, const char *attr, int diff, + int is_file_new); static void test_data_nocomparables(const char *fname, int diff); static void test_objs_nocomparables(const char *fname1, const char *fname2); static void test_objs_strings(const char *fname, const char *fname2); +static void test_double_epsilon(const char *fname1, const char *fname2); /* called by test_attributes() and test_datasets() */ -static void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs); -static void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs); -static void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs); +static void write_attr_strings(hid_t loc_id, const char *dset_name, hid_t fid, int make_diffs); +static void write_attr_in(hid_t loc_id, const char *dset_name, hid_t fid, int make_diffs); +static void write_dset_in(hid_t loc_id, const char *dset_name, hid_t fid, int make_diffs); static void gen_datareg(hid_t fid, int make_diffs); /* utilities */ -static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); +static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); static herr_t write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); -static int gen_dataset_idx(const char *file, int format); +static int gen_dataset_idx(const char *file, int format); /*------------------------------------------------------------------------- * Function: main @@ -191,7 +197,8 @@ static int gen_dataset_idx(const char *file, int format); *------------------------------------------------------------------------- */ -int main(void) +int +main(void) { test_basic(FILE1, FILE2, FILE11); @@ -231,11 +238,11 @@ int main(void) test_special_datasets(FILE20, 1); /* - * Generate 2 files: FILE21 with old format; FILE22 with new format - * Create 2 datasets in each file: - * One dataset: chunked layout, w/o filters, fixed dimension - * One dataset: chunked layout, w/ filters, fixed dimension - */ + * Generate 2 files: FILE21 with old format; FILE22 with new format + * Create 2 datasets in each file: + * One dataset: chunked layout, w/o filters, fixed dimension + * One dataset: chunked layout, w/ filters, fixed dimension + */ gen_dataset_idx(FILE21, 0); gen_dataset_idx(FILE22, 1); @@ -253,16 +260,16 @@ int main(void) test_comp_vlen_strings(COMP_VL_STRS_FILE, "group_copy", 0); /* diff when invalid enum values are present. - * This will probably grow to involve more extensive testing of - * enums so it has been given its own test file and test (apart - * from the basic type testing). - */ + * This will probably grow to involve more extensive testing of + * enums so it has been given its own test file and test (apart + * from the basic type testing). + */ test_enums(ENUM_INVALID_VALUES); /* ------------------------------------------------- - * Create test files with dataset and attribute with container types - * (array, vlen) with multiple nested compound types. - */ + * Create test files with dataset and attribute with container types + * (array, vlen) with multiple nested compound types. + */ /* file1 */ test_comps_array(COMPS_COMPLEX1, "dset1", "attr1", 0, 1); test_comps_vlen(COMPS_COMPLEX1, "dset2", "attr2", 0, 0); @@ -275,10 +282,10 @@ int main(void) test_comps_vlen_arry(COMPS_COMPLEX2, "dset4", "attr4", 5, 0); /*------------------------------------------------- - * Create test files with non-comparable dataset and attributes with - * comparable datasets and attributes. All the comparables should display - * differences. - */ + * Create test files with non-comparable dataset and attributes with + * comparable datasets and attributes. All the comparables should display + * differences. + */ test_data_nocomparables(NON_COMPARBLES1, 0); test_data_nocomparables(NON_COMPARBLES2, 5); @@ -288,6 +295,9 @@ int main(void) /* string dataset and attribute. HDFFV-10028 */ test_objs_strings(DIFF_STRINGS1, DIFF_STRINGS2); + /* double dataset and epsilion. HDFFV-10897 */ + test_double_epsilon(DIFF_EPS1, DIFF_EPS2); + return EXIT_SUCCESS; } @@ -300,13 +310,13 @@ int main(void) *------------------------------------------------------------------------- */ -static -int test_basic(const char *fname1, const char *fname2, const char *fname3) +static int +test_basic(const char *fname1, const char *fname2, const char *fname3) { - hid_t fid1 = -1, fid2 = -1; - hid_t gid1 = -1, gid2 = -1, gid3 = -1; - hsize_t dims1[1] = { 6 }; - hsize_t dims2[2] = { 3, 2 }; + hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID, gid2 = H5I_INVALID_HID, gid3 = H5I_INVALID_HID; + hsize_t dims1[1] = {6}; + hsize_t dims2[2] = {3, 2}; /* create the empty file */ if ((fid1 = H5Fcreate(fname3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { @@ -319,9 +329,9 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) } /*------------------------------------------------------------------------- - * create two files - *------------------------------------------------------------------------- - */ + * create two files + *------------------------------------------------------------------------- + */ if ((fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; @@ -329,190 +339,170 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) goto out; /*------------------------------------------------------------------------- - * create groups - *------------------------------------------------------------------------- - */ + * create groups + *------------------------------------------------------------------------- + */ gid1 = H5Gcreate2(fid1, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); gid2 = H5Gcreate2(fid2, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); gid3 = H5Gcreate2(fid2, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /*------------------------------------------------------------------------- - * tests: - * # 1.1 normal mode - * # 1.2 normal mode with objects - * # 1.3 report mode - * # 1.4 report mode with objects - * # 1.5 with -d - *------------------------------------------------------------------------- - */ + * tests: + * # 1.1 normal mode + * # 1.2 normal mode with objects + * # 1.3 report mode + * # 1.4 report mode with objects + * # 1.5 with -d + *------------------------------------------------------------------------- + */ { - double data1[3][2] = - { { 1.0F, 1.0F }, { 1.00F, 1.000F }, { 0.0F, 0.0F } }; - double data2[3][2] = - { { 0.0F, 1.1F }, { 1.01F, 1.001F }, { 0.0F, 1.0F } }; - double data3[3][2] = { { 100.0F, 100.0F }, { 100.00F, 100.000F }, { - 100.0F, 100.0F } }; - double data4[3][2] = { { 105.0F, 120.0F }, { 160.00F, 95.000F }, { - 80.0F, 40.0F } }; + double data1[3][2] = {{1.0, 1.0}, {1.00, 1.000}, {0.0, 0.0}}; + double data2[3][2] = {{0.0, 1.1}, {1.01, 1.001}, {0.0, 1.0}}; + double data3[3][2] = {{100.0, 100.0}, {100.00, 100.000}, {100.0, 100.0}}; + double data4[3][2] = {{105.0, 120.0}, {160.00, 95.000}, {80.0, 40.0}}; write_dset(gid1, 2, dims2, "dset1", H5T_NATIVE_DOUBLE, data1); write_dset(gid2, 2, dims2, "dset2", H5T_NATIVE_DOUBLE, data2); write_dset(gid1, 2, dims2, "dset3", H5T_NATIVE_DOUBLE, data3); write_dset(gid2, 2, dims2, "dset4", H5T_NATIVE_DOUBLE, data4); write_dset(gid2, 2, dims2, "dset1", H5T_NATIVE_DOUBLE, data2); - } /*------------------------------------------------------------------------- - * relative error, compare divide by zero, both zero - * # 1.6.1 with -p (int) - *------------------------------------------------------------------------- - */ + * relative error, compare divide by zero, both zero + * # 1.6.1 with -p (int) + *------------------------------------------------------------------------- + */ { - int data5[3][2] = { { 100, 100 }, { 100, 0 }, { 0, 100 } }; - int data6[3][2] = { { 120, 80 }, { 0, 100 }, { 0, 50 } }; + int data5[3][2] = {{100, 100}, {100, 0}, {0, 100}}; + int data6[3][2] = {{120, 80}, {0, 100}, {0, 50}}; write_dset(gid1, 2, dims2, "dset5", H5T_NATIVE_INT, data5); write_dset(gid1, 2, dims2, "dset6", H5T_NATIVE_INT, data6); - } /*------------------------------------------------------------------------- - * relative error, compare divide by zero, both zero - * # 1.6.2 with -p (unsigned long long) - *------------------------------------------------------------------------- - */ + * relative error, compare divide by zero, both zero + * # 1.6.2 with -p (unsigned long long) + *------------------------------------------------------------------------- + */ { - unsigned long long data7[3][2] = - { { 100, 100 }, { 100, 0 }, { 0, 100 } }; - unsigned long long data8[3][2] = { { 120, 80 }, { 0, 100 }, { 0, 50 } }; + unsigned long long data7[3][2] = {{100, 100}, {100, 0}, {0, 100}}; + unsigned long long data8[3][2] = {{120, 80}, {0, 100}, {0, 50}}; write_dset(gid1, 2, dims2, "dset7", H5T_NATIVE_ULLONG, data7); write_dset(gid1, 2, dims2, "dset8", H5T_NATIVE_ULLONG, data8); - } /*------------------------------------------------------------------------- - * relative error, compare divide by zero, both zero - * # 1.6.3 with -p (double) - * - * A B 1-B/A % - * 100 120 0.2 20 - * 100 80 0.2 20 - * 100 0 1 100 - * 0 100 #DIV/0! #DIV/0! - * 0 0 #DIV/0! #DIV/0! - * 100 50 0.5 50 - *------------------------------------------------------------------------- - */ + * relative error, compare divide by zero, both zero + * # 1.6.3 with -p (double) + * + * A B 1-B/A % + * 100 120 0.2 20 + * 100 80 0.2 20 + * 100 0 1 100 + * 0 100 #DIV/0! #DIV/0! + * 0 0 #DIV/0! #DIV/0! + * 100 50 0.5 50 + *------------------------------------------------------------------------- + */ { - double data9[3][2] = { { 100.0F, 100.0F }, { 100.0F, 0.0F }, { 0.0F, - 100.0F } }; - double data10[3][2] = { { 120.0F, 80.0F }, { 0.0F, 100.0F }, { 0.0F, - 50.0F } }; + double data9[3][2] = {{100.0, 100.0}, {100.0, 0.0}, {0.0, 100.0}}; + double data10[3][2] = {{120.0, 80.0}, {0.0, 100.0}, {0.0, 50.0}}; write_dset(gid1, 2, dims2, "dset9", H5T_NATIVE_DOUBLE, data9); write_dset(gid1, 2, dims2, "dset10", H5T_NATIVE_DOUBLE, data10); - } /*------------------------------------------------------------------------- - * test floating point comparison - *------------------------------------------------------------------------- - */ + * test floating point comparison + *------------------------------------------------------------------------- + */ { /* epsilon = 0.0000001 = 1e-7 - * system epsilon for float : FLT_EPSILON = 1.19209E-07 - */ - float data11[3][2] = { { 0.000000f, 0.0000001f }, { 0.0000001f, - 0.00000022f }, { 0.0000001f, 0.0000001f } }; - float data12[3][2] = { { 0.000000f, 0.0000002f }, { 0.0000003f, - 0.0000001f }, { 0.000000f, 0.0000001f } }; + * system epsilon for float : FLT_EPSILON = 1.19209E-07 + */ + float data11[3][2] = {{0.000000f, 0.0000001f}, {0.0000001f, 0.00000022f}, {0.0000001f, 0.0000001f}}; + float data12[3][2] = {{0.000000f, 0.0000002f}, {0.0000003f, 0.0000001f}, {0.000000f, 0.0000001f}}; /* epsilon = 0.0000000000000001 = 1e-16 - * system epsilon for double : DBL_EPSILON = 2.22045E-16 - */ - double data13[3][2] = { { H5_DOUBLE(0.0000000000000000), H5_DOUBLE( - 0.0000000000000001) }, { H5_DOUBLE(0.0000000000000001), - H5_DOUBLE(0.0000000000000000) }, { H5_DOUBLE( - 0.00000000000000033), H5_DOUBLE(0.0000000000000001) } }; - double data14[3][2] = { { H5_DOUBLE(0.0000000000000000), H5_DOUBLE( - 0.0000000000000004) }, { H5_DOUBLE(0.0000000000000002), - H5_DOUBLE(0.0000000000000001) }, { H5_DOUBLE( - 0.0000000000000001), H5_DOUBLE(0.00000000000000000) } }; + * system epsilon for double : DBL_EPSILON = 2.22045E-16 + */ + double data13[3][2] = {{0.0000000000000000, 0.0000000000000001}, + {0.0000000000000001, 0.0000000000000000}, + {0.00000000000000033, 0.0000000000000001}}; + double data14[3][2] = {{0.0000000000000000, 0.0000000000000004}, + {0.0000000000000002, 0.0000000000000001}, + {0.0000000000000001, 0.00000000000000000}}; write_dset(gid1, 2, dims2, "fp1", H5T_NATIVE_FLOAT, data11); write_dset(gid1, 2, dims2, "fp2", H5T_NATIVE_FLOAT, data12); write_dset(gid1, 2, dims2, "d1", H5T_NATIVE_DOUBLE, data13); write_dset(gid1, 2, dims2, "d2", H5T_NATIVE_DOUBLE, data14); - } -#if H5_SIZEOF_LONG_DOUBLE !=0 { /*------------------------------------------------------------------------- - * H5T_NATIVE_LDOUBLE - *------------------------------------------------------------------------- - */ - - long double data15[3][2] = { {1.0L,1.0L}, {1.0L,1.0L}, {1.0L,1.0L}}; + * H5T_NATIVE_LDOUBLE + *------------------------------------------------------------------------- + */ - write_dset(gid1,2,dims2,"ld",H5T_NATIVE_LDOUBLE,data15); + long double data15[3][2] = {{1.0L, 1.0L}, {1.0L, 1.0L}, {1.0L, 1.0L}}; + write_dset(gid1, 2, dims2, "ld", H5T_NATIVE_LDOUBLE, data15); } -#endif /*------------------------------------------------------------------------- - * NaNs in H5T_NATIVE_FLOAT - *------------------------------------------------------------------------- - */ + * NaNs in H5T_NATIVE_FLOAT + *------------------------------------------------------------------------- + */ { float data15[6]; float data16[6]; - data15[0] = (float) HDsqrt(-1.0F); - data15[1] = 1.0F; - data15[2] = (float) HDsqrt(-1.0F); - data15[3] = 1.0F; - data15[4] = 1.0F; - data15[5] = 1.0F; + data15[0] = (float)HDsqrt(-1.0); + data15[1] = 1.0; + data15[2] = (float)HDsqrt(-1.0); + data15[3] = 1.0; + data15[4] = 1.0; + data15[5] = 1.0; - data16[0] = (float) HDsqrt(-1.0F); - data16[1] = (float) HDsqrt(-1.0F); - data16[2] = 1.0F; - data16[3] = 1.0F; - data16[4] = 1.0F; - data16[5] = 1.0F; + data16[0] = (float)HDsqrt(-1.0); + data16[1] = (float)HDsqrt(-1.0); + data16[2] = 1.0; + data16[3] = 1.0; + data16[4] = 1.0; + data16[5] = 1.0; write_dset(gid1, 1, dims1, "fp15", H5T_NATIVE_FLOAT, data15); write_dset(gid1, 1, dims1, "fp16", H5T_NATIVE_FLOAT, data16); - } /*------------------------------------------------------------------------- - * NaNs in H5T_NATIVE_DOUBLE - *------------------------------------------------------------------------- - */ + * NaNs in H5T_NATIVE_DOUBLE + *------------------------------------------------------------------------- + */ { double data17[6]; double data18[6]; - data17[0] = HDsqrt(-1.0F); - data17[1] = 1.0F; - data17[2] = HDsqrt(-1.0F); - data17[3] = 1.0F; - data17[4] = 1.0F; - data17[5] = 1.0F; + data17[0] = HDsqrt(-1.0); + data17[1] = 1.0; + data17[2] = HDsqrt(-1.0); + data17[3] = 1.0; + data17[4] = 1.0; + data17[5] = 1.0; - data18[0] = HDsqrt(-1.0F); - data18[1] = HDsqrt(-10000.0F); - data18[2] = 1.0F; - data18[3] = 1.0F; - data18[4] = 1.0F; - data18[5] = 1.0F; + data18[0] = HDsqrt(-1.0); + data18[1] = HDsqrt(-10000.0); + data18[2] = 1.0; + data18[3] = 1.0; + data18[4] = 1.0; + data18[5] = 1.0; write_dset(gid1, 1, dims1, "fp17", H5T_NATIVE_DOUBLE, data17); write_dset(gid1, 1, dims1, "fp18", H5T_NATIVE_DOUBLE, data18); @@ -520,18 +510,18 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) } /*------------------------------------------------------------------------ - * INFINITY values - *------------------------------------------------------------------------ - */ + * INFINITY values + *------------------------------------------------------------------------ + */ { - float data19[6]; + float data19[6]; double data20[6]; - data19[0] = data19[1] = data19[2] = (float) HDlog(0.0F); - data19[3] = data19[4] = data19[5] = (float) -HDlog(0.0F); + data19[0] = data19[1] = data19[2] = (float)HDlog(0.0); + data19[3] = data19[4] = data19[5] = (float)-HDlog(0.0); - data20[0] = data20[1] = data20[2] = HDlog(0.0F); - data20[3] = data20[4] = data20[5] = -HDlog(0.0F); + data20[0] = data20[1] = data20[2] = HDlog(0.0); + data20[3] = data20[4] = data20[5] = -HDlog(0.0); write_dset(gid1, 1, dims1, "fp19", H5T_NATIVE_FLOAT, data19); write_dset(gid1, 1, dims1, "fp19_COPY", H5T_NATIVE_FLOAT, data19); @@ -540,39 +530,38 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) } /*------------------------------------------------------------------------- - * NaNs in H5T_NATIVE_DOUBLE and H5T_NATIVE_FLOAT inside H5T_COMPOUND - *------------------------------------------------------------------------- - */ + * NaNs in H5T_NATIVE_DOUBLE and H5T_NATIVE_FLOAT inside H5T_COMPOUND + *------------------------------------------------------------------------- + */ { typedef struct cmp1_t { double d; - float f; + float f; } cmp1_t; - cmp1_t buf1[2]; - cmp1_t buf2[2]; - hsize_t dims[1] = { 2 }; - size_t type_size; - hid_t tid; + cmp1_t buf1[2]; + cmp1_t buf2[2]; + hsize_t dims[1] = {2}; + size_t type_size; + hid_t tid; - buf1[0].d = HDsqrt(-1.0F); - buf1[0].f = (float) HDsqrt(-1.0F); - buf2[0].d = HDsqrt(-1.0F); - buf2[0].f = (float) HDsqrt(-1.0F); + buf1[0].d = HDsqrt(-1.0); + buf1[0].f = (float)HDsqrt(-1.0); + buf2[0].d = HDsqrt(-1.0); + buf2[0].f = (float)HDsqrt(-1.0); - buf1[1].d = HDsqrt(-1.0F); - buf1[1].f = (float) HDsqrt(-1.0F); - buf2[1].d = 0.0F; - buf2[1].f = 0.0F; + buf1[1].d = HDsqrt(-1.0); + buf1[1].f = (float)HDsqrt(-1.0); + buf2[1].d = 0.0; + buf2[1].f = 0.0; type_size = sizeof(cmp1_t); - tid = H5Tcreate(H5T_COMPOUND, type_size); + tid = H5Tcreate(H5T_COMPOUND, type_size); H5Tinsert(tid, "d", HOFFSET(cmp1_t, d), H5T_NATIVE_DOUBLE); H5Tinsert(tid, "f", HOFFSET(cmp1_t, f), H5T_NATIVE_FLOAT); write_dset(gid1, 1, dims, "dset11", tid, buf1); write_dset(gid1, 1, dims, "dset12", tid, buf2); H5Tclose(tid); - } /* not comparable objects */ @@ -580,11 +569,11 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) typedef struct cmp1_t { double d; - int i; + int i; } cmp1_t; typedef struct cmp2_t { - int i; + int i; double d; } cmp2_t; @@ -592,17 +581,17 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) int i; } cmp3_t; - double data2[6] = { 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }; - int data3[6] = { 0, 0, 0, 0, 0, 0 }; - int data4[3][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 } }; - int data5[2][2] = { { 0, 0 }, { 0, 0 } }; - unsigned int data6[3][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 } }; - cmp1_t data7[1] = { { 1.0f, 2 } }; - cmp2_t data8[1] = { { 1, 2.0f } }; - hsize_t dims3[2] = { 2, 2 }; - hsize_t dims4[1] = { 1 }; - size_t type_size; - hid_t tid; + double data2[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; + int data3[6] = {0, 0, 0, 0, 0, 0}; + int data4[3][2] = {{0, 0}, {0, 0}, {0, 0}}; + int data5[2][2] = {{0, 0}, {0, 0}}; + unsigned int data6[3][2] = {{0, 0}, {0, 0}, {0, 0}}; + cmp1_t data7[1] = {{1.0, 2}}; + cmp2_t data8[1] = {{1, 2.0}}; + hsize_t dims3[2] = {2, 2}; + hsize_t dims4[1] = {1}; + size_t type_size; + hid_t tid; write_dset(gid3, 1, dims1, "dset1", H5T_NATIVE_DOUBLE, NULL); write_dset(gid3, 1, dims1, "dset2", H5T_NATIVE_DOUBLE, data2); @@ -613,14 +602,14 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) /* case of compound with different type members */ type_size = sizeof(cmp1_t); - tid = H5Tcreate(H5T_COMPOUND, type_size); + tid = H5Tcreate(H5T_COMPOUND, type_size); H5Tinsert(tid, "d", HOFFSET(cmp1_t, d), H5T_NATIVE_DOUBLE); H5Tinsert(tid, "i", HOFFSET(cmp1_t, i), H5T_NATIVE_INT); write_dset(gid3, 1, dims4, "dset7", tid, data7); H5Tclose(tid); type_size = sizeof(cmp2_t); - tid = H5Tcreate(H5T_COMPOUND, type_size); + tid = H5Tcreate(H5T_COMPOUND, type_size); H5Tinsert(tid, "i", HOFFSET(cmp2_t, i), H5T_NATIVE_INT); H5Tinsert(tid, "d", HOFFSET(cmp2_t, d), H5T_NATIVE_DOUBLE); write_dset(gid3, 1, dims4, "dset8", tid, data8); @@ -628,17 +617,16 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) /* case of compound with different number of members */ type_size = sizeof(cmp3_t); - tid = H5Tcreate(H5T_COMPOUND, type_size); + tid = H5Tcreate(H5T_COMPOUND, type_size); H5Tinsert(tid, "i", HOFFSET(cmp2_t, i), H5T_NATIVE_INT); write_dset(gid3, 1, dims4, "dset9", tid, NULL); H5Tclose(tid); - } /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ + * close + *------------------------------------------------------------------------- + */ H5Gclose(gid1); H5Gclose(gid2); H5Gclose(gid3); @@ -659,18 +647,18 @@ out: * *------------------------------------------------------------------------- */ -static -int test_types(const char *fname) +static int +test_types(const char *fname) { - hid_t fid1 = -1; - hid_t gid1 = -1; - hid_t gid2 = -1; - hid_t tid1 = -1; - hid_t tid2 = -1; - herr_t status; - hsize_t dims[1] = { 1 }; + hid_t fid1 = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID; + hid_t gid2 = H5I_INVALID_HID; + hid_t tid1 = H5I_INVALID_HID; + hid_t tid2 = H5I_INVALID_HID; + herr_t status; + hsize_t dims[1] = {1}; typedef struct s1_t { - int a; + int a; float b; } s1_t; typedef struct s2_t { @@ -678,30 +666,30 @@ int test_types(const char *fname) } s2_t; /*------------------------------------------------------------------------- - * Create one file - *------------------------------------------------------------------------- - */ + * Create one file + *------------------------------------------------------------------------- + */ fid1 = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /*------------------------------------------------------------------------- - * H5G_DATASET - *------------------------------------------------------------------------- - */ + * H5G_DATASET + *------------------------------------------------------------------------- + */ write_dset(fid1, 1, dims, "dset", H5T_NATIVE_INT, 0); /*------------------------------------------------------------------------- - * H5G_GROUP - *------------------------------------------------------------------------- - */ - gid1 = H5Gcreate2(fid1, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * H5G_GROUP + *------------------------------------------------------------------------- + */ + gid1 = H5Gcreate2(fid1, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Gclose(gid1); - gid2 = H5Gcreate2(fid1, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + gid2 = H5Gcreate2(fid1, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Gclose(gid2); /*------------------------------------------------------------------------- - * H5G_TYPE - *------------------------------------------------------------------------- - */ + * H5G_TYPE + *------------------------------------------------------------------------- + */ /* create and commit datatype 1 */ tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t)); @@ -716,25 +704,25 @@ int test_types(const char *fname) H5Tclose(tid2); /*------------------------------------------------------------------------- - * H5G_LINK - *------------------------------------------------------------------------- - */ + * H5G_LINK + *------------------------------------------------------------------------- + */ status = H5Lcreate_soft("g1", fid1, "l1", H5P_DEFAULT, H5P_DEFAULT); status = H5Lcreate_soft("g2", fid1, "l2", H5P_DEFAULT, H5P_DEFAULT); /*------------------------------------------------------------------------- - * H5G_UDLINK - *------------------------------------------------------------------------- - */ + * H5G_UDLINK + *------------------------------------------------------------------------- + */ H5Lcreate_external("filename", "objname", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT); H5Lregister(UD_link_class); - H5Lcreate_ud(fid1, "ud_link", (H5L_type_t) MY_LINKCLASS, NULL, (size_t) 0, H5P_DEFAULT, H5P_DEFAULT); + H5Lcreate_ud(fid1, "ud_link", (H5L_type_t)MY_LINKCLASS, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT); /*------------------------------------------------------------------------- - * Close - *------------------------------------------------------------------------- - */ + * Close + *------------------------------------------------------------------------- + */ status = H5Fclose(fid1); return status; } @@ -784,138 +772,138 @@ int test_types(const char *fname) * *------------------------------------------------------------------------- */ -static -int test_datatypes(const char *fname) +static int +test_datatypes(const char *fname) { - hid_t fid1 = -1; - hid_t dset = -1; - hsize_t dims[2] = { 3, 2 }; - herr_t status; - char buf1a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } }; - char buf1b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } }; - short buf2a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } }; - short buf2b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } }; - int buf3a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } }; - int buf3b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } }; - long buf4a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } }; - long buf4b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } }; - float buf5a[3][2] = { { 1.0F, 1.0F }, { 1.0F, 1.0F }, { 1.0F, 1.0F } }; - float buf5b[3][2] = { { 1.0F, 1.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } }; - double buf6a[3][2] = { { 1.0F, 1.0F }, { 1.0F, 1.0F }, { 1.0F, 1.0F } }; - double buf6b[3][2] = { { 1.0F, 1.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } }; + hid_t fid1 = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; + hsize_t dims[2] = {3, 2}; + herr_t status; + char buf1a[3][2] = {{1, 1}, {1, 1}, {1, 1}}; + char buf1b[3][2] = {{1, 1}, {3, 4}, {5, 6}}; + short buf2a[3][2] = {{1, 1}, {1, 1}, {1, 1}}; + short buf2b[3][2] = {{1, 1}, {3, 4}, {5, 6}}; + int buf3a[3][2] = {{1, 1}, {1, 1}, {1, 1}}; + int buf3b[3][2] = {{1, 1}, {3, 4}, {5, 6}}; + long buf4a[3][2] = {{1, 1}, {1, 1}, {1, 1}}; + long buf4b[3][2] = {{1, 1}, {3, 4}, {5, 6}}; + float buf5a[3][2] = {{1.0, 1.0}, {1.0, 1.0}, {1.0, 1.0}}; + float buf5b[3][2] = {{1.0, 1.0}, {3.0, 4.0}, {5.0, 6.0}}; + double buf6a[3][2] = {{1.0, 1.0}, {1.0, 1.0}, {1.0, 1.0}}; + double buf6b[3][2] = {{1.0, 1.0}, {3.0, 4.0}, {5.0, 6.0}}; /*unsigned/signed test signed char -128 to 127 unsigned char 0 to 255 */ - char buf7a[3][2] = { { -1, -128 }, { -1, -1 }, { -1, -1 } }; - unsigned char buf7b[3][2] = { { 1, 128 }, { 1, 1 }, { 1, 1 } }; + char buf7a[3][2] = {{-1, -128}, {-1, -1}, {-1, -1}}; + unsigned char buf7b[3][2] = {{1, 128}, {1, 1}, {1, 1}}; /* long long test */ - long long buf8a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } }; - long long buf8b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } }; - unsigned long long buf9a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } }; - unsigned long long buf9b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } }; + long long buf8a[3][2] = {{1, 1}, {1, 1}, {1, 1}}; + long long buf8b[3][2] = {{1, 1}, {3, 4}, {5, 6}}; + unsigned long long buf9a[3][2] = {{1, 1}, {1, 1}, {1, 1}}; + unsigned long long buf9b[3][2] = {{1, 1}, {3, 4}, {5, 6}}; - unsigned int buf10a[3][2] = { { UIMAX, 1 }, { 1, 1 }, { 1, 1 } }; - unsigned int buf10b[3][2] = { { UIMAX - 1, 1 }, { 3, 4 }, { 5, 6 } }; + unsigned int buf10a[3][2] = {{UIMAX, 1}, {1, 1}, {1, 1}}; + unsigned int buf10b[3][2] = {{UIMAX - 1, 1}, {3, 4}, {5, 6}}; - unsigned short buf11a[3][2] = { { 204, 205 }, { 2, 3 }, { 1, 1 } }; - unsigned int buf11b[3][2] = { { 204, 205 }, { 2, 3 }, { 1, 1 } }; + unsigned short buf11a[3][2] = {{204, 205}, {2, 3}, {1, 1}}; + unsigned int buf11b[3][2] = {{204, 205}, {2, 3}, {1, 1}}; /*------------------------------------------------------------------------- - * Create a file - *------------------------------------------------------------------------- - */ + * Create a file + *------------------------------------------------------------------------- + */ fid1 = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /*------------------------------------------------------------------------- - * Check for different storage order. Give a warning if they are different - *------------------------------------------------------------------------- - */ + * Check for different storage order. Give a warning if they are different + *------------------------------------------------------------------------- + */ write_dset(fid1, 2, dims, "dset0a", H5T_STD_I16LE, buf2a); write_dset(fid1, 2, dims, "dset0b", H5T_STD_I32LE, buf3b); /*------------------------------------------------------------------------- - * H5T_NATIVE_CHAR - *------------------------------------------------------------------------- - */ + * H5T_NATIVE_CHAR + *------------------------------------------------------------------------- + */ write_dset(fid1, 2, dims, "dset1a", H5T_NATIVE_CHAR, buf1a); write_dset(fid1, 2, dims, "dset1b", H5T_NATIVE_CHAR, buf1b); /*------------------------------------------------------------------------- - * H5T_NATIVE_SHORT - *------------------------------------------------------------------------- - */ + * H5T_NATIVE_SHORT + *------------------------------------------------------------------------- + */ write_dset(fid1, 2, dims, "dset2a", H5T_NATIVE_SHORT, buf2a); write_dset(fid1, 2, dims, "dset2b", H5T_NATIVE_SHORT, buf2b); /*------------------------------------------------------------------------- - * H5T_NATIVE_INT - *------------------------------------------------------------------------- - */ + * H5T_NATIVE_INT + *------------------------------------------------------------------------- + */ write_dset(fid1, 2, dims, "dset3a", H5T_NATIVE_INT, buf3a); write_dset(fid1, 2, dims, "dset3b", H5T_NATIVE_INT, buf3b); /*------------------------------------------------------------------------- - * H5T_NATIVE_LONG - *------------------------------------------------------------------------- - */ + * H5T_NATIVE_LONG + *------------------------------------------------------------------------- + */ write_dset(fid1, 2, dims, "dset4a", H5T_NATIVE_LONG, buf4a); write_dset(fid1, 2, dims, "dset4b", H5T_NATIVE_LONG, buf4b); /*------------------------------------------------------------------------- - * H5T_NATIVE_FLOAT - *------------------------------------------------------------------------- - */ + * H5T_NATIVE_FLOAT + *------------------------------------------------------------------------- + */ write_dset(fid1, 2, dims, "dset5a", H5T_NATIVE_FLOAT, buf5a); write_dset(fid1, 2, dims, "dset5b", H5T_NATIVE_FLOAT, buf5b); /*------------------------------------------------------------------------- - * H5T_NATIVE_DOUBLE - *------------------------------------------------------------------------- - */ + * H5T_NATIVE_DOUBLE + *------------------------------------------------------------------------- + */ write_dset(fid1, 2, dims, "dset6a", H5T_NATIVE_DOUBLE, buf6a); write_dset(fid1, 2, dims, "dset6b", H5T_NATIVE_DOUBLE, buf6b); /*------------------------------------------------------------------------- - * H5T_NATIVE_CHAR and H5T_NATIVE_UCHAR - *------------------------------------------------------------------------- - */ + * H5T_NATIVE_CHAR and H5T_NATIVE_UCHAR + *------------------------------------------------------------------------- + */ write_dset(fid1, 2, dims, "dset7a", H5T_NATIVE_CHAR, buf7a); write_dset(fid1, 2, dims, "dset7b", H5T_NATIVE_UCHAR, buf7b); /*------------------------------------------------------------------------- - * H5T_NATIVE_LLONG - *------------------------------------------------------------------------- - */ + * H5T_NATIVE_LLONG + *------------------------------------------------------------------------- + */ write_dset(fid1, 2, dims, "dset8a", H5T_NATIVE_LLONG, buf8a); write_dset(fid1, 2, dims, "dset8b", H5T_NATIVE_LLONG, buf8b); /*------------------------------------------------------------------------- - * H5T_NATIVE_ULLONG - *------------------------------------------------------------------------- - */ + * H5T_NATIVE_ULLONG + *------------------------------------------------------------------------- + */ write_dset(fid1, 2, dims, "dset9a", H5T_NATIVE_ULLONG, buf9a); write_dset(fid1, 2, dims, "dset9b", H5T_NATIVE_ULLONG, buf9b); /*------------------------------------------------------------------------- - * H5T_NATIVE_INT - *------------------------------------------------------------------------- - */ + * H5T_NATIVE_INT + *------------------------------------------------------------------------- + */ write_dset(fid1, 2, dims, "dset10a", H5T_NATIVE_UINT, buf10a); write_dset(fid1, 2, dims, "dset10b", H5T_NATIVE_UINT, buf10b); /*------------------------------------------------------------------------- - * Same type class, different size - *------------------------------------------------------------------------- - */ + * Same type class, different size + *------------------------------------------------------------------------- + */ write_dset(fid1, 2, dims, "dset11a", H5T_STD_U16LE, buf11a); dset = H5Dopen2(fid1, "dset11a", H5P_DEFAULT); write_attr(dset, 2, dims, "attr", H5T_STD_U16LE, buf11a); @@ -927,9 +915,9 @@ int test_datatypes(const char *fname) H5Dclose(dset); /*------------------------------------------------------------------------- - * Close - *------------------------------------------------------------------------- - */ + * Close + *------------------------------------------------------------------------- + */ status = H5Fclose(fid1); return status; } @@ -974,44 +962,44 @@ int test_datatypes(const char *fname) * *------------------------------------------------------------------------- */ -static -int test_attributes(const char *file, int make_diffs /* flag to modify data buffers */) +static int +test_attributes(const char *file, int make_diffs /* flag to modify data buffers */) { - hid_t fid = -1; - hid_t did = -1; - hid_t gid = -1; - hid_t root_id = -1; - hid_t sid = -1; - hsize_t dims[1] = { 2 }; - herr_t status; + hid_t fid = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t root_id = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hsize_t dims[1] = {2}; + herr_t status; /* Create a file */ if ((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; /* Create a 1D dataset */ - sid = H5Screate_simple(1, dims, NULL); - did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + sid = H5Screate_simple(1, dims, NULL); + did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Sclose(sid); assert(status >= 0); /* Create groups */ - gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); root_id = H5Gopen2(fid, "/", H5P_DEFAULT); /*------------------------------------------------------------------------- - * write a series of attributes on the dataset, group, and root group - *------------------------------------------------------------------------- - */ + * write a series of attributes on the dataset, group, and root group + *------------------------------------------------------------------------- + */ if (make_diffs > 1) { write_attr_strings(did, "dset", fid, make_diffs); - write_attr_strings(gid, NULL, (hid_t) 0, make_diffs); - write_attr_strings(root_id, NULL, (hid_t) 0, make_diffs); + write_attr_strings(gid, NULL, (hid_t)0, make_diffs); + write_attr_strings(root_id, NULL, (hid_t)0, make_diffs); } else { write_attr_in(did, "dset", fid, make_diffs); - write_attr_in(gid, NULL, (hid_t) 0, make_diffs); - write_attr_in(root_id, NULL, (hid_t) 0, make_diffs); + write_attr_in(gid, NULL, (hid_t)0, make_diffs); + write_attr_in(root_id, NULL, (hid_t)0, make_diffs); } /* Close */ @@ -1036,34 +1024,35 @@ int test_attributes(const char *file, int make_diffs /* flag to modify data buff * *------------------------------------------------------------------------- */ -static int test_attributes_verbose_level(const char *fname1, const char *fname2) +static int +test_attributes_verbose_level(const char *fname1, const char *fname2) { herr_t status = SUCCEED; - hid_t fid1 = -1, fid2 = -1; - hid_t f1_gid = -1, f2_gid = -1; - hid_t f1_gid2 = -1, f2_gid2 = -1; - hid_t f1_gid3 = -1, f2_gid3 = -1; - hid_t f1_gid4 = -1, f2_gid4 = -1; - hid_t f1_did = -1, f2_did = -1; - hid_t f1_sid = -1, f2_sid = -1; - hid_t f1_tid = -1, f2_tid = -1; + hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID; + hid_t f1_gid = H5I_INVALID_HID, f2_gid = H5I_INVALID_HID; + hid_t f1_gid2 = H5I_INVALID_HID, f2_gid2 = H5I_INVALID_HID; + hid_t f1_gid3 = H5I_INVALID_HID, f2_gid3 = H5I_INVALID_HID; + hid_t f1_gid4 = H5I_INVALID_HID, f2_gid4 = H5I_INVALID_HID; + hid_t f1_did = H5I_INVALID_HID, f2_did = H5I_INVALID_HID; + hid_t f1_sid = H5I_INVALID_HID, f2_sid = H5I_INVALID_HID; + hid_t f1_tid = H5I_INVALID_HID, f2_tid = H5I_INVALID_HID; /* dset */ - hsize_t dset_dims[1] = { 3 }; - int dset_data[3] = { 0, 1, 2 }; + hsize_t dset_dims[1] = {3}; + int dset_data[3] = {0, 1, 2}; /* common attrs dim */ - hsize_t attr_dims[1] = { 2 }; + hsize_t attr_dims[1] = {2}; /* file1 attr */ - int f1_attr_idata[2] = { 1, 2 }; /* integer */ - float f1_attr_fdata[2] = { 1.1F, 2.2F }; /* float */ + int f1_attr_idata[2] = {1, 2}; /* integer */ + float f1_attr_fdata[2] = {1.1F, 2.2F}; /* float */ /* file2 attr */ - int f2_attr_idata[2] = { 2, 3 }; /* integer */ - float f2_attr_fdata[2] = { 2.1F, 3.2F }; /* float */ + int f2_attr_idata[2] = {2, 3}; /* integer */ + float f2_attr_fdata[2] = {2.1F, 3.2F}; /* float */ /*---------------------------------------------------------------------- - * Create file1 - *-----------------------------------------------------------------------*/ + * Create file1 + *-----------------------------------------------------------------------*/ if ((fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; @@ -1071,8 +1060,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) } /*---------------------------------- - * Groups - */ + * Groups + */ f1_gid = H5Gcreate2(fid1, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (f1_gid < 0) { HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); @@ -1102,8 +1091,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) } /*---------------------------------- - * Datasets - */ + * Datasets + */ f1_sid = H5Screate_simple(1, dset_dims, NULL); f1_did = H5Dcreate2(fid1, "dset", H5T_NATIVE_INT, f1_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (f1_did == FAIL) { @@ -1119,8 +1108,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) } /*---------------------------------- - * Named Datatype - */ + * Named Datatype + */ f1_tid = H5Tcopy(H5T_NATIVE_INT); status = H5Tcommit2(fid1, "ntype", f1_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { @@ -1130,8 +1119,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) } /*---------------------------------------------------------------------- - * Create file2 - *-----------------------------------------------------------------------*/ + * Create file2 + *-----------------------------------------------------------------------*/ if ((fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; @@ -1139,8 +1128,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) } /*---------------------------------- - * Groups - */ + * Groups + */ f2_gid = H5Gcreate2(fid2, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (f2_gid < 0) { HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); @@ -1170,8 +1159,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) } /*---------------------------------- - * Datasets - */ + * Datasets + */ f2_sid = H5Screate_simple(1, dset_dims, NULL); f2_did = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, f2_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (f2_did == FAIL) { @@ -1187,8 +1176,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) } /*---------------------------------- - * Named Datatype - */ + * Named Datatype + */ f2_tid = H5Tcopy(H5T_NATIVE_INT); status = H5Tcommit2(fid2, "ntype", f2_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { @@ -1198,9 +1187,9 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) } /*---------------------------------- - * CASE1 - Same attr number, all Same attr name - * add attr to group - */ + * CASE1 - Same attr number, all Same attr name + * add attr to group + */ write_attr(f1_gid, 1, attr_dims, "integer1", H5T_NATIVE_INT, f1_attr_idata); write_attr(f1_gid, 1, attr_dims, "float1", H5T_NATIVE_FLOAT, f1_attr_fdata); @@ -1208,9 +1197,9 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) write_attr(f2_gid, 1, attr_dims, "float1", H5T_NATIVE_FLOAT, f2_attr_fdata); /*---------------------------------- - * CASE2 - Same attr number, some Same attr name - * add attr to dset - */ + * CASE2 - Same attr number, some Same attr name + * add attr to dset + */ write_attr(f1_did, 1, attr_dims, "integer1", H5T_NATIVE_INT, f1_attr_idata); write_attr(f1_did, 1, attr_dims, "float2", H5T_NATIVE_FLOAT, f1_attr_fdata); @@ -1218,9 +1207,9 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) write_attr(f2_did, 1, attr_dims, "float3", H5T_NATIVE_FLOAT, f2_attr_fdata); /*---------------------------------- - * CASE3 - Same attr number, all different attr name - * add attr to ntype - */ + * CASE3 - Same attr number, all different attr name + * add attr to ntype + */ write_attr(f1_tid, 1, attr_dims, "integer1", H5T_NATIVE_INT, f1_attr_idata); write_attr(f1_tid, 1, attr_dims, "float2", H5T_NATIVE_FLOAT, f1_attr_fdata); write_attr(f1_tid, 1, attr_dims, "float3", H5T_NATIVE_FLOAT, f1_attr_fdata); @@ -1230,9 +1219,9 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) write_attr(f2_tid, 1, attr_dims, "float6", H5T_NATIVE_FLOAT, f2_attr_fdata); /*---------------------------------- - * CASE4 - Different attr number, some same attr name (vs file2-g2) - * add attr to g2 - */ + * CASE4 - Different attr number, some same attr name (vs file2-g2) + * add attr to g2 + */ write_attr(f1_gid2, 1, attr_dims, "integer1", H5T_NATIVE_INT, f1_attr_idata); write_attr(f1_gid2, 1, attr_dims, "float2", H5T_NATIVE_FLOAT, f1_attr_fdata); write_attr(f1_gid2, 1, attr_dims, "float3", H5T_NATIVE_FLOAT, f1_attr_fdata); @@ -1241,9 +1230,9 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) write_attr(f2_gid2, 1, attr_dims, "float2", H5T_NATIVE_FLOAT, f2_attr_fdata); /*---------------------------------- - * CASE5 - Different attr number, all different attr name - * add attr to g3 - */ + * CASE5 - Different attr number, all different attr name + * add attr to g3 + */ write_attr(f1_gid3, 1, attr_dims, "integer10", H5T_NATIVE_INT, f1_attr_idata); write_attr(f1_gid3, 1, attr_dims, "float11", H5T_NATIVE_FLOAT, f1_attr_fdata); write_attr(f1_gid3, 1, attr_dims, "float12", H5T_NATIVE_FLOAT, f1_attr_fdata); @@ -1253,8 +1242,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) out: /*----------------------------------------------------------------------- - * Close - *-----------------------------------------------------------------------*/ + * Close + *-----------------------------------------------------------------------*/ if (fid1 > 0) H5Fclose(fid1); if (fid2 > 0) @@ -1301,16 +1290,16 @@ out: * *------------------------------------------------------------------------- */ -static -int test_datasets(const char *file, int make_diffs /* flag to modify data buffers */) +static int +test_datasets(const char *file, int make_diffs /* flag to modify data buffers */) { - hid_t fid = -1; - hid_t did = -1; - hid_t gid = -1; - hid_t sid = -1; - hsize_t dims[1] = { 2 }; - herr_t status; - int buf[2] = { 1, 2 }; + hid_t fid = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hsize_t dims[1] = {2}; + herr_t status; + int buf[2] = {1, 2}; if (make_diffs > 0) memset(buf, 0, sizeof buf); @@ -1320,8 +1309,8 @@ int test_datasets(const char *file, int make_diffs /* flag to modify data buffer return -1; /* Create a 1D dataset */ - sid = H5Screate_simple(1, dims, NULL); - did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + sid = H5Screate_simple(1, dims, NULL); + did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); status = H5Sclose(sid); assert(status >= 0); @@ -1330,9 +1319,9 @@ int test_datasets(const char *file, int make_diffs /* flag to modify data buffer gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /*------------------------------------------------------------------------- - * write a series of datasets on the group - *------------------------------------------------------------------------- - */ + * write a series of datasets on the group + *------------------------------------------------------------------------- + */ write_dset_in(gid, "/dset", fid, make_diffs); @@ -1354,16 +1343,16 @@ int test_datasets(const char *file, int make_diffs /* flag to modify data buffer * Purpose: Check datasets with datasapce of zero dimension size. *------------------------------------------------------------------------- */ -static -int test_special_datasets(const char *file, int make_diffs /* flag to modify data buffers */) +static int +test_special_datasets(const char *file, int make_diffs /* flag to modify data buffers */) { - hid_t fid = -1; - hid_t did = -1; - hid_t sid0 = -1; - hid_t sid = -1; - hsize_t dims0[SPACE1_RANK] = { SPACE1_DIM1, SPACE1_DIM2 }; - hsize_t dims[SPACE1_RANK] = { SPACE1_DIM1, SPACE1_DIM2 }; - herr_t status; + hid_t fid = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t sid0 = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hsize_t dims0[SPACE1_RANK] = {SPACE1_DIM1, SPACE1_DIM2}; + hsize_t dims[SPACE1_RANK] = {SPACE1_DIM1, SPACE1_DIM2}; + herr_t status; /* Create a file */ if ((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -1371,7 +1360,7 @@ int test_special_datasets(const char *file, int make_diffs /* flag to modify dat /* Create a dataset with zero dimension size */ sid0 = H5Screate_simple(SPACE1_RANK, dims0, NULL); - did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid0, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid0, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* close dataset */ status = H5Dclose(did); @@ -1382,7 +1371,7 @@ int test_special_datasets(const char *file, int make_diffs /* flag to modify dat assert(status >= 0); /* Create a dataset with zero dimension size in one file but the other one - * has a dataset with a non-zero dimension size */ + * has a dataset with a non-zero dimension size */ if (make_diffs) dims[1] = SPACE1_DIM2 + 4; @@ -1411,16 +1400,17 @@ int test_special_datasets(const char *file, int make_diffs /* flag to modify dat * Programmer: Jonathan Kim (Feb 17, 2010) * *-------------------------------------------------------------------------*/ -static int test_link_name(const char *fname1) +static int +test_link_name(const char *fname1) { - hid_t fid1 = -1; - hid_t gid1 = -1; - hid_t gid2 = -1; + hid_t fid1 = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID; + hid_t gid2 = H5I_INVALID_HID; herr_t status = SUCCEED; /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); @@ -1429,16 +1419,15 @@ static int test_link_name(const char *fname1) } /*----------------------------------------------------------------------- - * Groups - *------------------------------------------------------------------------*/ + * Groups + *------------------------------------------------------------------------*/ gid1 = H5Gcreate2(fid1, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1 < 0) { HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } - gid2 = H5Gcreate2(fid1, "group_longname", H5P_DEFAULT, H5P_DEFAULT, - H5P_DEFAULT); + gid2 = H5Gcreate2(fid1, "group_longname", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid2 < 0) { HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); @@ -1447,8 +1436,8 @@ static int test_link_name(const char *fname1) } /*----------------------------------------------------------------------- - * Soft Links - *------------------------------------------------------------------------*/ + * Soft Links + *------------------------------------------------------------------------*/ status = H5Lcreate_soft("group", fid1, "link_g1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); @@ -1465,8 +1454,8 @@ static int test_link_name(const char *fname1) out: /*----------------------------------------------------------------------- - * Close - *------------------------------------------------------------------------*/ + * Close + *------------------------------------------------------------------------*/ if (fid1) H5Fclose(fid1); if (gid1) @@ -1484,18 +1473,19 @@ out: * Programmer: Jonathan Kim (Feb 17, 2010) * *-------------------------------------------------------------------------*/ -static int test_soft_links(const char *fname1) +static int +test_soft_links(const char *fname1) { - hid_t fid1 = -1; - hid_t gid1 = -1; - hsize_t dims2[2] = { 2, 4 }; - int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; - int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; - herr_t status = SUCCEED; + hid_t fid1 = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID; + hsize_t dims2[2] = {2, 4}; + int data1[4][2] = {{0, 1}, {2, 3}, {1, 2}, {3, 4}}; + int data2[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}}; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); @@ -1504,8 +1494,8 @@ static int test_soft_links(const char *fname1) } /*----------------------------------------------------------------------- - * Groups - *------------------------------------------------------------------------*/ + * Groups + *------------------------------------------------------------------------*/ gid1 = H5Gcreate2(fid1, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1 < 0) { HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); @@ -1514,8 +1504,8 @@ static int test_soft_links(const char *fname1) } /*----------------------------------------------------------------------- - * Datasets - *------------------------------------------------------------------------*/ + * Datasets + *------------------------------------------------------------------------*/ /* file1 */ status = write_dset(fid1, 2, dims2, "target_dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { @@ -1539,8 +1529,8 @@ static int test_soft_links(const char *fname1) } /*----------------------------------------------------------------------- - * Soft Links - *------------------------------------------------------------------------*/ + * Soft Links + *------------------------------------------------------------------------*/ /* file 1 */ status = H5Lcreate_soft("/target_dset1", fid1, "softlink_dset1_1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { @@ -1586,8 +1576,8 @@ static int test_soft_links(const char *fname1) out: /*----------------------------------------------------------------------- - * Close - *-----------------------------------------------------------------------*/ + * Close + *-----------------------------------------------------------------------*/ if (fid1) H5Fclose(fid1); if (gid1) @@ -1603,20 +1593,21 @@ out: * Programmer: Jonathan Kim (Feb 17, 2010) * *-------------------------------------------------------------------------*/ -static int test_linked_softlinks(const char *fname1) +static int +test_linked_softlinks(const char *fname1) { - hid_t fid1 = -1; - hid_t gid1 = -1; - hid_t gid2 = -1; - hid_t gid3 = -1; - hsize_t dims2[2] = { 2, 4 }; - int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; - int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; - herr_t status = SUCCEED; + hid_t fid1 = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID; + hid_t gid2 = H5I_INVALID_HID; + hid_t gid3 = H5I_INVALID_HID; + hsize_t dims2[2] = {2, 4}; + int data1[4][2] = {{0, 1}, {2, 3}, {1, 2}, {3, 4}}; + int data2[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}}; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); @@ -1625,8 +1616,8 @@ static int test_linked_softlinks(const char *fname1) } /*----------------------------------------------------------------------- - * Groups - *------------------------------------------------------------------------*/ + * Groups + *------------------------------------------------------------------------*/ gid1 = H5Gcreate2(fid1, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1 < 0) { HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); @@ -1649,8 +1640,8 @@ static int test_linked_softlinks(const char *fname1) } /*----------------------------------------------------------------------- - * Datasets - *------------------------------------------------------------------------*/ + * Datasets + *------------------------------------------------------------------------*/ /* file1 */ status = write_dset(fid1, 2, dims2, "target_dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { @@ -1673,10 +1664,10 @@ static int test_linked_softlinks(const char *fname1) } /*----------------------------------------------------------------------- - * Soft Links (Linked) - *------------------------------------------------------------------------*/ + * Soft Links (Linked) + *------------------------------------------------------------------------*/ /*--------- - * file 1 */ + * file 1 */ status = H5Lcreate_soft("/target_dset1", fid1, "softlink1_to_dset1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); @@ -1763,8 +1754,8 @@ static int test_linked_softlinks(const char *fname1) out: /*----------------------------------------------------------------------- - * Close - *-----------------------------------------------------------------------*/ + * Close + *-----------------------------------------------------------------------*/ if (fid1) H5Fclose(fid1); if (gid1) @@ -1784,20 +1775,21 @@ out: * Programmer: Jonathan Kim (Feb 17, 2010) * *-------------------------------------------------------------------------*/ -static int test_external_links(const char *fname1, const char *fname2) +static int +test_external_links(const char *fname1, const char *fname2) { - hid_t fid1 = -1; - hid_t fid2 = -1; - hid_t gid1 = -1; - hid_t gid2 = -1; - hsize_t dims2[2] = { 2, 4 }; - int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; - int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; - herr_t status = SUCCEED; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID; + hid_t gid2 = H5I_INVALID_HID; + hsize_t dims2[2] = {2, 4}; + int data1[4][2] = {{0, 1}, {2, 3}, {1, 2}, {3, 4}}; + int data2[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}}; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ /* source file */ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { @@ -1815,10 +1807,10 @@ static int test_external_links(const char *fname1, const char *fname2) } /*----------------------------------------------------------------------- - * Groups - *------------------------------------------------------------------------*/ + * Groups + *------------------------------------------------------------------------*/ /*-------------- - * target file */ + * target file */ gid1 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1 < 0) { HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); @@ -1833,10 +1825,10 @@ static int test_external_links(const char *fname1, const char *fname2) goto out; } /*----------------------------------------------------------------------- - * Datasets - *------------------------------------------------------------------------*/ + * Datasets + *------------------------------------------------------------------------*/ /*-------------- - * target file */ + * target file */ status = write_dset(fid2, 2, dims2, "target_dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); @@ -1859,18 +1851,20 @@ static int test_external_links(const char *fname1, const char *fname2) } /*----------------------------------------------------------------------- - * External Links - *------------------------------------------------------------------------*/ + * External Links + *------------------------------------------------------------------------*/ /*--------------*/ /* source file */ - status = H5Lcreate_external(fname2, "/target_group/x_dset", fid1, "ext_link_dset1", H5P_DEFAULT, H5P_DEFAULT); + status = + H5Lcreate_external(fname2, "/target_group/x_dset", fid1, "ext_link_dset1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } - status = H5Lcreate_external(fname2, "/target_group2/x_dset", fid1, "ext_link_dset2", H5P_DEFAULT, H5P_DEFAULT); + status = + H5Lcreate_external(fname2, "/target_group2/x_dset", fid1, "ext_link_dset2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; @@ -1907,8 +1901,8 @@ static int test_external_links(const char *fname1, const char *fname2) out: /*----------------------------------------------------------------------- - * Close - *-----------------------------------------------------------------------*/ + * Close + *-----------------------------------------------------------------------*/ if (fid1) H5Fclose(fid1); if (fid2) @@ -1929,19 +1923,20 @@ out: * Programmer: Jonathan Kim (Feb 17, 2010) * *-------------------------------------------------------------------------*/ -static int test_ext2soft_links(const char *fname1, const char *fname2) +static int +test_ext2soft_links(const char *fname1, const char *fname2) { - hid_t fid1 = -1; - hid_t fid2 = -1; - hid_t gid2 = -1; - hsize_t dims2[2] = { 2, 4 }; - int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; - int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; - herr_t status = SUCCEED; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t gid2 = H5I_INVALID_HID; + hsize_t dims2[2] = {2, 4}; + int data1[4][2] = {{0, 1}, {2, 3}, {1, 2}, {3, 4}}; + int data2[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}}; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ /* source file */ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { @@ -1959,8 +1954,8 @@ static int test_ext2soft_links(const char *fname1, const char *fname2) } /*----------------------------------------------------------------------- - * Groups - *------------------------------------------------------------------------*/ + * Groups + *------------------------------------------------------------------------*/ /* target file */ gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid2 < 0) { @@ -1970,10 +1965,10 @@ static int test_ext2soft_links(const char *fname1, const char *fname2) } /*----------------------------------------------------------------------- - * Datasets - *------------------------------------------------------------------------*/ + * Datasets + *------------------------------------------------------------------------*/ /*-------------- - * target file */ + * target file */ status = write_dset(fid2, 2, dims2, "dset1", H5T_NATIVE_INT, data2); if (status == FAIL) { HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); @@ -1989,10 +1984,10 @@ static int test_ext2soft_links(const char *fname1, const char *fname2) } /*----------------------------------------------------------------------- - * Soft Links (Linked) - *------------------------------------------------------------------------*/ + * Soft Links (Linked) + *------------------------------------------------------------------------*/ /*--------------- - * target file */ + * target file */ status = H5Lcreate_soft("/dset1", fid2, "softlink_to_dset1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); @@ -2008,10 +2003,10 @@ static int test_ext2soft_links(const char *fname1, const char *fname2) } /*----------------------------------------------------------------------- - * External Links - *------------------------------------------------------------------------*/ + * External Links + *------------------------------------------------------------------------*/ /*--------------- - * source file */ + * source file */ status = H5Lcreate_external(fname2, "/target_group", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); @@ -2019,14 +2014,16 @@ static int test_ext2soft_links(const char *fname1, const char *fname2) goto out; } - status = H5Lcreate_external(fname2, "/softlink_to_dset1", fid1, "ext_link_to_slink1", H5P_DEFAULT, H5P_DEFAULT); + status = H5Lcreate_external(fname2, "/softlink_to_dset1", fid1, "ext_link_to_slink1", H5P_DEFAULT, + H5P_DEFAULT); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } - status = H5Lcreate_external(fname2, "/softlink_to_dset2", fid1, "ext_link_to_slink2", H5P_DEFAULT, H5P_DEFAULT); + status = H5Lcreate_external(fname2, "/softlink_to_dset2", fid1, "ext_link_to_slink2", H5P_DEFAULT, + H5P_DEFAULT); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; @@ -2035,8 +2032,8 @@ static int test_ext2soft_links(const char *fname1, const char *fname2) out: /*----------------------------------------------------------------------- - * Close - *-----------------------------------------------------------------------*/ + * Close + *-----------------------------------------------------------------------*/ if (fid1) H5Fclose(fid1); if (fid2) @@ -2057,20 +2054,20 @@ out: * *------------------------------------------------------------------------- */ -static -int gen_dataset_idx(const char *file, int format) +static int +gen_dataset_idx(const char *file, int format) { - hid_t fid = -1; /* file id */ - hid_t did = -1; - hid_t did2 = -1; /* dataset id */ - hid_t sid = -1; /* space id */ - hid_t fapl = -1; /* file access property id */ - hid_t dcpl = -1; /* dataset creation property id */ - hsize_t dims[1] = { 10 }; /* dataset dimension */ - hsize_t c_dims[1] = { 2 }; /* chunk dimension */ - herr_t status; /* return status */ - int buf[10]; /* data buffer */ - int i; /* local index variable */ + hid_t fid = H5I_INVALID_HID; /* file id */ + hid_t did = H5I_INVALID_HID; + hid_t did2 = H5I_INVALID_HID; /* dataset id */ + hid_t sid = H5I_INVALID_HID; /* space id */ + hid_t fapl = H5I_INVALID_HID; /* file access property id */ + hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */ + hsize_t dims[1] = {10}; /* dataset dimension */ + hsize_t c_dims[1] = {2}; /* chunk dimension */ + herr_t status; /* return status */ + int buf[10]; /* data buffer */ + int i; /* local index variable */ /* Get a copy of the file aaccess property */ fapl = H5Pcreate(H5P_FILE_ACCESS); @@ -2090,7 +2087,7 @@ int gen_dataset_idx(const char *file, int format) buf[i] = i; /* Set chunk */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); + dcpl = H5Pcreate(H5P_DATASET_CREATE); status = H5Pset_chunk(dcpl, 1, c_dims); assert(status >= 0); @@ -2102,13 +2099,13 @@ int gen_dataset_idx(const char *file, int format) status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); assert(status >= 0); -#if defined (H5_HAVE_FILTER_DEFLATE) +#if defined(H5_HAVE_FILTER_DEFLATE) /* set deflate data */ status = H5Pset_deflate(dcpl, 9); assert(status >= 0); /* Create and write the dataset */ - did2 = H5Dcreate2(fid, "dset_filter", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + did2 = H5Dcreate2(fid, "dset_filter", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); status = H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); assert(status >= 0); @@ -2144,18 +2141,19 @@ int gen_dataset_idx(const char *file, int format) * Programmer: Jonathan Kim (Feb 17, 2010) * *-------------------------------------------------------------------------*/ -static int test_dangle_links(const char *fname1, const char *fname2) +static int +test_dangle_links(const char *fname1, const char *fname2) { - hid_t fid1 = -1; - hid_t fid2 = -1; - hsize_t dims2[2] = { 2, 4 }; - int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; - int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; - herr_t status = SUCCEED; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hsize_t dims2[2] = {2, 4}; + int data1[4][2] = {{0, 1}, {2, 3}, {1, 2}, {3, 4}}; + int data2[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}}; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); @@ -2171,8 +2169,8 @@ static int test_dangle_links(const char *fname1, const char *fname2) } /*----------------------------------------------------------------------- - * Datasets - *------------------------------------------------------------------------*/ + * Datasets + *------------------------------------------------------------------------*/ /* file1 */ status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { @@ -2204,8 +2202,8 @@ static int test_dangle_links(const char *fname1, const char *fname2) } /*----------------------------------------------------------------------- - * Soft Links - *------------------------------------------------------------------------*/ + * Soft Links + *------------------------------------------------------------------------*/ /* file 1 */ status = H5Lcreate_soft("no_obj", fid1, "soft_link1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { @@ -2265,8 +2263,8 @@ static int test_dangle_links(const char *fname1, const char *fname2) } /*----------------------------------------------------------------------- - * External Links - *------------------------------------------------------------------------*/ + * External Links + *------------------------------------------------------------------------*/ /* file1 */ status = H5Lcreate_external(fname2, "no_obj", fid1, "ext_link1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { @@ -2327,8 +2325,8 @@ static int test_dangle_links(const char *fname1, const char *fname2) out: /*----------------------------------------------------------------------- - * Close - *-----------------------------------------------------------------------*/ + * Close + *-----------------------------------------------------------------------*/ if (fid1) H5Fclose(fid1); if (fid2) @@ -2344,21 +2342,24 @@ out: * Programmer: Jonathan Kim (Aug 19, 2010) * *-------------------------------------------------------------------------*/ -static int test_group_recurse(const char *fname1, const char *fname2) +static int +test_group_recurse(const char *fname1, const char *fname2) { - hid_t fid1 = -1; - hid_t fid2 = -1; - hid_t gid1_f1 = -1, gid2_f1 = -1, gid3_f1 = -1, gid10_f1 = -1; - hid_t gid1_f2 = -1, gid2_f2 = -1, gid3_f2 = -1, gid11_f2 = -1; - hsize_t dims2[2] = { 2, 4 }; - int data1[4][2] = { { 0, 1 }, { 0, 1 }, { 1, 0 }, { 1, 0 } }; - int data2[4][2] = { { 0, 2 }, { 0, 2 }, { 2, 0 }, { 2, 0 } }; - int data3[4][2] = { { 0, 3 }, { 0, 3 }, { 3, 0 }, { 3, 0 } }; - herr_t status = SUCCEED; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t gid1_f1 = H5I_INVALID_HID, gid2_f1 = H5I_INVALID_HID, gid3_f1 = H5I_INVALID_HID, + gid10_f1 = H5I_INVALID_HID; + hid_t gid1_f2 = H5I_INVALID_HID, gid2_f2 = H5I_INVALID_HID, gid3_f2 = H5I_INVALID_HID, + gid11_f2 = H5I_INVALID_HID; + hsize_t dims2[2] = {2, 4}; + int data1[4][2] = {{0, 1}, {0, 1}, {1, 0}, {1, 0}}; + int data2[4][2] = {{0, 2}, {0, 2}, {2, 0}, {2, 0}}; + int data3[4][2] = {{0, 3}, {0, 3}, {3, 0}, {3, 0}}; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); @@ -2374,8 +2375,8 @@ static int test_group_recurse(const char *fname1, const char *fname2) } /*----------------------------------------------------------------------- - * Groups - *------------------------------------------------------------------------*/ + * Groups + *------------------------------------------------------------------------*/ /* file1 */ gid1_f1 = H5Gcreate2(fid1, "/grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1_f1 < 0) { @@ -2435,8 +2436,8 @@ static int test_group_recurse(const char *fname1, const char *fname2) } /*----------------------------------------------------------------------- - * Datasets under root - *------------------------------------------------------------------------*/ + * Datasets under root + *------------------------------------------------------------------------*/ /* file1 */ status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { @@ -2482,8 +2483,8 @@ static int test_group_recurse(const char *fname1, const char *fname2) } /*----------------------------------------------------------------------- - * Datasets under group - *------------------------------------------------------------------------*/ + * Datasets under group + *------------------------------------------------------------------------*/ /* file1 */ status = write_dset(gid1_f1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { @@ -2595,8 +2596,8 @@ static int test_group_recurse(const char *fname1, const char *fname2) } /*----------------------------------------------------------------------- - * Soft Links - *------------------------------------------------------------------------*/ + * Soft Links + *------------------------------------------------------------------------*/ /* file 1 */ status = H5Lcreate_soft("/grp1", fid1, "slink_grp1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { @@ -2656,8 +2657,8 @@ static int test_group_recurse(const char *fname1, const char *fname2) } /*----------------------------------------------------------------------- - * External Links - *------------------------------------------------------------------------*/ + * External Links + *------------------------------------------------------------------------*/ /* file1 */ status = H5Lcreate_external(fname2, "/grp1", fid1, "elink_grp1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { @@ -2703,9 +2704,9 @@ static int test_group_recurse(const char *fname1, const char *fname2) } /*------------------------------ - * external circle route test - * file1/grp11 <-> file2/grp10 via elink_grp_circle link - */ + * external circle route test + * file1/grp11 <-> file2/grp10 via elink_grp_circle link + */ /* file1 */ status = H5Lcreate_external(fname2, "/grp11", gid10_f1, "elink_grp_circle", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { @@ -2723,8 +2724,8 @@ static int test_group_recurse(const char *fname1, const char *fname2) out: /*----------------------------------------------------------------------- - * Close - *-----------------------------------------------------------------------*/ + * Close + *-----------------------------------------------------------------------*/ if (fid1) H5Fclose(fid1); if (fid2) @@ -2756,38 +2757,39 @@ out: *-------------------------------------------------------------------------*/ #define GRP_R_DSETNAME1 "dset1" #define GRP_R_DSETNAME2 "dset2" -static int test_group_recurse2(void) +static int +test_group_recurse2(void) { - hid_t fileid1 = -1; - hid_t grp1 = -1; - hid_t grp2 = -1; - hid_t grp3 = -1; - hid_t grp4 = -1; - hid_t dset1 = -1; - hid_t dset2 = -1; - hid_t datatype = -1; - hid_t dataspace = -1; - hid_t fileid2 = -1; - hid_t fileid3 = -1; - hid_t fileid4 = -1; + hid_t fileid1 = H5I_INVALID_HID; + hid_t grp1 = H5I_INVALID_HID; + hid_t grp2 = H5I_INVALID_HID; + hid_t grp3 = H5I_INVALID_HID; + hid_t grp4 = H5I_INVALID_HID; + hid_t dset1 = H5I_INVALID_HID; + hid_t dset2 = H5I_INVALID_HID; + hid_t datatype = H5I_INVALID_HID; + hid_t dataspace = H5I_INVALID_HID; + hid_t fileid2 = H5I_INVALID_HID; + hid_t fileid3 = H5I_INVALID_HID; + hid_t fileid4 = H5I_INVALID_HID; hsize_t dimsf[2]; /* dataset dimensions */ - herr_t status = 0; - int data1[4][2] = { { 0, 0 }, { 1, 1 }, { 2, 2 }, { 3, 3 } }; - int data2[4][2] = { { 0, 0 }, { 0, 1 }, { 0, 2 }, { 3, 3 } }; + herr_t status = 0; + int data1[4][2] = {{0, 0}, {1, 1}, {2, 2}, {3, 3}}; + int data2[4][2] = {{0, 0}, {0, 1}, {0, 2}, {3, 3}}; /*----------------------------------------------------------------------- - * FILE 1 - *------------------------------------------------------------------------*/ + * FILE 1 + *------------------------------------------------------------------------*/ /* - * Create a new file using H5F_ACC_TRUNC access, - * default file creation properties, and default file - * access properties. - */ + * Create a new file using H5F_ACC_TRUNC access, + * default file creation properties, and default file + * access properties. + */ fileid1 = H5Fcreate(GRP_RECURSE1_EXT, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /*----------------------------------------------------------------------- - * Groups - *------------------------------------------------------------------------*/ + * Groups + *------------------------------------------------------------------------*/ grp1 = H5Gcreate2(fileid1, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (grp1 < 0) { HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); @@ -2817,72 +2819,72 @@ static int test_group_recurse2(void) } /*----------------------------------------------------------------------- - * Datasets - *------------------------------------------------------------------------*/ + * Datasets + *------------------------------------------------------------------------*/ /* - * Describe the size of the array and create the data space for fixed - * size dataset. - */ - dimsf[0] = 4; - dimsf[1] = 2; + * Describe the size of the array and create the data space for fixed + * size dataset. + */ + dimsf[0] = 4; + dimsf[1] = 2; dataspace = H5Screate_simple(2, dimsf, NULL); /* - * Define datatype for the data in the file. - * We will store little endian INT numbers. - */ + * Define datatype for the data in the file. + * We will store little endian INT numbers. + */ datatype = H5Tcopy(H5T_NATIVE_INT); - status = H5Tset_order(datatype, H5T_ORDER_LE); + status = H5Tset_order(datatype, H5T_ORDER_LE); /*--------------- - * dset1 - */ + * dset1 + */ /* - * Create a new dataset within the file using defined dataspace and - * datatype and default dataset creation properties. - */ + * Create a new dataset within the file using defined dataspace and + * datatype and default dataset creation properties. + */ dset1 = H5Dcreate2(fileid1, GRP_R_DSETNAME1, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* - * Write the data to the dataset using default transfer properties. - */ + * Write the data to the dataset using default transfer properties. + */ status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1); H5Dclose(dset1); /*--------------- - * dset1 - */ + * dset1 + */ /* - * Create a new dataset within the file using defined dataspace and - * datatype and default dataset creation properties. - */ + * Create a new dataset within the file using defined dataspace and + * datatype and default dataset creation properties. + */ dset1 = H5Dcreate2(grp3, GRP_R_DSETNAME1, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* - * Write the data to the dataset using default transfer properties. - */ + * Write the data to the dataset using default transfer properties. + */ status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1); /*--------------- - * dset2 - */ + * dset2 + */ /* - * Create a new dataset within the fileid1 using defined dataspace and - * datatype and default dataset creation properties. - */ + * Create a new dataset within the fileid1 using defined dataspace and + * datatype and default dataset creation properties. + */ dset2 = H5Dcreate2(grp4, GRP_R_DSETNAME2, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* - * Write the data to the dataset using default transfer properties. - */ + * Write the data to the dataset using default transfer properties. + */ status = H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2); /*----------------------------------------------------------------------- - * Soft links - *------------------------------------------------------------------------*/ + * Soft links + *------------------------------------------------------------------------*/ /* - * under '/' root - */ + * under '/' root + */ /* link to dset1 */ status = H5Lcreate_soft(GRP_R_DSETNAME1, fileid1, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { @@ -2899,15 +2901,15 @@ static int test_group_recurse2(void) H5Gclose(grp4); /*----------------------------------------------------------------------- - * FILE 2-3 - *------------------------------------------------------------------------*/ + * FILE 2-3 + *------------------------------------------------------------------------*/ - /* crate target file */ + /* create target file */ fileid4 = H5Fcreate(GRP_RECURSE2_EXT3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /*----------------------------------------------- - * Groups - */ + * Groups + */ grp4 = H5Gcreate2(fileid4, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (grp4 < 0) { HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE2_EXT3); @@ -2916,32 +2918,32 @@ static int test_group_recurse2(void) } /*--------------- - * dset2 - */ + * dset2 + */ /* - * Create a new dataset within the fileid1 using defined dataspace and - * datatype and default dataset creation properties. - */ + * Create a new dataset within the fileid1 using defined dataspace and + * datatype and default dataset creation properties. + */ dset2 = H5Dcreate2(grp4, GRP_R_DSETNAME2, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* - * Write the data to the dataset using default transfer properties. - */ + * Write the data to the dataset using default transfer properties. + */ status = H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2); H5Gclose(grp4); H5Dclose(dset2); /*----------------------------------------------------------------------- - * FILE 2-2 - *------------------------------------------------------------------------*/ + * FILE 2-2 + *------------------------------------------------------------------------*/ - /* crate target file */ + /* create target file */ fileid3 = H5Fcreate(GRP_RECURSE2_EXT2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /*----------------------------------------------- - * Groups - */ + * Groups + */ grp2 = H5Gcreate2(fileid3, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (grp2 < 0) { HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE2_EXT2); @@ -2957,22 +2959,22 @@ static int test_group_recurse2(void) } /*--------------- - * dset1 - */ + * dset1 + */ /* - * Create a new dataset within the fileid1 using defined dataspace and - * datatype and default dataset creation properties. - */ + * Create a new dataset within the fileid1 using defined dataspace and + * datatype and default dataset creation properties. + */ dset1 = H5Dcreate2(grp3, GRP_R_DSETNAME1, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* - * Write the data to the dataset using default transfer properties. - */ + * Write the data to the dataset using default transfer properties. + */ status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1); /*----------------------------------------------- - * extlink to $GRP_RECURSE2_EXT3/g4 - */ + * extlink to $GRP_RECURSE2_EXT3/g4 + */ status = H5Lcreate_external(GRP_RECURSE2_EXT3, "/g4", fileid3, "/g2/g3/g4", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", GRP_RECURSE2_EXT2); @@ -2985,15 +2987,15 @@ static int test_group_recurse2(void) H5Gclose(grp3); /*----------------------------------------------------------------------- - * FILE 2-1 - *------------------------------------------------------------------------*/ + * FILE 2-1 + *------------------------------------------------------------------------*/ - /* crate target file */ + /* create target file */ fileid2 = H5Fcreate(GRP_RECURSE2_EXT1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /*----------------------------------------------- - * Groups - */ + * Groups + */ grp1 = H5Gcreate2(fileid2, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (grp1 < 0) { HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); @@ -3002,21 +3004,21 @@ static int test_group_recurse2(void) } /*--------------- - * dset1 - */ + * dset1 + */ dset1 = H5Dcreate2(fileid2, GRP_R_DSETNAME1, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* - * Write the data to the dataset using default transfer properties. - */ + * Write the data to the dataset using default transfer properties. + */ status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1); /*----------------------------------------------------------------------- - * Soft links - *------------------------------------------------------------------------*/ + * Soft links + *------------------------------------------------------------------------*/ /* - * under '/' root - */ + * under '/' root + */ /* link to dset1 */ status = H5Lcreate_soft(GRP_R_DSETNAME1, fileid2, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { @@ -3026,8 +3028,8 @@ static int test_group_recurse2(void) } /*----------------------------------------------- - * extlink to $GRP_RECURSE2_EXT2/g2 - */ + * extlink to $GRP_RECURSE2_EXT2/g2 + */ status = H5Lcreate_external(GRP_RECURSE2_EXT2, "/g2", fileid2, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", GRP_RECURSE2_EXT1); @@ -3040,8 +3042,8 @@ static int test_group_recurse2(void) out: /* - * Close/release resources. - */ + * Close/release resources. + */ if (dataspace > 0) H5Sclose(dataspace); if (datatype > 0) @@ -3067,20 +3069,21 @@ out: * Programmer: Jonathan Kim (July, 21, 2010) * *-------------------------------------------------------------------------*/ -static int test_exclude_obj1(const char *fname1, const char *fname2) +static int +test_exclude_obj1(const char *fname1, const char *fname2) { - hid_t fid1 = -1; - hid_t fid2 = -1; - hid_t gid1 = -1; - hid_t gid2 = -1; - hsize_t dims2[2] = { 2, 4 }; - int data1[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; - int data2[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; - herr_t status = SUCCEED; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID; + hid_t gid2 = H5I_INVALID_HID; + hsize_t dims2[2] = {2, 4}; + int data1[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}}; + int data2[4][2] = {{0, 1}, {2, 3}, {1, 2}, {3, 4}}; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); @@ -3096,8 +3099,8 @@ static int test_exclude_obj1(const char *fname1, const char *fname2) } /*----------------------------------------------------------------------- - * Group - *------------------------------------------------------------------------*/ + * Group + *------------------------------------------------------------------------*/ /* file1 */ gid1 = H5Gcreate2(fid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1 < 0) { @@ -3116,8 +3119,8 @@ static int test_exclude_obj1(const char *fname1, const char *fname2) } /*----------------------------------------------------------------------- - * Datasets - *------------------------------------------------------------------------*/ + * Datasets + *------------------------------------------------------------------------*/ /* file1 */ status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { @@ -3164,8 +3167,8 @@ static int test_exclude_obj1(const char *fname1, const char *fname2) out: /*----------------------------------------------------------------------- - * Close - *-----------------------------------------------------------------------*/ + * Close + *-----------------------------------------------------------------------*/ if (fid1) H5Fclose(fid1); if (fid2) @@ -3187,21 +3190,22 @@ out: * Programmer: Jonathan Kim (July, 21, 2010) * *-------------------------------------------------------------------------*/ -static int test_exclude_obj2(const char *fname1, const char *fname2) +static int +test_exclude_obj2(const char *fname1, const char *fname2) { - hid_t fid1 = -1; - hid_t fid2 = -1; - hid_t gid1 = -1; - hid_t gid2 = -1; - hid_t gid3 = -1; - hsize_t dims2[2] = { 2, 4 }; - int data1[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; - int data2[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; - herr_t status = SUCCEED; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID; + hid_t gid2 = H5I_INVALID_HID; + hid_t gid3 = H5I_INVALID_HID; + hsize_t dims2[2] = {2, 4}; + int data1[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}}; + int data2[4][2] = {{0, 1}, {2, 3}, {1, 2}, {3, 4}}; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); @@ -3217,8 +3221,8 @@ static int test_exclude_obj2(const char *fname1, const char *fname2) } /*----------------------------------------------------------------------- - * Group - *------------------------------------------------------------------------*/ + * Group + *------------------------------------------------------------------------*/ /* file1 */ gid1 = H5Gcreate2(fid1, "group10", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1 < 0) { @@ -3245,8 +3249,8 @@ static int test_exclude_obj2(const char *fname1, const char *fname2) } /*----------------------------------------------------------------------- - * Datasets - *------------------------------------------------------------------------*/ + * Datasets + *------------------------------------------------------------------------*/ /* file1 */ status = write_dset(fid1, 2, dims2, "dset10", H5T_NATIVE_INT, data1); if (status == FAIL) { @@ -3293,8 +3297,8 @@ static int test_exclude_obj2(const char *fname1, const char *fname2) out: /*----------------------------------------------------------------------- - * Close - *-----------------------------------------------------------------------*/ + * Close + *-----------------------------------------------------------------------*/ if (fid1) H5Fclose(fid1); if (fid2) @@ -3318,18 +3322,19 @@ out: * Programmer: Jonathan Kim (Mar, 19, 2012) * *-------------------------------------------------------------------------*/ -static int test_exclude_obj3(const char *fname1, const char *fname2) +static int +test_exclude_obj3(const char *fname1, const char *fname2) { - hid_t fid1 = -1; - hid_t fid2 = -1; - hid_t gid1 = -1; - hsize_t dims2[2] = { 2, 4 }; - int data1[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; - herr_t status = SUCCEED; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID; + hsize_t dims2[2] = {2, 4}; + int data1[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}}; + herr_t status = SUCCEED; /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); @@ -3345,8 +3350,8 @@ static int test_exclude_obj3(const char *fname1, const char *fname2) } /*----------------------------------------------------------------------- - * Group - *------------------------------------------------------------------------*/ + * Group + *------------------------------------------------------------------------*/ /* file1 */ gid1 = H5Gcreate2(fid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1 < 0) { @@ -3356,8 +3361,8 @@ static int test_exclude_obj3(const char *fname1, const char *fname2) } /*----------------------------------------------------------------------- - * Datasets - *------------------------------------------------------------------------*/ + * Datasets + *------------------------------------------------------------------------*/ /* file1 */ status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { @@ -3383,8 +3388,8 @@ static int test_exclude_obj3(const char *fname1, const char *fname2) out: /*----------------------------------------------------------------------- - * Close - *-----------------------------------------------------------------------*/ + * Close + *-----------------------------------------------------------------------*/ if (fid1) H5Fclose(fid1); if (fid2) @@ -3404,182 +3409,181 @@ out: * Programmer: Jonathan Kim (Oct, 26, 2010) * *-------------------------------------------------------------------------*/ -#define STR_RANK 1 -#define VLEN_STR_DIM 1 -#define FIXLEN_STR_SIZE 21 -#define FIXLEN_STR_DIM 1 -#define VLEN_STR_ARRY_DIM 3 -#define FIXLEN_STR_ARRY_DIM 3 +#define STR_RANK 1 +#define VLEN_STR_DIM 1 +#define FIXLEN_STR_SIZE 21 +#define FIXLEN_STR_DIM 1 +#define VLEN_STR_ARRY_DIM 3 +#define FIXLEN_STR_ARRY_DIM 3 #define FIXLEN_STR_ARRY_SIZE 30 -#define COMP_RANK 1 -#define COMP_DIM 1 -static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new) +#define COMP_RANK 1 +#define COMP_DIM 1 +static int +test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new) { - int i; - hid_t fid1 = -1; /* file id */ - hid_t gid = -1; + int i; + hid_t fid1 = H5I_INVALID_HID; /* file id */ + hid_t gid = H5I_INVALID_HID; /* compound1 datatype */ typedef struct comp1_t { - char *str_vlen; /* vlen string */ - char *str_vlen_repeat; /* vlen string */ - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char * str_vlen; /* vlen string */ + char * str_vlen_repeat; /* vlen string */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ } comp1_t; /* compound2 datatype */ typedef struct comp2_t { - char *str_vlen; /* vlen string */ - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen_repeat; /* vlen string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char * str_vlen; /* vlen string */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char * str_vlen_repeat; /* vlen string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ } comp2_t; /* compound3 datatype */ typedef struct comp3_t { - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen; /* vlen string */ - char *str_vlen_repeat; /* vlen string */ - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen; /* vlen string */ + char *str_vlen_repeat; /* vlen string */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ } comp3_t; /* compound4 datatype */ typedef struct comp4_t { - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen; /* vlen string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen_repeat; /* vlen string */ - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char * str_vlen; /* vlen string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char * str_vlen_repeat; /* vlen string */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ } comp4_t; /* compound5 datatype */ typedef struct comp5_t { - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - char *str_vlen; /* vlen string */ - char *str_vlen_repeat; /* vlen string */ - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_vlen; /* vlen string */ + char *str_vlen_repeat; /* vlen string */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ } comp5_t; /* compound6 datatype */ typedef struct comp6_t { - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - char *str_vlen; /* vlen string */ - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen_repeat; /* vlen string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_vlen; /* vlen string */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen_repeat; /* vlen string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ } comp6_t; /* compound7 datatype */ typedef struct comp7_t { - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen; /* vlen string */ - char *str_vlen_repeat; /* vlen string */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char * str_vlen; /* vlen string */ + char * str_vlen_repeat; /* vlen string */ } comp7_t; /* compound8 datatype */ typedef struct comp8_t { - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen; /* vlen string */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ - char *str_vlen_repeat; /* vlen string */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char * str_vlen; /* vlen string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char * str_vlen_repeat; /* vlen string */ } comp8_t; /* compound9 datatype */ typedef struct comp9_t { - char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ - const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ - const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ - char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ - int int_data1; - hobj_ref_t objref1; /* reference */ - char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ - hobj_ref_t objref2; /* reference */ - char *str_vlen; /* vlen string */ - int int_data2; - char *str_vlen_repeat; /* vlen string */ - hobj_ref_t objref3; /* reference */ - int int_data3; + const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + int int_data1; + hobj_ref_t objref1; /* reference */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + hobj_ref_t objref2; /* reference */ + char * str_vlen; /* vlen string */ + int int_data2; + char * str_vlen_repeat; /* vlen string */ + hobj_ref_t objref3; /* reference */ + int int_data3; } comp9_t; /* vlen string */ - hid_t sid_vlen_str = -1; /* dataspace ID */ - hid_t tid_vlen_str = -1; /* datatype ID */ - char vlen_str_buf[] = { "Variable length string" }; - hsize_t dims_vlen_str[] = { VLEN_STR_DIM }; + hid_t sid_vlen_str = H5I_INVALID_HID; /* dataspace ID */ + hid_t tid_vlen_str = H5I_INVALID_HID; /* datatype ID */ + char vlen_str_buf[] = {"Variable length string"}; + hsize_t dims_vlen_str[] = {VLEN_STR_DIM}; /* fixlen string */ - hid_t sid_fixlen_str = -1; /* dataspace ID */ - hid_t tid_fixlen_str = -1; /* datatype ID */ - const char fixlen_str_buf[FIXLEN_STR_SIZE] = { "Fixed length string" }; - hsize_t dims_fixlen_str[] = { FIXLEN_STR_DIM }; + hid_t sid_fixlen_str = H5I_INVALID_HID; /* dataspace ID */ + hid_t tid_fixlen_str = H5I_INVALID_HID; /* datatype ID */ + const char fixlen_str_buf[FIXLEN_STR_SIZE] = {"Fixed length string"}; + hsize_t dims_fixlen_str[] = {FIXLEN_STR_DIM}; /* vlen string array */ - hid_t sid_vlen_str_array = -1; /* dataspace ID */ - hid_t tid_vlen_str_array_pre = -1; /* datatype ID */ - hid_t tid_vlen_str_array = -1; /* datatype ID */ - const char *vlen_str_array_buf[VLEN_STR_ARRY_DIM] = - { "1 - Variable length string Array", - "2 - Testing variable length string array in compound type", - "3 - Four score and seven\n years ago our forefathers brought forth on this continent a new nation," }; - hsize_t dims_vlen_str_array[] = { VLEN_STR_ARRY_DIM }; + hid_t sid_vlen_str_array = H5I_INVALID_HID; /* dataspace ID */ + hid_t tid_vlen_str_array_pre = H5I_INVALID_HID; /* datatype ID */ + hid_t tid_vlen_str_array = H5I_INVALID_HID; /* datatype ID */ + const char *vlen_str_array_buf[VLEN_STR_ARRY_DIM] = { + "1 - Variable length string Array", "2 - Testing variable length string array in compound type", + "3 - Four score and seven\n years ago our forefathers brought forth on this continent a new nation,"}; + hsize_t dims_vlen_str_array[] = {VLEN_STR_ARRY_DIM}; /* fixlen string array */ - hid_t sid_fixlen_str_array = -1; /* dataspace ID */ - hid_t tid_fixlen_str_array_pre = -1; /* datatype ID */ - hid_t tid_fixlen_str_array = -1; /* datatype ID */ + hid_t sid_fixlen_str_array = H5I_INVALID_HID; /* dataspace ID */ + hid_t tid_fixlen_str_array_pre = H5I_INVALID_HID; /* datatype ID */ + hid_t tid_fixlen_str_array = H5I_INVALID_HID; /* datatype ID */ const char *fixlen_str_array_buf[FIXLEN_STR_ARRY_DIM] = { - "1 - Fixed length string Array", "2 - Fixed length string Array", - "3 - Fixed length string Array" }; - hsize_t dims_fixlen_str_array[] = { FIXLEN_STR_ARRY_DIM }; + "1 - Fixed length string Array", "2 - Fixed length string Array", "3 - Fixed length string Array"}; + hsize_t dims_fixlen_str_array[] = {FIXLEN_STR_ARRY_DIM}; /*------------------------------------------ - * compound dataset - *------------------------------------------*/ - hid_t sid_comp = -1; /* dataspace ID */ - hid_t tid1_comp = -1; /* datatype ID */ - hid_t tid2_comp = -1; /* datatype ID */ - hid_t tid3_comp = -1; /* datatype ID */ - hid_t tid4_comp = -1; /* datatype ID */ - hid_t tid5_comp = -1; /* datatype ID */ - hid_t tid6_comp = -1; /* datatype ID */ - hid_t tid7_comp = -1; /* datatype ID */ - hid_t tid8_comp = -1; /* datatype ID */ - hid_t tid9_comp = -1; /* datatype ID */ - hid_t did_comp = -1; /* dataset ID */ - hsize_t dims_comp[] = { COMP_DIM }; - herr_t status = SUCCEED; + * compound dataset + *------------------------------------------*/ + hid_t sid_comp = H5I_INVALID_HID; /* dataspace ID */ + hid_t tid1_comp = H5I_INVALID_HID; /* datatype ID */ + hid_t tid2_comp = H5I_INVALID_HID; /* datatype ID */ + hid_t tid3_comp = H5I_INVALID_HID; /* datatype ID */ + hid_t tid4_comp = H5I_INVALID_HID; /* datatype ID */ + hid_t tid5_comp = H5I_INVALID_HID; /* datatype ID */ + hid_t tid6_comp = H5I_INVALID_HID; /* datatype ID */ + hid_t tid7_comp = H5I_INVALID_HID; /* datatype ID */ + hid_t tid8_comp = H5I_INVALID_HID; /* datatype ID */ + hid_t tid9_comp = H5I_INVALID_HID; /* datatype ID */ + hid_t did_comp = H5I_INVALID_HID; /* dataset ID */ + hsize_t dims_comp[] = {COMP_DIM}; + herr_t status = SUCCEED; /* make compound strings data */ comp1_t comp1_buf; @@ -3636,25 +3640,15 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* copy vlen string array data to compound buffers */ for (i = 0; i < VLEN_STR_ARRY_DIM; i++) { - comp1_buf.str_array_vlen[i] = comp1_buf.str_vlen_array_again[i] = - vlen_str_array_buf[i]; - comp2_buf.str_array_vlen[i] = comp2_buf.str_vlen_array_again[i] = - vlen_str_array_buf[i]; - comp3_buf.str_array_vlen[i] = comp3_buf.str_vlen_array_again[i] = - vlen_str_array_buf[i]; - comp4_buf.str_array_vlen[i] = comp4_buf.str_vlen_array_again[i] = - vlen_str_array_buf[i]; - comp5_buf.str_array_vlen[i] = comp5_buf.str_vlen_array_again[i] = - vlen_str_array_buf[i]; - comp6_buf.str_array_vlen[i] = comp6_buf.str_vlen_array_again[i] = - vlen_str_array_buf[i]; - comp7_buf.str_array_vlen[i] = comp7_buf.str_vlen_array_again[i] = - vlen_str_array_buf[i]; - comp8_buf.str_array_vlen[i] = comp8_buf.str_vlen_array_again[i] = - vlen_str_array_buf[i]; - comp9_buf.str_array_vlen[i] = comp9_buf.str_vlen_array_again[i] = - vlen_str_array_buf[i]; - + comp1_buf.str_array_vlen[i] = comp1_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp2_buf.str_array_vlen[i] = comp2_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp3_buf.str_array_vlen[i] = comp3_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp4_buf.str_array_vlen[i] = comp4_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp5_buf.str_array_vlen[i] = comp5_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp6_buf.str_array_vlen[i] = comp6_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp7_buf.str_array_vlen[i] = comp7_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp8_buf.str_array_vlen[i] = comp8_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp9_buf.str_array_vlen[i] = comp9_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; } /* copy fixlen string attay data to compound buffers */ @@ -3693,8 +3687,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int comp9_buf.int_data3 = 30; /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ if (is_file_new == 1) { fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { @@ -3713,8 +3707,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int } /*----------------------------------------------------------------------- - * Create group - *------------------------------------------------------------------------*/ + * Create group + *------------------------------------------------------------------------*/ gid = H5Gcreate2(fid1, grp_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid < 0) { HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); @@ -3723,8 +3717,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int } /*----------------------------------------------------------------------- - * Variable length String1 - Create space and type - *------------------------------------------------------------------------*/ + * Variable length String1 - Create space and type + *------------------------------------------------------------------------*/ sid_vlen_str = H5Screate_simple(STR_RANK, dims_vlen_str, NULL); if (sid_vlen_str < 0) { HDfprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); @@ -3733,7 +3727,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int } tid_vlen_str = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid_vlen_str, H5T_VARIABLE); + status = H5Tset_size(tid_vlen_str, H5T_VARIABLE); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); status = FAIL; @@ -3741,8 +3735,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int } /*----------------------------------------------------------------------- - * Fixed length String2 - Create space and type - *------------------------------------------------------------------------*/ + * Fixed length String2 - Create space and type + *------------------------------------------------------------------------*/ sid_fixlen_str = H5Screate_simple(STR_RANK, dims_fixlen_str, NULL); if (sid_fixlen_str < 0) { HDfprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); @@ -3751,7 +3745,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int } tid_fixlen_str = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid_fixlen_str, FIXLEN_STR_SIZE); + status = H5Tset_size(tid_fixlen_str, FIXLEN_STR_SIZE); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); status = FAIL; @@ -3759,8 +3753,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int } /*----------------------------------------------------------------------- - * Fixed length String3 array - Create space and type - *------------------------------------------------------------------------*/ + * Fixed length String3 array - Create space and type + *------------------------------------------------------------------------*/ sid_vlen_str_array = H5Screate_simple(STR_RANK, dims_vlen_str_array, NULL); if (sid_vlen_str_array < 0) { HDfprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); @@ -3769,7 +3763,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int } tid_vlen_str_array_pre = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid_vlen_str_array_pre, H5T_VARIABLE); + status = H5Tset_size(tid_vlen_str_array_pre, H5T_VARIABLE); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); status = FAIL; @@ -3785,8 +3779,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int } /*----------------------------------------------------------------------- - * Variable length String4 array - Create space and type - *------------------------------------------------------------------------*/ + * Variable length String4 array - Create space and type + *------------------------------------------------------------------------*/ sid_fixlen_str_array = H5Screate_simple(STR_RANK, dims_fixlen_str_array, NULL); if (sid_fixlen_str_array < 0) { HDfprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); @@ -3795,7 +3789,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int } tid_fixlen_str_array_pre = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid_fixlen_str_array_pre, FIXLEN_STR_ARRY_SIZE); + status = H5Tset_size(tid_fixlen_str_array_pre, FIXLEN_STR_ARRY_SIZE); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); status = FAIL; @@ -3810,8 +3804,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int } /*------------------------------------------------------------------------- - * Compound dataset - *------------------------------------------------------------------------*/ + * Compound dataset + *------------------------------------------------------------------------*/ sid_comp = H5Screate_simple(COMP_RANK, dims_comp, NULL); if (sid_comp < 0) { HDfprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); @@ -3874,7 +3868,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int H5Tinsert(tid5_comp, "FIXLEN_STR1", HOFFSET(comp5_t, str_fixlen), tid_fixlen_str); H5Tinsert(tid5_comp, "FIXLEN_STR2", HOFFSET(comp5_t, str_fixlen_repeat), tid_fixlen_str); H5Tinsert(tid5_comp, "VLEN_STR_ARRAY1", HOFFSET(comp5_t, str_array_vlen), tid_vlen_str_array); - H5Tinsert(tid5_comp, "VLEN_STR_ARRAY2", HOFFSET(comp5_t, str_vlen_array_again), tid_vlen_str_array); + H5Tinsert(tid5_comp, "VLEN_STR_ARRAY2", HOFFSET(comp5_t, str_vlen_array_again), tid_vlen_str_array); H5Tinsert(tid5_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp5_t, str_array_fixlen), tid_fixlen_str_array); H5Tinsert(tid5_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp5_t, str_fixlen_array_again), tid_fixlen_str_array); @@ -3926,7 +3920,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 1 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset1", tid1_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - status = H5Dwrite(did_comp, tid1_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp1_buf); + status = H5Dwrite(did_comp, tid1_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp1_buf); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; @@ -3936,7 +3930,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 2 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset2", tid2_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - status = H5Dwrite(did_comp, tid2_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp2_buf); + status = H5Dwrite(did_comp, tid2_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp2_buf); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; @@ -3946,7 +3940,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 3 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset3", tid3_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - status = H5Dwrite(did_comp, tid3_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp3_buf); + status = H5Dwrite(did_comp, tid3_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp3_buf); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; @@ -3956,7 +3950,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 4 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset4", tid4_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - status = H5Dwrite(did_comp, tid4_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp4_buf); + status = H5Dwrite(did_comp, tid4_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp4_buf); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; @@ -3966,7 +3960,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 5 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset5", tid5_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - status = H5Dwrite(did_comp, tid5_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp5_buf); + status = H5Dwrite(did_comp, tid5_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp5_buf); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; @@ -3976,7 +3970,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 6 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset6", tid6_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - status = H5Dwrite(did_comp, tid6_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp6_buf); + status = H5Dwrite(did_comp, tid6_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp6_buf); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; @@ -3986,7 +3980,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 7 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset7", tid7_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - status = H5Dwrite(did_comp, tid7_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp7_buf); + status = H5Dwrite(did_comp, tid7_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp7_buf); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; @@ -3996,7 +3990,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Write data to compound 8 dataset buffer */ did_comp = H5Dcreate2(gid, "Compound_dset8", tid8_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - status = H5Dwrite(did_comp, tid8_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp8_buf); + status = H5Dwrite(did_comp, tid8_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp8_buf); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; @@ -4008,9 +4002,9 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int did_comp = H5Dcreate2(gid, "Compound_dset9", tid9_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* obj references */ - status = H5Rcreate(&(comp9_buf.objref1), gid, "Compound_dset2", H5R_OBJECT, (hid_t) -1); - status = H5Rcreate(&(comp9_buf.objref2), gid, "Compound_dset3", H5R_OBJECT, (hid_t) -1); - status = H5Rcreate(&(comp9_buf.objref3), gid, "Compound_dset4", H5R_OBJECT, (hid_t) -1); + status = H5Rcreate(&(comp9_buf.objref1), gid, "Compound_dset2", H5R_OBJECT, (hid_t)-1); + status = H5Rcreate(&(comp9_buf.objref2), gid, "Compound_dset3", H5R_OBJECT, (hid_t)-1); + status = H5Rcreate(&(comp9_buf.objref3), gid, "Compound_dset4", H5R_OBJECT, (hid_t)-1); status = H5Dwrite(did_comp, tid9_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp9_buf); if (status < 0) { @@ -4020,12 +4014,12 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int } H5Dclose(did_comp); - did_comp = -1; + did_comp = H5I_INVALID_HID; out: /*----------------------------------------------------------------------- - * Close - *-----------------------------------------------------------------------*/ + * Close + *-----------------------------------------------------------------------*/ if (fid1 > 0) H5Fclose(fid1); if (gid > 0) @@ -4089,59 +4083,60 @@ out: * *-------------------------------------------------------------------------*/ -static int test_enums(const char *fname) +static int +test_enums(const char *fname) { - hid_t fid = -1; + hid_t fid = H5I_INVALID_HID; - hid_t tid = -1; - int enum_val = -1; + hid_t tid = H5I_INVALID_HID; + int enum_val = -1; /* The data in the two arrays cover the following cases: - * - * V = valid enum value, I = invalid enum value - * - * 0: I-I (same value) - * 1: V-I - * 2: I-V - * 3: V-V (same value) - * 4: I-I (different values) SKIPPED FOR NOW - * 5: V-V (different values) - */ + * + * V = valid enum value, I = invalid enum value + * + * 0: I-I (same value) + * 1: V-I + * 2: I-V + * 3: V-V (same value) + * 4: I-I (different values) SKIPPED FOR NOW + * 5: V-V (different values) + */ /* *** NOTE *** - * - * There is a bug in H5Dread() where invalid enum values are always - * returned as -1 so two different invalid enum values cannot be - * properly compared. Test 4 has been adjusted to pass here - * while we fix the issue. - */ - int data1[6] = { 9, 0, 9, 0, 9, 0 }; + * + * There is a bug in H5Dread() where invalid enum values are always + * returned as -1 so two different invalid enum values cannot be + * properly compared. Test 4 has been adjusted to pass here + * while we fix the issue. + */ + int data1[6] = {9, 0, 9, 0, 9, 0}; /*int data1[6] = {9, 0, 9, 0, 8, 0}; */ - int data2[6] = { 9, 9, 0, 0, 9, 1 }; + int data2[6] = {9, 9, 0, 0, 9, 1}; hsize_t dims = 6; herr_t status = SUCCEED; /*----------------------------------------------------------------------- - * Create the file - *---------------------------------------------------------------------*/ + * Create the file + *---------------------------------------------------------------------*/ fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /*----------------------------------------------------------------------- - * Create enum types - *---------------------------------------------------------------------*/ + * Create enum types + *---------------------------------------------------------------------*/ - tid = H5Tenum_create(H5T_NATIVE_INT); + tid = H5Tenum_create(H5T_NATIVE_INT); enum_val = 0; - status = H5Tenum_insert(tid, "YIN", &enum_val); + status = H5Tenum_insert(tid, "YIN", &enum_val); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Tenum_insert failed.\n", fname); status = FAIL; goto out; } enum_val = 1; - status = H5Tenum_insert(tid, "YANG", &enum_val); + status = H5Tenum_insert(tid, "YANG", &enum_val); if (status < 0) { HDfprintf(stderr, "Error: %s> H5Tenum_insert failed.\n", fname); status = FAIL; @@ -4149,8 +4144,8 @@ static int test_enums(const char *fname) } /*----------------------------------------------------------------------- - * Create datasets containing enum data. - *---------------------------------------------------------------------*/ + * Create datasets containing enum data. + *---------------------------------------------------------------------*/ status = write_dset(fid, 1, &dims, "dset1", tid, data1); if (status < 0) { @@ -4167,8 +4162,8 @@ static int test_enums(const char *fname) out: /*----------------------------------------------------------------------- - * Close - *---------------------------------------------------------------------*/ + * Close + *---------------------------------------------------------------------*/ if (fid) H5Fclose(fid); if (tid) @@ -4198,56 +4193,57 @@ out: * Programmer: Jonathan Kim (Sep, 1, 2011) * *-------------------------------------------------------------------------*/ -#define SDIM_DSET 2 +#define SDIM_DSET 2 #define SDIM_CMPD_ARRAY 2 -static void test_comps_array(const char *fname, const char *dset, const char *attr, int diff, int is_file_new) +static void +test_comps_array(const char *fname, const char *dset, const char *attr, int diff, int is_file_new) { /* sub compound 2 */ typedef struct { - int i2; + int i2; float f2; } cmpd2_t; /* top compound 1 */ typedef struct { - int i1; + int i1; cmpd2_t cmpd2[SDIM_CMPD_ARRAY]; } cmpd1_t; cmpd1_t wdata[SDIM_DSET]; /* dataset with compound1 */ - hid_t fid = -1; /* HDF5 File IDs */ - hid_t did_dset = -1; /* Dataset ID */ - hid_t sid_dset = -1; /* Dataset space ID */ - hid_t tid_cmpd1 = -1; /* Compound1 type ID */ - hid_t tid_arry1 = -1; /* Array type ID in compound1 */ - hid_t tid_cmpd2 = -1; /* Compound2 type ID */ - hid_t tid_attr = -1; - hsize_t sdims_dset[] = { SDIM_DSET }; - hsize_t sdims_cmpd_arry[] = { SDIM_CMPD_ARRAY }; - int i, j; - herr_t ret; /* Generic return value */ + hid_t fid = H5I_INVALID_HID; /* HDF5 File IDs */ + hid_t did_dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t sid_dset = H5I_INVALID_HID; /* Dataset space ID */ + hid_t tid_cmpd1 = H5I_INVALID_HID; /* Compound1 type ID */ + hid_t tid_arry1 = H5I_INVALID_HID; /* Array type ID in compound1 */ + hid_t tid_cmpd2 = H5I_INVALID_HID; /* Compound2 type ID */ + hid_t tid_attr = H5I_INVALID_HID; + hsize_t sdims_dset[] = {SDIM_DSET}; + hsize_t sdims_cmpd_arry[] = {SDIM_CMPD_ARRAY}; + int i, j; + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Initialize array data to write */ for (i = 0; i < SDIM_DSET; i++) { wdata[i].i1 = i; for (j = 0; j < SDIM_CMPD_ARRAY; j++) { wdata[i].cmpd2[j].i2 = i * 10 + diff; - wdata[i].cmpd2[j].f2 = (float) i * 10.5F + (float) diff; + wdata[i].cmpd2[j].f2 = (float)i * 10.5F + (float)diff; } /* end for */ } /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ if (is_file_new == 1) fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); else fid = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT); /* ------------------------------- - * Create a sub compound2 datatype */ + * Create a sub compound2 datatype */ tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t)); /* Insert integer field */ @@ -4259,8 +4255,8 @@ static void test_comps_array(const char *fname, const char *dset, const char *at assert(ret >= 0); /*----------------------------------- - * Create a top compound1. - */ + * Create a top compound1. + */ tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t)); ret = H5Tinsert(tid_cmpd1, "int1", HOFFSET(cmpd1_t, i1), H5T_NATIVE_INT); @@ -4273,8 +4269,8 @@ static void test_comps_array(const char *fname, const char *dset, const char *at assert(ret >= 0); /* ------------------- - * Create a dataset - */ + * Create a dataset + */ /* Create dataspace for datasets */ sid_dset = H5Screate_simple(1, sdims_dset, NULL); @@ -4285,15 +4281,15 @@ static void test_comps_array(const char *fname, const char *dset, const char *at assert(ret >= 0); /*----------------------------------- - * Create an attribute in root group - */ + * Create an attribute in root group + */ tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT); assert(tid_attr > 0); ret = H5Awrite(tid_attr, tid_cmpd1, wdata); assert(ret >= 0); /* ---------------- - * Close Dataset */ + * Close Dataset */ ret = H5Aclose(tid_attr); assert(ret >= 0); ret = H5Tclose(tid_arry1); @@ -4310,57 +4306,56 @@ static void test_comps_array(const char *fname, const char *dset, const char *at assert(ret >= 0); } -static void test_comps_vlen(const char * fname, const char *dset, const char *attr, int diff, int is_file_new) +static void +test_comps_vlen(const char *fname, const char *dset, const char *attr, int diff, int is_file_new) { /* sub compound 2 */ typedef struct { - int i2; + int i2; float f2; } cmpd2_t; /* top compound 1 */ typedef struct { - int i1; + int i1; hvl_t vl; /* VL information for compound2 */ } cmpd1_t; cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */ - hid_t fid = -1; /* HDF5 File ID */ - hid_t did_dset = -1; /* dataset ID */ - hid_t sid_dset = -1; /* dataset space ID */ - hid_t tid_attr = -1; - hid_t tid_cmpd2 = -1; /* compound2 type ID */ - hid_t tid_cmpd1 = -1; /* compound1 type ID */ - hid_t tid_cmpd1_vlen = -1; - hsize_t sdims_dset[] = { SDIM_DSET }; + hid_t fid = H5I_INVALID_HID; /* HDF5 File ID */ + hid_t did_dset = H5I_INVALID_HID; /* dataset ID */ + hid_t sid_dset = H5I_INVALID_HID; /* dataset space ID */ + hid_t tid_attr = H5I_INVALID_HID; + hid_t tid_cmpd2 = H5I_INVALID_HID; /* compound2 type ID */ + hid_t tid_cmpd1 = H5I_INVALID_HID; /* compound1 type ID */ + hid_t tid_cmpd1_vlen = H5I_INVALID_HID; + hsize_t sdims_dset[] = {SDIM_DSET}; - unsigned i, j; /* counting variables */ - herr_t ret; /* Generic return value */ + unsigned i, j; /* counting variables */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Allocate and initialize VL data to write */ for (i = 0; i < SDIM_DSET; i++) { - wdata[i].i1 = (int) i; - wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t)); + wdata[i].i1 = (int)i; + wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t)); wdata[i].vl.len = i + 1; for (j = 0; j < (i + 1); j++) { - ((cmpd2_t *) wdata[i].vl.p)[j].i2 = - (int) (i * 10 + (unsigned) diff); - ((cmpd2_t *) wdata[i].vl.p)[j].f2 = (float) i * 10.5F - + (float) diff; + ((cmpd2_t *)wdata[i].vl.p)[j].i2 = (int)(i * 10 + (unsigned)diff); + ((cmpd2_t *)wdata[i].vl.p)[j].f2 = (float)i * 10.5F + (float)diff; } /* end for */ - } /* end for */ + } /* end for */ /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ if (is_file_new == 1) fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); else fid = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT); /* ----------------------------- - * Create sub compound2 type */ + * Create sub compound2 type */ tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t)); /* Insert fields */ @@ -4370,7 +4365,7 @@ static void test_comps_vlen(const char * fname, const char *dset, const char *at assert(ret >= 0); /* --------------------------- - * Create top compound1 type */ + * Create top compound1 type */ tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t)); /* Insert fields */ ret = H5Tinsert(tid_cmpd1, "int1", HOFFSET(cmpd1_t, i1), H5T_NATIVE_INT); @@ -4382,8 +4377,8 @@ static void test_comps_vlen(const char * fname, const char *dset, const char *at assert(ret >= 0); /* ------------------------------- - * Create dataset with compound1 - */ + * Create dataset with compound1 + */ /* Create dataspace for dataset */ sid_dset = H5Screate_simple(1, sdims_dset, NULL); @@ -4395,19 +4390,19 @@ static void test_comps_vlen(const char * fname, const char *dset, const char *at assert(ret >= 0); /*----------------------------------- - * Create an attribute in root group - */ + * Create an attribute in root group + */ tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT); assert(tid_attr > 0); ret = H5Awrite(tid_attr, tid_cmpd1, wdata); assert(ret >= 0); /* Reclaim the write VL data */ - ret = H5Dvlen_reclaim(tid_cmpd1, sid_dset, H5P_DEFAULT, wdata); + ret = H5Treclaim(tid_cmpd1, sid_dset, H5P_DEFAULT, wdata); assert(ret >= 0); /* ---------------- - * Close IDs */ + * Close IDs */ ret = H5Aclose(tid_attr); assert(ret >= 0); ret = H5Dclose(did_dset); @@ -4424,60 +4419,59 @@ static void test_comps_vlen(const char * fname, const char *dset, const char *at assert(ret >= 0); } -static void test_comps_array_vlen(const char * fname, const char *dset, const char *attr, int diff, int is_file_new) +static void +test_comps_array_vlen(const char *fname, const char *dset, const char *attr, int diff, int is_file_new) { typedef struct { - int i3; + int i3; float f3; } cmpd3_t; typedef struct { /* Typedef for compound datatype */ - int i2; + int i2; hvl_t vl; /* VL information to write */ } cmpd2_t; typedef struct { - int i1; + int i1; cmpd2_t cmpd2[SDIM_CMPD_ARRAY]; } cmpd1_t; - cmpd1_t wdata[SDIM_DSET]; /* Information to write */ - hid_t fid = -1; /* HDF5 File IDs */ - hid_t did_dset = -1; /* Dataset ID */ - hid_t sid_dset = -1; /* Dataspace ID */ - hid_t tid_attr = -1; - hid_t tid_cmpd1 = -1; /* Compound1 Datatype ID */ - hid_t tid_arry1 = -1; /* Array Datatype ID */ - hid_t tid_cmpd2 = -1; /* Compound2 Datatype ID */ - hid_t tid_cmpd2_vlen = -1; - hid_t tid_cmpd3 = -1; /* Compound3 Datatype ID */ - hsize_t sdims_dset[] = { SDIM_DSET }; - hsize_t sdims_arry[] = { SDIM_CMPD_ARRAY }; - unsigned i, j, k; /* counting variables */ - herr_t ret; /* Generic return value */ + cmpd1_t wdata[SDIM_DSET]; /* Information to write */ + hid_t fid = H5I_INVALID_HID; /* HDF5 File IDs */ + hid_t did_dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t sid_dset = H5I_INVALID_HID; /* Dataspace ID */ + hid_t tid_attr = H5I_INVALID_HID; + hid_t tid_cmpd1 = H5I_INVALID_HID; /* Compound1 Datatype ID */ + hid_t tid_arry1 = H5I_INVALID_HID; /* Array Datatype ID */ + hid_t tid_cmpd2 = H5I_INVALID_HID; /* Compound2 Datatype ID */ + hid_t tid_cmpd2_vlen = H5I_INVALID_HID; + hid_t tid_cmpd3 = H5I_INVALID_HID; /* Compound3 Datatype ID */ + hsize_t sdims_dset[] = {SDIM_DSET}; + hsize_t sdims_arry[] = {SDIM_CMPD_ARRAY}; + unsigned i, j, k; /* counting variables */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Initialize array data to write in compound1 */ for (i = 0; i < SDIM_DSET; i++) { - wdata[i].i1 = (int) i; + wdata[i].i1 = (int)i; /* Allocate and initialize VL data to write in compound2 */ for (j = 0; j < SDIM_CMPD_ARRAY; j++) { - wdata[i].cmpd2[j].i2 = (int) (j * 10); - wdata[i].cmpd2[j].vl.p = HDmalloc((j + 1) * sizeof(cmpd3_t)); + wdata[i].cmpd2[j].i2 = (int)(j * 10); + wdata[i].cmpd2[j].vl.p = HDmalloc((j + 1) * sizeof(cmpd3_t)); wdata[i].cmpd2[j].vl.len = j + 1; for (k = 0; k < (j + 1); k++) { /* Initialize data of compound3 */ - ((cmpd3_t *) wdata[i].cmpd2[j].vl.p)[k].i3 = (int) j * 10 - + diff; - ((cmpd3_t *) wdata[i].cmpd2[j].vl.p)[k].f3 = (float) j * 10.5F - + (float) diff; + ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].i3 = (int)j * 10 + diff; + ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].f3 = (float)j * 10.5F + (float)diff; } /* end for */ - } /* end for */ + } /* end for */ } /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ if (is_file_new == 1) fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); else @@ -4487,7 +4481,7 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch sid_dset = H5Screate_simple(1, sdims_dset, NULL); /*------------------------------------- - * Create a sub compound3 datatype */ + * Create a sub compound3 datatype */ tid_cmpd3 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd3_t)); /* Insert integer field */ @@ -4499,7 +4493,7 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch assert(ret >= 0); /*------------------------------------- - * Create a sub compound2 datatype */ + * Create a sub compound2 datatype */ tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t)); /* Insert integer field */ @@ -4507,12 +4501,12 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch assert(ret >= 0); /* Create a VL datatype */ tid_cmpd2_vlen = H5Tvlen_create(tid_cmpd3); - ret = H5Tinsert(tid_cmpd2, "vlen", HOFFSET(cmpd2_t, vl), tid_cmpd2_vlen); + ret = H5Tinsert(tid_cmpd2, "vlen", HOFFSET(cmpd2_t, vl), tid_cmpd2_vlen); assert(ret >= 0); /*----------------------------------- - * Create a top compound1 datatype for dataset. - */ + * Create a top compound1 datatype for dataset. + */ tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t)); /* Create an array datatype */ @@ -4521,7 +4515,7 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch H5Tinsert(tid_cmpd1, "array_comp", HOFFSET(cmpd1_t, cmpd2), tid_arry1); /* ---------------------- - * Create a dataset */ + * Create a dataset */ did_dset = H5Dcreate2(fid, dset, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Write dataset to disk */ @@ -4529,19 +4523,19 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch assert(ret >= 0); /*----------------------------------- - * Create an attribute in root group - */ + * Create an attribute in root group + */ tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT); assert(tid_attr > 0); ret = H5Awrite(tid_attr, tid_cmpd1, wdata); assert(ret >= 0); /* Reclaim the write VL data */ - ret = H5Dvlen_reclaim(tid_cmpd1, sid_dset, H5P_DEFAULT, wdata); + ret = H5Treclaim(tid_cmpd1, sid_dset, H5P_DEFAULT, wdata); assert(ret >= 0); /*------------------- - * Close IDs */ + * Close IDs */ ret = H5Aclose(tid_attr); assert(ret >= 0); ret = H5Tclose(tid_arry1); @@ -4562,70 +4556,71 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch assert(ret >= 0); } -static void test_comps_vlen_arry(const char * fname, const char *dset, const char *attr, int diff, int is_file_new) +static void +test_comps_vlen_arry(const char *fname, const char *dset, const char *attr, int diff, int is_file_new) { /* sub compound 3 */ typedef struct { - int i3; + int i3; float f3; } cmpd3_t; /* sub compound 2 */ typedef struct { - int i2; + int i2; cmpd3_t cmpd3[SDIM_CMPD_ARRAY]; } cmpd2_t; /* top compound 1 */ typedef struct { - int i1; + int i1; hvl_t vl; /* VL information for compound2 */ } cmpd1_t; cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */ - hid_t fid = -1; /* HDF5 File ID */ - hid_t did_dset = -1; /* dataset ID */ - hid_t sid_dset = -1; /* dataset space ID */ - hid_t tid_attr = -1; - hid_t tid_cmpd3 = -1; /* compound3 type ID */ - hid_t tid_cmpd2 = -1; /* compound2 type ID */ - hid_t tid_cmpd2_arry = -1; - hid_t tid_cmpd1 = -1; /* compound1 type ID */ - hid_t tid_cmpd1_vlen = -1; - hsize_t sdims_dset[] = { SDIM_DSET }; - hsize_t sdims_cmpd_arry[] = { SDIM_CMPD_ARRAY }; - - unsigned i, j, k; /* counting variables */ - herr_t ret; /* Generic return value */ + hid_t fid = H5I_INVALID_HID; /* HDF5 File ID */ + hid_t did_dset = H5I_INVALID_HID; /* dataset ID */ + hid_t sid_dset = H5I_INVALID_HID; /* dataset space ID */ + hid_t tid_attr = H5I_INVALID_HID; + hid_t tid_cmpd3 = H5I_INVALID_HID; /* compound3 type ID */ + hid_t tid_cmpd2 = H5I_INVALID_HID; /* compound2 type ID */ + hid_t tid_cmpd2_arry = H5I_INVALID_HID; + hid_t tid_cmpd1 = H5I_INVALID_HID; /* compound1 type ID */ + hid_t tid_cmpd1_vlen = H5I_INVALID_HID; + hsize_t sdims_dset[] = {SDIM_DSET}; + hsize_t sdims_cmpd_arry[] = {SDIM_CMPD_ARRAY}; + + unsigned i, j, k; /* counting variables */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Allocate and initialize VL data to write */ for (i = 0; i < SDIM_DSET; i++) { /* compound 1 data */ - wdata[i].i1 = (int) i; - wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t)); + wdata[i].i1 = (int)i; + wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t)); wdata[i].vl.len = i + 1; for (j = 0; j < (i + 1); j++) { /* compound2 data */ - ((cmpd2_t *) wdata[i].vl.p)[j].i2 = (int) i * 10 + diff; + ((cmpd2_t *)wdata[i].vl.p)[j].i2 = (int)i * 10 + diff; for (k = 0; k < SDIM_CMPD_ARRAY; k++) { /* compound 3 data */ - ((cmpd2_t *) (wdata[i].vl.p))[j].cmpd3[k].i3 = (int) ((float) k * 10.5F) + diff; - ((cmpd2_t *) (wdata[i].vl.p))[j].cmpd3[k].f3 = (float) k * 10.5F + (float) diff; + ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].i3 = (int)((float)k * 10.5F) + diff; + ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].f3 = (float)k * 10.5F + (float)diff; } /* end for */ - } /* end for */ - } /* end for */ + } /* end for */ + } /* end for */ /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ if (is_file_new == 1) fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); else fid = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT); /* ----------------------------- - * Create sub compound3 type */ + * Create sub compound3 type */ tid_cmpd3 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd3_t)); /* Insert fields */ @@ -4635,56 +4630,55 @@ static void test_comps_vlen_arry(const char * fname, const char *dset, const cha assert(ret >= 0); /* ----------------------------- - * Create sub compound2 type */ + * Create sub compound2 type */ tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t)); ret = H5Tinsert(tid_cmpd2, "int2", HOFFSET(cmpd2_t, i2), H5T_NATIVE_INT); assert(ret >= 0); tid_cmpd2_arry = H5Tarray_create2(tid_cmpd3, 1, sdims_cmpd_arry); - ret = H5Tinsert(tid_cmpd2, "array_cmpd2", HOFFSET(cmpd2_t, cmpd3), tid_cmpd2_arry); + ret = H5Tinsert(tid_cmpd2, "array_cmpd2", HOFFSET(cmpd2_t, cmpd3), tid_cmpd2_arry); assert(ret >= 0); /* --------------------------- - * Create top compound1 type - */ + * Create top compound1 type + */ /* Create a VL datatype */ tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t)); /* Insert fields */ ret = H5Tinsert(tid_cmpd1, "int1", HOFFSET(cmpd1_t, i1), H5T_NATIVE_INT); assert(ret >= 0); tid_cmpd1_vlen = H5Tvlen_create(tid_cmpd2); - ret = H5Tinsert(tid_cmpd1, "vlen_cmpd1", HOFFSET(cmpd1_t, vl), tid_cmpd1_vlen); + ret = H5Tinsert(tid_cmpd1, "vlen_cmpd1", HOFFSET(cmpd1_t, vl), tid_cmpd1_vlen); assert(ret >= 0); /* ------------------------------- - * Create dataset with compound1 - */ + * Create dataset with compound1 + */ /* Create dataspace for dataset */ sid_dset = H5Screate_simple(1, sdims_dset, NULL); /* Create a dataset */ - did_dset = H5Dcreate2(fid, dset, tid_cmpd1, sid_dset, H5P_DEFAULT, - H5P_DEFAULT, H5P_DEFAULT); + did_dset = H5Dcreate2(fid, dset, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Write dataset to disk */ ret = H5Dwrite(did_dset, tid_cmpd1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); assert(ret >= 0); /*----------------------------------- - * Create an attribute in root group - */ + * Create an attribute in root group + */ tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT); assert(tid_attr > 0); ret = H5Awrite(tid_attr, tid_cmpd1, wdata); assert(ret >= 0); /* Reclaim the write VL data */ - ret = H5Dvlen_reclaim(tid_cmpd1, sid_dset, H5P_DEFAULT, wdata); + ret = H5Treclaim(tid_cmpd1, sid_dset, H5P_DEFAULT, wdata); assert(ret >= 0); /* ---------------- - * Close IDs */ + * Close IDs */ ret = H5Aclose(tid_attr); assert(ret >= 0); ret = H5Dclose(did_dset); @@ -4715,83 +4709,83 @@ static void test_comps_vlen_arry(const char * fname, const char *dset, const cha * *-------------------------------------------------------------------------*/ #define DIM_ARRY 3 -static void test_data_nocomparables(const char * fname, int make_diffs) +static void +test_data_nocomparables(const char *fname, int make_diffs) { - hid_t fid = -1; - hid_t gid1 = -1; - hid_t gid2 = -1; - hid_t did1 = -1; - hid_t did2 = -1; - hid_t sid1 = -1; - hid_t tid_dset1 = -1; - hid_t tid_attr1 = -1; - hsize_t dims1_1[1] = { DIM_ARRY }; - hsize_t dims1_2[1] = { DIM_ARRY + 1 }; - hsize_t dims2[2] = { DIM_ARRY, 1 }; - int data1[DIM_ARRY] = { 0, 0, 0 }; - int data2[DIM_ARRY] = { 1, 1, 1 }; - int data3[DIM_ARRY + 1] = { 1, 1, 1, 1 }; - int data1_dim2[DIM_ARRY][1] = { { 0 }, { 0 }, { 0 } }; - int rank_attr; - char data1_str[DIM_ARRY][STR_SIZE] = { "ab", "cd", "ef" }; - herr_t status = SUCCEED; - void *dset_data_ptr1 = NULL; - void *dset_data_ptr2 = NULL; - void *dset_data_ptr3 = NULL; - void *attr_data_ptr1 = NULL; - void *attr_data_ptr2 = NULL; - void *attr_data_ptr3 = NULL; - void *attr_data_ptr4 = NULL; - void *attr2_dim_ptr = NULL; - void *attr3_dim_ptr = NULL; + hid_t fid = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID; + hid_t gid2 = H5I_INVALID_HID; + hid_t did1 = H5I_INVALID_HID; + hid_t did2 = H5I_INVALID_HID; + hid_t sid1 = H5I_INVALID_HID; + hid_t tid_dset1 = H5I_INVALID_HID; + hid_t tid_attr1 = H5I_INVALID_HID; + hsize_t dims1_1[1] = {DIM_ARRY}; + hsize_t dims1_2[1] = {DIM_ARRY + 1}; + hsize_t dims2[2] = {DIM_ARRY, 1}; + int data1[DIM_ARRY] = {0, 0, 0}; + int data2[DIM_ARRY] = {1, 1, 1}; + int data3[DIM_ARRY + 1] = {1, 1, 1, 1}; + int data1_dim2[DIM_ARRY][1] = {{0}, {0}, {0}}; + int rank_attr; + char data1_str[DIM_ARRY][STR_SIZE] = {"ab", "cd", "ef"}; + herr_t status = SUCCEED; + void * dset_data_ptr1 = NULL; + void * dset_data_ptr2 = NULL; + void * dset_data_ptr3 = NULL; + void * attr_data_ptr1 = NULL; + void * attr_data_ptr2 = NULL; + void * attr_data_ptr3 = NULL; + void * attr_data_ptr4 = NULL; + void * attr2_dim_ptr = NULL; + void * attr3_dim_ptr = NULL; /* init */ - tid_dset1 = H5Tcopy(H5T_NATIVE_INT); - dset_data_ptr1 = (int*) &data1; - dset_data_ptr2 = (int*) &data1; - dset_data_ptr3 = (int*) &data1; - tid_attr1 = H5Tcopy(H5T_NATIVE_INT); - attr_data_ptr1 = (int*) &data1; - attr_data_ptr3 = (int*) &data1; - attr_data_ptr4 = (int*) &data1; - attr2_dim_ptr = (hsize_t*) &dims1_1; - attr3_dim_ptr = (hsize_t*) &dims1_1; - rank_attr = 1; + tid_dset1 = H5Tcopy(H5T_NATIVE_INT); + dset_data_ptr1 = (int *)&data1; + dset_data_ptr2 = (int *)&data1; + dset_data_ptr3 = (int *)&data1; + tid_attr1 = H5Tcopy(H5T_NATIVE_INT); + attr_data_ptr1 = (int *)&data1; + attr_data_ptr3 = (int *)&data1; + attr_data_ptr4 = (int *)&data1; + attr2_dim_ptr = (hsize_t *)&dims1_1; + attr3_dim_ptr = (hsize_t *)&dims1_1; + rank_attr = 1; if (make_diffs) { /* ------------ - * group1 */ + * group1 */ tid_dset1 = H5Tcopy(H5T_C_S1); - H5Tset_size(tid_dset1, (size_t) STR_SIZE); - dset_data_ptr1 = (char*) &data1_str; - dset_data_ptr2 = (int*) &data2; - attr_data_ptr1 = (int*) &data2; + H5Tset_size(tid_dset1, (size_t)STR_SIZE); + dset_data_ptr1 = (char *)&data1_str; + dset_data_ptr2 = (int *)&data2; + attr_data_ptr1 = (int *)&data2; /* ----------- - * group2 - */ - dset_data_ptr3 = (int*) &data2; + * group2 + */ + dset_data_ptr3 = (int *)&data2; /* dset1/attr1 */ tid_attr1 = H5Tcopy(H5T_C_S1); - H5Tset_size(tid_attr1, (size_t) STR_SIZE); - attr_data_ptr2 = (char*) &data1_str; + H5Tset_size(tid_attr1, (size_t)STR_SIZE); + attr_data_ptr2 = (char *)&data1_str; /* dset1/attr2 */ - attr2_dim_ptr = (hsize_t*) &dims1_2; + attr2_dim_ptr = (hsize_t *)&dims1_2; /* dset1/attr3 */ - attr_data_ptr3 = (int*) &data1_dim2; - attr3_dim_ptr = (hsize_t*) &dims2; - rank_attr = 2; + attr_data_ptr3 = (int *)&data1_dim2; + attr3_dim_ptr = (hsize_t *)&dims2; + rank_attr = 2; /* dset1/attr4 */ - attr_data_ptr4 = (int*) &data2; - + attr_data_ptr4 = (int *)&data2; } /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid < 0) { HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname); @@ -4800,8 +4794,8 @@ static void test_data_nocomparables(const char * fname, int make_diffs) } /*----------------------------------------------------------------------- - * Groups - *------------------------------------------------------------------------*/ + * Groups + *------------------------------------------------------------------------*/ gid1 = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1 < 0) { HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname); @@ -4817,8 +4811,8 @@ static void test_data_nocomparables(const char * fname, int make_diffs) } /*----------------------------------------------------------------------- - * Datasets in /g1 - *------------------------------------------------------------------------*/ + * Datasets in /g1 + *------------------------------------------------------------------------*/ if ((sid1 = H5Screate_simple(1, dims1_1, NULL)) < 0) goto out; @@ -4844,10 +4838,10 @@ static void test_data_nocomparables(const char * fname, int make_diffs) } /*----------------------------------------------------------------------- - * Datasets in /g2 - *------------------------------------------------------------------------*/ + * Datasets in /g2 + *------------------------------------------------------------------------*/ /* --------- - * dset1 */ + * dset1 */ if ((did2 = H5Dcreate2(gid2, "dset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { HDfprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", "dset1"); status = FAIL; @@ -4862,17 +4856,17 @@ static void test_data_nocomparables(const char * fname, int make_diffs) /* attr1 - non-compatible : different type */ write_attr(did2, 1, dims1_1, "attr1", tid_attr1, attr_data_ptr2); - /* attr2 - non-compatible : same rank, different dimention */ - write_attr(did2, 1, (hsize_t *) attr2_dim_ptr, "attr2", H5T_NATIVE_INT, data3); + /* attr2 - non-compatible : same rank, different dimension */ + write_attr(did2, 1, (hsize_t *)attr2_dim_ptr, "attr2", H5T_NATIVE_INT, data3); /* attr3 - non-compatible : different rank */ - write_attr(did2, rank_attr, (hsize_t *) attr3_dim_ptr, "attr3", H5T_NATIVE_INT, attr_data_ptr3); + write_attr(did2, rank_attr, (hsize_t *)attr3_dim_ptr, "attr3", H5T_NATIVE_INT, attr_data_ptr3); /* attr4 - compatible : different data values */ write_attr(did2, 1, dims1_1, "attr4", H5T_NATIVE_INT, attr_data_ptr4); /*---------- - * dset2 */ + * dset2 */ status = write_dset(gid2, 1, dims1_1, "dset2", H5T_NATIVE_INT, dset_data_ptr3); if (status == FAIL) { HDfprintf(stderr, "Error: %s> write_dset failed\n", fname); @@ -4882,8 +4876,8 @@ static void test_data_nocomparables(const char * fname, int make_diffs) out: /*----------------------------------------------------------------------- - * Close IDs - *-----------------------------------------------------------------------*/ + * Close IDs + *-----------------------------------------------------------------------*/ if (fid) H5Fclose(fid); if (gid1) @@ -4913,95 +4907,96 @@ out: static void test_objs_nocomparables(const char *fname1, const char *fname2) { - hid_t fid1 = -1; - hid_t fid2 = -1; - hid_t topgid1 = -1; - hid_t topgid2 = -1; - hid_t gid1 = -1; - hid_t tid1 = -1; - hid_t gid2 = -1; - hid_t tid2 = -1; - hsize_t dims[1] = { DIM_ARRY }; - int data1[DIM_ARRY] = { 1, 1, 1 }; - int data2[DIM_ARRY] = { 2, 2, 2 }; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t topgid1 = H5I_INVALID_HID; + hid_t topgid2 = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID; + hid_t tid1 = H5I_INVALID_HID; + hid_t gid2 = H5I_INVALID_HID; + hid_t tid2 = H5I_INVALID_HID; + hsize_t dims[1] = {DIM_ARRY}; + int data1[DIM_ARRY] = {1, 1, 1}; + int data2[DIM_ARRY] = {2, 2, 2}; /*----------------------------------------------------------------------- - * Open file(s) to add objects - *------------------------------------------------------------------------*/ + * Open file(s) to add objects + *------------------------------------------------------------------------*/ /* file1 */ - if((fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) - PROGRAM_ERROR + if ((fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PROGRAM_ERROR; /* file2 */ - if((fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) - PROGRAM_ERROR + if ((fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PROGRAM_ERROR; /*----------------------------------------------------------------------- - * in file1 : add member objects - *------------------------------------------------------------------------*/ + * in file1 : add member objects + *------------------------------------------------------------------------*/ /* parent group */ - if((topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - PROGRAM_ERROR + if ((topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR; /* dataset */ - if(write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1) < 0) - PROGRAM_ERROR + if (write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1) < 0) + PROGRAM_ERROR; /* group */ - if((gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - PROGRAM_ERROR + if ((gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR; /* committed type */ - if((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0) - PROGRAM_ERROR - if(H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) - PROGRAM_ERROR + if ((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0) + PROGRAM_ERROR; + if (H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + PROGRAM_ERROR; /*----------------------------------------------------------------------- - * in file2 : add member objects - *------------------------------------------------------------------------*/ + * in file2 : add member objects + *------------------------------------------------------------------------*/ /* parent group */ - if((topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - PROGRAM_ERROR + if ((topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR; /* group */ - if((gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - PROGRAM_ERROR + if ((gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR; /* committed type */ - if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) - PROGRAM_ERROR - if(H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) - PROGRAM_ERROR + if ((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) + PROGRAM_ERROR; + if (H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + PROGRAM_ERROR; /* dataset */ - if(write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2) < 0) - PROGRAM_ERROR + if (write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2) < 0) + PROGRAM_ERROR; /*----------------------------------------------------------------------- - * Close IDs - *-----------------------------------------------------------------------*/ - if(H5Fclose(fid1) < 0) - PROGRAM_ERROR - if(H5Fclose(fid2) < 0) - PROGRAM_ERROR - if(H5Gclose(topgid1) < 0) - PROGRAM_ERROR - if(H5Gclose(topgid2) < 0) - PROGRAM_ERROR - if(H5Gclose(gid1) < 0) - PROGRAM_ERROR - if(H5Gclose(gid2) < 0) - PROGRAM_ERROR - if(H5Tclose(tid1) < 0) - PROGRAM_ERROR - if(H5Tclose(tid2) < 0) - PROGRAM_ERROR + * Close IDs + *-----------------------------------------------------------------------*/ + if (H5Fclose(fid1) < 0) + PROGRAM_ERROR; + if (H5Fclose(fid2) < 0) + PROGRAM_ERROR; + if (H5Gclose(topgid1) < 0) + PROGRAM_ERROR; + if (H5Gclose(topgid2) < 0) + PROGRAM_ERROR; + if (H5Gclose(gid1) < 0) + PROGRAM_ERROR; + if (H5Gclose(gid2) < 0) + PROGRAM_ERROR; + if (H5Tclose(tid1) < 0) + PROGRAM_ERROR; + if (H5Tclose(tid2) < 0) + PROGRAM_ERROR; return; error: - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Fclose(fid1); H5Fclose(fid2); H5Gclose(topgid1); @@ -5010,18 +5005,18 @@ error: H5Gclose(gid2); H5Tclose(tid1); H5Tclose(tid2); - } H5E_END_TRY; - - return; + } + H5E_END_TRY; } -static hid_t mkstr(int size, H5T_str_t pad) +static hid_t +mkstr(int size, H5T_str_t pad) { hid_t type; if ((type = H5Tcopy(H5T_C_S1)) < 0) return -1; - if (H5Tset_size(type, (size_t) size) < 0) + if (H5Tset_size(type, (size_t)size) < 0) return -1; if (H5Tset_strpad(type, pad) < 0) return -1; @@ -5037,51 +5032,44 @@ static hid_t mkstr(int size, H5T_str_t pad) * types. * h5diff should show differences output from these common objects. *-------------------------------------------------------------------------*/ -static void test_objs_strings(const char *fname1, const char *fname2) +static void +test_objs_strings(const char *fname1, const char *fname2) { - hid_t fid1 = -1; - hid_t fid2 = -1; - hid_t dataset = -1; - hid_t space = -1; - hid_t f_type = -1; - hid_t m_type = -1; - hsize_t dims1[] = { 3, 4 }; - char string1A[12][3] = { "s1", "s2", "s3", "s4", "s5", "s6", "s", "s", "s9", - "s0", "s1", "s2" }; - char string1B[12][3] = { "s1", "s2", "s3", "s4", "s", "s", "s7", "s8", "s9", - "s0", "s1", "s2" }; - - hsize_t dims2[] = { 20 }; - char string2A[20][10] = { "ab cd ef1", "ab cd ef2", "ab cd ef3", - "ab cd ef4", "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8", - "ab cd 9", "ab cd 0", "ab cd 1", "ab cd 2", "ab cd ef3", - "ab cd ef4", "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8", - "ab cd ef9", "ab cd ef0" }; - char string2B[20][10] = { "ab cd ef1", "ab cd ef2", "ab cd ef3", - "ab cd ef4", "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8", - "ab cd ef9", "ab cd ef0", "ab cd ef1", "ab cd ef2", "ab cd 3", - "ab cd 4", "ab cd 5", "ab cd 6", "ab cd ef7", "ab cd ef8", - "ab cd ef9", "ab cd ef0" }; - - hsize_t dims3[] = { 27 }; - char string3A[27][6] = { "abcd0", "abcd1", "abcd2", "abcd3", "abcd4", - "abcd5", "abcd6", "abcd7", "abcd8", "abcd9", "abcd0", "abcd1", - "abd2", "abc3", "bcd4", "acd5", "abcd6", "abcd7", "abcd8", "abcd9", - "abcd0", "abcd1", "abcd2", "abcd3", "abc4", "abc5", "abc6" }; - char string3B[27][6] = { "abcd0", "abcd1", "abcd2", "abcd3", "abcd4", - "abcd5", "abcd6", "abcd7", "abcd8", "abcd9", "abcd0", "abcd1", - "abcd2", "abcd3", "abcd4", "abcd5", "abd6", "abc7", "bcd8", "acd9", - "abcd0", "abcd1", "abcd2", "abcd3", "abd4", "abd5", "abd6" }; - - hsize_t dims4[] = { 3 }; - char string4A[3][21] = { "s1234567890123456789", "s1234567890123456789", - "s12345678901234567" }; - char string4B[3][21] = { "s1234567890123456789", "s12345678901234567", - "s1234567890123456789" }; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t dataset = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t f_type = H5I_INVALID_HID; + hid_t m_type = H5I_INVALID_HID; + hsize_t dims1[] = {3, 4}; + char string1A[12][3] = {"s1", "s2", "s3", "s4", "s5", "s6", "s", "s", "s9", "s0", "s1", "s2"}; + char string1B[12][3] = {"s1", "s2", "s3", "s4", "s", "s", "s7", "s8", "s9", "s0", "s1", "s2"}; + + hsize_t dims2[] = {20}; + char string2A[20][10] = {"ab cd ef1", "ab cd ef2", "ab cd ef3", "ab cd ef4", "ab cd ef5", + "ab cd ef6", "ab cd ef7", "ab cd ef8", "ab cd 9", "ab cd 0", + "ab cd 1", "ab cd 2", "ab cd ef3", "ab cd ef4", "ab cd ef5", + "ab cd ef6", "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0"}; + char string2B[20][10] = {"ab cd ef1", "ab cd ef2", "ab cd ef3", "ab cd ef4", "ab cd ef5", + "ab cd ef6", "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0", + "ab cd ef1", "ab cd ef2", "ab cd 3", "ab cd 4", "ab cd 5", + "ab cd 6", "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0"}; + + hsize_t dims3[] = {27}; + char string3A[27][6] = {"abcd0", "abcd1", "abcd2", "abcd3", "abcd4", "abcd5", "abcd6", "abcd7", "abcd8", + "abcd9", "abcd0", "abcd1", "abd2", "abc3", "bcd4", "acd5", "abcd6", "abcd7", + "abcd8", "abcd9", "abcd0", "abcd1", "abcd2", "abcd3", "abc4", "abc5", "abc6"}; + char string3B[27][6] = {"abcd0", "abcd1", "abcd2", "abcd3", "abcd4", "abcd5", "abcd6", "abcd7", "abcd8", + "abcd9", "abcd0", "abcd1", "abcd2", "abcd3", "abcd4", "abcd5", "abd6", "abc7", + "bcd8", "acd9", "abcd0", "abcd1", "abcd2", "abcd3", "abd4", "abd5", "abd6"}; + + hsize_t dims4[] = {3}; + char string4A[3][21] = {"s1234567890123456789", "s1234567890123456789", "s12345678901234567"}; + char string4B[3][21] = {"s1234567890123456789", "s12345678901234567", "s1234567890123456789"}; /*----------------------------------------------------------------------- - * Create file(s) - *------------------------------------------------------------------------*/ + * Create file(s) + *------------------------------------------------------------------------*/ /* file1 */ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { @@ -5097,9 +5085,9 @@ static void test_objs_strings(const char *fname1, const char *fname2) } /* string 1 : nullterm string */ - space = H5Screate_simple(2, dims1, NULL); - f_type = mkstr(5, H5T_STR_NULLTERM); - m_type = mkstr(3, H5T_STR_NULLTERM); + space = H5Screate_simple(2, dims1, NULL); + f_type = mkstr(5, H5T_STR_NULLTERM); + m_type = mkstr(3, H5T_STR_NULLTERM); dataset = H5Dcreate2(fid1, "/string1", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string1A); H5Dclose(dataset); @@ -5111,9 +5099,9 @@ static void test_objs_strings(const char *fname1, const char *fname2) H5Dclose(dataset); /* string 2 : space pad string */ - space = H5Screate_simple(1, dims2, NULL); - f_type = mkstr(11, H5T_STR_SPACEPAD); - m_type = mkstr(10, H5T_STR_NULLTERM); + space = H5Screate_simple(1, dims2, NULL); + f_type = mkstr(11, H5T_STR_SPACEPAD); + m_type = mkstr(10, H5T_STR_NULLTERM); dataset = H5Dcreate2(fid1, "/string2", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string2A); H5Dclose(dataset); @@ -5125,9 +5113,9 @@ static void test_objs_strings(const char *fname1, const char *fname2) H5Dclose(dataset); /* string 3 : null pad string */ - space = H5Screate_simple(1, dims3, NULL); - f_type = mkstr(8, H5T_STR_NULLPAD); - m_type = mkstr(6, H5T_STR_NULLTERM); + space = H5Screate_simple(1, dims3, NULL); + f_type = mkstr(8, H5T_STR_NULLPAD); + m_type = mkstr(6, H5T_STR_NULLTERM); dataset = H5Dcreate2(fid1, "/string3", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string3A); H5Dclose(dataset); @@ -5139,9 +5127,9 @@ static void test_objs_strings(const char *fname1, const char *fname2) H5Dclose(dataset); /* string 4 : space pad long string */ - space = H5Screate_simple(1, dims4, NULL); - f_type = mkstr(168, H5T_STR_SPACEPAD); - m_type = mkstr(21, H5T_STR_NULLTERM); + space = H5Screate_simple(1, dims4, NULL); + f_type = mkstr(168, H5T_STR_SPACEPAD); + m_type = mkstr(21, H5T_STR_NULLTERM); dataset = H5Dcreate2(fid1, "/string4", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string4A); H5Dclose(dataset); @@ -5167,10 +5155,10 @@ static void test_objs_strings(const char *fname1, const char *fname2) string4B[2][11] = 'a'; string4B[2][12] = 'B'; string4B[2][13] = 'c'; - space = H5Screate_simple(1, dims4, NULL); - f_type = mkstr(168, H5T_STR_NULLTERM); - m_type = mkstr(21, H5T_STR_NULLTERM); - dataset = H5Dcreate2(fid1, "/string5", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + space = H5Screate_simple(1, dims4, NULL); + f_type = mkstr(168, H5T_STR_NULLTERM); + m_type = mkstr(21, H5T_STR_NULLTERM); + dataset = H5Dcreate2(fid1, "/string5", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string4A); H5Dclose(dataset); dataset = H5Dcreate2(fid2, "/string5", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -5182,8 +5170,8 @@ static void test_objs_strings(const char *fname1, const char *fname2) out: /*----------------------------------------------------------------------- - * Close IDs - *-----------------------------------------------------------------------*/ + * Close IDs + *-----------------------------------------------------------------------*/ if (fid1) H5Fclose(fid1); if (fid2) @@ -5198,78 +5186,77 @@ out: * *------------------------------------------------------------------------- */ -static -void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs /* flag to modify data buffers */) +static void +write_attr_strings(hid_t loc_id, const char *dset_name, hid_t fid, + int make_diffs /* flag to modify data buffers */) { /* Compound datatype */ typedef struct s_t { - char a; + char a; double b; } s_t; - typedef enum { - RED, GREEN - } e_t; + typedef enum { RED, GREEN } e_t; - hid_t aid = -1; - hid_t sid = -1; - hid_t tid = -1; - herr_t status; - int val, i, j, k, l, n; - float f; + hid_t aid = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + herr_t H5_ATTR_NDEBUG_UNUSED status; + int val, i, j, k, l, n; + float f; /* create 1D attributes with dimension [2], 2 elements */ - hsize_t dims[1] = { 2 }; - char buf1[2][STR_SIZE] = { "ab", "de" }; /* string */ - char *buf1a[2]; /* VL string */ - char buf2[2] = { 1, 2 }; /* bitfield, opaque */ - s_t buf3[2] = { { 1, 2.0F }, { 3, 4.0F } }; /* compound */ - hobj_ref_t buf4[2]; /* reference */ - e_t buf45[2] = { RED, RED }; /* enum */ - hvl_t buf5[2]; /* vlen */ - hsize_t dimarray[1] = { 3 }; /* array dimension */ - int buf6[2][3] = { { 1, 2, 3 }, { 4, 5, 6 } }; /* array */ - int buf7[2] = { 1, 2 }; /* integer */ - float buf8[2] = { 1.0F, 2.0F }; /* float */ + hsize_t dims[1] = {2}; + char buf1[2][STR_SIZE] = {"ab", "de"}; /* string */ + char * buf1a[2]; /* VL string */ + char buf2[2] = {1, 2}; /* bitfield, opaque */ + s_t buf3[2] = {{1, 2.0}, {3, 4.0}}; /* compound */ + hobj_ref_t buf4[2]; /* reference */ + e_t buf45[2] = {RED, RED}; /* enum */ + hvl_t buf5[2]; /* vlen */ + hsize_t dimarray[1] = {3}; /* array dimension */ + int buf6[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */ + int buf7[2] = {1, 2}; /* integer */ + float buf8[2] = {1.0, 2.0}; /* float */ /* create 2D attributes with dimension [3][2], 6 elements */ - hsize_t dims2[2] = { 3, 2 }; - char buf12[3][2][STR_SIZE] = { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }; /* string */ - char *buf12a[3][2]; /* VL string */ - char buf22[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* bitfield, opaque */ - s_t buf32[6] = { { 1, 2.0F }, { 3, 4.0F }, { 5, 6.0F }, { 7, 8.0F }, { 9, 10.0F }, { 11, 12.0F } }; /* compound */ - hobj_ref_t buf42[3][2]; /* reference */ - e_t buf452[3][2]; /* enum */ - hvl_t buf52[3][2]; /* vlen */ - int buf62[6][3] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, { 10, 11, 12 }, { 13, 14, 15 }, { 16, 17, 18 } }; /* array */ - int buf72[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* integer */ - float buf82[3][2] = { { 1.0F, 2.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } }; /* float */ + hsize_t dims2[2] = {3, 2}; + char buf12[3][2][STR_SIZE] = {{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}}; /* string */ + char * buf12a[3][2]; /* VL string */ + char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */ + s_t buf32[6] = {{1, 2.0}, {3, 4.0}, {5, 6.0}, {7, 8.0}, {9, 10.0}, {11, 12.0}}; /* compound */ + hobj_ref_t buf42[3][2]; /* reference */ + e_t buf452[3][2]; /* enum */ + hvl_t buf52[3][2]; /* vlen */ + int buf62[6][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}, {16, 17, 18}}; /* array */ + int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */ + float buf82[3][2] = {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}}; /* float */ /* create 3D attributes with dimension [4][3][2], 24 elements */ - hsize_t dims3[3] = { 4, 3, 2 }; - char buf13[4][3][2][STR_SIZE] = { { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }, - { { "mn", "pq" }, { "rs", "tu" }, { "vw", "xz" } }, - { { "AB", "CD" }, { "EF", "GH" }, { "IJ", "KL" } }, - { { "MN", "PQ" }, { "RS", "TU" }, { "VW", "XZ" } } }; /* string */ - char *buf13a[4][3][2]; /* VL string */ - char buf23[4][3][2]; /* bitfield, opaque */ - s_t buf33[4][3][2]; /* compound */ - hobj_ref_t buf43[4][3][2]; /* reference */ - e_t buf453[4][3][2]; /* enum */ - hvl_t buf53[4][3][2]; /* vlen */ - int buf63[24][3]; /* array */ - int buf73[4][3][2]; /* integer */ - float buf83[4][3][2]; /* float */ - - /*------------------------------------------------------------------------- - * 1D attributes - *------------------------------------------------------------------------- - */ + hsize_t dims3[3] = {4, 3, 2}; + char buf13[4][3][2][STR_SIZE] = {{{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}}, + {{"mn", "pq"}, {"rs", "tu"}, {"vw", "xz"}}, + {{"AB", "CD"}, {"EF", "GH"}, {"IJ", "KL"}}, + {{"MN", "PQ"}, {"RS", "TU"}, {"VW", "XZ"}}}; /* string */ + char * buf13a[4][3][2]; /* VL string */ + char buf23[4][3][2]; /* bitfield, opaque */ + s_t buf33[4][3][2]; /* compound */ + hobj_ref_t buf43[4][3][2]; /* reference */ + e_t buf453[4][3][2]; /* enum */ + hvl_t buf53[4][3][2]; /* vlen */ + int buf63[24][3]; /* array */ + int buf73[4][3][2]; /* integer */ + float buf83[4][3][2]; /* float */ + + /*------------------------------------------------------------------------- + * 1D attributes + *------------------------------------------------------------------------- + */ /*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ + * H5T_STRING + *------------------------------------------------------------------------- + */ if (make_diffs) for (i = 0; i < 2; i++) @@ -5291,20 +5278,20 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make for (i = 0; i < 2; i++) buf1a[i] = buf1[i]; - tid = H5Tcopy(H5T_C_S1); + tid = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid, H5T_VARIABLE); write_attr(loc_id, 1, dims, "string", tid, buf1a); status = H5Tclose(tid); - tid = H5Tcopy(H5T_C_S1); + tid = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid, (size_t)STR_SIZE); write_attr(loc_id, 1, dims, "VLstring", tid, buf1); status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ if (make_diffs) for (i = 0; i < 2; i++) @@ -5326,9 +5313,9 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ /* buf2[2]= {1,2}; @@ -5342,15 +5329,15 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make [ 1 ] 2 0 2 */ - tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_attr(loc_id, 1, dims, "opaque", tid, buf2); status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ if (make_diffs) for (i = 0; i < 2; i++) { @@ -5378,13 +5365,13 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_REFERENCE (H5R_OBJECT object reference) - *------------------------------------------------------------------------- - */ + * H5T_REFERENCE (H5R_OBJECT object reference) + *------------------------------------------------------------------------- + */ /* Create references to dataset */ if (dset_name) { - status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t) -1); - status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t) -1); + status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t)-1); + status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t)-1); write_attr(loc_id, 1, dims, "reference", H5T_STD_REF_OBJ, buf4); } @@ -5418,18 +5405,18 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make /* Allocate and initialize VL dataset to write */ - buf5[0].len = 1; - buf5[0].p = HDmalloc(1 * sizeof(int)); - ((int *) buf5[0].p)[0] = 1; - buf5[1].len = 2; - buf5[1].p = HDmalloc(2 * sizeof(int)); - ((int *) buf5[1].p)[0] = 2; - ((int *) buf5[1].p)[1] = 3; + buf5[0].len = 1; + buf5[0].p = HDmalloc(1 * sizeof(int)); + ((int *)buf5[0].p)[0] = 1; + buf5[1].len = 2; + buf5[1].p = HDmalloc(2 * sizeof(int)); + ((int *)buf5[1].p)[0] = 2; + ((int *)buf5[1].p)[1] = 3; if (make_diffs) { - ((int *) buf5[0].p)[0] = 0; - ((int *) buf5[1].p)[0] = 0; - ((int *) buf5[1].p)[1] = 0; + ((int *)buf5[0].p)[0] = 0; + ((int *)buf5[1].p)[0] = 0; + ((int *)buf5[1].p)[1] = 0; } /* $h5diff file7.h5 file6.h5 g1 g1 -v @@ -5441,12 +5428,12 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make [ 1 ] 3 0 3 */ - sid = H5Screate_simple(1, dims, NULL); - tid = H5Tvlen_create(H5T_NATIVE_INT); - aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT); + sid = H5Screate_simple(1, dims, NULL); + tid = H5Tvlen_create(H5T_NATIVE_INT); + aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT); status = H5Awrite(aid, tid, buf5); assert(status >= 0); - status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5); + status = H5Treclaim(tid, sid, H5P_DEFAULT, buf5); assert(status >= 0); status = H5Aclose(aid); status = H5Tclose(tid); @@ -5545,13 +5532,13 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make for (j = 0; j < 2; j++) buf12a[i][j] = buf12[i][j]; - tid = H5Tcopy(H5T_C_S1); + tid = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid, H5T_VARIABLE); write_attr(loc_id, 2, dims2, "string2D", tid, buf12a); status = H5Tclose(tid); - tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, (size_t) STR_SIZE); + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, (size_t)STR_SIZE); write_attr(loc_id, 2, dims2, "VLstring2D", tid, buf12); status = H5Tclose(tid); @@ -5598,7 +5585,7 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make [ 2 0 ] 5 0 5 [ 2 1 ] 6 0 6 */ - tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_attr(loc_id, 2, dims2, "opaque2D", tid, buf22); status = H5Tclose(tid); @@ -5638,8 +5625,7 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make if (dset_name) { for (i = 0; i < 3; i++) for (j = 0; j < 2; j++) - status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, - (hid_t) -1); + status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t)-1); write_attr(loc_id, 2, dims2, "reference2D", H5T_STD_REF_OBJ, buf42); } @@ -5681,13 +5667,13 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make n = 0; for (i = 0; i < 3; i++) { for (j = 0; j < 2; j++) { - buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int)); buf52[i][j].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) if (make_diffs) - ((int *) buf52[i][j].p)[l] = 0; + ((int *)buf52[i][j].p)[l] = 0; else - ((int *) buf52[i][j].p)[l] = n++; + ((int *)buf52[i][j].p)[l] = n++; } } @@ -5707,12 +5693,12 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make [ 2 1 ] 11 0 11 */ - sid = H5Screate_simple(2, dims2, NULL); - tid = H5Tvlen_create(H5T_NATIVE_INT); - aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT); + sid = H5Screate_simple(2, dims2, NULL); + tid = H5Tvlen_create(H5T_NATIVE_INT); + aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT); status = H5Awrite(aid, tid, buf52); assert(status >= 0); - status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52); + status = H5Treclaim(tid, sid, H5P_DEFAULT, buf52); assert(status >= 0); status = H5Aclose(aid); status = H5Tclose(tid); @@ -5868,13 +5854,13 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make for (k = 0; k < 2; k++) buf13a[i][j][k] = buf13[i][j][k]; - tid = H5Tcopy(H5T_C_S1); + tid = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid, H5T_VARIABLE); write_attr(loc_id, 3, dims3, "string3D", tid, buf13a); status = H5Tclose(tid); - tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, (size_t) STR_SIZE); + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, (size_t)STR_SIZE); write_attr(loc_id, 3, dims3, "VLstring3D", tid, buf13); status = H5Tclose(tid); @@ -5890,7 +5876,7 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make if (make_diffs) buf23[i][j][k] = 0; else - buf23[i][j][k] = (char) n++; + buf23[i][j][k] = (char)n++; /* position bitfield3D of </g1> bitfield3D of </g1> difference @@ -5929,7 +5915,7 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make * H5T_OPAQUE *------------------------------------------------------------------------- */ - tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_attr(loc_id, 3, dims3, "opaque3D", tid, buf23); status = H5Tclose(tid); @@ -5945,9 +5931,10 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make for (k = 0; k < 2; k++) if (make_diffs) { buf33[i][j][k].a = 0; - buf33[i][j][k].b = 0.0F; - } else { - buf33[i][j][k].a = (char) n++; + buf33[i][j][k].b = 0.0; + } + else { + buf33[i][j][k].a = (char)n++; buf33[i][j][k].b = n++; } /*position compound3D of </g1> compound3D of </g1> difference @@ -6017,8 +6004,7 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make for (i = 0; i < 4; i++) for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) - status = H5Rcreate(&buf43[i][j][k], fid, dset_name, - H5R_OBJECT, (hid_t) -1); + status = H5Rcreate(&buf43[i][j][k], fid, dset_name, H5R_OBJECT, (hid_t)-1); write_attr(loc_id, 3, dims3, "reference3D", H5T_STD_REF_OBJ, buf43); } @@ -6080,13 +6066,13 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make for (i = 0; i < 4; i++) for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { - buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int)); buf53[i][j][k].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) if (make_diffs) - ((int *) buf53[i][j][k].p)[l] = 0; + ((int *)buf53[i][j][k].p)[l] = 0; else - ((int *) buf53[i][j][k].p)[l] = n++; + ((int *)buf53[i][j][k].p)[l] = n++; } /* position vlen3D of </g1> vlen3D of </g1> difference @@ -6103,12 +6089,12 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make [ 1 1 0 ] 10 0 10 etc */ - sid = H5Screate_simple(3, dims3, NULL); - tid = H5Tvlen_create(H5T_NATIVE_INT); - aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT); + sid = H5Screate_simple(3, dims3, NULL); + tid = H5Tvlen_create(H5T_NATIVE_INT); + aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT); status = H5Awrite(aid, tid, buf53); assert(status >= 0); - status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53); + status = H5Treclaim(tid, sid, H5P_DEFAULT, buf53); assert(status >= 0); status = H5Aclose(aid); status = H5Tclose(tid); @@ -6120,7 +6106,7 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make */ n = 1; for (i = 0; i < 24; i++) { - for (j = 0; j < (int) dimarray[0]; j++) { + for (j = 0; j < (int)dimarray[0]; j++) { if (make_diffs) buf63[i][j] = 0; else @@ -6155,7 +6141,7 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make for (k = 0; k < 2; k++) { if (make_diffs) { buf73[i][j][k] = 0; - buf83[i][j][k] = 0.0F; + buf83[i][j][k] = 0.0; } else { buf73[i][j][k] = n++; @@ -6189,78 +6175,77 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make * *------------------------------------------------------------------------- */ -static -void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs /* flag to modify data buffers */) +static void +write_attr_in(hid_t loc_id, const char *dset_name, hid_t fid, + int make_diffs /* flag to modify data buffers */) { /* Compound datatype */ typedef struct s_t { - char a; + char a; double b; } s_t; - typedef enum { - RED, GREEN - } e_t; + typedef enum { RED, GREEN } e_t; - hid_t aid = -1; - hid_t sid = -1; - hid_t tid = -1; - herr_t status; - int val, i, j, k, l, n; - float f; + hid_t aid = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + herr_t H5_ATTR_NDEBUG_UNUSED status; + int val, i, j, k, l, n; + float f; /* create 1D attributes with dimension [2], 2 elements */ - hsize_t dims[1] = { 2 }; - char buf1[2][STR_SIZE] = { "ab", "de" }; /* string */ - char *buf1a[2]; /* VL string */ - char buf2[2] = { 1, 2 }; /* bitfield, opaque */ - s_t buf3[2] = { { 1, 2.0F }, { 3, 4.0F } }; /* compound */ - hobj_ref_t buf4[2]; /* reference */ - e_t buf45[2] = { RED, RED }; /* enum */ - hvl_t buf5[2]; /* vlen */ - hsize_t dimarray[1] = { 3 }; /* array dimension */ - int buf6[2][3] = { { 1, 2, 3 }, { 4, 5, 6 } }; /* array */ - int buf7[2] = { 1, 2 }; /* integer */ - float buf8[2] = { 1.0F, 2.0F }; /* float */ + hsize_t dims[1] = {2}; + char buf1[2][STR_SIZE] = {"ab", "de"}; /* string */ + char * buf1a[2]; /* VL string */ + char buf2[2] = {1, 2}; /* bitfield, opaque */ + s_t buf3[2] = {{1, 2.0}, {3, 4.0}}; /* compound */ + hobj_ref_t buf4[2]; /* reference */ + e_t buf45[2] = {RED, RED}; /* enum */ + hvl_t buf5[2]; /* vlen */ + hsize_t dimarray[1] = {3}; /* array dimension */ + int buf6[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */ + int buf7[2] = {1, 2}; /* integer */ + float buf8[2] = {1.0, 2.0}; /* float */ /* create 2D attributes with dimension [3][2], 6 elements */ - hsize_t dims2[2] = { 3, 2 }; - char buf12[3][2][STR_SIZE] = { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }; /* string */ - char *buf12a[3][2]; /* VL string */ - char buf22[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* bitfield, opaque */ - s_t buf32[6] = { { 1, 2.0F }, { 3, 4.0F }, { 5, 6.0F }, { 7, 8.0F }, { 9, 10.0F }, { 11, 12.0F } }; /* compound */ - hobj_ref_t buf42[3][2]; /* reference */ - e_t buf452[3][2]; /* enum */ - hvl_t buf52[3][2]; /* vlen */ - int buf62[6][3] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, { 10, 11, 12 }, { 13, 14, 15 }, { 16, 17, 18 } }; /* array */ - int buf72[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* integer */ - float buf82[3][2] = { { 1.0F, 2.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } }; /* float */ + hsize_t dims2[2] = {3, 2}; + char buf12[3][2][STR_SIZE] = {{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}}; /* string */ + char * buf12a[3][2]; /* VL string */ + char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */ + s_t buf32[6] = {{1, 2.0}, {3, 4.0}, {5, 6.0}, {7, 8.0}, {9, 10.0}, {11, 12.0}}; /* compound */ + hobj_ref_t buf42[3][2]; /* reference */ + e_t buf452[3][2]; /* enum */ + hvl_t buf52[3][2]; /* vlen */ + int buf62[6][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}, {16, 17, 18}}; /* array */ + int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */ + float buf82[3][2] = {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}}; /* float */ /* create 3D attributes with dimension [4][3][2], 24 elements */ - hsize_t dims3[3] = { 4, 3, 2 }; - char buf13[4][3][2][STR_SIZE] = { { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }, - { { "mn", "pq" }, { "rs", "tu" }, { "vw", "xz" } }, - { { "AB", "CD" }, { "EF", "GH" }, { "IJ", "KL" } }, - { { "MN", "PQ" }, { "RS", "TU" }, { "VW", "XZ" } } }; /* string */ - char *buf13a[4][3][2]; /* VL string */ - char buf23[4][3][2]; /* bitfield, opaque */ - s_t buf33[4][3][2]; /* compound */ - hobj_ref_t buf43[4][3][2]; /* reference */ - e_t buf453[4][3][2]; /* enum */ - hvl_t buf53[4][3][2]; /* vlen */ - int buf63[24][3]; /* array */ - int buf73[4][3][2]; /* integer */ - float buf83[4][3][2]; /* float */ - - /*------------------------------------------------------------------------- - * 1D attributes - *------------------------------------------------------------------------- - */ + hsize_t dims3[3] = {4, 3, 2}; + char buf13[4][3][2][STR_SIZE] = {{{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}}, + {{"mn", "pq"}, {"rs", "tu"}, {"vw", "xz"}}, + {{"AB", "CD"}, {"EF", "GH"}, {"IJ", "KL"}}, + {{"MN", "PQ"}, {"RS", "TU"}, {"VW", "XZ"}}}; /* string */ + char * buf13a[4][3][2]; /* VL string */ + char buf23[4][3][2]; /* bitfield, opaque */ + s_t buf33[4][3][2]; /* compound */ + hobj_ref_t buf43[4][3][2]; /* reference */ + e_t buf453[4][3][2]; /* enum */ + hvl_t buf53[4][3][2]; /* vlen */ + int buf63[24][3]; /* array */ + int buf73[4][3][2]; /* integer */ + float buf83[4][3][2]; /* float */ + + /*------------------------------------------------------------------------- + * 1D attributes + *------------------------------------------------------------------------- + */ /*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ + * H5T_STRING + *------------------------------------------------------------------------- + */ if (make_diffs) for (i = 0; i < 2; i++) @@ -6278,22 +6263,22 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff [ 1 ] d z [ 1 ] e z */ - tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, (size_t) STR_SIZE); + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, (size_t)STR_SIZE); write_attr(loc_id, 1, dims, "string", tid, buf1); status = H5Tclose(tid); for (i = 0; i < 2; i++) buf1a[i] = buf1[i]; - tid = H5Tcopy(H5T_C_S1); + tid = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid, H5T_VARIABLE); write_attr(loc_id, 1, dims, "VLstring", tid, buf1a); status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ if (make_diffs) for (i = 0; i < 2; i++) @@ -6315,9 +6300,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ /* buf2[2]= {1,2}; @@ -6331,15 +6316,15 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff [ 1 ] 2 0 2 */ - tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_attr(loc_id, 1, dims, "opaque", tid, buf2); status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ if (make_diffs) for (i = 0; i < 2; i++) { @@ -6366,20 +6351,20 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_REFERENCE (H5R_OBJECT object reference) - *------------------------------------------------------------------------- - */ + * H5T_REFERENCE (H5R_OBJECT object reference) + *------------------------------------------------------------------------- + */ /* Create references to dataset */ if (dset_name) { - status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t) -1); - status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t) -1); + status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t)-1); + status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t)-1); write_attr(loc_id, 1, dims, "reference", H5T_STD_REF_OBJ, buf4); } /*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ + * H5T_ENUM + *------------------------------------------------------------------------- + */ if (make_diffs) for (i = 0; i < 2; i++) buf45[i] = GREEN; @@ -6400,24 +6385,24 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ + * H5T_VLEN + *------------------------------------------------------------------------- + */ /* Allocate and initialize VL dataset to write */ - buf5[0].len = 1; - buf5[0].p = HDmalloc(1 * sizeof(int)); - ((int *) buf5[0].p)[0] = 1; - buf5[1].len = 2; - buf5[1].p = HDmalloc(2 * sizeof(int)); - ((int *) buf5[1].p)[0] = 2; - ((int *) buf5[1].p)[1] = 3; + buf5[0].len = 1; + buf5[0].p = HDmalloc(1 * sizeof(int)); + ((int *)buf5[0].p)[0] = 1; + buf5[1].len = 2; + buf5[1].p = HDmalloc(2 * sizeof(int)); + ((int *)buf5[1].p)[0] = 2; + ((int *)buf5[1].p)[1] = 3; if (make_diffs) { - ((int *) buf5[0].p)[0] = 0; - ((int *) buf5[1].p)[0] = 0; - ((int *) buf5[1].p)[1] = 0; + ((int *)buf5[0].p)[0] = 0; + ((int *)buf5[1].p)[0] = 0; + ((int *)buf5[1].p)[1] = 0; } /* $h5diff file7.h5 file6.h5 g1 g1 -v @@ -6429,21 +6414,21 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff [ 1 ] 3 0 3 */ - sid = H5Screate_simple(1, dims, NULL); - tid = H5Tvlen_create(H5T_NATIVE_INT); - aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT); + sid = H5Screate_simple(1, dims, NULL); + tid = H5Tvlen_create(H5T_NATIVE_INT); + aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT); status = H5Awrite(aid, tid, buf5); assert(status >= 0); - status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5); + status = H5Treclaim(tid, sid, H5P_DEFAULT, buf5); assert(status >= 0); status = H5Aclose(aid); status = H5Tclose(tid); status = H5Sclose(sid); /*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ + * H5T_ARRAY + *------------------------------------------------------------------------- + */ if (make_diffs) { for (i = 0; i < 2; i++) @@ -6469,9 +6454,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_INTEGER and H5T_FLOAT - *------------------------------------------------------------------------- - */ + * H5T_INTEGER and H5T_FLOAT + *------------------------------------------------------------------------- + */ if (make_diffs) { for (i = 0; i < 2; i++) { @@ -6497,14 +6482,14 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff write_attr(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8); /*------------------------------------------------------------------------- - * 2D attributes - *------------------------------------------------------------------------- - */ + * 2D attributes + *------------------------------------------------------------------------- + */ /*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ + * H5T_STRING + *------------------------------------------------------------------------- + */ if (make_diffs) { for (i = 0; i < 3; i++) for (j = 0; j < 2; j++) @@ -6532,8 +6517,8 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff [ 2 1 ] l z */ - tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, (size_t) STR_SIZE); + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, (size_t)STR_SIZE); write_attr(loc_id, 2, dims2, "string2D", tid, buf12); status = H5Tclose(tid); @@ -6541,15 +6526,15 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff for (j = 0; j < 2; j++) buf12a[i][j] = buf12[i][j]; - tid = H5Tcopy(H5T_C_S1); + tid = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid, H5T_VARIABLE); write_attr(loc_id, 2, dims2, "VLstring2D", tid, buf12a); status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ if (make_diffs) memset(buf22, 0, sizeof buf22); @@ -6572,9 +6557,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ /* buf22[3][2]= {{1,2},{3,4},{5,6}}; @@ -6589,15 +6574,15 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff [ 2 0 ] 5 0 5 [ 2 1 ] 6 0 6 */ - tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_attr(loc_id, 2, dims2, "opaque2D", tid, buf22); status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ if (make_diffs) memset(buf32, 0, sizeof buf32); /* @@ -6621,21 +6606,21 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_REFERENCE (H5R_OBJECT object reference) - *------------------------------------------------------------------------- - */ + * H5T_REFERENCE (H5R_OBJECT object reference) + *------------------------------------------------------------------------- + */ /* Create references to dataset */ if (dset_name) { for (i = 0; i < 3; i++) for (j = 0; j < 2; j++) - status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t) -1); + status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t)-1); write_attr(loc_id, 2, dims2, "reference2D", H5T_STD_REF_OBJ, buf42); } /*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ + * H5T_ENUM + *------------------------------------------------------------------------- + */ for (i = 0; i < 3; i++) for (j = 0; j < 2; j++) { if (make_diffs) @@ -6663,21 +6648,21 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ + * H5T_VLEN + *------------------------------------------------------------------------- + */ /* Allocate and initialize VL dataset to write */ n = 0; for (i = 0; i < 3; i++) { for (j = 0; j < 2; j++) { - buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int)); buf52[i][j].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) if (make_diffs) - ((int *) buf52[i][j].p)[l] = 0; + ((int *)buf52[i][j].p)[l] = 0; else - ((int *) buf52[i][j].p)[l] = n++; + ((int *)buf52[i][j].p)[l] = n++; } } @@ -6697,21 +6682,21 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff [ 2 1 ] 11 0 11 */ - sid = H5Screate_simple(2, dims2, NULL); - tid = H5Tvlen_create(H5T_NATIVE_INT); - aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT); + sid = H5Screate_simple(2, dims2, NULL); + tid = H5Tvlen_create(H5T_NATIVE_INT); + aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT); status = H5Awrite(aid, tid, buf52); assert(status >= 0); - status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52); + status = H5Treclaim(tid, sid, H5P_DEFAULT, buf52); assert(status >= 0); status = H5Aclose(aid); status = H5Tclose(tid); status = H5Sclose(sid); /*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ + * H5T_ARRAY + *------------------------------------------------------------------------- + */ if (make_diffs) memset(buf62, 0, sizeof buf62); @@ -6746,9 +6731,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_INTEGER and H5T_FLOAT - *------------------------------------------------------------------------- - */ + * H5T_INTEGER and H5T_FLOAT + *------------------------------------------------------------------------- + */ if (make_diffs) { memset(buf72, 0, sizeof buf72); @@ -6780,14 +6765,14 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff write_attr(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82); /*------------------------------------------------------------------------- - * 3D attributes - *------------------------------------------------------------------------- - */ + * 3D attributes + *------------------------------------------------------------------------- + */ /*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ + * H5T_STRING + *------------------------------------------------------------------------- + */ if (make_diffs) { for (i = 0; i < 4; i++) @@ -6854,8 +6839,8 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff [ 3 2 1 ] Z z */ - tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, (size_t) STR_SIZE); + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, (size_t)STR_SIZE); write_attr(loc_id, 3, dims3, "string3D", tid, buf13); status = H5Tclose(tid); @@ -6863,15 +6848,15 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) buf13a[i][j][k] = buf13[i][j][k]; - tid = H5Tcopy(H5T_C_S1); + tid = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid, H5T_VARIABLE); write_attr(loc_id, 3, dims3, "VLstring3D", tid, buf13a); status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ n = 1; for (i = 0; i < 4; i++) @@ -6880,7 +6865,7 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff if (make_diffs) buf23[i][j][k] = 0; else - buf23[i][j][k] = (char) n++; + buf23[i][j][k] = (char)n++; } /* position bitfield3D of </g1> bitfield3D of </g1> difference @@ -6916,18 +6901,18 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ - tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_attr(loc_id, 3, dims3, "opaque3D", tid, buf23); status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ n = 1; for (i = 0; i < 4; i++) @@ -6935,10 +6920,10 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff for (k = 0; k < 2; k++) { if (make_diffs) { buf33[i][j][k].a = 0; - buf33[i][j][k].b = 0.0F; + buf33[i][j][k].b = 0.0; } else { - buf33[i][j][k].a = (char) n++; + buf33[i][j][k].a = (char)n++; buf33[i][j][k].b = n++; } } @@ -7001,23 +6986,22 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_REFERENCE (H5R_OBJECT object reference) - *------------------------------------------------------------------------- - */ + * H5T_REFERENCE (H5R_OBJECT object reference) + *------------------------------------------------------------------------- + */ /* Create references to dataset */ if (dset_name) { for (i = 0; i < 4; i++) for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) - status = H5Rcreate(&buf43[i][j][k], fid, dset_name, - H5R_OBJECT, (hid_t) -1); + status = H5Rcreate(&buf43[i][j][k], fid, dset_name, H5R_OBJECT, (hid_t)-1); write_attr(loc_id, 3, dims3, "reference3D", H5T_STD_REF_OBJ, buf43); } /*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ + * H5T_ENUM + *------------------------------------------------------------------------- + */ for (i = 0; i < 4; i++) for (j = 0; j < 3; j++) @@ -7063,22 +7047,22 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ + * H5T_VLEN + *------------------------------------------------------------------------- + */ /* Allocate and initialize VL dataset to write */ n = 0; for (i = 0; i < 4; i++) for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { - buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int)); buf53[i][j][k].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) if (make_diffs) - ((int *) buf53[i][j][k].p)[l] = 0; + ((int *)buf53[i][j][k].p)[l] = 0; else - ((int *) buf53[i][j][k].p)[l] = n++; + ((int *)buf53[i][j][k].p)[l] = n++; } /* position vlen3D of </g1> vlen3D of </g1> difference @@ -7095,24 +7079,24 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff [ 1 1 0 ] 10 0 10 etc */ - sid = H5Screate_simple(3, dims3, NULL); - tid = H5Tvlen_create(H5T_NATIVE_INT); - aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT); + sid = H5Screate_simple(3, dims3, NULL); + tid = H5Tvlen_create(H5T_NATIVE_INT); + aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT); status = H5Awrite(aid, tid, buf53); assert(status >= 0); - status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53); + status = H5Treclaim(tid, sid, H5P_DEFAULT, buf53); assert(status >= 0); status = H5Aclose(aid); status = H5Tclose(tid); status = H5Sclose(sid); /*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ + * H5T_ARRAY + *------------------------------------------------------------------------- + */ n = 1; for (i = 0; i < 24; i++) - for (j = 0; j < (int) dimarray[0]; j++) { + for (j = 0; j < (int)dimarray[0]; j++) { if (make_diffs) buf63[i][j] = 0; else @@ -7136,9 +7120,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_INTEGER and H5T_FLOAT - *------------------------------------------------------------------------- - */ + * H5T_INTEGER and H5T_FLOAT + *------------------------------------------------------------------------- + */ n = 1; f = 1; for (i = 0; i < 4; i++) @@ -7146,7 +7130,7 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff for (k = 0; k < 2; k++) { if (make_diffs) { buf73[i][j][k] = 0; - buf83[i][j][k] = 0.0F; + buf83[i][j][k] = 0.0; } else { buf73[i][j][k] = n++; @@ -7180,77 +7164,76 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff * *------------------------------------------------------------------------- */ -static -void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs /* flag to modify data buffers */) +static void +write_dset_in(hid_t loc_id, const char *dset_name, hid_t fid, + int make_diffs /* flag to modify data buffers */) { /* Compound datatype */ typedef struct s_t { - char a; + char a; double b; } s_t; - typedef enum { - RED, GREEN - } e_t; + typedef enum { RED, GREEN } e_t; - hid_t did = -1; - hid_t sid = -1; - hid_t tid = -1; - hid_t dcpl = -1; - herr_t status; - int val, i, j, k, l, n; - float f; - int fillvalue = 2; - int scalar_data = 2; + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; + herr_t H5_ATTR_NDEBUG_UNUSED status; + int val, i, j, k, l, n; + float f; + int fillvalue = 2; + int scalar_data = 2; /* create 1D attributes with dimension [2], 2 elements */ - hsize_t dims[1] = { 2 }; - char buf1[2][STR_SIZE] = { "ab", "de" }; /* string */ - char *buf1a[2]; /* VL string */ - char buf2[2] = { 1, 2 }; /* bitfield, opaque */ - s_t buf3[2] = { { 1, 2.0F }, { 3, 4.0F } }; /* compound */ - hobj_ref_t buf4[2]; /* reference */ - e_t buf45[2] = { RED, GREEN }; /* enum */ - hvl_t buf5[2]; /* vlen */ - hsize_t dimarray[1] = { 3 }; /* array dimension */ - int buf6[2][3] = { { 1, 2, 3 }, { 4, 5, 6 } }; /* array */ - int buf7[2] = { 1, 2 }; /* integer */ - float buf8[2] = { 1.0F, 2.0F }; /* float */ + hsize_t dims[1] = {2}; + char buf1[2][STR_SIZE] = {"ab", "de"}; /* string */ + char * buf1a[2]; /* VL string */ + char buf2[2] = {1, 2}; /* bitfield, opaque */ + s_t buf3[2] = {{1, 2.0}, {3, 4.0}}; /* compound */ + hobj_ref_t buf4[2]; /* reference */ + e_t buf45[2] = {RED, GREEN}; /* enum */ + hvl_t buf5[2]; /* vlen */ + hsize_t dimarray[1] = {3}; /* array dimension */ + int buf6[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */ + int buf7[2] = {1, 2}; /* integer */ + float buf8[2] = {1.0, 2.0}; /* float */ /* create 2D attributes with dimension [3][2], 6 elements */ - hsize_t dims2[2] = { 3, 2 }; - char buf12[3][2][STR_SIZE] = { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }; /* string */ - char *buf12a[3][2]; /* VL string */ - char buf22[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* bitfield, opaque */ - s_t buf32[6] = { { 1, 2.0F }, { 3, 4.0F }, { 5, 6.0F }, { 7, 8.0F }, { 9, 10.0F }, { 11, 12.0F } }; /* compound */ - hobj_ref_t buf42[3][2]; /* reference */ - hvl_t buf52[3][2]; /* vlen */ - int buf62[6][3] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, { 10, 11, 12 }, { 13, 14, 15 }, { 16, 17, 18 } }; /* array */ - int buf72[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* integer */ - float buf82[3][2] = { { 1.0F, 2.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } }; /* float */ + hsize_t dims2[2] = {3, 2}; + char buf12[3][2][STR_SIZE] = {{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}}; /* string */ + char * buf12a[3][2]; /* VL string */ + char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */ + s_t buf32[6] = {{1, 2.0}, {3, 4.0}, {5, 6.0}, {7, 8.0}, {9, 10.0}, {11, 12.0}}; /* compound */ + hobj_ref_t buf42[3][2]; /* reference */ + hvl_t buf52[3][2]; /* vlen */ + int buf62[6][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}, {16, 17, 18}}; /* array */ + int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */ + float buf82[3][2] = {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}}; /* float */ /* create 3D attributes with dimension [4][3][2], 24 elements */ - hsize_t dims3[3] = { 4, 3, 2 }; - char buf13[4][3][2][STR_SIZE] = { { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }, - { { "mn", "pq" }, { "rs", "tu" }, { "vw", "xz" } }, - { { "AB", "CD" }, { "EF", "GH" }, { "IJ", "KL" } }, - { { "MN", "PQ" }, { "RS", "TU" }, { "VW", "XZ" } } }; /* string */ - char *buf13a[4][3][2]; /* VL string */ - char buf23[4][3][2]; /* bitfield, opaque */ - s_t buf33[4][3][2]; /* compound */ - hobj_ref_t buf43[4][3][2]; /* reference */ - hvl_t buf53[4][3][2]; /* vlen */ - int buf63[24][3]; /* array */ - int buf73[4][3][2]; /* integer */ - float buf83[4][3][2]; /* float */ + hsize_t dims3[3] = {4, 3, 2}; + char buf13[4][3][2][STR_SIZE] = {{{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}}, + {{"mn", "pq"}, {"rs", "tu"}, {"vw", "xz"}}, + {{"AB", "CD"}, {"EF", "GH"}, {"IJ", "KL"}}, + {{"MN", "PQ"}, {"RS", "TU"}, {"VW", "XZ"}}}; /* string */ + char * buf13a[4][3][2]; /* VL string */ + char buf23[4][3][2]; /* bitfield, opaque */ + s_t buf33[4][3][2]; /* compound */ + hobj_ref_t buf43[4][3][2]; /* reference */ + hvl_t buf53[4][3][2]; /* vlen */ + int buf63[24][3]; /* array */ + int buf73[4][3][2]; /* integer */ + float buf83[4][3][2]; /* float */ if (make_diffs == 2) dimarray[0] = 4; /*------------------------------------------------------------------------- - * H5S_SCALAR - *------------------------------------------------------------------------- - */ + * H5S_SCALAR + *------------------------------------------------------------------------- + */ if (make_diffs) scalar_data = 1; @@ -7269,37 +7252,37 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff H5Sclose(sid); /*------------------------------------------------------------------------- - * 1D - *------------------------------------------------------------------------- - */ + * 1D + *------------------------------------------------------------------------- + */ /*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ + * H5T_STRING + *------------------------------------------------------------------------- + */ if (make_diffs) for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) buf1[i][j] = 'z'; - tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, (size_t) STR_SIZE); + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, (size_t)STR_SIZE); write_dset(loc_id, 1, dims, "string", tid, buf1); status = H5Tclose(tid); for (i = 0; i < 2; i++) buf1a[i] = buf1[i]; - tid = H5Tcopy(H5T_C_S1); + tid = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid, H5T_VARIABLE); write_dset(loc_id, 1, dims, "VLstring", tid, buf1a); status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ if (make_diffs) for (i = 0; i < 2; i++) @@ -7310,9 +7293,9 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ if (make_diffs) for (i = 0; i < 2; i++) { @@ -7320,15 +7303,15 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff buf3[i].b = 0; } - tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_dset(loc_id, 1, dims, "opaque", tid, buf2); status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ if (make_diffs) for (i = 0; i < 2; i++) @@ -7341,27 +7324,27 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_REFERENCE (H5R_OBJECT object reference) - *------------------------------------------------------------------------- - */ + * H5T_REFERENCE (H5R_OBJECT object reference) + *------------------------------------------------------------------------- + */ /* Create references to dataset */ if (dset_name) { - status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t) -1); - status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t) -1); + status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t)-1); + status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t)-1); write_dset(loc_id, 1, dims, "reference", H5T_STD_REF_OBJ, buf4); } /*------------------------------------------------------------------------- - * H5T_REFERENCE (H5R_DATASET_REGION dataset region reference) - *------------------------------------------------------------------------- - */ + * H5T_REFERENCE (H5R_DATASET_REGION dataset region reference) + *------------------------------------------------------------------------- + */ gen_datareg(fid, make_diffs); /*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ + * H5T_ENUM + *------------------------------------------------------------------------- + */ tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); H5Tenum_insert(tid, "RED", (val = 0, &val)); H5Tenum_insert(tid, "GREEN", (val = 1, &val)); @@ -7369,42 +7352,41 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ + * H5T_VLEN + *------------------------------------------------------------------------- + */ /* Allocate and initialize VL dataset to write */ - buf5[0].len = 1; - buf5[0].p = HDmalloc(1 * sizeof(int)); - ((int *) buf5[0].p)[0] = 1; - buf5[1].len = 2; - buf5[1].p = HDmalloc(2 * sizeof(int)); - ((int *) buf5[1].p)[0] = 2; - ((int *) buf5[1].p)[1] = 3; + buf5[0].len = 1; + buf5[0].p = HDmalloc(1 * sizeof(int)); + ((int *)buf5[0].p)[0] = 1; + buf5[1].len = 2; + buf5[1].p = HDmalloc(2 * sizeof(int)); + ((int *)buf5[1].p)[0] = 2; + ((int *)buf5[1].p)[1] = 3; if (make_diffs) { - ((int *) buf5[0].p)[0] = 0; - ((int *) buf5[1].p)[0] = 0; - ((int *) buf5[1].p)[1] = 0; + ((int *)buf5[0].p)[0] = 0; + ((int *)buf5[1].p)[0] = 0; + ((int *)buf5[1].p)[1] = 0; } - sid = H5Screate_simple(1, dims, NULL); - tid = H5Tvlen_create(H5T_NATIVE_INT); - did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, - H5P_DEFAULT); + sid = H5Screate_simple(1, dims, NULL); + tid = H5Tvlen_create(H5T_NATIVE_INT); + did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5); HDassert(status >= 0); - status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5); + status = H5Treclaim(tid, sid, H5P_DEFAULT, buf5); HDassert(status >= 0); status = H5Dclose(did); status = H5Tclose(tid); status = H5Sclose(sid); /*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ + * H5T_ARRAY + *------------------------------------------------------------------------- + */ if (make_diffs) for (i = 0; i < 2; i++) @@ -7416,21 +7398,21 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); { - double *dbuf; /* information to write */ - hid_t ldid = -1; /* dataset ID */ - hid_t lsid = -1; /* dataspace ID */ - hid_t ltid = -1; /* datatype ID */ - size_t size; - hsize_t sdims[] = { 1 }; - hsize_t tdims[] = { H5TOOLS_MALLOCSIZE / sizeof(double) + 1 }; - size_t jj; + double *dbuf; /* information to write */ + hid_t ldid = H5I_INVALID_HID; /* dataset ID */ + hid_t lsid = H5I_INVALID_HID; /* dataspace ID */ + hid_t ltid = H5I_INVALID_HID; /* datatype ID */ + size_t size; + hsize_t sdims[] = {1}; + hsize_t tdims[] = {H5TOOLS_MALLOCSIZE / sizeof(double) + 1}; + size_t jj; /* allocate and initialize array data to write */ size = (H5TOOLS_MALLOCSIZE / sizeof(double) + 1) * sizeof(double); - dbuf = (double *) HDmalloc(size); + dbuf = (double *)HDmalloc(size); for (jj = 0; jj < (H5TOOLS_MALLOCSIZE / sizeof(double) + 1); jj++) - dbuf[jj] = (double) jj; + dbuf[jj] = (double)jj; if (make_diffs) { dbuf[5] = 0; @@ -7454,9 +7436,9 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff } /*------------------------------------------------------------------------- - * H5T_INTEGER and H5T_FLOAT - *------------------------------------------------------------------------- - */ + * H5T_INTEGER and H5T_FLOAT + *------------------------------------------------------------------------- + */ if (make_diffs) for (i = 0; i < 2; i++) { @@ -7468,14 +7450,14 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff write_dset(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8); /*------------------------------------------------------------------------- - * 2D - *------------------------------------------------------------------------- - */ + * 2D + *------------------------------------------------------------------------- + */ /*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ + * H5T_STRING + *------------------------------------------------------------------------- + */ if (make_diffs) { for (i = 0; i < 3; i++) @@ -7484,8 +7466,8 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff buf12[i][j][k] = 'z'; } - tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, (size_t) STR_SIZE); + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, (size_t)STR_SIZE); write_dset(loc_id, 2, dims2, "string2D", tid, buf12); status = H5Tclose(tid); @@ -7493,15 +7475,15 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff for (j = 0; j < 2; j++) buf12a[i][j] = buf12[i][j]; - tid = H5Tcopy(H5T_C_S1); + tid = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid, H5T_VARIABLE); write_dset(loc_id, 2, dims2, "VLstring2D", tid, buf12a); status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ if (make_diffs) memset(buf22, 0, sizeof buf22); @@ -7511,18 +7493,18 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ - tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_dset(loc_id, 2, dims2, "opaque2D", tid, buf22); status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ if (make_diffs) memset(buf32, 0, sizeof buf32); @@ -7534,21 +7516,21 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_REFERENCE (H5R_OBJECT object reference) - *------------------------------------------------------------------------- - */ + * H5T_REFERENCE (H5R_OBJECT object reference) + *------------------------------------------------------------------------- + */ /* Create references to dataset */ if (dset_name) { for (i = 0; i < 3; i++) for (j = 0; j < 2; j++) - status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t) -1); + status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t)-1); write_dset(loc_id, 2, dims2, "reference2D", H5T_STD_REF_OBJ, buf42); } /*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ + * H5T_ENUM + *------------------------------------------------------------------------- + */ tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); H5Tenum_insert(tid, "RED", (val = 0, &val)); @@ -7557,39 +7539,39 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ + * H5T_VLEN + *------------------------------------------------------------------------- + */ /* Allocate and initialize VL dataset to write */ n = 0; for (i = 0; i < 3; i++) for (j = 0; j < 2; j++) { - buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int)); buf52[i][j].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) { if (make_diffs) - ((int *) buf52[i][j].p)[l] = 0; + ((int *)buf52[i][j].p)[l] = 0; else - ((int *) buf52[i][j].p)[l] = n++; + ((int *)buf52[i][j].p)[l] = n++; } } - sid = H5Screate_simple(2, dims2, NULL); - tid = H5Tvlen_create(H5T_NATIVE_INT); - did = H5Dcreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + sid = H5Screate_simple(2, dims2, NULL); + tid = H5Tvlen_create(H5T_NATIVE_INT); + did = H5Dcreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf52); assert(status >= 0); - status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52); + status = H5Treclaim(tid, sid, H5P_DEFAULT, buf52); assert(status >= 0); status = H5Dclose(did); status = H5Tclose(tid); status = H5Sclose(sid); /*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ + * H5T_ARRAY + *------------------------------------------------------------------------- + */ if (make_diffs) memset(buf62, 0, sizeof buf62); @@ -7599,40 +7581,40 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_INTEGER, write a fill value - *------------------------------------------------------------------------- - */ + * H5T_INTEGER, write a fill value + *------------------------------------------------------------------------- + */ if (make_diffs) { memset(buf72, 0, sizeof buf72); memset(buf82, 0, sizeof buf82); } - dcpl = H5Pcreate(H5P_DATASET_CREATE); + dcpl = H5Pcreate(H5P_DATASET_CREATE); status = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue); - sid = H5Screate_simple(2, dims2, NULL); - did = H5Dcreate2(loc_id, "integer2D", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + sid = H5Screate_simple(2, dims2, NULL); + did = H5Dcreate2(loc_id, "integer2D", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf72); status = H5Pclose(dcpl); status = H5Dclose(did); status = H5Sclose(sid); /*------------------------------------------------------------------------- - * H5T_FLOAT - *------------------------------------------------------------------------- - */ + * H5T_FLOAT + *------------------------------------------------------------------------- + */ write_dset(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82); /*------------------------------------------------------------------------- - * 3D - *------------------------------------------------------------------------- - */ + * 3D + *------------------------------------------------------------------------- + */ /*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ + * H5T_STRING + *------------------------------------------------------------------------- + */ if (make_diffs) { for (i = 0; i < 4; i++) @@ -7642,8 +7624,8 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff buf13[i][j][k][l] = 'z'; } - tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, (size_t) STR_SIZE); + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, (size_t)STR_SIZE); write_dset(loc_id, 3, dims3, "string3D", tid, buf13); status = H5Tclose(tid); @@ -7652,15 +7634,15 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff for (k = 0; k < 2; k++) buf13a[i][j][k] = buf13[i][j][k]; - tid = H5Tcopy(H5T_C_S1); + tid = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid, H5T_VARIABLE); write_dset(loc_id, 3, dims3, "VLstring3D", tid, buf13a); status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ n = 1; for (i = 0; i < 4; i++) @@ -7669,7 +7651,7 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff if (make_diffs) buf23[i][j][k] = 0; else - buf23[i][j][k] = (char) n++; + buf23[i][j][k] = (char)n++; } tid = H5Tcopy(H5T_STD_B8LE); @@ -7677,18 +7659,18 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ - tid = H5Tcreate(H5T_OPAQUE, (size_t) 1); + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_dset(loc_id, 3, dims3, "opaque3D", tid, buf23); status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ n = 1; for (i = 0; i < 4; i++) @@ -7696,10 +7678,10 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff for (k = 0; k < 2; k++) { if (make_diffs) { buf33[i][j][k].a = 0; - buf33[i][j][k].b = 0.0F; + buf33[i][j][k].b = 0.0; } else { - buf33[i][j][k].a = (char) n++; + buf33[i][j][k].a = (char)n++; buf33[i][j][k].b = n++; } } @@ -7711,22 +7693,22 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_REFERENCE (H5R_OBJECT object reference) - *------------------------------------------------------------------------- - */ + * H5T_REFERENCE (H5R_OBJECT object reference) + *------------------------------------------------------------------------- + */ /* Create references to dataset */ if (dset_name) { for (i = 0; i < 4; i++) for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) - status = H5Rcreate(&buf43[i][j][k], fid, dset_name, H5R_OBJECT, (hid_t) -1); + status = H5Rcreate(&buf43[i][j][k], fid, dset_name, H5R_OBJECT, (hid_t)-1); write_dset(loc_id, 3, dims3, "reference3D", H5T_STD_REF_OBJ, buf43); } /*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ + * H5T_ENUM + *------------------------------------------------------------------------- + */ tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); H5Tenum_insert(tid, "RED", (val = 0, &val)); @@ -7735,40 +7717,40 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ + * H5T_VLEN + *------------------------------------------------------------------------- + */ /* Allocate and initialize VL dataset to write */ n = 0; for (i = 0; i < 4; i++) for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { - buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int)); buf53[i][j][k].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) { if (make_diffs) - ((int *) buf53[i][j][k].p)[l] = 0; + ((int *)buf53[i][j][k].p)[l] = 0; else - ((int *) buf53[i][j][k].p)[l] = n++; + ((int *)buf53[i][j][k].p)[l] = n++; } } - sid = H5Screate_simple(3, dims3, NULL); - tid = H5Tvlen_create(H5T_NATIVE_INT); - did = H5Dcreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + sid = H5Screate_simple(3, dims3, NULL); + tid = H5Tvlen_create(H5T_NATIVE_INT); + did = H5Dcreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf53); assert(status >= 0); - status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53); + status = H5Treclaim(tid, sid, H5P_DEFAULT, buf53); assert(status >= 0); status = H5Dclose(did); status = H5Tclose(tid); status = H5Sclose(sid); /*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ + * H5T_ARRAY + *------------------------------------------------------------------------- + */ n = 1; for (i = 0; i < 24; i++) @@ -7784,9 +7766,9 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff status = H5Tclose(tid); /*------------------------------------------------------------------------- - * H5T_INTEGER and H5T_FLOAT - *------------------------------------------------------------------------- - */ + * H5T_INTEGER and H5T_FLOAT + *------------------------------------------------------------------------- + */ n = 1; f = 1; for (i = 0; i < 4; i++) @@ -7794,7 +7776,7 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff for (k = 0; k < 2; k++) { if (make_diffs) { buf73[i][j][k] = 0; - buf83[i][j][k] = 0.0F; + buf83[i][j][k] = 0.0; } else { buf73[i][j][k] = n++; @@ -7816,44 +7798,43 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff *------------------------------------------------------------------------- */ -static -void gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */) +static void +gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */) { /* data dataset */ - hid_t did1 = -1; /* dataset ID */ - hid_t sid1 = -1; /* dataspace ID */ - hsize_t dims1[2] = { 10, 10 };/* dimensions */ - int *buf; /* dataset buffer */ + hid_t did1 = H5I_INVALID_HID; /* dataset ID */ + hid_t sid1 = H5I_INVALID_HID; /* dataspace ID */ + hsize_t dims1[2] = {10, 10}; /* dimensions */ + int * buf; /* dataset buffer */ /* reference dataset */ - hid_t did2 = -1; /* dataset ID */ - hid_t sid2 = -1; /* dataspace ID */ - hsize_t dims2[] = { 2 }; /* 2 references */ - hdset_reg_ref_t *rbuf; /* buffer for write the references */ - hsize_t start[10]; /* starting location of hyperslab */ - hsize_t count[10]; /* element count of hyperslab */ - hsize_t coord[5][2]; /* coordinates for point selection */ - herr_t status; - int i; + hid_t did2 = H5I_INVALID_HID; /* dataset ID */ + hid_t sid2 = H5I_INVALID_HID; /* dataspace ID */ + hsize_t dims2[] = {2}; /* 2 references */ + hdset_reg_ref_t * rbuf; /* buffer for write the references */ + hsize_t start[10]; /* starting location of hyperslab */ + hsize_t count[10]; /* element count of hyperslab */ + hsize_t coord[5][2]; /* coordinates for point selection */ + herr_t H5_ATTR_NDEBUG_UNUSED status; + int i; /* allocate the buffer for write the references */ - rbuf = (hdset_reg_ref_t *) HDcalloc((size_t )2, sizeof(hdset_reg_ref_t)); + rbuf = (hdset_reg_ref_t *)HDcalloc((size_t)2, sizeof(hdset_reg_ref_t)); /* allocate the buffer for write the data dataset */ - buf = (int *) HDmalloc(10 * 10 * sizeof(int)); + buf = (int *)HDmalloc(10 * 10 * sizeof(int)); for (i = 0; i < 10 * 10; i++) buf[i] = i; /* create the data dataset */ - sid1 = H5Screate_simple(2, dims1, NULL); - did1 = H5Dcreate2(fid, "dsetref", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + sid1 = H5Screate_simple(2, dims1, NULL); + did1 = H5Dcreate2(fid, "dsetref", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); HDassert(status >= 0); /* create the reference dataset */ sid2 = H5Screate_simple(1, dims2, NULL); - did2 = H5Dcreate2(fid, "refreg", H5T_STD_REF_DSETREG, sid2, H5P_DEFAULT, - H5P_DEFAULT, H5P_DEFAULT); + did2 = H5Dcreate2(fid, "refreg", H5T_STD_REF_DSETREG, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* create the references */ /* select hyperslab for first reference */ @@ -7896,7 +7877,7 @@ void gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */) coord[4][0] = 1; coord[4][1] = 7; } - H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t) 5, (const hsize_t *) coord); + H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t)5, (const hsize_t *)coord); H5Sget_select_npoints(sid1); /* store second dataset region */ @@ -7924,29 +7905,29 @@ void gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */) * Function: test_hyperslab * * Purpose: test diff by hyperslabs. create a dataset with 1GB dimensions - * by iterating trough 1KB hyperslabs + * by iterating through 1KB hyperslabs * *------------------------------------------------------------------------- */ -static -int test_hyperslab(const char *fname, int make_diffs /* flag to modify data buffers */) +static int +test_hyperslab(const char *fname, int make_diffs /* flag to modify data buffers */) { - hid_t did = -1; - hid_t fid = -1; - hid_t f_sid = -1; - hid_t m_sid = -1; - hid_t tid = -1; - hid_t dcpl = -1; - hsize_t dims[1] = { GBLL }; /* dataset dimensions */ - hsize_t hs_size[1] = { GBLL / (1024 * 1024) }; /* hyperslab dimensions */ - hsize_t chunk_dims[1] = { GBLL / 1024 }; /* chunk dimensions */ + hid_t did = H5I_INVALID_HID; + hid_t fid = H5I_INVALID_HID; + hid_t f_sid = H5I_INVALID_HID; + hid_t m_sid = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; + hsize_t dims[1] = {GBLL}; /* dataset dimensions */ + hsize_t hs_size[1] = {GBLL / (1024 * 1024)}; /* hyperslab dimensions */ + hsize_t chunk_dims[1] = {GBLL / 1024}; /* chunk dimensions */ hsize_t hs_start[1]; - size_t size; - size_t nelmts = (size_t)GBLL / (1024 * 1024); /* elements in each hyperslab */ - char fillvalue = -1; - char *buf = NULL; - int i, j, s; - char c; + size_t size; + size_t nelmts = (size_t)GBLL / (1024 * 1024); /* elements in each hyperslab */ + char fillvalue = -1; + char * buf = NULL; + int i, j, s; + char c; /* create */ fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -7968,8 +7949,8 @@ int test_hyperslab(const char *fname, int make_diffs /* flag to modify data buff goto out; /* create a evenly divided buffer from 0 to 127 */ - buf = (char *) HDmalloc((size_t)(nelmts * size)); - s = 1024 * 1024 / 127; + buf = (char *)HDmalloc((size_t)(nelmts * size)); + s = 1024 * 1024 / 127; for (i = 0, j = 0, c = 0; i < 1024 * 1024; j++, i++) { if (j == s) { c++; @@ -7983,7 +7964,7 @@ int test_hyperslab(const char *fname, int make_diffs /* flag to modify data buff if (make_diffs && i == 512 * 512) HDmemset(buf, 0, nelmts); - hs_start[0] = (unsigned long long) i * GBLL / (1024 * 1024); + hs_start[0] = (unsigned long long)i * GBLL / (1024 * 1024); if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, hs_start, NULL, hs_size, NULL) < 0) goto out; @@ -8010,16 +7991,71 @@ int test_hyperslab(const char *fname, int make_diffs /* flag to modify data buff return 0; out: - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Pclose(dcpl); H5Sclose(f_sid); H5Sclose(m_sid); H5Dclose(did); H5Fclose(fid); - } H5E_END_TRY; + } + H5E_END_TRY; return -1; } +/* + * Function: test_double_epsilion + * + * Purpose: Create test files to compare data with epsilion + */ +static void +test_double_epsilon(const char *fname1, const char *fname2) +{ + hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID; + hsize_t dims1[2] = {4, 7}; + double wdata[4][7]; + int i, j; + + /*------------------------------------------------------------------------- + * create two files + *------------------------------------------------------------------------- + */ + if ((fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR; + if ((fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR; + + /* + * Initialize data. + */ + for (i = 0; i < 4; i++) + for (j = 0; j < 7; j++) + wdata[i][j] = 0.0; + + /* dataset */ + if (write_dset(fid1, 2, dims1, "dataset", H5T_IEEE_F64LE, wdata) < 0) + PROGRAM_ERROR; + + /* + * Initialize data. + */ + for (i = 0; i < 4; i++) + for (j = 0; j < 7; j++) + wdata[i][j] = (double)1.e-19; + + /* dataset */ + if (write_dset(fid2, 2, dims1, "dataset", H5T_IEEE_F64LE, wdata) < 0) + PROGRAM_ERROR; + +error: + H5E_BEGIN_TRY + { + H5Fclose(fid1); + H5Fclose(fid2); + } + H5E_END_TRY; +} + /*------------------------------------------------------------------------- * Function: write_attr * @@ -8027,11 +8063,11 @@ out: * *------------------------------------------------------------------------- */ -static -int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf) +static int +write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf) { - hid_t aid = -1; - hid_t sid = -1; + hid_t aid = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; /* create a space */ if ((sid = H5Screate_simple(rank, dims, NULL)) < 0) @@ -8070,37 +8106,38 @@ out: static herr_t write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf) { - hid_t did = -1; - hid_t sid = -1; + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; /* create a space */ - if((sid = H5Screate_simple(rank, dims, NULL)) < 0) - PROGRAM_ERROR + if ((sid = H5Screate_simple(rank, dims, NULL)) < 0) + PROGRAM_ERROR; /* create the dataset */ - if((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - PROGRAM_ERROR + if ((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR; /* write */ - if(buf) - if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - PROGRAM_ERROR + if (buf) + if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + PROGRAM_ERROR; /* close */ - if(H5Dclose(did) < 0) - PROGRAM_ERROR - if(H5Sclose(sid) < 0) - PROGRAM_ERROR + if (H5Dclose(did) < 0) + PROGRAM_ERROR; + if (H5Sclose(sid) < 0) + PROGRAM_ERROR; return SUCCEED; error: - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Dclose(did); H5Sclose(sid); - } H5E_END_TRY; + } + H5E_END_TRY; return FAIL; } /* end write_dset() */ - diff --git a/tools/test/h5diff/testfiles/h5diff_10.txt b/tools/test/h5diff/testfiles/h5diff_10.txt index 11ad800..b1d607e 100644 --- a/tools/test/h5diff/testfiles/h5diff_10.txt +++ b/tools/test/h5diff/testfiles/h5diff_10.txt @@ -4,6 +4,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] [obj1] Name of an HDF5 object, in absolute path [obj2] Name of an HDF5 object, in absolute path + ERROR + --enable-error-stack Prints messages from the HDF5 error stack as they occur. + Optional value 2 also prints file open errors. OPTIONS -h, --help Print a usage message and exit. @@ -17,14 +20,35 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Verbose mode with level. Print differences and list of objects. Level of detail depends on value of N: 0 : Identical to '-v' or '--verbose'. - 1 : All level 0 information plus one-line attribute - status summary. - 2 : All level 1 information plus extended attribute - status report. + 1 : All level 0 information plus one-line attribute status summary. + 2 : All level 1 information plus extended attribute status report. + 3 : All level 2 information plus file names. -q, --quiet Quiet mode. Do not produce output. - --enable-error-stack - Prints messages from the HDF5 error stack as they occur. + --vol-value-1 Value (ID) of the VOL connector to use for opening the + first HDF5 file specified + --vol-name-1 Name of the VOL connector to use for opening the first + HDF5 file specified + --vol-info-1 VOL-specific info to pass to the VOL connector used for + opening the first HDF5 file specified + --vol-value-2 Value (ID) of the VOL connector to use for opening the + second HDF5 file specified + --vol-name-2 Name of the VOL connector to use for opening the second + HDF5 file specified + --vol-info-2 VOL-specific info to pass to the VOL connector used for + opening the second HDF5 file specified + --vfd-value-1 Value (ID) of the VFL driver to use for opening the + first HDF5 file specified + --vfd-name-1 Name of the VFL driver to use for opening the first + HDF5 file specified + --vfd-info-1 VFD-specific info to pass to the VFL driver used for + opening the first HDF5 file specified + --vfd-value-2 Value (ID) of the VFL driver to use for opening the + second HDF5 file specified + --vfd-name-2 Name of the VFL driver to use for opening the second + HDF5 file specified + --vfd-info-2 VFD-specific info to pass to the VFL driver used for + opening the second HDF5 file specified --follow-symlinks Follow symbolic links (soft links and external links and compare the) links' target objects. @@ -97,8 +121,16 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] excluded. This option can be used repeatedly to exclude multiple paths. + --exclude-attribute "path/to/object/with/attribute" + Exclude attributes on the specified path to an object when comparing files or groups. + + If there are multiple paths to an object, only the specified path(s) + will be excluded; the comparison will include any path not explicitly + excluded. + This option can be used repeatedly to exclude multiple paths. + Modes of output: - Default mode: print the number of differences found and where they occured + Default mode: print the number of differences found and where they occurred -r Report mode: print the above plus the differences -v Verbose mode: print the above plus a list of objects and warnings -q Quiet mode: do not print output @@ -124,6 +156,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_58.txt b/tools/test/h5diff/testfiles/h5diff_58.txt index d27a0c9..da147bc 100644 --- a/tools/test/h5diff/testfiles/h5diff_58.txt +++ b/tools/test/h5diff/testfiles/h5diff_58.txt @@ -1,3 +1,4 @@ + dataset: </refreg> and </refreg> Referenced dataset 10784 10784 ------------------------------------------------------------ @@ -8,4 +9,7 @@ point #1 (2,2) (3,3) point #3 (1,6) (2,5) point #4 (2,8) (1,7) 4 differences found + obj1 obj2 + -------------------------------------- +Attributes status: 0 common, 0 only in obj1, 0 only in obj2 EXIT CODE: 1 diff --git a/tools/test/h5diff/testfiles/h5diff_58_ref.txt b/tools/test/h5diff/testfiles/h5diff_58_ref.txt new file mode 100644 index 0000000..48a4b33 --- /dev/null +++ b/tools/test/h5diff/testfiles/h5diff_58_ref.txt @@ -0,0 +1,37 @@ + +dataset: </g1/reference2D> and </g1/reference2D> +size: [2] [2] +position reference2D reference2D difference +------------------------------------------------------------ +[ 0 ] 1 0 1 +[ 1 ] 2 0 2 +size: [2] [2] +position reference2D reference2D difference +------------------------------------------------------------ +[ 0 ] 1 0 1 +[ 1 ] 2 0 2 +size: [2] [2] +position reference2D reference2D difference +------------------------------------------------------------ +[ 0 ] 1 0 1 +[ 1 ] 2 0 2 +size: [2] [2] +position reference2D reference2D difference +------------------------------------------------------------ +[ 0 ] 1 0 1 +[ 1 ] 2 0 2 +size: [2] [2] +position reference2D reference2D difference +------------------------------------------------------------ +[ 0 ] 1 0 1 +[ 1 ] 2 0 2 +size: [2] [2] +position reference2D reference2D difference +------------------------------------------------------------ +[ 0 ] 1 0 1 +[ 1 ] 2 0 2 +12 differences found + obj1 obj2 + -------------------------------------- +Attributes status: 0 common, 0 only in obj1, 0 only in obj2 +EXIT CODE: 1 diff --git a/tools/test/h5diff/testfiles/h5diff_600.txt b/tools/test/h5diff/testfiles/h5diff_600.txt index 13d627c..5236964 100644 --- a/tools/test/h5diff/testfiles/h5diff_600.txt +++ b/tools/test/h5diff/testfiles/h5diff_600.txt @@ -4,6 +4,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] [obj1] Name of an HDF5 object, in absolute path [obj2] Name of an HDF5 object, in absolute path + ERROR + --enable-error-stack Prints messages from the HDF5 error stack as they occur. + Optional value 2 also prints file open errors. OPTIONS -h, --help Print a usage message and exit. @@ -17,14 +20,35 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Verbose mode with level. Print differences and list of objects. Level of detail depends on value of N: 0 : Identical to '-v' or '--verbose'. - 1 : All level 0 information plus one-line attribute - status summary. - 2 : All level 1 information plus extended attribute - status report. + 1 : All level 0 information plus one-line attribute status summary. + 2 : All level 1 information plus extended attribute status report. + 3 : All level 2 information plus file names. -q, --quiet Quiet mode. Do not produce output. - --enable-error-stack - Prints messages from the HDF5 error stack as they occur. + --vol-value-1 Value (ID) of the VOL connector to use for opening the + first HDF5 file specified + --vol-name-1 Name of the VOL connector to use for opening the first + HDF5 file specified + --vol-info-1 VOL-specific info to pass to the VOL connector used for + opening the first HDF5 file specified + --vol-value-2 Value (ID) of the VOL connector to use for opening the + second HDF5 file specified + --vol-name-2 Name of the VOL connector to use for opening the second + HDF5 file specified + --vol-info-2 VOL-specific info to pass to the VOL connector used for + opening the second HDF5 file specified + --vfd-value-1 Value (ID) of the VFL driver to use for opening the + first HDF5 file specified + --vfd-name-1 Name of the VFL driver to use for opening the first + HDF5 file specified + --vfd-info-1 VFD-specific info to pass to the VFL driver used for + opening the first HDF5 file specified + --vfd-value-2 Value (ID) of the VFL driver to use for opening the + second HDF5 file specified + --vfd-name-2 Name of the VFL driver to use for opening the second + HDF5 file specified + --vfd-info-2 VFD-specific info to pass to the VFL driver used for + opening the second HDF5 file specified --follow-symlinks Follow symbolic links (soft links and external links and compare the) links' target objects. @@ -97,8 +121,16 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] excluded. This option can be used repeatedly to exclude multiple paths. + --exclude-attribute "path/to/object/with/attribute" + Exclude attributes on the specified path to an object when comparing files or groups. + + If there are multiple paths to an object, only the specified path(s) + will be excluded; the comparison will include any path not explicitly + excluded. + This option can be used repeatedly to exclude multiple paths. + Modes of output: - Default mode: print the number of differences found and where they occured + Default mode: print the number of differences found and where they occurred -r Report mode: print the above plus the differences -v Verbose mode: print the above plus a list of objects and warnings -q Quiet mode: do not print output @@ -124,6 +156,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_603.txt b/tools/test/h5diff/testfiles/h5diff_603.txt index 0d6b474..e7bad17 100644 --- a/tools/test/h5diff/testfiles/h5diff_603.txt +++ b/tools/test/h5diff/testfiles/h5diff_603.txt @@ -5,6 +5,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] [obj1] Name of an HDF5 object, in absolute path [obj2] Name of an HDF5 object, in absolute path + ERROR + --enable-error-stack Prints messages from the HDF5 error stack as they occur. + Optional value 2 also prints file open errors. OPTIONS -h, --help Print a usage message and exit. @@ -18,14 +21,35 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Verbose mode with level. Print differences and list of objects. Level of detail depends on value of N: 0 : Identical to '-v' or '--verbose'. - 1 : All level 0 information plus one-line attribute - status summary. - 2 : All level 1 information plus extended attribute - status report. + 1 : All level 0 information plus one-line attribute status summary. + 2 : All level 1 information plus extended attribute status report. + 3 : All level 2 information plus file names. -q, --quiet Quiet mode. Do not produce output. - --enable-error-stack - Prints messages from the HDF5 error stack as they occur. + --vol-value-1 Value (ID) of the VOL connector to use for opening the + first HDF5 file specified + --vol-name-1 Name of the VOL connector to use for opening the first + HDF5 file specified + --vol-info-1 VOL-specific info to pass to the VOL connector used for + opening the first HDF5 file specified + --vol-value-2 Value (ID) of the VOL connector to use for opening the + second HDF5 file specified + --vol-name-2 Name of the VOL connector to use for opening the second + HDF5 file specified + --vol-info-2 VOL-specific info to pass to the VOL connector used for + opening the second HDF5 file specified + --vfd-value-1 Value (ID) of the VFL driver to use for opening the + first HDF5 file specified + --vfd-name-1 Name of the VFL driver to use for opening the first + HDF5 file specified + --vfd-info-1 VFD-specific info to pass to the VFL driver used for + opening the first HDF5 file specified + --vfd-value-2 Value (ID) of the VFL driver to use for opening the + second HDF5 file specified + --vfd-name-2 Name of the VFL driver to use for opening the second + HDF5 file specified + --vfd-info-2 VFD-specific info to pass to the VFL driver used for + opening the second HDF5 file specified --follow-symlinks Follow symbolic links (soft links and external links and compare the) links' target objects. @@ -98,8 +122,16 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] excluded. This option can be used repeatedly to exclude multiple paths. + --exclude-attribute "path/to/object/with/attribute" + Exclude attributes on the specified path to an object when comparing files or groups. + + If there are multiple paths to an object, only the specified path(s) + will be excluded; the comparison will include any path not explicitly + excluded. + This option can be used repeatedly to exclude multiple paths. + Modes of output: - Default mode: print the number of differences found and where they occured + Default mode: print the number of differences found and where they occurred -r Report mode: print the above plus the differences -v Verbose mode: print the above plus a list of objects and warnings -q Quiet mode: do not print output @@ -125,6 +157,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_606.txt b/tools/test/h5diff/testfiles/h5diff_606.txt index 94f44e8..410528d 100644 --- a/tools/test/h5diff/testfiles/h5diff_606.txt +++ b/tools/test/h5diff/testfiles/h5diff_606.txt @@ -5,6 +5,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] [obj1] Name of an HDF5 object, in absolute path [obj2] Name of an HDF5 object, in absolute path + ERROR + --enable-error-stack Prints messages from the HDF5 error stack as they occur. + Optional value 2 also prints file open errors. OPTIONS -h, --help Print a usage message and exit. @@ -18,14 +21,35 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Verbose mode with level. Print differences and list of objects. Level of detail depends on value of N: 0 : Identical to '-v' or '--verbose'. - 1 : All level 0 information plus one-line attribute - status summary. - 2 : All level 1 information plus extended attribute - status report. + 1 : All level 0 information plus one-line attribute status summary. + 2 : All level 1 information plus extended attribute status report. + 3 : All level 2 information plus file names. -q, --quiet Quiet mode. Do not produce output. - --enable-error-stack - Prints messages from the HDF5 error stack as they occur. + --vol-value-1 Value (ID) of the VOL connector to use for opening the + first HDF5 file specified + --vol-name-1 Name of the VOL connector to use for opening the first + HDF5 file specified + --vol-info-1 VOL-specific info to pass to the VOL connector used for + opening the first HDF5 file specified + --vol-value-2 Value (ID) of the VOL connector to use for opening the + second HDF5 file specified + --vol-name-2 Name of the VOL connector to use for opening the second + HDF5 file specified + --vol-info-2 VOL-specific info to pass to the VOL connector used for + opening the second HDF5 file specified + --vfd-value-1 Value (ID) of the VFL driver to use for opening the + first HDF5 file specified + --vfd-name-1 Name of the VFL driver to use for opening the first + HDF5 file specified + --vfd-info-1 VFD-specific info to pass to the VFL driver used for + opening the first HDF5 file specified + --vfd-value-2 Value (ID) of the VFL driver to use for opening the + second HDF5 file specified + --vfd-name-2 Name of the VFL driver to use for opening the second + HDF5 file specified + --vfd-info-2 VFD-specific info to pass to the VFL driver used for + opening the second HDF5 file specified --follow-symlinks Follow symbolic links (soft links and external links and compare the) links' target objects. @@ -98,8 +122,16 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] excluded. This option can be used repeatedly to exclude multiple paths. + --exclude-attribute "path/to/object/with/attribute" + Exclude attributes on the specified path to an object when comparing files or groups. + + If there are multiple paths to an object, only the specified path(s) + will be excluded; the comparison will include any path not explicitly + excluded. + This option can be used repeatedly to exclude multiple paths. + Modes of output: - Default mode: print the number of differences found and where they occured + Default mode: print the number of differences found and where they occurred -r Report mode: print the above plus the differences -v Verbose mode: print the above plus a list of objects and warnings -q Quiet mode: do not print output @@ -125,6 +157,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_612.txt b/tools/test/h5diff/testfiles/h5diff_612.txt index 7f83c64..ffc191e 100644 --- a/tools/test/h5diff/testfiles/h5diff_612.txt +++ b/tools/test/h5diff/testfiles/h5diff_612.txt @@ -5,6 +5,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] [obj1] Name of an HDF5 object, in absolute path [obj2] Name of an HDF5 object, in absolute path + ERROR + --enable-error-stack Prints messages from the HDF5 error stack as they occur. + Optional value 2 also prints file open errors. OPTIONS -h, --help Print a usage message and exit. @@ -18,14 +21,35 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Verbose mode with level. Print differences and list of objects. Level of detail depends on value of N: 0 : Identical to '-v' or '--verbose'. - 1 : All level 0 information plus one-line attribute - status summary. - 2 : All level 1 information plus extended attribute - status report. + 1 : All level 0 information plus one-line attribute status summary. + 2 : All level 1 information plus extended attribute status report. + 3 : All level 2 information plus file names. -q, --quiet Quiet mode. Do not produce output. - --enable-error-stack - Prints messages from the HDF5 error stack as they occur. + --vol-value-1 Value (ID) of the VOL connector to use for opening the + first HDF5 file specified + --vol-name-1 Name of the VOL connector to use for opening the first + HDF5 file specified + --vol-info-1 VOL-specific info to pass to the VOL connector used for + opening the first HDF5 file specified + --vol-value-2 Value (ID) of the VOL connector to use for opening the + second HDF5 file specified + --vol-name-2 Name of the VOL connector to use for opening the second + HDF5 file specified + --vol-info-2 VOL-specific info to pass to the VOL connector used for + opening the second HDF5 file specified + --vfd-value-1 Value (ID) of the VFL driver to use for opening the + first HDF5 file specified + --vfd-name-1 Name of the VFL driver to use for opening the first + HDF5 file specified + --vfd-info-1 VFD-specific info to pass to the VFL driver used for + opening the first HDF5 file specified + --vfd-value-2 Value (ID) of the VFL driver to use for opening the + second HDF5 file specified + --vfd-name-2 Name of the VFL driver to use for opening the second + HDF5 file specified + --vfd-info-2 VFD-specific info to pass to the VFL driver used for + opening the second HDF5 file specified --follow-symlinks Follow symbolic links (soft links and external links and compare the) links' target objects. @@ -98,8 +122,16 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] excluded. This option can be used repeatedly to exclude multiple paths. + --exclude-attribute "path/to/object/with/attribute" + Exclude attributes on the specified path to an object when comparing files or groups. + + If there are multiple paths to an object, only the specified path(s) + will be excluded; the comparison will include any path not explicitly + excluded. + This option can be used repeatedly to exclude multiple paths. + Modes of output: - Default mode: print the number of differences found and where they occured + Default mode: print the number of differences found and where they occurred -r Report mode: print the above plus the differences -v Verbose mode: print the above plus a list of objects and warnings -q Quiet mode: do not print output @@ -125,6 +157,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_615.txt b/tools/test/h5diff/testfiles/h5diff_615.txt index 3cfe6b9..2ff50e9 100644 --- a/tools/test/h5diff/testfiles/h5diff_615.txt +++ b/tools/test/h5diff/testfiles/h5diff_615.txt @@ -5,6 +5,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] [obj1] Name of an HDF5 object, in absolute path [obj2] Name of an HDF5 object, in absolute path + ERROR + --enable-error-stack Prints messages from the HDF5 error stack as they occur. + Optional value 2 also prints file open errors. OPTIONS -h, --help Print a usage message and exit. @@ -18,14 +21,35 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Verbose mode with level. Print differences and list of objects. Level of detail depends on value of N: 0 : Identical to '-v' or '--verbose'. - 1 : All level 0 information plus one-line attribute - status summary. - 2 : All level 1 information plus extended attribute - status report. + 1 : All level 0 information plus one-line attribute status summary. + 2 : All level 1 information plus extended attribute status report. + 3 : All level 2 information plus file names. -q, --quiet Quiet mode. Do not produce output. - --enable-error-stack - Prints messages from the HDF5 error stack as they occur. + --vol-value-1 Value (ID) of the VOL connector to use for opening the + first HDF5 file specified + --vol-name-1 Name of the VOL connector to use for opening the first + HDF5 file specified + --vol-info-1 VOL-specific info to pass to the VOL connector used for + opening the first HDF5 file specified + --vol-value-2 Value (ID) of the VOL connector to use for opening the + second HDF5 file specified + --vol-name-2 Name of the VOL connector to use for opening the second + HDF5 file specified + --vol-info-2 VOL-specific info to pass to the VOL connector used for + opening the second HDF5 file specified + --vfd-value-1 Value (ID) of the VFL driver to use for opening the + first HDF5 file specified + --vfd-name-1 Name of the VFL driver to use for opening the first + HDF5 file specified + --vfd-info-1 VFD-specific info to pass to the VFL driver used for + opening the first HDF5 file specified + --vfd-value-2 Value (ID) of the VFL driver to use for opening the + second HDF5 file specified + --vfd-name-2 Name of the VFL driver to use for opening the second + HDF5 file specified + --vfd-info-2 VFD-specific info to pass to the VFL driver used for + opening the second HDF5 file specified --follow-symlinks Follow symbolic links (soft links and external links and compare the) links' target objects. @@ -98,8 +122,16 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] excluded. This option can be used repeatedly to exclude multiple paths. + --exclude-attribute "path/to/object/with/attribute" + Exclude attributes on the specified path to an object when comparing files or groups. + + If there are multiple paths to an object, only the specified path(s) + will be excluded; the comparison will include any path not explicitly + excluded. + This option can be used repeatedly to exclude multiple paths. + Modes of output: - Default mode: print the number of differences found and where they occured + Default mode: print the number of differences found and where they occurred -r Report mode: print the above plus the differences -v Verbose mode: print the above plus a list of objects and warnings -q Quiet mode: do not print output @@ -125,6 +157,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_621.txt b/tools/test/h5diff/testfiles/h5diff_621.txt index 9c34945..7db4959 100644 --- a/tools/test/h5diff/testfiles/h5diff_621.txt +++ b/tools/test/h5diff/testfiles/h5diff_621.txt @@ -5,6 +5,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] [obj1] Name of an HDF5 object, in absolute path [obj2] Name of an HDF5 object, in absolute path + ERROR + --enable-error-stack Prints messages from the HDF5 error stack as they occur. + Optional value 2 also prints file open errors. OPTIONS -h, --help Print a usage message and exit. @@ -18,14 +21,35 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Verbose mode with level. Print differences and list of objects. Level of detail depends on value of N: 0 : Identical to '-v' or '--verbose'. - 1 : All level 0 information plus one-line attribute - status summary. - 2 : All level 1 information plus extended attribute - status report. + 1 : All level 0 information plus one-line attribute status summary. + 2 : All level 1 information plus extended attribute status report. + 3 : All level 2 information plus file names. -q, --quiet Quiet mode. Do not produce output. - --enable-error-stack - Prints messages from the HDF5 error stack as they occur. + --vol-value-1 Value (ID) of the VOL connector to use for opening the + first HDF5 file specified + --vol-name-1 Name of the VOL connector to use for opening the first + HDF5 file specified + --vol-info-1 VOL-specific info to pass to the VOL connector used for + opening the first HDF5 file specified + --vol-value-2 Value (ID) of the VOL connector to use for opening the + second HDF5 file specified + --vol-name-2 Name of the VOL connector to use for opening the second + HDF5 file specified + --vol-info-2 VOL-specific info to pass to the VOL connector used for + opening the second HDF5 file specified + --vfd-value-1 Value (ID) of the VFL driver to use for opening the + first HDF5 file specified + --vfd-name-1 Name of the VFL driver to use for opening the first + HDF5 file specified + --vfd-info-1 VFD-specific info to pass to the VFL driver used for + opening the first HDF5 file specified + --vfd-value-2 Value (ID) of the VFL driver to use for opening the + second HDF5 file specified + --vfd-name-2 Name of the VFL driver to use for opening the second + HDF5 file specified + --vfd-info-2 VFD-specific info to pass to the VFL driver used for + opening the second HDF5 file specified --follow-symlinks Follow symbolic links (soft links and external links and compare the) links' target objects. @@ -98,8 +122,16 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] excluded. This option can be used repeatedly to exclude multiple paths. + --exclude-attribute "path/to/object/with/attribute" + Exclude attributes on the specified path to an object when comparing files or groups. + + If there are multiple paths to an object, only the specified path(s) + will be excluded; the comparison will include any path not explicitly + excluded. + This option can be used repeatedly to exclude multiple paths. + Modes of output: - Default mode: print the number of differences found and where they occured + Default mode: print the number of differences found and where they occurred -r Report mode: print the above plus the differences -v Verbose mode: print the above plus a list of objects and warnings -q Quiet mode: do not print output @@ -125,6 +157,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_622.txt b/tools/test/h5diff/testfiles/h5diff_622.txt index 2b2df2f..db77f88 100644 --- a/tools/test/h5diff/testfiles/h5diff_622.txt +++ b/tools/test/h5diff/testfiles/h5diff_622.txt @@ -5,6 +5,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] [obj1] Name of an HDF5 object, in absolute path [obj2] Name of an HDF5 object, in absolute path + ERROR + --enable-error-stack Prints messages from the HDF5 error stack as they occur. + Optional value 2 also prints file open errors. OPTIONS -h, --help Print a usage message and exit. @@ -18,14 +21,35 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Verbose mode with level. Print differences and list of objects. Level of detail depends on value of N: 0 : Identical to '-v' or '--verbose'. - 1 : All level 0 information plus one-line attribute - status summary. - 2 : All level 1 information plus extended attribute - status report. + 1 : All level 0 information plus one-line attribute status summary. + 2 : All level 1 information plus extended attribute status report. + 3 : All level 2 information plus file names. -q, --quiet Quiet mode. Do not produce output. - --enable-error-stack - Prints messages from the HDF5 error stack as they occur. + --vol-value-1 Value (ID) of the VOL connector to use for opening the + first HDF5 file specified + --vol-name-1 Name of the VOL connector to use for opening the first + HDF5 file specified + --vol-info-1 VOL-specific info to pass to the VOL connector used for + opening the first HDF5 file specified + --vol-value-2 Value (ID) of the VOL connector to use for opening the + second HDF5 file specified + --vol-name-2 Name of the VOL connector to use for opening the second + HDF5 file specified + --vol-info-2 VOL-specific info to pass to the VOL connector used for + opening the second HDF5 file specified + --vfd-value-1 Value (ID) of the VFL driver to use for opening the + first HDF5 file specified + --vfd-name-1 Name of the VFL driver to use for opening the first + HDF5 file specified + --vfd-info-1 VFD-specific info to pass to the VFL driver used for + opening the first HDF5 file specified + --vfd-value-2 Value (ID) of the VFL driver to use for opening the + second HDF5 file specified + --vfd-name-2 Name of the VFL driver to use for opening the second + HDF5 file specified + --vfd-info-2 VFD-specific info to pass to the VFL driver used for + opening the second HDF5 file specified --follow-symlinks Follow symbolic links (soft links and external links and compare the) links' target objects. @@ -98,8 +122,16 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] excluded. This option can be used repeatedly to exclude multiple paths. + --exclude-attribute "path/to/object/with/attribute" + Exclude attributes on the specified path to an object when comparing files or groups. + + If there are multiple paths to an object, only the specified path(s) + will be excluded; the comparison will include any path not explicitly + excluded. + This option can be used repeatedly to exclude multiple paths. + Modes of output: - Default mode: print the number of differences found and where they occured + Default mode: print the number of differences found and where they occurred -r Report mode: print the above plus the differences -v Verbose mode: print the above plus a list of objects and warnings -q Quiet mode: do not print output @@ -125,6 +157,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_623.txt b/tools/test/h5diff/testfiles/h5diff_623.txt index 3e80438..11739be 100644 --- a/tools/test/h5diff/testfiles/h5diff_623.txt +++ b/tools/test/h5diff/testfiles/h5diff_623.txt @@ -5,6 +5,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] [obj1] Name of an HDF5 object, in absolute path [obj2] Name of an HDF5 object, in absolute path + ERROR + --enable-error-stack Prints messages from the HDF5 error stack as they occur. + Optional value 2 also prints file open errors. OPTIONS -h, --help Print a usage message and exit. @@ -18,14 +21,35 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Verbose mode with level. Print differences and list of objects. Level of detail depends on value of N: 0 : Identical to '-v' or '--verbose'. - 1 : All level 0 information plus one-line attribute - status summary. - 2 : All level 1 information plus extended attribute - status report. + 1 : All level 0 information plus one-line attribute status summary. + 2 : All level 1 information plus extended attribute status report. + 3 : All level 2 information plus file names. -q, --quiet Quiet mode. Do not produce output. - --enable-error-stack - Prints messages from the HDF5 error stack as they occur. + --vol-value-1 Value (ID) of the VOL connector to use for opening the + first HDF5 file specified + --vol-name-1 Name of the VOL connector to use for opening the first + HDF5 file specified + --vol-info-1 VOL-specific info to pass to the VOL connector used for + opening the first HDF5 file specified + --vol-value-2 Value (ID) of the VOL connector to use for opening the + second HDF5 file specified + --vol-name-2 Name of the VOL connector to use for opening the second + HDF5 file specified + --vol-info-2 VOL-specific info to pass to the VOL connector used for + opening the second HDF5 file specified + --vfd-value-1 Value (ID) of the VFL driver to use for opening the + first HDF5 file specified + --vfd-name-1 Name of the VFL driver to use for opening the first + HDF5 file specified + --vfd-info-1 VFD-specific info to pass to the VFL driver used for + opening the first HDF5 file specified + --vfd-value-2 Value (ID) of the VFL driver to use for opening the + second HDF5 file specified + --vfd-name-2 Name of the VFL driver to use for opening the second + HDF5 file specified + --vfd-info-2 VFD-specific info to pass to the VFL driver used for + opening the second HDF5 file specified --follow-symlinks Follow symbolic links (soft links and external links and compare the) links' target objects. @@ -98,8 +122,16 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] excluded. This option can be used repeatedly to exclude multiple paths. + --exclude-attribute "path/to/object/with/attribute" + Exclude attributes on the specified path to an object when comparing files or groups. + + If there are multiple paths to an object, only the specified path(s) + will be excluded; the comparison will include any path not explicitly + excluded. + This option can be used repeatedly to exclude multiple paths. + Modes of output: - Default mode: print the number of differences found and where they occured + Default mode: print the number of differences found and where they occurred -r Report mode: print the above plus the differences -v Verbose mode: print the above plus a list of objects and warnings -q Quiet mode: do not print output @@ -125,6 +157,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_624.txt b/tools/test/h5diff/testfiles/h5diff_624.txt index 7a2f585..6af9fe3 100644 --- a/tools/test/h5diff/testfiles/h5diff_624.txt +++ b/tools/test/h5diff/testfiles/h5diff_624.txt @@ -5,6 +5,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] [obj1] Name of an HDF5 object, in absolute path [obj2] Name of an HDF5 object, in absolute path + ERROR + --enable-error-stack Prints messages from the HDF5 error stack as they occur. + Optional value 2 also prints file open errors. OPTIONS -h, --help Print a usage message and exit. @@ -18,14 +21,35 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Verbose mode with level. Print differences and list of objects. Level of detail depends on value of N: 0 : Identical to '-v' or '--verbose'. - 1 : All level 0 information plus one-line attribute - status summary. - 2 : All level 1 information plus extended attribute - status report. + 1 : All level 0 information plus one-line attribute status summary. + 2 : All level 1 information plus extended attribute status report. + 3 : All level 2 information plus file names. -q, --quiet Quiet mode. Do not produce output. - --enable-error-stack - Prints messages from the HDF5 error stack as they occur. + --vol-value-1 Value (ID) of the VOL connector to use for opening the + first HDF5 file specified + --vol-name-1 Name of the VOL connector to use for opening the first + HDF5 file specified + --vol-info-1 VOL-specific info to pass to the VOL connector used for + opening the first HDF5 file specified + --vol-value-2 Value (ID) of the VOL connector to use for opening the + second HDF5 file specified + --vol-name-2 Name of the VOL connector to use for opening the second + HDF5 file specified + --vol-info-2 VOL-specific info to pass to the VOL connector used for + opening the second HDF5 file specified + --vfd-value-1 Value (ID) of the VFL driver to use for opening the + first HDF5 file specified + --vfd-name-1 Name of the VFL driver to use for opening the first + HDF5 file specified + --vfd-info-1 VFD-specific info to pass to the VFL driver used for + opening the first HDF5 file specified + --vfd-value-2 Value (ID) of the VFL driver to use for opening the + second HDF5 file specified + --vfd-name-2 Name of the VFL driver to use for opening the second + HDF5 file specified + --vfd-info-2 VFD-specific info to pass to the VFL driver used for + opening the second HDF5 file specified --follow-symlinks Follow symbolic links (soft links and external links and compare the) links' target objects. @@ -98,8 +122,16 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] excluded. This option can be used repeatedly to exclude multiple paths. + --exclude-attribute "path/to/object/with/attribute" + Exclude attributes on the specified path to an object when comparing files or groups. + + If there are multiple paths to an object, only the specified path(s) + will be excluded; the comparison will include any path not explicitly + excluded. + This option can be used repeatedly to exclude multiple paths. + Modes of output: - Default mode: print the number of differences found and where they occured + Default mode: print the number of differences found and where they occurred -r Report mode: print the above plus the differences -v Verbose mode: print the above plus a list of objects and warnings -q Quiet mode: do not print output @@ -125,6 +157,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_70.txt b/tools/test/h5diff/testfiles/h5diff_70.txt index efa34ea..b0b8bf6 100644 --- a/tools/test/h5diff/testfiles/h5diff_70.txt +++ b/tools/test/h5diff/testfiles/h5diff_70.txt @@ -1183,10 +1183,42 @@ position opaque3D of </dset> opaque3D of </dset> difference [ 3 2 1 ] 24 0 24 24 differences found attribute: <reference of </dset>> and <reference of </dset>> +Not comparable: <reference of </dset>> or <reference of </dset>> is an empty dataset +Not comparable: <reference of </dset>> or <reference of </dset>> is an empty dataset 0 differences found attribute: <reference2D of </dset>> and <reference2D of </dset>> +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset 0 differences found attribute: <reference3D of </dset>> and <reference3D of </dset>> +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset 0 differences found attribute: <string of </dset>> and <string of </dset>> size: [2] [2] diff --git a/tools/test/h5diff/testfiles/h5diff_700.txt b/tools/test/h5diff/testfiles/h5diff_700.txt index 851a407..6cf9893 100644 --- a/tools/test/h5diff/testfiles/h5diff_700.txt +++ b/tools/test/h5diff/testfiles/h5diff_700.txt @@ -1187,10 +1187,42 @@ position opaque3D of </dset> opaque3D of </dset> difference [ 3 2 1 ] 24 0 24 24 differences found attribute: <reference of </dset>> and <reference of </dset>> +Not comparable: <reference of </dset>> or <reference of </dset>> is an empty dataset +Not comparable: <reference of </dset>> or <reference of </dset>> is an empty dataset 0 differences found attribute: <reference2D of </dset>> and <reference2D of </dset>> +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset 0 differences found attribute: <reference3D of </dset>> and <reference3D of </dset>> +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset 0 differences found attribute: <string of </dset>> and <string of </dset>> size: [2] [2] diff --git a/tools/test/h5diff/testfiles/h5diff_701.txt b/tools/test/h5diff/testfiles/h5diff_701.txt index 33f1a0f..4187754 100644 --- a/tools/test/h5diff/testfiles/h5diff_701.txt +++ b/tools/test/h5diff/testfiles/h5diff_701.txt @@ -1254,10 +1254,42 @@ position opaque3D of </dset> opaque3D of </dset> difference [ 3 2 1 ] 24 0 24 24 differences found attribute: <reference of </dset>> and <reference of </dset>> +Not comparable: <reference of </dset>> or <reference of </dset>> is an empty dataset +Not comparable: <reference of </dset>> or <reference of </dset>> is an empty dataset 0 differences found attribute: <reference2D of </dset>> and <reference2D of </dset>> +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset 0 differences found attribute: <reference3D of </dset>> and <reference3D of </dset>> +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset 0 differences found attribute: <string of </dset>> and <string of </dset>> size: [2] [2] diff --git a/tools/test/h5diff/testfiles/h5diff_702.txt b/tools/test/h5diff/testfiles/h5diff_702.txt index 851a407..6cf9893 100644 --- a/tools/test/h5diff/testfiles/h5diff_702.txt +++ b/tools/test/h5diff/testfiles/h5diff_702.txt @@ -1187,10 +1187,42 @@ position opaque3D of </dset> opaque3D of </dset> difference [ 3 2 1 ] 24 0 24 24 differences found attribute: <reference of </dset>> and <reference of </dset>> +Not comparable: <reference of </dset>> or <reference of </dset>> is an empty dataset +Not comparable: <reference of </dset>> or <reference of </dset>> is an empty dataset 0 differences found attribute: <reference2D of </dset>> and <reference2D of </dset>> +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset 0 differences found attribute: <reference3D of </dset>> and <reference3D of </dset>> +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset 0 differences found attribute: <string of </dset>> and <string of </dset>> size: [2] [2] diff --git a/tools/test/h5diff/testfiles/h5diff_703.txt b/tools/test/h5diff/testfiles/h5diff_703.txt index 33f1a0f..4187754 100644 --- a/tools/test/h5diff/testfiles/h5diff_703.txt +++ b/tools/test/h5diff/testfiles/h5diff_703.txt @@ -1254,10 +1254,42 @@ position opaque3D of </dset> opaque3D of </dset> difference [ 3 2 1 ] 24 0 24 24 differences found attribute: <reference of </dset>> and <reference of </dset>> +Not comparable: <reference of </dset>> or <reference of </dset>> is an empty dataset +Not comparable: <reference of </dset>> or <reference of </dset>> is an empty dataset 0 differences found attribute: <reference2D of </dset>> and <reference2D of </dset>> +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset +Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset 0 differences found attribute: <reference3D of </dset>> and <reference3D of </dset>> +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset +Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset 0 differences found attribute: <string of </dset>> and <string of </dset>> size: [2] [2] diff --git a/tools/test/h5diff/testfiles/h5diff_80.txt b/tools/test/h5diff/testfiles/h5diff_80.txt index b223eed..11dccd8 100644 --- a/tools/test/h5diff/testfiles/h5diff_80.txt +++ b/tools/test/h5diff/testfiles/h5diff_80.txt @@ -528,166 +528,166 @@ position opaque3D opaque3D difference 24 differences found dataset: </g1/reference> and </g1/reference> size: [2] [2] -position difference +position reference reference difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference reference difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 4 differences found dataset: </g1/reference2D> and </g1/reference2D> size: [2] [2] -position difference +position reference2D reference2D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference2D reference2D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference2D reference2D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference2D reference2D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference2D reference2D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference2D reference2D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 12 differences found dataset: </g1/reference3D> and </g1/reference3D> size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 size: [2] [2] -position difference +position reference3D reference3D difference ------------------------------------------------------------ [ 0 ] 1 0 1 [ 1 ] 2 0 2 diff --git a/tools/test/h5diff/testfiles/h5diff_830.txt b/tools/test/h5diff/testfiles/h5diff_830.txt new file mode 100644 index 0000000..8f00d8b --- /dev/null +++ b/tools/test/h5diff/testfiles/h5diff_830.txt @@ -0,0 +1,30 @@ +dataset: </g1/array3D> and </g1/array3D> +size: [4x3x2] [4x3x2] +position array3D array3D difference +------------------------------------------------------------ +[ 0 0 0 ] 1 0 1 +[ 0 0 0 ] 2 0 2 +[ 0 0 0 ] 3 0 3 +[ 0 0 1 ] 4 0 4 +[ 0 0 1 ] 5 0 5 +[ 0 0 1 ] 6 0 6 +[ 0 2 0 ] 13 0 13 +[ 0 2 0 ] 14 0 14 +[ 0 2 0 ] 15 0 15 +[ 0 2 1 ] 16 0 16 +[ 0 2 1 ] 17 0 17 +[ 0 2 1 ] 18 0 18 +[ 2 0 0 ] 37 0 37 +[ 2 0 0 ] 38 0 38 +[ 2 0 0 ] 39 0 39 +[ 2 0 1 ] 40 0 40 +[ 2 0 1 ] 41 0 41 +[ 2 0 1 ] 42 0 42 +[ 2 2 0 ] 49 0 49 +[ 2 2 0 ] 50 0 50 +[ 2 2 0 ] 51 0 51 +[ 2 2 1 ] 52 0 52 +[ 2 2 1 ] 53 0 53 +[ 2 2 1 ] 54 0 54 +24 differences found +EXIT CODE: 1 diff --git a/tools/test/h5diff/testfiles/h5diff_eps.txt b/tools/test/h5diff/testfiles/h5diff_eps.txt new file mode 100644 index 0000000..3a71366 --- /dev/null +++ b/tools/test/h5diff/testfiles/h5diff_eps.txt @@ -0,0 +1,17 @@ +file1: h5diff_eps1.h5 +file2: h5diff_eps2.h5 + +file1 file2 +--------------------------------------- + x x / + x x /DS1 + + +group : </> and </> +0 differences found +Attributes status: 0 common, 0 only in obj1, 0 only in obj2 + +dataset: </DS1> and </DS1> +0 differences found +Attributes status: 0 common, 0 only in obj1, 0 only in obj2 +EXIT CODE: 0 diff --git a/tools/test/h5diff/testfiles/h5diff_eps1.h5 b/tools/test/h5diff/testfiles/h5diff_eps1.h5 Binary files differnew file mode 100644 index 0000000..2803a1d --- /dev/null +++ b/tools/test/h5diff/testfiles/h5diff_eps1.h5 diff --git a/tools/test/h5diff/testfiles/h5diff_eps2.h5 b/tools/test/h5diff/testfiles/h5diff_eps2.h5 Binary files differnew file mode 100644 index 0000000..4acf27a --- /dev/null +++ b/tools/test/h5diff/testfiles/h5diff_eps2.h5 diff --git a/tools/test/h5diff/testfiles/h5diff_reg.txt b/tools/test/h5diff/testfiles/h5diff_reg.txt new file mode 100644 index 0000000..ecb6275 --- /dev/null +++ b/tools/test/h5diff/testfiles/h5diff_reg.txt @@ -0,0 +1,14 @@ + +dataset: </Dataset3> and </Dataset3> +attribute: <Attr1 of <Dataset3>> and <Attr1 of <Dataset3>> +0 differences found +Warning: Cannot open referenced attribute1 +attribute: <Attr2 of <Dataset3>> and <Attr2 of <Dataset3>> +0 differences found +attribute: <Attr3 of <Dataset3>> and <Attr3 of <Dataset3>> +0 differences found +0 differences found + obj1 obj2 + -------------------------------------- +Attributes status: 0 common, 0 only in obj1, 0 only in obj2 +EXIT CODE: 0 diff --git a/tools/test/h5diff/testfiles/diff_strings1.h5 b/tools/test/h5diff/testfiles/h5diff_strings1.h5 Binary files differindex 0f8b380..0f8b380 100644 --- a/tools/test/h5diff/testfiles/diff_strings1.h5 +++ b/tools/test/h5diff/testfiles/h5diff_strings1.h5 diff --git a/tools/test/h5diff/testfiles/diff_strings2.h5 b/tools/test/h5diff/testfiles/h5diff_strings2.h5 Binary files differindex e8520ae..e8520ae 100644 --- a/tools/test/h5diff/testfiles/diff_strings2.h5 +++ b/tools/test/h5diff/testfiles/h5diff_strings2.h5 diff --git a/tools/test/h5diff/testh5diff.sh.in b/tools/test/h5diff/testh5diff.sh.in index 557d2ff..6871463 100644 --- a/tools/test/h5diff/testh5diff.sh.in +++ b/tools/test/h5diff/testh5diff.sh.in @@ -7,7 +7,7 @@ # 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. +# distribution tree, or in https://www.hdfgroup.org/licenses. # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # @@ -85,6 +85,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_attr2.h5 $SRC_H5DIFF_TESTFILES/h5diff_attr3.h5 $SRC_H5DIFF_TESTFILES/h5diff_dset1.h5 $SRC_H5DIFF_TESTFILES/h5diff_dset2.h5 +$SRC_H5DIFF_TESTFILES/h5diff_dset3.h5 $SRC_H5DIFF_TESTFILES/h5diff_hyper1.h5 $SRC_H5DIFF_TESTFILES/h5diff_hyper2.h5 $SRC_H5DIFF_TESTFILES/h5diff_empty.h5 @@ -119,8 +120,10 @@ $SRC_H5DIFF_TESTFILES/h5diff_attr_v_level2.h5 $SRC_H5DIFF_TESTFILES/h5diff_enum_invalid_values.h5 $SRC_H5DIFF_TESTFILES/non_comparables1.h5 $SRC_H5DIFF_TESTFILES/non_comparables2.h5 -$SRC_H5DIFF_TESTFILES/diff_strings1.h5 -$SRC_H5DIFF_TESTFILES/diff_strings2.h5 +$SRC_H5DIFF_TESTFILES/h5diff_strings1.h5 +$SRC_H5DIFF_TESTFILES/h5diff_strings2.h5 +$SRC_H5DIFF_TESTFILES/h5diff_eps1.h5 +$SRC_H5DIFF_TESTFILES/h5diff_eps2.h5 $SRC_TOOLS_TESTFILES/tvlstr.h5 " @@ -150,6 +153,19 @@ $SRC_TOOLS_TESTFILES/vds/5_c.h5 $SRC_TOOLS_TESTFILES/vds/5_vds.h5 " +LIST_HDF5_STD_REF_OBJ_TEST_FILES=" +$SRC_TOOLS_TESTFILES/trefer_attr.h5 +$SRC_TOOLS_TESTFILES/trefer_compat.h5 +$SRC_TOOLS_TESTFILES/trefer_ext1.h5 +$SRC_TOOLS_TESTFILES/trefer_ext2.h5 +$SRC_TOOLS_TESTFILES/trefer_grp.h5 +$SRC_TOOLS_TESTFILES/trefer_obj_del.h5 +$SRC_TOOLS_TESTFILES/trefer_obj.h5 +$SRC_TOOLS_TESTFILES/trefer_param.h5 +$SRC_TOOLS_TESTFILES/trefer_reg_1d.h5 +$SRC_TOOLS_TESTFILES/trefer_reg.h5 +" + LIST_OTHER_TEST_FILES=" $SRC_H5DIFF_TESTFILES/h5diff_10.txt $SRC_H5DIFF_TESTFILES/h5diff_100.txt @@ -259,6 +275,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_55.txt $SRC_H5DIFF_TESTFILES/h5diff_56.txt $SRC_H5DIFF_TESTFILES/h5diff_57.txt $SRC_H5DIFF_TESTFILES/h5diff_58.txt +$SRC_H5DIFF_TESTFILES/h5diff_58_ref.txt $SRC_H5DIFF_TESTFILES/h5diff_59.txt $SRC_H5DIFF_TESTFILES/h5diff_500.txt $SRC_H5DIFF_TESTFILES/h5diff_501.txt @@ -335,19 +352,24 @@ $SRC_H5DIFF_TESTFILES/h5diff_708.txt $SRC_H5DIFF_TESTFILES/h5diff_709.txt $SRC_H5DIFF_TESTFILES/h5diff_710.txt $SRC_H5DIFF_TESTFILES/h5diff_80.txt +$SRC_H5DIFF_TESTFILES/h5diff_800.txt +$SRC_H5DIFF_TESTFILES/h5diff_801.txt +$SRC_H5DIFF_TESTFILES/h5diff_830.txt $SRC_H5DIFF_TESTFILES/h5diff_90.txt $SRC_H5DIFF_TESTFILES/h5diff_8625.txt $SRC_H5DIFF_TESTFILES/h5diff_8639.txt +$SRC_H5DIFF_TESTFILES/h5diff_reg.txt $SRC_H5DIFF_TESTFILES/h5diff_v1.txt $SRC_H5DIFF_TESTFILES/h5diff_v2.txt $SRC_H5DIFF_TESTFILES/h5diff_v3.txt $SRC_H5DIFF_TESTFILES/h5diff_vlstr.txt +$SRC_H5DIFF_TESTFILES/h5diff_eps.txt " # # copy test files and expected output files from source dirs to test dir # -COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_HDF5_VDS_TEST_FILES $LIST_OTHER_TEST_FILES $LIST_HDF5_TEST_FILES_XML $LIST_OTHER_TEST_FILES_XML" +COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_HDF5_VDS_TEST_FILES $LIST_HDF5_STD_REF_OBJ_TEST_FILES $LIST_OTHER_TEST_FILES $LIST_HDF5_TEST_FILES_XML $LIST_OTHER_TEST_FILES_XML" COPY_TESTFILES_TO_TESTDIR() { @@ -433,7 +455,7 @@ done # RUNSERIAL is used. Check if it can return exit code from executalbe correctly. if [ -n "$RUNSERIAL_NOEXITCODE" ]; then - echo "***Warning*** Serial Exit Code is not passed back to shell corretly." + echo "***Warning*** Serial Exit Code is not passed back to shell correctly." echo "***Warning*** Exit code checking is skipped." h5haveexitcode=no fi @@ -479,22 +501,24 @@ TOOLTEST() { # Run test. TESTING $H5DIFF $@ ( - #echo "#############################" - #echo "Expected output for '$H5DIFF $@'" - #echo "#############################" - cd $TESTDIR - eval $RUNCMD $H5DIFF_BIN "$@" + #echo "#############################" + #echo "Expected output for '$H5DIFF $@'" + #echo "#############################" + cd $TESTDIR + eval $RUNCMD $H5DIFF_BIN "$@" ) >$actual 2>$actual_err EXIT_CODE=$? + # save actual and actual_err in case they are needed later. cp $actual $actual_sav STDOUT_FILTER $actual cp $actual_err $actual_err_sav STDERR_FILTER $actual_err + # don't add exit code check in pmode, as it causes failure. (exit code # is from mpirun not tool) # if any problem occurs relate to an exit code, it will be caught in - # serial mode, so the test is fullfilled. + # serial mode, so the test is fulfilled. if test $h5haveexitcode = 'yes' -a -z "$pmode"; then echo "EXIT CODE: $EXIT_CODE" >> $actual fi @@ -524,23 +548,24 @@ TOOLTEST() { # is done by serial mode. grep -v "EXIT CODE:" $expect_sorted > $expect_sorted.noexit mv $expect_sorted.noexit $expect_sorted - if $CMP $expect_sorted $actual_sorted; then - echo " PASSED" - else - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - if test yes = "$verbose"; then - echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)" - $DIFF $expect_sorted $actual_sorted |sed 's/^/ /' - echo "====The actual output ($actual_sav)" - sed 's/^/ /' < $actual_sav - echo "====The actual stderr ($actual_err_sav)" - sed 's/^/ /' < $actual_err_sav - echo "====End of actual stderr ($actual_err_sav)" - echo "" + + if $CMP $expect_sorted $actual_sorted; then + echo " PASSED" + else + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + if test yes = "$verbose"; then + echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)" + $DIFF $expect_sorted $actual_sorted |sed 's/^/ /' + echo "====The actual output ($actual_sav)" + sed 's/^/ /' < $actual_sav + echo "====The actual stderr ($actual_err_sav)" + sed 's/^/ /' < $actual_err_sav + echo "====End of actual stderr ($actual_err_sav)" + echo "" + fi fi fi - fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then @@ -691,7 +716,10 @@ TOOLTEST h5diff_56.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset6a dset6b TOOLTEST h5diff_57.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset7a dset7b # 5.8 (region reference) -TOOLTEST h5diff_58.txt -v h5diff_dset1.h5 h5diff_dset2.h5 refreg +TOOLTEST h5diff_58.txt -v2 h5diff_dset1.h5 h5diff_dset2.h5 refreg +TOOLTEST h5diff_58_ref.txt -v2 h5diff_dset1.h5 h5diff_dset2.h5 /g1/reference2D +# STD_REF_OBJ +TOOLTEST h5diff_reg.txt -v2 trefer_attr.h5 trefer_ext2.h5 Dataset3 Dataset3 # test for both dset and attr with same type but with different size # ( HDDFV-7942 ) @@ -699,10 +727,10 @@ TOOLTEST h5diff_59.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset11a dset11b # Strings # ( HDFFV-10128 ) -TOOLTEST h5diff_60.txt -v diff_strings1.h5 diff_strings2.h5 string1 string1 -TOOLTEST h5diff_61.txt -v diff_strings1.h5 diff_strings2.h5 string2 string2 -TOOLTEST h5diff_62.txt -v diff_strings1.h5 diff_strings2.h5 string3 string3 -TOOLTEST h5diff_63.txt -v diff_strings1.h5 diff_strings2.h5 string4 string4 +TOOLTEST h5diff_60.txt -v h5diff_strings1.h5 h5diff_strings2.h5 string1 string1 +TOOLTEST h5diff_61.txt -v h5diff_strings1.h5 h5diff_strings2.h5 string2 string2 +TOOLTEST h5diff_62.txt -v h5diff_strings1.h5 h5diff_strings2.h5 string3 string3 +TOOLTEST h5diff_63.txt -v h5diff_strings1.h5 h5diff_strings2.h5 string4 string4 # ############################################################################## # # Error messages @@ -745,6 +773,9 @@ TOOLTEST h5diff_609.txt -d 200 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dse # 6.10: number smaller than smallest difference TOOLTEST h5diff_610.txt -d 1 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4 +# eps: number smaller than epsilon +TOOLTEST h5diff_eps.txt -v3 -d 1e-16 h5diff_eps1.h5 h5diff_eps2.h5 + # ############################################################################## # # -p @@ -895,7 +926,7 @@ TOOLTEST h5diff_207.txt -c h5diff_basic2.h5 h5diff_basic2.h5 g2/dset8 g2/dset9 TOOLTEST h5diff_208.txt -c h5diff_dset_zero_dim_size1.h5 h5diff_dset_zero_dim_size2.h5 # non-comparable dataset with comparable attribute, and other comparable datasets. -# Also test non-compatible attributes with different type, dimention, rank. +# Also test non-compatible attributes with different type, dimension, rank. # All the comparables should display differences. TOOLTEST h5diff_220.txt -c non_comparables1.h5 non_comparables2.h5 /g1 @@ -1058,7 +1089,7 @@ TOOLTEST h5diff_474.txt -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_li TOOLTEST h5diff_475.txt -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link1 # ############################################################################## -# # test for group diff recursivly +# # test for group diff recursively # ############################################################################## # root TOOLTEST h5diff_500.txt -v h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 / / @@ -1166,6 +1197,17 @@ TOOLTEST h5diff_645.txt -v -p 0.05 --use-system-epsilon h5diff_basic1.h5 h5diff_ TOOLTEST h5diff_646.txt -v --use-system-epsilon -p 0.05 h5diff_basic1.h5 h5diff_basic2.h5 /g1/dset3 /g1/dset4 # ############################################################################## +# # Test array variances +# ############################################################################## +TOOLTEST h5diff_800.txt -v h5diff_dset1.h5 h5diff_dset2.h5 /g1/array /g1/array +TOOLTEST h5diff_801.txt -v h5diff_dset1.h5 h5diff_dset3.h5 /g1/array /g1/array + +# ############################################################################## +# # dataset subsets +# ############################################################################## +#TOOLTEST h5diff_830.txt --enable-error-stack -v h5diff_dset1.h5 h5diff_dset2.h5 "/g1/array3D[0,0,0;2,2,1;2,2,2;]" "/g1/array3D[0,0,0;2,2,1;2,2,2;]" + +# ############################################################################## # VDS tests # ############################################################################## TOOLTEST h5diff_v1.txt -v 1_vds.h5 2_vds.h5 diff --git a/tools/test/h5diff/testph5diff.sh.in b/tools/test/h5diff/testph5diff.sh.in index b726a80..5bb6e52 100644 --- a/tools/test/h5diff/testph5diff.sh.in +++ b/tools/test/h5diff/testph5diff.sh.in @@ -7,7 +7,7 @@ # 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. +# distribution tree, or in https://www.hdfgroup.org/licenses. # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # |