diff options
Diffstat (limited to 'tools/test/misc')
29 files changed, 1269 insertions, 1221 deletions
diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt index 8f13d84..f67f36b 100644 --- a/tools/test/misc/CMakeLists.txt +++ b/tools/test/misc/CMakeLists.txt @@ -6,7 +6,7 @@ project (HDF5_TOOLS_TEST_MISC C) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (h5repart_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5repart_gentest.c) - target_include_directories (h5repart_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5repart_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT ONLY_SHARED_LIBS) TARGET_C_PROPERTIES (h5repart_gentest STATIC) target_link_libraries (h5repart_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) @@ -17,8 +17,15 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) set_target_properties (h5repart_gentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5repart_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repart_gentest>) + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_MISC_h5repart_gentest_FORMAT h5repart_gentest) + endif () + add_executable (h5clear_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5clear_gentest.c) - target_include_directories (h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_TEST_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_TEST_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT ONLY_SHARED_LIBS) TARGET_C_PROPERTIES (h5clear_gentest STATIC) target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) @@ -29,12 +36,19 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) set_target_properties (h5clear_gentest PROPERTIES FOLDER tools) #add_test (NAME H5CLEAR-h5clear_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5clear_gentest>) + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_MISC_h5clear_gentest_FORMAT h5clear_gentest) + endif () + add_subdirectory (vds) endif () add_executable (h5repart_test ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/repart_test.c) -target_include_directories (h5repart_test PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (h5repart_test PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT ONLY_SHARED_LIBS) TARGET_C_PROPERTIES (h5repart_test STATIC) target_link_libraries (h5repart_test PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -44,8 +58,15 @@ else () endif () set_target_properties (h5repart_test PROPERTIES FOLDER tools) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_MISC_h5repart_test_FORMAT h5repart_test) +endif () + add_executable (clear_open_chk ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/clear_open_chk.c) -target_include_directories (clear_open_chk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (clear_open_chk PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT ONLY_SHARED_LIBS) TARGET_C_PROPERTIES (clear_open_chk STATIC) target_link_libraries (clear_open_chk PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -55,6 +76,13 @@ else () endif () set_target_properties (clear_open_chk PROPERTIES FOLDER tools) +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_MISC_clear_open_chk_FORMAT clear_open_chk) +endif () + if (HDF5_TEST_SERIAL) include (CMakeTestsRepart.cmake) include (CMakeTestsClear.cmake) diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake index cb285e4..198a363 100644 --- a/tools/test/misc/CMakeTestsClear.cmake +++ b/tools/test/misc/CMakeTestsClear.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. # @@ -397,7 +397,7 @@ # # The following are tests to verify the expected exit code from h5clear: # "h5clear -m h5clear_mdc_image.h5" (valid option, existing file, succeed exit code) -# "h5clear --vers" (valid option, version #, succeed exit code) +# "h5clear --version" (valid option, version #, succeed exit code) # "h5clear -k" (invalid 1 option, no file, fail exit code) # "h5clear -k junk.h5" (invalid 1 option, nonexisting file, fail exit code) # "h5clear -l h5clear_sec2_v2.h5" (invalid 1 option, existing file, fail exit code) @@ -408,7 +408,7 @@ # "h5clear -m -l h5clear_sec2_v0.h5" (valid/invalid 2 options, existing file, fail exit code) # "h5clear -l -m h5clear_sec2_v0.h5" (invalid/valid 2 options, existing file, fail exit code) ADD_H5_RETTEST (h5clr_mdc_image "false" "-m" h5clear_mdc_image.h5) - ADD_H5_RETTEST (h5clr_vers "false" "--vers") + ADD_H5_RETTEST (h5clr_vers "false" "--version") ADD_H5_RETTEST (h5clr_k "true" "-k") ADD_H5_RETTEST (h5clr_k_junk "true" "-k" junk.h5) ADD_H5_RETTEST (h5clr_l_sec2 "true" "-l" h5clear_sec2_v2.h5) diff --git a/tools/test/misc/CMakeTestsMkgrp.cmake b/tools/test/misc/CMakeTestsMkgrp.cmake index fb9e5ba..11c9fdf 100644 --- a/tools/test/misc/CMakeTestsMkgrp.cmake +++ b/tools/test/misc/CMakeTestsMkgrp.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. # diff --git a/tools/test/misc/CMakeTestsRepart.cmake b/tools/test/misc/CMakeTestsRepart.cmake index 14b349c..20ae263 100644 --- a/tools/test/misc/CMakeTestsRepart.cmake +++ b/tools/test/misc/CMakeTestsRepart.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. # diff --git a/tools/test/misc/Makefile.am b/tools/test/misc/Makefile.am index c58ba38..2dcbe7c 100644 --- a/tools/test/misc/Makefile.am +++ b/tools/test/misc/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/misc/Makefile.in b/tools/test/misc/Makefile.in index f2ba3db..58ee1b1 100644 --- a/tools/test/misc/Makefile.in +++ b/tools/test/misc/Makefile.in @@ -22,7 +22,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. # @@ -115,6 +115,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \ $(top_srcdir)/m4/ax_check_junit.m4 \ $(top_srcdir)/m4/ax_java_options.m4 \ $(top_srcdir)/m4/ax_jni_include_dir.m4 \ + $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_prog_jar.m4 \ $(top_srcdir)/m4/ax_prog_java.m4 \ $(top_srcdir)/m4/ax_prog_java_works.m4 \ @@ -479,12 +480,12 @@ AMTAR = @AMTAR@ # AM_CFLAGS is an automake construct which should be used by Makefiles # instead of CFLAGS, as CFLAGS is reserved solely for the user to define. # This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well. -AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@ +AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ # Include src directory AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \ -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib -AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@ +AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@ AM_JAVACFLAGS = @AM_JAVACFLAGS@ @@ -522,11 +523,56 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@ -DEV_WARNINGS = @DEV_WARNINGS@ +DIAGS = @DIAGS@ DIRECT_VFD = @DIRECT_VFD@ DLLTOOL = @DLLTOOL@ +DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@ +DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@ +DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@ +DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@ +DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@ +DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@ +DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@ +DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@ +DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@ +DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@ +DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@ +DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@ +DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@ +DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ +DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@ +DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@ +DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@ +DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@ +DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@ +DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@ +DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@ +DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ +DX_CONFIG = @DX_CONFIG@ +DX_DOCDIR = @DX_DOCDIR@ +DX_DOT = @DX_DOT@ +DX_DOXYGEN = @DX_DOXYGEN@ +DX_DVIPS = @DX_DVIPS@ +DX_EGREP = @DX_EGREP@ +DX_ENV = @DX_ENV@ +DX_FLAG_chi = @DX_FLAG_chi@ +DX_FLAG_chm = @DX_FLAG_chm@ +DX_FLAG_doc = @DX_FLAG_doc@ +DX_FLAG_dot = @DX_FLAG_dot@ +DX_FLAG_html = @DX_FLAG_html@ +DX_FLAG_man = @DX_FLAG_man@ +DX_FLAG_pdf = @DX_FLAG_pdf@ +DX_FLAG_ps = @DX_FLAG_ps@ +DX_FLAG_rtf = @DX_FLAG_rtf@ +DX_FLAG_xml = @DX_FLAG_xml@ +DX_HHC = @DX_HHC@ +DX_LATEX = @DX_LATEX@ +DX_MAKEINDEX = @DX_MAKEINDEX@ +DX_PDFLATEX = @DX_PDFLATEX@ +DX_PERL = @DX_PERL@ +DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ @@ -558,8 +604,6 @@ H5_CFLAGS = @H5_CFLAGS@ H5_CLASSPATH = @H5_CLASSPATH@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ -H5_ECFLAGS = @H5_ECFLAGS@ -H5_ECXXFLAGS = @H5_ECXXFLAGS@ H5_FCFLAGS = @H5_FCFLAGS@ H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@ H5_IS_DARWIN = @H5_IS_DARWIN@ @@ -573,7 +617,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@ HAVE_LIBHDFS = @HAVE_LIBHDFS@ HAVE_PTHREAD = @HAVE_PTHREAD@ +HDF5_DOXYGEN = @HDF5_DOXYGEN@ HDF5_HL = @HDF5_HL@ +HDF5_HL_TOOLS = @HDF5_HL_TOOLS@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF5_TESTS = @HDF5_TESTS@ HDF5_TOOLS = @HDF5_TOOLS@ @@ -583,6 +629,7 @@ HDF_JAVA = @HDF_JAVA@ HID_T = @HID_T@ HL = @HL@ HL_FOR = @HL_FOR@ +HL_TOOLS = @HL_TOOLS@ HSIZE_T = @HSIZE_T@ HSSIZE_T = @HSSIZE_T@ IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@ @@ -776,7 +823,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la # Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below -# has been removed. According to the official description of DESTDIR by Gnu at +# has been removed. According to the official description of DESTDIR by GNU at # http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is # prepended to the normal and complete install path that it precedes for the # purpose of installing in a temporary directory which is useful for building @@ -1412,8 +1459,9 @@ uninstall-am: # commands that should be executed even if a file with the same name already # exists. .PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \ - build-tests check-clean check-install check-p check-s check-vfd \ - install-doc lib progs tests uninstall-doc _exec_check-s _test help + build-tests check-clean check-install check-p check-s check-vfd \ + install-doc lib progs tests uninstall-doc \ + _exec_check-s _test help trace doxygen help: @$(top_srcdir)/bin/makehelp diff --git a/tools/test/misc/clear_open_chk.c b/tools/test/misc/clear_open_chk.c index 7d22ca6..dd217b0 100644 --- a/tools/test/misc/clear_open_chk.c +++ b/tools/test/misc/clear_open_chk.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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -40,11 +40,11 @@ usage(void) int main(int argc, char *argv[]) { - char *fname; /* The HDF5 file name */ - hid_t fid; /* File ID */ + char *fname; /* The HDF5 file name */ + hid_t fid; /* File ID */ /* Check the # of arguments */ - if(argc != 2) { + if (argc != 2) { usage(); HDexit(EXIT_FAILURE); } @@ -53,7 +53,7 @@ main(int argc, char *argv[]) fname = HDstrdup(argv[1]); /* Try opening the file */ - if((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, FALSE, NULL, (size_t)0)) < 0) { + if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, FALSE, NULL, (size_t)0)) < 0) { HDfprintf(stderr, "clear_open_chk: unable to open the file\n"); HDfree(fname); HDexit(EXIT_FAILURE); @@ -61,7 +61,7 @@ main(int argc, char *argv[]) HDfree(fname); /* Close the file */ - if(H5Fclose(fid) < 0) { + if (H5Fclose(fid) < 0) { HDfprintf(stderr, "clear_open_chk: cannot close the file\n"); HDexit(EXIT_FAILURE); } diff --git a/tools/test/misc/h5clear_gentest.c b/tools/test/misc/h5clear_gentest.c index 8d6883c..53fbc42 100644 --- a/tools/test/misc/h5clear_gentest.c +++ b/tools/test/misc/h5clear_gentest.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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -15,31 +15,31 @@ /* The HDF5 test files */ const char *FILENAME[] = { - "h5clear_sec2_v3.h5", /* 0 -- sec2 file with superblock version 3 */ - "h5clear_log_v3.h5", /* 1 -- log file with superblock veresion 3 */ - "h5clear_sec2_v0.h5", /* 2 -- sec2 file with superblock version 0 */ - "h5clear_sec2_v2.h5" /* 3 -- sec2 file with superblock version 2 */ + "h5clear_sec2_v3.h5", /* 0 -- sec2 file with superblock version 3 */ + "h5clear_log_v3.h5", /* 1 -- log file with superblock veresion 3 */ + "h5clear_sec2_v0.h5", /* 2 -- sec2 file with superblock version 0 */ + "h5clear_sec2_v2.h5" /* 3 -- sec2 file with superblock version 2 */ }; const char *FILENAME_ENHANCE[] = { - "h5clear_fsm_persist_equal.h5", /* 0: persisting free-space, stored EOA = actual EOF */ - "h5clear_fsm_persist_greater.h5", /* 1: persisting free-space, stored EOA > actual EOF */ - "h5clear_fsm_persist_less.h5", /* 2: persisting free-space, stored EOA < actual EOF */ - "h5clear_fsm_persist_user_equal.h5", /* 3: user block, persisting free-space, stored EOA = actual EOF */ - "h5clear_fsm_persist_user_greater.h5", /* 4: user block, persisting free-space, stored EOA > actual EOF */ - "h5clear_fsm_persist_user_less.h5", /* 5: user block, persisting free-space, stored EOA < actual EOF */ - "h5clear_status_noclose.h5", /* 6 -- v3 superblock, nonzero status_flags, no flush, exit, - stored EOA < actual EOF */ - "h5clear_fsm_persist_noclose.h5" /* 7 -- persisting free-space, no flush, exit, stored EOA < actual EOF */ + "h5clear_fsm_persist_equal.h5", /* 0: persisting free-space, stored EOA = actual EOF */ + "h5clear_fsm_persist_greater.h5", /* 1: persisting free-space, stored EOA > actual EOF */ + "h5clear_fsm_persist_less.h5", /* 2: persisting free-space, stored EOA < actual EOF */ + "h5clear_fsm_persist_user_equal.h5", /* 3: user block, persisting free-space, stored EOA = actual EOF */ + "h5clear_fsm_persist_user_greater.h5", /* 4: user block, persisting free-space, stored EOA > actual EOF */ + "h5clear_fsm_persist_user_less.h5", /* 5: user block, persisting free-space, stored EOA < actual EOF */ + "h5clear_status_noclose.h5", /* 6 -- v3 superblock, nonzero status_flags, no flush, exit, + stored EOA < actual EOF */ + "h5clear_fsm_persist_noclose.h5" /* 7 -- persisting free-space, no flush, exit, stored EOA < actual EOF */ }; -#define KB 1024U +#define KB 1024U -#define CACHE_IMAGE_FILE "h5clear_mdc_image.h5" -#define DSET "DSET" -#define DATASET "dset" -#define NUM_ELMTS 100 -#define USERBLOCK 512 +#define CACHE_IMAGE_FILE "h5clear_mdc_image.h5" +#define DSET "DSET" +#define DATASET "dset" +#define NUM_ELMTS 100 +#define USERBLOCK 512 /*------------------------------------------------------------------------- * Function: gen_cache_image_file @@ -56,73 +56,71 @@ const char *FILENAME_ENHANCE[] = { static int gen_cache_image_file(const char *fname) { - hid_t fid = H5I_INVALID_HID; /* File ID */ - hid_t did = -1, sid = H5I_INVALID_HID; /* Dataset ID, dataspace ID */ - hid_t fapl = H5I_INVALID_HID; /* File access property list */ - hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */ - hsize_t dims[2]; /* Dimension sizes */ - hsize_t chunks[2]; /* Chunked dimension sizes */ - int i, j; /* Local index variables */ - int **buf = NULL; /* Buffer for data to write */ - H5AC_cache_image_config_t cache_image_config = /* Cache image input configuration */ - { H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION, - TRUE, FALSE, - H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE}; + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t did = -1, sid = H5I_INVALID_HID; /* Dataset ID, dataspace ID */ + hid_t fapl = H5I_INVALID_HID; /* File access property list */ + hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */ + hsize_t dims[2]; /* Dimension sizes */ + hsize_t chunks[2]; /* Chunked dimension sizes */ + int i, j; /* Local index variables */ + int ** buf = NULL; /* Buffer for data to write */ + H5AC_cache_image_config_t cache_image_config = /* Cache image input configuration */ + {H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION, TRUE, FALSE, H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE}; /* Create and fill array */ H5TEST_ALLOCATE_2D_ARRAY(buf, int, 50, 100); if (NULL == buf) goto error; - for(i = 0; i < 50; i++) - for(j = 0; j < 100; j++) + for (i = 0; i < 50; i++) + for (j = 0; j < 100; j++) buf[i][j] = i * j; /* Create a copy of file access property list */ - if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) goto error; /* Enable latest format in fapl */ - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) goto error; /* Enable metadata cache image in fapl */ - if(H5Pset_mdc_image_config(fapl, &cache_image_config) < 0) + if (H5Pset_mdc_image_config(fapl, &cache_image_config) < 0) goto error; /* Create the file */ - if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; /* Create dataspace */ dims[0] = 50; dims[1] = 100; - if((sid = H5Screate_simple(2, dims, NULL)) < 0) + if ((sid = H5Screate_simple(2, dims, NULL)) < 0) goto error; /* Set up to create a chunked dataset */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; chunks[0] = 5; chunks[1] = 10; - if(H5Pset_chunk(dcpl, 2, chunks) < 0) + if (H5Pset_chunk(dcpl, 2, chunks) < 0) goto error; - if((did = H5Dcreate2(fid, DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; /* Write to the dataset */ - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) goto error; /* Closing */ - if(H5Dclose(did) < 0) + if (H5Dclose(did) < 0) goto error; - if(H5Pclose(dcpl) < 0) + if (H5Pclose(dcpl) < 0) goto error; - if(H5Pclose(fapl) < 0) + if (H5Pclose(fapl) < 0) goto error; - if(H5Sclose(sid) < 0) + if (H5Sclose(sid) < 0) goto error; - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) goto error; HDfree(buf); @@ -130,14 +128,16 @@ gen_cache_image_file(const char *fname) return 0; error: - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Pclose(dcpl); H5Sclose(sid); H5Dclose(did); H5Fclose(fid); H5Pclose(fapl); H5Pclose(dcpl); - } H5E_END_TRY; + } + H5E_END_TRY; HDfree(buf); @@ -173,61 +173,61 @@ error: static int gen_enhance_files(hbool_t user) { - hid_t fid = H5I_INVALID_HID; /* File ID */ - hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ - hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ - hid_t did = H5I_INVALID_HID; /* Dataset ID */ - hsize_t dim[1]; /* Dimension sizes */ - int data[NUM_ELMTS]; /* Buffer for data */ - int fd = H5I_INVALID_HID; /* The file descriptor ID */ - int64_t eoa; /* The EOA value */ - uint32_t chksum; /* The chksum value */ - int i = 0 , j = 0, u = 0; /* Local index variable */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ + hsize_t dim[1]; /* Dimension sizes */ + int data[NUM_ELMTS]; /* Buffer for data */ + int fd = H5I_INVALID_HID; /* The file descriptor ID */ + int64_t eoa; /* The EOA value */ + uint32_t chksum; /* The chksum value */ + int i = 0, j = 0, u = 0; /* Local index variable */ /* Get a copy of the default file creation property */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) goto error; /* Check to see if user block will be added */ - if(user) { - if(H5Pset_userblock(fcpl, (hsize_t)USERBLOCK) < 0) + if (user) { + if (H5Pset_userblock(fcpl, (hsize_t)USERBLOCK) < 0) goto error; u = 3; } /* Set file space strategy and persisting free-space */ - if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0) + if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0) goto error; /* * Create the file, then write invalid EOA to the file. */ - for(i = 0+u; i < 3+u; i++) { + for (i = 0 + u; i < 3 + u; i++) { /* Create the file with the file space strategy and persisting free-space */ - if((fid = H5Fcreate(FILENAME_ENHANCE[i], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(FILENAME_ENHANCE[i], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0) goto error; /* Create the dataset */ dim[0] = NUM_ELMTS; - if((sid = H5Screate_simple(1, dim, NULL)) < 0) - goto error; - if((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((sid = H5Screate_simple(1, dim, NULL)) < 0) + goto error; + if ((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - for(j = 0; j < NUM_ELMTS; j++) + for (j = 0; j < NUM_ELMTS; j++) data[j] = j; /* Write the dataset */ - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) goto error; /* Closing */ - if(H5Dclose(did) < 0) + if (H5Dclose(did) < 0) goto error; - if(H5Sclose(sid) < 0) + if (H5Sclose(sid) < 0) goto error; - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) goto error; /* @@ -235,7 +235,7 @@ gen_enhance_files(hbool_t user) * --FILENAME_ENHANCE[0]: "h5clear_fsm_persist_equal.h5" * --FILENAME_ENHANCE[3]: "h5clear_fsm_persist_user_equal.h5", */ - if(!(i % 3)) + if (!(i % 3)) continue; /* * For the following files: @@ -248,27 +248,27 @@ gen_enhance_files(hbool_t user) * update the chksum value. */ /* Open the file */ - if((fd = open(FILENAME_ENHANCE[i], O_RDWR, 0663)) < 0) + if ((fd = open(FILENAME_ENHANCE[i], O_RDWR, 0663)) < 0) goto error; - switch(i) { + switch (i) { case 1: /* stored EOA is > EOF */ - eoa = 3048; + eoa = 3048; chksum = 268376587; break; case 2: /* stored EOA is < EOF */ - eoa = 512; + eoa = 512; chksum = 372920305; break; case 4: /* with userblock, stored EOA > EOF */ - eoa = 4000; + eoa = 4000; chksum = 4168810027; break; case 5: /* with userblock, stored EOA < EOF */ - eoa = 3000; + eoa = 3000; chksum = 3716054346; break; @@ -277,40 +277,42 @@ gen_enhance_files(hbool_t user) } /* location of "end of file address" */ - if(lseek(fd, (off_t)(28+(user?USERBLOCK:0)), SEEK_SET) < 0) + if (lseek(fd, (off_t)(28 + (user ? USERBLOCK : 0)), SEEK_SET) < 0) goto error; /* Write the bad eoa value to the file */ - if(write(fd, &eoa, sizeof(eoa)) < 0) + if (write(fd, &eoa, sizeof(eoa)) < 0) goto error; /* location of "superblock checksum" */ - if(lseek(fd, (off_t)(44+(user?USERBLOCK:0)), SEEK_SET) < 0) + if (lseek(fd, (off_t)(44 + (user ? USERBLOCK : 0)), SEEK_SET) < 0) goto error; /* Write the chksum value to the file */ - if(write(fd, &chksum, sizeof(chksum)) < 0) + if (write(fd, &chksum, sizeof(chksum)) < 0) goto error; /* Close the file */ - if(close(fd) < 0) + if (close(fd) < 0) goto error; } /* end for */ /* Close the property list */ - if(H5Pclose(fcpl) < 0) + if (H5Pclose(fcpl) < 0) goto error; return 0; error: - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Sclose(sid); H5Dclose(did); H5Fclose(fid); H5Pclose(fcpl); - } H5E_END_TRY; + } + H5E_END_TRY; return 1; } /* gen_enhance_files() */ @@ -370,39 +372,39 @@ error: int main(void) { - hid_t fid = H5I_INVALID_HID; /* File ID */ - hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ - hid_t fapl = -1, new_fapl = H5I_INVALID_HID; /* File access property lists */ - char fname[512]; /* File name */ - unsigned new_format; /* To use latest library format or not */ - hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ - hid_t did = H5I_INVALID_HID; /* Dataset ID */ - hsize_t dim[1]; /* Dimension sizes */ - int data[NUM_ELMTS]; /* Buffer for data */ - int i; /* Local index variables */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ + hid_t fapl = -1, new_fapl = H5I_INVALID_HID; /* File access property lists */ + char fname[512]; /* File name */ + unsigned new_format; /* To use latest library format or not */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ + hsize_t dim[1]; /* Dimension sizes */ + int data[NUM_ELMTS]; /* Buffer for data */ + int i; /* Local index variables */ /* Generate a file with cache image feature enabled */ - if(gen_cache_image_file(CACHE_IMAGE_FILE) < 0) + if (gen_cache_image_file(CACHE_IMAGE_FILE) < 0) goto error; /* Generate the first 6 files in FILENAME_ENHANCE[] */ - if(gen_enhance_files(FALSE) < 0) + if (gen_enhance_files(FALSE) < 0) goto error; - if(gen_enhance_files(TRUE) < 0) + if (gen_enhance_files(TRUE) < 0) goto error; /* * Generate files in FILENAME[] */ /* Create a copy of the file access property list */ - if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) goto error; /* Copy the file access property list */ - if((new_fapl = H5Pcopy(fapl)) < 0) + if ((new_fapl = H5Pcopy(fapl)) < 0) goto error; /* Set to latest library format */ - if(H5Pset_libver_bounds(new_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + if (H5Pset_libver_bounds(new_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) goto error; /* @@ -410,54 +412,56 @@ main(void) * --FILENAME[0]: "h5clear_sec2_v3.h5", "latest_h5clear_sec2_v3.h5" * --FILENAME[1]: "h5clear_log_v3.h5", "latest_h5clear_log_v3.h5" */ - for(new_format = FALSE; new_format <= TRUE; new_format++) { - hid_t fapl2, my_fapl; /* File access property lists */ + for (new_format = FALSE; new_format <= TRUE; new_format++) { + hid_t fapl2, my_fapl; /* File access property lists */ /* Set to use the appropriate file access property list */ - if(new_format) + if (new_format) fapl2 = new_fapl; else fapl2 = fapl; /* * Create a sec2 file */ - if((my_fapl = H5Pcopy(fapl2)) < 0) + if ((my_fapl = H5Pcopy(fapl2)) < 0) goto error; /* Create the file */ - HDsprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[0]); - if((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, my_fapl)) < 0) + HDsprintf(fname, "%s%s", new_format ? "latest_" : "", FILENAME[0]); + if ((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, + my_fapl)) < 0) goto error; /* Flush the file */ - if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) + if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) goto error; /* Close the property list */ - if(H5Pclose(my_fapl) < 0) + if (H5Pclose(my_fapl) < 0) goto error; /* * Create a log file */ /* Create a copy of file access property list */ - if((my_fapl = H5Pcopy(fapl2)) < 0) - goto error; + if ((my_fapl = H5Pcopy(fapl2)) < 0) + goto error; /* Setup the fapl for the log driver */ - if(H5Pset_fapl_log(my_fapl, "append.log", (unsigned long long)H5FD_LOG_ALL, (size_t)(4 * KB)) < 0) + if (H5Pset_fapl_log(my_fapl, "append.log", (unsigned long long)H5FD_LOG_ALL, (size_t)(4 * KB)) < 0) goto error; /* Create the file */ - HDsprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[1]); - if((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, my_fapl)) < 0) + HDsprintf(fname, "%s%s", new_format ? "latest_" : "", FILENAME[1]); + if ((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, + my_fapl)) < 0) goto error; /* Flush the file */ - if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) + if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) goto error; /* Close the property list */ - if(H5Pclose(my_fapl) < 0) + if (H5Pclose(my_fapl) < 0) goto error; } /* end for */ @@ -466,39 +470,37 @@ main(void) * Create a sec2 file with v0 superblock but nonzero status_flags: * FILENAME[2]: "h5clear_sec2_v0.h5" */ - if((fid = H5Fcreate(FILENAME[2], H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if ((fid = H5Fcreate(FILENAME[2], H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; /* Flush the file */ - if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) + if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) goto error; - /* * Create a sec2 file with v2 superblock but nonzero status_flags: * FILENAME[3]: "h5clear_sec2_v2.h5" */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) goto error; - if(H5Pset_shared_mesg_nindexes(fcpl, 1) < 0) + if (H5Pset_shared_mesg_nindexes(fcpl, 1) < 0) goto error; - if(H5Pset_shared_mesg_index(fcpl, 0, H5O_SHMESG_DTYPE_FLAG, 50) < 0) + if (H5Pset_shared_mesg_index(fcpl, 0, H5O_SHMESG_DTYPE_FLAG, 50) < 0) goto error; - if((fid = H5Fcreate(FILENAME[3], H5F_ACC_TRUNC, fcpl, fapl)) < 0) + if ((fid = H5Fcreate(FILENAME[3], H5F_ACC_TRUNC, fcpl, fapl)) < 0) goto error; /* Flush the file */ - if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) + if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) goto error; - /* Close the property lists */ - if(H5Pclose(fapl) < 0) + if (H5Pclose(fapl) < 0) goto error; - if(H5Pclose(new_fapl) < 0) + if (H5Pclose(new_fapl) < 0) goto error; - if(H5Pclose(fcpl) < 0) + if (H5Pclose(fcpl) < 0) goto error; /* @@ -515,42 +517,41 @@ main(void) * --does not flush the file, just exit without closing file: * --this file is similar to the user-suppplied test file attached with HDFFV-10347 */ - if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - goto error; + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + goto error; /* Set to latest format */ - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - goto error; + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + goto error; /* Create file with SWMR-write access */ - if((fid = H5Fcreate(FILENAME_ENHANCE[6], H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) + if ((fid = H5Fcreate(FILENAME_ENHANCE[6], H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) goto error; /* Create the dataset */ dim[0] = NUM_ELMTS; - if((sid = H5Screate_simple(1, dim, NULL)) < 0) + if ((sid = H5Screate_simple(1, dim, NULL)) < 0) goto error; - if((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - for(i = 0; i < NUM_ELMTS; i++) + for (i = 0; i < NUM_ELMTS; i++) data[i] = i; /* Write the dataset */ - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) goto error; /* Closing */ - if(H5Dclose(did) < 0) + if (H5Dclose(did) < 0) goto error; - if(H5Sclose(sid) < 0) + if (H5Sclose(sid) < 0) goto error; - if(H5Pclose(fapl) < 0) + if (H5Pclose(fapl) < 0) goto error; /* Does not flush and does not close the file */ - /* * FILENAME_ENHANCE[7]: h5clear_fsm_persist_noclose.h5 * --stored EOA < actual EOF @@ -559,42 +560,41 @@ main(void) * --undefined fsinfo.fs_addr * --does not flush the file, just exit without closing */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) goto error; /* Set file space strategy and persisting free-space */ - if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0) - goto error; + if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0) + goto error; /* Create the file with the set file space info */ - if((fid = H5Fcreate(FILENAME_ENHANCE[7], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(FILENAME_ENHANCE[7], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0) goto error; /* Create the dataset */ dim[0] = NUM_ELMTS; - if((sid = H5Screate_simple(1, dim, NULL)) < 0) + if ((sid = H5Screate_simple(1, dim, NULL)) < 0) goto error; - if((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - for(i = 0; i < NUM_ELMTS; i++) + for (i = 0; i < NUM_ELMTS; i++) data[i] = i; /* Write the dataset */ - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) goto error; /* Closing */ - if(H5Dclose(did) < 0) + if (H5Dclose(did) < 0) goto error; - if(H5Sclose(sid) < 0) + if (H5Sclose(sid) < 0) goto error; - if(H5Pclose(fcpl) < 0) + if (H5Pclose(fcpl) < 0) goto error; /* Does not flush and does not close the file */ - fflush(stdout); fflush(stderr); diff --git a/tools/test/misc/h5perf_gentest.c b/tools/test/misc/h5perf_gentest.c index 511a9e2..332e49c 100644 --- a/tools/test/misc/h5perf_gentest.c +++ b/tools/test/misc/h5perf_gentest.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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -21,70 +21,70 @@ #include <stdio.h> #include <stdlib.h> -#define FNAME "test_perf.h5" -#define NGROUPS 20 -#define NDSETS 20 -#define NATTRS 20 -#define DIM0 40 -#define NROWS 100 -#define NTYPES 9 -#define MAXVLEN 10 -#define FIXED_LEN 8 +#define FNAME "test_perf.h5" +#define NGROUPS 20 +#define NDSETS 20 +#define NATTRS 20 +#define DIM0 40 +#define NROWS 100 +#define NTYPES 9 +#define MAXVLEN 10 +#define FIXED_LEN 8 -typedef enum { SOLID=0, LIQUID, GAS, PLASMA } phase_t; +typedef enum { SOLID = 0, LIQUID, GAS, PLASMA } phase_t; typedef struct { - int i; - unsigned long long l; - float f; - double d; - char s[FIXED_LEN]; - phase_t e; - float f_array[FIXED_LEN]; - hvl_t i_vlen; - char *s_vlen; + int i; + unsigned long long l; + float f; + double d; + char s[FIXED_LEN]; + phase_t e; + float f_array[FIXED_LEN]; + hvl_t i_vlen; + char * s_vlen; } test_comp_t; typedef struct { - int zipcode; - char *city; + int zipcode; + char *city; } zipcode_t; -int add_attrs(hid_t oid, int idx); -int add_attr(hid_t oid, const char *name, hid_t tid, hid_t sid, void *buf) ; -herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, - int nattrs, hsize_t nrows, hsize_t dim0, hsize_t chunk, int vlen, - int compressed, int latest); +int add_attrs(hid_t oid, int idx); +int add_attr(hid_t oid, const char *name, hid_t tid, hid_t sid, void *buf); +herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, int nattrs, hsize_t nrows, + hsize_t dim0, hsize_t chunk, int vlen, int compressed, int latest); -int main (int argc, char *argv[]) +int +main(int argc, char *argv[]) { char fname[32]; - int i, ngrps=NGROUPS, ndsets=NDSETS, nattrs=NATTRS, dim0=DIM0, - chunk=DIM0/10+1, nrows=NROWS, vlen=MAXVLEN, l=0, z=0; + int i, ngrps = NGROUPS, ndsets = NDSETS, nattrs = NATTRS, dim0 = DIM0, chunk = DIM0 / 10 + 1, + nrows = NROWS, vlen = MAXVLEN, l = 0, z = 0; memset(fname, 0, 32); - for (i=1; i<argc; i++) { - if (strcmp(argv[i], "-f")==0) - strcpy(fname, argv[i+1]); - else if (strcmp(argv[i], "-g")==0) - ngrps = atoi(argv[i+1]); - else if (strcmp(argv[i], "-d")==0) - ndsets = atoi(argv[i+1]); - else if (strcmp(argv[i], "-a")==0) - nattrs = atoi(argv[i+1]); - else if (strcmp(argv[i], "-r")==0) - nrows = atoi(argv[i+1]); - else if (strcmp(argv[i], "-s")==0) - dim0 = atoi(argv[i+1]); - else if (strcmp(argv[i], "-c")==0) - chunk = atoi(argv[i+1]); - else if (strcmp(argv[i], "-v")==0) - vlen = atoi(argv[i+1]); - else if (strcmp(argv[i], "-l")==0) + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-f") == 0) + strcpy(fname, argv[i + 1]); + else if (strcmp(argv[i], "-g") == 0) + ngrps = atoi(argv[i + 1]); + else if (strcmp(argv[i], "-d") == 0) + ndsets = atoi(argv[i + 1]); + else if (strcmp(argv[i], "-a") == 0) + nattrs = atoi(argv[i + 1]); + else if (strcmp(argv[i], "-r") == 0) + nrows = atoi(argv[i + 1]); + else if (strcmp(argv[i], "-s") == 0) + dim0 = atoi(argv[i + 1]); + else if (strcmp(argv[i], "-c") == 0) + chunk = atoi(argv[i + 1]); + else if (strcmp(argv[i], "-v") == 0) + vlen = atoi(argv[i + 1]); + else if (strcmp(argv[i], "-l") == 0) l = 1; - else if (strcmp(argv[i], "-z")==0) + else if (strcmp(argv[i], "-z") == 0) z = 1; - else if (strcmp(argv[i], "-h")==0) { + else if (strcmp(argv[i], "-h") == 0) { HDprintf("\nOPTONS:\n"); HDprintf("\t-f F:\tname of the test file (default: %s).\n", FNAME); HDprintf("\t-g N:\tnumber of top level groups (default: %d).\n", NGROUPS); @@ -92,7 +92,7 @@ int main (int argc, char *argv[]) HDprintf("\t-a N:\tnumber of attributes (default: %d).\n", NATTRS); HDprintf("\t-r N:\tnumber of rows in the large compound dataset (default: %d).\n", NROWS); HDprintf("\t-s N:\tsize of dim0 in datasets (default: %d).\n", DIM0); - HDprintf("\t-c N:\tchunk size of dim0 (default: %d).\n", (DIM0/10+1)); + HDprintf("\t-c N:\tchunk size of dim0 (default: %d).\n", (DIM0 / 10 + 1)); HDprintf("\t-v N:\tmax vlen size (default: %d).\n", MAXVLEN); HDprintf("\t-l:\tuse latest format (default: no).\n"); HDprintf("\t-z:\tuse gzip compression (default: no).\n"); @@ -103,11 +103,11 @@ int main (int argc, char *argv[]) } } - if (strlen(fname)<=0) + if (strlen(fname) <= 0) HDsprintf(fname, FNAME); - create_perf_test_file(fname, ngrps, ndsets, nattrs, (hsize_t)nrows, - (hsize_t)dim0, (hsize_t)chunk, vlen, z, l); + create_perf_test_file(fname, ngrps, ndsets, nattrs, (hsize_t)nrows, (hsize_t)dim0, (hsize_t)chunk, vlen, + z, l); return 0; } @@ -130,339 +130,378 @@ int main (int argc, char *argv[]) Programmer: Peter Cao, Jan. 2013 ****************************************************************************/ -herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, - int nattrs, hsize_t nrows, hsize_t dim0, hsize_t chunk, int vlen, - int compressed, int latest) +herr_t +create_perf_test_file(const char *fname, int ngrps, int ndsets, int nattrs, hsize_t nrows, hsize_t dim0, + hsize_t chunk, int vlen, int compressed, int latest) { - int i, j, k; - hid_t fid, sid_null, sid_scalar, sid_1d, sid_2d, did, aid, sid_2, sid_large, - fapl=H5P_DEFAULT, dcpl=H5P_DEFAULT, gid1, gid2, cmp_tid, tid_str, - tid_enum, tid_array_f, tid_vlen_i, tid_vlen_s; - char name[32], tmp_name1[32], tmp_name2[32], tmp_name3[32]; - hsize_t dims[1]={dim0}, dims2d[2]={dim0, (dim0/4+1)}, dims_array[1]={FIXED_LEN}, - dim1[1]={2}; - char *enum_names[4] = {"SOLID", "LIQUID", "GAS", "PLASMA"}; - test_comp_t *buf_comp=NULL, *buf_comp_large=NULL; - int *buf_int=NULL; - float (*buf_float_a)[FIXED_LEN]=NULL; - double **buf_double2d=NULL; - hvl_t *buf_vlen_i=NULL; - char (*buf_str)[FIXED_LEN]; - char **buf_vlen_s=NULL; - hobj_ref_t buf_ref[2]; + int i, j, k; + hid_t fid, sid_null, sid_scalar, sid_1d, sid_2d, did, aid, sid_2, sid_large, + fapl = H5P_DEFAULT, dcpl = H5P_DEFAULT, gid1, gid2, cmp_tid, tid_str, tid_enum, tid_array_f, + tid_vlen_i, tid_vlen_s; + char name[32], tmp_name1[32], tmp_name2[32], tmp_name3[32]; + hsize_t dims[1] = {dim0}, dims2d[2] = {dim0, (dim0 / 4 + 1)}, dims_array[1] = {FIXED_LEN}, dim1[1] = {2}; + char * enum_names[4] = {"SOLID", "LIQUID", "GAS", "PLASMA"}; + test_comp_t *buf_comp = NULL, *buf_comp_large = NULL; + int * buf_int = NULL; + float(*buf_float_a)[FIXED_LEN] = NULL; + double **buf_double2d = NULL; + hvl_t * buf_vlen_i = NULL; + char(*buf_str)[FIXED_LEN]; + char ** buf_vlen_s = NULL; + hobj_ref_t buf_ref[2]; hdset_reg_ref_t buf_reg_ref[2]; - size_t offset, len; - herr_t status; - char *names[NTYPES] = { "int", "ulong", "float", "double", "fixed string", - "enum", "fixed float array", "vlen int array", "vlen strings"}; - hid_t types[NTYPES] = { H5T_NATIVE_INT, H5T_NATIVE_UINT64, H5T_NATIVE_FLOAT, - H5T_NATIVE_DOUBLE, tid_str, tid_enum, tid_array_f, tid_vlen_i, tid_vlen_s}; - hsize_t coords[4][2] = { {0, 1}, {3, 5}, {1, 0}, {2, 4}}, start=0, stride=1, count=1; - - if (nrows < NROWS) nrows = NROWS; - if (ngrps<NGROUPS) ngrps=NGROUPS; - if (ndsets<NDSETS) ndsets=NDSETS; - if (nattrs<NATTRS) nattrs=NATTRS; - if (dim0<DIM0) dim0=DIM0; - if (chunk>dim0) chunk=dim0/4; - if (chunk<1) chunk = 1; - if (vlen<1) vlen = MAXVLEN; + size_t offset, len; + herr_t status; + char * names[NTYPES] = {"int", + "ulong", + "float", + "double", + "fixed string", + "enum", + "fixed float array", + "vlen int array", + "vlen strings"}; + hid_t types[NTYPES] = {H5T_NATIVE_INT, H5T_NATIVE_UINT64, H5T_NATIVE_FLOAT, H5T_NATIVE_DOUBLE, tid_str, + tid_enum, tid_array_f, tid_vlen_i, tid_vlen_s}; + hsize_t coords[4][2] = {{0, 1}, {3, 5}, {1, 0}, {2, 4}}, start = 0, stride = 1, count = 1; + + if (nrows < NROWS) + nrows = NROWS; + if (ngrps < NGROUPS) + ngrps = NGROUPS; + if (ndsets < NDSETS) + ndsets = NDSETS; + if (nattrs < NATTRS) + nattrs = NATTRS; + if (dim0 < DIM0) + dim0 = DIM0; + if (chunk > dim0) + chunk = dim0 / 4; + if (chunk < 1) + chunk = 1; + if (vlen < 1) + vlen = MAXVLEN; /* create fixed string datatype */ - types[4] = tid_str = H5Tcopy (H5T_C_S1); - H5Tset_size (tid_str, FIXED_LEN); + types[4] = tid_str = H5Tcopy(H5T_C_S1); + H5Tset_size(tid_str, FIXED_LEN); /* create enum datatype */ types[5] = tid_enum = H5Tenum_create(H5T_NATIVE_INT); - for (i = (int) SOLID; i <= (int) PLASMA; i++) { - phase_t val = (phase_t) i; - status = H5Tenum_insert (tid_enum, enum_names[i], &val); + for (i = (int)SOLID; i <= (int)PLASMA; i++) { + phase_t val = (phase_t)i; + status = H5Tenum_insert(tid_enum, enum_names[i], &val); } /* create float array datatype */ - types[6] = tid_array_f = H5Tarray_create (H5T_NATIVE_FLOAT, 1, dims_array); + types[6] = tid_array_f = H5Tarray_create(H5T_NATIVE_FLOAT, 1, dims_array); /* create variable length integer datatypes */ - types[7] = tid_vlen_i = H5Tvlen_create (H5T_NATIVE_INT); + types[7] = tid_vlen_i = H5Tvlen_create(H5T_NATIVE_INT); /* create variable length string datatype */ - types[8] = tid_vlen_s = H5Tcopy (H5T_C_S1); - H5Tset_size (tid_vlen_s, H5T_VARIABLE); + types[8] = tid_vlen_s = H5Tcopy(H5T_C_S1); + H5Tset_size(tid_vlen_s, H5T_VARIABLE); /* create compound datatypes */ - cmp_tid = H5Tcreate (H5T_COMPOUND, sizeof (test_comp_t)); - offset = 0; - for (i=0; i<NTYPES-2; i++) { + cmp_tid = H5Tcreate(H5T_COMPOUND, sizeof(test_comp_t)); + offset = 0; + for (i = 0; i < NTYPES - 2; i++) { H5Tinsert(cmp_tid, names[i], offset, types[i]); offset += H5Tget_size(types[i]); } H5Tinsert(cmp_tid, names[7], offset, types[7]); - offset += sizeof (hvl_t); + offset += sizeof(hvl_t); H5Tinsert(cmp_tid, names[8], offset, types[8]); /* create dataspace */ - sid_1d = H5Screate_simple (1, dims, NULL); - sid_2d = H5Screate_simple (2, dims2d, NULL); - sid_2 = H5Screate_simple (1, dim1, NULL); - sid_large = H5Screate_simple (1, &nrows, NULL); - sid_null = H5Screate (H5S_NULL); - sid_scalar = H5Screate (H5S_SCALAR); + sid_1d = H5Screate_simple(1, dims, NULL); + sid_2d = H5Screate_simple(2, dims2d, NULL); + sid_2 = H5Screate_simple(1, dim1, NULL); + sid_large = H5Screate_simple(1, &nrows, NULL); + sid_null = H5Screate(H5S_NULL); + sid_scalar = H5Screate(H5S_SCALAR); /* create fid access property */ - fapl = H5Pcreate (H5P_FILE_ACCESS); - H5Pset_libver_bounds (fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + fapl = H5Pcreate(H5P_FILE_ACCESS); + H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); /* create dataset creation property */ - dcpl = H5Pcreate (H5P_DATASET_CREATE); + dcpl = H5Pcreate(H5P_DATASET_CREATE); /* set dataset chunk */ - if (chunk>0) { - H5Pset_chunk (dcpl, 1, &chunk); + if (chunk > 0) { + H5Pset_chunk(dcpl, 1, &chunk); } /* set dataset compression */ if (compressed) { - if (chunk<=0) { - chunk = dim0/10+1;; - H5Pset_chunk (dcpl, 1, &chunk); + if (chunk <= 0) { + chunk = dim0 / 10 + 1; + ; + H5Pset_chunk(dcpl, 1, &chunk); } - H5Pset_shuffle (dcpl); - H5Pset_deflate (dcpl, 6); + H5Pset_shuffle(dcpl); + H5Pset_deflate(dcpl, 6); } /* allocate buffers */ - buf_comp = (test_comp_t *)calloc(dim0, sizeof(test_comp_t)); - buf_comp_large = (test_comp_t *)calloc(nrows, sizeof(test_comp_t)); - buf_int = (int *)calloc(dim0, sizeof(int)); - buf_float_a = malloc(dim0*sizeof(*buf_float_a)); - buf_vlen_i = (hvl_t *)calloc(dim0, sizeof (hvl_t)); - buf_vlen_s = (char **)calloc(dim0, sizeof(char *)); - buf_str = malloc(dim0*sizeof (*buf_str)); + buf_comp = (test_comp_t *)calloc(dim0, sizeof(test_comp_t)); + buf_comp_large = (test_comp_t *)calloc(nrows, sizeof(test_comp_t)); + buf_int = (int *)calloc(dim0, sizeof(int)); + buf_float_a = malloc(dim0 * sizeof(*buf_float_a)); + buf_vlen_i = (hvl_t *)calloc(dim0, sizeof(hvl_t)); + buf_vlen_s = (char **)calloc(dim0, sizeof(char *)); + buf_str = malloc(dim0 * sizeof(*buf_str)); /* allocate array of doulbe pointers */ - buf_double2d = (double **)calloc(dims2d[0],sizeof(double *)); + buf_double2d = (double **)calloc(dims2d[0], sizeof(double *)); /* allocate a contigous chunk of memory for the data */ - buf_double2d[0] = (double *)calloc( dims2d[0]*dims2d[1],sizeof(double) ); + buf_double2d[0] = (double *)calloc(dims2d[0] * dims2d[1], sizeof(double)); /* assign memory city to pointer array */ - for (i=1; i <dims2d[0]; i++) buf_double2d[i] = buf_double2d[0]+i*dims2d[1]; + for (i = 1; i < dims2d[0]; i++) + buf_double2d[i] = buf_double2d[0] + i * dims2d[1]; /* fill buffer values */ len = 1; - for (i=0; i<dims[0]; i++) { - buf_comp[i].i = buf_int[i] = i-2147483648; - buf_comp[i].l = 0xffffffffffffffff-i; - buf_comp[i].f = 1.0/(i+1.0); - buf_comp[i].d = 987654321.0*i+1.0/(i+1.0); - buf_comp[i].e = (phase_t) (i % (int) (PLASMA + 1)); - - for (j=0; j<FIXED_LEN; j++) { - buf_comp[i].f_array[j] = buf_float_a[i][j] = i*100+j; - buf_str[i][j] = 'a' + (i%26); + for (i = 0; i < dims[0]; i++) { + buf_comp[i].i = buf_int[i] = i - 2147483648; + buf_comp[i].l = 0xffffffffffffffff - i; + buf_comp[i].f = 1.0 / (i + 1.0); + buf_comp[i].d = 987654321.0 * i + 1.0 / (i + 1.0); + buf_comp[i].e = (phase_t)(i % (int)(PLASMA + 1)); + + for (j = 0; j < FIXED_LEN; j++) { + buf_comp[i].f_array[j] = buf_float_a[i][j] = i * 100 + j; + buf_str[i][j] = 'a' + (i % 26); } - buf_str[i][FIXED_LEN-1] = 0; + buf_str[i][FIXED_LEN - 1] = 0; strcpy(buf_comp[i].s, buf_str[i]); - len = (1-cos(i/8.0))/2*vlen+1; - if (!i) len = vlen; + len = (1 - cos(i / 8.0)) / 2 * vlen + 1; + if (!i) + len = vlen; buf_vlen_i[i].len = len; - buf_vlen_i[i].p = (int *)calloc(len, sizeof(int)); - for (j=0; j<len; j++) ((int*)(buf_vlen_i[i].p))[j] = i*100+j; + buf_vlen_i[i].p = (int *)calloc(len, sizeof(int)); + for (j = 0; j < len; j++) + ((int *)(buf_vlen_i[i].p))[j] = i * 100 + j; buf_comp[i].i_vlen = buf_vlen_i[i]; buf_vlen_s[i] = (char *)calloc(len, sizeof(char)); - for (j=0; j<len-1; j++) - buf_vlen_s[i][j] = j%26+'A'; + for (j = 0; j < len - 1; j++) + buf_vlen_s[i][j] = j % 26 + 'A'; buf_comp[i].s_vlen = buf_vlen_s[i]; - for (j=0; j<dims2d[1]; j++) - buf_double2d[i][j] = i+j/10000.0; + for (j = 0; j < dims2d[1]; j++) + buf_double2d[i][j] = i + j / 10000.0; } - for (i=0; i<nrows; i++) { - buf_comp_large[i].i = i-2147483648; - buf_comp_large[i].l = 0xffffffffffffffff-i; - buf_comp_large[i].f = 1.0/(i+1.0); - buf_comp_large[i].d = 987654321.0*i+1.0/(i+1.0); - buf_comp_large[i].e = (phase_t) (i % (int) (PLASMA + 1)); - for (j=0; j<FIXED_LEN-1; j++) { - buf_comp_large[i].f_array[j] = i*100+j; - buf_comp_large[i].s[j] = 'a' + (i%26); + for (i = 0; i < nrows; i++) { + buf_comp_large[i].i = i - 2147483648; + buf_comp_large[i].l = 0xffffffffffffffff - i; + buf_comp_large[i].f = 1.0 / (i + 1.0); + buf_comp_large[i].d = 987654321.0 * i + 1.0 / (i + 1.0); + buf_comp_large[i].e = (phase_t)(i % (int)(PLASMA + 1)); + for (j = 0; j < FIXED_LEN - 1; j++) { + buf_comp_large[i].f_array[j] = i * 100 + j; + buf_comp_large[i].s[j] = 'a' + (i % 26); } - len = i%vlen+1; + len = i % vlen + 1; buf_comp_large[i].i_vlen.len = len; - buf_comp_large[i].i_vlen.p = (int *)calloc(len, sizeof(int)); - for (j=0; j<len; j++) ((int*)(buf_comp_large[i].i_vlen.p))[j] = i*100+j; - buf_comp_large[i].s_vlen = (char *)calloc(i+2, sizeof(char)); - for (j=0; j<i+1; j++) (buf_comp_large[i].s_vlen)[j] = j%26+'A'; + buf_comp_large[i].i_vlen.p = (int *)calloc(len, sizeof(int)); + for (j = 0; j < len; j++) + ((int *)(buf_comp_large[i].i_vlen.p))[j] = i * 100 + j; + buf_comp_large[i].s_vlen = (char *)calloc(i + 2, sizeof(char)); + for (j = 0; j < i + 1; j++) + (buf_comp_large[i].s_vlen)[j] = j % 26 + 'A'; } /* create file */ if (latest) - fid = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); else - fid = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); add_attrs(fid, 0); HDsprintf(name, "a cmp ds of %d rows", nrows); - did = H5Dcreate (fid, name, cmp_tid, sid_large, H5P_DEFAULT, dcpl, H5P_DEFAULT); - H5Dwrite (did, cmp_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_comp_large); + did = H5Dcreate(fid, name, cmp_tid, sid_large, H5P_DEFAULT, dcpl, H5P_DEFAULT); + H5Dwrite(did, cmp_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_comp_large); add_attrs(did, 0); H5Dclose(did); // /* add attributes*/ - gid1 = H5Gcreate (fid, "attributes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (nattrs<1) nattrs = 1; - i=0; - while (i<nattrs) i += add_attrs(gid1, i); + gid1 = H5Gcreate(fid, "attributes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (nattrs < 1) + nattrs = 1; + i = 0; + while (i < nattrs) + i += add_attrs(gid1, i); H5Gclose(gid1); /* add many sub groups to a group*/ - gid1 = H5Gcreate (fid, "groups", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + gid1 = H5Gcreate(fid, "groups", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); add_attrs(gid1, 0); - for (i=0; i<ngrps; i++) { + for (i = 0; i < ngrps; i++) { /* create sub groups */ HDsprintf(name, "g%02d", i); - gid2 = H5Gcreate (gid1, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (i<10) add_attrs(gid2, 0); + gid2 = H5Gcreate(gid1, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (i < 10) + add_attrs(gid2, 0); H5Gclose(gid2); } H5Gclose(gid1); /* add many datasets to a group */ - gid1 = H5Gcreate (fid, "datasets", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + gid1 = H5Gcreate(fid, "datasets", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); add_attrs(gid1, 0); - for (j=0; j<ndsets; j+=12) { + for (j = 0; j < ndsets; j += 12) { /* 1 add a null dataset */ HDsprintf(name, "%05d null dataset", j); - did = H5Dcreate (gid1, name, H5T_STD_I32LE, sid_null, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (!j) add_attrs(did, j); + did = H5Dcreate(gid1, name, H5T_STD_I32LE, sid_null, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (!j) + add_attrs(did, j); H5Dclose(did); /* 2 add scalar int point */ HDsprintf(name, "%05d scalar int point", j); - did = H5Dcreate (gid1, name, H5T_NATIVE_INT, sid_scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite (did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &j); - if (!j) add_attrs(did, j); + did = H5Dcreate(gid1, name, H5T_NATIVE_INT, sid_scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &j); + if (!j) + add_attrs(did, j); H5Dclose(did); /* 3 scalar vlen string */ HDsprintf(name, "%05d scalar vlen string", j); - did = H5Dcreate (gid1, name, tid_vlen_s, sid_scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite (did, tid_vlen_s, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buf_vlen_s[0]); - if (!j) add_attrs(did, j); + did = H5Dcreate(gid1, name, tid_vlen_s, sid_scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(did, tid_vlen_s, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buf_vlen_s[0]); + if (!j) + add_attrs(did, j); H5Dclose(did); /* 4 add fixed-length float array */ HDsprintf(name, "%05d fixed-length float array", j); - did = H5Dcreate (gid1, name, tid_array_f, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); - H5Dwrite (did, tid_array_f, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_float_a); - if (!j) add_attrs(did, j); + did = H5Dcreate(gid1, name, tid_array_f, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); + H5Dwrite(did, tid_array_f, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_float_a); + if (!j) + add_attrs(did, j); H5Dclose(did); /* 5 add fixed-length strings */ HDsprintf(name, "%05d fixed-length strings", j); - did = H5Dcreate (gid1, name, tid_str, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); - H5Dwrite (did, tid_str, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_str); - if (!j) add_attrs(did, j); + did = H5Dcreate(gid1, name, tid_str, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); + H5Dwrite(did, tid_str, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_str); + if (!j) + add_attrs(did, j); H5Dclose(did); /* 6 add compound data */ HDsprintf(name, "%05d compund data", j); - did = H5Dcreate (gid1, name, cmp_tid, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); - H5Dwrite (did, cmp_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_comp); - if (!j) add_attrs(did, j); + did = H5Dcreate(gid1, name, cmp_tid, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); + H5Dwrite(did, cmp_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_comp); + if (!j) + add_attrs(did, j); H5Dclose(did); /* 7 add 2D double */ HDsprintf(name, "%05d 2D double", j); - strcpy (tmp_name1, name); - did = H5Dcreate (gid1, name, H5T_NATIVE_DOUBLE, sid_2d, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite (did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_double2d[0]); - if (!j) add_attrs(did, j); + strcpy(tmp_name1, name); + did = H5Dcreate(gid1, name, H5T_NATIVE_DOUBLE, sid_2d, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_double2d[0]); + if (!j) + add_attrs(did, j); H5Dclose(did); /* 8 add 1D int array */ HDsprintf(name, "%05d 1D int array", j); - did = H5Dcreate (gid1, name, H5T_NATIVE_INT, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); - H5Dwrite (did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_int); - if (!j) add_attrs(did, j); + did = H5Dcreate(gid1, name, H5T_NATIVE_INT, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); + H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_int); + if (!j) + add_attrs(did, j); H5Dclose(did); /* 9 add vlen int array */ HDsprintf(name, "%05d vlen int array", j); - strcpy (tmp_name2, name); - did = H5Dcreate (gid1, name, tid_vlen_i, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); - H5Dwrite (did, tid_vlen_i, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_vlen_i); - if (!j) add_attrs(did, j); + strcpy(tmp_name2, name); + did = H5Dcreate(gid1, name, tid_vlen_i, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); + H5Dwrite(did, tid_vlen_i, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_vlen_i); + if (!j) + add_attrs(did, j); H5Dclose(did); /* 10 add vlen strings */ HDsprintf(name, "%05d vlen strings", j); - strcpy (tmp_name3, name); - did = H5Dcreate (gid1, name, tid_vlen_s, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); - H5Dwrite (did, tid_vlen_s, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_vlen_s); - if (!j) add_attrs(did, j); + strcpy(tmp_name3, name); + did = H5Dcreate(gid1, name, tid_vlen_s, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT); + H5Dwrite(did, tid_vlen_s, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_vlen_s); + if (!j) + add_attrs(did, j); H5Dclose(did); /* 11 add object refs */ - H5Rcreate(&buf_ref[0],gid1, ".", H5R_OBJECT, (hid_t)-1); - H5Rcreate(&buf_ref[1],gid1, tmp_name3, H5R_OBJECT, (hid_t)-1); + H5Rcreate(&buf_ref[0], gid1, ".", H5R_OBJECT, (hid_t)-1); + H5Rcreate(&buf_ref[1], gid1, tmp_name3, H5R_OBJECT, (hid_t)-1); HDsprintf(name, "%05d obj refs", j); - did = H5Dcreate (gid1, name, H5T_STD_REF_OBJ, sid_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite (did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_ref); - if (!j) add_attrs(did, j); + did = H5Dcreate(gid1, name, H5T_STD_REF_OBJ, sid_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_ref); + if (!j) + add_attrs(did, j); H5Dclose(did); /* 12 add region refs */ - H5Sselect_elements (sid_2d, H5S_SELECT_SET, 4, coords[0]); - H5Rcreate(&buf_reg_ref[0],gid1, tmp_name1, H5R_DATASET_REGION, sid_2d); + H5Sselect_elements(sid_2d, H5S_SELECT_SET, 4, coords[0]); + H5Rcreate(&buf_reg_ref[0], gid1, tmp_name1, H5R_DATASET_REGION, sid_2d); H5Sselect_none(sid_2d); - count = dims[0]/2+1; - H5Sselect_hyperslab (sid_1d, H5S_SELECT_SET, &start, &stride, &count,NULL); - H5Rcreate(&buf_reg_ref[1],gid1, tmp_name2, H5R_DATASET_REGION, sid_1d); + count = dims[0] / 2 + 1; + H5Sselect_hyperslab(sid_1d, H5S_SELECT_SET, &start, &stride, &count, NULL); + H5Rcreate(&buf_reg_ref[1], gid1, tmp_name2, H5R_DATASET_REGION, sid_1d); H5Sselect_none(sid_1d); HDsprintf(name, "%05d region refs", j); - did = H5Dcreate (gid1, name, H5T_STD_REF_DSETREG, sid_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite (did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_reg_ref); - if (!j) add_attrs(did, j); + did = H5Dcreate(gid1, name, H5T_STD_REF_DSETREG, sid_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_reg_ref); + if (!j) + add_attrs(did, j); H5Dclose(did); } H5Gclose(gid1); - H5Tclose (tid_array_f); - H5Tclose (tid_vlen_i); - H5Tclose (tid_vlen_s); - H5Tclose (tid_enum); - H5Tclose (tid_str); - H5Tclose (cmp_tid); - H5Pclose (dcpl); - H5Pclose (fapl); - H5Sclose (sid_1d); - H5Sclose (sid_2d); - H5Sclose (sid_2); - H5Sclose (sid_large); - H5Sclose (sid_null); - H5Sclose (sid_scalar); - H5Fclose (fid); - - for (i=0; i<dims[0]; i++) { - if (buf_vlen_i[i].p) free(buf_vlen_i[i].p); - if (buf_vlen_s[i]) free(buf_vlen_s[i]); + H5Tclose(tid_array_f); + H5Tclose(tid_vlen_i); + H5Tclose(tid_vlen_s); + H5Tclose(tid_enum); + H5Tclose(tid_str); + H5Tclose(cmp_tid); + H5Pclose(dcpl); + H5Pclose(fapl); + H5Sclose(sid_1d); + H5Sclose(sid_2d); + H5Sclose(sid_2); + H5Sclose(sid_large); + H5Sclose(sid_null); + H5Sclose(sid_scalar); + H5Fclose(fid); + + for (i = 0; i < dims[0]; i++) { + if (buf_vlen_i[i].p) + free(buf_vlen_i[i].p); + if (buf_vlen_s[i]) + free(buf_vlen_s[i]); } - for (i=0; i<nrows; i++) { - if (buf_comp_large[i].i_vlen.p) free(buf_comp_large[i].i_vlen.p); - if (buf_comp_large[i].s_vlen) free(buf_comp_large[i].s_vlen); + for (i = 0; i < nrows; i++) { + if (buf_comp_large[i].i_vlen.p) + free(buf_comp_large[i].i_vlen.p); + if (buf_comp_large[i].s_vlen) + free(buf_comp_large[i].s_vlen); } - free (buf_comp); - free (buf_comp_large); - free (buf_int); - free (buf_float_a); - free (buf_double2d[0]); - free (buf_double2d); - free (buf_str); + free(buf_comp); + free(buf_comp_large); + free(buf_int); + free(buf_float_a); + free(buf_double2d[0]); + free(buf_double2d); + free(buf_str); free(buf_vlen_i); free(buf_vlen_s); @@ -470,13 +509,14 @@ herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, } /* add a single attribute */ -int add_attr(hid_t oid, const char *name, hid_t tid, hid_t sid, void *buf) +int +add_attr(hid_t oid, const char *name, hid_t tid, hid_t sid, void *buf) { hid_t aid; - aid = H5Acreate (oid, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT); - if (aid <0) - return 0; + aid = H5Acreate(oid, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT); + if (aid < 0) + return 0; H5Awrite(aid, tid, buf); @@ -490,60 +530,61 @@ int add_attr(hid_t oid, const char *name, hid_t tid, hid_t sid, void *buf) returns the number of attributes added to the objects. */ -int add_attrs(hid_t oid, int idx) +int +add_attrs(hid_t oid, int idx) { - char name[32]; - int i0, i1, i2, j, nattrs=0; - hid_t aid, tid, tid1, sid; - hvl_t i_vlen[4]; - hobj_ref_t ref; - zipcode_t cmp_data[4]; - unsigned int i = 0xffffffff; - long long l = -2147483647; - float f = 123456789.987654321; - double d = 987654321.123456789; - char *s[7] = {"Parting", "is such", "sweeter", "sorrow."}; - float f_array[4] = {1.0, 2.22, 3.333, 4.444}; - char *s_vlen[4] = {"Parting", "is such", "sweet", "sorrow."}; - hsize_t dims1[1]={1}, dims2[1]={4}, dims3[2]={3,5}; - int int3d[4][3][5]; - size_t offset = 0; - - for (i0=0; i0<4; i0++) { - i_vlen[i0].len = (i0+1); - i_vlen[i0].p = (int *)calloc(i_vlen[i0].len, sizeof(int)); - for (j=0; j<i_vlen[i0].len; j++) - ((int *)i_vlen[i0].p)[j] = i0*100+j; - for (i1=0; i1<3; i1++) { - for (i2=0; i2<5; i2++) - int3d[i0][i1][i2] = i0*i1-i1*i2+i0*i2; + char name[32]; + int i0, i1, i2, j, nattrs = 0; + hid_t aid, tid, tid1, sid; + hvl_t i_vlen[4]; + hobj_ref_t ref; + zipcode_t cmp_data[4]; + unsigned int i = 0xffffffff; + long long l = -2147483647; + float f = 123456789.987654321; + double d = 987654321.123456789; + char * s[7] = {"Parting", "is such", "sweeter", "sorrow."}; + float f_array[4] = {1.0, 2.22, 3.333, 4.444}; + char * s_vlen[4] = {"Parting", "is such", "sweet", "sorrow."}; + hsize_t dims1[1] = {1}, dims2[1] = {4}, dims3[2] = {3, 5}; + int int3d[4][3][5]; + size_t offset = 0; + + for (i0 = 0; i0 < 4; i0++) { + i_vlen[i0].len = (i0 + 1); + i_vlen[i0].p = (int *)calloc(i_vlen[i0].len, sizeof(int)); + for (j = 0; j < i_vlen[i0].len; j++) + ((int *)i_vlen[i0].p)[j] = i0 * 100 + j; + for (i1 = 0; i1 < 3; i1++) { + for (i2 = 0; i2 < 5; i2++) + int3d[i0][i1][i2] = i0 * i1 - i1 * i2 + i0 * i2; } } cmp_data[0].zipcode = 01001; - cmp_data[0].city = "Agawam, Massachusetts"; + cmp_data[0].city = "Agawam, Massachusetts"; cmp_data[1].zipcode = 99950; - cmp_data[1].city = "Ketchikan, Alaska"; + cmp_data[1].city = "Ketchikan, Alaska"; cmp_data[2].zipcode = 00501; - cmp_data[2].city = "Holtsville, New York"; + cmp_data[2].city = "Holtsville, New York"; cmp_data[3].zipcode = 61820; - cmp_data[3].city = "Champaign, Illinois"; + cmp_data[3].city = "Champaign, Illinois"; /* 1 scalar point */ - sid = H5Screate (H5S_SCALAR); + sid = H5Screate(H5S_SCALAR); HDsprintf(name, "%05d scalar int", idx); nattrs += add_attr(oid, name, H5T_NATIVE_UINT, sid, &i); HDsprintf(name, "%05d scalar ulong", idx); nattrs += add_attr(oid, name, H5T_NATIVE_INT64, sid, &l); HDsprintf(name, "%05d scalar str", idx); - tid = H5Tcopy (H5T_C_S1); - H5Tset_size (tid, H5T_VARIABLE); + tid = H5Tcopy(H5T_C_S1); + H5Tset_size(tid, H5T_VARIABLE); nattrs += add_attr(oid, name, tid, sid, &s[2]); H5Tclose(tid); H5Sclose(sid); /* 4 single point */ - sid = H5Screate_simple (1, dims1, NULL); + sid = H5Screate_simple(1, dims1, NULL); H5Rcreate(&ref, oid, ".", H5R_OBJECT, (hid_t)-1); HDsprintf(name, "%05d single float", idx); nattrs += add_attr(oid, name, H5T_NATIVE_FLOAT, sid, &f); @@ -554,14 +595,14 @@ int add_attrs(hid_t oid, int idx) H5Sclose(sid); /* 7 fixed length 1D array */ - sid = H5Screate_simple (1, dims1, NULL); - tid = H5Tarray_create (H5T_NATIVE_FLOAT, 1, dims2); + sid = H5Screate_simple(1, dims1, NULL); + tid = H5Tarray_create(H5T_NATIVE_FLOAT, 1, dims2); HDsprintf(name, "%05d array float", idx); nattrs += add_attr(oid, name, tid, sid, &f_array[0]); H5Tclose(tid); - tid = H5Tcopy (H5T_C_S1); - H5Tset_size (tid, strlen(s[0])+1); - tid1 = H5Tarray_create (tid, 1, dims2); + tid = H5Tcopy(H5T_C_S1); + H5Tset_size(tid, strlen(s[0]) + 1); + tid1 = H5Tarray_create(tid, 1, dims2); HDsprintf(name, "%05d array str", idx); nattrs += add_attr(oid, name, tid1, sid, s); H5Tclose(tid1); @@ -569,40 +610,43 @@ int add_attrs(hid_t oid, int idx) H5Sclose(sid); /* 9 fixed length 2D int arrays */ - sid = H5Screate_simple (1, dims2, NULL); - tid = H5Tarray_create (H5T_NATIVE_INT, 2, dims3); + sid = H5Screate_simple(1, dims2, NULL); + tid = H5Tarray_create(H5T_NATIVE_INT, 2, dims3); HDsprintf(name, "%05d array int 2D", idx); nattrs += add_attr(oid, name, tid, sid, int3d[0][0]); H5Tclose(tid); H5Sclose(sid); /* 10 variable length arrays */ - sid = H5Screate_simple (1, dims2, NULL); - tid = H5Tcopy (H5T_C_S1); - H5Tset_size (tid, H5T_VARIABLE); + sid = H5Screate_simple(1, dims2, NULL); + tid = H5Tcopy(H5T_C_S1); + H5Tset_size(tid, H5T_VARIABLE); HDsprintf(name, "%05d vlen strings", idx); nattrs += add_attr(oid, name, tid, sid, s_vlen); H5Tclose(tid); - tid = H5Tvlen_create (H5T_NATIVE_INT);; + tid = H5Tvlen_create(H5T_NATIVE_INT); + ; HDsprintf(name, "%05d vlen int array", idx); nattrs += add_attr(oid, name, tid, sid, i_vlen); H5Tclose(tid); H5Sclose(sid); /* 12 compound data */ - sid = H5Screate_simple (1, dims2, NULL); - tid = H5Tcreate (H5T_COMPOUND, sizeof (zipcode_t)); - tid1 = H5Tcopy (H5T_C_S1); - H5Tset_size (tid1, H5T_VARIABLE); - H5Tinsert (tid, "zip code", 0, H5T_NATIVE_INT); offset += sizeof(H5T_NATIVE_INT); - H5Tinsert (tid, "City", offset, tid1); offset += sizeof(char *); + sid = H5Screate_simple(1, dims2, NULL); + tid = H5Tcreate(H5T_COMPOUND, sizeof(zipcode_t)); + tid1 = H5Tcopy(H5T_C_S1); + H5Tset_size(tid1, H5T_VARIABLE); + H5Tinsert(tid, "zip code", 0, H5T_NATIVE_INT); + offset += sizeof(H5T_NATIVE_INT); + H5Tinsert(tid, "City", offset, tid1); + offset += sizeof(char *); HDsprintf(name, "%05d compound data", idx); nattrs += add_attr(oid, name, tid, sid, cmp_data); H5Tclose(tid1); H5Tclose(tid); H5Sclose(sid); - for (i0=0; i0<4; i0++) + for (i0 = 0; i0 < 4; i0++) free(i_vlen[i0].p); return nattrs; diff --git a/tools/test/misc/h5repart_gentest.c b/tools/test/misc/h5repart_gentest.c index 520069f..b068985 100644 --- a/tools/test/misc/h5repart_gentest.c +++ b/tools/test/misc/h5repart_gentest.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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -21,26 +21,27 @@ #include "hdf5.h" #include "H5private.h" -#define FAMILY_NUMBER 4 -#define FAMILY_SIZE 1024 -#define FILENAME "family_file%05d.h5" +#define FAMILY_NUMBER 4 +#define FAMILY_SIZE 1024 +#define FILENAME "family_file%05d.h5" -int **buf = NULL; -int *buf_data = NULL; +int **buf = NULL; +int * buf_data = NULL; -int main(void) +int +main(void) { - hid_t file=(-1), fapl, space=(-1), dset=(-1); - char dname[]="dataset"; - int i, j; - hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE}; + hid_t file = (-1), fapl, space = (-1), dset = (-1); + char dname[] = "dataset"; + int i, j; + hsize_t dims[2] = {FAMILY_NUMBER, FAMILY_SIZE}; /* Set up data array */ - if(NULL == (buf_data = (int *)HDcalloc(FAMILY_NUMBER * FAMILY_SIZE, sizeof(int)))) { + if (NULL == (buf_data = (int *)HDcalloc(FAMILY_NUMBER * FAMILY_SIZE, sizeof(int)))) { HDperror("HDcalloc"); HDexit(EXIT_FAILURE); } - if(NULL == (buf = (int **)HDcalloc(FAMILY_NUMBER, sizeof(buf_data)))) { + if (NULL == (buf = (int **)HDcalloc(FAMILY_NUMBER, sizeof(buf_data)))) { HDperror("HDcalloc"); HDexit(EXIT_FAILURE); } @@ -53,55 +54,52 @@ int main(void) HDexit(EXIT_FAILURE); } - if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) { + if (H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) { HDperror("H5Pset_fapl_family"); HDexit(EXIT_FAILURE); } - if((file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { + if ((file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { HDperror("H5Fcreate"); HDexit(EXIT_FAILURE); } /* Create and write dataset */ - if((space = H5Screate_simple(2, dims, NULL)) < 0) { + if ((space = H5Screate_simple(2, dims, NULL)) < 0) { HDperror("H5Screate_simple"); HDexit(EXIT_FAILURE); } - - if((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + if ((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { HDperror("H5Dcreate2"); HDexit(EXIT_FAILURE); } - - for(i = 0; i < FAMILY_NUMBER; i++) - for(j = 0; j < FAMILY_SIZE; j++) + for (i = 0; i < FAMILY_NUMBER; i++) + for (j = 0; j < FAMILY_SIZE; j++) buf[i][j] = i * 10000 + j; - if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) { + if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) { HDperror("H5Dwrite"); HDexit(EXIT_FAILURE); } - - if(H5Sclose(space) < 0) { + if (H5Sclose(space) < 0) { HDperror("H5Sclose"); HDexit(EXIT_FAILURE); } - if(H5Dclose(dset) < 0) { + if (H5Dclose(dset) < 0) { HDperror("H5Dclose"); HDexit(EXIT_FAILURE); } - if(H5Pclose(fapl) < 0) { + if (H5Pclose(fapl) < 0) { HDperror("H5Pclose"); HDexit(EXIT_FAILURE); } - if(H5Fclose(file) < 0) { + if (H5Fclose(file) < 0) { HDperror("H5Fclose"); HDexit(EXIT_FAILURE); } diff --git a/tools/test/misc/repart_test.c b/tools/test/misc/repart_test.c index 7227de0..7aa5ad9 100644 --- a/tools/test/misc/repart_test.c +++ b/tools/test/misc/repart_test.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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -19,22 +19,16 @@ #include "hdf5.h" #include "H5private.h" -#define KB 1024 -#define FAMILY_H5REPART_SIZE1 20000 -#define FAMILY_H5REPART_SIZE2 (5*KB) +#define KB 1024 +#define FAMILY_H5REPART_SIZE1 20000 +#define FAMILY_H5REPART_SIZE2 (5 * KB) -const char *FILENAME[] = { - "fst_family%05d.h5", - "scd_family%05d.h5", - "family_to_single.h5", - "family_to_sec2.h5", - NULL -}; +const char *FILENAME[] = {"fst_family%05d.h5", "scd_family%05d.h5", "family_to_single.h5", + "family_to_sec2.h5", NULL}; herr_t test_family_h5repart_opens(void); herr_t test_single_h5repart_opens(void); - /*------------------------------------------------------------------------- * Function: test_family_h5repart_opens * @@ -47,8 +41,8 @@ herr_t test_single_h5repart_opens(void); herr_t test_family_h5repart_opens(void) { - hid_t fid = H5I_INVALID_HID; - hid_t fapl_id = H5I_INVALID_HID; + hid_t fid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; /* open 1st file(single member file) with correct family size(20000 byte) */ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) @@ -57,7 +51,7 @@ test_family_h5repart_opens(void) if (H5Pset_fapl_family(fapl_id, (hsize_t)FAMILY_H5REPART_SIZE1, H5P_DEFAULT) < 0) goto error; - if ((fid = H5Fopen(FILENAME[0], H5F_ACC_RDWR, fapl_id))<0) + if ((fid = H5Fopen(FILENAME[0], H5F_ACC_RDWR, fapl_id)) < 0) goto error; if (H5Fclose(fid) < 0) @@ -79,17 +73,17 @@ test_family_h5repart_opens(void) return SUCCEED; error: - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Pclose(fapl_id); H5Fclose(fid); - } H5E_END_TRY; + } + H5E_END_TRY; return FAIL; } /* end test_family_h5repart_opens() */ - - /*------------------------------------------------------------------------- * Function: test_single_h5repart_opens * @@ -102,7 +96,7 @@ error: herr_t test_single_h5repart_opens(void) { - hid_t fid = H5I_INVALID_HID; + hid_t fid = H5I_INVALID_HID; /* open the single file */ if ((fid = H5Fopen(FILENAME[2], H5F_ACC_RDWR, H5P_DEFAULT)) < 0) @@ -119,15 +113,16 @@ test_single_h5repart_opens(void) return SUCCEED; error: - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Fclose(fid); - } H5E_END_TRY; + } + H5E_END_TRY; return FAIL; } /* end test_single_h5repart_opens() */ - /*------------------------------------------------------------------------- * Function: main * @@ -140,10 +135,10 @@ error: int main(void) { - int nerrors = 0; + int nerrors = 0; - nerrors += test_family_h5repart_opens() < 0 ? 1 : 0; - nerrors += test_single_h5repart_opens() < 0 ? 1 : 0; + nerrors += test_family_h5repart_opens() < 0 ? 1 : 0; + nerrors += test_single_h5repart_opens() < 0 ? 1 : 0; if (nerrors) goto error; @@ -152,8 +147,6 @@ main(void) error: nerrors = MAX(1, nerrors); - HDprintf("***** %d FAMILY FILE TEST%s FAILED! *****\n", - nerrors, 1 == nerrors ? "" : "S"); + HDprintf("***** %d FAMILY FILE TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); HDexit(EXIT_FAILURE); } /* end main() */ - diff --git a/tools/test/misc/talign.c b/tools/test/misc/talign.c index c69d1f7..f214527 100644 --- a/tools/test/misc/talign.c +++ b/tools/test/misc/talign.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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -20,7 +20,7 @@ #include "H5private.h" #include "h5tools.h" -const char *fname = "talign.h5"; +const char *fname = "talign.h5"; const char *setname = "align"; /* @@ -30,26 +30,27 @@ const char *setname = "align"; * another per construction) */ -int main(void) +int +main(void) { - hid_t fil=H5I_INVALID_HID, spc=H5I_INVALID_HID, set=H5I_INVALID_HID; - hid_t cs6=H5I_INVALID_HID, cmp=H5I_INVALID_HID, fix=H5I_INVALID_HID; - hid_t cmp1=H5I_INVALID_HID, cmp2=H5I_INVALID_HID, cmp3=H5I_INVALID_HID; - hid_t plist=H5I_INVALID_HID; - hid_t array_dt=H5I_INVALID_HID; + hid_t fil = H5I_INVALID_HID, spc = H5I_INVALID_HID, set = H5I_INVALID_HID; + hid_t cs6 = H5I_INVALID_HID, cmp = H5I_INVALID_HID, fix = H5I_INVALID_HID; + hid_t cmp1 = H5I_INVALID_HID, cmp2 = H5I_INVALID_HID, cmp3 = H5I_INVALID_HID; + hid_t plist = H5I_INVALID_HID; + hid_t array_dt = H5I_INVALID_HID; hsize_t dim[2]; hsize_t cdim[4]; - char string5[5]; - float fok[2] = {1234.0f, 2341.0f}; - float fnok[2] = {5678.0f, 6785.0f}; - float *fptr = NULL; + char string5[5]; + float fok[2] = {1234.0f, 2341.0f}; + float fnok[2] = {5678.0f, 6785.0f}; + float *fptr = NULL; char *data = NULL; - int result = 0; - herr_t error = 1; + int result = 0; + herr_t error = 1; HDprintf("%-70s", "Testing alignment in compound datatypes"); @@ -62,9 +63,11 @@ int main(void) return 1; } - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { (void)H5Ldelete(fil, setname, H5P_DEFAULT); - } H5E_END_TRY; + } + H5E_END_TRY; cs6 = H5Tcopy(H5T_C_S1); H5Tset_size(cs6, sizeof(string5)); @@ -73,20 +76,20 @@ int main(void) cmp = H5Tcreate(H5T_COMPOUND, sizeof(fok) + sizeof(string5) + sizeof(fnok)); H5Tinsert(cmp, "Awkward length", 0, cs6); - cdim[0] = sizeof(fok) / sizeof(float); + cdim[0] = sizeof(fok) / sizeof(float); array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, cdim); H5Tinsert(cmp, "Ok", sizeof(string5), array_dt); H5Tclose(array_dt); - cdim[0] = sizeof(fnok) / sizeof(float); + cdim[0] = sizeof(fnok) / sizeof(float); array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, cdim); H5Tinsert(cmp, "Not Ok", sizeof(fok) + sizeof(string5), array_dt); H5Tclose(array_dt); - fix = H5Tget_native_type(cmp, H5T_DIR_DEFAULT); + fix = H5Tget_native_type(cmp, H5T_DIR_DEFAULT); cmp1 = H5Tcreate(H5T_COMPOUND, sizeof(fok)); - cdim[0] = sizeof(fok) / sizeof(float); + cdim[0] = sizeof(fok) / sizeof(float); array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, cdim); H5Tinsert(cmp1, "Ok", 0, array_dt); H5Tclose(array_dt); @@ -96,13 +99,13 @@ int main(void) cmp3 = H5Tcreate(H5T_COMPOUND, sizeof(fnok)); - cdim[0] = sizeof(fnok) / sizeof(float); + cdim[0] = sizeof(fnok) / sizeof(float); array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, cdim); H5Tinsert(cmp3, "Not Ok", 0, array_dt); H5Tclose(array_dt); plist = H5Pcreate(H5P_DATASET_XFER); - if((error = H5Pset_preserve(plist, 1)) < 0) + if ((error = H5Pset_preserve(plist, 1)) < 0) goto out; /* @@ -110,8 +113,8 @@ int main(void) * in turn so that we are avoid alignment issues at this point */ dim[0] = 1; - spc = H5Screate_simple(1, dim, NULL); - set = H5Dcreate2(fil, setname, cmp, spc, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + spc = H5Screate_simple(1, dim, NULL); + set = H5Dcreate2(fil, setname, cmp, spc, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); H5Dwrite(set, cmp1, spc, H5S_ALL, plist, fok); H5Dwrite(set, cmp2, spc, H5S_ALL, plist, string5); @@ -122,7 +125,7 @@ int main(void) /* Now open the set, and read it back in */ data = (char *)HDmalloc(H5Tget_size(fix)); - if(!data) { + if (!data) { HDperror("malloc() failed"); HDabort(); } @@ -134,61 +137,56 @@ int main(void) H5Dclose(set); out: - if(error < 0) { + if (error < 0) { result = 1; HDputs("*FAILED - HDF5 library error*"); - } else if(!(H5_FLT_ABS_EQUAL(fok[0], fptr[0])) - || !(H5_FLT_ABS_EQUAL(fok[1], fptr[1])) - || !(H5_FLT_ABS_EQUAL(fnok[0], fptr[2])) - || !(H5_FLT_ABS_EQUAL(fnok[1], fptr[3]))) { + } + else if (!(H5_FLT_ABS_EQUAL(fok[0], fptr[0])) || !(H5_FLT_ABS_EQUAL(fok[1], fptr[1])) || + !(H5_FLT_ABS_EQUAL(fnok[0], fptr[2])) || !(H5_FLT_ABS_EQUAL(fnok[1], fptr[3]))) { char *mname; result = 1; - mname = H5Tget_member_name(fix, 0); - HDprintf("%14s (%2d) %6s = %s\n", - mname ? mname : "(null)", (int)H5Tget_member_offset(fix,0), - string5, (char *)(data + H5Tget_member_offset(fix, 0))); - if(mname) + mname = H5Tget_member_name(fix, 0); + HDprintf("%14s (%2d) %6s = %s\n", mname ? mname : "(null)", (int)H5Tget_member_offset(fix, 0), + string5, (char *)(data + H5Tget_member_offset(fix, 0))); + if (mname) H5free_memory(mname); - fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); mname = H5Tget_member_name(fix, 1); HDprintf("Data comparison:\n" - "%14s (%2d) %6f = %f\n" - " %6f = %f\n", - mname ? mname : "(null)", (int)H5Tget_member_offset(fix,1), - (double)fok[0], (double)fptr[0], - (double)fok[1], (double)fptr[1]); - if(mname) + "%14s (%2d) %6f = %f\n" + " %6f = %f\n", + mname ? mname : "(null)", (int)H5Tget_member_offset(fix, 1), (double)fok[0], (double)fptr[0], + (double)fok[1], (double)fptr[1]); + if (mname) H5free_memory(mname); - fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 2))); + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 2))); mname = H5Tget_member_name(fix, 2); HDprintf("%14s (%2d) %6f = %f\n" - " %6f = %6f\n", - mname ? mname : "(null)", (int)H5Tget_member_offset(fix,2), - (double)fnok[0], (double)fptr[0], - (double)fnok[1], (double)fptr[1]); - if(mname) + " %6f = %6f\n", + mname ? mname : "(null)", (int)H5Tget_member_offset(fix, 2), (double)fnok[0], + (double)fptr[0], (double)fnok[1], (double)fptr[1]); + if (mname) H5free_memory(mname); fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); HDprintf("\n" - "Short circuit\n" - " %6f = %f\n" - " %6f = %f\n" - " %6f = %f\n" - " %6f = %f\n", - (double)fok[0], (double)fptr[0], - (double)fok[1], (double)fptr[1], - (double)fnok[0], (double)fptr[2], - (double)fnok[1], (double)fptr[3]); + "Short circuit\n" + " %6f = %f\n" + " %6f = %f\n" + " %6f = %f\n" + " %6f = %f\n", + (double)fok[0], (double)fptr[0], (double)fok[1], (double)fptr[1], (double)fnok[0], + (double)fptr[2], (double)fnok[1], (double)fptr[3]); HDputs("*FAILED - compound type alignmnent problem*"); - } else { + } + else { HDputs(" PASSED"); } - if(data) + if (data) HDfree(data); H5Sclose(spc); H5Tclose(cs6); @@ -203,4 +201,3 @@ out: HDfflush(stdout); return result; } - diff --git a/tools/test/misc/testh5clear.sh.in b/tools/test/misc/testh5clear.sh.in index 3f2b32f..a01fa4a 100644 --- a/tools/test/misc/testh5clear.sh.in +++ b/tools/test/misc/testh5clear.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. # @@ -315,7 +315,7 @@ TOOLTEST_ERR orig_h5clear_sec2_v0.h5 -s -m "" h5clear_no_mdc_image.err # # The following are tests to verify the expected exit code from h5clear: # "h5clear -m h5clear_mdc_image.h5" (valid option, existing file, succeed exit code) -# "h5clear --vers" (valid option, version #, succeed exit code) +# "h5clear --version" (valid option, version #, succeed exit code) # "h5clear -k" (invalid 1 option, no file, fail exit code) # "h5clear -k junk.h5" (invalid 1 option, nonexisting file, fail exit code) # "h5clear -l h5clear_sec2_v2.h5" (invalid 1 option, existing file, fail exit code) @@ -326,7 +326,7 @@ TOOLTEST_ERR orig_h5clear_sec2_v0.h5 -s -m "" h5clear_no_mdc_image.err # "h5clear -m -l h5clear_sec2_v0.h5" (valid/invalid 2 options, existing file, fail exit code) # "h5clear -l -m h5clear_sec2_v0.h5" (invalid/valid 2 options, existing file, fail exit code) TOOLTEST h5clear_mdc_image.h5 -m "" $SUCCEED -TOOLTEST "" --vers "" $SUCCEED +TOOLTEST "" --version "" $SUCCEED TOOLTEST "" -k "" $FAIL TOOLTEST junk.h5 -k "" $FAIL TOOLTEST h5clear_sec2_v2.h5 -l "" $FAIL diff --git a/tools/test/misc/testh5mkgrp.sh.in b/tools/test/misc/testh5mkgrp.sh.in index 7dc8155..5cd852a 100644 --- a/tools/test/misc/testh5mkgrp.sh.in +++ b/tools/test/misc/testh5mkgrp.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. # diff --git a/tools/test/misc/testh5repart.sh.in b/tools/test/misc/testh5repart.sh.in index 143f607..be07f0d 100644 --- a/tools/test/misc/testh5repart.sh.in +++ b/tools/test/misc/testh5repart.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. # diff --git a/tools/test/misc/vds/CMakeLists.txt b/tools/test/misc/vds/CMakeLists.txt index 71261c4..e8eb960 100644 --- a/tools/test/misc/vds/CMakeLists.txt +++ b/tools/test/misc/vds/CMakeLists.txt @@ -1,9 +1,9 @@ cmake_minimum_required (VERSION 3.12) project (HDF5_TOOLS_TEST_MISC_VDS C) -MACRO (ADD_H5_GENERATOR genfile) +macro (ADD_H5_GENERATOR genfile) add_executable (${genfile} ${HDF5_TOOLS_TEST_MISC_VDS_SOURCE_DIR}/${genfile}.c) - target_include_directories (${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT ONLY_SHARED_LIBS) TARGET_C_PROPERTIES (${genfile} STATIC) target_link_libraries (${genfile} PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -12,7 +12,14 @@ MACRO (ADD_H5_GENERATOR genfile) target_link_libraries (${genfile} PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) endif () set_target_properties (${genfile} PROPERTIES FOLDER generator/tools) -ENDMACRO () + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TOOLS_TEST_MISC_VDS_${genfile}_FORMAT ${genfile}) + endif () +endmacro () # generator executables set (H5_GENERATORS diff --git a/tools/test/misc/vds/Makefile.am b/tools/test/misc/vds/Makefile.am index 73c335f..90923fa 100644 --- a/tools/test/misc/vds/Makefile.am +++ b/tools/test/misc/vds/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/misc/vds/Makefile.in b/tools/test/misc/vds/Makefile.in index 657f615..0cc66fa 100644 --- a/tools/test/misc/vds/Makefile.in +++ b/tools/test/misc/vds/Makefile.in @@ -22,7 +22,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. # @@ -114,6 +114,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \ $(top_srcdir)/m4/ax_check_junit.m4 \ $(top_srcdir)/m4/ax_java_options.m4 \ $(top_srcdir)/m4/ax_jni_include_dir.m4 \ + $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_prog_jar.m4 \ $(top_srcdir)/m4/ax_prog_java.m4 \ $(top_srcdir)/m4/ax_prog_java_works.m4 \ @@ -436,12 +437,12 @@ AMTAR = @AMTAR@ # AM_CFLAGS is an automake construct which should be used by Makefiles # instead of CFLAGS, as CFLAGS is reserved solely for the user to define. # This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well. -AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@ +AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ # Include src directory AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \ -I$(top_srcdir)/tools/lib -I$(top_srcdir)/tools/test/misc/vds -AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@ +AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@ AM_JAVACFLAGS = @AM_JAVACFLAGS@ @@ -479,11 +480,56 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@ -DEV_WARNINGS = @DEV_WARNINGS@ +DIAGS = @DIAGS@ DIRECT_VFD = @DIRECT_VFD@ DLLTOOL = @DLLTOOL@ +DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@ +DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@ +DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@ +DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@ +DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@ +DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@ +DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@ +DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@ +DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@ +DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@ +DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@ +DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@ +DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@ +DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ +DOXYGEN_PREDEFINED = @DOXYGEN_PREDEFINED@ +DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@ +DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@ +DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@ +DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@ +DOXYGEN_STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@ +DOXYGEN_TAG_FILE = @DOXYGEN_TAG_FILE@ +DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ +DX_CONFIG = @DX_CONFIG@ +DX_DOCDIR = @DX_DOCDIR@ +DX_DOT = @DX_DOT@ +DX_DOXYGEN = @DX_DOXYGEN@ +DX_DVIPS = @DX_DVIPS@ +DX_EGREP = @DX_EGREP@ +DX_ENV = @DX_ENV@ +DX_FLAG_chi = @DX_FLAG_chi@ +DX_FLAG_chm = @DX_FLAG_chm@ +DX_FLAG_doc = @DX_FLAG_doc@ +DX_FLAG_dot = @DX_FLAG_dot@ +DX_FLAG_html = @DX_FLAG_html@ +DX_FLAG_man = @DX_FLAG_man@ +DX_FLAG_pdf = @DX_FLAG_pdf@ +DX_FLAG_ps = @DX_FLAG_ps@ +DX_FLAG_rtf = @DX_FLAG_rtf@ +DX_FLAG_xml = @DX_FLAG_xml@ +DX_HHC = @DX_HHC@ +DX_LATEX = @DX_LATEX@ +DX_MAKEINDEX = @DX_MAKEINDEX@ +DX_PDFLATEX = @DX_PDFLATEX@ +DX_PERL = @DX_PERL@ +DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ @@ -515,8 +561,6 @@ H5_CFLAGS = @H5_CFLAGS@ H5_CLASSPATH = @H5_CLASSPATH@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ -H5_ECFLAGS = @H5_ECFLAGS@ -H5_ECXXFLAGS = @H5_ECXXFLAGS@ H5_FCFLAGS = @H5_FCFLAGS@ H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@ H5_IS_DARWIN = @H5_IS_DARWIN@ @@ -530,7 +574,9 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@ HAVE_LIBHDFS = @HAVE_LIBHDFS@ HAVE_PTHREAD = @HAVE_PTHREAD@ +HDF5_DOXYGEN = @HDF5_DOXYGEN@ HDF5_HL = @HDF5_HL@ +HDF5_HL_TOOLS = @HDF5_HL_TOOLS@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF5_TESTS = @HDF5_TESTS@ HDF5_TOOLS = @HDF5_TOOLS@ @@ -540,6 +586,7 @@ HDF_JAVA = @HDF_JAVA@ HID_T = @HID_T@ HL = @HL@ HL_FOR = @HL_FOR@ +HL_TOOLS = @HL_TOOLS@ HSIZE_T = @HSIZE_T@ HSSIZE_T = @HSSIZE_T@ IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@ @@ -733,7 +780,7 @@ LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la # Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below -# has been removed. According to the official description of DESTDIR by Gnu at +# has been removed. According to the official description of DESTDIR by GNU at # http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is # prepended to the normal and complete install path that it precedes for the # purpose of installing in a temporary directory which is useful for building @@ -1293,8 +1340,9 @@ uninstall-am: # commands that should be executed even if a file with the same name already # exists. .PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \ - build-tests check-clean check-install check-p check-s check-vfd \ - install-doc lib progs tests uninstall-doc _exec_check-s _test help + build-tests check-clean check-install check-p check-s check-vfd \ + install-doc lib progs tests uninstall-doc \ + _exec_check-s _test help trace doxygen help: @$(top_srcdir)/bin/makehelp diff --git a/tools/test/misc/vds/UC_1.h b/tools/test/misc/vds/UC_1.h index d922d22..f38ed54 100644 --- a/tools/test/misc/vds/UC_1.h +++ b/tools/test/misc/vds/UC_1.h @@ -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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -63,57 +63,40 @@ */ - -#define UC_1_N_SOURCES 6 +#define UC_1_N_SOURCES 6 /* Dataset dimensions */ -#define UC_1_SM_HEIGHT 2 /* K */ -#define UC_1_LG_HEIGHT 4 /* N */ -#define UC_1_SM_LG_HEIGHT 6 /* SM_HEIGHT + LG_HEIGHT */ -#define UC_1_FULL_HEIGHT 18 /* (3 * K) + (3 * N) */ -#define UC_1_HALF_HEIGHT 9 -#define UC_1_WIDTH 8 /* M */ -#define UC_1_HALF_WIDTH 4 +#define UC_1_SM_HEIGHT 2 /* K */ +#define UC_1_LG_HEIGHT 4 /* N */ +#define UC_1_SM_LG_HEIGHT 6 /* SM_HEIGHT + LG_HEIGHT */ +#define UC_1_FULL_HEIGHT 18 /* (3 * K) + (3 * N) */ +#define UC_1_HALF_HEIGHT 9 +#define UC_1_WIDTH 8 /* M */ +#define UC_1_HALF_WIDTH 4 -#define UC_1_N_MAX_PLANES H5S_UNLIMITED /* max number of planes */ -#define UC_1_N_TEST_PLANES 5 /* number of planes we write */ +#define UC_1_N_MAX_PLANES H5S_UNLIMITED /* max number of planes */ +#define UC_1_N_TEST_PLANES 5 /* number of planes we write */ /* Dataset datatypes */ -#define UC_1_SOURCE_DATATYPE H5T_STD_I32LE -#define UC_1_VDS_DATATYPE H5T_STD_I32LE +#define UC_1_SOURCE_DATATYPE H5T_STD_I32LE +#define UC_1_VDS_DATATYPE H5T_STD_I32LE /* Starting size of datasets, both source and VDS */ static hsize_t UC_1_DIMS[UC_1_N_SOURCES][RANK] = { - {0, UC_1_SM_HEIGHT, UC_1_WIDTH}, - {0, UC_1_LG_HEIGHT, UC_1_WIDTH}, - {0, UC_1_SM_HEIGHT, UC_1_WIDTH}, - {0, UC_1_LG_HEIGHT, UC_1_WIDTH}, - {0, UC_1_SM_HEIGHT, UC_1_WIDTH}, - {0, UC_1_LG_HEIGHT, UC_1_WIDTH} -}; + {0, UC_1_SM_HEIGHT, UC_1_WIDTH}, {0, UC_1_LG_HEIGHT, UC_1_WIDTH}, {0, UC_1_SM_HEIGHT, UC_1_WIDTH}, + {0, UC_1_LG_HEIGHT, UC_1_WIDTH}, {0, UC_1_SM_HEIGHT, UC_1_WIDTH}, {0, UC_1_LG_HEIGHT, UC_1_WIDTH}}; /* Maximum size of datasets, both source and VDS */ static hsize_t UC_1_MAX_DIMS[UC_1_N_SOURCES][RANK] = { - {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH}, - {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH}, - {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH}, - {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH}, - {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH}, - {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH} -}; + {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH}, {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH}, + {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH}, {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH}, + {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH}, {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH}}; /* File names for source datasets */ -static char UC_1_FILE_NAMES[UC_1_N_SOURCES][NAME_LEN] = { - {"1_a.h5"}, - {"1_b.h5"}, - {"1_c.h5"}, - {"1_d.h5"}, - {"1_e.h5"}, - {"1_f.h5"} -}; +static char UC_1_FILE_NAMES[UC_1_N_SOURCES][NAME_LEN] = {{"1_a.h5"}, {"1_b.h5"}, {"1_c.h5"}, + {"1_d.h5"}, {"1_e.h5"}, {"1_f.h5"}}; /* Dataset names */ static char UC_1_SOURCE_DSET_PATH[NAME_LEN] = "/source_dset"; #endif /* UC_1_H */ - diff --git a/tools/test/misc/vds/UC_1_one_dim_gen.c b/tools/test/misc/vds/UC_1_one_dim_gen.c index 7c4201e..a816fb8 100644 --- a/tools/test/misc/vds/UC_1_one_dim_gen.c +++ b/tools/test/misc/vds/UC_1_one_dim_gen.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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -25,18 +25,13 @@ #include "UC_common.h" #include "UC_1.h" -static hsize_t UC_1_VDS_DIMS[RANK] = {0, UC_1_FULL_HEIGHT, UC_1_WIDTH}; +static hsize_t UC_1_VDS_DIMS[RANK] = {0, UC_1_FULL_HEIGHT, UC_1_WIDTH}; static hsize_t UC_1_VDS_MAX_DIMS[RANK] = {UC_1_N_MAX_PLANES, UC_1_FULL_HEIGHT, UC_1_WIDTH}; /* Planes */ static hsize_t UC_1_PLANES[UC_1_N_SOURCES][RANK] = { - {1, UC_1_SM_HEIGHT, UC_1_WIDTH}, - {1, UC_1_LG_HEIGHT, UC_1_WIDTH}, - {1, UC_1_SM_HEIGHT, UC_1_WIDTH}, - {1, UC_1_LG_HEIGHT, UC_1_WIDTH}, - {1, UC_1_SM_HEIGHT, UC_1_WIDTH}, - {1, UC_1_LG_HEIGHT, UC_1_WIDTH} -}; + {1, UC_1_SM_HEIGHT, UC_1_WIDTH}, {1, UC_1_LG_HEIGHT, UC_1_WIDTH}, {1, UC_1_SM_HEIGHT, UC_1_WIDTH}, + {1, UC_1_LG_HEIGHT, UC_1_WIDTH}, {1, UC_1_SM_HEIGHT, UC_1_WIDTH}, {1, UC_1_LG_HEIGHT, UC_1_WIDTH}}; /* VDS file name */ static char UC_1_VDS_FILE_NAME[NAME_LEN] = "1_vds.h5"; @@ -46,43 +41,35 @@ static char UC_1_SOURCE_DSET_NAME[NAME_LEN] = "source_dset"; static char UC_1_VDS_DSET_NAME[NAME_LEN] = "vds_dset"; /* Fill values */ -static int UC_1_FILL_VALUES[UC_1_N_SOURCES] = { - -1, - -2, - -3, - -4, - -5, - -6 -}; -static int UC_1_VDS_FILL_VALUE = -9; +static int UC_1_FILL_VALUES[UC_1_N_SOURCES] = {-1, -2, -3, -4, -5, -6}; +static int UC_1_VDS_FILL_VALUE = -9; int main(void) { - hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ - hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */ + hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ + hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */ - hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ - hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ + hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ + hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ - hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ - hid_t did = H5I_INVALID_HID; /* dataset ID */ - hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */ - hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */ + hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ + hid_t did = H5I_INVALID_HID; /* dataset ID */ + hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */ + hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */ - hsize_t extent[RANK]; /* dataset extents */ - hsize_t start[RANK]; /* starting point for hyperslab */ - hsize_t map_start = 0; /* starting point in the VDS map */ + hsize_t extent[RANK]; /* dataset extents */ + hsize_t start[RANK]; /* starting point for hyperslab */ + hsize_t map_start = 0; /* starting point in the VDS map */ - int *buffer = NULL; /* data buffer */ - hsize_t count = 0; /* number of elements in a plane */ - int n_planes = -1; /* number of planes to write */ - int value = -1; /* value written to datasets */ - - int i; /* iterator */ - int j; /* iterator */ - hsize_t k; /* iterator */ + int * buffer = NULL; /* data buffer */ + hsize_t count = 0; /* number of elements in a plane */ + int n_planes = -1; /* number of planes to write */ + int value = -1; /* value written to datasets */ + int i; /* iterator */ + int j; /* iterator */ + hsize_t k; /* iterator */ /* Start by creating the virtual dataset (VDS) dataspace and creation * property list. The individual source datasets are then created @@ -90,86 +77,80 @@ main(void) */ /* Create VDS dcpl */ - if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) UC_ERROR - if(H5Pset_fill_value(vds_dcplid, UC_1_VDS_DATATYPE, - &UC_1_VDS_FILL_VALUE) < 0) + if (H5Pset_fill_value(vds_dcplid, UC_1_VDS_DATATYPE, &UC_1_VDS_FILL_VALUE) < 0) UC_ERROR /* Create VDS dataspace */ - if((vds_sid = H5Screate_simple(RANK, UC_1_VDS_DIMS, - UC_1_VDS_MAX_DIMS)) < 0) + if ((vds_sid = H5Screate_simple(RANK, UC_1_VDS_DIMS, UC_1_VDS_MAX_DIMS)) < 0) UC_ERROR /************************************ * Create source files and datasets * ************************************/ - start[0] = 0; - start[1] = 0; - start[2] = 0; + start[0] = 0; + start[1] = 0; + start[2] = 0; map_start = 0; - for(i = 0; i < UC_1_N_SOURCES; i++) { + for (i = 0; i < UC_1_N_SOURCES; i++) { /* Create source dataset dcpl */ - if((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) UC_ERROR - if(H5Pset_chunk(src_dcplid, RANK, UC_1_PLANES[i]) < 0) + if (H5Pset_chunk(src_dcplid, RANK, UC_1_PLANES[i]) < 0) UC_ERROR - if(H5Pset_fill_value(src_dcplid, UC_1_SOURCE_DATATYPE, - &UC_1_FILL_VALUES[i]) < 0) + if (H5Pset_fill_value(src_dcplid, UC_1_SOURCE_DATATYPE, &UC_1_FILL_VALUES[i]) < 0) UC_ERROR - if(0 != i % 2) - if(H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0) + if (0 != i % 2) + if (H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0) UC_ERROR /* Create source file, dataspace, and dataset */ - if((fid = H5Fcreate(UC_1_FILE_NAMES[i], H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(UC_1_FILE_NAMES[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) UC_ERROR - if((src_sid = H5Screate_simple(RANK, UC_1_DIMS[i], - UC_1_MAX_DIMS[i])) < 0) + if ((src_sid = H5Screate_simple(RANK, UC_1_DIMS[i], UC_1_MAX_DIMS[i])) < 0) UC_ERROR - if((did = H5Dcreate2(fid, UC_1_SOURCE_DSET_NAME, - UC_1_SOURCE_DATATYPE, src_sid, - H5P_DEFAULT, src_dcplid, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, UC_1_SOURCE_DSET_NAME, UC_1_SOURCE_DATATYPE, src_sid, H5P_DEFAULT, + src_dcplid, H5P_DEFAULT)) < 0) UC_ERROR /* Set the dataset's extent (will eventually vary with i) */ extent[0] = UC_1_N_TEST_PLANES; extent[1] = UC_1_PLANES[i][1]; extent[2] = UC_1_PLANES[i][2]; - if(H5Dset_extent(did, extent) < 0) + if (H5Dset_extent(did, extent) < 0) UC_ERROR /* Create a data buffer that represents a plane */ count = UC_1_PLANES[i][1] * UC_1_PLANES[i][2]; - if(NULL == (buffer = (int *)malloc(count * sizeof(int)))) + if (NULL == (buffer = (int *)malloc(count * sizeof(int)))) UC_ERROR /* Create the memory dataspace */ - if((msid = H5Screate_simple(RANK, UC_1_PLANES[i], NULL)) < 0) + if ((msid = H5Screate_simple(RANK, UC_1_PLANES[i], NULL)) < 0) UC_ERROR /* Get the file dataspace */ - if((fsid = H5Dget_space(did)) < 0) + if ((fsid = H5Dget_space(did)) < 0) UC_ERROR /* Write planes to the dataset, number will eventually vary with i */ n_planes = UC_1_N_TEST_PLANES; - for(j = 0; j < n_planes; j++) { + for (j = 0; j < n_planes; j++) { value = ((i + 1) * 10) + j; - for(k = 0; k < count; k++) - buffer[k] = value; + for (k = 0; k < count; k++) + buffer[k] = value; start[0] = (hsize_t)j; start[1] = 0; start[2] = 0; - if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_1_PLANES[i], NULL) < 0) + if (H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_1_PLANES[i], NULL) < 0) UC_ERROR - if(H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0) + if (H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0) UC_ERROR } /* end for */ @@ -178,90 +159,86 @@ main(void) start[0] = 0; start[1] = 0; start[2] = 0; - if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, - UC_1_MAX_DIMS[i], NULL) < 0) + if (H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, UC_1_MAX_DIMS[i], NULL) < 0) UC_ERROR start[0] = 0; start[1] = map_start; start[2] = 0; - if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, NULL, - UC_1_MAX_DIMS[i], NULL) < 0) + if (H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, NULL, UC_1_MAX_DIMS[i], NULL) < 0) UC_ERROR map_start += UC_1_PLANES[i][1]; /* Add VDS mapping */ - if(H5Pset_virtual(vds_dcplid, vds_sid, UC_1_FILE_NAMES[i], - UC_1_SOURCE_DSET_PATH, src_sid) < 0) + if (H5Pset_virtual(vds_dcplid, vds_sid, UC_1_FILE_NAMES[i], UC_1_SOURCE_DSET_PATH, src_sid) < 0) UC_ERROR /* close */ - if(H5Sclose(src_sid) < 0) + if (H5Sclose(src_sid) < 0) UC_ERROR - if(H5Pclose(src_dcplid) < 0) + if (H5Pclose(src_dcplid) < 0) UC_ERROR - if(H5Sclose(msid) < 0) + if (H5Sclose(msid) < 0) UC_ERROR - if(H5Sclose(fsid) < 0) + if (H5Sclose(fsid) < 0) UC_ERROR - if(H5Dclose(did) < 0) + if (H5Dclose(did) < 0) UC_ERROR - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) UC_ERROR free(buffer); } /* end for */ - /******************* * Create VDS file * *******************/ /* file */ - if((fid = H5Fcreate(UC_1_VDS_FILE_NAME, H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(UC_1_VDS_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) UC_ERROR /* dataset */ - if((did = H5Dcreate2(fid, UC_1_VDS_DSET_NAME, UC_1_VDS_DATATYPE, vds_sid, - H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, UC_1_VDS_DSET_NAME, UC_1_VDS_DATATYPE, vds_sid, H5P_DEFAULT, vds_dcplid, + H5P_DEFAULT)) < 0) UC_ERROR /* close */ - if(H5Pclose(vds_dcplid) < 0) + if (H5Pclose(vds_dcplid) < 0) UC_ERROR - if(H5Sclose(vds_sid) < 0) + if (H5Sclose(vds_sid) < 0) UC_ERROR - if(H5Dclose(did) < 0) + if (H5Dclose(did) < 0) UC_ERROR - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) UC_ERROR return EXIT_SUCCESS; error: - H5E_BEGIN_TRY { - if(src_sid >= 0) + H5E_BEGIN_TRY + { + if (src_sid >= 0) (void)H5Sclose(src_sid); - if(src_dcplid >= 0) + if (src_dcplid >= 0) (void)H5Pclose(src_dcplid); - if(vds_sid >= 0) + if (vds_sid >= 0) (void)H5Sclose(vds_sid); - if(vds_dcplid >= 0) + if (vds_dcplid >= 0) (void)H5Pclose(vds_dcplid); - if(fid >= 0) + if (fid >= 0) (void)H5Fclose(fid); - if(did >= 0) + if (did >= 0) (void)H5Dclose(did); - if(msid >= 0) + if (msid >= 0) (void)H5Sclose(msid); - if(fsid >= 0) + if (fsid >= 0) (void)H5Sclose(fsid); - if(buffer != NULL) + if (buffer != NULL) free(buffer); - } H5E_END_TRY + } + H5E_END_TRY return EXIT_FAILURE; } /* end main */ - diff --git a/tools/test/misc/vds/UC_2.h b/tools/test/misc/vds/UC_2.h index 07f9b9a..8165756 100644 --- a/tools/test/misc/vds/UC_2.h +++ b/tools/test/misc/vds/UC_2.h @@ -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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -48,61 +48,51 @@ */ -#define UC_2_N_SOURCES 5 +#define UC_2_N_SOURCES 5 /* Dataset dimensions */ -#define UC_2_A_HEIGHT 2 -#define UC_2_B_HEIGHT 4 -#define UC_2_AB_HEIGHT 6 /* For hyperslab start position */ -#define UC_2_C_HEIGHT 2 -#define UC_2_D_HEIGHT 5 -#define UC_2_E_HEIGHT 3 -#define UC_2_FULL_HEIGHT 8 /* A+B+C and D+E */ -#define UC_2_WIDTH 7 -#define UC_2_FULL_WIDTH 14 /* 2*width */ - -#define UC_2_N_PLANES_IN_SERIES 3 /* number of planes in a series of sub-images */ -#define UC_2_N_MAX_PLANES H5S_UNLIMITED /* max number of planes */ -#define UC_2_N_TEST_PLANES 6 /* number of planes we write */ +#define UC_2_A_HEIGHT 2 +#define UC_2_B_HEIGHT 4 +#define UC_2_AB_HEIGHT 6 /* For hyperslab start position */ +#define UC_2_C_HEIGHT 2 +#define UC_2_D_HEIGHT 5 +#define UC_2_E_HEIGHT 3 +#define UC_2_FULL_HEIGHT 8 /* A+B+C and D+E */ +#define UC_2_WIDTH 7 +#define UC_2_FULL_WIDTH 14 /* 2*width */ + +#define UC_2_N_PLANES_IN_SERIES 3 /* number of planes in a series of sub-images */ +#define UC_2_N_MAX_PLANES H5S_UNLIMITED /* max number of planes */ +#define UC_2_N_TEST_PLANES 6 /* number of planes we write */ /* Dataset datatypes */ -#define UC_2_SOURCE_DATATYPE H5T_STD_I32LE -#define UC_2_VDS_DATATYPE H5T_STD_I32LE +#define UC_2_SOURCE_DATATYPE H5T_STD_I32LE +#define UC_2_VDS_DATATYPE H5T_STD_I32LE /* Starting size of datasets, both source and VDS */ -static hsize_t UC_2_DIMS[UC_2_N_SOURCES][RANK] = { - {0, UC_2_A_HEIGHT, UC_2_WIDTH}, - {0, UC_2_B_HEIGHT, UC_2_WIDTH}, - {0, UC_2_C_HEIGHT, UC_2_WIDTH}, - {0, UC_2_D_HEIGHT, UC_2_WIDTH}, - {0, UC_2_E_HEIGHT, UC_2_WIDTH} -}; +static hsize_t UC_2_DIMS[UC_2_N_SOURCES][RANK] = {{0, UC_2_A_HEIGHT, UC_2_WIDTH}, + {0, UC_2_B_HEIGHT, UC_2_WIDTH}, + {0, UC_2_C_HEIGHT, UC_2_WIDTH}, + {0, UC_2_D_HEIGHT, UC_2_WIDTH}, + {0, UC_2_E_HEIGHT, UC_2_WIDTH}}; /* Maximum size of datasets, both source and VDS */ -static hsize_t UC_2_MAX_DIMS[UC_2_N_SOURCES][RANK] = { - {UC_2_N_MAX_PLANES, UC_2_A_HEIGHT, UC_2_WIDTH}, - {UC_2_N_MAX_PLANES, UC_2_B_HEIGHT, UC_2_WIDTH}, - {UC_2_N_MAX_PLANES, UC_2_C_HEIGHT, UC_2_WIDTH}, - {UC_2_N_MAX_PLANES, UC_2_D_HEIGHT, UC_2_WIDTH}, - {UC_2_N_MAX_PLANES, UC_2_E_HEIGHT, UC_2_WIDTH} -}; +static hsize_t UC_2_MAX_DIMS[UC_2_N_SOURCES][RANK] = {{UC_2_N_MAX_PLANES, UC_2_A_HEIGHT, UC_2_WIDTH}, + {UC_2_N_MAX_PLANES, UC_2_B_HEIGHT, UC_2_WIDTH}, + {UC_2_N_MAX_PLANES, UC_2_C_HEIGHT, UC_2_WIDTH}, + {UC_2_N_MAX_PLANES, UC_2_D_HEIGHT, UC_2_WIDTH}, + {UC_2_N_MAX_PLANES, UC_2_E_HEIGHT, UC_2_WIDTH}}; /* File names for source datasets */ static char UC_2_FILE_NAMES[UC_2_N_SOURCES][NAME_LEN] = { - {"2_a.h5"}, - {"2_b.h5"}, - {"2_c.h5"}, - {"2_d.h5"}, - {"2_e.h5"} -}; + {"2_a.h5"}, {"2_b.h5"}, {"2_c.h5"}, {"2_d.h5"}, {"2_e.h5"}}; /* VDS file name */ -#define UC_2_VDS_FILE_NAME "2_vds.h5" +#define UC_2_VDS_FILE_NAME "2_vds.h5" /* Dataset names */ -#define UC_2_SOURCE_DSET_NAME "source_dset" -#define UC_2_SOURCE_DSET_PATH "/source_dset" -#define UC_2_VDS_DSET_NAME "vds_dset" +#define UC_2_SOURCE_DSET_NAME "source_dset" +#define UC_2_SOURCE_DSET_PATH "/source_dset" +#define UC_2_VDS_DSET_NAME "vds_dset" #endif /* UC_2_H */ - diff --git a/tools/test/misc/vds/UC_2_two_dims_gen.c b/tools/test/misc/vds/UC_2_two_dims_gen.c index b9799d6..85bd63d 100644 --- a/tools/test/misc/vds/UC_2_two_dims_gen.c +++ b/tools/test/misc/vds/UC_2_two_dims_gen.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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -17,7 +17,6 @@ * See the header file for a description. */ - #include <stdlib.h> #include "hdf5.h" @@ -25,72 +24,60 @@ #include "UC_common.h" #include "UC_2.h" -static hsize_t UC_2_VDS_DIMS[RANK] = {0, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH}; -static hsize_t UC_2_VDS_MAX_DIMS[RANK] = {UC_2_N_MAX_PLANES, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH}; +static hsize_t UC_2_VDS_DIMS[RANK] = {0, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH}; +static hsize_t UC_2_VDS_MAX_DIMS[RANK] = {UC_2_N_MAX_PLANES, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH}; /* Positions of source datasets in the VDS */ static hsize_t UC_2_POSITIONS[UC_2_N_SOURCES][RANK] = { - /* A */ {0, 0, 0}, - /* B */ {0, UC_2_A_HEIGHT, 0}, + /* A */ {0, 0, 0}, + /* B */ {0, UC_2_A_HEIGHT, 0}, /* C */ {0, UC_2_AB_HEIGHT, 0}, - /* D */ {0, 0, UC_2_WIDTH}, - /* E */ {0, UC_2_D_HEIGHT, UC_2_WIDTH} -}; + /* D */ {0, 0, UC_2_WIDTH}, + /* E */ {0, UC_2_D_HEIGHT, UC_2_WIDTH}}; /* Planes */ -static hsize_t UC_2_PLANES[UC_2_N_SOURCES][RANK] = { - {1, UC_2_A_HEIGHT, UC_2_WIDTH}, - {1, UC_2_B_HEIGHT, UC_2_WIDTH}, - {1, UC_2_C_HEIGHT, UC_2_WIDTH}, - {1, UC_2_D_HEIGHT, UC_2_WIDTH}, - {1, UC_2_E_HEIGHT, UC_2_WIDTH} -}; +static hsize_t UC_2_PLANES[UC_2_N_SOURCES][RANK] = {{1, UC_2_A_HEIGHT, UC_2_WIDTH}, + {1, UC_2_B_HEIGHT, UC_2_WIDTH}, + {1, UC_2_C_HEIGHT, UC_2_WIDTH}, + {1, UC_2_D_HEIGHT, UC_2_WIDTH}, + {1, UC_2_E_HEIGHT, UC_2_WIDTH}}; /* Chunk dimensions */ -static hsize_t UC_2_CHUNK_DIMS[UC_2_N_SOURCES][RANK] = { - {UC_2_N_PLANES_IN_SERIES, UC_2_A_HEIGHT, UC_2_WIDTH}, - {UC_2_N_PLANES_IN_SERIES, UC_2_B_HEIGHT, UC_2_WIDTH}, - {UC_2_N_PLANES_IN_SERIES, UC_2_C_HEIGHT, UC_2_WIDTH}, - {UC_2_N_PLANES_IN_SERIES, UC_2_D_HEIGHT, UC_2_WIDTH}, - {UC_2_N_PLANES_IN_SERIES, UC_2_E_HEIGHT, UC_2_WIDTH} -}; +static hsize_t UC_2_CHUNK_DIMS[UC_2_N_SOURCES][RANK] = {{UC_2_N_PLANES_IN_SERIES, UC_2_A_HEIGHT, UC_2_WIDTH}, + {UC_2_N_PLANES_IN_SERIES, UC_2_B_HEIGHT, UC_2_WIDTH}, + {UC_2_N_PLANES_IN_SERIES, UC_2_C_HEIGHT, UC_2_WIDTH}, + {UC_2_N_PLANES_IN_SERIES, UC_2_D_HEIGHT, UC_2_WIDTH}, + {UC_2_N_PLANES_IN_SERIES, UC_2_E_HEIGHT, UC_2_WIDTH}}; /* Fill values */ -static int UC_2_FILL_VALUES[UC_2_N_SOURCES] = { - -1, - -2, - -3, - -4, - -5 -}; -static int UC_2_VDS_FILL_VALUE = -9; +static int UC_2_FILL_VALUES[UC_2_N_SOURCES] = {-1, -2, -3, -4, -5}; +static int UC_2_VDS_FILL_VALUE = -9; int main(void) { - hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ - hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */ - - hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ - hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ + hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ + hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */ - hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ - hid_t did = H5I_INVALID_HID; /* dataset ID */ - hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */ - hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */ + hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ + hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ - hsize_t start[RANK]; /* starting point for hyperslab */ - hsize_t extent[RANK]; /* dataset extents */ + hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ + hid_t did = H5I_INVALID_HID; /* dataset ID */ + hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */ + hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */ - int *buffer = NULL; /* data buffer */ - int value = -1; /* value written to datasets */ - hsize_t count = 0; /* number of elements in a plane */ - int n_planes = -1; /* number of planes to write */ + hsize_t start[RANK]; /* starting point for hyperslab */ + hsize_t extent[RANK]; /* dataset extents */ - int i; /* iterator */ - int j; /* iterator */ - hsize_t k; /* iterator */ + int * buffer = NULL; /* data buffer */ + int value = -1; /* value written to datasets */ + hsize_t count = 0; /* number of elements in a plane */ + int n_planes = -1; /* number of planes to write */ + int i; /* iterator */ + int j; /* iterator */ + hsize_t k; /* iterator */ /* Start by creating the virtual dataset (VDS) dataspace and creation * property list. The individual source datasets are then created @@ -98,15 +85,13 @@ main(void) */ /* Create VDS dcpl */ - if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) UC_ERROR - if(H5Pset_fill_value(vds_dcplid, UC_2_VDS_DATATYPE, - &UC_2_VDS_FILL_VALUE) < 0) + if (H5Pset_fill_value(vds_dcplid, UC_2_VDS_DATATYPE, &UC_2_VDS_FILL_VALUE) < 0) UC_ERROR /* Create VDS dataspace */ - if((vds_sid = H5Screate_simple(RANK, UC_2_VDS_DIMS, - UC_2_VDS_MAX_DIMS)) < 0) + if ((vds_sid = H5Screate_simple(RANK, UC_2_VDS_DIMS, UC_2_VDS_MAX_DIMS)) < 0) UC_ERROR /************************************ @@ -117,65 +102,61 @@ main(void) start[1] = 0; start[2] = 0; - for(i = 0; i < UC_2_N_SOURCES; i++) { + for (i = 0; i < UC_2_N_SOURCES; i++) { /* source dataset dcpl */ - if((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) UC_ERROR - if(H5Pset_chunk(src_dcplid, RANK, UC_2_CHUNK_DIMS[i]) < 0) + if (H5Pset_chunk(src_dcplid, RANK, UC_2_CHUNK_DIMS[i]) < 0) UC_ERROR - if(H5Pset_fill_value(src_dcplid, UC_2_SOURCE_DATATYPE, - &UC_2_FILL_VALUES[i]) < 0) + if (H5Pset_fill_value(src_dcplid, UC_2_SOURCE_DATATYPE, &UC_2_FILL_VALUES[i]) < 0) UC_ERROR - if(H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0) + if (H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0) UC_ERROR /* Create source file, dataspace, and dataset */ - if((fid = H5Fcreate(UC_2_FILE_NAMES[i], H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(UC_2_FILE_NAMES[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) UC_ERROR - if((src_sid = H5Screate_simple(RANK, UC_2_DIMS[i], - UC_2_MAX_DIMS[i])) < 0) + if ((src_sid = H5Screate_simple(RANK, UC_2_DIMS[i], UC_2_MAX_DIMS[i])) < 0) UC_ERROR - if((did = H5Dcreate2(fid, UC_2_SOURCE_DSET_NAME, - UC_2_SOURCE_DATATYPE, src_sid, - H5P_DEFAULT, src_dcplid, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, UC_2_SOURCE_DSET_NAME, UC_2_SOURCE_DATATYPE, src_sid, H5P_DEFAULT, + src_dcplid, H5P_DEFAULT)) < 0) UC_ERROR /* Set the dataset's extent (will eventually vary with i) */ extent[0] = UC_2_N_TEST_PLANES; extent[1] = UC_2_PLANES[i][1]; extent[2] = UC_2_PLANES[i][2]; - if(H5Dset_extent(did, extent) < 0) + if (H5Dset_extent(did, extent) < 0) UC_ERROR /* Create a data buffer that represents a plane */ count = UC_2_PLANES[i][1] * UC_2_PLANES[i][2]; - if(NULL == (buffer = (int *)malloc(count * sizeof(int)))) + if (NULL == (buffer = (int *)malloc(count * sizeof(int)))) UC_ERROR /* Create the memory dataspace */ - if((msid = H5Screate_simple(RANK, UC_2_PLANES[i], NULL)) < 0) + if ((msid = H5Screate_simple(RANK, UC_2_PLANES[i], NULL)) < 0) UC_ERROR /* Get the file dataspace */ - if((fsid = H5Dget_space(did)) < 0) + if ((fsid = H5Dget_space(did)) < 0) UC_ERROR /* Write planes to the dataset, number will eventually vary with i */ n_planes = UC_2_N_TEST_PLANES; - for(j = 0; j < n_planes; j++) { + for (j = 0; j < n_planes; j++) { value = ((i + 1) * 10) + j; - for(k = 0; k < count; k++) - buffer[k] = value; + for (k = 0; k < count; k++) + buffer[k] = value; start[0] = (hsize_t)j; start[1] = 0; start[2] = 0; - if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_2_PLANES[i], NULL) < 0) + if (H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_2_PLANES[i], NULL) < 0) UC_ERROR - if(H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0) + if (H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0) UC_ERROR } /* end for */ @@ -184,30 +165,27 @@ main(void) start[0] = 0; start[1] = 0; start[2] = 0; - if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, - UC_2_MAX_DIMS[i], NULL) < 0) + if (H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, UC_2_MAX_DIMS[i], NULL) < 0) UC_ERROR - if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, UC_2_POSITIONS[i], NULL, - UC_2_MAX_DIMS[i], NULL) < 0) + if (H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, UC_2_POSITIONS[i], NULL, UC_2_MAX_DIMS[i], NULL) < 0) UC_ERROR /* Add VDS mapping */ - if(H5Pset_virtual(vds_dcplid, vds_sid, UC_2_FILE_NAMES[i], - UC_2_SOURCE_DSET_PATH, src_sid) < 0) + if (H5Pset_virtual(vds_dcplid, vds_sid, UC_2_FILE_NAMES[i], UC_2_SOURCE_DSET_PATH, src_sid) < 0) UC_ERROR /* close */ - if(H5Sclose(msid) < 0) + if (H5Sclose(msid) < 0) UC_ERROR - if(H5Sclose(fsid) < 0) + if (H5Sclose(fsid) < 0) UC_ERROR - if(H5Sclose(src_sid) < 0) + if (H5Sclose(src_sid) < 0) UC_ERROR - if(H5Pclose(src_dcplid) < 0) + if (H5Pclose(src_dcplid) < 0) UC_ERROR - if(H5Dclose(did) < 0) + if (H5Dclose(did) < 0) UC_ERROR - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) UC_ERROR free(buffer); @@ -218,51 +196,51 @@ main(void) *******************************/ /* file */ - if((fid = H5Fcreate(UC_2_VDS_FILE_NAME, H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(UC_2_VDS_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) UC_ERROR /* dataset */ - if((did = H5Dcreate2(fid, UC_2_VDS_DSET_NAME, UC_2_VDS_DATATYPE, vds_sid, - H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, UC_2_VDS_DSET_NAME, UC_2_VDS_DATATYPE, vds_sid, H5P_DEFAULT, vds_dcplid, + H5P_DEFAULT)) < 0) UC_ERROR /* close */ - if(H5Pclose(vds_dcplid) < 0) + if (H5Pclose(vds_dcplid) < 0) UC_ERROR - if(H5Sclose(vds_sid) < 0) + if (H5Sclose(vds_sid) < 0) UC_ERROR - if(H5Dclose(did) < 0) + if (H5Dclose(did) < 0) UC_ERROR - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) UC_ERROR return EXIT_SUCCESS; error: - H5E_BEGIN_TRY { - if(src_sid >= 0) + H5E_BEGIN_TRY + { + if (src_sid >= 0) (void)H5Sclose(src_sid); - if(src_dcplid >= 0) + if (src_dcplid >= 0) (void)H5Pclose(src_dcplid); - if(vds_sid >= 0) + if (vds_sid >= 0) (void)H5Sclose(vds_sid); - if(vds_dcplid >= 0) + if (vds_dcplid >= 0) (void)H5Pclose(vds_dcplid); - if(fid >= 0) + if (fid >= 0) (void)H5Fclose(fid); - if(did >= 0) + if (did >= 0) (void)H5Dclose(did); - if(msid >= 0) + if (msid >= 0) (void)H5Sclose(msid); - if(fsid >= 0) + if (fsid >= 0) (void)H5Sclose(fsid); - if(buffer != NULL) + if (buffer != NULL) free(buffer); - } H5E_END_TRY + } + H5E_END_TRY return EXIT_FAILURE; } /* end main() */ - diff --git a/tools/test/misc/vds/UC_3.h b/tools/test/misc/vds/UC_3.h index 0c26dfb..f7e84eb 100644 --- a/tools/test/misc/vds/UC_3.h +++ b/tools/test/misc/vds/UC_3.h @@ -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,42 +31,40 @@ * Height and width are large enough to encompass the * mapped source datasets with gaps. */ -#define UC_31_VDS_HEIGHT 25 /* full height + 7 (gaps of 1) */ -#define UC_31_VDS_WIDTH 8 /* full width + 0 (no gaps) */ -#define UC_32_VDS_HEIGHT 13 /* full height + 5 */ -#define UC_32_VDS_WIDTH 19 /* full width + 5 */ -#define UC_31_GAP 1 +#define UC_31_VDS_HEIGHT 25 /* full height + 7 (gaps of 1) */ +#define UC_31_VDS_WIDTH 8 /* full width + 0 (no gaps) */ +#define UC_32_VDS_HEIGHT 13 /* full height + 5 */ +#define UC_32_VDS_WIDTH 19 /* full width + 5 */ +#define UC_31_GAP 1 /* VDS datatypes */ -#define UC_31_VDS_DATATYPE H5T_STD_I32LE -#define UC_32_VDS_DATATYPE H5T_STD_I32LE +#define UC_31_VDS_DATATYPE H5T_STD_I32LE +#define UC_32_VDS_DATATYPE H5T_STD_I32LE /* Starting size of virtual datasets */ -static hsize_t UC_31_VDS_DIMS[RANK] = {0, UC_31_VDS_HEIGHT, UC_31_VDS_WIDTH}; -static hsize_t UC_32_VDS_DIMS[RANK] = {0, UC_32_VDS_HEIGHT, UC_32_VDS_WIDTH}; +static hsize_t UC_31_VDS_DIMS[RANK] = {0, UC_31_VDS_HEIGHT, UC_31_VDS_WIDTH}; +static hsize_t UC_32_VDS_DIMS[RANK] = {0, UC_32_VDS_HEIGHT, UC_32_VDS_WIDTH}; /* Maximum size of virtual datasets */ -static hsize_t UC_31_VDS_MAX_DIMS[RANK] = {UC_1_N_MAX_PLANES, UC_31_VDS_HEIGHT, UC_31_VDS_WIDTH}; -static hsize_t UC_32_VDS_MAX_DIMS[RANK] = {UC_2_N_MAX_PLANES, UC_32_VDS_HEIGHT, UC_32_VDS_WIDTH}; +static hsize_t UC_31_VDS_MAX_DIMS[RANK] = {UC_1_N_MAX_PLANES, UC_31_VDS_HEIGHT, UC_31_VDS_WIDTH}; +static hsize_t UC_32_VDS_MAX_DIMS[RANK] = {UC_2_N_MAX_PLANES, UC_32_VDS_HEIGHT, UC_32_VDS_WIDTH}; /* Positions of mapped source datasets */ static hsize_t UC_32_POSITIONS[UC_2_N_SOURCES][RANK] = { - /* A */ {0, 1, 1}, - /* B */ {0, 4, 0}, - /* C */ {0, 11, 4}, - /* D */ {0, 1, 9}, - /* E */ {0, 8, 12} -}; + /* A */ {0, 1, 1}, + /* B */ {0, 4, 0}, + /* C */ {0, 11, 4}, + /* D */ {0, 1, 9}, + /* E */ {0, 8, 12}}; /* VDS file names */ -#define UC_31_VDS_FILE_NAME "3_1_vds.h5" -#define UC_32_VDS_FILE_NAME "3_2_vds.h5" +#define UC_31_VDS_FILE_NAME "3_1_vds.h5" +#define UC_32_VDS_FILE_NAME "3_2_vds.h5" /* Dataset name */ -#define UC_3_VDS_DSET_NAME "vds_dset" +#define UC_3_VDS_DSET_NAME "vds_dset" /* Fill value */ -static int UC_3_VDS_FILL_VALUE = -9; +static int UC_3_VDS_FILL_VALUE = -9; #endif /* UC_3_H */ - diff --git a/tools/test/misc/vds/UC_3_gaps_gen.c b/tools/test/misc/vds/UC_3_gaps_gen.c index 74a23dc..e6e311a 100644 --- a/tools/test/misc/vds/UC_3_gaps_gen.c +++ b/tools/test/misc/vds/UC_3_gaps_gen.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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -29,28 +29,26 @@ static herr_t create_3_1_vds(void) { - hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ - hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ - hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ + hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ + hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ + hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ - hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ - hid_t did = H5I_INVALID_HID; /* dataset ID */ + hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ + hid_t did = H5I_INVALID_HID; /* dataset ID */ - hsize_t start[RANK]; /* source starting point for hyperslab */ - hsize_t position[RANK]; /* vds mapping positions */ + hsize_t start[RANK]; /* source starting point for hyperslab */ + hsize_t position[RANK]; /* vds mapping positions */ - int i; /* iterator */ + int i; /* iterator */ /* Create VDS dcpl */ - if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) UC_ERROR - if(H5Pset_fill_value(vds_dcplid, UC_31_VDS_DATATYPE, - &UC_3_VDS_FILL_VALUE) < 0) + if (H5Pset_fill_value(vds_dcplid, UC_31_VDS_DATATYPE, &UC_3_VDS_FILL_VALUE) < 0) UC_ERROR /* Create VDS dataspace */ - if((vds_sid = H5Screate_simple(RANK, UC_31_VDS_DIMS, - UC_31_VDS_MAX_DIMS)) < 0) + if ((vds_sid = H5Screate_simple(RANK, UC_31_VDS_DIMS, UC_31_VDS_MAX_DIMS)) < 0) UC_ERROR /* Set starting positions */ @@ -65,26 +63,22 @@ create_3_1_vds(void) /****************************** * Create source-VDS mappings * ******************************/ - for(i = 0; i < UC_1_N_SOURCES; i++) { + for (i = 0; i < UC_1_N_SOURCES; i++) { - if((src_sid = H5Screate_simple(RANK, UC_1_DIMS[i], - UC_1_MAX_DIMS[i])) < 0) - UC_ERROR + if ((src_sid = H5Screate_simple(RANK, UC_1_DIMS[i], UC_1_MAX_DIMS[i])) < 0) + UC_ERROR /* set up hyperslabs for source and destination datasets */ - if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, - UC_1_MAX_DIMS[i], NULL) < 0) + if (H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, UC_1_MAX_DIMS[i], NULL) < 0) UC_ERROR - if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, position, - NULL, UC_1_MAX_DIMS[i], NULL) < 0) + if (H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, position, NULL, UC_1_MAX_DIMS[i], NULL) < 0) UC_ERROR position[1] += UC_1_DIMS[i][1] + UC_31_GAP; /* Add VDS mapping */ - if(H5Pset_virtual(vds_dcplid, vds_sid, UC_1_FILE_NAMES[i], - UC_1_SOURCE_DSET_PATH, src_sid) < 0) + if (H5Pset_virtual(vds_dcplid, vds_sid, UC_1_FILE_NAMES[i], UC_1_SOURCE_DSET_PATH, src_sid) < 0) UC_ERROR - if(H5Sclose(src_sid) < 0) + if (H5Sclose(src_sid) < 0) UC_ERROR } /* end for */ @@ -94,39 +88,40 @@ create_3_1_vds(void) *******************************/ /* file */ - if((fid = H5Fcreate(UC_31_VDS_FILE_NAME, H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(UC_31_VDS_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) UC_ERROR /* dataset */ - if((did = H5Dcreate2(fid, UC_3_VDS_DSET_NAME, UC_31_VDS_DATATYPE, vds_sid, - H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, UC_3_VDS_DSET_NAME, UC_31_VDS_DATATYPE, vds_sid, H5P_DEFAULT, vds_dcplid, + H5P_DEFAULT)) < 0) UC_ERROR /* close */ - if(H5Pclose(vds_dcplid) < 0) + if (H5Pclose(vds_dcplid) < 0) UC_ERROR - if(H5Sclose(vds_sid) < 0) + if (H5Sclose(vds_sid) < 0) UC_ERROR - if(H5Dclose(did) < 0) + if (H5Dclose(did) < 0) UC_ERROR - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) UC_ERROR return 0; error: - H5E_BEGIN_TRY { - if(vds_sid >= 0) + H5E_BEGIN_TRY + { + if (vds_sid >= 0) (void)H5Sclose(vds_sid); - if(vds_dcplid >= 0) + if (vds_dcplid >= 0) (void)H5Pclose(vds_dcplid); - if(fid >= 0) + if (fid >= 0) (void)H5Fclose(fid); - if(did >= 0) + if (did >= 0) (void)H5Dclose(did); - } H5E_END_TRY + } + H5E_END_TRY return -1; @@ -136,27 +131,25 @@ error: static herr_t create_3_2_vds(void) { - hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ - hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ - hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ + hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ + hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ + hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ - hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ - hid_t did = H5I_INVALID_HID; /* dataset ID */ + hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ + hid_t did = H5I_INVALID_HID; /* dataset ID */ - hsize_t start[RANK]; /* source starting point for hyperslab */ + hsize_t start[RANK]; /* source starting point for hyperslab */ - int i; /* iterator */ + int i; /* iterator */ /* Create VDS dcpl */ - if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) UC_ERROR - if(H5Pset_fill_value(vds_dcplid, UC_32_VDS_DATATYPE, - &UC_3_VDS_FILL_VALUE) < 0) + if (H5Pset_fill_value(vds_dcplid, UC_32_VDS_DATATYPE, &UC_3_VDS_FILL_VALUE) < 0) UC_ERROR /* Create VDS dataspace */ - if((vds_sid = H5Screate_simple(RANK, UC_32_VDS_DIMS, - UC_32_VDS_MAX_DIMS)) < 0) + if ((vds_sid = H5Screate_simple(RANK, UC_32_VDS_DIMS, UC_32_VDS_MAX_DIMS)) < 0) UC_ERROR /* Set starting positions */ @@ -167,25 +160,22 @@ create_3_2_vds(void) /****************************** * Create source-VDS mappings * ******************************/ - for(i = 0; i < UC_2_N_SOURCES; i++) { + for (i = 0; i < UC_2_N_SOURCES; i++) { - if((src_sid = H5Screate_simple(RANK, UC_2_DIMS[i], - UC_2_MAX_DIMS[i])) < 0) - UC_ERROR + if ((src_sid = H5Screate_simple(RANK, UC_2_DIMS[i], UC_2_MAX_DIMS[i])) < 0) + UC_ERROR /* set up hyperslabs for source and destination datasets */ - if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, - UC_2_MAX_DIMS[i], NULL) < 0) + if (H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, UC_2_MAX_DIMS[i], NULL) < 0) UC_ERROR - if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, UC_32_POSITIONS[i], - NULL, UC_2_MAX_DIMS[i], NULL) < 0) + if (H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, UC_32_POSITIONS[i], NULL, UC_2_MAX_DIMS[i], NULL) < + 0) UC_ERROR /* Add VDS mapping */ - if(H5Pset_virtual(vds_dcplid, vds_sid, UC_2_FILE_NAMES[i], - UC_2_SOURCE_DSET_PATH, src_sid) < 0) + if (H5Pset_virtual(vds_dcplid, vds_sid, UC_2_FILE_NAMES[i], UC_2_SOURCE_DSET_PATH, src_sid) < 0) UC_ERROR - if(H5Sclose(src_sid) < 0) + if (H5Sclose(src_sid) < 0) UC_ERROR } /* end for */ @@ -195,39 +185,40 @@ create_3_2_vds(void) *******************************/ /* file */ - if((fid = H5Fcreate(UC_32_VDS_FILE_NAME, H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(UC_32_VDS_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) UC_ERROR /* dataset */ - if((did = H5Dcreate2(fid, UC_3_VDS_DSET_NAME, UC_32_VDS_DATATYPE, vds_sid, - H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, UC_3_VDS_DSET_NAME, UC_32_VDS_DATATYPE, vds_sid, H5P_DEFAULT, vds_dcplid, + H5P_DEFAULT)) < 0) UC_ERROR /* close */ - if(H5Pclose(vds_dcplid) < 0) + if (H5Pclose(vds_dcplid) < 0) UC_ERROR - if(H5Sclose(vds_sid) < 0) + if (H5Sclose(vds_sid) < 0) UC_ERROR - if(H5Dclose(did) < 0) + if (H5Dclose(did) < 0) UC_ERROR - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) UC_ERROR return 0; error: - H5E_BEGIN_TRY { - if(vds_sid >= 0) + H5E_BEGIN_TRY + { + if (vds_sid >= 0) (void)H5Sclose(vds_sid); - if(vds_dcplid >= 0) + if (vds_dcplid >= 0) (void)H5Pclose(vds_dcplid); - if(fid >= 0) + if (fid >= 0) (void)H5Fclose(fid); - if(did >= 0) + if (did >= 0) (void)H5Dclose(did); - } H5E_END_TRY + } + H5E_END_TRY return -1; @@ -237,10 +228,10 @@ int main(void) { - if(create_3_1_vds() < 0) + if (create_3_1_vds() < 0) UC_ERROR - if(create_3_2_vds() < 0) + if (create_3_2_vds() < 0) UC_ERROR return EXIT_SUCCESS; @@ -250,4 +241,3 @@ error: return EXIT_FAILURE; } /* end main() */ - diff --git a/tools/test/misc/vds/UC_4.h b/tools/test/misc/vds/UC_4.h index 5dba4fb..9efd077 100644 --- a/tools/test/misc/vds/UC_4.h +++ b/tools/test/misc/vds/UC_4.h @@ -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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -29,39 +29,35 @@ /* virtual dataset <---> source dataset mapping and sizes */ -#define UC_4_N_SOURCES 3 +#define UC_4_N_SOURCES 3 /* Dataset dimensions */ -#define UC_4_SRC_PLANES 3 -#define UC_4_HEIGHT 4 -#define UC_4_WIDTH 4 +#define UC_4_SRC_PLANES 3 +#define UC_4_HEIGHT 4 +#define UC_4_WIDTH 4 /* max number of planes for VDS (sources are finite) */ -#define UC_4_VDS_MAX_PLANES H5S_UNLIMITED -#define UC_4_N_TEST_PLANES 9 /* number of planes in the VDS */ +#define UC_4_VDS_MAX_PLANES H5S_UNLIMITED +#define UC_4_N_TEST_PLANES 9 /* number of planes in the VDS */ /* Dataset datatypes */ -#define UC_4_SOURCE_DATATYPE H5T_STD_I32LE -#define UC_4_VDS_DATATYPE H5T_STD_I32LE +#define UC_4_SOURCE_DATATYPE H5T_STD_I32LE +#define UC_4_VDS_DATATYPE H5T_STD_I32LE /* Starting size of datasets, both source and VDS */ static hsize_t UC_4_SOURCE_DIMS[RANK] = {0, UC_4_HEIGHT, UC_4_WIDTH}; -static hsize_t UC_4_VDS_DIMS[RANK] = {0, UC_4_HEIGHT, UC_4_WIDTH}; +static hsize_t UC_4_VDS_DIMS[RANK] = {0, UC_4_HEIGHT, UC_4_WIDTH}; /* Max size of datasets, both source and VDS */ static hsize_t UC_4_SOURCE_MAX_DIMS[RANK] = {UC_4_SRC_PLANES, UC_4_HEIGHT, UC_4_WIDTH}; -static hsize_t UC_4_VDS_MAX_DIMS[RANK] = {UC_4_VDS_MAX_PLANES, UC_4_HEIGHT, UC_4_WIDTH}; +static hsize_t UC_4_VDS_MAX_DIMS[RANK] = {UC_4_VDS_MAX_PLANES, UC_4_HEIGHT, UC_4_WIDTH}; /* Planes (both source and VDS) */ static hsize_t UC_4_PLANE[RANK] = {1, UC_4_HEIGHT, UC_4_WIDTH}; /* File names for source datasets */ -static char UC_4_FILE_NAMES[UC_4_N_SOURCES][NAME_LEN] = { - {"4_0.h5"}, - {"4_1.h5"}, - {"4_2.h5"} -}; -static char UC_4_MAPPING_FILE_NAME[NAME_LEN] = "4_%b.h5"; +static char UC_4_FILE_NAMES[UC_4_N_SOURCES][NAME_LEN] = {{"4_0.h5"}, {"4_1.h5"}, {"4_2.h5"}}; +static char UC_4_MAPPING_FILE_NAME[NAME_LEN] = "4_%b.h5"; /* VDS file name */ static char UC_4_VDS_FILE_NAME[NAME_LEN] = "4_vds.h5"; @@ -72,13 +68,7 @@ static char UC_4_SOURCE_DSET_PATH[NAME_LEN] = "/source_dset"; static char UC_4_VDS_DSET_NAME[NAME_LEN] = "vds_dset"; /* Fill values */ -static int UC_4_FILL_VALUES[UC_4_N_SOURCES] = { - -1, - -2, - -3 -}; -static int UC_4_VDS_FILL_VALUE = -9; +static int UC_4_FILL_VALUES[UC_4_N_SOURCES] = {-1, -2, -3}; +static int UC_4_VDS_FILL_VALUE = -9; #endif /* UC_4_H */ - - diff --git a/tools/test/misc/vds/UC_4_printf_gen.c b/tools/test/misc/vds/UC_4_printf_gen.c index 24451e9..206e1f3 100644 --- a/tools/test/misc/vds/UC_4_printf_gen.c +++ b/tools/test/misc/vds/UC_4_printf_gen.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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -27,109 +27,104 @@ int main(void) { - hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ - hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */ + hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ + hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */ - hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ - hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ + hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ + hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ - hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ - hid_t did = H5I_INVALID_HID; /* dataset ID */ - hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */ - hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */ + hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ + hid_t did = H5I_INVALID_HID; /* dataset ID */ + hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */ + hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */ /* Hyperslab arrays */ hsize_t start[RANK] = {0, 0, 0}; hsize_t count[RANK] = {H5S_UNLIMITED, 1, 1}; - int *buffer = NULL; /* data buffer */ - int value = -1; /* value written to datasets */ + int *buffer = NULL; /* data buffer */ + int value = -1; /* value written to datasets */ - hsize_t n = 0; /* number of elements in a plane */ + hsize_t n = 0; /* number of elements in a plane */ - int i; /* iterator */ - int j; /* iterator */ - hsize_t k; /* iterator */ + int i; /* iterator */ + int j; /* iterator */ + hsize_t k; /* iterator */ /************************************ * Create source files and datasets * ************************************/ /* Create source dataspace ID */ - if((src_sid = H5Screate_simple(RANK, UC_4_SOURCE_DIMS, - UC_4_SOURCE_MAX_DIMS)) < 0) + if ((src_sid = H5Screate_simple(RANK, UC_4_SOURCE_DIMS, UC_4_SOURCE_MAX_DIMS)) < 0) UC_ERROR - if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, - UC_4_SOURCE_MAX_DIMS, NULL) < 0) + if (H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, UC_4_SOURCE_MAX_DIMS, NULL) < 0) UC_ERROR /* Create source files and datasets */ - for(i = 0; i < UC_4_N_SOURCES; i++) { + for (i = 0; i < UC_4_N_SOURCES; i++) { /* source dataset dcpl */ - if((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) UC_ERROR - if(H5Pset_chunk(src_dcplid, RANK, UC_4_PLANE) < 0) + if (H5Pset_chunk(src_dcplid, RANK, UC_4_PLANE) < 0) UC_ERROR - if(H5Pset_fill_value(src_dcplid, UC_4_SOURCE_DATATYPE, - &UC_4_FILL_VALUES[i]) < 0) + if (H5Pset_fill_value(src_dcplid, UC_4_SOURCE_DATATYPE, &UC_4_FILL_VALUES[i]) < 0) UC_ERROR - if(H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0) + if (H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0) UC_ERROR /* Create source file and dataset */ - if((fid = H5Fcreate(UC_4_FILE_NAMES[i], H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(UC_4_FILE_NAMES[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) UC_ERROR - if((did = H5Dcreate2(fid, UC_4_SOURCE_DSET_NAME, - UC_4_SOURCE_DATATYPE, src_sid, - H5P_DEFAULT, src_dcplid, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, UC_4_SOURCE_DSET_NAME, UC_4_SOURCE_DATATYPE, src_sid, H5P_DEFAULT, + src_dcplid, H5P_DEFAULT)) < 0) UC_ERROR /* Set the dataset's extent */ - if(H5Dset_extent(did, UC_4_SOURCE_MAX_DIMS) < 0) + if (H5Dset_extent(did, UC_4_SOURCE_MAX_DIMS) < 0) UC_ERROR /* Create a data buffer that represents a plane */ n = UC_4_PLANE[1] * UC_4_PLANE[2]; - if(NULL == (buffer = (int *)malloc(n * sizeof(int)))) + if (NULL == (buffer = (int *)malloc(n * sizeof(int)))) UC_ERROR /* Create the memory dataspace */ - if((msid = H5Screate_simple(RANK, UC_4_PLANE, NULL)) < 0) + if ((msid = H5Screate_simple(RANK, UC_4_PLANE, NULL)) < 0) UC_ERROR /* Get the file dataspace */ - if((fsid = H5Dget_space(did)) < 0) + if ((fsid = H5Dget_space(did)) < 0) UC_ERROR /* Write planes to the dataset */ - for(j = 0; j < UC_4_SRC_PLANES; j++) { + for (j = 0; j < UC_4_SRC_PLANES; j++) { value = ((i + 1) * 10) + j; - for(k = 0; k < n; k++) - buffer[k] = value; + for (k = 0; k < n; k++) + buffer[k] = value; start[0] = (hsize_t)j; start[1] = 0; start[2] = 0; - if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_4_PLANE, NULL) < 0) + if (H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_4_PLANE, NULL) < 0) UC_ERROR - if(H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0) + if (H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0) UC_ERROR } /* end for */ /* close */ - if(H5Sclose(msid) < 0) + if (H5Sclose(msid) < 0) UC_ERROR - if(H5Sclose(fsid) < 0) + if (H5Sclose(fsid) < 0) UC_ERROR - if(H5Pclose(src_dcplid) < 0) + if (H5Pclose(src_dcplid) < 0) UC_ERROR - if(H5Dclose(did) < 0) + if (H5Dclose(did) < 0) UC_ERROR - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) UC_ERROR free(buffer); @@ -140,78 +135,75 @@ main(void) *******************/ /* Create file */ - if((fid = H5Fcreate(UC_4_VDS_FILE_NAME, H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(UC_4_VDS_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) UC_ERROR /* Create VDS dcpl */ - if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) UC_ERROR - if(H5Pset_fill_value(vds_dcplid, UC_4_VDS_DATATYPE, - &UC_4_VDS_FILL_VALUE) < 0) + if (H5Pset_fill_value(vds_dcplid, UC_4_VDS_DATATYPE, &UC_4_VDS_FILL_VALUE) < 0) UC_ERROR /* Create VDS dataspace */ - if((vds_sid = H5Screate_simple(RANK, UC_4_VDS_DIMS, - UC_4_VDS_MAX_DIMS)) < 0) + if ((vds_sid = H5Screate_simple(RANK, UC_4_VDS_DIMS, UC_4_VDS_MAX_DIMS)) < 0) UC_ERROR start[0] = 0; start[1] = 0; start[2] = 0; - if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, - UC_4_SOURCE_MAX_DIMS, count, UC_4_SOURCE_MAX_DIMS) < 0) + if (H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, UC_4_SOURCE_MAX_DIMS, count, + UC_4_SOURCE_MAX_DIMS) < 0) UC_ERROR /* Add VDS mapping - The mapped file name uses a printf-like * naming scheme that automatically maps new files. */ - if(H5Pset_virtual(vds_dcplid, vds_sid, UC_4_MAPPING_FILE_NAME, - UC_4_SOURCE_DSET_PATH, src_sid) < 0) + if (H5Pset_virtual(vds_dcplid, vds_sid, UC_4_MAPPING_FILE_NAME, UC_4_SOURCE_DSET_PATH, src_sid) < 0) UC_ERROR /* Create dataset */ - if((did = H5Dcreate2(fid, UC_4_VDS_DSET_NAME, UC_4_VDS_DATATYPE, vds_sid, - H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, UC_4_VDS_DSET_NAME, UC_4_VDS_DATATYPE, vds_sid, H5P_DEFAULT, vds_dcplid, + H5P_DEFAULT)) < 0) UC_ERROR /* close */ - if(H5Sclose(src_sid) < 0) + if (H5Sclose(src_sid) < 0) UC_ERROR - if(H5Pclose(vds_dcplid) < 0) + if (H5Pclose(vds_dcplid) < 0) UC_ERROR - if(H5Sclose(vds_sid) < 0) + if (H5Sclose(vds_sid) < 0) UC_ERROR - if(H5Dclose(did) < 0) + if (H5Dclose(did) < 0) UC_ERROR - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) UC_ERROR return EXIT_SUCCESS; error: - H5E_BEGIN_TRY { - if(src_sid >= 0) + H5E_BEGIN_TRY + { + if (src_sid >= 0) (void)H5Sclose(src_sid); - if(src_dcplid >= 0) + if (src_dcplid >= 0) (void)H5Pclose(src_dcplid); - if(vds_sid >= 0) + if (vds_sid >= 0) (void)H5Sclose(vds_sid); - if(vds_dcplid >= 0) + if (vds_dcplid >= 0) (void)H5Pclose(vds_dcplid); - if(fid >= 0) + if (fid >= 0) (void)H5Fclose(fid); - if(did >= 0) + if (did >= 0) (void)H5Dclose(did); - if(msid >= 0) + if (msid >= 0) (void)H5Sclose(msid); - if(fsid >= 0) + if (fsid >= 0) (void)H5Sclose(fsid); - if(buffer != NULL) + if (buffer != NULL) free(buffer); - } H5E_END_TRY + } + H5E_END_TRY return EXIT_FAILURE; } /* end main() */ - diff --git a/tools/test/misc/vds/UC_5.h b/tools/test/misc/vds/UC_5.h index 3f8fe41..a81960f 100644 --- a/tools/test/misc/vds/UC_5.h +++ b/tools/test/misc/vds/UC_5.h @@ -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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -28,20 +28,20 @@ /* virtual dataset <---> source dataset mapping and sizes */ -#define UC_5_N_SOURCES 3 +#define UC_5_N_SOURCES 3 /* Dataset dimensions */ -#define UC_5_SRC_PLANES 3 -#define UC_5_HEIGHT 4 -#define UC_5_WIDTH 4 +#define UC_5_SRC_PLANES 3 +#define UC_5_HEIGHT 4 +#define UC_5_WIDTH 4 /* max number of planes for datasets */ -#define UC_5_MAX_PLANES H5S_UNLIMITED -#define UC_5_N_TEST_PLANES 9 /* number of planes in VDS */ +#define UC_5_MAX_PLANES H5S_UNLIMITED +#define UC_5_N_TEST_PLANES 9 /* number of planes in VDS */ /* Dataset datatypes */ -#define UC_5_SOURCE_DATATYPE H5T_STD_I32LE -#define UC_5_VDS_DATATYPE H5T_STD_I32LE +#define UC_5_SOURCE_DATATYPE H5T_STD_I32LE +#define UC_5_VDS_DATATYPE H5T_STD_I32LE /* Starting size of datasets, both source and VDS */ static hsize_t UC_5_SOURCE_DIMS[RANK] = {0, UC_5_HEIGHT, UC_5_WIDTH}; @@ -55,11 +55,7 @@ static hsize_t UC_5_VDS_MAX_DIMS[RANK] = {UC_5_MAX_PLANES, UC_5_HEIGHT, UC_5_ static hsize_t UC_5_PLANE[RANK] = {1, UC_5_HEIGHT, UC_5_WIDTH}; /* File names for source datasets */ -static char UC_5_FILE_NAMES[UC_5_N_SOURCES][NAME_LEN] = { - {"5_a.h5"}, - {"5_b.h5"}, - {"5_c.h5"} -}; +static char UC_5_FILE_NAMES[UC_5_N_SOURCES][NAME_LEN] = {{"5_a.h5"}, {"5_b.h5"}, {"5_c.h5"}}; /* VDS file name */ static char UC_5_VDS_FILE_NAME[NAME_LEN] = "5_vds.h5"; @@ -70,12 +66,7 @@ static char UC_5_SOURCE_DSET_PATH[NAME_LEN] = "/source_dset"; static char UC_5_VDS_DSET_NAME[NAME_LEN] = "vds_dset"; /* Fill values */ -static int UC_5_FILL_VALUES[UC_5_N_SOURCES] = { - -1, - -2, - -3 -}; -static int UC_5_VDS_FILL_VALUE = -9; +static int UC_5_FILL_VALUES[UC_5_N_SOURCES] = {-1, -2, -3}; +static int UC_5_VDS_FILL_VALUE = -9; #endif /* UC_5_H */ - diff --git a/tools/test/misc/vds/UC_5_stride_gen.c b/tools/test/misc/vds/UC_5_stride_gen.c index 726ce6e..d4ba139 100644 --- a/tools/test/misc/vds/UC_5_stride_gen.c +++ b/tools/test/misc/vds/UC_5_stride_gen.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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -27,31 +27,31 @@ int main(void) { - hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ - hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */ + hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ + hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */ - hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ - hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ + hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ + hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ - hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ - hid_t did = H5I_INVALID_HID; /* dataset ID */ - hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */ - hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */ + hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ + hid_t did = H5I_INVALID_HID; /* dataset ID */ + hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */ + hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */ - hsize_t extent[RANK]; /* source dataset extents */ - hsize_t start[RANK]; /* starting point for hyperslab */ - hsize_t stride[RANK]; /* hypserslab stride */ - hsize_t count[RANK]; /* hypserslab count */ - hsize_t map_start = 0; /* starting point in the VDS map */ + hsize_t extent[RANK]; /* source dataset extents */ + hsize_t start[RANK]; /* starting point for hyperslab */ + hsize_t stride[RANK]; /* hypserslab stride */ + hsize_t count[RANK]; /* hypserslab count */ + hsize_t map_start = 0; /* starting point in the VDS map */ - int *buffer = NULL; /* data buffer */ - int value = -1; /* value written to datasets */ + int *buffer = NULL; /* data buffer */ + int value = -1; /* value written to datasets */ - hsize_t n = 0; /* number of elements in a plane */ + hsize_t n = 0; /* number of elements in a plane */ - int i; /* iterator */ - int j; /* iterator */ - hsize_t k; /* iterator */ + int i; /* iterator */ + int j; /* iterator */ + hsize_t k; /* iterator */ /* Start by creating the virtual dataset (VDS) dataspace and creation * property list. The individual source datasets are then created @@ -59,15 +59,13 @@ main(void) */ /* Create VDS dcpl */ - if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) UC_ERROR - if(H5Pset_fill_value(vds_dcplid, UC_5_VDS_DATATYPE, - &UC_5_VDS_FILL_VALUE) < 0) + if (H5Pset_fill_value(vds_dcplid, UC_5_VDS_DATATYPE, &UC_5_VDS_FILL_VALUE) < 0) UC_ERROR /* Create VDS dataspace */ - if((vds_sid = H5Screate_simple(RANK, UC_5_VDS_DIMS, - UC_5_VDS_MAX_DIMS)) < 0) + if ((vds_sid = H5Screate_simple(RANK, UC_5_VDS_DIMS, UC_5_VDS_MAX_DIMS)) < 0) UC_ERROR /********************************* @@ -75,9 +73,9 @@ main(void) *********************************/ /* Hyperslab array setup */ - start[0] = 0; - start[1] = 0; - start[2] = 0; + start[0] = 0; + start[1] = 0; + start[2] = 0; map_start = 0; stride[0] = UC_5_N_SOURCES; @@ -92,61 +90,57 @@ main(void) extent[1] = UC_5_HEIGHT; extent[2] = UC_5_WIDTH; - for(i = 0; i < UC_5_N_SOURCES; i++) { + for (i = 0; i < UC_5_N_SOURCES; i++) { /* source dataset dcpl */ - if((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) UC_ERROR - if(H5Pset_chunk(src_dcplid, RANK, UC_5_PLANE) < 0) + if (H5Pset_chunk(src_dcplid, RANK, UC_5_PLANE) < 0) UC_ERROR - if(H5Pset_fill_value(src_dcplid, UC_5_SOURCE_DATATYPE, - &UC_5_FILL_VALUES[i]) < 0) + if (H5Pset_fill_value(src_dcplid, UC_5_SOURCE_DATATYPE, &UC_5_FILL_VALUES[i]) < 0) UC_ERROR - if(H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0) + if (H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0) UC_ERROR /* Create source file, dataspace, and dataset */ - if((fid = H5Fcreate(UC_5_FILE_NAMES[i], H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(UC_5_FILE_NAMES[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) UC_ERROR - if((src_sid = H5Screate_simple(RANK, UC_5_SOURCE_DIMS, - UC_5_SOURCE_MAX_DIMS)) < 0) + if ((src_sid = H5Screate_simple(RANK, UC_5_SOURCE_DIMS, UC_5_SOURCE_MAX_DIMS)) < 0) UC_ERROR - if((did = H5Dcreate2(fid, UC_5_SOURCE_DSET_NAME, - UC_5_SOURCE_DATATYPE, src_sid, - H5P_DEFAULT, src_dcplid, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, UC_5_SOURCE_DSET_NAME, UC_5_SOURCE_DATATYPE, src_sid, H5P_DEFAULT, + src_dcplid, H5P_DEFAULT)) < 0) UC_ERROR /* Set the dataset's extent */ - if(H5Dset_extent(did, extent) < 0) + if (H5Dset_extent(did, extent) < 0) UC_ERROR /* Create a data buffer that represents a plane */ n = UC_5_PLANE[1] * UC_5_PLANE[2]; - if(NULL == (buffer = (int *)malloc(n * sizeof(int)))) + if (NULL == (buffer = (int *)malloc(n * sizeof(int)))) UC_ERROR /* Create the memory dataspace */ - if((msid = H5Screate_simple(RANK, UC_5_PLANE, NULL)) < 0) + if ((msid = H5Screate_simple(RANK, UC_5_PLANE, NULL)) < 0) UC_ERROR /* Get the file dataspace */ - if((fsid = H5Dget_space(did)) < 0) + if ((fsid = H5Dget_space(did)) < 0) UC_ERROR /* Write planes to the dataset */ - for(j = 0; j < UC_5_SRC_PLANES; j++) { + for (j = 0; j < UC_5_SRC_PLANES; j++) { value = ((i + 1) * 10) + j; - for(k = 0; k < n; k++) - buffer[k] = value; + for (k = 0; k < n; k++) + buffer[k] = value; start[0] = (hsize_t)j; start[1] = 0; start[2] = 0; - if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_5_PLANE, NULL) < 0) + if (H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_5_PLANE, NULL) < 0) UC_ERROR - if(H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0) + if (H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0) UC_ERROR } /* end for */ @@ -155,32 +149,29 @@ main(void) start[0] = 0; start[1] = 0; start[2] = 0; - if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, - UC_5_SOURCE_MAX_DIMS, NULL) < 0) + if (H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, UC_5_SOURCE_MAX_DIMS, NULL) < 0) UC_ERROR start[0] = map_start; - if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, stride, - count, UC_5_PLANE) < 0) + if (H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, stride, count, UC_5_PLANE) < 0) UC_ERROR map_start += 1; /* Add VDS mapping */ - if(H5Pset_virtual(vds_dcplid, vds_sid, UC_5_FILE_NAMES[i], - UC_5_SOURCE_DSET_PATH, src_sid) < 0) + if (H5Pset_virtual(vds_dcplid, vds_sid, UC_5_FILE_NAMES[i], UC_5_SOURCE_DSET_PATH, src_sid) < 0) UC_ERROR /* close */ - if(H5Sclose(msid) < 0) + if (H5Sclose(msid) < 0) UC_ERROR - if(H5Sclose(fsid) < 0) + if (H5Sclose(fsid) < 0) UC_ERROR - if(H5Sclose(src_sid) < 0) + if (H5Sclose(src_sid) < 0) UC_ERROR - if(H5Pclose(src_dcplid) < 0) + if (H5Pclose(src_dcplid) < 0) UC_ERROR - if(H5Dclose(did) < 0) + if (H5Dclose(did) < 0) UC_ERROR - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) UC_ERROR free(buffer); @@ -191,51 +182,51 @@ main(void) *******************/ /* file */ - if((fid = H5Fcreate(UC_5_VDS_FILE_NAME, H5F_ACC_TRUNC, - H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(UC_5_VDS_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) UC_ERROR /* dataset */ - if((did = H5Dcreate2(fid, UC_5_VDS_DSET_NAME, UC_5_VDS_DATATYPE, vds_sid, - H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, UC_5_VDS_DSET_NAME, UC_5_VDS_DATATYPE, vds_sid, H5P_DEFAULT, vds_dcplid, + H5P_DEFAULT)) < 0) UC_ERROR /* close */ - if(H5Pclose(vds_dcplid) < 0) + if (H5Pclose(vds_dcplid) < 0) UC_ERROR - if(H5Sclose(vds_sid) < 0) + if (H5Sclose(vds_sid) < 0) UC_ERROR - if(H5Dclose(did) < 0) + if (H5Dclose(did) < 0) UC_ERROR - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) UC_ERROR return EXIT_SUCCESS; error: - H5E_BEGIN_TRY { - if(src_sid >= 0) + H5E_BEGIN_TRY + { + if (src_sid >= 0) (void)H5Sclose(src_sid); - if(src_dcplid >= 0) + if (src_dcplid >= 0) (void)H5Pclose(src_dcplid); - if(vds_sid >= 0) + if (vds_sid >= 0) (void)H5Sclose(vds_sid); - if(vds_dcplid >= 0) + if (vds_dcplid >= 0) (void)H5Pclose(vds_dcplid); - if(fid >= 0) + if (fid >= 0) (void)H5Fclose(fid); - if(did >= 0) + if (did >= 0) (void)H5Dclose(did); - if(msid >= 0) + if (msid >= 0) (void)H5Sclose(msid); - if(fsid >= 0) + if (fsid >= 0) (void)H5Sclose(fsid); - if(buffer != NULL) + if (buffer != NULL) free(buffer); - } H5E_END_TRY + } + H5E_END_TRY return EXIT_FAILURE; } /* end main() */ - diff --git a/tools/test/misc/vds/UC_common.h b/tools/test/misc/vds/UC_common.h index 78d8a11..bfa1ed9 100644 --- a/tools/test/misc/vds/UC_common.h +++ b/tools/test/misc/vds/UC_common.h @@ -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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -28,21 +28,26 @@ ******************************************/ /* All datasets are 3D */ -#define RANK 3 +#define RANK 3 /* Lengths of string identifiers (file, dataset names, etc.) */ -#define NAME_LEN 32 +#define NAME_LEN 32 /* Compression level */ -#define COMPRESSION_LEVEL 7 +#define COMPRESSION_LEVEL 7 /* Booleans */ -#define TRUE 1 +#define TRUE 1 #define FALSE 0 /* Testing macros */ -#define AT() printf (" at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); -#define UC_ERROR {puts("*ERROR*"); fflush(stdout); AT(); goto error;} +#define AT() printf(" at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); +#define UC_ERROR \ + { \ + puts("*ERROR*"); \ + fflush(stdout); \ + AT(); \ + goto error; \ + } #endif /* USE_CASE_COMMON_H */ - |