diff options
author | Larry Knox <lrknox@hdfgroup.org> | 2021-10-29 22:10:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-29 22:10:31 (GMT) |
commit | 111c7ae9ac2efc29e8b399e6951253af9110b81a (patch) | |
tree | f69fa03253bdab97d7cf3615baff02cd936323f9 /tools/test/misc/vds | |
parent | db30c2da68ece4a155e9e50c28ec16d6057509b2 (diff) | |
download | hdf5-hdf5-1_10_8.zip hdf5-hdf5-1_10_8.tar.gz hdf5-hdf5-1_10_8.tar.bz2 |
Merge hdf5 1 10 8 (#1154)hdf5-1_10_8
Merge HDF5 1.10.8 release files to 1.10/master
Diffstat (limited to 'tools/test/misc/vds')
-rw-r--r-- | tools/test/misc/vds/CMakeLists.txt | 13 | ||||
-rw-r--r-- | tools/test/misc/vds/Makefile.am | 2 | ||||
-rw-r--r-- | tools/test/misc/vds/Makefile.in | 66 | ||||
-rw-r--r-- | tools/test/misc/vds/UC_1.h | 57 | ||||
-rw-r--r-- | tools/test/misc/vds/UC_1_one_dim_gen.c | 179 | ||||
-rw-r--r-- | tools/test/misc/vds/UC_2.h | 74 | ||||
-rw-r--r-- | tools/test/misc/vds/UC_2_two_dims_gen.c | 194 | ||||
-rw-r--r-- | tools/test/misc/vds/UC_3.h | 44 | ||||
-rw-r--r-- | tools/test/misc/vds/UC_3_gaps_gen.c | 148 | ||||
-rw-r--r-- | tools/test/misc/vds/UC_4.h | 40 | ||||
-rw-r--r-- | tools/test/misc/vds/UC_4_printf_gen.c | 140 | ||||
-rw-r--r-- | tools/test/misc/vds/UC_5.h | 33 | ||||
-rw-r--r-- | tools/test/misc/vds/UC_5_stride_gen.c | 155 | ||||
-rw-r--r-- | tools/test/misc/vds/UC_common.h | 21 |
14 files changed, 553 insertions, 613 deletions
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 */ - |