From 1227bc041118e1c9fb3fdd48c083186f5deb4676 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Sat, 9 Jul 2022 03:05:53 -0700 Subject: Sync with develop (#1863) --- CMakeLists.txt | 19 +- README.md | 3 +- autogen.sh | 5 +- bin/bbrelease | 42 +- c++/test/dsets.cpp | 2 +- c++/test/h5cpputil.h | 4 +- c++/test/tfilter.cpp | 6 +- c++/test/trefer.cpp | 1 - c++/test/ttypes.cpp | 13 - config/cmake/H5pubconf.h.in | 13 +- config/cmake/HDF5_Examples.cmake.in | 4 +- config/cmake/scripts/HDF5config.cmake | 6 +- config/cmake/scripts/HDF5options.cmake | 2 +- config/cmake_ext_mod/ConfigureChecks.cmake | 53 -- config/cmake_ext_mod/HDFMacros.cmake | 8 +- config/cmake_ext_mod/HDFTests.c | 80 -- config/ibm-aix | 2 - configure.ac | 96 +- doc/img/release-schedule.plantuml | 12 +- doc/img/release-schedule.png | Bin 16991 -> 17146 bytes doxygen/CMakeLists.txt | 2 +- doxygen/Doxyfile.in | 3 +- doxygen/aliases | 3 +- doxygen/dox/RFC.dox | 3 +- doxygen/dox/ReferenceManual.dox | 25 +- doxygen/dox/high_level/extension.dox | 657 +++++++++++++ doxygen/dox/high_level/high_level.dox | 29 + doxygen/examples/H5DO_examples.c | 220 +++++ doxygen/examples/H5LDget_dset_elmts.c | 143 +++ doxygen/examples/H5LT_examples.c | 27 + doxygen/examples/H5TBAget_fill.c | 43 + examples/testh5cc.sh.in | 2 +- fortran/test/tH5O_F03.F90 | 1 - hl/c++/src/H5PacketTable.h | 2 +- hl/src/H5DOpublic.h | 199 ++++ hl/src/H5DSpublic.h | 362 ++++++- hl/src/H5IMpublic.h | 293 ++++++ hl/src/H5LDpublic.h | 141 +++ hl/src/H5LTanalyze.c | 154 +-- hl/src/H5LTanalyze.l | 8 + hl/src/H5LTparse.c | 897 ++++++++++-------- hl/src/H5LTparse.h | 15 +- hl/src/H5LTpublic.h | 1398 +++++++++++++++++++++++++++- hl/src/H5PTpublic.h | 416 +++++++++ hl/src/H5TBpublic.h | 539 +++++++++++ hl/test/test_ds.c | 36 +- java/src/hdf/hdf5lib/H5.java | 2 +- java/src/hdf/hdf5lib/HDF5Constants.java | 4 + java/src/jni/h5util.c | 8 +- release_docs/INSTALL | 2 +- release_docs/INSTALL_CMake.txt | 2 +- release_docs/README_HDF5_CMake | 8 +- release_docs/RELEASE.txt | 34 +- src/H5B2int.c | 11 +- src/H5C.c | 46 +- src/H5Cmpio.c | 4 +- src/H5Dcompact.c | 4 +- src/H5Dint.c | 4 +- src/H5Dmpio.c | 17 +- src/H5Dvirtual.c | 3 +- src/H5EAcache.c | 2 +- src/H5ESdevelop.h | 6 +- src/H5FD.c | 4 +- src/H5FDcore.c | 2 +- src/H5FDdevelop.h | 6 +- src/H5FDint.c | 84 +- src/H5FDlog.c | 2 +- src/H5FDmpi.c | 12 +- src/H5FDmpio.c | 14 +- src/H5FDmulti.c | 2 +- src/H5FDonion.c | 10 +- src/H5FDpublic.h | 26 +- src/H5FDsec2.c | 4 +- src/H5FDsplitter.c | 6 +- src/H5FDstdio.c | 2 +- src/H5Fint.c | 7 +- src/H5Fsuper.c | 4 +- src/H5Gcompact.c | 2 +- src/H5Gname.c | 5 +- src/H5Gnode.c | 2 + src/H5Gobj.c | 8 +- src/H5Gtraverse.c | 5 +- src/H5HFcache.c | 5 +- src/H5Idbg.c | 2 +- src/H5Idevelop.h | 6 +- src/H5Iint.c | 13 +- src/H5Ldevelop.h | 6 +- src/H5Lint.c | 10 +- src/H5Ocache.c | 18 +- src/H5Opline.c | 16 +- src/H5Pdcpl.c | 144 +-- src/H5Ppublic.h | 3 + src/H5SM.c | 2 +- src/H5Shyper.c | 2 +- src/H5Tdbg.c | 2 +- src/H5Tdevelop.h | 6 +- src/H5Tnative.c | 19 +- src/H5Z.c | 2 +- src/H5Zdevelop.h | 6 +- src/H5make_libsettings.c | 67 +- src/H5private.h | 2 +- src/H5public.h | 5 +- src/H5timer.c | 39 +- src/H5win32defs.h | 10 +- test/CMakeLists.txt | 8 +- test/CMakePassthroughVOLTests.cmake | 4 +- test/CMakeTests.cmake | 10 +- test/CMakeVFDTests.cmake | 4 +- test/cache_api.c | 2 +- test/cache_tagging.c | 8 +- test/chunk_info.c | 96 +- test/cork.c | 6 +- test/dt_arith.c | 24 +- test/dtypes.c | 2 +- test/fheap.c | 4 +- test/filter_plugin.c | 18 +- test/h5test.c | 2 +- test/hyperslab.c | 55 +- test/istore.c | 22 +- test/lheap.c | 4 +- test/mf.c | 12 +- test/objcopy.c | 14 +- test/objcopy_ref.c | 4 +- test/ohdr.c | 2 +- test/stab.c | 29 +- test/swmr_common.c | 9 +- test/swmr_common.h | 8 +- test/swmr_generator.c | 2 +- test/tattr.c | 14 +- test/tconfig.c | 5 - test/test_swmr.sh.in | 92 +- test/testframe.c | 39 +- test/testmeta.c | 8 +- test/tfile.c | 16 +- test/th5o.c | 2 +- test/titerate.c | 8 +- test/unlink.c | 78 +- test/vfd.c | 68 +- testpar/t_2Gio.c | 17 +- testpar/t_dset.c | 5 +- testpar/t_mdset.c | 30 +- testpar/t_prop.c | 12 +- testpar/t_vfd.c | 99 +- tools/lib/h5diff_array.c | 42 +- tools/lib/h5tools_str.c | 4 +- tools/src/h5perf/perf.c | 13 +- tools/src/h5perf/pio_engine.c | 29 +- tools/src/h5perf/pio_perf.c | 8 +- tools/src/h5perf/sio_engine.c | 10 +- tools/src/h5perf/sio_perf.c | 8 +- tools/src/h5repack/h5repack_copy.c | 6 +- tools/src/misc/h5repart.c | 8 +- tools/test/h5dump/h5dumpgentest.c | 30 +- tools/test/h5jam/h5jamgentest.c | 6 +- tools/test/h5repack/h5repacktst.c | 6 +- tools/test/h5stat/h5stat_gentest.c | 14 +- tools/test/misc/h5perf_gentest.c | 54 +- tools/test/perform/iopipe.c | 2 +- 158 files changed, 6142 insertions(+), 1678 deletions(-) mode change 100755 => 100644 doc/img/release-schedule.png create mode 100644 doxygen/dox/high_level/extension.dox create mode 100644 doxygen/dox/high_level/high_level.dox create mode 100644 doxygen/examples/H5DO_examples.c create mode 100644 doxygen/examples/H5LDget_dset_elmts.c create mode 100644 doxygen/examples/H5LT_examples.c create mode 100644 doxygen/examples/H5TBAget_fill.c diff --git a/CMakeLists.txt b/CMakeLists.txt index cad378b..5599441 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,10 +2,13 @@ cmake_minimum_required (VERSION 3.12) project (HDF5 C) if (POLICY CMP0074) + # find_package() uses _ROOT variables. cmake_policy (SET CMP0074 NEW) endif () if (POLICY CMP0083) + # To control generation of Position Independent Executable (PIE) or not, + # some flags are required at link time. cmake_policy (SET CMP0083 NEW) endif () @@ -830,15 +833,6 @@ if (HDF5_ENABLE_THREADSAFE) message (VERBOSE " **** thread-safety option will not be used building static library **** ") endif () endif () - if (HDF5_ENABLE_PARALLEL) - if (NOT ALLOW_UNSUPPORTED) - message (FATAL_ERROR " **** parallel and thread-safety options are not supported, override with ALLOW_UNSUPPORTED option **** ") - else () - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE " **** Allowing unsupported parallel and thread-safety options **** ") - endif () - endif () - endif () if (HDF5_BUILD_FORTRAN) if (NOT ALLOW_UNSUPPORTED) message (FATAL_ERROR " **** Fortran and thread-safety options are not supported, override with ALLOW_UNSUPPORTED option **** ") @@ -962,8 +956,13 @@ if (BUILD_TESTING) mark_as_advanced (HDF5_TEST_FHEAP_PASSTHROUGH VOL) endif () - option (HDF_TEST_EXPRESS "Control testing framework (0-3)" "0") + set (H5_TEST_EXPRESS_LEVEL_DEFAULT "3") + set (HDF_TEST_EXPRESS "${H5_TEST_EXPRESS_LEVEL_DEFAULT}" + CACHE STRING "Control testing framework (0-3) (0 = exhaustive testing; 3 = quicker testing)") mark_as_advanced (HDF_TEST_EXPRESS) + if (NOT "${HDF_TEST_EXPRESS}" STREQUAL "") + set (H5_TEST_EXPRESS_LEVEL_DEFAULT "${HDF_TEST_EXPRESS}") + endif () enable_testing () include (CTest) diff --git a/README.md b/README.md index 1d4e3d6..3d17cd3 100644 --- a/README.md +++ b/README.md @@ -85,8 +85,7 @@ are tentative. | Release | New Features | | ------- | ------------ | | 1.13.2 | VFD SWMR, Onion VFD, Selection I/O | -| 1.13.3 | Multi-Dataset I/O | -| 1.13.4 | Subfiling | +| 1.13.3 | Subfiling, Multi-Dataset I/O | This list of feature release versions is also tentative, and the specific release in which a feature is introduced may change. diff --git a/autogen.sh b/autogen.sh index 4676ee0..7c3cbcf 100755 --- a/autogen.sh +++ b/autogen.sh @@ -236,7 +236,10 @@ ${automake_cmd} || exit 1 echo # AUTOCONF -autoconf_cmd="${HDF5_AUTOCONF} --force" +# The "obsolete" warnings category flags our Java macros as obsolete. +# Since there is no clear way to upgrade them (Java support in the Autotools +# is not great) and they work well enough for now, we suppress those warnings. +autoconf_cmd="${HDF5_AUTOCONF} --force --warnings=no-obsolete" echo "${autoconf_cmd}" if [ "$verbose" = true ] ; then ${HDF5_AUTOCONF} --version diff --git a/bin/bbrelease b/bin/bbrelease index 6120e37..9699cf0 100755 --- a/bin/bbrelease +++ b/bin/bbrelease @@ -28,15 +28,17 @@ USAGE() { cat << EOF -Usage: $0 -d [--docver BRANCHNAME] [-h] [--private] [--revision] ... +Usage: $0 -d [-h] [--private] [--revision [--branch BRANCHNAME]] ... -d DIR The name of the directory where the release(s) should be placed. - --docver BRANCHNAME This is added for 1.8 and beyond to get the correct - version of documentation files from the hdf5docs + --branch BRANCHNAME This is to get the correct version of the branch name from the repository. BRANCHNAME for v1.8 should be hdf5_1_8. -h print the help page. --private Make a private release with today's date in version information. --revision Make a private release with the code revision number in version information. + This allows --branch to be used for the file name. + --branch BRANCHNAME This is to get the correct version of the branch name from the + repository. BRANCHNAME for v1.8 should be hdf5_1_8. This must be run at the top level of the source directory. The other command-line options are the names of the programs to use @@ -47,7 +49,6 @@ for compressing the resulting tar archive (if none are given then gzip -- use gzip with "-9" and append ".gz" to the output name. bzip2 -- use bzip2 with "-9" and append ".bz2" to the output name. zip -- convert all text files to DOS style and form a zip file for Windows use. - doc -- produce the latest doc tree in addition to the archive. An md5 checksum is produced for each archive created and stored in the md5 file. @@ -154,7 +155,6 @@ today=`date +%Y%m%d` pmode='no' revmode='no' tmpdir="../#release_tmp.$$" # tmp work directory -DOC_URL=https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5doc.git CPPLUS_RM_NAME=cpplus_RM # Restore previous Version information @@ -189,8 +189,8 @@ while [ -n "$1" ]; do --revision) revmode=yes ;; - --docver) - DOCVERSION=$1 + --branch) + BRANCHNAME=$1 shift ;; -*) @@ -239,13 +239,15 @@ if [ X$revmode = Xyes ]; then # Copy old version of config/lt_vers.am, since it's hard to # "undo" changes to it. cp config/lt_vers.am $tmpdir - branch=`git symbolic-ref -q --short HEAD` + if [ "${BRANCHNAME}" = "" ]; then + BRANCHNAME=`git symbolic-ref -q --short HEAD` + fi revision=`git rev-parse --short HEAD` # Set version information to m.n.r-r$revision. # (h5vers does not correctly handle just m.n.r-$today.) VERS=`echo $VERS | sed -e s/-.*//`-$revision echo Private release of $VERS - HDF5_VERS=hdf5-$branch-$revision + HDF5_VERS=hdf5-$BRANCHNAME-$revision echo file base of $HDF5_VERS bin/h5vers -s $VERS # use a generic directory name for revision releases @@ -281,11 +283,6 @@ for f in README.md release_docs/RELEASE.txt; do chmod 644 $f done -# develop is different than branches. -if [ "${DOCVERSION}" ]; then - DOC_URL=https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5doc.git -b ${DOCVERSION} -fi - # Create the tar file test "$verbose" && echo " Running tar..." 1>&2 (cd "$tmpdir" && exec tar -ch --exclude-vcs -f "$HDF5_VERS.tar" "./$HDF5_IN_VERS" || exit 1 ) @@ -314,23 +311,6 @@ for comp in $methods; do tar2zip $HDF5_IN_VERS $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.zip 1>&2 (cd $DEST; md5sum $HDF5_VERS.zip >> $MD5file) ;; - doc) - if [ "${DOCVERSION}" = "" ]; then - DOCVERSION=master - fi - test "$verbose" && echo " Creating docs..." 1>&2 - # Check out docs from git repo - (cd $tmpdir; git clone $DOC_URL > /dev/null) || exit 1 - # Create doxygen C++ RM - (cd c++/src && doxygen cpp_doc_config > /dev/null ) || exit 1 - # Replace version of C++ RM with just-created version - rm -rf $tmpdir/${DOCVERSION}/html/$CPPLUS_RM_NAME - mv c++/src/$CPPLUS_RM_NAME $tmpdir/${DOCVERSION}/html/$CPPLUS_RM_NAME - # Compress the docs and move them to the release area - mv $tmpdir/$DOCVERSION $tmpdir/${HDF5_VERS}_docs - (cd $tmpdir && tar cf ${HDF5_VERS}_docs.tar ${HDF5_VERS}_docs) - mv $tmpdir/${HDF5_VERS}_docs.tar $DEST - ;; *) echo "***Error*** Unknown method $comp" exit 1 diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 55ffd67..6e170bf 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -1201,7 +1201,7 @@ test_chunk_cache(const FileAccPropList &fapl) // Retrieve and verify the raw data chunk cache parameters nslots_4 = nbytes_4 = 0; - w0_4 = 0.0F; + w0_4 = 0.0; dapl2.getChunkCache(nslots_4, nbytes_4, w0_4); verify_val(nslots_2, nslots_4, "DSetCreatPropList::getChunkCache", __LINE__, __FILE__); verify_val(nbytes_2, nbytes_4, "DSetCreatPropList::getChunkCache", __LINE__, __FILE__); diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h index 444bc68..86bc9d7 100644 --- a/c++/test/h5cpputil.h +++ b/c++/test/h5cpputil.h @@ -50,14 +50,14 @@ class InvalidActionException : public Exception { public: InvalidActionException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); InvalidActionException(); - virtual ~InvalidActionException() throw(); + ~InvalidActionException() throw() override; }; class TestFailedException : public Exception { public: TestFailedException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); TestFailedException(); - virtual ~TestFailedException() throw(); + ~TestFailedException() throw() override; }; // Overloaded/Template functions to verify values and display proper info diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp index e89838c..b5073e8 100644 --- a/c++/test/tfilter.cpp +++ b/c++/test/tfilter.cpp @@ -27,8 +27,10 @@ using namespace H5; #include "h5test.h" #include "h5cpputil.h" // C++ utilility header file -#define DSET_DIM1 100 -#define DSET_DIM2 200 +#ifdef H5_HAVE_FILTER_SZIP +#define DSET_DIM1 100 +#define DSET_DIM2 200 +#endif #define FILTER_CHUNK_DIM1 2 #define FILTER_CHUNK_DIM2 25 diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 53a4ed3..66fa040 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -395,7 +395,6 @@ test_reference_obj() #define GROUPNAME3 "group3" #define DSETNAME "/dset" #define DSETNAME2 "dset2" -#define NAME_SIZE 16 static void test_reference_group() diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index 8afb4bb..794820e 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -28,12 +28,6 @@ using namespace H5; #include "h5cpputil.h" // C++ utilility header file /* - * Offset from aligned memory returned by malloc(). This can be used to test - * that type conversions handle non-aligned buffers correctly. - */ -#define ALIGNMENT 1 - -/* * Define if you want to test alignment code on a machine that doesn't * normally require alignment. When set, all native datatypes must be aligned * on a byte boundary equal to the data size. @@ -53,13 +47,6 @@ using namespace H5; const char *FILENAME[] = {"dtypes1.h5", "dtypes2.h5", "dtypes3.h5", "dtypes4.h5", NULL}; -/* - * Count up or down depending on whether the machine is big endian or little - * endian. If local variable `endian' is H5T_ORDER_BE then the result will - * be I, otherwise the result will be Z-(I+1). - */ -#define ENDIAN(Z, I) (H5T_ORDER_BE == endian ? (I) : (Z) - ((I) + 1)) - typedef enum flt_t { FLT_FLOAT, FLT_DOUBLE, FLT_LDOUBLE, FLT_OTHER } flt_t; typedef enum int_t { diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 9a581cb..e32c3b3 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -98,10 +98,6 @@ /* Define if the __attribute__(()) extension is present */ #cmakedefine H5_HAVE_ATTRIBUTE @H5_HAVE_ATTRIBUTE@ -/* Define if the compiler understands C99 designated initialization of structs - and unions */ -#cmakedefine H5_HAVE_C99_DESIGNATED_INITIALIZER @H5_HAVE_C99_DESIGNATED_INITIALIZER@ - /* Define to 1 if you have the `clock_gettime' function. */ #cmakedefine H5_HAVE_CLOCK_GETTIME @H5_HAVE_CLOCK_GETTIME@ @@ -464,9 +460,6 @@ /* Define Fortran Maximum Real Decimal Precision */ #define H5_PAC_FC_MAX_REAL_PRECISION @H5_PAC_FC_MAX_REAL_PRECISION@ -/* Width for printf() for type `long long' or `__int64', use `ll' */ -#cmakedefine H5_PRINTF_LL_WIDTH @H5_PRINTF_LL_WIDTH@ - /* The size of `bool', as computed by sizeof. */ #cmakedefine H5_SIZEOF_BOOL @H5_SIZEOF_BOOL@ @@ -559,8 +552,7 @@ #endif -/* Define size of long long and/or __int64 bit integer type only if the type - exists. */ +/* The size of `long long', as computed by sizeof. */ #if !defined(__APPLE__) #cmakedefine H5_SIZEOF_LONG_LONG @H5_SIZEOF_LONG_LONG@ #else @@ -627,9 +619,6 @@ /* The size of `__float128', as computed by sizeof. */ #define H5_SIZEOF___FLOAT128 @H5_SIZEOF___FLOAT128@ -/* The size of `__int64', as computed by sizeof. */ -#define H5_SIZEOF___INT64 @H5_SIZEOF___INT64@ - /* Define if strict file format checks are enabled */ #cmakedefine H5_STRICT_FORMAT_CHECKS @H5_STRICT_FORMAT_CHECKS@ diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index 795399e..23c07e8 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -52,7 +52,7 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_CONFIGURATION_TYPE:STRING=${ if(NOT DEFINED INSTALLDIR) if(WIN32) - set(INSTALLDIR "C:/Program Files/HDF_Group/@HDF5_PACKAGE_NAME@/@HDF5_PACKAGE_VERSION@") + set(INSTALLDIR "%ProgramFiles%/HDF_Group/@HDF5_PACKAGE_NAME@/@HDF5_PACKAGE_VERSION@") else() set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@") endif() @@ -77,7 +77,7 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDN #TAR_SOURCE - name of tarfile #if(NOT DEFINED TAR_SOURCE) -# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.14.4-Source") +# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.14.5-Source") #endif() ############################################################################################################### diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 9a3ead2..bda7af2 100644 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -79,7 +79,7 @@ set (CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}") if (NOT DEFINED INSTALLDIR) if (WIN32) - set (INSTALLDIR "C:/Program Files/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}") + set (INSTALLDIR "%ProgramFiles%/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}") else () set (INSTALLDIR "${CTEST_SCRIPT_DIRECTORY}/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}") endif () @@ -105,7 +105,7 @@ endif () ######### Following describes compiler ############ if (NOT DEFINED HPC) if (NOT DEFINED BUILD_GENERATOR) - message (FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2017, or VS201764, VS2015, VS201564, VS2013, VS201364") + message (FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2019, VS201964, VS2017, VS201764, VS2015, VS201564") endif () if (WIN32 AND NOT MINGW) set (SITE_OS_NAME "Windows") @@ -163,7 +163,7 @@ if (NOT DEFINED HPC) set (SITE_COMPILER_NAME "vs2012") set (SITE_COMPILER_VERSION "11") else () - message (FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2019, VS201964, VS2017, or VS201764, VS2015, VS201564") + message (FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2019, VS201964, VS2017, VS201764, VS2015, VS201564") endif () ## Set the following to unique id your computer ## set (CTEST_SITE "WIN7${BUILD_GENERATOR}.XXXX") diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index 136f55d..8ad432f 100644 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -69,7 +69,7 @@ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRIN #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") #### package examples #### -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.14.4-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.14.5-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}") ############################################################################################# ### enable parallel builds diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 6242b12..2312929 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -326,10 +326,6 @@ if (NOT APPLE) HDF_CHECK_TYPE_SIZE (long ${HDF_PREFIX}_SIZEOF_LONG) endif () HDF_CHECK_TYPE_SIZE ("long long" ${HDF_PREFIX}_SIZEOF_LONG_LONG) -HDF_CHECK_TYPE_SIZE (__int64 ${HDF_PREFIX}_SIZEOF___INT64) -if (NOT ${HDF_PREFIX}_SIZEOF___INT64) - set (${HDF_PREFIX}_SIZEOF___INT64 0) -endif () HDF_CHECK_TYPE_SIZE (float ${HDF_PREFIX}_SIZEOF_FLOAT) HDF_CHECK_TYPE_SIZE (double ${HDF_PREFIX}_SIZEOF_DOUBLE) @@ -497,7 +493,6 @@ endif () if (MINGW OR NOT WINDOWS) foreach (other_test HAVE_ATTRIBUTE - HAVE_C99_DESIGNATED_INITIALIZER SYSTEM_SCOPE_THREADS HAVE_SOCKLEN_T ) @@ -567,54 +562,6 @@ if (WINDOWS) endif () endif () -#----------------------------------------------------------------------------- -# Check how to print a Long Long integer -#----------------------------------------------------------------------------- -if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES "unknown") - set (PRINT_LL_FOUND 0) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Checking for appropriate format for 64 bit long:") - endif () - set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH") - if (${HDF_PREFIX}_SIZEOF_LONG_LONG) - set (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG") - endif () - TRY_RUN (${HDF_PREFIX}_PRINTF_LL_TEST_RUN ${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE - ${CMAKE_BINARY_DIR} - ${HDF_RESOURCES_EXT_DIR}/HDFTests.c - COMPILE_DEFINITIONS "${CURRENT_TEST_DEFINITIONS}" - RUN_OUTPUT_VARIABLE OUTPUT - ) - if (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE) - if (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0) - string(REGEX REPLACE ".*PRINTF_LL_WIDTH=\\[(.*)\\].*" "\\1" ${HDF_PREFIX}_PRINTF_LL "${OUTPUT}") - set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"${${HDF_PREFIX}_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll") - set (PRINT_LL_FOUND 1) - else () - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Width test failed with result: ${${HDF_PREFIX}_PRINTF_LL_TEST_RUN}") - endif () - endif () - else () - file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log - "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH failed\n" - ) - endif () - - if (PRINT_LL_FOUND) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Checking for appropriate format for 64 bit long: found ${${HDF_PREFIX}_PRINTF_LL_WIDTH}") - endif () - else () - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Checking for appropriate format for 64 bit long: not found") - endif () - set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL - "Width for printf for type `long long' or `__int64', us. `ll" - ) - endif () -endif () - # ---------------------------------------------------------------------- # Set the flag to indicate that the machine can handle converting # denormalized floating-point values. diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 0f9b367..260fd55 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -267,10 +267,14 @@ macro (HDF_README_PROPERTIES target_fortran) elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.*") if (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.0.*") set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2015") - elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.16.*") + elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.1.*") set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2017") - else () #19.23 + elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.2.*") set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2019") + elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.3.*") + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2022") + else () + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO ???") endif () else () set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO ${CMAKE_C_COMPILER_VERSION}") diff --git a/config/cmake_ext_mod/HDFTests.c b/config/cmake_ext_mod/HDFTests.c index 2b2a202..66b9bf6 100644 --- a/config/cmake_ext_mod/HDFTests.c +++ b/config/cmake_ext_mod/HDFTests.c @@ -11,38 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #define SIMPLE_TEST(x) int main(){ x; return 0; } -#ifdef HAVE_C99_DESIGNATED_INITIALIZER - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus -extern "C" -# endif -int FC_DUMMY_MAIN() -{ return 1;} -#endif -#endif -int -main () -{ - - typedef struct - { - int x; - union - { - int i; - double d; - }u; - }di_struct_t; - di_struct_t x = - { 0, - { .d = 0.0}}; - ; - return 0; -} - -#endif #ifdef HAVE_ATTRIBUTE @@ -80,54 +48,6 @@ SIMPLE_TEST(timezone=0); #endif /* HAVE_TIMEZONE */ -#ifdef PRINTF_LL_WIDTH - -#ifdef HAVE_LONG_LONG -# define LL_TYPE long long -#else /* HAVE_LONG_LONG */ -# define LL_TYPE __int64 -#endif /* HAVE_LONG_LONG */ - -#include -#include -#include - -#if defined(_MSC_VER) && defined(_DEBUG) -# include -int DebugReport(int reportType, char* message, int* returnValue) -{ - (void)reportType; - (void)message; - (void)returnValue; - return 1; /* no further handling required */ -} -#endif - -int main(void) -{ - char *llwidthArgs[] = { "I64", "l64", "ll", "l", "L", "q", NULL }; - char *s = malloc(128); - char **currentArg = NULL; - LL_TYPE x = (LL_TYPE)1048576 * (LL_TYPE)1048576; - #if defined(_MSC_VER) && defined(_DEBUG) - _CrtSetReportHook(DebugReport); - #endif - for (currentArg = llwidthArgs; *currentArg != NULL; currentArg++) - { - char formatString[64]; - snprintf(formatString, sizeof(formatString), "%%%sd", *currentArg); - snprintf(s, 128, formatString, x); - if (strcmp(s, "1099511627776") == 0) - { - printf("PRINTF_LL_WIDTH=[%s]\n", *currentArg); - return 0; - } - } - return 1; -} - -#endif /* PRINTF_LL_WIDTH */ - #ifdef SYSTEM_SCOPE_THREADS #include #include diff --git a/config/ibm-aix b/config/ibm-aix index f48f9d8..9f261e3 100644 --- a/config/ibm-aix +++ b/config/ibm-aix @@ -149,8 +149,6 @@ ac_cv_sizeof_char=${ac_cv_sizeof_char=1} ac_cv_sizeof_short=${ac_cv_sizeof_short=2} ac_cv_sizeof_int=${ac_cv_sizeof_int=4} ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long=8} -# Do not cache __int64 since it is not a standard C type and some compilers -# (e.g., gcc) does not support it. ac_cv_sizeof_float=${ac_cv_sizeof_float=4} ac_cv_sizeof_double=${ac_cv_sizeof_double=8} ac_cv_sizeof_long_double=${ac_cv_sizeof_long_double=8} diff --git a/configure.ac b/configure.ac index 908ece7..d493873 100644 --- a/configure.ac +++ b/configure.ac @@ -160,6 +160,8 @@ AM_JNIFLAGS="${AM_JNIFLAGS}" AM_JAVACFLAGS="${AM_JAVACFLAGS}" AM_JAVAFLAGS="${AM_JAVAFLAGS}" AM_LDFLAGS="${AM_LDFLAGS}" + +## Flags passed in by the user CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" FCFLAGS="${FCFLAGS}" @@ -181,6 +183,14 @@ saved_user_JAVAFLAGS="$JAVAFLAGS" saved_user_LDFLAGS="$LDFLAGS" saved_user_CPPFLAGS="$CPPFLAGS" +## Strip out -Werror from CFLAGS since that can cause checks to fail when +## compiling the test program fails due to warnings +CFLAGS="`echo $CFLAGS | sed -e 's/-Werror//g'`" +CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Werror//g'`" +FCFLAGS="`echo $FCFLAGS | sed -e 's/-Werror//g'`" +JAVACFLAGS="`echo $JAVACFLAGS | sed -e 's/-Werror//g'`" +CPPFLAGS="`echo $CPPFLAGS | sed -e 's/-Werror//g'`" + ## Support F9X variable to define Fortran compiler if FC variable is ## not used. This should be deprecated in the future. if test "x" = "x$FC"; then @@ -522,7 +532,6 @@ AC_CHECK_SIZEOF([int]) AC_CHECK_SIZEOF([unsigned]) AC_CHECK_SIZEOF([long]) AC_CHECK_SIZEOF([long long]) -AC_CHECK_SIZEOF([__int64]) AC_CHECK_SIZEOF([float]) AC_CHECK_SIZEOF([double]) AC_CHECK_SIZEOF([long double]) @@ -783,7 +792,7 @@ HDF_CXX=no ## AC_PROG_CXX defines some macros that Automake 1.9.x uses and will ## miss even if c++ is not enabled. AC_PROG_CXX -AC_PROG_CXXCPP ## this is checked for when AC_HEADER_STDC is done +AC_PROG_CXXCPP AC_MSG_CHECKING([if c++ interface enabled]) @@ -862,7 +871,7 @@ AC_MSG_CHECKING([if the high-level tools are enabled]) AC_ARG_ENABLE([hltools], [AS_HELP_STRING([--enable-hltools], [Enable the high-level tools. - [default=yes)] + [default=yes] ])], [HDF5_HL_TOOLS=$enableval]) @@ -908,7 +917,7 @@ esac ## ---------------------------------------------------------------------- ## Check which archiving tool to use. This needs to be done before -## the AM_PROG_LIBTOOL macro. +## the LT_INIT macro. ## if test -z "$AR"; then AC_CHECK_PROGS([AR], [ar xar], [:], [$PATH]) @@ -1120,6 +1129,32 @@ AC_SUBST([H5_TEST_BUILDDIR]) H5_TEST_BUILDDIR='test' ## ---------------------------------------------------------------------- +## Check what level of testing should be enabled +## + +## Default is quickest testing +TEST_EXPRESS_LEVEL_DEFAULT=3 + +AC_MSG_CHECKING([if HDF5 testing intensity level is set]) + +AC_ARG_ENABLE([test-express], + [AS_HELP_STRING([--enable-test-express=(0-3)], + [Set HDF5 testing intensity level (0-3) [0 = exhaustive testing; 3 = quicker testing; default=3] Set environment variable HDF5TestExpress to override configured setting])], + [TEST_EXPRESS_LEVEL_DEFAULT=$enableval]) + +case "X-$TEST_EXPRESS_LEVEL_DEFAULT" in + X-0|X-1|X-2|X-3) + AC_MSG_RESULT([$TEST_EXPRESS_LEVEL_DEFAULT]) + ;; + *) + AC_MSG_RESULT([error]) + AC_MSG_ERROR([$TEST_EXPRESS_LEVEL_DEFAULT is not a valid test express level]) + ;; +esac + +AC_DEFINE_UNQUOTED([TEST_EXPRESS_LEVEL_DEFAULT], [$TEST_EXPRESS_LEVEL_DEFAULT], [HDF5 testing intensity level]) + +## ---------------------------------------------------------------------- ## Check if they would like to disable building tools ## @@ -1327,7 +1362,8 @@ esac ## Windows case "`uname`" in MINGW*) - AC_HAVE_LIBRARY([ws2_32]) + # The Winsock library + AC_CHECK_LIB([ws2_32], [GetUserName]) ;; esac @@ -2104,48 +2140,6 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[int __attribute__((unused)) x]])], AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) -AC_MSG_CHECKING([for C99 designated initialization support]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ - typedef struct { - int x; - union { - int i; - double d; - } u; - } di_struct_t; - di_struct_t x = {0, { .d = 0.0}}; ]])], - [AC_DEFINE([HAVE_C99_DESIGNATED_INITIALIZER], [1], - [Define if the compiler understands C99 designated initialization of structs and unions]) - AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no])]) - -## ---------------------------------------------------------------------- -## Try to figure out how to print `long long'. Some machines use `%lld' -## and others use `%qd'. There may be more! The final `l' is a -## default in case none of the others work. -## -AC_MSG_CHECKING([how to print long long]) -AC_CACHE_VAL([hdf5_cv_printf_ll], [ - -for hdf5_cv_printf_ll in ll l L q unknown; do - AC_RUN_IFELSE( - [AC_LANG_PROGRAM([ - #include - #include - #include - ],[[ - char *s = malloc(128); - long long x = (long long)1048576 * (long long)1048576; - snprintf(s,128,"%${hdf5_cv_printf_ll}d",x); - exit(strcmp(s,"1099511627776")); - ]])] - , [break],,[continue]) -done]) - -AC_MSG_RESULT([%${hdf5_cv_printf_ll}d and %${hdf5_cv_printf_ll}u]) -AC_DEFINE_UNQUOTED([PRINTF_LL_WIDTH], ["$hdf5_cv_printf_ll"], - [Width for printf() for type `long long' or `__int64', use `ll']) - ## ---------------------------------------------------------------------- ## Remove old ways of determining debug/production build. ## These were used in 1.8.x and earlier. We should probably keep these checks @@ -2755,14 +2749,6 @@ if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then fi fi -## --enable-parallel is also incompatible with --enable-threadsafe, unless -## --enable-unsupported has been specified on the configure line. -if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then - if test "X${THREADSAFE}" = "Xyes" -a "X${enable_parallel}" = "Xyes"; then - AC_MSG_ERROR([--enable-threadsafe and --enable-parallel flags are incompatible. Use --enable-unsupported to override this error.]) - fi -fi - AC_MSG_CHECKING([for parallel support files]) case "X-$enable_parallel" in X-|X-no|X-none) diff --git a/doc/img/release-schedule.plantuml b/doc/img/release-schedule.plantuml index f5aa62a..2564852 100644 --- a/doc/img/release-schedule.plantuml +++ b/doc/img/release-schedule.plantuml @@ -8,7 +8,7 @@ title HDF5 Release Schedule projectscale monthly Project starts 2021-01-01 -[1.8] starts 2021-01-01 and lasts 114 weeks +[1.8] starts 2021-01-01 and lasts 104 weeks [1.8.22] happens 2021-02-05 [1.8.23] happens 2022-12-31 [1.8.23] displays on same row as [1.8.22] @@ -20,22 +20,22 @@ Project starts 2021-01-01 [1.10.9] displays on same row as [1.10.8] [1.10] is colored in #DDCC77 -[1.12] starts 2021-01-01 and lasts 114 weeks +[1.12] starts 2021-01-01 and lasts 109 weeks [1.12.1] happens 2021-07-01 [1.12.2] happens 2022-04-30 +[1.12.3] happens 2023-01-31 [1.12.2] displays on same row as [1.12.1] +[1.12.3] displays on same row as [1.12.1] [1.12] is colored in #88CCEE [1.13] starts 2021-01-01 and lasts 104 weeks [1.13.0] happens 2021-12-01 [1.13.1] happens 2022-03-02 -[1.13.2] happens 2022-06-31 -[1.13.3] happens 2022-08-31 -[1.13.4] happens 2022-10-31 +[1.13.2] happens 2022-07-31 +[1.13.3] happens 2022-09-31 [1.13.1] displays on same row as [1.13.0] [1.13.2] displays on same row as [1.13.0] [1.13.3] displays on same row as [1.13.0] -[1.13.4] displays on same row as [1.13.0] [1.13] is colored in #44AA99 [1.14] starts at 2022-12-31 and lasts 10 weeks diff --git a/doc/img/release-schedule.png b/doc/img/release-schedule.png old mode 100755 new mode 100644 index c2ed241..4d5ac40 Binary files a/doc/img/release-schedule.png and b/doc/img/release-schedule.png differ diff --git a/doxygen/CMakeLists.txt b/doxygen/CMakeLists.txt index 920fafa..e75c899 100644 --- a/doxygen/CMakeLists.txt +++ b/doxygen/CMakeLists.txt @@ -21,7 +21,7 @@ if (DOXYGEN_FOUND) set (DOXYGEN_HTML_HEADER ${HDF5_DOXYGEN_DIR}/hdf5_header.html) set (DOXYGEN_HTML_FOOTER ${HDF5_DOXYGEN_DIR}/hdf5_footer.html) set (DOXYGEN_HTML_EXTRA_STYLESHEET ${HDF5_DOXYGEN_DIR}/hdf5doxy.css) - set (DOXYGEN_HTML_EXTRA_FILES "${HDF5_DOXYGEN_DIR}/hdf5_navtree_hacks.js ${HDF5_DOXYGEN_DIR}/img/FF-IH_FileGroup.gif ${HDF5_DOXYGEN_DIR}/img/FF-IH_FileObject.gif ${HDF5_DOXYGEN_DIR}/img/FileFormatSpecChunkDiagram.jpg ${HDF5_DOXYGEN_DIR}/img/ftv2node.png ${HDF5_DOXYGEN_DIR}/img/ftv2pnode.png ${HDF5_DOXYGEN_DIR}/img/HDFG-logo.png ${HDF5_DOXYGEN_DIR}/img/IOFlow2.gif ${HDF5_DOXYGEN_DIR}/img/IOFlow3.gif ${HDF5_DOXYGEN_DIR}/img/IOFlow.gif ${HDF5_DOXYGEN_DIR}/img/PaletteExample1.gif ${HDF5_DOXYGEN_DIR}/img/Palettes.fm.anc.gif") + set (DOXYGEN_HTML_EXTRA_FILES "${HDF5_DOXYGEN_DIR}/hdf5_navtree_hacks.js") set (DOXYGEN_TAG_FILE ${HDF5_BINARY_DIR}/hdf5.tag) set (DOXYGEN_SERVER_BASED_SEARCH NO) set (DOXYGEN_EXTERNAL_SEARCH NO) diff --git a/doxygen/Doxyfile.in b/doxygen/Doxyfile.in index 8c871de..0fba719 100644 --- a/doxygen/Doxyfile.in +++ b/doxygen/Doxyfile.in @@ -870,6 +870,7 @@ FILE_PATTERNS = H5*public.h \ H5FDsplitter.h \ H5FDstdio.h \ H5FDwindows.h \ + H5Tdevelop.h \ H5VLconnector.h \ H5VLconnector_passthru.h \ H5VLnative.h \ @@ -943,7 +944,7 @@ EXAMPLE_RECURSIVE = NO # that contain images that are to be included in the documentation (see the # \image command). -IMAGE_PATH = +IMAGE_PATH = @HDF5_DOXYGEN_DIR@/img # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program diff --git a/doxygen/aliases b/doxygen/aliases index 11fa691..3f40dff 100644 --- a/doxygen/aliases +++ b/doxygen/aliases @@ -264,8 +264,9 @@ ALIASES += ref_rfc20181220="Sparse Chunks" ALIASES += ref_rfc20180829="H5FD_MIRROR Virtual File Driver" ALIASES += ref_rfc20180815="Splitter_VFD" +ALIASES += ref_rfc20180712="Update to HDF5 References" ALIASES += ref_rfc20180620="Chunk query functionality in HDF5" -ALIASES += ref_rfc20180610="VFD SWMR" +ALIASES += ref_rfc20180610="VFD SWMR" ALIASES += ref_rfc20180321="API Contexts" ALIASES += ref_rfc20180125="Enhancement to the tool h5clear" ALIASES += ref_rfc20170707="H5Sencode/H5Sdecode Format Change" diff --git a/doxygen/dox/RFC.dox b/doxygen/dox/RFC.dox index c2562b0..f32be4f 100644 --- a/doxygen/dox/RFC.dox +++ b/doxygen/dox/RFC.dox @@ -14,6 +14,7 @@ 2018-08-30 \ref_rfc20180830 2018-08-29 \ref_rfc20180829 2018-08-15 \ref_rfc20180815 + 2018-07-12 \ref_rfc20180712 2018-06-20 \ref_rfc20180620 2018-06-10 \ref_rfc20180610 2018-03-21 \ref_rfc20180321 @@ -99,4 +100,4 @@ 2004-08-11 \ref_rfc20040811 -*/ \ No newline at end of file +*/ diff --git a/doxygen/dox/ReferenceManual.dox b/doxygen/dox/ReferenceManual.dox index cc0f99b..bc5a544 100644 --- a/doxygen/dox/ReferenceManual.dox +++ b/doxygen/dox/ReferenceManual.dox @@ -1,4 +1,4 @@ -/** \page RM Reference Manual +/** \page RM HDF5 Reference Manual The functions provided by the HDF5 C-API are grouped into the following \Emph{modules}: @@ -33,19 +33,26 @@ The functions provided by the HDF5 C-API are grouped into the following \li Functions with \ref ASYNC "asynchronous variants" \li \ref api-compat-macros \li Deprecated functions -\li High-level Extensions +\li \ref high_level -\ref H5 \ref H5A \ref H5D \ref H5E \ref H5ES \ref H5F \ref H5G \ref H5I \ref H5L +\a Core \a library: \ref H5 \ref H5A \ref H5D \ref H5E \ref H5ES \ref H5F \ref H5G \ref H5I \ref H5L \ref H5M \ref H5O \ref H5P \ref H5PL \ref H5R \ref H5S \ref H5T \ref H5VL \ref H5Z + + +\a High-level \a library: \ref H5LT \ref H5IM \ref H5TB \ref H5PT \ref H5DS \ref H5DO \ref H5LR + + @@ -86,4 +93,4 @@ Break a leg! pull request !\n See the \ref RMT for general guidance. -*/ \ No newline at end of file +*/ diff --git a/doxygen/dox/high_level/extension.dox b/doxygen/dox/high_level/extension.dox new file mode 100644 index 0000000..1481bdd --- /dev/null +++ b/doxygen/dox/high_level/extension.dox @@ -0,0 +1,657 @@ +/** \defgroup H5LR Extensions + * + * Working with region references, hyperslab selections, + * and bit-fields (H5LR, H5LT) + * + * The following reference manual entries describe high-level HDF5 C and Fortran APIs + * for working with region references, hyperslab selections, and bit-fields. + * These functions were created as part of a project supporting + * NPP/NPOESS Data Production and Exploitation ( + * + * project , + * + * software ). + * While they were written to facilitate access to NPP, NPOESS, and JPSS + * data in the HDF5 format, these functions may be useful to anyone working + * with region references, hyperslab selections, or bit-fields. + * + * Note that these functions are not part of the standard HDF5 distribution; + * the + * + * software + * must be separately downloaded and installed. + * + * A comprehensive guide to this library, + * + * User Guide to the HDF5 High-level Library for Handling Region References and Hyperslab Selections + * is available at + * https://support.hdfgroup.org/projects/jpss/documentation/HL/UG/NPOESS_HL-UG.pdf. + * + * - \ref H5LRcopy_reference + * \n Copies data from the specified dataset to a new location and + * creates a reference to it. + * - \ref H5LRcopy_region + * \n Copies data from a referenced region to a region in a + * destination dataset. + * - \ref H5LRcreate_ref_to_all + * \n Creates a dataset with the region references to the data in all + * datasets located under a specified group in a file or creates a + * dataset with object references to all objects (groups or datasets) + * located under a specified group in a file. + * - \ref H5LRcreate_region_references + * \n Creates an array of region references using an array of paths to + * datasets and an array of corresponding hyperslab descriptions. + * - \ref H5LRget_region_info + * \n Retrieves information about the data a region reference points to. + * - \ref H5LRmake_dataset + * \n Creates and writes a dataset containing a list of + * region references. + * - \ref H5LRread_region + * \n Retrieves raw data pointed to by a region reference to + * an application buffer. + * - \ref H5LTcopy_region + * \n Copies data from a specified region in a source dataset + * to a specified region in a destination dataset. + * - \ref H5LTread_bitfield_value + * \n Retrieves the values of quality flags for each element + * to the application provided buffer. + * - \ref H5LTread_region + * \n Reads selected data to an application buffer. + * . + */ + +/*------------------------------------------------------------------------- + * + * Make dataset functions + * + *------------------------------------------------------------------------- + */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5LR + * + * \brief Creates and writes a dataset containing a list of region references. + * + * \fgdta_loc_id + * \param[in] path Path to the dataset being created + * \param[in] type_id Datatype of the dataset + * \param[in] buf_size Size of the \p loc_id_ref and \p buf arrays + * \param[in] loc_id_ref Array of object identifiers; each identifier + * describes to which HDF5 file the corresponding + * region reference belongs to + * \param[in] buf Array of region references + * + * \return \herr_t + * + * \details Given an array of size \p buf_size of region references \p buf, + * the function will create a dataset with path \p path, at location + * specified by \p loc_id and of a datatype specified by \p type_id, + * and will write data associated with each region reference in the order + * corresponding to the order of the region references in the buffer. + * It is assumed that all referenced hyperslabs have the same dimensionality, + * and only the size of the slowest changing dimension may differ. + * Each reference in the \p buf array belongs to the file identified + * by the corresponding object identifiers in the array \p loc_id_ref. + * + * If \p path does not exist in \p loc_id then the function will + * create the path specified by \p path automatically. + * + * \version 1.1 Fortran wrapper introduced in this release. + * + * \since 1.0 + * + */ +H5_HLRDLL herr_t H5LRmake_dataset(hid_t loc_id, + const char *path, + hid_t type_id, const size_t buf_size, + const hid_t *loc_id_ref, + const hdset_reg_ref_t *buf); + +/*------------------------------------------------------------------------- + * + * Make and manipulate dataset region references functions + * + *------------------------------------------------------------------------- + */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5LR + * + * \brief Creates an array of region references using an array of paths to + * datasets and an array of corresponding hyperslab descriptions. + * + * \param[in] obj_id File identifier for the HDF5 file containing + * the referenced regions or an object identifier + * for any object in that file + * \param[in] num_elem Number of elements in the \p path and + * \p buf arrays + * \param[in] path Array of pointers to strings, which contain + * the paths to the target datasets for the + * region references + * \param[in] block_coord Array of hyperslab coordinate + * \param[out] buf Buffer for returning an array of region + * references + * + * \return \herr_t + * + * \note **Motivation:** + * \note H5LRcreate_region_references() is useful when creating + * large numbers of similar region references. + * + * \details H5LRcreate_region_references() creates a list of region references + * given an array of paths to datasets and another array listing the + * corner coordinates of the corresponding hyperslabs. + * + * \p path parameter is an array of pointers to strings. + * + * \p num_elem specifies the number of region references to be created, + * thus specifying the size of the \p path and \p _buf arrays. + * + * Buffer \p block_coord has size 2*rank and is the coordinates of the + * starting point following by the coordinates of the ending point of + * the hyperslab, repeated \p num_elem times for each hyperslab. + * For example, creating two region references to two hyperslabs, + * one with a rectangular hyperslab region starting at element (2,2) + * to element (5,4) and the second rectangular region starting at + * element (7,7) to element (9,10), results in \p block_coord + * being {2,2,5,4, 7,7,9,10}. + * + * The rank of the hyperslab will be the same as the rank of the + * target dataset. H5LRcreate_region_references() will retrieve + * the rank for each dataset and will use those values to interpret + * the values in the buffer. Please note that rank may vary from one + * dataset to another. + * + * \version 1.1 Fortran wrapper introduced in this release. + * + * \since 1.0 + * + */ +H5_HLRDLL herr_t H5LRcreate_region_references(hid_t obj_id, + size_t num_elem, + const char **path, + const hsize_t *block_coord, + hdset_reg_ref_t *buf); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5LR + * + * \brief Copies data from the specified dataset to a new location and + * creates a reference to it. + * + * \param[in] obj_id Identifier of any object in a file an + * HDF5 reference belongs to + * \param[in] ref Reference to the datasets region + * \param[in] file Name of the destination file + * \param[in] path Full path to the destination dataset + * \param[in] block_coord Hyperslab coordinates in the destination + * dataset + * \param[out] ref_new Region reference to the new location of + * data + * + * \return \herr_t + * + * \details Given a data set pointed to by a region reference, the function + * H5LRcopy_reference() will copy the hyperslab data referenced by + * a datasets region reference into existing dataset specified by + * its path \p path in the file with the name \p file, and to location + * specified by the hyperslab coordinates \p block_coord. It will + * create the region reference \p ref_new to point to the new location. + * The number of elements in the old and newly specified regions has + * to be the same. + * + * Buffer \p block_coord has size 2*rank and is the coordinates of + * the starting point following by the coordinates of the ending + * point of the hyperslab. For example, to extract a rectangular + * hyperslab region starting at element (2,2) to element (5,4) + * then \p block_coord would be {2, 2, 5, 4}. + * + * \version 1.1 Fortran wrapper introduced in this release. + * + * \since 1.0 + * + */ +H5_HLRDLL herr_t H5LRcopy_reference(hid_t obj_id, hdset_reg_ref_t *ref, const char *file, + const char *path, const hsize_t *block_coord, + hdset_reg_ref_t *ref_new); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5LR + * + * \brief Copies data from a referenced region to a region in a + * destination dataset. + * + * \param[in] obj_id Identifier of any object in a file + * dataset region reference belongs to + * \param[in] ref Dataset region reference + * \param[in] file Name of the destination file + * \param[in] path Full path to the destination dataset + * \param[in] block_coord Hyperslab coordinates in the destination + * dataset + * + * \return \herr_t + * + * \details Given a dataset region reference \p ref in a source file + * specified by an identifier of any object in that file + * \p obj_id, the function will write data to the existing + * dataset \p path in file \p file to the simple hyperslab + * specified by \p block_coord. + * + * Buffer \p block_coord has size 2*rank and is the coordinates + * of the starting point following by the coordinates of the + * ending point of the hyperslab. For example, to specify a + * rectangular hyperslab destination region starting at element + * (2,2) to element (5,4) then \p block_coord would be {2, 2, 5, 4}. + * + * If \p path does not exist in the destination file (as may be + * the case when writing to a new file) then the dataset will be + * copied directly to the \p path and \p block_coord will be + * disregarded. + * + * \version 1.1 Fortran wrapper introduced in this release. + * + * \since 1.0 + * + */ +H5_HLRDLL herr_t H5LRcopy_region(hid_t obj_id, + hdset_reg_ref_t *ref, + const char *file, + const char *path, + const hsize_t *block_coord); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5LR + * + * \brief Creates a dataset with the region references to the data + * in all datasets located under a specified group in a file + * or creates a dataset with object references to all objects + * (groups or datasets) located under a specified group in a file. + * + * \fg_loc_id + * \param[in] group_path Absolute or relative path to the group + * at which traversal starts + * \param[in] ds_path Absolute or relative path to the dataset + * with region references to be created + * \param[in] index_type Index_type; + * see valid values below in description + * \param[in] order Order in which index is traversed; + * see valid values below in description + * \param[in] ref_type Reference type; + * see valid values below in description + * + * \return \herr_t + * + * \details H5LRcreate_ref_to_all() creates a dataset with the + * region references to the data in all datasets located + * under a specified group in a file or creates a dataset with + * object references to all objects (groups or datasets) located + * under a specified group in a file. + * + * Given a dataset path \p ds_path in a file specified by the + * \p loc_id identifier, the function H5LRcreate_ref_to_all() + * will create a contiguous one-dimensional dataset with the + * region references or object references depending on the value + * of the \p ref_type parameter. When \p ref_type is + * #H5R_DATASET_REGION, each region reference points to all data + * in a dataset encountered by an internally called H5Lvisit() + * routine, which starts at the group specified by the \p loc_id + * and \p group_path parameters. In a like manner, when + * \p ref_type is #H5R_OBJECT, each object reference points to + * an object (a group or a dataset) encountered by H5Lvisit(). + * + * If \p ds_path does not exist in \p loc_id then the function + * will create the path specified by \p ds_path automatically. + * + * \p index_type specifies the index to be used. + * Valid values include the following: + * - #H5_INDEX_NAME Alphanumeric index on name + * - #H5_INDEX_CRT_ORDER Index on creation order + * . + * + * \p order specifies the order in which objects are to be + * inspected along the index specified in \p index_type. + * Valid values include the following: + * - #H5_ITER_INC Increasing order + * - #H5_ITER_DEC Decreasing order + * - #H5_ITER_NATIVE Fastest available order + * . + * + * For more detailed information on these two parameters, + * see H5Lvisit(). + * + * \p ref_type specifies the type of the reference to be used. + * Valid values include the following: + * - #H5R_DATASET_REGION Dataset region reference + * - #H5R_OBJECT Object reference + * . + * + * \version 1.1 Fortran wrapper introduced in this release. + * + * \since 1.0 + * + */ +H5_HLRDLL herr_t H5LRcreate_ref_to_all(hid_t loc_id, const char *group_path, + const char *ds_path, H5_index_t index_type, H5_iter_order_t order, H5R_type_t ref_type); + +/*------------------------------------------------------------------------- + * + * Read dataset functions + * + *------------------------------------------------------------------------- + */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5LR + * + * \brief Retrieves raw data pointed to by a region reference + * to an application buffer. + * + * \param[in] obj_id File identifier for the HDF5 file containing + * the dataset with the referenced region or an + * object identifier for any object in that file + * \param[in] ref Region reference specifying data to be read + * in + * \param[in] mem_type Memory datatype of data read from referenced + * region into the application buffer + * \param[in,out] numelem Number of elements to be read into buffer + * \p buf + * \param[out] buf Buffer in which data is returned to the + * application + * + * \return \herr_t + * + * \details H5LRread_region() reads data pointed to by the region + * reference \p ref into the buffer \p buf. + * + * \p numelem specifies the number of elements to be read + * into \p buf. When the size of the reference region is unknown, + * H5LRread_region() can be called with \p buf set to NULL; + * the number of elements in the referenced region will be returned + * in \p numelem. + * + * The buffer buf must be big enough to hold \p numelem elements + * of type \p mem_type. For example, if data is read from the referenced + * region into an integer buffer, \p mem_type should be #H5T_NATIVE_INT + * and the buffer must be at least \c sizeof(int) * \p numelem bytes + * in size. This buffer must be allocated by the application. + * + * \version 1.1 Fortran wrapper introduced in this release. + * + * \since 1.0 + * + */ +H5_HLRDLL herr_t H5LRread_region(hid_t obj_id, + const hdset_reg_ref_t *ref, + hid_t mem_type, + size_t *numelem, + void *buf ); + +/*------------------------------------------------------------------------- + * + * Query dataset functions + * + *------------------------------------------------------------------------- + */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5LR + * + * \brief Retrieves information about the data a region reference + * points to. + * + * \param[in] obj_id Identifier of any object in an HDF5 file + * the region reference belongs to. + * \param[in] ref Region reference to query + * \param[in,out] len Size of the buffer to store \p path in. + * NOTE: if \p *path is not NULL then \p *len + * must be the appropriate length + * \param[out] path Full path that a region reference points to + * \param[out] rank The number of dimensions of the dataset + * dimensions of the dataset pointed by + * region reference. + * \param[out] dtype Datatype of the dataset pointed by the + * region reference. + * \param[out] sel_type Type of the selection (point or hyperslab) + * \param[in,out] numelem Number of coordinate blocks or + * selected elements. + * \param[out] buf Buffer containing description of the region + * pointed by region reference + * + * \return \herr_t + * + * \details H5LRget_region_info() queries information about the data + * pointed by a region reference \p ref. It returns one of the + * absolute paths to a dataset, length of the path, dataset’s rank + * and datatype, description of the referenced region and type of + * the referenced region. Any output argument can be NULL if that + * argument does not need to be returned. + * + * The parameter \p obj_id is an identifier for any object in the + * HDF5 file containing the referenced object. For example, it can + * be an identifier of a dataset the region reference belongs to + * or an identifier of an HDF5 file the dataset with region references + * is stored in. + * + * The parameter \p ref is a region reference to query. + * + * The parameter \p path is a pointer to application allocated + * buffer of size \p len+1 to return an absolute path to a dataset + * the region reference points to. + * + * The parameter \p len is a length of absolute path string plus + * the \0 string terminator. If path parameter is NULL, actual + * length of the path (+1 for \0 string terminator) is returned to + * application and can be used to allocate buffer path of an + * appropriate length \p len. + * + * The parameter \p sel_type describes the type of the selected + * region. Possible values can be #H5S_SEL_POINTS for point + * selection and #H5S_SEL_HYPERSLABS for hyperslab selection. + * + * The parameter \p numelem describes how many elements will be + * placed in the buffer \p buf. The number should be interpreted + * using the value of \p sel_type. + * + * If value of \p sel_type is #H5S_SEL_HYPERSLABS, the parameter + * \p buf contains \p numelem blocks of the coordinates for each + * simple hyperslab of the referenced region. Each block has + * length \c 2*\p rank and is organized as follows: <"start" coordinate>, + * immediately followed by <"opposite" corner coordinate>. + * The total size of the buffer to hold the description of the + * region will be \c 2*\p rank*\p numelem. If region reference + * points to a contiguous sub-array, then the value of \p numelem + * is 1 and the block contains coordinates of the upper left and + * lower right corners of the sub-array (or simple hyperslab). + * + * If value of \p sel_type is #H5S_SEL_POINTS, the parameter \p buf + * contains \p numelem blocks of the coordinates for each selected + * point of the referenced region. Each block has length \p rank + * and contains coordinates of the element. The total size of the + * buffer to hold the description of the region will be + * \p rank* \p numelem. + * + * + * \version 1.1 Fortran wrapper introduced in this release. + * + * \since 1.0 + * + */ +H5_HLRDLL herr_t H5LRget_region_info(hid_t obj_id, + const hdset_reg_ref_t *ref, + size_t *len, + char *path, + int *rank, + hid_t *dtype, + H5S_sel_type *sel_type, + size_t *numelem, + hsize_t *buf ); + + + +/*------------------------------------------------------------------------- + * + * Make dataset functions + * + *------------------------------------------------------------------------- + */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5LR + * + * \brief Copies data from a specified region in a source dataset + * to a specified region in a destination dataset + * + * \param[in] file_src Name of the source file + * \param[in] path_src Full path to the source dataset + * \param[in] block_coord_src Hyperslab coordinates in the + * source dataset + * \param[in] file_dest Name of the destination file + * \param[in] path_dest Full path to the destination dataset + * \param[in] block_coord_dset Hyperslab coordinates in the + * destination dataset + * + * \return \herr_t + * + * \details Given a path to a dataset \p path_src in a file with the + * name \p file_src, and description of a simple hyperslab of + * the source \p block_coord_src, the function will write data + * to the dataset \p path_dest in file \p file_dest to the + * simple hyperslab specified by \p block_coord_dset. + * The arrays \p block_coord_src and \p block_coord_dset have + * a length of 2*rank and are the coordinates of the starting + * point following by the coordinates of the ending point of the + * hyperslab. For example, to specify a rectangular hyperslab + * destination region starting at element (2,2) to element (5,4) + * then \p block_coord_dset would be {2, 2, 5, 4}. + * + * If \p path_dest does not exist in the destination file + * (as may be the case when writing to a new file) then the + * dataset will be copied directly to the \p path_dest and + * \p block_coord_dset will be disregarded. + * + * \version 1.1 Fortran wrapper introduced in this release. + * + * \since 1.0 + * + */ +H5_HLRDLL herr_t H5LTcopy_region(const char *file_src, + const char *path_src, + const hsize_t *block_coord_src, + const char *file_dest, + const char *path_dest, + const hsize_t *block_coord_dset); + +/*------------------------------------------------------------------------- + * + * Read dataset functions + * + *------------------------------------------------------------------------- + */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5LR + * + * \brief Reads selected data to an application buffer. + * + * \param[in] file Name of file + * \param[in] path Full path to a dataset + * \param[in] block_coord Hyperslab coordinates + * \param[in] mem_type Memory datatype, describing the buffer + * the referenced data will be read into + * \param[out] buf Buffer containing data from the + * referenced region + * + * \return \herr_t + * + * \details H5LTread_region() reads data from a region described by + * the hyperslab coordinates in \p block_coord, located in + * the dataset specified by its absolute path \p path in a + * file specified by its name \p file. Data is read into a + * buffer \p buf of the datatype that corresponds to the + * HDF5 datatype specified by \p mem_type. + * + * Buffer \p block_coord has size 2*rank and is the coordinates + * of the starting point following by the coordinates of the + * ending point of the hyperslab. For example, to extract a + * rectangular hyperslab region starting at element (2,2) to + * element (5,4) then \p block_coord would be {2, 2, 5, 4}. + * + * Buffer \p buf should be big enough to hold selected elements + * of the type that corresponds to the \p mem_type + * + * \version 1.1 Fortran wrapper introduced in this release. + * + * \since 1.0 + * + */ +H5_HLRDLL herr_t H5LTread_region(const char *file, + const char *path, + const hsize_t *block_coord, + hid_t mem_type, + void *buf ); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5LR + * + * \brief Retrieves the values of quality flags for each element + * to the application provided buffer. + * + * \param[in] dset_id Identifier of the dataset with bit-field values + * \param[in] num_values Number of the values to be extracted + * \param[in] offset Array of staring bits to be extracted from + * the element; valid values: 0 (zero) through 7 + * \param[in] lengths Array of the number of bits to be extracted + * for each value + * \param[in] space Dataspace identifier, describing the elements + * to be read from the dataset with bit-field + * values + * \param[out] buf Buffer to read the values in + * + * \return \herr_t + * + * \details H5LTread_bitfield_value() reads selected elements from a + * dataset specified by its identifier \p dset_id, and unpacks + * the bit-field values to a buffer \p buf. + * + * The parameter \p space is a space identifier that indicates + * which elements of the dataset should be read. + * + * The parameter \p offset is an array of length \p num_values; + * the ith element of the array holds the value of the + * starting bit of the ith bit-field value. + * Valid values are: 0 (zero) through 7. + * + * The parameter \p lengths is an array of length \p num_values; + * the ith element of the array holds the number of + * bits to be extracted for the ith bit-field value. + * Extracted bits will be interpreted as a base-2 integer value. + * Each value will be converted to the base-10 integer value and + * stored in the application buffer. + * + * Buffer \p buf is allocated by the application and should be big + * enough to hold \c num_sel_elem * \p num_values elements of the + * specified type, where \c num_sel_elem is a number of the elements + * to be read from the dataset. Data in the buffer is organized + * as \p num_values values for the first element, followed by the + * \p num_values values for the second element, ... , followed by + * the \p num_values values for the + * \c num_selected_elemth element. + * + * \version 1.1 Fortran wrapper introduced in this release. + * + * \since 1.0 + * + */ +H5_HLRDLL herr_t H5LTread_bitfield_value(hid_t dset_id, int num_values, const unsigned *offset, + const unsigned *lengths, hid_t space, int *buf); + diff --git a/doxygen/dox/high_level/high_level.dox b/doxygen/dox/high_level/high_level.dox new file mode 100644 index 0000000..c53d298 --- /dev/null +++ b/doxygen/dox/high_level/high_level.dox @@ -0,0 +1,29 @@ +/** \page high_level High-level library + * The high-level HDF5 library includes several sets of convenience and standard-use APIs to + * facilitate common HDF5 operations. + * + *
    + *
  • \ref H5LT "Lite (H5LT, H5LD)" + * \n + * Functions to simplify creating and manipulating datasets, attributes and other features + *
  • \ref H5IM "Image (H5IM)" + * \n + * Creating and manipulating HDF5 datasets intended to be interpreted as images + *
  • \ref H5TB "Table (H5TB)" + * \n + * Creating and manipulating HDF5 datasets intended to be interpreted as tables + *
  • \ref H5PT "Packet Table (H5PT)" + * \n + * Creating and manipulating HDF5 datasets to support append- and read-only operations on table data + *
  • \ref H5DS "Dimension Scale (H5DS)" + * \n + * Creating and manipulating HDF5 datasets that are associated with the dimension of another HDF5 dataset + *
  • \ref H5DO "Optimizations (H5DO)" + * \n + * Bypassing default HDF5 behavior in order to optimize for specific use cases + *
  • \ref H5LR "Extensions (H5LR, H5LT)" + * \n + * Working with region references, hyperslab selections, and bit-fields + *
+ * + */ diff --git a/doxygen/examples/H5DO_examples.c b/doxygen/examples/H5DO_examples.c new file mode 100644 index 0000000..7a33c6b --- /dev/null +++ b/doxygen/examples/H5DO_examples.c @@ -0,0 +1,220 @@ +/* -*- c-file-style: "stroustrup" -*- */ + +//! + +#include +#include +#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s)) * 1.001) + 12) + : + : +size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); + const Bytef *z_src = (const Bytef *)(direct_buf); + Bytef * z_dst; /* Destination buffer */ + uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); + uLong z_src_nbytes = (uLong)buf_size; + int aggression = 9; /* Compression aggression setting */ + uint32_t filter_mask = 0; + size_t buf_size = CHUNK_NX * CHUNK_NY * sizeof(int); + + /* Create the data space */ + if ((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) + goto error; + + /* Create a new file */ + if ((file = H5Fcreate(FILE_NAME5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + /* Modify dataset creation properties, i.e. enable chunking and compression */ + if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + + if ((status = H5Pset_chunk(cparms, RANK, chunk_dims)) < 0) + goto error; + + if ((status = H5Pset_deflate(cparms, aggression)) < 0) + goto error; + + /* Create a new dataset within the file using cparms creation properties */ + if ((dset_id = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms, + H5P_DEFAULT)) < 0) + goto error; + + /* Initialize data for one chunk */ + for (i = n = 0; i < CHUNK_NX; i++) + for (j = 0; j < CHUNK_NY; j++) + direct_buf[i][j] = n++; + + /* Allocate output (compressed) buffer */ + outbuf = malloc(z_dst_nbytes); + z_dst = (Bytef *)outbuf; + + /* Perform compression from the source to the destination buffer */ + ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression); + + /* Check for various zlib errors */ + if (Z_BUF_ERROR == ret) { + fprintf(stderr, "overflow"); + goto error; + } + else if (Z_MEM_ERROR == ret) { + fprintf(stderr, "deflate memory error"); + goto error; + } + else if (Z_OK != ret) { + fprintf(stderr, "other deflate error"); + goto error; + } + + /* Write the compressed chunk data repeatedly to cover all the + * * chunks in the dataset, using the direct write function. */ + for (i = 0; i < NX / CHUNK_NX; i++) { + for (j = 0; j < NY / CHUNK_NY; j++) { + status = + H5DOwrite_chunk(dset_id, H5P_DEFAULT, filter_mask, offset, z_dst_nbytes, outbuf); + offset[1] += CHUNK_NY; + } + offset[0] += CHUNK_NX; + offset[1] = 0; + } + + /* Overwrite the first chunk with uncompressed data. Set the filter mask to + * * indicate the compression filter is skipped */ + filter_mask = 0x00000001; + offset[0] = offset[1] = 0; + if (H5DOwrite_chunk(dset_id, H5P_DEFAULT, filter_mask, offset, buf_size, direct_buf) < 0) + goto error; + + /* Read the entire dataset back for data verification converting ints to longs */ + if (H5Dread(dataset, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, outbuf_long) < 0) + goto error; + + /* Data verification here */ + : + : + + //! + + //! + +#include +#include +#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s)) * 1.001) + 12) + : + : +size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); + const Bytef *z_src = (const Bytef *)(direct_buf); + Bytef * z_dst; /* Destination buffer */ + uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); + uLong z_src_nbytes = (uLong)buf_size; + int aggression = 9; /* Compression aggression setting */ + uint32_t filter_mask = 0; + size_t buf_size = CHUNK_NX * CHUNK_NY * sizeof(int); + /* For H5DOread_chunk() */ + void * readbuf = NULL; /* Buffer for reading data */ + const Bytef *pt_readbuf; /* Point to the buffer for data read */ + hsize_t read_chunk_nbytes; /* Size of chunk on disk */ + int read_dst_buf[CHUNK_NX][CHUNK_NY]; /* Buffer to hold un-compressed data */ + + /* Create the data space */ + if ((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) + goto error; + + /* Create a new file */ + if ((file = H5Fcreate(FILE_NAME5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + /* Modify dataset creation properties, i.e. enable chunking and compression */ + if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + + if ((status = H5Pset_chunk(cparms, RANK, chunk_dims)) < 0) + goto error; + + if ((status = H5Pset_deflate(cparms, aggression)) < 0) + goto error; + + /* Create a new dataset within the file using cparms creation properties */ + if ((dset_id = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms, + H5P_DEFAULT)) < 0) + goto error; + + /* Initialize data for one chunk */ + for (i = n = 0; i < CHUNK_NX; i++) + for (j = 0; j < CHUNK_NY; j++) + direct_buf[i][j] = n++; + + /* Allocate output (compressed) buffer */ + outbuf = malloc(z_dst_nbytes); + z_dst = (Bytef *)outbuf; + + /* Perform compression from the source to the destination buffer */ + ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression); + + /* Check for various zlib errors */ + if (Z_BUF_ERROR == ret) { + fprintf(stderr, "overflow"); + goto error; + } + else if (Z_MEM_ERROR == ret) { + fprintf(stderr, "deflate memory error"); + goto error; + } + else if (Z_OK != ret) { + fprintf(stderr, "other deflate error"); + goto error; + } + + /* Write the compressed chunk data repeatedly to cover all the + * * chunks in the dataset, using the direct write function. */ + for (i = 0; i < NX / CHUNK_NX; i++) { + for (j = 0; j < NY / CHUNK_NY; j++) { + status = H5DOwrite_chunk(dset_id, H5P_DEFAULT, filter_mask, offset, z_dst_nbytes, outbuf); + offset[1] += CHUNK_NY; + } + offset[0] += CHUNK_NX; + offset[1] = 0; + } + + if (H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0) + goto error; + + if (H5Dclose(dataset) < 0) + goto error; + + if ((dataset = H5Dopen2(file, DATASETNAME1, H5P_DEFAULT)) < 0) + goto error; + + offset[0] = CHUNK_NX; + offset[1] = CHUNK_NY; + + /* Get the size of the compressed chunk */ + ret = H5Dget_chunk_storage_size(dataset, offset, &read_chunk_nbytes); + + readbuf = HDmalloc(read_chunk_nbytes); + pt_readbuf = (const Bytef *)readbuf; + + /* Use H5DOread_chunk() to read the chunk back */ + if ((status = H5DOread_chunk(dataset, H5P_DEFAULT, offset, &read_filter_mask, readbuf)) < 0) + goto error; + + ret = + uncompress((Bytef *)read_dst_buf, (uLongf *)&buf_size, pt_readbuf, (uLong)read_chunk_nbytes); + + /* Check for various zlib errors */ + if (Z_BUF_ERROR == ret) { + fprintf(stderr, "error: not enough room in output buffer"); + goto error; + } + else if (Z_MEM_ERROR == ret) { + fprintf(stderr, "error: not enough memory"); + goto error; + } + else if (Z_OK != ret) { + fprintf(stderr, "error: corrupted input data"); + goto error; + } + + /* Data verification here */ + : + : +//! diff --git a/doxygen/examples/H5LDget_dset_elmts.c b/doxygen/examples/H5LDget_dset_elmts.c new file mode 100644 index 0000000..e23299a --- /dev/null +++ b/doxygen/examples/H5LDget_dset_elmts.c @@ -0,0 +1,143 @@ +/* -*- c-file-style: "stroustrup" -*- */ + +//! + +DATASET "DSET1" {DATATYPE H5T_STD_I32LE DATASPACE SIMPLE{(4, 13) / (60, 100)} : : } + +//! + +//! + +/* open the HDF5 file */ +fid = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT); + +/* open the dataset */ +did = H5Dopen2(fid, "DSET1", H5P_DEFAULT); + : + : + /* define hsize_t dims[2]; */ + /* define hsize_t new_dims[2]; */ + /* get the dataset's current dimension sizes */ + H5LDget_dset_dims(did, dims); + + /* extend the dataset by 2 */ + new_dims[0] = dims[0] + 2; + new_dims[1] = dims[1] + 2; + H5Dset_extent(did, new_dims) + + /* write data to the extended dataset */ + : : + /* get the size of the dataset's data type */ + type_size = H5LDget_dset_type_size(did, NULL); + : + : + /* allocate buffer for storing selected data elements from the dataset */ + /* calculate # of selected elements from dims & new_dims */ + /* buffer size = type_size * number of selected elements */ + : + : + /* read the selected elements from the dataset into buf */ + H5LDget_dset_elmts(did, dims, new_dims, NULL, buf); + : + : + H5Dclose(did); + H5Fclose(fid); + + //! + + //! + + data for elements (0, 13), (0, 14) + data for elements (1, 13), (1, 14) + data for elements (2, 13), (2, 14) + data for elements (3, 13), (3, 14) + data for elements (4, 0), (4, 1), (4, 2)......................(4, 13), (4, 14) + data for elements (5, 0), (5, 1), (5, 2)......................(5, 13), (5, 14) + +//! + + +//! + + DATASET "DSET2" { + DATATYPE H5T_COMPOUND { + H5T_STD_I32LE "a"; + H5T_STD_I32LE "b"; + H5T_ARRAY + { + [4] H5T_STD_I32LE + } + "c"; + H5T_STD_I32LE "d"; + H5T_STD_I32LE "e"; + H5T_COMPOUND + { + H5T_STD_I32LE "a"; + H5T_STD_I32LE "b"; + H5T_ARRAY + { + [4] H5T_STD_I32LE + } + "c"; + H5T_STD_I32LE "d"; + H5T_STD_I32LE "e"; + } + "s2"; + } + DATASPACE SIMPLE + { + (5) / (5) + } + :: + } + + //! + + //! + + /* open the HDF5 file */ + fid = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT); + + /* open the dataset */ + did = H5Dopen2(fid, "DSET2", H5P_DEFAULT); + + /* define hsize_t dims[1]; */ + /* define hsize_t new_dims[1]; */ + : + : + /* get the dataset's current dimension size */ + H5LDget_dset_dims(did, dims); + + /* extend the dataset by 2 */ + new_dims[0] = dims[0] + 2; + H5Dset_extent(did, new_dims); + : + : + /* write data to the extended part of the dataset */ + : + : + /* #define fields "d,s2.c" */ + /* get the size of the dataset's data type for the selected fields */ + type_size = H5LDget_dset_type_size(did, fields); + : + : + /* allocate buffer for storing selected data elements from the dataset */ + /* calculate # of selected elements from dims & new_dims */ + /* buffer size = type_size * number of selected elements */ + : + : + /* read the selected elements from the dataset into buf */ + H5LD_get_dset_elmts(did, dims, new_dims, fields, buf); + : + : + H5Dclose(did); + H5Fclose(fid); + + //! + + //! + + Data for element (5): integer value for "d", 4 integer values for array "s2.c" + Data for element (6): integer value for "d", 4 integer values for array "s2.c" + +//! diff --git a/doxygen/examples/H5LT_examples.c b/doxygen/examples/H5LT_examples.c new file mode 100644 index 0000000..5ed4c29 --- /dev/null +++ b/doxygen/examples/H5LT_examples.c @@ -0,0 +1,27 @@ +/* -*- c-file-style: "stroustrup" -*- */ + +//! + +H5T_class_t type_class; +size_t type_size; +hsize_t dims[0]; +... status = H5LTget_attribute_info(file_id, "/", STRNAME, dims, &type_class, &type_size); +if (type_class == H5T_STRING) { + printf("Attribute is a string.\n"); + printf("String size: %i\n", type_size); + + //! + + //! + + “H5T_ENUM + { + H5T_NATIVE_INT; + “Bob” 0; + “Elena” 1; + “Quincey” 2; + “Frank” 3; + } + ” + +//! diff --git a/doxygen/examples/H5TBAget_fill.c b/doxygen/examples/H5TBAget_fill.c new file mode 100644 index 0000000..15eae8b --- /dev/null +++ b/doxygen/examples/H5TBAget_fill.c @@ -0,0 +1,43 @@ +unsigned char tmp_fill_buf[40]; +... + + file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); +dataset_id = H5Dopen(file_id, TABLE_NAME, H5P_DEFAULT); +datatype_id = H5Dget_type(dataset_id); + +status = H5TBget_table_info(file_id, TABLE_NAME, &nfields, &nrecords); + +hasfill = H5TBAget_fill(file_id, TABLE_NAME, dataset_id, tmp_fill_buf); + +for (i = 0; i < nfields; i++) { + member_type_id = H5Tget_member_type(datatype_id, (unsigned)i); + native_mem_type_id = H5Tget_native_type(member_type_id, H5T_DIR_ASCEND); + member_offset = H5Tget_member_offset(datatype_id, (unsigned)i); + printf("member_offset: %i\n", member_offset); + memb_class = H5Tget_class(member_type_id); + switch (memb_class) { + case H5T_INTEGER: + /* convert unsigned char array to integer */ + break; + case H5T_FLOAT: + /* convert unsigned char array to double or float */ + + if (H5Tequal(native_mem_type_id, H5T_NATIVE_DOUBLE)) { + } + else if (H5Tequal(native_mem_type_id, H5T_NATIVE_FLOAT)) { + f.i = tmp_fill_buf[member_offset] | (tmp_fill_buf[member_offset + 1] << 8) | + (tmp_fill_buf[member_offset + 2] << 16) | (tmp_fill_buf[member_offset + 3] << 24); + printf("Field %i Fill Value: %lf\n", i, f.f); + } + break; + + case H5T_STRING: + /* convert unsigned char array to string */ + strsize = H5Tget_size(member_type_id); + + printf("Field %i Fill Value: ", i); + for (j = 0; j < strsize; j++) + printf("%c", tmp_fill_buf[member_offset + j]); + printf("\n"); + break; + } diff --git a/examples/testh5cc.sh.in b/examples/testh5cc.sh.in index a8974bf..0018bc5 100644 --- a/examples/testh5cc.sh.in +++ b/examples/testh5cc.sh.in @@ -401,7 +401,7 @@ echo "***"Version compatibility tests. # else if H5_USE_16_API_DEFAULT; # then v16main works. # else v18main works and -DH5_USE_16_API_DEFAULT v16main also works. -# as new versions with versioned functions are added, they will work with and +# As new versions with versioned functions are added, they will work with and # should be added to H5_NO_DEPRECATED_SYMBOLS and to the else section, with and # without the -DH5_USE__API_DEFAULT flag. A new H5_USE__API_DEFAULT section # should also be added. diff --git a/fortran/test/tH5O_F03.F90 b/fortran/test/tH5O_F03.F90 index 2f9bcad..e8f7c96 100644 --- a/fortran/test/tH5O_F03.F90 +++ b/fortran/test/tH5O_F03.F90 @@ -209,7 +209,6 @@ CONTAINS ! Since the name is generated in C and passed to a Fortran string, it ! will be NULL terminated, so we need to find the end of the string. - len = 1 DO len = 1, 180 IF(name(len) .EQ. C_NULL_CHAR) EXIT ENDDO diff --git a/hl/c++/src/H5PacketTable.h b/hl/c++/src/H5PacketTable.h index c1f1eb5..e395e5a 100644 --- a/hl/c++/src/H5PacketTable.h +++ b/hl/c++/src/H5PacketTable.h @@ -163,7 +163,7 @@ class H5_HLCPPDLL FL_PacketTable : virtual public PacketTable { /* Destructor * Cleans up the packet table */ - virtual ~FL_PacketTable() + ~FL_PacketTable() override { } diff --git a/hl/src/H5DOpublic.h b/hl/src/H5DOpublic.h index 88616a3..99358b3 100644 --- a/hl/src/H5DOpublic.h +++ b/hl/src/H5DOpublic.h @@ -18,6 +18,29 @@ extern "C" { #endif +/**\defgroup H5DO Optimizations + * + * Bypassing default HDF5 behavior in order to optimize for specific + * use cases (H5DO) + * + * HDF5 functions described is this section are implemented in the HDF5 High-level + * library as optimized functions. These functions generally require careful setup + * and testing as they enable an application to bypass portions of the HDF5 + * library’s I/O pipeline for performance purposes. + * + * These functions are distributed in the standard HDF5 distribution and are + * available any time the HDF5 High-level library is available. + * + * - \ref H5DOappend + * \n Appends data to a dataset along a specified dimension. + * - \ref H5DOread_chunk + * \n Reads a raw data chunk directly from a dataset in a file into a buffer (DEPRECATED) + * - \ref H5DOwrite_chunk + * \n Writes a raw data chunk from a buffer directly to a dataset in a file (DEPRECATED) + * . + * + */ + /*------------------------------------------------------------------------- * * "Optimized dataset" routines. @@ -25,6 +48,48 @@ extern "C" { *------------------------------------------------------------------------- */ +/** + * -------------------------------------------------------------------------- + * \ingroup H5DO + * + * \brief Appends data to a dataset along a specified dimension. + * + * \param[in] dset_id Dataset identifier + * \param[in] dxpl_id Dataset transfer property list identifier + * \param[in] axis Dataset Dimension (0-based) for the append + * \param[in] extension Number of elements to append for the + * axis-th dimension + * \param[in] memtype The memory datatype identifier + * \param[in] buf Buffer with data for the append + * + * \return \herr_t + * + * \details The H5DOappend() routine extends a dataset by \p extension + * number of elements along a dimension specified by a + * dimension \p axis and writes \p buf of elements to the + * dataset. Dimension \p axis is 0-based. Elements’ type + * is described by \p memtype. + * + * This routine combines calling H5Dset_extent(), + * H5Sselect_hyperslab(), and H5Dwrite() into a single routine + * that simplifies application development for the common case + * of appending elements to an existing dataset. + * + * For a multi-dimensional dataset, appending to one dimension + * will write a contiguous hyperslab over the other dimensions. + * For example, if a 3-D dataset has dimension sizes (3, 5, 8), + * extending the 0th dimension (currently of size 3) by 3 will + * append 3*5*8 = 120 elements (which must be pointed to by the + * \p buffer parameter) to the dataset, making its final + * dimension sizes (6, 5, 8). + * + * If a dataset has more than one unlimited dimension, any of + * those dimensions may be appended to, although only along + * one dimension per call to H5DOappend(). + * + * \since 1.10.0 + * + */ H5_HLDLL herr_t H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension, hid_t memtype, const void *buf); @@ -35,8 +100,142 @@ H5_HLDLL herr_t H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t e #ifndef H5_NO_DEPRECATED_SYMBOLS /* Compatibility wrappers for functionality moved to H5D */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5DO + * + * \brief Writes a raw data chunk from a buffer directly to a dataset in a file. + * + * \param[in] dset_id Identifier for the dataset to write to + * \param[in] dxpl_id Transfer property list identifier for + * this I/O operation + * \param[in] filters Mask for identifying the filters in use + * \param[in] offset Logical position of the chunk’s first element + * in the dataspace + * \param[in] data_size Size of the actual data to be written in bytes + * \param[in] buf Buffer containing data to be written to the chunk + * + * \return \herr_t + * + * \deprecated This function was deprecated in favor of the function + * H5Dwrite_chunk() of HDF5-1.10.3. + * The functionality of H5DOwrite_chunk() was moved + * to H5Dwrite_chunk(). + * \deprecated For compatibility, this API call has been left as a stub which + * simply calls H5Dwrite_chunk(). New code should use H5Dwrite_chunk(). + * + * \details The H5DOwrite_chunk() writes a raw data chunk as specified by its + * logical \p offset in a chunked dataset \p dset_id from the application + * memory buffer \p buf to the dataset in the file. Typically, the data + * in \p buf is preprocessed in memory by a custom transformation, such as + * compression. The chunk will bypass the library’s internal data + * transfer pipeline, including filters, and will be written directly to the file. + * + * \p dxpl_id is a data transfer property list identifier. + * + * \p filters is a mask providing a record of which filters are used + * with the chunk. The default value of the mask is zero (\c 0), + * indicating that all enabled filters are applied. A filter is skipped + * if the bit corresponding to the filter’s position in the pipeline + * (0 ≤ position < 32) is turned on. This mask is saved + * with the chunk in the file. + * + * \p offset is an array specifying the logical position of the first + * element of the chunk in the dataset’s dataspace. The length of the + * offset array must equal the number of dimensions, or rank, of the + * dataspace. The values in \p offset must not exceed the dimension limits + * and must specify a point that falls on a dataset chunk boundary. + * + * \p data_size is the size in bytes of the chunk, representing the number of + * bytes to be read from the buffer \p buf. If the data chunk has been + * precompressed, \p data_size should be the size of the compressed data. + * + * \p buf is the memory buffer containing data to be written to the chunk in the file. + * + * \attention Exercise caution when using H5DOread_chunk() and H5DOwrite_chunk(), + * as they read and write data chunks directly in a file. + * H5DOwrite_chunk() bypasses hyperslab selection, the conversion of data + * from one datatype to another, and the filter pipeline to write the chunk. + * Developers should have experience with these processes before + * using this function. Please see + * + * Using the Direct Chunk Write Function + * for more information. + * + * \note H5DOread_chunk() and H5DOwrite_chunk() are not + * supported under parallel and do not support variable length types. + * + * \par Example + * The following code illustrates the use of H5DOwrite_chunk to write + * an entire dataset, chunk by chunk: + * \snippet H5DO_examples.c H5DOwrite + * + * \version 1.10.3 Function deprecated in favor of H5Dwrite_chunk. + * + * \since 1.8.11 + */ H5_HLDLL herr_t H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset, size_t data_size, const void *buf); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5DO + * + * \brief Reads a raw data chunk directly from a dataset in a file into a buffer. + * + * \param[in] dset_id Identifier for the dataset to be read + * \param[in] dxpl_id Transfer property list identifier for + * this I/O operation + * \param[in] offset Logical position of the chunk’s first + element in the dataspace + * \param[in,out] filters Mask for identifying the filters used + * with the chunk + * \param[in] buf Buffer containing the chunk read from + * the dataset + * + * \return \herr_t + * + * \deprecated This function was deprecated in favor of the function + * H5Dread_chunk() as of HDF5-1.10.3. + * In HDF5 1.10.3, the functionality of H5DOread_chunk() + * was moved to H5Dread_chunk(). + * \deprecated For compatibility, this API call has been left as a stub which + * simply calls H5Dread_chunk(). New code should use H5Dread_chunk(). + * + * \details The H5DOread_chunk() reads a raw data chunk as specified + * by its logical \p offset in a chunked dataset \p dset_id + * from the dataset in the file into the application memory + * buffer \p buf. The data in \p buf is read directly from the file + * bypassing the library’s internal data transfer pipeline, + * including filters. + * + * \p dxpl_id is a data transfer property list identifier. + * + * The mask \p filters indicates which filters are used with the + * chunk when written. A zero value indicates that all enabled filters + * are applied on the chunk. A filter is skipped if the bit corresponding + * to the filter’s position in the pipeline + * (0 ≤ position < 32) is turned on. + * + * \p offset is an array specifying the logical position of the first + * element of the chunk in the dataset’s dataspace. The length of the + * offset array must equal the number of dimensions, or rank, of the + * dataspace. The values in \p offset must not exceed the dimension + * limits and must specify a point that falls on a dataset chunk boundary. + * + * \p buf is the memory buffer containing the chunk read from the dataset + * in the file. + * + * \par Example + * The following code illustrates the use of H5DOread_chunk() + * to read a chunk from a dataset: + * \snippet H5DO_examples.c H5DOread + * + * \version 1.10.3 Function deprecated in favor of H5Dread_chunk. + * + * \since 1.10.2, 1.8.19 + */ H5_HLDLL herr_t H5DOread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters /*out*/, void *buf /*out*/); diff --git a/hl/src/H5DSpublic.h b/hl/src/H5DSpublic.h index 979a173..1dd0781 100644 --- a/hl/src/H5DSpublic.h +++ b/hl/src/H5DSpublic.h @@ -19,33 +19,393 @@ #define REFERENCE_LIST "REFERENCE_LIST" #define DIMENSION_LABELS "DIMENSION_LABELS" +/** + * \brief Prototype for H5DSiterate_scales() operator + * + */ +//! typedef herr_t (*H5DS_iterate_t)(hid_t dset, unsigned dim, hid_t scale, void *visitor_data); +//! #ifdef __cplusplus extern "C" { #endif +/**\defgroup H5DS Dimension Scales + * + * Creating and manipulating HDF5 datasets that are associated with + * the dimension of another HDF5 dataset (H5DS) + * + * \note \Bold{Programming hints:} + * \note To use any of these functions or subroutines, + * you must first include the relevant include file (C) or + * module (Fortran) in your application. + * \note The following line includes the HDF5 Dimension Scale package, + * H5DS, in C applications: + * \code #include "hdf5_hl.h" \endcode + * \note This line includes the H5DS module in Fortran applications: + * \code use h5ds \endcode + * + * - \ref H5DSwith_new_ref + * \n Determines if new references are used with dimension scales. + * - \ref H5DSattach_scale + * \n Attach dimension scale dsid to dimension idx of dataset did. + * - \ref H5DSdetach_scale + * \n Detach dimension scale dsid from the dimension idx of Dataset did. + * - \ref H5DSget_label + * \n Read the label for dimension idx of did into buffer label. + * - \ref H5DSget_num_scales + * \n Determines how many Dimension Scales are attached + * to dimension idx of did. + * - \ref H5DSget_scale_name + * \n Retrieves name of scale did into buffer name. + * - \ref H5DSis_attached + * \n Report if dimension scale dsid is currently attached + * to dimension idx of dataset did. + * - \ref H5DSis_scale + * \n Determines whether dset is a Dimension Scale. + * - \ref H5DSiterate_scales + * \n Iterates the operation visitor through the scales + * attached to dimension dim. + * - \ref H5DSset_label + * \n Set label for the dimension idx of did to the value label. + * - \ref H5DSset_scale + * \n Convert dataset dsid to a dimension scale, + * with optional name, dimname. + * . + * + */ + +/* THIS IS A NEW ROUTINE NOT ON OLD PORTAL */ +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Determines if new references are used with dimension scales. + * + * \param[in] obj_id Object identifier + * \param[out] with_new_ref New references are used or not + * + * \return \herr_t + * + * \details H5DSwith_new_ref() takes any object identifier and checks + * if new references are used for dimension scales. Currently, + * new references are used when non-native VOL connector is + * used or when H5_DIMENSION_SCALES_WITH_NEW_REF is set up + * via configure option. + * + */ H5_HLDLL herr_t H5DSwith_new_ref(hid_t obj_id, hbool_t *with_new_ref); +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Attach dimension scale \p dsid to dimension \p idx of + * dataset did. + * + * \param[in] did The dataset + * \param[in] dsid The scale to be attached + * \param[in] idx The dimension of \p did that \p dsid is associated with + * + * \return \herr_t + * + * \details Define Dimension Scale \p dsid to be associated with + * dimension \p idx of dataset \p did. + * + * Entries are created in the #DIMENSION_LIST and + * #REFERENCE_LIST attributes, as defined in section 4.2 of + * + * HDF5 Dimension Scale Specification. + * + * Fails if: + * - Bad arguments + * - If \p dsid is not a Dimension Scale + * - If \p did is a Dimension Scale + * (A Dimension Scale cannot have scales.) + * + * \note The Dimension Scale \p dsid can be attached to the + * same dimension more than once, which has no effect. + */ H5_HLDLL herr_t H5DSattach_scale(hid_t did, hid_t dsid, unsigned int idx); +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Detach dimension scale \p dsid from the dimension \p idx of dataset \p did. + * + * \param[in] did The dataset + * \param[in] dsid The scale to be detached + * \param[in] idx The dimension of \p did to detach + * + * \return \herr_t + * + * \details If possible, deletes association of Dimension Scale \p dsid with + * dimension \p idx of dataset \p did. This deletes the entries in the + * #DIMENSION_LIST and #REFERENCE_LIST attributes, + * as defined in section 4.2 of + * + * HDF5 Dimension Scale Specification. + * + * Fails if: + * - Bad arguments + * - The dataset \p did or \p dsid do not exist + * - The \p dsid is not a Dimension Scale + * - \p dsid is not attached to \p did + * . + * + * \note A scale may be associated with more than dimension of the + * same dataset. If so, the detach operation only deletes one + * of the associations, for \p did. + * + */ H5_HLDLL herr_t H5DSdetach_scale(hid_t did, hid_t dsid, unsigned int idx); +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Convert dataset \p dsid to a dimension scale, + * with optional name, \p dimname. + * + * \param[in] dsid The dataset to be made a Dimemsion Scale + * \param[in] dimname The dimension name (optional), NULL if the + * dimension has no name. + * + * \return \herr_t + * + * \details The dataset \p dsid is converted to a Dimension Scale dataset, + * as defined above. Creates the CLASS attribute, set to the value + * "DIMENSION_SCALE" and an empty #REFERENCE_LIST attribute, + * as described in + * + * HDF5 Dimension Scale Specification. + * (PDF, see section 4.2). + * + * If \p dimname is specified, then an attribute called NAME + * is created, with the value \p dimname. + * + * Fails if: + * - Bad arguments + * - If \p dsid is already a scale + * - If \p dsid is a dataset which already has dimension scales + * . + * + * If the dataset was created with the Table, Image, or Palette interface [9], + * it is not recommended to convert to a Dimension Scale. + * (These Datasets will have a CLASS Table, Image, or Palette.) + * + * \todo what is [9] after Palette interface? + */ H5_HLDLL herr_t H5DSset_scale(hid_t dsid, const char *dimname); -H5_HLDLL int H5DSget_num_scales(hid_t did, unsigned int dim); +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Determines how many Dimension Scales are attached + * to dimension \p idx of \p did. + * + * \param[in] did The dataset to query + * \param[in] idx The dimension of \p did to query + * + * \return Returns the number of Dimension Scales associated + * with \p did, if successful, otherwise returns a + * negative value. + * + * \details H5DSget_num_scales() determines how many Dimension + * Scales are attached to dimension \p idx of + * dataset \p did. + * + */ +H5_HLDLL int H5DSget_num_scales(hid_t did, unsigned int idx); +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Set label for the dimension \p idx of \p did + * to the value \p label. + * + * \param[in] did The dataset + * \param[in] idx The dimension + * \param[in] label The label + * + * \return \herr_t + * + * \details Sets the #DIMENSION_LABELS for dimension \p idx of + * dataset \p did. If the dimension had a label, + * the new value replaces the old. + * + * Fails if: + * - Bad arguments + * . + */ H5_HLDLL herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label); +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Read the label for dimension \p idx of \p did into buffer \p label. + * + * \param[in] did The dataset + * \param[in] idx The dimension + * \param[out] label The label + * \param[in] size The length of the label buffer + * + * \return Upon success, size of label or zero if no label found. + * Negative if fail. + * + * \details Returns the value of the #DIMENSION_LABELS for + * dimension \p idx of dataset \p did, if set. + * Up to \p size characters of the name are copied into + * the buffer \p label. If the label is longer than + * \p size, it will be truncated to fit. The parameter + * \p size is set to the size of the returned \p label. + * + * If \p did has no label, the return value of + * \p label is NULL. + * + * Fails if: + * - Bad arguments + * . + */ H5_HLDLL ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size); +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Retrieves name of scale \p did into buffer \p name. + * + * \param[in] did Dimension scale identifier + * \param[out] name Buffer to contain the returned name + * \param[in] size Size in bytes, of the \p name buffer + * + * \return Upon success, the length of the scale name or zero if no name found. + * Negative if fail. + * + * \details H5DSget_scale_name() retrieves the name attribute + * for scale \p did. + * + * Up to \p size characters of the scale name are returned + * in \p name; additional characters, if any, are not returned + * to the user application. + * + * If the length of the name, which determines the required value of + * \p size, is unknown, a preliminary H5DSget_scale_name() call can + * be made by setting \p name to NULL. The return value of this call + * will be the size of the scale name; that value plus one (1) can then + * be assigned to \p size for a second H5DSget_scale_name() call, + * which will retrieve the actual name. (The value passed in with the + * parameter \p size must be one greater than size in bytes of the actual + * name in order to accommodate the null terminator; + * if \p size is set to the exact size of the name, the last byte + * passed back will contain the null terminator and the last character + * will be missing from the name passed back to the calling application.) + */ H5_HLDLL ssize_t H5DSget_scale_name(hid_t did, char *name, size_t size); +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Determines whether \p did is a Dimension Scale. + * + * \param[in] did The dataset to query + * + * \return \htri_t + * + * \details H5DSis_scale() determines if \p did is a Dimension Scale, + * i.e., has class="DIMENSION_SCALE"). + * + */ H5_HLDLL htri_t H5DSis_scale(hid_t did); +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Iterates the operation visitor through the scales + * attached to dimension \p dim. + * + * \param[in] did The dataset + * \param[in] dim The dimension of dataset \p did + * \param[in,out] idx Input the index to start iterating, + * output the next index to visit. + * If NULL, start at the first position. + * \param[in] visitor The visitor function + * \param[in] visitor_data Arbitrary data to pass to the + * visitor function + * + * \return Returns the return value of the last operator if it was + * non-zero, or zero if all scales were processed. + * + * \details H5DSiterate_scales() iterates over the scales attached to + * dimension \p dim of dataset \p did. For each scale in the + * list, the \p visitor_data and some additional information, + * specified below, are passed to the \p visitor function. + * The iteration begins with the \p idx object in the + * group and the next element to be processed by the operator + * is returned in \p idx. If \p idx is NULL, then the + * iterator starts at the first group member; since no + * stopping point is returned in this case, + * the iterator cannot be restarted if one of the calls + * to its operator returns non-zero. + * + * The prototype for \ref H5DS_iterate_t is: + * \snippet this H5DS_iterate_t_snip + * + * The operation receives the Dimension Scale dataset + * identifier, \p scale, and the pointer to the operator + * data passed in to H5DSiterate_scales(), \p visitor_data. + * + * The return values from an operator are: + * + * - Zero causes the iterator to continue, returning zero + * when all group members have been processed. + * - Positive causes the iterator to immediately return that + * positive value, indicating short-circuit success. + * The iterator can be restarted at the next group member. + * - Negative causes the iterator to immediately return + * that value, indicating failure. The iterator can be + * restarted at the next group member. + * . + * + * H5DSiterate_scales() assumes that the scales of the + * dimension identified by \p dim remain unchanged through + * the iteration. If the membership changes during the iteration, + * the function's behavior is undefined. + */ H5_HLDLL herr_t H5DSiterate_scales(hid_t did, unsigned int dim, int *idx, H5DS_iterate_t visitor, void *visitor_data); +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Report if dimension scale \p dsid is currently attached to + * dimension \p idx of dataset \p did. + * + * \param[in] did The dataset + * \param[in] dsid The scale to be attached + * \param[in] idx The dimension of \p did that \p dsid is associated with + * + * \return \htri_t + * + * \details Report if dimension scale \p dsid is currently attached to + * dimension \p idx of dataset \p did. + * + * Fails if: + * - Bad arguments + * - If \p dsid is not a Dimension Scale + * - The \p dsid is not a Dimension Scale + * - If \p did is a Dimension Scale (A Dimension Scale cannot have scales.) + * . + * + */ H5_HLDLL htri_t H5DSis_attached(hid_t did, hid_t dsid, unsigned int idx); #ifdef __cplusplus diff --git a/hl/src/H5IMpublic.h b/hl/src/H5IMpublic.h index 2843942..2129509 100644 --- a/hl/src/H5IMpublic.h +++ b/hl/src/H5IMpublic.h @@ -18,33 +18,326 @@ extern "C" { #endif +/**\defgroup H5IM Images + * + * Creating and manipulating HDF5 datasets intended to be + * interpreted as images (H5IM) + * + * The specification for the Images API is presented in another + * document: \ref IMG + * This version of the API is primarily concerned with two dimensional raster + * data similar to HDF4 Raster Images. + * The HDF5 Images API uses the \ref H5LT HDF5 API. + * + * \note \Bold{Programming hints:} + * \note To use any of these functions or subroutines, + * you must first include the relevant include file (C) or + * module (Fortran) in your application. + * \note The following line includes the HDF5 Images package, H5IM, + * in C applications: + * \code #include "hdf5_hl.h" \endcode + * \note This line includes the H5IM module in Fortran applications: + * \code use h5im \endcode + * + * - \ref H5IMget_image_info + * \n Gets information about an image dataset (dimensions, + * interlace mode and number of associated palettes). + * - \ref H5IMget_npalettes + * \n Gets the number of palettes associated to an image. + * - \ref H5IMget_palette + * \n Gets the palette dataset. + * - \ref H5IMget_palette_info + * \n Gets information about a palette dataset (dimensions). + * - \ref H5IMis_image + * \n Inquires if a dataset is an image + * - \ref H5IMis_palette + * \n Inquires if a dataset is a palette. + * - \ref H5IMlink_palette + * \n Attaches a palette to an image. + * - \ref H5IMmake_image_8bit + * \n Creates and writes an image. + * - \ref H5IMmake_image_24bit + * \n Creates and writes a true color image. + * - \ref H5IMmake_palette + * \n Creates and writes a palette. + * - \ref H5IMread_image + * \n Reads image data from disk. + * - \ref H5IMunlink_palette + * \n Dettaches a palette from an image. + * . + * + */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Creates and writes an image. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to create + * \param[in] width The width of the image + * \param[in] height The height of the image + * \param[in] buffer Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5IMmake_image_8bit() creates and writes a dataset named + * \p dset_name attached to the file or group specified by the + * identifier \p loc_id. Attributes conforming to the HDF5 Image + * and Palette specification for an indexed image are attached to + * the dataset, thus identifying it as an image. The image data is + * of the type #H5T_NATIVE_UCHAR. An indexed image is an image in + * which each each pixel information storage is an index to a + * table palette. + * + */ H5_HLDLL herr_t H5IMmake_image_8bit(hid_t loc_id, const char *dset_name, hsize_t width, hsize_t height, const unsigned char *buffer); +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Creates and writes a true color image. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to create + * \param[in] width The width of the image + * \param[in] height The height of the image + * \param[in] interlace String defining the interlace mode + * \param[in] buffer Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5IMmake_image_24bit() creates and writes a dataset named + * \p dset_name attached to the file or group specified by the + * identifier \p loc_id. This function defines a true color image + * conforming to the HDF5 Image and Palette specification. + * The function assumes that the image data is of the type + * #H5T_NATIVE_UCHAR. + * + * A true color image is an image where the pixel storage contains + * several color planes. In a 24 bit RGB color model, these planes + * are red, green and blue. In a true color image the stream of bytes + * can be stored in several different ways, thus defining the + * interlace (or interleaving) mode. The 2 most used types of interlace mode + * are interlace by pixel and interlace by plane. In the 24 bit RGB color + * model example, interlace by plane means all the red components for the + * entire dataset are stored first, followed by all the green components, + * and then by all the blue components. Interlace by pixel in this example + * means that for each pixel the sequence red, green, blue is defined. + * In this function, the interlace mode is defined in the parameter + * \p interlace, a string that can have the values INTERLACE_PIXEL + * or INTERLACE_PLANE. + * + */ H5_HLDLL herr_t H5IMmake_image_24bit(hid_t loc_id, const char *dset_name, hsize_t width, hsize_t height, const char *interlace, const unsigned char *buffer); +/** + *------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Gets information about an image dataset + * (dimensions, interlace mode and number of associated palettes). + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset + * \param[out] width The width of the image + * \param[out] height The height of the image + * \param[out] planes The number of color planes of the image + * \param[out] interlace The interlace mode of the image + * \param[out] npals The number of palettes associated to the image + * + * \return \herr_t + * + * \details H5IMget_image_info() gets information about an image + * named \p dset_name attached to the file or group specified + * by the identifier \p loc_id. + * + */ H5_HLDLL herr_t H5IMget_image_info(hid_t loc_id, const char *dset_name, hsize_t *width, hsize_t *height, hsize_t *planes, char *interlace, hssize_t *npals); +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Reads image data from disk. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to create + * \param[out] buffer Buffer with data to store the image + * + * \return \herr_t + * + * \details H5IMread_image() reads a dataset named \p dset_name + * attached to the file or group specified by the + * identifier \p loc_id. + * + */ H5_HLDLL herr_t H5IMread_image(hid_t loc_id, const char *dset_name, unsigned char *buffer); +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Creates and writes a palette. + * + * \fg_loc_id + * \param[in] pal_name The name of the palette + * \param[in] pal_dims An array of the size of the palette dimensions + * \param[in] pal_data Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5IMmake_palette() creates and writes a dataset + * named \p pal_name. Attributes conforming to the HDF5 Image and + * Palette specification are attached to the dataset, thus + * identifying it as a palette. The palette data is of the + * type #H5T_NATIVE_UCHAR. + * + */ H5_HLDLL herr_t H5IMmake_palette(hid_t loc_id, const char *pal_name, const hsize_t *pal_dims, const unsigned char *pal_data); +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Attaches a palette to an image. + * + * \fg_loc_id + * \param[in] image_name The name of the dataset to attach the palette to + * \param[in] pal_name The name of the palette + * + * \return \herr_t + * + * \details H5IMlink_palette() attaches a palette named \p pal_name + * to an image specified by \p image_name. The image dataset + * may or not already have an attached palette. If it has, + * the array of palette references is extended to hold the reference + * to the new palette. + * + */ H5_HLDLL herr_t H5IMlink_palette(hid_t loc_id, const char *image_name, const char *pal_name); +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Dettaches a palette from an image. + * + * \fg_loc_id + * \param[in] image_name The name of the image dataset + * \param[in] pal_name The name of the palette + * + * \return \herr_t + * + * \details H5IMunlink_palette() dettaches a palette from an image + * specified by \p image_name. + * + */ H5_HLDLL herr_t H5IMunlink_palette(hid_t loc_id, const char *image_name, const char *pal_name); +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Gets the number of palettes associated to an image. + * + * \fg_loc_id + * \param[in] image_name The name of the image dataset + * \param[out] npals The number of palettes + * + * \return \herr_t + * + * \details H5IMget_npalettes() gets the number of palettes associated to + * an image specified by \p image_name. + * + */ H5_HLDLL herr_t H5IMget_npalettes(hid_t loc_id, const char *image_name, hssize_t *npals); +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Gets information about a palette dataset (dimensions). + * + * \fg_loc_id + * \param[in] image_name The name of the image dataset + * \param[in] pal_number The zero based index that identifies + * the palette + * \param[out] pal_dims The dimensions of the palette dataset + * + * \return \herr_t + * + * \details H5IMget_palette_info() gets the dimensions of the palette + * dataset identified by \p pal_number (a zero based index) + * associated to an image specified by \p image_name. + * + */ H5_HLDLL herr_t H5IMget_palette_info(hid_t loc_id, const char *image_name, int pal_number, hsize_t *pal_dims); +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Gets the palette dataset. + * + * \fg_loc_id + * \param[in] image_name The name of the image dataset + * \param[in] pal_number The zero based index that identifies + * the palette + * \param[out] pal_data The palette dataset + * + * \return \herr_t + * + * \details H5IMget_palette() gets the palette dataset identified + * by \p pal_number (a zero based index) associated to an + * image specified by \p image_name. + * + */ H5_HLDLL herr_t H5IMget_palette(hid_t loc_id, const char *image_name, int pal_number, unsigned char *pal_data); +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Inquires if a dataset is an image. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset + * + * \return \htri_t + * + * \details H5IMis_image() inquires if a dataset named \p dset_name, + * attached to the file or group specified by the identifier + * \p loc_id, is an image based on the HDF5 Image and Palette + * Specification. + * + */ H5_HLDLL herr_t H5IMis_image(hid_t loc_id, const char *dset_name); +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Inquires if a dataset is a palette + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset + * + * \return \htri_t + * + * \details H5IMis_palette() inquires if a dataset named \p dset_name, + * attached to the file or group specified by the + * identifier \p loc_id, is a palette based on the HDF5 + * Image and Palette Specification. + * + */ H5_HLDLL herr_t H5IMis_palette(hid_t loc_id, const char *dset_name); #ifdef __cplusplus diff --git a/hl/src/H5LDpublic.h b/hl/src/H5LDpublic.h index 011b208..826da40 100644 --- a/hl/src/H5LDpublic.h +++ b/hl/src/H5LDpublic.h @@ -18,8 +18,149 @@ extern "C" { #endif +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Retrieves the current dimension sizes of a dataset. + * + * \param[in] did The dataset identifier + * \param[out] cur_dims The current dimension sizes of the dataset + * + * \return \herr_t + * + * \details H5LDget_dset_dims() retrieves the current dimension sizes + * for the dataset \p did through the parameter \p cur_dims. + * It will return failure if \p cur_dims is NULL. + * + * \note See Also: + * \note Dataset Watch functions (used with \ref h5watch): + * - H5LDget_dset_dims() + * - H5LDget_dset_elmts() + * - H5LDget_dset_type_size() + * . + * + * \par Example: + * See the example code in H5LDget_dset_elmts() for usage of this routine. + * + * \since 1.10.0 + * + */ H5_HLDLL herr_t H5LDget_dset_dims(hid_t did, hsize_t *cur_dims); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Returns the size in bytes of the dataset’s datatype + * + * \param[in] did The dataset identifier + * \param[in] fields The pointer to a comma-separated list of fields for a compound datatype + * + * \return If successful, returns the size in bytes of the + * dataset’s datatype. Otherwise, returns 0. + * + * \details H5LDget_dset_type_size() allows the user to find out the datatype + * size for the dataset associated with \p did. If the + * parameter \p fields is NULL, this routine just returns the size + * of the dataset’s datatype. If the dataset has a compound datatype + * and \p fields is non-NULL, this routine returns the size of the + * datatype(s) for the selected fields specified in \p fields. + * Note that ’,’ is the separator for the fields of a compound + * datatype while ’.’ (dot) is the separator for a nested field. + * Use a backslash ( \ ) to escape characters in field names that + * conflict with these two separators. + * + * \note See Also: + * \note Dataset Watch functions (used with \ref h5watch): + * - H5LDget_dset_dims() + * - H5LDget_dset_elmts() + * - H5LDget_dset_type_size() + * . + * + * \par Example: + * See the example code in H5LDget_dset_elmts() for usage of this routine. + * + * \since 1.10.0 + * + */ H5_HLDLL size_t H5LDget_dset_type_size(hid_t did, const char *fields); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Retrieves selected data from the dataset + * + * \param[in] did The dataset identifier + * \param[in] prev_dims The previous dimension size of the dataset + * \param[in] cur_dims The current dimension sizes of the dataset + * \param[in] fields A string containing a comma-separated list + * of fields for a compound datatype + * \param[out] buf Buffer for storing data retrieved from the + * dataset + * + * \return \herr_t + * + * \details H5LDget_dset_dims() retrieves selected data of the dataset + * \p did and stores the data in the parameter \p buf. + * The difference between the parameters \p prev_dims and + * \p cur_dims indicates the dimension sizes of the data to be + * selected from the dataset. Note that \p cur_dims must have + * at least one dimension whose size is greater than the + * corresponding dimension in \p prev_dims. Users can + * determine the size of buf by multipling the datatype + * size of the dataset by the number of selected elements. + * + * If the parameter \p fields is NULL, this routine returns + * data for the selected elements of the dataset. If \p fields + * is not NULL and the dataset has a compound datatype, \p fields + * is a string containing a comma-separated list of fields. + * Each name in \p fields specifies a field in the compound + * datatype, and this routine returns data of the selected fields + * for the dataset's selected elements. Note that ’,’ is the + * separator for the fields of a compound datatype while + * ’.’ is the separator for a nested field. Use backslash to + * escape characters in field names that conflict with these + * two separators. + * + * \note See Also: + * \note Dataset Watch functions (used with \ref h5watch): + * - H5LDget_dset_dims() + * - H5LDget_dset_elmts() + * - H5LDget_dset_type_size() + * . + * + * \par Examples: + * + * For the first example, \c DSET1 is a two-dimensional chunked dataset with atomic type defined below: + * \snippet H5LDget_dset_elmts.c first_declare + * + * The following coding sample illustrates the reading of + * data elements appended to the dataset \c DSET1: + * \snippet H5LDget_dset_elmts.c first_reading + * + * The output buffer will contain data elements selected from + * \c DSET1 as follows: + * \snippet H5LDget_dset_elmts.c first_output + * + * For the second example, DSET2 is a one-dimensional chunked dataset + * with compound type defined below: + * \snippet H5LDget_dset_elmts.c second_declare + * + * The following coding sample illustrates the reading of data elements + * appended to the dataset \c DSET2 with compound datatype. + * This example selects only 2 fields: the fourth field \c d and a + * subfield of the sixth field \c s2.c: + * \snippet H5LDget_dset_elmts.c second_reading + * + * The output buffer will contain data for \c d and \c s2.c + * selected from \c DSET2 as follows: + * \snippet H5LDget_dset_elmts.c second_output + * + * \since 1.10.0 + * + */ H5_HLDLL herr_t H5LDget_dset_elmts(hid_t did, const hsize_t *prev_dims, const hsize_t *cur_dims, const char *fields, void *buf); diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c index 875a37a..4928efe 100644 --- a/hl/src/H5LTanalyze.c +++ b/hl/src/H5LTanalyze.c @@ -28,9 +28,14 @@ #elif defined _MSC_VER #pragma warning(push, 1) #endif -#line 1 "hl/src/H5LTanalyze.c" +#line 2 "./hl/src/H5LTanalyze.c" +/* Quiet warnings about integer type macro redifinitions on Visual Studio + * (MSVC doesn't define STDC_VERSION, but has inttypes.h). This is an + * issue that is apparently fixed in flex 2.6.5. + */ +#include -#line 3 "hl/src/H5LTanalyze.c" +#line 9 "./hl/src/H5LTanalyze.c" #define YY_INT_ALIGNED short int @@ -888,7 +893,7 @@ int yy_flex_debug = 0; #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "hl/src/H5LTanalyze.l" +#line 1 "./hl/src/H5LTanalyze.l" /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * @@ -906,7 +911,8 @@ char *yytext; * If you make any changes to H5LTanalyze.l, please run bin/genparser to * recreate the output files. */ -#line 21 "hl/src/H5LTanalyze.l" + +#line 29 "./hl/src/H5LTanalyze.l" #include #include #include @@ -930,8 +936,8 @@ static int my_yyinput(char *, int); extern char *myinput; extern size_t input_len; -#line 903 "hl/src/H5LTanalyze.c" -#line 904 "hl/src/H5LTanalyze.c" +#line 910 "./hl/src/H5LTanalyze.c" +#line 911 "./hl/src/H5LTanalyze.c" #define INITIAL 0 @@ -1140,10 +1146,10 @@ YY_DECL } { -#line 46 "hl/src/H5LTanalyze.l" +#line 54 "./hl/src/H5LTanalyze.l" -#line 1116 "hl/src/H5LTanalyze.c" +#line 1123 "./hl/src/H5LTanalyze.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { @@ -1202,277 +1208,277 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 48 "hl/src/H5LTanalyze.l" +#line 56 "./hl/src/H5LTanalyze.l" {return hid(H5T_STD_I8BE_TOKEN);} YY_BREAK case 2: YY_RULE_SETUP -#line 49 "hl/src/H5LTanalyze.l" +#line 57 "./hl/src/H5LTanalyze.l" {return hid(H5T_STD_I8LE_TOKEN);} YY_BREAK case 3: YY_RULE_SETUP -#line 50 "hl/src/H5LTanalyze.l" +#line 58 "./hl/src/H5LTanalyze.l" {return hid(H5T_STD_I16BE_TOKEN);} YY_BREAK case 4: YY_RULE_SETUP -#line 51 "hl/src/H5LTanalyze.l" +#line 59 "./hl/src/H5LTanalyze.l" {return hid(H5T_STD_I16LE_TOKEN);} YY_BREAK case 5: YY_RULE_SETUP -#line 52 "hl/src/H5LTanalyze.l" +#line 60 "./hl/src/H5LTanalyze.l" {return hid(H5T_STD_I32BE_TOKEN);} YY_BREAK case 6: YY_RULE_SETUP -#line 53 "hl/src/H5LTanalyze.l" +#line 61 "./hl/src/H5LTanalyze.l" {return hid(H5T_STD_I32LE_TOKEN);} YY_BREAK case 7: YY_RULE_SETUP -#line 54 "hl/src/H5LTanalyze.l" +#line 62 "./hl/src/H5LTanalyze.l" {return hid(H5T_STD_I64BE_TOKEN);} YY_BREAK case 8: YY_RULE_SETUP -#line 55 "hl/src/H5LTanalyze.l" +#line 63 "./hl/src/H5LTanalyze.l" {return hid(H5T_STD_I64LE_TOKEN);} YY_BREAK case 9: YY_RULE_SETUP -#line 57 "hl/src/H5LTanalyze.l" +#line 65 "./hl/src/H5LTanalyze.l" {return hid(H5T_STD_U8BE_TOKEN);} YY_BREAK case 10: YY_RULE_SETUP -#line 58 "hl/src/H5LTanalyze.l" +#line 66 "./hl/src/H5LTanalyze.l" {return hid(H5T_STD_U8LE_TOKEN);} YY_BREAK case 11: YY_RULE_SETUP -#line 59 "hl/src/H5LTanalyze.l" +#line 67 "./hl/src/H5LTanalyze.l" {return hid(H5T_STD_U16BE_TOKEN);} YY_BREAK case 12: YY_RULE_SETUP -#line 60 "hl/src/H5LTanalyze.l" +#line 68 "./hl/src/H5LTanalyze.l" {return hid(H5T_STD_U16LE_TOKEN);} YY_BREAK case 13: YY_RULE_SETUP -#line 61 "hl/src/H5LTanalyze.l" +#line 69 "./hl/src/H5LTanalyze.l" {return hid(H5T_STD_U32BE_TOKEN);} YY_BREAK case 14: YY_RULE_SETUP -#line 62 "hl/src/H5LTanalyze.l" +#line 70 "./hl/src/H5LTanalyze.l" {return hid(H5T_STD_U32LE_TOKEN);} YY_BREAK case 15: YY_RULE_SETUP -#line 63 "hl/src/H5LTanalyze.l" +#line 71 "./hl/src/H5LTanalyze.l" {return hid(H5T_STD_U64BE_TOKEN);} YY_BREAK case 16: YY_RULE_SETUP -#line 64 "hl/src/H5LTanalyze.l" +#line 72 "./hl/src/H5LTanalyze.l" {return hid(H5T_STD_U64LE_TOKEN);} YY_BREAK case 17: YY_RULE_SETUP -#line 66 "hl/src/H5LTanalyze.l" +#line 74 "./hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_CHAR_TOKEN);} YY_BREAK case 18: YY_RULE_SETUP -#line 67 "hl/src/H5LTanalyze.l" +#line 75 "./hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_SCHAR_TOKEN);} YY_BREAK case 19: YY_RULE_SETUP -#line 68 "hl/src/H5LTanalyze.l" +#line 76 "./hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_UCHAR_TOKEN);} YY_BREAK case 20: YY_RULE_SETUP -#line 69 "hl/src/H5LTanalyze.l" +#line 77 "./hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_SHORT_TOKEN);} YY_BREAK case 21: YY_RULE_SETUP -#line 70 "hl/src/H5LTanalyze.l" +#line 78 "./hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_USHORT_TOKEN);} YY_BREAK case 22: YY_RULE_SETUP -#line 71 "hl/src/H5LTanalyze.l" +#line 79 "./hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_INT_TOKEN);} YY_BREAK case 23: YY_RULE_SETUP -#line 72 "hl/src/H5LTanalyze.l" +#line 80 "./hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_UINT_TOKEN);} YY_BREAK case 24: YY_RULE_SETUP -#line 73 "hl/src/H5LTanalyze.l" +#line 81 "./hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_LONG_TOKEN);} YY_BREAK case 25: YY_RULE_SETUP -#line 74 "hl/src/H5LTanalyze.l" +#line 82 "./hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_ULONG_TOKEN);} YY_BREAK case 26: YY_RULE_SETUP -#line 75 "hl/src/H5LTanalyze.l" +#line 83 "./hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_LLONG_TOKEN);} YY_BREAK case 27: YY_RULE_SETUP -#line 76 "hl/src/H5LTanalyze.l" +#line 84 "./hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_ULLONG_TOKEN);} YY_BREAK case 28: YY_RULE_SETUP -#line 78 "hl/src/H5LTanalyze.l" +#line 86 "./hl/src/H5LTanalyze.l" {return hid(H5T_IEEE_F32BE_TOKEN);} YY_BREAK case 29: YY_RULE_SETUP -#line 79 "hl/src/H5LTanalyze.l" +#line 87 "./hl/src/H5LTanalyze.l" {return hid(H5T_IEEE_F32LE_TOKEN);} YY_BREAK case 30: YY_RULE_SETUP -#line 80 "hl/src/H5LTanalyze.l" +#line 88 "./hl/src/H5LTanalyze.l" {return hid(H5T_IEEE_F64BE_TOKEN);} YY_BREAK case 31: YY_RULE_SETUP -#line 81 "hl/src/H5LTanalyze.l" +#line 89 "./hl/src/H5LTanalyze.l" {return hid(H5T_IEEE_F64LE_TOKEN);} YY_BREAK case 32: YY_RULE_SETUP -#line 82 "hl/src/H5LTanalyze.l" +#line 90 "./hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_FLOAT_TOKEN);} YY_BREAK case 33: YY_RULE_SETUP -#line 83 "hl/src/H5LTanalyze.l" +#line 91 "./hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_DOUBLE_TOKEN);} YY_BREAK case 34: YY_RULE_SETUP -#line 84 "hl/src/H5LTanalyze.l" +#line 92 "./hl/src/H5LTanalyze.l" {return hid(H5T_NATIVE_LDOUBLE_TOKEN);} YY_BREAK case 35: YY_RULE_SETUP -#line 86 "hl/src/H5LTanalyze.l" +#line 94 "./hl/src/H5LTanalyze.l" {return token(H5T_STRING_TOKEN);} YY_BREAK case 36: YY_RULE_SETUP -#line 87 "hl/src/H5LTanalyze.l" +#line 95 "./hl/src/H5LTanalyze.l" {return token(STRSIZE_TOKEN);} YY_BREAK case 37: YY_RULE_SETUP -#line 88 "hl/src/H5LTanalyze.l" +#line 96 "./hl/src/H5LTanalyze.l" {return token(STRPAD_TOKEN);} YY_BREAK case 38: YY_RULE_SETUP -#line 89 "hl/src/H5LTanalyze.l" +#line 97 "./hl/src/H5LTanalyze.l" {return token(CSET_TOKEN);} YY_BREAK case 39: YY_RULE_SETUP -#line 90 "hl/src/H5LTanalyze.l" +#line 98 "./hl/src/H5LTanalyze.l" {return token(CTYPE_TOKEN);} YY_BREAK case 40: YY_RULE_SETUP -#line 91 "hl/src/H5LTanalyze.l" +#line 99 "./hl/src/H5LTanalyze.l" {return token(H5T_STR_NULLTERM_TOKEN);} YY_BREAK case 41: YY_RULE_SETUP -#line 92 "hl/src/H5LTanalyze.l" +#line 100 "./hl/src/H5LTanalyze.l" {return token(H5T_STR_NULLPAD_TOKEN);} YY_BREAK case 42: YY_RULE_SETUP -#line 93 "hl/src/H5LTanalyze.l" +#line 101 "./hl/src/H5LTanalyze.l" {return token(H5T_STR_SPACEPAD_TOKEN);} YY_BREAK case 43: YY_RULE_SETUP -#line 94 "hl/src/H5LTanalyze.l" +#line 102 "./hl/src/H5LTanalyze.l" {return token(H5T_CSET_ASCII_TOKEN);} YY_BREAK case 44: YY_RULE_SETUP -#line 95 "hl/src/H5LTanalyze.l" +#line 103 "./hl/src/H5LTanalyze.l" {return token(H5T_CSET_UTF8_TOKEN);} YY_BREAK case 45: YY_RULE_SETUP -#line 96 "hl/src/H5LTanalyze.l" +#line 104 "./hl/src/H5LTanalyze.l" {return token(H5T_C_S1_TOKEN);} YY_BREAK case 46: YY_RULE_SETUP -#line 97 "hl/src/H5LTanalyze.l" +#line 105 "./hl/src/H5LTanalyze.l" {return token(H5T_FORTRAN_S1_TOKEN);} YY_BREAK case 47: YY_RULE_SETUP -#line 98 "hl/src/H5LTanalyze.l" +#line 106 "./hl/src/H5LTanalyze.l" {return token(H5T_VARIABLE_TOKEN);} YY_BREAK case 48: YY_RULE_SETUP -#line 100 "hl/src/H5LTanalyze.l" +#line 108 "./hl/src/H5LTanalyze.l" {return token(H5T_COMPOUND_TOKEN);} YY_BREAK case 49: YY_RULE_SETUP -#line 101 "hl/src/H5LTanalyze.l" +#line 109 "./hl/src/H5LTanalyze.l" {return token(H5T_ENUM_TOKEN);} YY_BREAK case 50: YY_RULE_SETUP -#line 102 "hl/src/H5LTanalyze.l" +#line 110 "./hl/src/H5LTanalyze.l" {return token(H5T_ARRAY_TOKEN);} YY_BREAK case 51: YY_RULE_SETUP -#line 103 "hl/src/H5LTanalyze.l" +#line 111 "./hl/src/H5LTanalyze.l" {return token(H5T_VLEN_TOKEN);} YY_BREAK case 52: YY_RULE_SETUP -#line 105 "hl/src/H5LTanalyze.l" +#line 113 "./hl/src/H5LTanalyze.l" {return token(H5T_OPAQUE_TOKEN);} YY_BREAK case 53: YY_RULE_SETUP -#line 106 "hl/src/H5LTanalyze.l" +#line 114 "./hl/src/H5LTanalyze.l" {return token(OPQ_SIZE_TOKEN);} YY_BREAK case 54: YY_RULE_SETUP -#line 107 "hl/src/H5LTanalyze.l" +#line 115 "./hl/src/H5LTanalyze.l" {return token(OPQ_TAG_TOKEN);} YY_BREAK case 55: YY_RULE_SETUP -#line 109 "hl/src/H5LTanalyze.l" +#line 117 "./hl/src/H5LTanalyze.l" { H5LTyylval.ival = HDatoi(yytext); return NUMBER; @@ -1481,7 +1487,7 @@ YY_RULE_SETUP case 56: /* rule 56 can match eol */ YY_RULE_SETUP -#line 114 "hl/src/H5LTanalyze.l" +#line 122 "./hl/src/H5LTanalyze.l" { H5LTyylval.sval = trim_quotes(yytext); return STRING; @@ -1489,46 +1495,46 @@ YY_RULE_SETUP YY_BREAK case 57: YY_RULE_SETUP -#line 119 "hl/src/H5LTanalyze.l" +#line 127 "./hl/src/H5LTanalyze.l" {return token('{');} YY_BREAK case 58: YY_RULE_SETUP -#line 120 "hl/src/H5LTanalyze.l" +#line 128 "./hl/src/H5LTanalyze.l" {return token('}');} YY_BREAK case 59: YY_RULE_SETUP -#line 121 "hl/src/H5LTanalyze.l" +#line 129 "./hl/src/H5LTanalyze.l" {return token('[');} YY_BREAK case 60: YY_RULE_SETUP -#line 122 "hl/src/H5LTanalyze.l" +#line 130 "./hl/src/H5LTanalyze.l" {return token(']');} YY_BREAK case 61: YY_RULE_SETUP -#line 123 "hl/src/H5LTanalyze.l" +#line 131 "./hl/src/H5LTanalyze.l" {return token(':');} YY_BREAK case 62: YY_RULE_SETUP -#line 124 "hl/src/H5LTanalyze.l" +#line 132 "./hl/src/H5LTanalyze.l" {return token(';');} YY_BREAK case 63: /* rule 63 can match eol */ YY_RULE_SETUP -#line 125 "hl/src/H5LTanalyze.l" +#line 133 "./hl/src/H5LTanalyze.l" ; YY_BREAK case 64: YY_RULE_SETUP -#line 127 "hl/src/H5LTanalyze.l" +#line 135 "./hl/src/H5LTanalyze.l" ECHO; YY_BREAK -#line 1501 "hl/src/H5LTanalyze.c" +#line 1508 "./hl/src/H5LTanalyze.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2533,7 +2539,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 127 "hl/src/H5LTanalyze.l" +#line 135 "./hl/src/H5LTanalyze.l" /* Allocate a copy of `quoted` with the double quote character at diff --git a/hl/src/H5LTanalyze.l b/hl/src/H5LTanalyze.l index 5006612..fd014a4 100644 --- a/hl/src/H5LTanalyze.l +++ b/hl/src/H5LTanalyze.l @@ -17,6 +17,14 @@ * recreate the output files. */ +%top{ +/* Quiet warnings about integer type macro redifinitions on Visual Studio + * (MSVC doesn't define STDC_VERSION, but has inttypes.h). This is an + * issue that is apparently fixed in flex 2.6.5. + */ +#include +} + %{ #include #include diff --git a/hl/src/H5LTparse.c b/hl/src/H5LTparse.c index 7f552d8..cb1d480 100644 --- a/hl/src/H5LTparse.c +++ b/hl/src/H5LTparse.c @@ -28,11 +28,12 @@ #elif defined _MSC_VER #pragma warning(push, 1) #endif -/* A Bison parser, made by GNU Bison 3.0.4. */ +/* A Bison parser, made by GNU Bison 3.5.1. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -70,11 +71,14 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0.4" +#define YYBISON_VERSION "3.5.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -95,12 +99,11 @@ #define yyerror H5LTyyerror #define yydebug H5LTyydebug #define yynerrs H5LTyynerrs - #define yylval H5LTyylval #define yychar H5LTyychar -/* Copy the first part of user declarations. */ -#line 20 "hl/src/H5LTparse.y" /* yacc.c:339 */ +/* First part of user prologue. */ +#line 20 "./hl/src/H5LTparse.y" #include #include @@ -150,13 +153,26 @@ static hbool_t is_enum_memb = 0; /*flag to lexer for enum member*/ static char* enum_memb_symbol; /*enum member symbol string*/ -#line 124 "hl/src/H5LTparse.c" /* yacc.c:339 */ +#line 127 "./hl/src/H5LTparse.c" +# ifndef YY_CAST +# ifdef __cplusplus +# define YY_CAST(Type, Val) static_cast (Val) +# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) +# else +# define YY_CAST(Type, Val) ((Type) (Val)) +# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) +# endif +# endif # ifndef YY_NULLPTR -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif # else -# define YY_NULLPTR 0 +# define YY_NULLPTR ((void*)0) # endif # endif @@ -168,8 +184,8 @@ static char* enum_memb_symbol; /*enum member symbol string*/ # define YYERROR_VERBOSE 0 #endif -/* In a future release of Bison, this section will be replaced - by #include "H5LTparse.h". */ +/* Use api.header.include to #include this header + instead of duplicating it here. */ #ifndef YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED # define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED /* Debug traces. */ @@ -246,18 +262,17 @@ extern int H5LTyydebug; /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - union YYSTYPE { -#line 69 "hl/src/H5LTparse.y" /* yacc.c:355 */ +#line 69 "./hl/src/H5LTparse.y" int ival; /*for integer token*/ char *sval; /*for name string*/ hid_t hid; /*for hid_t token*/ -#line 229 "hl/src/H5LTparse.c" /* yacc.c:355 */ -}; +#line 244 "./hl/src/H5LTparse.c" +}; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 @@ -270,36 +285,81 @@ hid_t H5LTyyparse (void); #endif /* !YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED */ -/* Copy the second part of user declarations. */ -#line 246 "hl/src/H5LTparse.c" /* yacc.c:358 */ #ifdef short # undef short #endif -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; +/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure + and (if available) are included + so that the code can choose integer types of a good width. */ + +#ifndef __PTRDIFF_MAX__ +# include /* INFRINGES ON USER NAME SPACE */ +# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_STDINT_H +# endif #endif -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; +/* Narrow types that promote to a signed type and that can represent a + signed or unsigned integer of at least N bits. In tables they can + save space and decrease cache pressure. Promoting to a signed type + helps avoid bugs in integer arithmetic. */ + +#ifdef __INT_LEAST8_MAX__ +typedef __INT_LEAST8_TYPE__ yytype_int8; +#elif defined YY_STDINT_H +typedef int_least8_t yytype_int8; #else typedef signed char yytype_int8; #endif -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; +#ifdef __INT_LEAST16_MAX__ +typedef __INT_LEAST16_TYPE__ yytype_int16; +#elif defined YY_STDINT_H +typedef int_least16_t yytype_int16; #else -typedef unsigned short int yytype_uint16; +typedef short yytype_int16; #endif -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; +#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST8_TYPE__ yytype_uint8; +#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST8_MAX <= INT_MAX) +typedef uint_least8_t yytype_uint8; +#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX +typedef unsigned char yytype_uint8; #else -typedef short int yytype_int16; +typedef short yytype_uint8; +#endif + +#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST16_TYPE__ yytype_uint16; +#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST16_MAX <= INT_MAX) +typedef uint_least16_t yytype_uint16; +#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX +typedef unsigned short yytype_uint16; +#else +typedef int yytype_uint16; +#endif + +#ifndef YYPTRDIFF_T +# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ +# define YYPTRDIFF_T __PTRDIFF_TYPE__ +# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ +# elif defined PTRDIFF_MAX +# ifndef ptrdiff_t +# include /* INFRINGES ON USER NAME SPACE */ +# endif +# define YYPTRDIFF_T ptrdiff_t +# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX +# else +# define YYPTRDIFF_T long +# define YYPTRDIFF_MAXIMUM LONG_MAX +# endif #endif #ifndef YYSIZE_T @@ -307,15 +367,27 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else -# define YYSIZE_T unsigned int +# define YYSIZE_T unsigned # endif #endif -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) +#define YYSIZE_MAXIMUM \ + YY_CAST (YYPTRDIFF_T, \ + (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ + ? YYPTRDIFF_MAXIMUM \ + : YY_CAST (YYSIZE_T, -1))) + +#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) + +/* Stored state numbers (used for stacks). */ +typedef yytype_uint8 yy_state_t; + +/* State numbers in computations. */ +typedef int yy_state_fast_t; #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS @@ -329,30 +401,19 @@ typedef short int yytype_int16; # endif #endif -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +#ifndef YY_ATTRIBUTE_PURE +# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) # else -# define YY_ATTRIBUTE(Spec) /* empty */ +# define YY_ATTRIBUTE_PURE # endif #endif -#ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) -#endif - #ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) -#endif - -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) +# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) # else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# define YY_ATTRIBUTE_UNUSED # endif #endif @@ -363,13 +424,13 @@ typedef short int yytype_int16; # define YYUSE(E) /* empty */ #endif -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value @@ -382,6 +443,20 @@ typedef short int yytype_int16; # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif +#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ +# define YY_IGNORE_USELESS_CAST_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") +# define YY_IGNORE_USELESS_CAST_END \ + _Pragma ("GCC diagnostic pop") +#endif +#ifndef YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_END +#endif + + +#define YY_ASSERT(E) ((void) (0 && (E))) #if ! defined yyoverflow || YYERROR_VERBOSE @@ -458,17 +533,17 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; + yy_state_t yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) +# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 @@ -481,11 +556,11 @@ union yyalloc # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ - YYSIZE_T yynewbytes; \ + YYPTRDIFF_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ + yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / YYSIZEOF (*yyptr); \ } \ while (0) @@ -497,12 +572,12 @@ union yyalloc # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) + __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ - YYSIZE_T yyi; \ + YYPTRDIFF_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ @@ -525,17 +600,18 @@ union yyalloc /* YYNSTATES -- Number of states. */ #define YYNSTATES 134 -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 313 + +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ #define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ -static const yytype_uint8 yytranslate[] = + as returned by yylex. */ +static const yytype_int8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -573,7 +649,7 @@ static const yytype_uint8 yytranslate[] = #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = +static const yytype_int16 yyrline[] = { 0, 102, 102, 103, 105, 106, 107, 108, 110, 111, 112, 113, 114, 117, 118, 119, 120, 121, 122, 123, @@ -628,7 +704,7 @@ static const char *const yytname[] = # ifdef YYPRINT /* YYTOKNUM[NUM] -- (External) token number corresponding to the (internal) symbol number NUM (which must be that of a token). */ -static const yytype_uint16 yytoknum[] = +static const yytype_int16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -640,14 +716,14 @@ static const yytype_uint16 yytoknum[] = }; # endif -#define YYPACT_NINF -25 +#define YYPACT_NINF (-25) -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-25))) +#define yypact_value_is_default(Yyn) \ + ((Yyn) == YYPACT_NINF) -#define YYTABLE_NINF -1 +#define YYTABLE_NINF (-1) -#define yytable_value_is_error(Yytable_value) \ +#define yytable_value_is_error(Yyn) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing @@ -673,7 +749,7 @@ static const yytype_int16 yypact[] = /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. Performed when YYTABLE does not specify something else to do. Zero means the default is an error. */ -static const yytype_uint8 yydefact[] = +static const yytype_int8 yydefact[] = { 2, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, @@ -738,7 +814,7 @@ static const yytype_uint8 yytable[] = 20, 21, 22, 23, 24, 25, 26, 27 }; -static const yytype_uint8 yycheck[] = +static const yytype_int8 yycheck[] = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, @@ -764,7 +840,7 @@ static const yytype_uint8 yycheck[] = /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = +static const yytype_int8 yystos[] = { 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, @@ -783,7 +859,7 @@ static const yytype_uint8 yystos[] = }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = +static const yytype_int8 yyr1[] = { 0, 65, 66, 66, 67, 67, 67, 67, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, @@ -798,7 +874,7 @@ static const yytype_uint8 yyr1[] = }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = +static const yytype_int8 yyr2[] = { 0, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -825,22 +901,22 @@ static const yytype_uint8 yyr2[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) +#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ + while (0) /* Error token number */ #define YYTERROR 1 @@ -880,37 +956,39 @@ do { \ } while (0) -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) { - FILE *yyo = yyoutput; - YYUSE (yyo); + FILE *yyoutput = yyo; + YYUSE (yyoutput); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); + YYPRINT (yyo, yytoknum[yytype], *yyvaluep); # endif + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) { - YYFPRINTF (yyoutput, "%s %s (", + YYFPRINTF (yyo, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); + yy_symbol_value_print (yyo, yytype, yyvaluep); + YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. @@ -919,7 +997,7 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) `------------------------------------------------------------------*/ static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -942,20 +1020,20 @@ do { \ `------------------------------------------------*/ static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) +yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule) { - unsigned long int yylno = yyrline[yyrule]; + int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) + yystos[+yyssp[yyi + 1 - yynrhs]], + &yyvsp[(yyi + 1) - (yynrhs)] ); YYFPRINTF (stderr, "\n"); } @@ -999,13 +1077,13 @@ int yydebug; # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen +# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) # else /* Return the length of YYSTR. */ -static YYSIZE_T +static YYPTRDIFF_T yystrlen (const char *yystr) { - YYSIZE_T yylen; + YYPTRDIFF_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; @@ -1041,12 +1119,12 @@ yystpcpy (char *yydest, const char *yysrc) backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ -static YYSIZE_T +static YYPTRDIFF_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { - YYSIZE_T yyn = 0; + YYPTRDIFF_T yyn = 0; char const *yyp = yystr; for (;;) @@ -1059,7 +1137,10 @@ yytnamerr (char *yyres, const char *yystr) case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; - /* Fall through. */ + else + goto append; + + append: default: if (yyres) yyres[yyn] = *yyp; @@ -1074,10 +1155,10 @@ yytnamerr (char *yyres, const char *yystr) do_not_strip_quotes: ; } - if (! yyres) + if (yyres) + return yystpcpy (yyres, yystr) - yyres; + else return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; } # endif @@ -1090,19 +1171,19 @@ yytnamerr (char *yyres, const char *yystr) *YYMSG_ALLOC to the required number of bytes. Return 2 if the required number of bytes is too large to store. */ static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) +yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, + yy_state_t *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat. */ + /* Arguments of yyformat: reported tokens (one for the "unexpected", + one per "expected"). */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ + /* Actual size of YYARG. */ int yycount = 0; + /* Cumulated lengths of YYARG. */ + YYPTRDIFF_T yysize = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then @@ -1129,7 +1210,9 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, */ if (yytoken != YYEMPTY) { - int yyn = yypact[*yyssp]; + int yyn = yypact[+*yyssp]; + YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + yysize = yysize0; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { @@ -1154,11 +1237,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } yyarg[yycount++] = yytname[yyx]; { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + YYPTRDIFF_T yysize1 + = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else return 2; - yysize = yysize1; } } } @@ -1170,6 +1254,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, case N: \ yyformat = S; \ break + default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); @@ -1180,10 +1265,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + /* Don't count the "%s"s in the final size, but reserve room for + the terminator. */ + YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1; + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else return 2; - yysize = yysize1; } if (*yymsg_alloc < yysize) @@ -1209,8 +1297,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } else { - yyp++; - yyformat++; + ++yyp; + ++yyformat; } } return 0; @@ -1253,7 +1341,7 @@ int yynerrs; hid_t yyparse (void) { - int yystate; + yy_state_fast_t yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; @@ -1265,16 +1353,16 @@ yyparse (void) to reallocate them elsewhere. */ /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; + yy_state_t yyssa[YYINITDEPTH]; + yy_state_t *yyss; + yy_state_t *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; - YYSIZE_T yystacksize; + YYPTRDIFF_T yystacksize; int yyn; int yyresult; @@ -1288,7 +1376,7 @@ yyparse (void) /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; + YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) @@ -1309,46 +1397,54 @@ yyparse (void) yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; + /*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | +| yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ - yynewstate: +yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - yysetstate: - *yyssp = yystate; + +/*--------------------------------------------------------------------. +| yysetstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + YY_IGNORE_USELESS_CAST_BEGIN + *yyssp = YY_CAST (yy_state_t, yystate); + YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + goto yyexhaustedlab; +#else { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + YYPTRDIFF_T yysize = yyssp - yyss + 1; -#ifdef yyoverflow +# if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ + yy_state_t *yyss1 = yyss; YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), + &yyss1, yysize * YYSIZEOF (*yyssp), + &yyvs1, yysize * YYSIZEOF (*yyvsp), &yystacksize); - yyss = yyss1; yyvs = yyvs1; } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else +# else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; @@ -1357,42 +1453,43 @@ yyparse (void) yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; + yy_state_t *yyss1 = yyss; union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + YY_CAST (union yyalloc *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE +# undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif -#endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + YY_IGNORE_USELESS_CAST_BEGIN + YYDPRINTF ((stderr, "Stack size increased to %ld\n", + YY_CAST (long, yystacksize))); + YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) YYABORT; } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ if (yystate == YYFINAL) YYACCEPT; goto yybackup; + /*-----------. | yybackup. | `-----------*/ yybackup: - /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ @@ -1442,15 +1539,13 @@ yybackup: /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END + /* Discard the shifted token. */ + yychar = YYEMPTY; goto yynewstate; @@ -1465,7 +1560,7 @@ yydefault: /*-----------------------------. -| yyreduce -- Do a reduction. | +| yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ @@ -1485,247 +1580,247 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 2: -#line 102 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { memset(arr_stack, 0, STACK_SIZE*sizeof(struct arr_info)); /*initialize here?*/ } -#line 1462 "hl/src/H5LTparse.c" /* yacc.c:1646 */ + case 2: +#line 102 "./hl/src/H5LTparse.y" + { memset(arr_stack, 0, STACK_SIZE*sizeof(struct arr_info)); /*initialize here?*/ } +#line 1557 "./hl/src/H5LTparse.c" break; case 3: -#line 103 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { return (yyval.hid);} -#line 1468 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 103 "./hl/src/H5LTparse.y" + { return (yyval.hid);} +#line 1563 "./hl/src/H5LTparse.c" break; case 13: -#line 117 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_STD_I8BE); } -#line 1474 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 117 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I8BE); } +#line 1569 "./hl/src/H5LTparse.c" break; case 14: -#line 118 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_STD_I8LE); } -#line 1480 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 118 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I8LE); } +#line 1575 "./hl/src/H5LTparse.c" break; case 15: -#line 119 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_STD_I16BE); } -#line 1486 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 119 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I16BE); } +#line 1581 "./hl/src/H5LTparse.c" break; case 16: -#line 120 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_STD_I16LE); } -#line 1492 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 120 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I16LE); } +#line 1587 "./hl/src/H5LTparse.c" break; case 17: -#line 121 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_STD_I32BE); } -#line 1498 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 121 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I32BE); } +#line 1593 "./hl/src/H5LTparse.c" break; case 18: -#line 122 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_STD_I32LE); } -#line 1504 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 122 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I32LE); } +#line 1599 "./hl/src/H5LTparse.c" break; case 19: -#line 123 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_STD_I64BE); } -#line 1510 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 123 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I64BE); } +#line 1605 "./hl/src/H5LTparse.c" break; case 20: -#line 124 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_STD_I64LE); } -#line 1516 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 124 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I64LE); } +#line 1611 "./hl/src/H5LTparse.c" break; case 21: -#line 125 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_STD_U8BE); } -#line 1522 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 125 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U8BE); } +#line 1617 "./hl/src/H5LTparse.c" break; case 22: -#line 126 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_STD_U8LE); } -#line 1528 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 126 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U8LE); } +#line 1623 "./hl/src/H5LTparse.c" break; case 23: -#line 127 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_STD_U16BE); } -#line 1534 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 127 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U16BE); } +#line 1629 "./hl/src/H5LTparse.c" break; case 24: -#line 128 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_STD_U16LE); } -#line 1540 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 128 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U16LE); } +#line 1635 "./hl/src/H5LTparse.c" break; case 25: -#line 129 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_STD_U32BE); } -#line 1546 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 129 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U32BE); } +#line 1641 "./hl/src/H5LTparse.c" break; case 26: -#line 130 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_STD_U32LE); } -#line 1552 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 130 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U32LE); } +#line 1647 "./hl/src/H5LTparse.c" break; case 27: -#line 131 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_STD_U64BE); } -#line 1558 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 131 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U64BE); } +#line 1653 "./hl/src/H5LTparse.c" break; case 28: -#line 132 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_STD_U64LE); } -#line 1564 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 132 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U64LE); } +#line 1659 "./hl/src/H5LTparse.c" break; case 29: -#line 133 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_NATIVE_CHAR); } -#line 1570 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 133 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_CHAR); } +#line 1665 "./hl/src/H5LTparse.c" break; case 30: -#line 134 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_NATIVE_SCHAR); } -#line 1576 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 134 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_SCHAR); } +#line 1671 "./hl/src/H5LTparse.c" break; case 31: -#line 135 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_NATIVE_UCHAR); } -#line 1582 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 135 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_UCHAR); } +#line 1677 "./hl/src/H5LTparse.c" break; case 32: -#line 136 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_NATIVE_SHORT); } -#line 1588 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 136 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_SHORT); } +#line 1683 "./hl/src/H5LTparse.c" break; case 33: -#line 137 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_NATIVE_USHORT); } -#line 1594 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 137 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_USHORT); } +#line 1689 "./hl/src/H5LTparse.c" break; case 34: -#line 138 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_NATIVE_INT); } -#line 1600 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 138 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_INT); } +#line 1695 "./hl/src/H5LTparse.c" break; case 35: -#line 139 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_NATIVE_UINT); } -#line 1606 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 139 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_UINT); } +#line 1701 "./hl/src/H5LTparse.c" break; case 36: -#line 140 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_NATIVE_LONG); } -#line 1612 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 140 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_LONG); } +#line 1707 "./hl/src/H5LTparse.c" break; case 37: -#line 141 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULONG); } -#line 1618 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 141 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULONG); } +#line 1713 "./hl/src/H5LTparse.c" break; case 38: -#line 142 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_NATIVE_LLONG); } -#line 1624 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 142 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_LLONG); } +#line 1719 "./hl/src/H5LTparse.c" break; case 39: -#line 143 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULLONG); } -#line 1630 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 143 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULLONG); } +#line 1725 "./hl/src/H5LTparse.c" break; case 40: -#line 146 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_IEEE_F32BE); } -#line 1636 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 146 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_IEEE_F32BE); } +#line 1731 "./hl/src/H5LTparse.c" break; case 41: -#line 147 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_IEEE_F32LE); } -#line 1642 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 147 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_IEEE_F32LE); } +#line 1737 "./hl/src/H5LTparse.c" break; case 42: -#line 148 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_IEEE_F64BE); } -#line 1648 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 148 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_IEEE_F64BE); } +#line 1743 "./hl/src/H5LTparse.c" break; case 43: -#line 149 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_IEEE_F64LE); } -#line 1654 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 149 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_IEEE_F64LE); } +#line 1749 "./hl/src/H5LTparse.c" break; case 44: -#line 150 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT); } -#line 1660 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 150 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT); } +#line 1755 "./hl/src/H5LTparse.c" break; case 45: -#line 151 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_NATIVE_DOUBLE); } -#line 1666 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 151 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_DOUBLE); } +#line 1761 "./hl/src/H5LTparse.c" break; case 46: -#line 152 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tcopy(H5T_NATIVE_LDOUBLE); } -#line 1672 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 152 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_LDOUBLE); } +#line 1767 "./hl/src/H5LTparse.c" break; case 47: -#line 156 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { csindex++; cmpd_stack[csindex].id = H5Tcreate(H5T_COMPOUND, 1); /*temporarily set size to 1*/ } -#line 1678 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 156 "./hl/src/H5LTparse.y" + { csindex++; cmpd_stack[csindex].id = H5Tcreate(H5T_COMPOUND, 1); /*temporarily set size to 1*/ } +#line 1773 "./hl/src/H5LTparse.c" break; case 48: -#line 158 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = cmpd_stack[csindex].id; +#line 158 "./hl/src/H5LTparse.y" + { (yyval.hid) = cmpd_stack[csindex].id; cmpd_stack[csindex].id = 0; cmpd_stack[csindex].first_memb = 1; csindex--; } -#line 1688 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1783 "./hl/src/H5LTparse.c" break; case 51: -#line 167 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/ } -#line 1694 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 167 "./hl/src/H5LTparse.y" + { cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/ } +#line 1789 "./hl/src/H5LTparse.c" break; case 52: -#line 169 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { +#line 169 "./hl/src/H5LTparse.y" + { size_t origin_size, new_size; hid_t dtype_id = cmpd_stack[csindex].id; @@ -1759,109 +1854,109 @@ yyreduce: new_size = H5Tget_size(dtype_id); } -#line 1733 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1828 "./hl/src/H5LTparse.c" break; case 53: -#line 205 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { +#line 205 "./hl/src/H5LTparse.y" + { (yyval.sval) = HDstrdup(yylval.sval); HDfree(yylval.sval); yylval.sval = NULL; } -#line 1743 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1838 "./hl/src/H5LTparse.c" break; case 54: -#line 212 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.ival) = 0; } -#line 1749 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 212 "./hl/src/H5LTparse.y" + { (yyval.ival) = 0; } +#line 1844 "./hl/src/H5LTparse.c" break; case 55: -#line 214 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.ival) = yylval.ival; } -#line 1755 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 214 "./hl/src/H5LTparse.y" + { (yyval.ival) = yylval.ival; } +#line 1850 "./hl/src/H5LTparse.c" break; case 57: -#line 218 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { asindex++; /*pushd onto the stack*/ } -#line 1761 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 218 "./hl/src/H5LTparse.y" + { asindex++; /*pushd onto the stack*/ } +#line 1856 "./hl/src/H5LTparse.c" break; case 58: -#line 220 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { +#line 220 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tarray_create2((yyvsp[-1].hid), arr_stack[asindex].ndims, arr_stack[asindex].dims); arr_stack[asindex].ndims = 0; asindex--; H5Tclose((yyvsp[-1].hid)); } -#line 1772 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1867 "./hl/src/H5LTparse.c" break; case 61: -#line 230 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { arr_stack[asindex].is_dim = 1; /*notice lexer of dimension size*/ } -#line 1778 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 230 "./hl/src/H5LTparse.y" + { arr_stack[asindex].is_dim = 1; /*notice lexer of dimension size*/ } +#line 1873 "./hl/src/H5LTparse.c" break; case 62: -#line 231 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { unsigned ndims = arr_stack[asindex].ndims; +#line 231 "./hl/src/H5LTparse.y" + { unsigned ndims = arr_stack[asindex].ndims; arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival; arr_stack[asindex].ndims++; arr_stack[asindex].is_dim = 0; } -#line 1788 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1883 "./hl/src/H5LTparse.c" break; case 65: -#line 242 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = H5Tvlen_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } -#line 1794 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 242 "./hl/src/H5LTparse.y" + { (yyval.hid) = H5Tvlen_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } +#line 1889 "./hl/src/H5LTparse.c" break; case 66: -#line 248 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { +#line 248 "./hl/src/H5LTparse.y" + { size_t size = (size_t)yylval.ival; (yyval.hid) = H5Tcreate(H5T_OPAQUE, size); } -#line 1803 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1898 "./hl/src/H5LTparse.c" break; case 67: -#line 253 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { +#line 253 "./hl/src/H5LTparse.y" + { H5Tset_tag((yyvsp[-3].hid), yylval.sval); HDfree(yylval.sval); yylval.sval = NULL; } -#line 1813 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1908 "./hl/src/H5LTparse.c" break; case 68: -#line 258 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { (yyval.hid) = (yyvsp[-5].hid); } -#line 1819 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 258 "./hl/src/H5LTparse.y" + { (yyval.hid) = (yyvsp[-5].hid); } +#line 1914 "./hl/src/H5LTparse.c" break; case 71: -#line 267 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { +#line 267 "./hl/src/H5LTparse.y" + { if((yyvsp[-1].ival) == H5T_VARIABLE_TOKEN) is_variable = 1; else str_size = yylval.ival; } -#line 1830 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1925 "./hl/src/H5LTparse.c" break; case 72: -#line 274 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { +#line 274 "./hl/src/H5LTparse.y" + { if((yyvsp[-1].ival) == H5T_STR_NULLTERM_TOKEN) str_pad = H5T_STR_NULLTERM; else if((yyvsp[-1].ival) == H5T_STR_NULLPAD_TOKEN) @@ -1869,34 +1964,34 @@ yyreduce: else if((yyvsp[-1].ival) == H5T_STR_SPACEPAD_TOKEN) str_pad = H5T_STR_SPACEPAD; } -#line 1843 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1938 "./hl/src/H5LTparse.c" break; case 73: -#line 283 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { +#line 283 "./hl/src/H5LTparse.y" + { if((yyvsp[-1].ival) == H5T_CSET_ASCII_TOKEN) str_cset = H5T_CSET_ASCII; else if((yyvsp[-1].ival) == H5T_CSET_UTF8_TOKEN) str_cset = H5T_CSET_UTF8; } -#line 1854 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1949 "./hl/src/H5LTparse.c" break; case 74: -#line 290 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { +#line 290 "./hl/src/H5LTparse.y" + { if((yyvsp[-1].hid) == H5T_C_S1_TOKEN) (yyval.hid) = H5Tcopy(H5T_C_S1); else if((yyvsp[-1].hid) == H5T_FORTRAN_S1_TOKEN) (yyval.hid) = H5Tcopy(H5T_FORTRAN_S1); } -#line 1865 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1960 "./hl/src/H5LTparse.c" break; case 75: -#line 297 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { +#line 297 "./hl/src/H5LTparse.y" + { hid_t str_id = (yyvsp[-1].hid); /*set string size*/ @@ -1912,83 +2007,83 @@ yyreduce: (yyval.hid) = str_id; } -#line 1886 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 1981 "./hl/src/H5LTparse.c" break; case 76: -#line 314 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - {(yyval.ival) = H5T_VARIABLE_TOKEN;} -#line 1892 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 314 "./hl/src/H5LTparse.y" + {(yyval.ival) = H5T_VARIABLE_TOKEN;} +#line 1987 "./hl/src/H5LTparse.c" break; case 78: -#line 317 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - {(yyval.ival) = H5T_STR_NULLTERM_TOKEN;} -#line 1898 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 317 "./hl/src/H5LTparse.y" + {(yyval.ival) = H5T_STR_NULLTERM_TOKEN;} +#line 1993 "./hl/src/H5LTparse.c" break; case 79: -#line 318 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - {(yyval.ival) = H5T_STR_NULLPAD_TOKEN;} -#line 1904 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 318 "./hl/src/H5LTparse.y" + {(yyval.ival) = H5T_STR_NULLPAD_TOKEN;} +#line 1999 "./hl/src/H5LTparse.c" break; case 80: -#line 319 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - {(yyval.ival) = H5T_STR_SPACEPAD_TOKEN;} -#line 1910 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 319 "./hl/src/H5LTparse.y" + {(yyval.ival) = H5T_STR_SPACEPAD_TOKEN;} +#line 2005 "./hl/src/H5LTparse.c" break; case 81: -#line 321 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - {(yyval.ival) = H5T_CSET_ASCII_TOKEN;} -#line 1916 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 321 "./hl/src/H5LTparse.y" + {(yyval.ival) = H5T_CSET_ASCII_TOKEN;} +#line 2011 "./hl/src/H5LTparse.c" break; case 82: -#line 322 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - {(yyval.ival) = H5T_CSET_UTF8_TOKEN;} -#line 1922 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 322 "./hl/src/H5LTparse.y" + {(yyval.ival) = H5T_CSET_UTF8_TOKEN;} +#line 2017 "./hl/src/H5LTparse.c" break; case 83: -#line 324 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - {(yyval.hid) = H5T_C_S1_TOKEN;} -#line 1928 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 324 "./hl/src/H5LTparse.y" + {(yyval.hid) = H5T_C_S1_TOKEN;} +#line 2023 "./hl/src/H5LTparse.c" break; case 84: -#line 325 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - {(yyval.hid) = H5T_FORTRAN_S1_TOKEN;} -#line 1934 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 325 "./hl/src/H5LTparse.y" + {(yyval.hid) = H5T_FORTRAN_S1_TOKEN;} +#line 2029 "./hl/src/H5LTparse.c" break; case 85: -#line 329 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { is_enum = 1; enum_id = H5Tenum_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } -#line 1940 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 329 "./hl/src/H5LTparse.y" + { is_enum = 1; enum_id = H5Tenum_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } +#line 2035 "./hl/src/H5LTparse.c" break; case 86: -#line 331 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { is_enum = 0; /*reset*/ (yyval.hid) = enum_id; } -#line 1946 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 331 "./hl/src/H5LTparse.y" + { is_enum = 0; /*reset*/ (yyval.hid) = enum_id; } +#line 2041 "./hl/src/H5LTparse.c" break; case 89: -#line 336 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { +#line 336 "./hl/src/H5LTparse.y" + { is_enum_memb = 1; /*indicate member of enum*/ enum_memb_symbol = HDstrdup(yylval.sval); HDfree(yylval.sval); yylval.sval = NULL; } -#line 1957 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 2052 "./hl/src/H5LTparse.c" break; case 90: -#line 343 "hl/src/H5LTparse.y" /* yacc.c:1646 */ - { +#line 343 "./hl/src/H5LTparse.y" + { char char_val=(char)yylval.ival; short short_val=(short)yylval.ival; int int_val=(int)yylval.ival; @@ -2030,11 +2125,12 @@ yyreduce: H5Tclose(super); H5Tclose(native); } -#line 2004 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 2099 "./hl/src/H5LTparse.c" break; -#line 2008 "hl/src/H5LTparse.c" /* yacc.c:1646 */ +#line 2103 "./hl/src/H5LTparse.c" + default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -2059,14 +2155,13 @@ yyreduce: /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; + { + const int yylhs = yyr1[yyn] - YYNTOKENS; + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp + ? yytable[yyi] + : yydefgoto[yylhs]); + } goto yynewstate; @@ -2098,7 +2193,7 @@ yyerrlab: { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); if (!yymsg) { yymsg = yymsgbuf; @@ -2149,12 +2244,10 @@ yyerrlab: | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ @@ -2216,6 +2309,7 @@ yyacceptlab: yyresult = 0; goto yyreturn; + /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ @@ -2223,6 +2317,7 @@ yyabortlab: yyresult = 1; goto yyreturn; + #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | @@ -2233,6 +2328,10 @@ yyexhaustedlab: /* Fall through. */ #endif + +/*-----------------------------------------------------. +| yyreturn -- parsing is finished, return the result. | +`-----------------------------------------------------*/ yyreturn: if (yychar != YYEMPTY) { @@ -2249,7 +2348,7 @@ yyreturn: while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); + yystos[+*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow diff --git a/hl/src/H5LTparse.h b/hl/src/H5LTparse.h index 9dd2fba..6464f26 100644 --- a/hl/src/H5LTparse.h +++ b/hl/src/H5LTparse.h @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ +/* A Bison parser, made by GNU Bison 3.5.1. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +31,9 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + #ifndef YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED # define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED /* Debug traces. */ @@ -106,18 +110,17 @@ extern int H5LTyydebug; /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - union YYSTYPE { -#line 69 "hl/src/H5LTparse.y" /* yacc.c:1909 */ +#line 69 "./hl/src/H5LTparse.y" int ival; /*for integer token*/ char *sval; /*for name string*/ hid_t hid; /*for hid_t token*/ -#line 119 "hl/src/H5LTparse.h" /* yacc.c:1909 */ -}; +#line 122 "./hl/src/H5LTparse.h" +}; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 diff --git a/hl/src/H5LTpublic.h b/hl/src/H5LTpublic.h index a6c7c84..2f87944 100644 --- a/hl/src/H5LTpublic.h +++ b/hl/src/H5LTpublic.h @@ -35,6 +35,116 @@ typedef enum H5LT_lang_t { extern "C" { #endif +/**\defgroup H5LT Lite + * Functions used to simplify creating and manipulating datasets, + * attributes and other features (H5LT, H5LD) + * + * The HDF5 Lite API consists of higher-level functions which do + * more operations per call than the basic HDF5 interface. + * The purpose is to wrap intuitive functions around certain sets + * of features in the existing APIs. + * It has the following sets of functions listed below. + * + * \note \Bold{Programming hints:} + * \note To use any of these functions or subroutines, + * you must first include the relevant include file (C) or + * module (Fortran) in your application. + * \note The following line includes the HDF5 Lite package, H5LT, + * in C applications: + * \code #include "hdf5_hl.h" \endcode + * \note This line includes the H5LT module in Fortran applications: + * \code use h5lt \endcode + * + * - Dataset Functions + * - Make dataset functions + * - \ref H5LTmake_dataset + * - \ref H5LTmake_dataset_char + * - \ref H5LTmake_dataset_short + * - \ref H5LTmake_dataset_int + * - \ref H5LTmake_dataset_long + * - \ref H5LTmake_dataset_float + * - \ref H5LTmake_dataset_double + * - \ref H5LTmake_dataset_string + * . + * - Read dataset functions + * - \ref H5LTread_dataset + * - \ref H5LTread_dataset_char + * - \ref H5LTread_dataset_short + * - \ref H5LTread_dataset_int + * - \ref H5LTread_dataset_long + * - \ref H5LTread_dataset_float + * - \ref H5LTread_dataset_double + * - \ref H5LTread_dataset_string + * . + * - Query dataset functions + * - \ref H5LTfind_dataset + * - \ref H5LTget_dataset_ndims + * - \ref H5LTget_dataset_info + * . + * - Dataset watch functions + * - \ref H5LDget_dset_dims + * - \ref H5LDget_dset_elmts + * - \ref H5LDget_dset_type_size + * . + * . + * - Attribute Functions + * - Set attribute functions + * - \ref H5LTset_attribute_string + * - \ref H5LTset_attribute_char + * - \ref H5LTset_attribute_uchar + * - \ref H5LTset_attribute_short + * - \ref H5LTset_attribute_ushort + * - \ref H5LTset_attribute_int + * - \ref H5LTset_attribute_uint + * - \ref H5LTset_attribute_long + * - \ref H5LTset_attribute_long_long + * - \ref H5LTset_attribute_ulong + * - \ref H5LTset_attribute_ullong + * - \ref H5LTset_attribute_float + * - \ref H5LTset_attribute_double + * - \ref H5LTset_attribute_f (fortran ONLY) + * . + * - Get attribute functions + * - \ref H5LTget_attribute + * - \ref H5LTget_attribute_string + * - \ref H5LTget_attribute_char + * - \ref H5LTget_attribute_uchar + * - \ref H5LTget_attribute_short + * - \ref H5LTget_attribute_ushort + * - \ref H5LTget_attribute_int + * - \ref H5LTget_attribute_uint + * - \ref H5LTget_attribute_long + * - \ref H5LTget_attribute_long_long + * - \ref H5LTget_attribute_ulong + * - \ref H5LTget_attribute_ullong + * - \ref H5LTget_attribute_float + * - \ref H5LTget_attribute_double + * . + * - Query attribute functions + * - \ref H5LTfind_attribute + * - \ref H5LTget_attribute_info + * - \ref H5LTget_attribute_ndims + * . + * . + * - Datatype Functions + * - Datatype translation functions + * - \ref H5LTtext_to_dtype + * - \ref H5LTdtype_to_text + * . + * . + * - File image function + * - Open file image function + * - \ref H5LTopen_file_image + * . + * . + * - Path and object function + * - Query path and object function + * - \ref H5LTpath_valid + * . + * . + * . + */ + /*------------------------------------------------------------------------- * * Make dataset functions @@ -42,27 +152,214 @@ extern "C" { *------------------------------------------------------------------------- */ +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes a dataset of a type \p type_id. + * + * \fg_loc_id + * \param[in] dset_name The Name of the dataset to create + * \param[in] rank Number of dimensions of dataspace + * \param[in] dims An array of the size of each dimension + * \param[in] type_id Identifier of the datatype to use when creating the dataset + * \param[in] buffer Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5LTmake_dataset() creates and writes a dataset named + * \p dset_name attached to the object specified by the + * identifier \p loc_id. + * + * The parameter \p type_id can be any valid HDF5 Prdefined \ref PDTNAT; + * For example, setting \p type_id to #H5T_NATIVE_INT will result in a dataset + * of signed \e integer datatype. + * + * \version 1.10.0 Fortran 2003 subroutine added to accept a C address of the data buffer. + * \version 1.8.7 Fortran subroutine modified in this release to accommodate arrays + * with more than three dimensions. + * + */ H5_HLDLL herr_t H5LTmake_dataset(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, hid_t type_id, const void *buffer); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes a dataset. + * + * \fg_loc_id + * \param[in] dset_name The Name of the dataset to create + * \param[in] rank Number of dimensions of dataspace + * \param[in] dims An array of the size of each dimension + * \param[in] buffer Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5LTmake_dataset_char() creates and writes a dataset + * named \p dset_name attached to the object specified by + * the identifier \p loc_id. + * + * The dataset’s datatype will be \e character, #H5T_NATIVE_CHAR. + * + */ H5_HLDLL herr_t H5LTmake_dataset_char(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const char *buffer); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes a dataset. + * + * \fg_loc_id + * \param[in] dset_name The Name of the dataset to create + * \param[in] rank Number of dimensions of dataspace + * \param[in] dims An array of the size of each dimension + * \param[in] buffer Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5LTmake_dataset_short() creates and writes a dataset + * named \p dset_name attached to the object specified by + * the identifier \p loc_id. + * + * The dataset’s datatype will be short signed integer, + * #H5T_NATIVE_SHORT. + * + */ H5_HLDLL herr_t H5LTmake_dataset_short(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const short *buffer); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes a dataset. + * + * \fg_loc_id + * \param[in] dset_name The Name of the dataset to create + * \param[in] rank Number of dimensions of dataspace + * \param[in] dims An array of the size of each dimension + * \param[in] buffer Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5LTmake_dataset_int() creates and writes a dataset + * named \p dset_name attached to the object specified by + * the identifier \p loc_id. + * + * The dataset’s datatype will be native signed integer, + * #H5T_NATIVE_INT. + * + * \version Fortran subroutine modified in this release to accommodate + * arrays with more than three dimensions. + * + */ H5_HLDLL herr_t H5LTmake_dataset_int(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const int *buffer); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes a dataset. + * + * \fg_loc_id + * \param[in] dset_name The Name of the dataset to create + * \param[in] rank Number of dimensions of dataspace + * \param[in] dims An array of the size of each dimension + * \param[in] buffer Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5LTmake_dataset_long() creates and writes a dataset + * named \p dset_name attached to the object specified by + * the identifier \p loc_id. + * + * The dataset’s datatype will be long signed integer, + * #H5T_NATIVE_LONG. + * + */ H5_HLDLL herr_t H5LTmake_dataset_long(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const long *buffer); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes a dataset. + * + * \fg_loc_id + * \param[in] dset_name The Name of the dataset to create + * \param[in] rank Number of dimensions of dataspace + * \param[in] dims An array of the size of each dimension + * \param[in] buffer Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5LTmake_dataset_float() creates and writes a dataset + * named \p dset_name attached to the object specified by + * the identifier \p loc_id. + * + * The dataset’s datatype will be native floating point, + * #H5T_NATIVE_FLOAT. + * + * \version 1.8.7 Fortran subroutine modified in this release to accommodate + * arrays with more than three dimensions. + * + */ H5_HLDLL herr_t H5LTmake_dataset_float(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const float *buffer); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes a dataset. + * + * \fg_loc_id + * \param[in] dset_name The Name of the dataset to create + * \param[in] rank Number of dimensions of dataspace + * \param[in] dims An array of the size of each dimension + * \param[in] buffer Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5LTmake_dataset_double() creates and writes a dataset + * named \p dset_name attached to the object specified by + * the identifier \p loc_id. + * + * The dataset’s datatype will be + * native floating-point double, #H5T_NATIVE_DOUBLE. + * + * \version 1.8.7 Fortran subroutine modified in this release to accommodate + * arrays with more than three dimensions. + * + */ H5_HLDLL herr_t H5LTmake_dataset_double(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const double *buffer); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes a dataset with string datatype. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to create + * \param[in] buf Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5LTmake_dataset_string() creates and writes a dataset + * named \p dset_name attached to the object specified by + * the identifier \p loc_id. + * + * The dataset’s datatype will be C string, #H5T_C_S1. + * + */ H5_HLDLL herr_t H5LTmake_dataset_string(hid_t loc_id, const char *dset_name, const char *buf); /*------------------------------------------------------------------------- @@ -72,20 +369,169 @@ H5_HLDLL herr_t H5LTmake_dataset_string(hid_t loc_id, const char *dset_name, con *------------------------------------------------------------------------- */ +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads a dataset from disk. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[in] type_id Identifier of the datatype to use when reading + * the dataset + * \param[out] buffer Buffer with data + * + * \return \herr_t + * + * \details H5LTread_dataset() reads a dataset named \p dset_name + * attached to the object specified by the identifier \p loc_id. + * + * \version 1.10.0 Fortran 2003 subroutine added to accept a C + * address of the data buffer. + * \version 1.8.7 Fortran subroutine modified in this release to + * accommodate arrays with more than three dimensions. + * + */ H5_HLDLL herr_t H5LTread_dataset(hid_t loc_id, const char *dset_name, hid_t type_id, void *buffer); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads a dataset from disk. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[out] buffer Buffer with data + * + * \return \herr_t + * + * \details H5LTread_dataset_char() reads a dataset named \p dset_name + * attached to the object specified by the identifier \p loc_id. + * The HDF5 datatype is #H5T_NATIVE_CHAR. + * + */ H5_HLDLL herr_t H5LTread_dataset_char(hid_t loc_id, const char *dset_name, char *buffer); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads a dataset from disk. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[out] buffer Buffer with data + * + * \return \herr_t + * + * \details H5LTread_dataset_short() reads a dataset named \p dset_name + * attached to the object specified by the identifier \p loc_id. + * The HDF5 datatype is #H5T_NATIVE_SHORT. + * + */ H5_HLDLL herr_t H5LTread_dataset_short(hid_t loc_id, const char *dset_name, short *buffer); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads a dataset from disk. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[out] buffer Buffer with data + * + * \return \herr_t + * + * \details H5LTread_dataset_int() reads a dataset named \p dset_name + * attached to the object specified by the identifier \p loc_id. + * The HDF5 datatype is #H5T_NATIVE_INT. + * + * \version 1.8.7 Fortran subroutine modified in this release to + * accommodate arrays with more than three dimensions. + * + */ H5_HLDLL herr_t H5LTread_dataset_int(hid_t loc_id, const char *dset_name, int *buffer); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads a dataset from disk. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[out] buffer Buffer with data + * + * \return \herr_t + * + * \details H5LTread_dataset_long() reads a dataset named \p dset_name + * attached to the object specified by the identifier \p loc_id. + * The HDF5 datatype is #H5T_NATIVE_LONG. + * + */ H5_HLDLL herr_t H5LTread_dataset_long(hid_t loc_id, const char *dset_name, long *buffer); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads a dataset from disk. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[out] buffer Buffer with data + * + * \return \herr_t + * + * \details H5LTread_dataset_float() reads a dataset named \p dset_name + * attached to the object specified by the identifier \p loc_id. + * The HDF5 datatype is #H5T_NATIVE_FLOAT. + * + * \version 1.8.7 Fortran subroutine modified in this release to + * accommodate arrays with more than three dimensions. + */ H5_HLDLL herr_t H5LTread_dataset_float(hid_t loc_id, const char *dset_name, float *buffer); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads a dataset from disk. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[out] buffer Buffer with data + * + * \return \herr_t + * + * \details H5LTread_dataset_double() reads a dataset named \p dset_name + * attached to the object specified by the identifier \p loc_id. + * The HDF5 datatype is #H5T_NATIVE_DOUBLE. + * + * \version 1.8.7 Fortran subroutine modified in this release to + * accommodate arrays with more than three dimensions. + */ H5_HLDLL herr_t H5LTread_dataset_double(hid_t loc_id, const char *dset_name, double *buffer); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads a dataset from disk. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[out] buf Buffer with data + * + * \return \herr_t + * + * \details H5LTread_dataset_string() reads a dataset named \p dset_name + * attached to the object specified by the identifier \p loc_id. + * The HDF5 datatype is #H5T_C_S1. + * + */ H5_HLDLL herr_t H5LTread_dataset_string(hid_t loc_id, const char *dset_name, char *buf); /*------------------------------------------------------------------------- @@ -95,11 +541,67 @@ H5_HLDLL herr_t H5LTread_dataset_string(hid_t loc_id, const char *dset_name, cha *------------------------------------------------------------------------- */ +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Gets the dimensionality of a dataset + * + * \param[in] loc_id Identifier of the object to + * locate the dataset within + * \param[in] dset_name The dataset name + * \param[out] rank The dimensionality of the dataset + * + * \return \herr_t + * + * \details H5LTget_dataset_ndims() gets the dimensionality of a dataset + * named \p dset_name exists attached to the object \p loc_id. + * + */ H5_HLDLL herr_t H5LTget_dataset_ndims(hid_t loc_id, const char *dset_name, int *rank); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Retrieves information about a dataset + * + * \param[in] loc_id Identifier of the object to locate + * the dataset within + * \param[in] dset_name The dataset name + * \param[out] dims The dimensions of the dataset + * \param[out] type_class The class identifier. #H5T_class_t is defined in + * H5Tpublic.h. See H5Tget_class() for a list + * of class types. + * \param[out] type_size The size of the datatype in bytes + * + * \return \herr_t + * + * \details H5LTget_dataset_info() retrieves information about a dataset + * named \p dset_name attached to the object \p loc_id. + * + */ H5_HLDLL herr_t H5LTget_dataset_info(hid_t loc_id, const char *dset_name, hsize_t *dims, H5T_class_t *type_class, size_t *type_size); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Determines whether a dataset exists. + * + * \param[in] loc_id Identifier of the group containing the dataset + * \param[in] name Dataset name + * + * \return \htri_t + * + * \details H5LTfind_dataset() determines whether a dataset named + * \p name exists in the group specified by \p loc_id. + * + * \p loc_id must be a group identifier and \p name must + * specify a dataset that is a member of that group. + * + */ H5_HLDLL herr_t H5LTfind_dataset(hid_t loc_id, const char *name); /*------------------------------------------------------------------------- @@ -109,42 +611,343 @@ H5_HLDLL herr_t H5LTfind_dataset(hid_t loc_id, const char *name); *------------------------------------------------------------------------- */ +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes a string attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] attr_data Buffer with data to be written to the attribute + * + * \return \herr_t + * + * \details H5LTset_attribute_string() creates and writes a string attribute + * named \p attr_name and attaches it to the object specified by + * the name \p obj_name. If the attribute already exists, + * it is overwritten. + * + */ H5_HLDLL herr_t H5LTset_attribute_string(hid_t loc_id, const char *obj_name, const char *attr_name, const char *attr_data); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] buffer Buffer with data to be written to the attribute + * \param[in] size The size of the 1D array (one in the case of a + * scalar attribute). This value is used by + * H5Screate_simple() to create the dataspace. + * + * \return \herr_t + * + * \details H5LTset_attribute_char() creates and writes a numerical attribute + * named \p attr_name and attaches it to the object specified by the + * name \p obj_name. The attribute has a dimensionality of 1. + * The HDF5 datatype of the attribute is #H5T_NATIVE_CHAR. + * + */ H5_HLDLL herr_t H5LTset_attribute_char(hid_t loc_id, const char *obj_name, const char *attr_name, const char *buffer, size_t size); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] buffer Buffer with data to be written to the attribute + * \param[in] size The size of the 1D array (one in the case of a + * scalar attribute). This value is used by + * H5Screate_simple() to create the dataspace. + * + * \return \herr_t + * + * \details H5LTset_attribute_uchar() creates and writes a numerical attribute + * named \p attr_name and attaches it to the object specified by the + * name \p obj_name. The attribute has a dimensionality of 1. + * The HDF5 datatype of the attribute is #H5T_NATIVE_UCHAR. + * + */ H5_HLDLL herr_t H5LTset_attribute_uchar(hid_t loc_id, const char *obj_name, const char *attr_name, const unsigned char *buffer, size_t size); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] buffer Buffer with data to be written to the attribute + * \param[in] size The size of the 1D array (one in the case of a + * scalar attribute). This value is used by + * H5Screate_simple() to create the dataspace. + * + * \return \herr_t + * + * \details H5LTset_attribute_short() creates and writes a numerical attribute + * named \p attr_name and attaches it to the object specified by the + * name \p obj_name. The attribute has a dimensionality of 1. + * The HDF5 datatype of the attribute is #H5T_NATIVE_SHORT. + * + */ H5_HLDLL herr_t H5LTset_attribute_short(hid_t loc_id, const char *obj_name, const char *attr_name, const short *buffer, size_t size); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] buffer Buffer with data to be written to the attribute + * \param[in] size The size of the 1D array (one in the case of a + * scalar attribute). This value is used by + * H5Screate_simple() to create the dataspace. + * + * \return \herr_t + * + * \details H5LTset_attribute_ushort() creates and writes a numerical attribute + * named \p attr_name and attaches it to the object specified by the + * name \p obj_name. The attribute has a dimensionality of 1. + * The HDF5 datatype of the attribute is #H5T_NATIVE_USHORT. + * + */ H5_HLDLL herr_t H5LTset_attribute_ushort(hid_t loc_id, const char *obj_name, const char *attr_name, const unsigned short *buffer, size_t size); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] buffer Buffer with data to be written to the attribute + * \param[in] size The size of the 1D array (one in the case of a + * scalar attribute). This value is used by + * H5Screate_simple() to create the dataspace. + * + * \return \herr_t + * + * \details H5LTset_attribute_int() creates and writes a numerical integer + * attribute named \p attr_name and attaches it to the object + * specified by the name \p obj_name. The attribute has a + * dimensionality of 1. The HDF5 datatype of the attribute + * is #H5T_NATIVE_INT. + * + */ H5_HLDLL herr_t H5LTset_attribute_int(hid_t loc_id, const char *obj_name, const char *attr_name, const int *buffer, size_t size); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] buffer Buffer with data to be written to the attribute + * \param[in] size The size of the 1D array (one in the case of a + * scalar attribute). This value is used by + * H5Screate_simple() to create the dataspace. + * + * \return \herr_t + * + * \details H5LTset_attribute_uint() creates and writes a numerical integer + * attribute named \p attr_name and attaches it to the object specified + * by the name \p obj_name. The attribute has a dimensionality of 1. + * The HDF5 datatype of the attribute is #H5T_NATIVE_UINT. + * + */ H5_HLDLL herr_t H5LTset_attribute_uint(hid_t loc_id, const char *obj_name, const char *attr_name, const unsigned int *buffer, size_t size); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] buffer Buffer with data to be written to the attribute + * \param[in] size The size of the 1D array (one in the case of a + * scalar attribute). This value is used by + * H5Screate_simple() to create the dataspace. + * + * \return \herr_t + * + * \details H5LTset_attribute_long() creates and writes a numerical + * attribute named \p attr_name and attaches it to the object + * specified by the name \p obj_name. The attribute has a + * dimensionality of 1. The HDF5 datatype of the attribute + * is #H5T_NATIVE_LONG. + * + */ H5_HLDLL herr_t H5LTset_attribute_long(hid_t loc_id, const char *obj_name, const char *attr_name, const long *buffer, size_t size); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Location of the object to which the attribute + * is to be attached + * \param[in] obj_name That object's name + * \param[in] attr_name Attribute name + * \param[in] buffer Attribute value + * \param[in] size Attribute size + * + * \return \herr_t + * + * \details H5LTset_attribute_long_long() creates and writes a numerical + * attribute named \p attr_name and attaches it to the object + * specified by the name \p obj_name. + * + * The attribute has a dimensionality of 1 and its HDF5 datatype + * is #H5T_NATIVE_LLONG. + * + */ H5_HLDLL herr_t H5LTset_attribute_long_long(hid_t loc_id, const char *obj_name, const char *attr_name, const long long *buffer, size_t size); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] buffer Buffer with data to be written to the attribute + * \param[in] size The size of the 1D array (one in the case of a + * scalar attribute). This value is used by + * H5Screate_simple() to create the dataspace. + * + * \return \herr_t + * + * \details H5LTset_attribute_ulong() creates and writes a numerical + * attribute named \p attr_name and attaches it to the object + * specified by the name \p obj_name. The attribute has a + * dimensionality of 1. The HDF5 datatype of the attribute + * is #H5T_NATIVE_ULONG. + * + */ H5_HLDLL herr_t H5LTset_attribute_ulong(hid_t loc_id, const char *obj_name, const char *attr_name, const unsigned long *buffer, size_t size); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Location of the object to which the attribute + * is to be attached + * \param[in] obj_name That object's name + * \param[in] attr_name Attribute name + * \param[in] buffer Attribute value + * \param[in] size Attribute size + * + * \return \herr_t + * + * \details H5LTset_attribute_ullong() creates and writes a numerical + * attribute named \p attr_name and attaches it to the object + * specified by the name \p obj_name. + * + * The attribute has a dimensionality of 1 and its HDF5 datatype + * is #H5T_NATIVE_ULLONG. + * + */ H5_HLDLL herr_t H5LTset_attribute_ullong(hid_t loc_id, const char *obj_name, const char *attr_name, const unsigned long long *buffer, size_t size); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] buffer Buffer with data to be written to the attribute + * \param[in] size The size of the 1D array (one in the case of a + * scalar attribute). This value is used by + * H5Screate_simple() to create the dataspace. + * + * \return \herr_t + * + * \details H5LTset_attribute_float() creates and writes a numerical + * floating point attribute named \p attr_name and attaches + * it to the object specified by the name \p obj_name. + * The attribute has a dimensionality of 1. The HDF5 datatype + * of the attribute is #H5T_NATIVE_FLOAT. + * + */ H5_HLDLL herr_t H5LTset_attribute_float(hid_t loc_id, const char *obj_name, const char *attr_name, const float *buffer, size_t size); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] buffer Buffer with data to be written to the attribute + * \param[in] size The size of the 1D array (one in the case of a + * scalar attribute). This value is used by + * H5Screate_simple() to create the dataspace. + * + * \return \herr_t + * + * \details H5LTset_attribute_double() creates and writes a numerical + * attribute named \p attr_name and attaches + * it to the object specified by the name \p obj_name. + * The attribute has a dimensionality of 1. The HDF5 datatype + * of the attribute is #H5T_NATIVE_DOUBLE. + * + */ H5_HLDLL herr_t H5LTset_attribute_double(hid_t loc_id, const char *obj_name, const char *attr_name, const double *buffer, size_t size); @@ -155,42 +958,337 @@ H5_HLDLL herr_t H5LTset_attribute_double(hid_t loc_id, const char *obj_name, con *------------------------------------------------------------------------- */ +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[in] mem_type_id Identifier of the memory datatype + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute() reads an attribute named + * \p attr_name with the memory type \p mem_type_id. + * + */ H5_HLDLL herr_t H5LTget_attribute(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t mem_type_id, void *data); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_string() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The datatype is a string. + * + * \version 1.8.9 The content of the buffer returned by the Fortran + * subroutine has changed in this release:\n + * If the returned buffer requires padding, + * h5ltget_attribute_string_f() now employs space + * padding; this buffer was previously returned with a C NULL terminator. + * + */ H5_HLDLL herr_t H5LTget_attribute_string(hid_t loc_id, const char *obj_name, const char *attr_name, char *data); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_char() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The datatype of the attribute + * is #H5T_NATIVE_CHAR. + * + */ H5_HLDLL herr_t H5LTget_attribute_char(hid_t loc_id, const char *obj_name, const char *attr_name, char *data); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_uchar() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The HDF5 datatype of the + * attribute is #H5T_NATIVE_UCHAR + * + */ H5_HLDLL herr_t H5LTget_attribute_uchar(hid_t loc_id, const char *obj_name, const char *attr_name, unsigned char *data); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_short() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The HDF5 datatype of the + * attribute is #H5T_NATIVE_SHORT + * + */ H5_HLDLL herr_t H5LTget_attribute_short(hid_t loc_id, const char *obj_name, const char *attr_name, short *data); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_ushort() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The HDF5 datatype of the + * attribute is #H5T_NATIVE_USHORT. + * + */ H5_HLDLL herr_t H5LTget_attribute_ushort(hid_t loc_id, const char *obj_name, const char *attr_name, unsigned short *data); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_int() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The HDF5 datatype of the + * attribute is #H5T_NATIVE_INT. + * + */ H5_HLDLL herr_t H5LTget_attribute_int(hid_t loc_id, const char *obj_name, const char *attr_name, int *data); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_uint() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The HDF5 datatype of the + * attribute is #H5T_NATIVE_INT. + * + */ H5_HLDLL herr_t H5LTget_attribute_uint(hid_t loc_id, const char *obj_name, const char *attr_name, unsigned int *data); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_long() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The HDF5 datatype of the + * attribute is #H5T_NATIVE_LONG. + * + */ H5_HLDLL herr_t H5LTget_attribute_long(hid_t loc_id, const char *obj_name, const char *attr_name, long *data); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads a \e long \e long attribute. + * + * \param[in] loc_id Location of the object to which + * the attribute is attached + * \param[in] obj_name That object's name + * \param[in] attr_name Attribute name + * \param[out] data Attribute value + * + * \return \herr_t + * + * \details H5LTget_attribute_long_long() reads the attribute + * specified by \p loc_id and \p obj_name. + * + */ H5_HLDLL herr_t H5LTget_attribute_long_long(hid_t loc_id, const char *obj_name, const char *attr_name, long long *data); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_ulong() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The HDF5 datatype of the + * attribute is #H5T_NATIVE_ULONG. + * + */ H5_HLDLL herr_t H5LTget_attribute_ulong(hid_t loc_id, const char *obj_name, const char *attr_name, unsigned long *data); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_ullong() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The HDF5 datatype of the + * attribute is #H5T_NATIVE_ULLONG. + * + */ H5_HLDLL herr_t H5LTget_attribute_ullong(hid_t loc_id, const char *obj_name, const char *attr_name, unsigned long long *data); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_float() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The HDF5 datatype of the + * attribute is #H5T_NATIVE_FLOAT. + * + */ H5_HLDLL herr_t H5LTget_attribute_float(hid_t loc_id, const char *obj_name, const char *attr_name, float *data); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_double() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The HDF5 datatype of the + * attribute is #H5T_NATIVE_DOUBLE. + * + */ H5_HLDLL herr_t H5LTget_attribute_double(hid_t loc_id, const char *obj_name, const char *attr_name, double *data); @@ -201,8 +1299,55 @@ H5_HLDLL herr_t H5LTget_attribute_double(hid_t loc_id, const char *obj_name, con *------------------------------------------------------------------------- */ +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Gets the dimensionality of an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] rank The dimensionality of the attribute + * + * \return \herr_t + * + * \details H5LTget_attribute_ndims() gets the dimensionality of an attribute + * named \p attr_name that is attached to the object specified + * by the name \p obj_name. + * + */ H5_HLDLL herr_t H5LTget_attribute_ndims(hid_t loc_id, const char *obj_name, const char *attr_name, int *rank); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Gets information about an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] dims The dimensions of the attribute + * \param[out] type_class The class identifier. #H5T_class_t is + * defined in H5Tpublic.h. For a list of valid class + * types see: H5Tget_class(). + * \param[out] type_size The size of the datatype in bytes + * + * \return \herr_t + * + * \details H5LTget_attribute_info() gets information about an attribute + * named \p attr_name attached to the object specified by + * the name \p obj_name. + * + * \par Example + * \snippet H5LT_examples.c get_attribute_info + * + */ H5_HLDLL herr_t H5LTget_attribute_info(hid_t loc_id, const char *obj_name, const char *attr_name, hsize_t *dims, H5T_class_t *type_class, size_t *type_size); @@ -213,7 +1358,74 @@ H5_HLDLL herr_t H5LTget_attribute_info(hid_t loc_id, const char *obj_name, const *------------------------------------------------------------------------- */ -H5_HLDLL hid_t H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates an HDF5 datatype given a text description. + * + * \param[in] text A character string containing a DDL + * definition of the datatype to be created + * \param[in] lang_type The language used to describe the datatype. + * The only currently supported language is + * #H5LT_DDL. + * + * \return Returns the datatype identifier(non-negative) if successful; + * otherwise returns a negative value. + * + * \details Given a text description of a datatype, this function creates + * an HDF5 datatype and returns the datatype identifier. + * The text description of the datatype has to comply with the + * \p lang_type definition of HDF5 datatypes. + * Currently, only the DDL(#H5LT_DDL) is supported. + * The complete DDL definition of HDF5 datatypes can be found in + * the last chapter of the + * + * HDF5 User's Guide. + * + * \par Example + * An example of DDL definition of \c enum type is shown as follows. + * \snippet H5LT_examples.c enum + * + */ +H5_HLDLL hid_t H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates a text description of an HDF5 datatype. + * + * \param[in] dtype Identifier of the datatype to be converted + * \param[out] str Buffer for the text description of the datatype + * \param[in] lang_type The language used to describe the datatype. + * The currently supported language is #H5LT_DDL. + * \param[out] len The size of buffer needed to store the text description + * + * \return \herr_t + * + * \details Given an HDF5 datatype identifier, this function creates + * a description of this datatype in \p lang_type language format. + * A preliminary H5LTdtype_to_text() call can be made to determine + * the size of the buffer needed with a NULL passed in for \p str. + * This value is returned as \p len. That value can then be assigned + * to len for a second H5Ttype_to_text() call, which will + * retrieve the actual text description for the datatype. + * + * If \p len is not big enough for the description, the text + * description will be truncated to fit in the buffer. + * + * Currently only DDL (#H5LT_DDL) is supported for \p lang_type. + * The complete DDL definition of HDF5 data types can be found in + * the last chapter of the + * + * HDF5 User's Guide. + * + * \par Example + * An example of DDL definition of \c enum type is shown as follows. + * \snippet H5LT_examples.c enum + * + */ H5_HLDLL herr_t H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t *len); /*------------------------------------------------------------------------- @@ -223,8 +1435,116 @@ H5_HLDLL herr_t H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, *------------------------------------------------------------------------- */ +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Determines whether an attribute exists. + * + * \param[in] loc_id Identifier of the object to which the attribute + * is expected to be attached + * \param[in] name Attribute name + * + * \return \htri_t + * + * \details H5LTfind_attribute() determines whether an attribute named + * \p name exists attached to the object specified + * by \p loc_id. + * + * \p loc_id must be an object identifier and \p name + * must specify an attribute that is expected to be attached + * to that object. + * + */ H5_HLDLL herr_t H5LTfind_attribute(hid_t loc_id, const char *name); +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Determines whether an HDF5 path is valid and, optionally, + * whether the path resolves to an HDF5 object. + * + * \param[in] loc_id Identifier of an object in the file + * \param[in] path The path to the object to check; + * links in \p path may be of any type. + * \param[in] check_object_valid If TRUE, determine whether the final + * component of \p path resolves to + * an object; if FALSE, do not check. + * + * \return Upon success: + * \return If \p check_object_valid is set to \c FALSE: + * \return Returns \c TRUE if the path is valid; + * otherwise returns \c FALSE. + * \return If \p check_object_valid is set to \c TRUE: + * \return Returns \c TRUE if the path is valid and + * resolves to an HDF5 object; + * otherwise returns \c FALSE. + * + * \return Upon error, returns a negative value. + * + * \details H5LTpath_valid() checks the validity of \p path relative + * to the identifier of an object, \p loc_id. Optionally, + * \p check_object_valid can be set to determine whether the + * final component of \p path resolves to an HDF5 object; + * if not, the final component is a dangling link. + * + * The meaning of the function’s return value depends on the + * value of \p check_object_valid: + * + * If \p check_object_valid is set to \c FALSE, H5LTpath_valid() + * will check all links in \p path to verify that they exist. + * If all the links in \p path exist, the function will + * return \c TRUE; otherwise the function will return \c FALSE. + * + * If \p check_object_valid is set to \c TRUE, + * H5LTpath_valid() will first check the links in \p path, + * as described above. If all the links exist, + * \p check_object_valid will then determine whether the final + * component of \p path resolves to an actual HDF5 object. + * H5LTpath_valid() will return \c TRUE if all the links in + * \p path exist and the final component resolves to an + * actual object; otherwise, it will return \c FALSE. + * + * \p path can be any one of the following: + * + * - An absolute path, which starts with a slash (\c /) + * indicating the file’s root group, followed by the members + * - A relative path with respect to \p loc_id + * - A dot (\c .), if \p loc_id is the object identifier for + * the object itself + * . + * + * If \p path is an absolute path, then \p loc_id can be an + * identifier for any object in the file as it is used only to + * identify the file. If \p path is a relative path, then + * \p loc_id must be a file or a group identifier. + * + * \note + * Note on Behavior Change: + * The behavior of H5LTpath_valid() was changed in the 1.10.0 release + * in the case where the root group, “/”, is the value of path. + * This change is described below: + * - Let \p loc_id denote a valid HDF5 file identifier, and let + * \p check_object_valid be set to true or false. + * A call to H5LTpath_valid() with arguments \p loc_id, “/”, + * and \p check_object_valid returns a positive value; + * in other words, H5LTpath_valid(loc_id, "/", check_object_valid) + * returns a positive value. + * In HDF5 version 1.8.16, this function returns 0. + * - Let ‘root’ denote a valid HDF5 group identifier that refers + * to the root group of an HDF5 file, and let \p check_object_valid + * be set to true or false. + * A call to H5LTpath_valid() with arguments ‘root’, “/”, and + * \p check_object_valid returns a positive value; + * in other words, H5LTpath_valid(root, "/", check_object_valid) + * returns a positive value. + * In HDF5 version 1.8.16, this function returns 0. + * + * \version 1.10.0 Function behavior changed in this release. + * See the “Note on Behavior Change” section above. + * + */ H5_HLDLL htri_t H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid); /*------------------------------------------------------------------------- @@ -234,6 +1554,82 @@ H5_HLDLL htri_t H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_obj *------------------------------------------------------------------------- */ +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Opens an HDF5 file image in memory. + * + * \param[in] buf_ptr A pointer to the supplied initial image + * \param[in] buf_size Size of the supplied buffer + * \param[in] flags Flags specifying whether to open the image + * read-only or read/write, whether HDF5 is to + * take control of the buffer, and instruction + * regarding releasing the buffer. + * + * \return Returns a file identifier if successful; + * otherwise returns a negative value. + * \warning \Bold{Failure Modes:} + * \warning H5LTopen_file_image() will fail if either \p buf_ptr is NULL + * or \p buf_size equals 0 (zero). + * + * + * \details H5LTopen_file_image() opens the HDF5 file image that is + * located in system memory at the address indicated by + * \p buf_ptr of size \p buf_size. + * H5LTopen_file_image() opens a file image with the + * Core driver, #H5FD_CORE. + * + * A value of NULL for \p buf_ptr is invalid and will + * cause the function to fail. + * + * A value of 0 for \p buf_size is invalid and will cause + * the function to fail. + * + * The flags passed in \p flags specify whether to open the image + * read-only or read/write, whether HDF5 is to take control of the + * buffer, and instruction regarding releasing the buffer. + * Valid values are: + * - #H5LT_FILE_IMAGE_OPEN_RW + * - Specifies opening the file image in read/write mode. + * - Default without this flag: File image will be opened read-only. + * . + * - #H5LT_FILE_IMAGE_DONT_COPY + * - Specifies to not copy the provided file image buffer; + * the buffer will be used directly. HDF5 will release the + * file image when finished. + * - Default without this flag: Copy the file image buffer and + * open the copied file image. + * . + * - #H5LT_FILE_IMAGE_DONT_RELEASE + * - Specifies that HDF5 is not to release the buffer when + * the file opened with H5LTopen_file_image() is closed; + * releasing the buffer will be left to the application. + * - Default without this flag: HDF5 will automatically + * release the file image buffer after the file image is + * closed. This flag is valid only when used with + * #H5LT_FILE_IMAGE_DONT_COPY. + * . + * . + * + * \note **Motivation:** + * \note H5LTopen_file_image() and other elements of HDF5 + * are used to load an image of an HDF5 file into system memory + * and open that image as a regular HDF5 file. An application can + * then use the file without the overhead of disk I/O. + * + * \note **Recommended Reading:** + * \note This function is part of the file image operations feature set. + * It is highly recommended to study the guide + * + * HDF5 File Image Operations before using this feature set.\n + * See the “See Also” section below for links to other elements of + * HDF5 file image operations. + * + * \todo There is no "See Also" section??? + * + * \since 1.8.9 + */ H5_HLDLL hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags); #ifdef __cplusplus diff --git a/hl/src/H5PTpublic.h b/hl/src/H5PTpublic.h index d74baa5..b881b25 100644 --- a/hl/src/H5PTpublic.h +++ b/hl/src/H5PTpublic.h @@ -18,19 +18,201 @@ extern "C" { #endif +/**\defgroup H5PT Packet Table + * + * Creating and manipulating HDF5 datasets to support append- + * and read-only operations on table data (H5PT) + * + * The HDF5 Packet Table API is designed to allow records to be + * appended to and read from a table. Packet Table datasets are + * chunked, allowing them to grow as needed. + * + * The Packet Table API, with the H5PT prefix, is not to be confused with + * the H5TB Table API (H5TB prefix). The H5TB APIs are stateless + * (H5TB Tables do not need to be opened or closed) but H5PT Packet Tables + * require less performance overhead. Also, H5TB Tables support insertions + * and deletions, while H5PT Packet Tables support only append operations. + * H5TB functions should not be called on tables created with the + * H5PT API, or vice versa. + * + * Packet Tables are datasets in an HDF5 file, so while their contents + * should not be changed outside of the H5PT API calls, the datatypes of + * Packet Tables can be queried using \ref H5Dget_type. + * Packet Tables can also be given attributes using the normal HDF5 APIs. + * + * \note \Bold{Programming hints:} + * \note The following line includes the HDF5 Packet Table package, H5PT, + * in C applications: + * \code #include "hdf5_hl.h" \endcode + * Without this include, an application will not have access to + * these functions. + * + * - \ref H5PTappend + * \n Appends packets to the end of a packet table. + * - \ref H5PTclose + * \n Closes an open packet table. + * - \ref H5PTcreate + * \n Creates a packet table to store fixed-length + * or variable-length packets. + * - \ref H5PTcreate_fl + * \n Creates a packet table to store fixed-length packets. + * - \ref H5PTcreate_index + * \n Resets a packet table's index to the first packet. + * - \ref H5PTfree_vlen_buff + * \n Releases memory allocated in the process of + * reading variable-length packets. + * - \ref H5PTget_dataset + * \n Returns the backend dataset of this packet table. + * - \ref H5PTget_index + * \n Gets the current record index for a packet table + * - \ref H5PTget_next + * \n Reads packets from a packet table starting at the + * current index. + * - \ref H5PTget_num_packets + * \n Returns the number of packets in a packet table. + * - \ref H5PTget_type + * \n Returns the backend datatype of this packet table. + * - \ref H5PTis_valid + * \n Determines whether an identifier points to a packet table. + * - \ref H5PTis_varlen + * \n Determines whether a packet table contains variable-length + * or fixed-length packets. + * - \ref H5PTopen + * \n Opens an existing packet table. + * - \ref H5PTread_packets + * \n Reads a number of packets from a packet table. + * - \ref H5PTset_index + * \n Sets a packet table's index. + * . + * + */ + /*------------------------------------------------------------------------- * Create/Open/Close functions *------------------------------------------------------------------------- */ /* NOTE: H5PTcreate is replacing H5PTcreate_fl for better name due to the removal of H5PTcreate_vl. H5PTcreate_fl may be retired in 1.8.19. */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Creates a packet table to store fixed-length or + * variable-length packets. + * + * \fg_loc_id + * \param[in] dset_name The name of the packet table to create + * \param[in] dtype_id The datatype of the packet + * \param[in] chunk_size The size in number of table entries per chunk + * \param[in] plist_id Identifier of the property list. Can be used to + * specify the compression of the packet table. + * + * \return Returns an identifier for the new packet table or + * #H5I_INVALID_HID on error. + * + * \details The H5PTcreate() creates and opens a packet table named + * \p dset_name attached to the object specified by the + * identifier \p loc_id. The created packet table should be closed + * with H5PTclose(), eventually. + * + * The datatype, \p dtype_id, may specify any datatype, including + * variable-length data. If \p dtype_id specifies a compound + * datatype, one or more fields in that compound type may be + * variable-length. + * + * \p chunk_size is the size in number of table entries per chunk. + * Packet table datasets use HDF5 chunked storage + * to allow them to grow. This value allows the user + * to set the size of a chunk. The chunk size affects + * performance. + * + * \since 1.10.0 and 1.8.17 + * + */ H5_HLDLL hid_t H5PTcreate(hid_t loc_id, const char *dset_name, hid_t dtype_id, hsize_t chunk_size, hid_t plist_id); +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Opens an existing packet table. + * + * \fg_loc_id + * \param[in] dset_name The name of the packet table to open + * + * \return Returns an identifier for the packet table or + * #H5I_INVALID_HID on error. + * + * \details H5PTopen() opens an existing packet table in the file or group + * specified by \p loc_id. \p dset_name is the name of the packet + * table and is used to identify it in the file. This function is + * used to open both fixed-length packet tables and variable-length + * packet tables. The packet table should later be closed with + * H5PTclose(). + * + */ H5_HLDLL hid_t H5PTopen(hid_t loc_id, const char *dset_name); +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Closes an open packet table. + * + * \param[in] table_id Identifier of packet table to be closed + * + * \return \herr_t + * + * \details The H5PTclose() ends access to a packet table specified + * by \p table_id. + * + */ H5_HLDLL herr_t H5PTclose(hid_t table_id); +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Creates a packet table to store fixed-length packets + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to create + * \param[in] dtype_id The datatype of a packet. + * \param[in] chunk_size The size in number of table entries per + * chunk. + * \param[in] compression The compression level; + * a value of 0 through 9. + * + * \return Returns an identifier for the packet table or + * #H5I_INVALID_HID on error. + * + * \deprecated This function was deprecated in favor of the function + * H5PTcreate(). + * + * \details The H5PTcreate_fl() creates and opens a packet table + * named \p dset_name attached to the object specified by + * the identifier \p loc_id. It should be closed + * with H5PTclose(). + * + * The datatype, \p dtype_id, may specify any datatype, + * including variable-length data. If \p dtype_id specifies a + * compound datatype, one or more fields in that compound type + * may be variable-length. + * + * \p chunk_size is the size in number of table entries per chunk. + * Packet table datasets use HDF5 chunked storage + * to allow them to grow. This value allows the user + * to set the size of a chunk. The chunk size affects + * performance. + * + * \p compression is the compression level, a value of 0 through 9. + * Level 0 is faster but offers the least compression; + * level 9 is slower but offers maximum compression. + * A setting of -1 indicates that no compression is desired. + + */ /* This function may be removed from the packet table in release 1.8.19. */ H5_HLDLL hid_t H5PTcreate_fl(hid_t loc_id, const char *dset_name, hid_t dtype_id, hsize_t chunk_size, int compression); @@ -39,24 +221,148 @@ H5_HLDLL hid_t H5PTcreate_fl(hid_t loc_id, const char *dset_name, hid_t dtype_id * Write functions *------------------------------------------------------------------------- */ +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Appends packets to the end of a packet table. + * + * \param[in] table_id Identifier of packet table to which + * packets should be appended + * \param[in] nrecords Number of packets to be appended + * \param[in] data Buffer holding data to write + * + * \return \herr_t + * + * \details The H5PTappend() writes \p nrecords packets to the end of a + * packet table specified by \p table_id. \p data is a buffer + * containing the data to be written. For a packet table holding + * fixed-length packets, this data should be in the packet + * table's datatype. For a variable-length packet table, + * the data should be in the form of #hvl_t structs. + * + */ H5_HLDLL herr_t H5PTappend(hid_t table_id, size_t nrecords, const void *data); /*------------------------------------------------------------------------- * Read functions *------------------------------------------------------------------------- */ +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Reads packets from a packet table starting at the current index. + * + * \param[in] table_id Identifier of packet table to read from + * \param[in] nrecords Number of packets to be read + * \param[out] data Buffer into which to read data + * + * \return \herr_t + * + * \details The H5PTget_next() reads \p nrecords packets starting with + * the "current index" from a packet table specified by \p table_id. + * The packet table's index is set and reset with H5PTset_index() + * and H5PTcreate_index(). \p data is a buffer into which the + * data should be read. + * + * For a packet table holding variable-length records, the data + * returned in the buffer will be in form of a #hvl_t struct + * containing the length of the data and a pointer to it in memory. + * The memory used by this data must be freed using H5PTfree_vlen_buff(). + * + */ H5_HLDLL herr_t H5PTget_next(hid_t table_id, size_t nrecords, void *data); +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Reads a number of packets from a packet table. + * + * \param[in] table_id Identifier of packet table to read from + * \param[in] start Packet to start reading from + * \param[in] nrecords Number of packets to be read + * \param[out] data Buffer into which to read data. + * + * \return \herr_t + * + * \details The H5PTread_packets() reads \p nrecords packets starting at + * packet number \p start from a packet table specified by + * \p table_id. \p data is a buffer into which the data should + * be read. + * + * For a packet table holding variable-length records, the data + * returned in the buffer will be in form of #hvl_t structs, + * each containing the length of the data and a pointer to it in + * memory. The memory used by this data must be freed using + * H5PTfree_vlen_buff(). + * + */ H5_HLDLL herr_t H5PTread_packets(hid_t table_id, hsize_t start, size_t nrecords, void *data); /*------------------------------------------------------------------------- * Inquiry functions *------------------------------------------------------------------------- */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Returns the number of packets in a packet table. + * + * \param[in] table_id Identifier of packet table to query + * \param[out] nrecords Number of packets in packet table + * + * \return \herr_t + * + * \details The H5PTget_num_packets() returns by reference the number + * of packets in a packet table specified by \p table_id. + * + */ H5_HLDLL herr_t H5PTget_num_packets(hid_t table_id, hsize_t *nrecords); +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Determines whether an identifier points to a packet table. + * + * \param[in] table_id Identifier to query + * + * \return Returns a non-negative value if \p table_id is + * a valid packet table, otherwise returns a negative value. + * + * \details The H5PTis_valid() returns a non-negative value if + * \p table_id corresponds to an open packet table, + * and returns a negative value otherwise. + * + */ H5_HLDLL herr_t H5PTis_valid(hid_t table_id); +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Determines whether a packet table contains + * variable-length or fixed-length packets. + * + * \param[in] table_id Packet table to query + * + * \return Returns 1 for a variable-length packet table, + * 0 for fixed-length, or a negative value on error. + * + * \details The H5PTis_varlen() returns 1 (TRUE) if \p table_id is + * a packet table containing variable-length records. + * It returns 0 (FALSE) if \p table_id is a packet table + * containing fixed-length records. If \p table_id is not a + * packet table, a negative value is returned. + * + * \version 1.10.0 and 1.8.17 Function re-introduced. + * Function had been removed in 1.8.3. + * + */ H5_HLDLL herr_t H5PTis_varlen(hid_t table_id); /*------------------------------------------------------------------------- @@ -66,8 +372,42 @@ H5_HLDLL herr_t H5PTis_varlen(hid_t table_id); *------------------------------------------------------------------------- */ +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Returns the backend dataset of this packet table. + * + * \param[in] table_id Identifier of the packet table + * + * \return Returns a dataset identifier or H5I_INVALID_HID on error. + * + * \details The H5PTget_dataset() returns the identifier of the dataset + * storing the packet table \p table_id. This dataset identifier + * will be closed by H5PTclose(). + * + * \since 1.10.0 and 1.8.17 + * + */ H5_HLDLL hid_t H5PTget_dataset(hid_t table_id); +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Returns the backend datatype of this packet table. + * + * \param[in] table_id Identifier of the packet table + * + * \return Returns a datatype identifier or H5I_INVALID_HID on error. + * + * \details The H5PTget_type() returns the identifier of the datatype + * used by the packet table \p table_id. This datatype + * identifier will be closed by H5PTclose(). + * + * \since 1.10.0 and 1.8.17 + * + */ H5_HLDLL hid_t H5PTget_type(hid_t table_id); /*------------------------------------------------------------------------- @@ -77,10 +417,63 @@ H5_HLDLL hid_t H5PTget_type(hid_t table_id); *------------------------------------------------------------------------- */ +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Resets a packet table's index to the first packet. + * + * \param[in] table_id Identifier of packet table whose index + * should be initialized. + * + * \return \herr_t + * + * \details Each packet table keeps an index of the "current" packet + * so that \c get_next can iterate through the packets in order. + * H5PTcreate_index() initializes a packet table's index, and + * should be called before using \c get_next. The index must be + * initialized every time a packet table is created or opened; + * this information is lost when the packet table is closed. + * + */ H5_HLDLL herr_t H5PTcreate_index(hid_t table_id); +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Sets a packet table's index. + * + * \param[in] table_id Identifier of packet table whose index is to be set + * \param[in] pt_index The packet to which the index should point + * + * \return \herr_t + * + * \details Each packet table keeps an index of the "current" packet + * so that \c get_next can iterate through the packets in order. + * H5PTset_index() sets this index to point to a user-specified + * packet (the packets are zero-indexed). + * + */ H5_HLDLL herr_t H5PTset_index(hid_t table_id, hsize_t pt_index); +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Gets the current record index for a packet table. + * + * \param[in] table_id Table identifier + * \param[out] pt_index Current record index + * + * \return \herr_t + * + * \details The H5PTget_index() returns the current record index + * \p pt_index for the table identified by \p table_id. + * + * \since 1.8.0 + * + */ H5_HLDLL herr_t H5PTget_index(hid_t table_id, hsize_t *pt_index); /*------------------------------------------------------------------------- @@ -90,6 +483,29 @@ H5_HLDLL herr_t H5PTget_index(hid_t table_id, hsize_t *pt_index); *------------------------------------------------------------------------- */ +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Releases memory allocated in the process of reading + * variable-length packets. + * + * \param[in] table_id Packet table whose memory should be freed. + * \param[in] bufflen Size of \p buff + * \param[in] buff Buffer that was used to read in variable-length + * packets + * + * \return \herr_t + * + * \details When variable-length packets are read, memory is automatically + * allocated to hold them, and must be freed. H5PTfree_vlen_buff() + * frees this memory, and should be called whenever packets are + * read from a variable-length packet table. + * + * \version 1.10.0 and 1.8.17 Function re-introduced. + * Function had been removed in 1.8.3. + * + */ H5_HLDLL herr_t H5PTfree_vlen_buff(hid_t table_id, size_t bufflen, void *buff); #ifdef __cplusplus diff --git a/hl/src/H5TBpublic.h b/hl/src/H5TBpublic.h index 1750490..042bf99 100644 --- a/hl/src/H5TBpublic.h +++ b/hl/src/H5TBpublic.h @@ -18,6 +18,64 @@ extern "C" { #endif +/**\defgroup H5TB Table + * + * Creating and manipulating HDF5 datasets intended to be + * interpreted as tables (H5TB) + * + * The HDF5 Table API defines a standard storage for HDF5 datasets + * that are intended to be interpreted as tables. A table is defined + * as a collection of records whose values are stored in fixed-length + * fields. All records have the same structure, and all values in + * each field have the same data type. + * + * \note \Bold{Programming hints:} + * \note To use any of these functions or subroutines, + * you must first include the relevant include file (C) or + * module (Fortran) in your application. + * \note The following line includes the HDF5 Table package, H5TB, + * in C applications: + * \code #include "hdf5_hl.h" \endcode + * \note To include the H5TB module in Fortran applications specify: + * \code use h5tb \endcode + * Fortran applications must also include \ref H5open before + * any HDF5 calls to initialize global variables and \ref H5close + * after all HDF5 calls to close the Fortran interface. + * + * - Creation + * - \ref H5TBmake_table + * - Storage + * - \ref H5TBappend_records (No Fortran) + * - \ref H5TBwrite_records (No Fortran) + * - \ref H5TBwrite_fields_name + * - \ref H5TBwrite_fields_index + * . + * - Modification + * - \ref H5TBdelete_record (No Fortran) + * - \ref H5TBinsert_record (No Fortran) + * - \ref H5TBadd_records_from (No Fortran) + * - \ref H5TBcombine_tables (No Fortran) + * - \ref H5TBinsert_field + * - \ref H5TBdelete_field + * . + * - Retrieval + * - \ref H5TBread_table + * - \ref H5TBread_records (No Fortran) + * - \ref H5TBread_fields_name + * - \ref H5TBread_fields_index + * . + * - Query + * - \ref H5TBget_table_info + * - \ref H5TBget_field_info + * . + * - Query Table Attributes + * - \ref H5TBAget_fill + * - \ref H5TBAget_title + * . + * . + * + */ + /*------------------------------------------------------------------------- * * Create functions @@ -25,6 +83,38 @@ extern "C" { *------------------------------------------------------------------------- */ +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * \brief Creates and writes a table + * + * \param[in] table_title The title of the table + * \fg_loc_id + * \param[in] dset_name The name of the dataset to create + * \param[in] nfields The number of fields + * \param[in] nrecords The number of records + * \param[in] type_size The size in bytes of the structure + * associated with the table; + * This value is obtained with \c sizeof(). + * \param[in] field_names An array containing the names of + * the fields + * \param[in] field_offset An array containing the offsets of + * the fields + * \param[in] field_types An array containing the type of + * the fields + * \param[in] chunk_size The chunk size + * \param[in] fill_data Fill values data + * \param[in] compress Flag that turns compression on or off + * \param[in] buf Buffer with data to be written to the table + * + * \return \herr_t + * + * \details H5TBmake_table() creates and writes a dataset named + * \p dset_name attached to the object specified by the + * identifier loc_id. + * + */ H5_HLDLL herr_t H5TBmake_table(const char *table_title, hid_t loc_id, const char *dset_name, hsize_t nfields, hsize_t nrecords, size_t type_size, const char *field_names[], const size_t *field_offset, const hid_t *field_types, hsize_t chunk_size, @@ -37,17 +127,128 @@ H5_HLDLL herr_t H5TBmake_table(const char *table_title, hid_t loc_id, const char *------------------------------------------------------------------------- */ +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * \brief Adds records to the end of the table + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to overwrite + * \param[in] nrecords The number of records to append + * \param[in] type_size The size of the structure type, + * as calculated by \c sizeof(). + * \param[in] field_offset An array containing the offsets of + * the fields. These offsets can be + * calculated with the #HOFFSET macro + * \param[in] dst_sizes An array containing the sizes of + * the fields + * \param[in] buf Buffer with data + * + * \return \herr_t + * + * \details H5TBappend_records() adds records to the end of the table + * named \p dset_name attached to the object specified by the + * identifier \p loc_id. The dataset is extended to hold the + * new records. + * + */ H5_HLDLL herr_t H5TBappend_records(hid_t loc_id, const char *dset_name, hsize_t nrecords, size_t type_size, const size_t *field_offset, const size_t *dst_sizes, const void *buf); +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * \brief Overwrites records + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to overwrite + * \param[in] start The zero index record to start writing + * \param[in] nrecords The number of records to write + * \param[in] type_size The size of the structure type, as + * calculated by \c sizeof(). + * \param[in] field_offset An array containing the offsets of + * the fields. These offsets can be + * calculated with the #HOFFSET macro + * \param[in] dst_sizes An array containing the sizes of + * the fields + * \param[in] buf Buffer with data + * + * \return \herr_t + * + * \details H5TBwrite_records() overwrites records starting at the zero + * index position start of the table named \p dset_name attached + * to the object specified by the identifier \p loc_id. + * + */ H5_HLDLL herr_t H5TBwrite_records(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t type_size, const size_t *field_offset, const size_t *dst_sizes, const void *buf); +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * \brief Overwrites fields + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to overwrite + * \param[in] field_names The names of the fields to write + * \param[in] start The zero index record to start writing + * \param[in] nrecords The number of records to write + * \param[in] type_size The size of the structure type, as + * calculated by \c sizeof(). + * \param[in] field_offset An array containing the offsets of + * the fields. These offsets can be + * calculated with the #HOFFSET macro + * \param[in] dst_sizes An array containing the sizes of + * the fields + * \param[in] buf Buffer with data + * + * \return \herr_t + * + * \details H5TBwrite_fields_name() overwrites one or several fields + * specified by \p field_names with data in \p buf from a + * dataset named \p dset_name attached to the object specified + * by the identifier \p loc_id. + * + */ H5_HLDLL herr_t H5TBwrite_fields_name(hid_t loc_id, const char *dset_name, const char *field_names, hsize_t start, hsize_t nrecords, size_t type_size, const size_t *field_offset, const size_t *dst_sizes, const void *buf); +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * \brief Overwrites fields + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to overwrite + * \param[in] nfields The number of fields to overwrite. + * This parameter is also the size of the + * \p field_index array. + * \param[in] field_index The indexes of the fields to write + * \param[in] start The zero based index record to start writing + * \param[in] nrecords The number of records to write + * \param[in] type_size The size of the structure type, as + * calculated by \c sizeof(). + * \param[in] field_offset An array containing the offsets of + * the fields. These offsets can be + * calculated with the #HOFFSET macro + * \param[in] dst_sizes An array containing the sizes of + * the fields + * \param[in] buf Buffer with data + * + * \return \herr_t + * + * \details H5TBwrite_fields_index() overwrites one or several fields + * specified by \p field_index with a buffer \p buf from a + * dataset named \p dset_name attached to the object + * specified by the identifier \p loc_id. + * + */ H5_HLDLL herr_t H5TBwrite_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields, const int *field_index, hsize_t start, hsize_t nrecords, size_t type_size, const size_t *field_offset, const size_t *dst_sizes, @@ -60,18 +261,128 @@ H5_HLDLL herr_t H5TBwrite_fields_index(hid_t loc_id, const char *dset_name, hsiz *------------------------------------------------------------------------- */ +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * \brief Reads a table + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[in] dst_size The size of the structure type, + * as calculated by \c sizeof() + * \param[in] dst_offset An array containing the offsets of + * the fields. These offsets can be + * calculated with the #HOFFSET macro + * \param[in] dst_sizes An array containing the sizes of + * the fields. These sizes can be + * calculated with the sizeof() macro. + * \param[in] dst_buf Buffer with data + * + * \return \herr_t + * + * \details H5TBread_table() reads a table named + * \p dset_name attached to the object specified by + * the identifier \p loc_id. + * + */ H5_HLDLL herr_t H5TBread_table(hid_t loc_id, const char *dset_name, size_t dst_size, const size_t *dst_offset, const size_t *dst_sizes, void *dst_buf); +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * \brief Reads one or several fields. The fields are identified by name. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[in] field_names An array containing the names of the + * fields to read + * \param[in] start The start record to read from + * \param[in] nrecords The number of records to read + * \param[in] type_size The size in bytes of the structure associated + * with the table + * (This value is obtained with \c sizeof().) + * \param[in] field_offset An array containing the offsets of the fields + * \param[in] dst_sizes An array containing the size in bytes of + * the fields + * \param[out] buf Buffer with data + * + * \return \herr_t + * + * \details H5TBread_fields_name() reads the fields identified + * by \p field_names from a dataset named \p dset_name + * attached to the object specified by the identifier \p loc_id. + * + */ H5_HLDLL herr_t H5TBread_fields_name(hid_t loc_id, const char *dset_name, const char *field_names, hsize_t start, hsize_t nrecords, size_t type_size, const size_t *field_offset, const size_t *dst_sizes, void *buf); +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Reads one or several fields. The fields are identified by index. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[in] nfields The number of fields to read + * (This parameter is also the size of the + * \p field_index array.) + * fields to read + * \param[in] field_index The indexes of the fields to read + * \param[in] start The start record to read from + * \param[in] nrecords The number of records to read + * \param[in] type_size The size in bytes of the structure associated + * with the table + * (This value is obtained with \c sizeof()) + * \param[in] field_offset An array containing the offsets of the fields + * \param[in] dst_sizes An array containing the size in bytes of + * the fields + * \param[out] buf Buffer with data + * + * \return \herr_t + * + * \details H5TBread_fields_index() reads the fields identified + * by \p field_index from a dataset named \p dset_name attached + * to the object specified by the identifier \p loc_id. + * + */ H5_HLDLL herr_t H5TBread_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields, const int *field_index, hsize_t start, hsize_t nrecords, size_t type_size, const size_t *field_offset, const size_t *dst_sizes, void *buf); +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Reads records + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[in] start The start record to read from + * \param[in] nrecords The number of records to read + * \param[in] type_size The size of the structure type, + * as calculated by \c sizeof() + * \param[in] dst_offset An array containing the offsets of the + * fields. These offsets can be calculated + * with the #HOFFSET macro + * \param[in] dst_sizes An array containing the size in bytes of + * the fields + * \param[out] buf Buffer with data + * + * \return \herr_t + * + * \details H5TBread_records() reads some records identified from a dataset + * named \p dset_name attached to the object specified by the + * identifier \p loc_id. + * + */ H5_HLDLL herr_t H5TBread_records(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t type_size, const size_t *dst_offset, const size_t *dst_sizes, void *buf); @@ -83,8 +394,52 @@ H5_HLDLL herr_t H5TBread_records(hid_t loc_id, const char *dset_name, hsize_t st *------------------------------------------------------------------------- */ +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Gets the table dimensions + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[out] nfields The number of fields + * \param[out] nrecords The number of records + * + * \return \herr_t + * + * \details H5TBget_table_info() retrieves the table dimensions from a + * dataset named \p dset_name attached to the object specified + * by the identifier \p loc_id. + * + */ H5_HLDLL herr_t H5TBget_table_info(hid_t loc_id, const char *dset_name, hsize_t *nfields, hsize_t *nrecords); +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Gets information about a table + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[out] field_names An array containing the names of the fields + * \param[out] field_sizes An array containing the size of the fields + * \param[out] field_offsets An array containing the offsets of the fields + * \param[out] type_size The size of the HDF5 datatype associated + * with the table. (More specifically, + * the size in bytes of the HDF5 compound + * datatype used to define a row, or record, + * in the table) + * + * \return \herr_t + * + * \details H5TBget_field_info() gets information about a dataset + * named \p dset_name attached to the object specified + * by the identifier \p loc_id. + * + */ H5_HLDLL herr_t H5TBget_field_info(hid_t loc_id, const char *dset_name, char *field_names[], size_t *field_sizes, size_t *field_offsets, size_t *type_size); @@ -95,21 +450,162 @@ H5_HLDLL herr_t H5TBget_field_info(hid_t loc_id, const char *dset_name, char *fi *------------------------------------------------------------------------- */ +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Delete records + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset + * \param[in] start The start record to delete from + * \param[in] nrecords The number of records to delete + * + * \return \herr_t + * + * \details H5TBdelete_record() deletes nrecords number of records starting + * from \p start from the middle of the table \p dset_name + * ("pulling up" all the records after it). + * + */ H5_HLDLL herr_t H5TBdelete_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords); +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Insert records + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset + * \param[in] start The position to insert + * \param[in] nrecords The number of records to insert + * \param[in] dst_size The size in bytes of the structure + * associated with the table + * \param[in] dst_offset An array containing the offsets of the + * fields + * \param[in] dst_sizes An array containing the size in bytes of + * the fields + * \param[in] buf Buffer with data + * + * \return \herr_t + * + * \details H5TBinsert_record() inserts records into the middle of the table + * ("pushing down" all the records after it) + * + */ H5_HLDLL herr_t H5TBinsert_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t dst_size, const size_t *dst_offset, const size_t *dst_sizes, void *buf); +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Add records from first table to second table + * + * \fg_loc_id + * \param[in] dset_name1 The name of the dataset to read the records + * \param[in] start1 The position to read the records from the + * first table + * \param[in] nrecords The number of records to read from the first + * table + * \param[in] dset_name2 The name of the dataset to write the records + * \param[in] start2 The position to write the records on the + * second table + * + * \return \herr_t + * + * \details H5TBadd_records_from() adds records from a dataset named + * \p dset_name1 to a dataset named \p dset_name2. Both tables + * are attached to the object specified by the identifier loc_id. + * + */ H5_HLDLL herr_t H5TBadd_records_from(hid_t loc_id, const char *dset_name1, hsize_t start1, hsize_t nrecords, const char *dset_name2, hsize_t start2); +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Combines records from two tables into a third + * + * \param[in] loc_id1 Identifier of the file or group in which + * the first table is located + * \param[in] dset_name1 The name of the first table to combine + * \param[in] loc_id2 Identifier of the file or group in which + * the second table is located + * \param[in] dset_name2 The name of the second table to combine + * \param[in] dset_name3 The name of the new table + * + * \return \herr_t + * + * \details H5TBcombine_tables() combines records from two datasets named + * \p dset_name1 and \p dset_name2, to a new table named + * \p dset_name3. These tables can be located on different files, + * identified by \p loc_id1 and \p loc_id2 (identifiers obtained + * with H5Fcreate()). They can also be located on the same file. + * In this case one uses the same identifier for both parameters + * \p loc_id1 and \p loc_id2. If two files are used, the third + * table is written in the first file. + * + */ H5_HLDLL herr_t H5TBcombine_tables(hid_t loc_id1, const char *dset_name1, hid_t loc_id2, const char *dset_name2, const char *dset_name3); +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Insert a new field into a table + * + * \fg_loc_id + * \param[in] dset_name The name of the table + * \param[in] field_name The name of the field to insert + * \param[in] field_type The data type of the field + * \param[in] position The zero based index position where to + * insert the field + * \param[in] fill_data Fill value data for the field. This parameter + * can be NULL + * \param[in] buf Buffer with data + * + * \return \herr_t + * + * \details H5TBinsert_field() inserts a new field named \p field_name into + * the table \p dset_name. Note: this function requires the table + * to be re-created and rewritten in its entirety, and this can result + * in some unused space in the file, and can also take a great deal of + * time if the table is large. + * + */ H5_HLDLL herr_t H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hid_t field_type, hsize_t position, const void *fill_data, const void *buf); +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Deletes a field from a table + * + * \fg_loc_id + * \param[in] dset_name The name of the table + * \param[in] field_name The name of the field to delete + * + * \return \herr_t + * + * \details H5TBdelete_field() deletes a field named \p field_name from the + * table \p dset_name. Note: this function requires the table to be + * re-created and rewritten in its entirety, and this can result in + * some unused space in the file, and can also take a great deal of + * time if the table is large. + * + */ H5_HLDLL herr_t H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name); /*------------------------------------------------------------------------- @@ -119,8 +615,51 @@ H5_HLDLL herr_t H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *------------------------------------------------------------------------- */ +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Reads a table's title + * + * \fg_loc_id + * \param[out] table_title Buffer for title name + * + * \return \herr_t + * + * \details H5TBget_title() returns the title of the table identified + * by \p loc_id in a buffer \p table_title. + * + */ H5_HLDLL herr_t H5TBAget_title(hid_t loc_id, char *table_title); +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Reads the table attribute fill values + * + * \fg_loc_id + * \param[in] dset_name Name of table + * \param[in] dset_id Table identifier + * \param[out] dst_buf Buffer of fill values for table fields + * + * \return + * \return A return value of 1 indicates that a fill value is present. + * \return A return value of 0 indicates a fill value is not present. + * \return A return value <0 indicates an error. + * + * + * \details H5TBget_fill() reads the table attribute fill values into + * the buffer \p dst_buf for the table specified by \p dset_id + * and \p dset_name located in \p loc_id. + * + * + * \par Example + * \include H5TBAget_fill.c + * + */ H5_HLDLL htri_t H5TBAget_fill(hid_t loc_id, const char *dset_name, hid_t dset_id, unsigned char *dst_buf); #ifdef __cplusplus diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 12b6840..cc716aa 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -1220,14 +1220,14 @@ test_detachscales(void) /* make datasets; they are three dimensional*/ for (i = 0; i < 2; i++) { - HDsprintf(dname, "D%d", i); + HDsnprintf(dname, sizeof(dname), "D%d", i); if (H5LTmake_dataset_int(fid, dname, rank3, dims, buf) < 0) goto out; } /* create datasets and make them dim. scales */ for (i = 0; i < 4; i++) { - HDsprintf(dname, "DS%d", i); + HDsnprintf(dname, sizeof(dname), "DS%d", i); if (H5LTmake_dataset_int(fid, dname, rank1, dims, buf) < 0) goto out; } @@ -1235,7 +1235,7 @@ test_detachscales(void) two scales attached */ if ((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) >= 0) { for (i = 0; i < 4; i++) { - HDsprintf(dname, "DS%d", i); + HDsnprintf(dname, sizeof(dname), "DS%d", i); if ((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) goto out; if (H5DSattach_scale(did, dsid, (unsigned int)i % 3) < 0) @@ -1252,7 +1252,7 @@ test_detachscales(void) /* attach scales to the second dataset */ if ((did = H5Dopen2(fid, "D1", H5P_DEFAULT)) >= 0) { for (i = 0; i < 3; i++) { - HDsprintf(dname, "DS%d", i); + HDsnprintf(dname, sizeof(dname), "DS%d", i); if ((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) goto out; if (H5DSattach_scale(did, dsid, (unsigned int)i) < 0) @@ -1273,7 +1273,7 @@ test_detachscales(void) goto out; for (i = 0; i < 2; i++) { - HDsprintf(dname, "D%d", i); + HDsnprintf(dname, sizeof(dname), "D%d", i); if ((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) goto out; if (H5DSdetach_scale(did, dsid, (unsigned int)0) < 0) @@ -1303,7 +1303,7 @@ test_detachscales(void) sure that attribute "DIMENSION_LIST" doesn't exist anymore */ if ((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) >= 0) { for (i = 1; i < 4; i++) { - HDsprintf(dname, "DS%d", i); + HDsnprintf(dname, sizeof(dname), "DS%d", i); if ((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) goto out; if (H5DSdetach_scale(did, dsid, (unsigned int)i % 3) < 0) @@ -2984,10 +2984,10 @@ test_simple(void) if ((sid = H5Screate_simple(rank, dims, NULL)) < 0) goto out; for (i = 0; i < 5; i++) { - HDsprintf(dname, "dset_%d", i); + HDsnprintf(dname, sizeof(dname), "dset_%d", i); if ((did = H5Dcreate2(gid, dname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - HDsprintf(sname, "ds_%d", i); + HDsnprintf(sname, sizeof(sname), "ds_%d", i); if ((dsid = H5Dcreate2(gid, sname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if (H5DSset_scale(dsid, "scale") < 0) @@ -3004,11 +3004,11 @@ test_simple(void) */ for (i = 0; i < 5; i++) { - HDsprintf(dname, "dset_%d", i); + HDsnprintf(dname, sizeof(dname), "dset_%d", i); if ((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0) goto out; for (j = 0; j < 5; j++) { - HDsprintf(sname, "ds_%d", j); + HDsnprintf(sname, sizeof(sname), "ds_%d", j); if ((dsid = H5Dopen2(gid, sname, H5P_DEFAULT)) < 0) goto out; if (H5DSattach_scale(did, dsid, DIM0) < 0) @@ -3026,11 +3026,11 @@ test_simple(void) */ for (i = 0; i < 5; i++) { - HDsprintf(dname, "dset_%d", i); + HDsnprintf(dname, sizeof(dname), "dset_%d", i); if ((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0) goto out; for (j = 0; j < 5; j++) { - HDsprintf(sname, "ds_%d", j); + HDsnprintf(sname, sizeof(sname), "ds_%d", j); if ((dsid = H5Dopen2(gid, sname, H5P_DEFAULT)) < 0) goto out; if (H5DSdetach_scale(did, dsid, DIM0) < 0) @@ -3048,11 +3048,11 @@ test_simple(void) */ for (i = 0; i < 5; i++) { - HDsprintf(dname, "dset_%d", i); + HDsnprintf(dname, sizeof(dname), "dset_%d", i); if ((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0) goto out; for (j = 0; j < 5; j++) { - HDsprintf(sname, "ds_%d", j); + HDsnprintf(sname, sizeof(sname), "ds_%d", j); if ((dsid = H5Dopen2(gid, sname, H5P_DEFAULT)) < 0) goto out; if (H5DSattach_scale(did, dsid, DIM0) < 0) @@ -4292,7 +4292,7 @@ test_iterators(void) for (i = 0; i < 100; i++) { /* make a DS */ - HDsprintf(dname, "ds_%d", i); + HDsnprintf(dname, sizeof(dname), "ds_%d", i); if (H5LTmake_dataset_int(fid, dname, rankds, s1_dim, NULL) < 0) goto out; /* open */ @@ -4442,7 +4442,7 @@ test_rank(void) goto out; for (i = 0; i < 3; i++) { - HDsprintf(name, "ds_a_%d", i); + HDsnprintf(name, sizeof(name), "ds_a_%d", i); if ((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) goto out; if (H5DSattach_scale(did, dsid, (unsigned)i) < 0) @@ -4469,7 +4469,7 @@ test_rank(void) goto out; for (i = 0; i < 3; i++) { - HDsprintf(name, "ds_a_%d", i); + HDsnprintf(name, sizeof(name), "ds_a_%d", i); if ((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) goto out; if (H5DSdetach_scale(did, dsid, (unsigned)i) < 0) @@ -4495,7 +4495,7 @@ test_rank(void) goto out; for (i = 0; i < 3; i++) { - HDsprintf(name, "ds_a_%d", i); + HDsnprintf(name, sizeof(name), "ds_a_%d", i); if ((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) goto out; if (H5DSset_scale(dsid, name) < 0) diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 9fac20c..905a092 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -6991,7 +6991,7 @@ public class H5 implements java.io.Serializable { /** * H5Oflush causes all buffers associated with an object to be immediately flushed to disk without * removing the data from the cache. object_id can be any named object associated with an HDF5 file - * ncluding a dataset, a group, or a committed datatype. + * including a dataset, a group, or a committed datatype. * * @param object_id * IN: Identifier of the object to be flushed. diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index cbdf463..b0c639c 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -916,6 +916,8 @@ public class HDF5Constants { /** */ public static final int H5R_OBJ_REF_BUF_SIZE = H5R_OBJ_REF_BUF_SIZE(); /** */ + public static final int H5R_DSET_REG_REF_BUF_SIZE = H5R_DSET_REG_REF_BUF_SIZE(); + /** */ public static final int H5R_OBJECT = H5R_OBJECT(); /** */ public static final int H5R_OBJECT1 = H5R_OBJECT1(); @@ -2397,6 +2399,8 @@ public class HDF5Constants { private static native final int H5R_OBJ_REF_BUF_SIZE(); + private static native final int H5R_DSET_REG_REF_BUF_SIZE(); + private static native final int H5R_OBJECT(); private static native final int H5R_OBJECT1(); diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 2de5d87..7ea09c8 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -211,9 +211,9 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ /* Build default formats for long long types */ if (!fmt_llong[0]) { - if (HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%%sd", H5_PRINTF_LL_WIDTH) < 0) + if (HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%lld") < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_convert: HDsnprintf failure"); - if (HDsnprintf(fmt_ullong, sizeof(fmt_ullong), "%%%su", H5_PRINTF_LL_WIDTH) < 0) + if (HDsnprintf(fmt_ullong, sizeof(fmt_ullong), "%%llu") < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_convert: HDsnprintf failure"); } /* end if */ @@ -781,9 +781,9 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i /* Build default formats for long long types */ if (!fmt_llong[0]) { - if (HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%%sd", H5_PRINTF_LL_WIDTH) < 0) + if (HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%lld") < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); - if (HDsnprintf(fmt_ullong, sizeof(fmt_ullong), "%%%su", H5_PRINTF_LL_WIDTH) < 0) + if (HDsnprintf(fmt_ullong, sizeof(fmt_ullong), "%%llu") < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); } /* end if */ switch (tclass) { diff --git a/release_docs/INSTALL b/release_docs/INSTALL index c9f7d4c..177f3b6 100644 --- a/release_docs/INSTALL +++ b/release_docs/INSTALL @@ -491,7 +491,7 @@ CONTENTS The HDF5 tests can take a long time to run on some systems. To perform a faster (but less thorough) test, set the HDF5TestExpress environment variable to 2 or 3 (with 3 being the shortest run). To perform a - longer test, set HDF5TestExpress to 0. 1 is the default. + longer test, set HDF5TestExpress to 0. 3 is the default. 4.6. Installing HDF5 The HDF5 library, include files, and support programs can be diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 91eb593..c977617 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -769,7 +769,7 @@ HDF5_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE HDF5_PACKAGE_EXTLIBS "CPACK - include external libraries" OFF HDF5_STRICT_FORMAT_CHECKS "Whether to perform strict file format checks" OFF -HDF_TEST_EXPRESS "Control testing framework (0-3)" "0" +HDF_TEST_EXPRESS "Control testing framework (0-3)" "3" HDF5_TEST_VFD "Execute tests with different VFDs" OFF HDF5_TEST_PASSTHROUGH_VOL "Execute tests with different passthrough VOL connectors" OFF DEFAULT_API_VERSION "Enable default API (v16, v18, v110, v112, v114)" "v114" diff --git a/release_docs/README_HDF5_CMake b/release_docs/README_HDF5_CMake index c575320..ddaa7b4 100644 --- a/release_docs/README_HDF5_CMake +++ b/release_docs/README_HDF5_CMake @@ -6,18 +6,18 @@ This tar file contains CTestScript.cmake HDF5config.cmake CMake scripts for building HDF5 HDF5options.cmake - hdf5-1.13.0 HDF5 1.13.0 source + hdf5-1.13.2 HDF5 1.13.2 source LIBAEC.tar.gz source for building SZIP replacement ZLib.tar.gz source for building ZLIB hdf5_plugins.tar.gz source for building compression plugins - HDF5Examples-1.14.4-Source.tar.gz source for building examples + HDF5Examples-1.14.5-Source.tar.gz source for building examples For more information about building HDF5 with CMake, see USING_HDF5_CMake.txt in -hdf5-1.13.0/release_docs, or +hdf5-1.13.2/release_docs, or https://portal.hdfgroup.org/display/support/Building+HDF5+with+CMake. For more information about building HDF5 with CMake on HPC machines, including -cross compiling on Cray XC40, see README_HPC in hdf5-1.13.0/release_docs. +cross compiling on Cray XC40, see README_HPC in hdf5-1.13.2/release_docs. diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index b0d9bc8..d5a860e 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -69,7 +69,7 @@ New Features Library: -------- - - + - Parallel Library: @@ -84,12 +84,12 @@ New Features C++ Library: ------------ - - + - Java Library: ------------- - - + - Tools: @@ -109,7 +109,7 @@ New Features Internal header file: --------------------- - - + - All the #defines named H5FD_CTL__* were renamed to H5FD_CTL_*, i.e. the double underscore was reduced to a single underscore. Documentation: @@ -126,22 +126,31 @@ Bug Fixes since HDF5-1.13.1 release =================================== Library ------- - - + - Converted an assertion on (possibly corrupt) file contents to a normal + error check + + Previously, the library contained an assertion check that a read superblock + doesn't contain a superblock extension message when the superblock + version < 2. When a corrupt HDF5 file is read, this assertion can be triggered + in debug builds of HDF5. In production builds, this situation could cause + either a library error or a crash, depending on the platform. + + (JTH - 2022/07/08) Java Library ------------ - - + - Configuration ------------- - - + - Tools ----- - - + - Performance @@ -161,7 +170,7 @@ Bug Fixes since HDF5-1.13.1 release High-Level Library ------------------ - - + - Fortran High-Level APIs @@ -184,6 +193,11 @@ Bug Fixes since HDF5-1.13.1 release - + Testing + ------- + - + + Platforms Tested =================== @@ -286,7 +300,7 @@ Platforms Tested Visual Studio 2017 w/ Intel C/C++/Fortran 19 (cmake) Visual Studio 2019 w/ clang 12.0.0 with MSVC-like command-line (C/C++ only - cmake) - Visual Studio 2019 w/ Intel Fortran 19 (cmake) + Visual Studio 2019 w/ Intel C/C++/Fortran oneAPI 2021 (cmake) Visual Studio 2019 w/ MSMPI 10.1 (C only - cmake) diff --git a/src/H5B2int.c b/src/H5B2int.c index 80dfb72..f9be132 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -1664,7 +1664,7 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, /* Lock the current B-tree node */ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, (H5B2_node_ptr_t *)curr_node, FALSE, - H5AC__READ_ONLY_FLAG))) /* Casting away const OK -QAK */ + H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* Set up information about current node */ @@ -1776,8 +1776,8 @@ H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, v H5B2_leaf_t *leaf; /* Pointer to leaf node */ /* Lock the current B-tree node */ - if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, (H5B2_node_ptr_t *)curr_node, FALSE, - H5AC__NO_FLAGS_SET))) /* Casting away const OK -QAK */ + if (NULL == + (leaf = H5B2__protect_leaf(hdr, parent, (H5B2_node_ptr_t *)curr_node, FALSE, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* Set up information about current node */ @@ -1956,9 +1956,8 @@ H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_t *node H5B2_leaf_t *child_leaf; /* Protect child */ - if (NULL == - (child_leaf = H5B2__protect_leaf(hdr, new_parent, (H5B2_node_ptr_t *)node_ptr, FALSE, - H5AC__NO_FLAGS_SET))) /* Casting away const OK -QAK */ + if (NULL == (child_leaf = H5B2__protect_leaf(hdr, new_parent, (H5B2_node_ptr_t *)node_ptr, FALSE, + H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") child_class = H5AC_BT2_LEAF; child = child_leaf; diff --git a/src/H5C.c b/src/H5C.c index 067acfa..51fa334 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -7778,30 +7778,30 @@ H5C_validate_lru_list(H5C_t *cache_ptr) if (((cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_tail_ptr == NULL)) && (cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU list head/tail check failed") if ((cache_ptr->LRU_list_len == 1) && ((cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr) || (cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_head_ptr->size != cache_ptr->LRU_list_size))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU list sanity check failed") if ((cache_ptr->LRU_list_len >= 1) && ((cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_head_ptr->prev != NULL) || (cache_ptr->LRU_tail_ptr == NULL) || (cache_ptr->LRU_tail_ptr->next != NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU list sanity check failed") entry_ptr = cache_ptr->LRU_head_ptr; while (entry_ptr != NULL) { if ((entry_ptr != cache_ptr->LRU_head_ptr) && ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry has bad prev/next pointers") if ((entry_ptr != cache_ptr->LRU_tail_ptr) && ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry has bad prev/next pointers") if ((entry_ptr->is_pinned) || (entry_ptr->pinned_from_client) || (entry_ptr->pinned_from_cache)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "invalid entry 'pin origin' fields") len++; size += entry_ptr->size; @@ -7809,7 +7809,7 @@ H5C_validate_lru_list(H5C_t *cache_ptr) } if ((cache_ptr->LRU_list_len != (uint32_t)len) || (cache_ptr->LRU_list_size != size)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU list length/size check failed") done: if (ret_value != SUCCEED) @@ -7852,33 +7852,33 @@ H5C_validate_pinned_entry_list(H5C_t *cache_ptr) if (((cache_ptr->pel_head_ptr == NULL) || (cache_ptr->pel_tail_ptr == NULL)) && (cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pinned list head/tail check failed") if ((cache_ptr->pel_len == 1) && ((cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr) || (cache_ptr->pel_head_ptr == NULL) || (cache_ptr->pel_head_ptr->size != cache_ptr->pel_size))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pinned list sanity check failed") if ((cache_ptr->pel_len >= 1) && ((cache_ptr->pel_head_ptr == NULL) || (cache_ptr->pel_head_ptr->prev != NULL) || (cache_ptr->pel_tail_ptr == NULL) || (cache_ptr->pel_tail_ptr->next != NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pinned list sanity check failed") entry_ptr = cache_ptr->pel_head_ptr; while (entry_ptr != NULL) { if ((entry_ptr != cache_ptr->pel_head_ptr) && ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry has bad prev/next pointers") if ((entry_ptr != cache_ptr->pel_tail_ptr) && ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry has bad prev/next pointers") if (!entry_ptr->is_pinned) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pinned list contains unpinned entry") if (!(entry_ptr->pinned_from_client || entry_ptr->pinned_from_cache)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "invalid entry 'pin origin' fields") len++; size += entry_ptr->size; @@ -7886,7 +7886,7 @@ H5C_validate_pinned_entry_list(H5C_t *cache_ptr) } if ((cache_ptr->pel_len != (uint32_t)len) || (cache_ptr->pel_size != size)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pinned list length/size check failed") done: if (ret_value != SUCCEED) @@ -7929,33 +7929,33 @@ H5C_validate_protected_entry_list(H5C_t *cache_ptr) if (((cache_ptr->pl_head_ptr == NULL) || (cache_ptr->pl_tail_ptr == NULL)) && (cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "protected list head/tail check failed") if ((cache_ptr->pl_len == 1) && ((cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr) || (cache_ptr->pl_head_ptr == NULL) || (cache_ptr->pl_head_ptr->size != cache_ptr->pl_size))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "protected list sanity check failed") if ((cache_ptr->pl_len >= 1) && ((cache_ptr->pl_head_ptr == NULL) || (cache_ptr->pl_head_ptr->prev != NULL) || (cache_ptr->pl_tail_ptr == NULL) || (cache_ptr->pl_tail_ptr->next != NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "protected list sanity check failed") entry_ptr = cache_ptr->pl_head_ptr; while (entry_ptr != NULL) { if ((entry_ptr != cache_ptr->pl_head_ptr) && ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry has bad prev/next pointers") if ((entry_ptr != cache_ptr->pl_tail_ptr) && ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry has bad prev/next pointers") if (!entry_ptr->is_protected) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "protected list contains unprotected entry") if (entry_ptr->is_read_only && (entry_ptr->ro_ref_count <= 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "read-only entry has non-positive ref count") len++; size += entry_ptr->size; @@ -7963,7 +7963,7 @@ H5C_validate_protected_entry_list(H5C_t *cache_ptr) } if ((cache_ptr->pl_len != (uint32_t)len) || (cache_ptr->pl_size != size)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "protected list length/size check failed") done: if (ret_value != SUCCEED) diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index a0cc6bb..a746e54 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -199,7 +199,7 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha HDmemset(tbl_buf, 0, sizeof(tbl_buf)); - HDsprintf(&(tbl_buf[0]), "candidate list = "); + HDsnprintf(tbl_buf, sizeof(tbl_buf), "candidate list = "); for (u = 0; u < num_candidates; u++) HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " 0x%llx", (long long)(*(candidates_list_ptr + u))); HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n"); @@ -266,7 +266,7 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha #if H5C_APPLY_CANDIDATE_LIST__DEBUG for (u = 0; u < 1024; u++) tbl_buf[u] = '\0'; - HDsprintf(&(tbl_buf[0]), "candidate assignment table = "); + HDsnprintf(tbl_buf, sizeof(tbl_buf), "candidate assignment table = "); for (u = 0; u <= (unsigned)mpi_size; u++) HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %u", candidate_assignment_table[u]); HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n"); diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index 92252dc..94dc64d 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -285,7 +285,7 @@ H5D__compact_iovv_memmanage_cb(hsize_t dst_off, hsize_t src_off, size_t len, voi HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "can't get file handle") /* Setup operation flags and arguments */ - op_flags = H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG | H5FD_CTL__FAIL_IF_UNKNOWN_FLAG; + op_flags = H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG | H5FD_CTL_FAIL_IF_UNKNOWN_FLAG; op_args.dstbuf = udata->dstbuf; op_args.dst_off = dst_off; @@ -294,7 +294,7 @@ H5D__compact_iovv_memmanage_cb(hsize_t dst_off, hsize_t src_off, size_t len, voi op_args.len = len; /* Make request to file driver */ - if (H5FD_ctl(file_handle, H5FD_CTL__MEM_COPY, op_flags, &op_args, NULL) < 0) + if (H5FD_ctl(file_handle, H5FD_CTL_MEM_COPY, op_flags, &op_args, NULL) < 0) HGOTO_ERROR(H5E_IO, H5E_FCNTL, FAIL, "VFD memcpy request failed") done: diff --git a/src/H5Dint.c b/src/H5Dint.c index 3b6b884..ee49464 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1564,7 +1564,7 @@ done: vds_prefix = (char *)H5MM_xfree(vds_prefix); if (ret_value == NULL) { - /* Free the location--casting away const*/ + /* Free the location */ if (dataset) { if (shared_fo == NULL && dataset->shared) { /* Need to free shared fo */ dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix); @@ -3502,7 +3502,7 @@ H5D_flush_all(H5F_t *f) HDassert(f); /* Iterate over all the open datasets */ - if (H5I_iterate(H5I_DATASET, H5D__flush_all_cb, f, FALSE) < 0) /* Casting away const OK -QAK */ + if (H5I_iterate(H5I_DATASET, H5D__flush_all_cb, f, FALSE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to flush cached dataset info") done: diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 0620459..655d475 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -4068,10 +4068,18 @@ H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk else { int all_sends_completed; - /* Determine if all send requests have completed */ + /* Determine if all send requests have completed + * + * gcc 11 complains about passing MPI_STATUSES_IGNORE as an MPI_Status + * array. See the discussion here: + * + * https://github.com/pmodels/mpich/issues/5687 + */ + H5_GCC_DIAG_OFF("stringop-overflow") if (MPI_SUCCESS != (mpi_code = MPI_Testall((int)num_send_requests, send_requests, &all_sends_completed, MPI_STATUSES_IGNORE))) HMPI_GOTO_ERROR(FAIL, "MPI_Testall failed", mpi_code) + H5_GCC_DIAG_ON("stringop-overflow") if (all_sends_completed) { /* Post non-blocking barrier */ @@ -4105,9 +4113,16 @@ H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk * in the order that chunks are processed. So, the safest way to * support both I/O modes is to simply make sure all messages * are available. + * + * gcc 11 complains about passing MPI_STATUSES_IGNORE as an MPI_Status + * array. See the discussion here: + * + * https://github.com/pmodels/mpich/issues/5687 */ + H5_GCC_DIAG_OFF("stringop-overflow") if (MPI_SUCCESS != (mpi_code = MPI_Waitall((int)num_recv_requests, recv_requests, MPI_STATUSES_IGNORE))) HMPI_GOTO_ERROR(FAIL, "MPI_Waitall failed", mpi_code) + H5_GCC_DIAG_ON("stringop-overflow") /* Set the new number of locally-selected chunks */ *chunk_list_num_entries = last_assigned_idx; diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 2daf05a..0326180 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -527,8 +527,7 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) UINT32ENCODE(heap_block_p, chksum) /* Insert block into global heap */ - if (H5HG_insert(f, block_size, heap_block, &(virt->serial_list_hobjid)) < - 0) /* Casting away const OK --NAF */ + if (H5HG_insert(f, block_size, heap_block, &(virt->serial_list_hobjid)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to insert virtual dataset heap block") } /* end if */ diff --git a/src/H5EAcache.c b/src/H5EAcache.c index d3b06cb..86610f9 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -638,7 +638,7 @@ H5EA__cache_iblock_get_initial_load_size(void *_udata, size_t *image_len) /* Set up fake index block for computing size on disk */ HDmemset(&iblock, 0, sizeof(iblock)); - iblock.hdr = (H5EA_hdr_t *)hdr; /* Casting away 'const' OK - QAK */ + iblock.hdr = (H5EA_hdr_t *)hdr; iblock.nsblks = H5EA_SBLK_FIRST_IDX(hdr->cparam.sup_blk_min_data_ptrs); iblock.ndblk_addrs = 2 * ((size_t)hdr->cparam.sup_blk_min_data_ptrs - 1); iblock.nsblk_addrs = hdr->nsblks - iblock.nsblks; diff --git a/src/H5ESdevelop.h b/src/H5ESdevelop.h index 2fb9aeb..5bbf74e 100644 --- a/src/H5ESdevelop.h +++ b/src/H5ESdevelop.h @@ -15,8 +15,8 @@ * support routines. */ -#ifndef _H5ESdevelop_H -#define _H5ESdevelop_H +#ifndef H5ESdevelop_H +#define H5ESdevelop_H /* Include package's public header */ #include "H5ESpublic.h" @@ -49,4 +49,4 @@ H5_DLL herr_t H5ESget_requests(hid_t es_id, H5_iter_order_t order, hid_t *connec } #endif -#endif /* _H5ESdevelop_H */ +#endif /* H5ESdevelop_H */ diff --git a/src/H5FD.c b/src/H5FD.c index 6584843..162e27f 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -2180,7 +2180,7 @@ H5FD_ctl(H5FD_t *file, uint64_t op_code, uint64_t flags, const void *input, void /* Dispatch to driver if the ctl function exists. * - * If it doesn't, fail if the H5FD_CTL__FAIL_IF_UNKNOWN_FLAG is set. + * If it doesn't, fail if the H5FD_CTL_FAIL_IF_UNKNOWN_FLAG is set. * * Otherwise, report success. */ @@ -2190,7 +2190,7 @@ H5FD_ctl(H5FD_t *file, uint64_t op_code, uint64_t flags, const void *input, void HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed") } - else if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG) { + else if (flags & H5FD_CTL_FAIL_IF_UNKNOWN_FLAG) { HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed (no ctl callback and fail if unknown flag is set)") diff --git a/src/H5FDcore.c b/src/H5FDcore.c index ebf9921..20bb5f2 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -1607,7 +1607,7 @@ H5FD__core_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing BOOL bError; /* Boolean error flag */ /* Windows uses this odd QuadPart union for 32/64-bit portability */ - li.QuadPart = (__int64)file->eoa; + li.QuadPart = (LONGLONG)file->eoa; /* Extend the file to make sure it's large enough. * diff --git a/src/H5FDdevelop.h b/src/H5FDdevelop.h index f5b32ed..50eae1f 100644 --- a/src/H5FDdevelop.h +++ b/src/H5FDdevelop.h @@ -15,8 +15,8 @@ * support routines. */ -#ifndef _H5FDdevelop_H -#define _H5FDdevelop_H +#ifndef H5FDdevelop_H +#define H5FDdevelop_H /* Include package's public header */ #include "H5FDpublic.h" @@ -292,4 +292,4 @@ H5_DLL herr_t H5FDctl(H5FD_t *file, uint64_t op_code, uint64_t flags, const voi } #endif -#endif /* _H5FDdevelop_H */ +#endif /* H5FDdevelop_H */ diff --git a/src/H5FDint.c b/src/H5FDint.c index 120b570..0a8b28c 100644 --- a/src/H5FDint.c +++ b/src/H5FDint.c @@ -84,7 +84,7 @@ typedef struct H5FD_vsrt_tmp_t { haddr_t addr; - int index; + size_t index; } H5FD_vsrt_tmp_t; /* Information needed for iterating over the registered VFD hid_t IDs. @@ -790,25 +790,27 @@ H5FD__read_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uin /* Sanity checks */ HDassert(file); HDassert(file->cls); - HDassert(mem_spaces); - HDassert(file_spaces); - HDassert(offsets); - HDassert(element_sizes); - HDassert(bufs); - - /* Verify that the first elements of the element_sizes and bufs arrays are - * valid. */ - HDassert(element_sizes[0] != 0); - HDassert(bufs[0] != NULL); + HDassert((mem_spaces) || (count == 0)); + HDassert((file_spaces) || (count == 0)); + HDassert((offsets) || (count == 0)); + HDassert((element_sizes) || (count == 0)); + HDassert((bufs) || (count == 0)); /* Check if we're using vector I/O */ use_vector = file->cls->read_vector != NULL; - /* Allocate sequence lists for memory and file spaces */ - if (NULL == (file_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "couldn't allocate file selection iterator") - if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "couldn't allocate memory selection iterator") + if (count > 0) { + /* Verify that the first elements of the element_sizes and bufs arrays are + * valid. */ + HDassert(element_sizes[0] != 0); + HDassert(bufs[0] != NULL); + + /* Allocate sequence lists for memory and file spaces */ + if (NULL == (file_iter = H5FL_MALLOC(H5S_sel_iter_t))) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "couldn't allocate file selection iterator") + if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t))) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "couldn't allocate memory selection iterator") + } /* Loop over dataspaces */ for (i = 0; i < count; i++) { @@ -1431,25 +1433,27 @@ H5FD__write_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, ui /* Sanity checks */ HDassert(file); HDassert(file->cls); - HDassert(mem_spaces); - HDassert(file_spaces); - HDassert(offsets); - HDassert(element_sizes); - HDassert(bufs); - - /* Verify that the first elements of the element_sizes and bufs arrays are - * valid. */ - HDassert(element_sizes[0] != 0); - HDassert(bufs[0] != NULL); + HDassert((mem_spaces) || (count == 0)); + HDassert((file_spaces) || (count == 0)); + HDassert((offsets) || (count == 0)); + HDassert((element_sizes) || (count == 0)); + HDassert((bufs) || (count == 0)); /* Check if we're using vector I/O */ use_vector = file->cls->write_vector != NULL; - /* Allocate sequence lists for memory and file spaces */ - if (NULL == (file_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "couldn't allocate file selection iterator") - if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "couldn't allocate memory selection iterator") + if (count > 0) { + /* Verify that the first elements of the element_sizes and bufs arrays are + * valid. */ + HDassert(element_sizes[0] != 0); + HDassert(bufs[0] != NULL); + + /* Allocate sequence lists for memory and file spaces */ + if (NULL == (file_iter = H5FL_MALLOC(H5S_sel_iter_t))) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "couldn't allocate file selection iterator") + if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t))) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "couldn't allocate memory selection iterator") + } /* Loop over dataspaces */ for (i = 0; i < count; i++) { @@ -2256,7 +2260,7 @@ H5FD_sort_vector_io_req(hbool_t *vector_was_sorted, uint32_t _count, H5FD_mem_t * arrays and populate them using the mapping provided by * the sorted array of H5FD_vsrt_tmp_t. */ - int j; + size_t j; size_t fixed_size_index = count; size_t fixed_type_index = count; size_t srt_tmp_size; @@ -2268,10 +2272,8 @@ H5FD_sort_vector_io_req(hbool_t *vector_was_sorted, uint32_t _count, H5FD_mem_t HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't alloc srt_tmp") for (i = 0; i < count; i++) { - HDassert(i == (size_t)((int)i)); - srt_tmp[i].addr = addrs[i]; - srt_tmp[i].index = (int)i; + srt_tmp[i].index = i; } /* sort the srt_tmp array */ @@ -2315,15 +2317,17 @@ H5FD_sort_vector_io_req(hbool_t *vector_was_sorted, uint32_t _count, H5FD_mem_t HDassert(fixed_size_index <= count); HDassert(fixed_type_index <= count); - /* populate the sorted vectors */ + /* Populate the sorted vectors. Note that the index stored in srt_tmp + * refers to the index in the unsorted array, while the position of + * srt_tmp within the sorted array is the index in the sorted arrays */ for (i = 0; i < count; i++) { j = srt_tmp[i].index; - (*s_types_ptr)[j] = types[MIN(i, fixed_type_index)]; - (*s_addrs_ptr)[j] = addrs[i]; - (*s_sizes_ptr)[j] = sizes[MIN(i, fixed_size_index)]; - (*s_bufs_ptr)[j] = bufs[i]; + (*s_types_ptr)[i] = types[MIN(j, fixed_type_index)]; + (*s_addrs_ptr)[i] = addrs[j]; + (*s_sizes_ptr)[i] = sizes[MIN(j, fixed_size_index)]; + (*s_bufs_ptr)[i] = bufs[j]; } } diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 28ba5d8..90c4d0f 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -1626,7 +1626,7 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_ */ /* Windows uses this odd QuadPart union for 32/64-bit portability */ - li.QuadPart = (__int64)file->eoa; + li.QuadPart = (LONGLONG)file->eoa; /* Extend the file to make sure it's large enough. * diff --git a/src/H5FDmpi.c b/src/H5FDmpi.c index 7eb1463..45791e8 100644 --- a/src/H5FDmpi.c +++ b/src/H5FDmpi.c @@ -57,7 +57,7 @@ int H5FD_mpi_get_rank(H5FD_t *file) { const H5FD_class_t *cls; - uint64_t flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + uint64_t flags = H5FD_CTL_FAIL_IF_UNKNOWN_FLAG | H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG; int rank = -1; void * rank_ptr = (void *)(&rank); int ret_value; @@ -70,7 +70,7 @@ H5FD_mpi_get_rank(H5FD_t *file) HDassert(cls->ctl); /* All MPI drivers must implement this */ /* Dispatch to driver */ - if ((cls->ctl)(file, H5FD_CTL__GET_MPI_RANK_OPCODE, flags, NULL, &rank_ptr) < 0) + if ((cls->ctl)(file, H5FD_CTL_GET_MPI_RANK_OPCODE, flags, NULL, &rank_ptr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_rank request failed") HDassert(rank >= 0); @@ -109,7 +109,7 @@ int H5FD_mpi_get_size(H5FD_t *file) { const H5FD_class_t *cls; - uint64_t flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + uint64_t flags = H5FD_CTL_FAIL_IF_UNKNOWN_FLAG | H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG; int size = 0; void * size_ptr = (void *)(&size); int ret_value; @@ -122,7 +122,7 @@ H5FD_mpi_get_size(H5FD_t *file) HDassert(cls->ctl); /* All MPI drivers must implement this */ /* Dispatch to driver */ - if ((cls->ctl)(file, H5FD_CTL__GET_MPI_SIZE_OPCODE, flags, NULL, &size_ptr) < 0) + if ((cls->ctl)(file, H5FD_CTL_GET_MPI_SIZE_OPCODE, flags, NULL, &size_ptr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_size request failed") if (0 >= size) @@ -162,7 +162,7 @@ MPI_Comm H5FD_mpi_get_comm(H5FD_t *file) { const H5FD_class_t *cls; - uint64_t flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + uint64_t flags = H5FD_CTL_FAIL_IF_UNKNOWN_FLAG | H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG; MPI_Comm comm = MPI_COMM_NULL; void * comm_ptr = (void *)(&comm); MPI_Comm ret_value; @@ -175,7 +175,7 @@ H5FD_mpi_get_comm(H5FD_t *file) HDassert(cls->ctl); /* All MPI drivers must implement this */ /* Dispatch to driver */ - if ((cls->ctl)(file, H5FD_CTL__GET_MPI_COMMUNICATOR_OPCODE, flags, NULL, &comm_ptr) < 0) + if ((cls->ctl)(file, H5FD_CTL_GET_MPI_COMMUNICATOR_OPCODE, flags, NULL, &comm_ptr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, MPI_COMM_NULL, "driver get_comm request failed") if (comm == MPI_COMM_NULL) diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 1be4779..ce32bc7 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -3017,9 +3017,9 @@ done: * * At present, the supported op codes are: * - * H5FD_CTL__GET_MPI_COMMUNICATOR_OPCODE - * H5FD_CTL__GET_MPI_RANK_OPCODE - * H5FD_CTL__GET_MPI_SIZE_OPCODE + * H5FD_CTL_GET_MPI_COMMUNICATOR_OPCODE + * H5FD_CTL_GET_MPI_RANK_OPCODE + * H5FD_CTL_GET_MPI_SIZE_OPCODE * * Note that these opcodes must be supported by all VFDs that * support MPI. @@ -3045,26 +3045,26 @@ H5FD__mpio_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void H5_AT switch (op_code) { - case H5FD_CTL__GET_MPI_COMMUNICATOR_OPCODE: + case H5FD_CTL_GET_MPI_COMMUNICATOR_OPCODE: HDassert(output); HDassert(*output); **((MPI_Comm **)output) = file->comm; break; - case H5FD_CTL__GET_MPI_RANK_OPCODE: + case H5FD_CTL_GET_MPI_RANK_OPCODE: HDassert(output); HDassert(*output); **((int **)output) = file->mpi_rank; break; - case H5FD_CTL__GET_MPI_SIZE_OPCODE: + case H5FD_CTL_GET_MPI_SIZE_OPCODE: HDassert(output); HDassert(*output); **((int **)output) = file->mpi_size; break; default: /* unknown op code */ - if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG) { + if (flags & H5FD_CTL_FAIL_IF_UNKNOWN_FLAG) { HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "unknown op_code and fail if unknown") } diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 20c538f..0d5bedf 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -2268,7 +2268,7 @@ H5FD_multi_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *inpu switch (op_code) { /* Unknown op code */ default: - if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG) + if (flags & H5FD_CTL_FAIL_IF_UNKNOWN_FLAG) H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_FCNTL, "VFD ctl request failed (unknown op code and fail if unknown flag is set)", -1); diff --git a/src/H5FDonion.c b/src/H5FDonion.c index 6d42a26..659b807 100644 --- a/src/H5FDonion.c +++ b/src/H5FDonion.c @@ -150,7 +150,7 @@ H5FL_DEFINE_STATIC(H5FD_onion_t); #define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) -#define H5FD_CTL__GET_NUM_REVISIONS 20001 +#define H5FD_CTL_GET_NUM_REVISIONS 20001 /* Prototypes */ static herr_t H5FD__onion_close(H5FD_t *); @@ -1619,7 +1619,7 @@ H5FD__onion_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void H5_A HDassert(file); switch (op_code) { - case H5FD_CTL__GET_NUM_REVISIONS: + case H5FD_CTL_GET_NUM_REVISIONS: if (!output || !*output) HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "the output parameter is null") @@ -1627,7 +1627,7 @@ H5FD__onion_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void H5_A break; /* Unknown op code */ default: - if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG) + if (flags & H5FD_CTL_FAIL_IF_UNKNOWN_FLAG) HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "unknown op_code and fail if unknown flag is set") break; } @@ -1702,8 +1702,8 @@ H5FD__get_onion_revision_count(H5FD_t *file, size_t *revision_count) HDassert(file); HDassert(revision_count); - op_code = H5FD_CTL__GET_NUM_REVISIONS; - flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG; + op_code = H5FD_CTL_GET_NUM_REVISIONS; + flags = H5FD_CTL_FAIL_IF_UNKNOWN_FLAG; /* Get the number of revisions via the ctl callback */ if (H5FD_ctl(file, op_code, flags, NULL, (void **)&revision_count) < 0) diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index f8f88f3..d12b525 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -189,14 +189,14 @@ (H5FD_CTL_OPC_RESERVED + 511) /* Maximum opcode value available for experimental use */ /* ctl function op codes: */ -#define H5FD_CTL__INVALID_OPCODE 0 -#define H5FD_CTL__TEST_OPCODE 1 -#define H5FD_CTL__GET_MPI_COMMUNICATOR_OPCODE 2 -#define H5FD_CTL__GET_MPI_RANK_OPCODE 3 -#define H5FD_CTL__GET_MPI_SIZE_OPCODE 4 -#define H5FD_CTL__MEM_ALLOC 5 -#define H5FD_CTL__MEM_FREE 6 -#define H5FD_CTL__MEM_COPY 7 +#define H5FD_CTL_INVALID_OPCODE 0 +#define H5FD_CTL_TEST_OPCODE 1 +#define H5FD_CTL_GET_MPI_COMMUNICATOR_OPCODE 2 +#define H5FD_CTL_GET_MPI_RANK_OPCODE 3 +#define H5FD_CTL_GET_MPI_SIZE_OPCODE 4 +#define H5FD_CTL_MEM_ALLOC 5 +#define H5FD_CTL_MEM_FREE 6 +#define H5FD_CTL_MEM_COPY 7 /* ctl function flags: */ @@ -228,7 +228,7 @@ */ /* Unknown op codes should be ignored silently unless the - * H5FD_CTL__FAIL_IF_UNKNOWN_FLAG is set. + * H5FD_CTL_FAIL_IF_UNKNOWN_FLAG is set. * * On terminal VFDs, unknown op codes should generate an * error unconditionally if this flag is set. @@ -238,9 +238,9 @@ * flags. In the absence of such flags, the VFD should * generate an error. */ -#define H5FD_CTL__FAIL_IF_UNKNOWN_FLAG 0x0001 +#define H5FD_CTL_FAIL_IF_UNKNOWN_FLAG 0x0001 -/* The H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG is used only +/* The H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG is used only * by non-ternminal VFDs, and only applies to unknown * opcodes. (known op codes should be handled as * appropriate.) @@ -250,9 +250,9 @@ * the VFD stack en-route to the terminal VFD. * If that VFD does not support the ctl call, the * pass through VFD should fail or succeed as directed - * by the H5FD_CTL__FAIL_IF_UNKNOWN_FLAG. + * by the H5FD_CTL_FAIL_IF_UNKNOWN_FLAG. */ -#define H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG 0x0002 +#define H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG 0x0002 /*******************/ /* Public Typedefs */ diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index acc705e..e83411c 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -915,7 +915,7 @@ H5FD__sec2_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR BOOL bError; /* Boolean error flag */ /* Windows uses this odd QuadPart union for 32/64-bit portability */ - li.QuadPart = (__int64)file->eoa; + li.QuadPart = (LONGLONG)file->eoa; /* Extend the file to make sure it's large enough. * @@ -1086,7 +1086,7 @@ H5FD__sec2_ctl(H5FD_t *_file, uint64_t H5_ATTR_UNUSED op_code, uint64_t flags, HDassert(_file); /* No op codes are understood. */ - if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG) + if (flags & H5FD_CTL_FAIL_IF_UNKNOWN_FLAG) HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "unknown op_code and fail if unknown flag is set") done: diff --git a/src/H5FDsplitter.c b/src/H5FDsplitter.c index 3d7093a..48de4e6 100644 --- a/src/H5FDsplitter.c +++ b/src/H5FDsplitter.c @@ -1325,16 +1325,16 @@ H5FD__splitter_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void * switch (op_code) { /* Unknown op code */ default: - if (flags & H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG) { + if (flags & H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG) { /* Pass ctl call down to R/W channel VFD */ if (H5FDctl(file->rw_file, op_code, flags, input, output) < 0) HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed") } else { /* If no valid VFD routing flag is specified, fail for unknown op code - * if H5FD_CTL__FAIL_IF_UNKNOWN_FLAG flag is set. + * if H5FD_CTL_FAIL_IF_UNKNOWN_FLAG flag is set. */ - if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG) + if (flags & H5FD_CTL_FAIL_IF_UNKNOWN_FLAG) HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed (unknown op code and fail if unknown flag is set)") } diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 6624685..39dba47 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -1066,7 +1066,7 @@ H5FD_stdio_truncate(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, hbool_t /*UNUSED*/ rewind(file->fp); /* Windows uses this odd QuadPart union for 32/64-bit portability */ - li.QuadPart = (__int64)file->eoa; + li.QuadPart = (LONGLONG)file->eoa; /* Extend the file to make sure it's large enough. * diff --git a/src/H5Fint.c b/src/H5Fint.c index fd3e6be..0b75d2e 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -2707,10 +2707,13 @@ H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *n if (NULL == (new_fapl = (H5P_genplist_t *)H5I_object(new_fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "can't get property list") - /* Set the character encoding on the new property list */ + /* + * Set the private property for retrieving the backing store + * POSIX file descriptor from the Core VFD + */ want_posix_fd = TRUE; if (H5P_set(new_fapl, H5F_ACS_WANT_POSIX_FD_NAME, &want_posix_fd) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set character encoding") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set property for retrieving file descriptor") /* Retrieve the file handle */ if (H5F_get_vfd_handle(f, new_fapl_id, (void **)&fd) < 0) diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 4e4fe8d..6a82a6e 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -687,7 +687,9 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Sanity check - superblock extension should only be defined for * superblock version >= 2. */ - HDassert(sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_2); + if (sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, + "invalid superblock - extension message should not be defined for version < 2") /* Check for superblock extension being located "outside" the stored * 'eoa' value, which can occur with the split/multi VFD. diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c index d98e047..cc6113d 100644 --- a/src/H5Gcompact.c +++ b/src/H5Gcompact.c @@ -138,7 +138,7 @@ H5G__compact_build_table(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_ind H5O_mesg_operator_t op; /* Message operator */ /* Allocate the link table */ - if ((ltable->lnks = (H5O_link_t *)H5MM_malloc(sizeof(H5O_link_t) * ltable->nlinks)) == NULL) + if ((ltable->lnks = (H5O_link_t *)H5MM_calloc(sizeof(H5O_link_t) * ltable->nlinks)) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Set up user data for iteration */ diff --git a/src/H5Gname.c b/src/H5Gname.c index 7002daa..2ea1912 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -446,9 +446,10 @@ H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_depth_t depth) dst->user_path_r = H5RS_dup(src->user_path_r); } else { - /* Discarding 'const' qualifier OK - QAK */ + H5_GCC_CLANG_DIAG_OFF("cast-qual") H5G_name_reset((H5G_name_t *)src); - } /* end if */ + H5_GCC_CLANG_DIAG_ON("cast-qual") + } FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5G_name_copy() */ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index aabb6a7..9f6d7e0 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -1228,7 +1228,9 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, const /* Set up group location for soft link to start in */ H5G_name_reset(&grp_path); grp_loc.path = &grp_path; + H5_GCC_CLANG_DIAG_OFF("cast-qual") grp_loc.oloc = (H5O_loc_t *)src_oloc; + H5_GCC_CLANG_DIAG_ON("cast-qual") /* Get pointer to link value in local heap */ if ((link_name = (char *)H5HL_offset_into(heap, tmp_src_ent.cache.slink.lval_offset)) == NULL) diff --git a/src/H5Gobj.c b/src/H5Gobj.c index 5412b52..cc92f2c 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -242,21 +242,20 @@ H5G__obj_create_real(H5F_t *f, const H5O_ginfo_t *ginfo, const H5O_linfo_t *linf /* Check for format of group to create */ if (use_at_least_v18) { + H5_GCC_CLANG_DIAG_OFF("cast-qual") /* Insert link info message */ - /* (Casting away const OK - QAK) */ if (H5O_msg_create(oloc, H5O_LINFO_ID, 0, H5O_UPDATE_TIME, (void *)linfo) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message") /* Insert group info message */ - /* (Casting away const OK - QAK) */ if (H5O_msg_create(oloc, H5O_GINFO_ID, H5O_MSG_FLAG_CONSTANT, 0, (void *)ginfo) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message") /* Insert pipeline message */ if (pline && pline->nused) - /* (Casting away const OK - QAK) */ if (H5O_msg_create(oloc, H5O_PLINE_ID, H5O_MSG_FLAG_CONSTANT, 0, (void *)pline) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message") + H5_GCC_CLANG_DIAG_ON("cast-qual") } /* end if */ else { H5O_stab_t stab; /* Symbol table message */ @@ -398,9 +397,10 @@ H5G__obj_stab_to_new_cb(const H5O_link_t *lnk, void *_udata) HDassert(udata); /* Insert link into group */ - /* (Casting away const OK - QAK) */ + H5_GCC_CLANG_DIAG_OFF("cast-qual") if (H5G_obj_insert(udata->grp_oloc, lnk->name, (H5O_link_t *)lnk, FALSE, H5O_TYPE_UNKNOWN, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5_ITER_ERROR, "can't insert link into group") + H5_GCC_CLANG_DIAG_ON("cast-qual") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 15fb9a4..f03794e 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -713,18 +713,17 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to hold file open") /* Reset any non-default object header messages */ + H5_GCC_CLANG_DIAG_OFF("cast-qual") if (ginfo != &def_ginfo) - /* (Casting away const OK - QAK) */ if (H5O_msg_reset(H5O_GINFO_ID, (void *)ginfo) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset group info message") if (linfo != &def_linfo) - /* (Casting away const OK - QAK) */ if (H5O_msg_reset(H5O_LINFO_ID, (void *)linfo) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset link info message") if (pline != &def_pline) - /* (Casting away const OK - QAK) */ if (H5O_msg_reset(H5O_PLINE_ID, (void *)pline) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset I/O pipeline message") + H5_GCC_CLANG_DIAG_ON("cast-qual") } /* end if */ else HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "component not found") diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 4f86993..331b580 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -742,7 +742,9 @@ H5HF__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UN HDassert(len == hdr->heap_size); /* Set the shared heap header's file context for this operation */ + H5_GCC_CLANG_DIAG_OFF("discarded-qualifiers") hdr->f = f; + H5_GCC_CLANG_DIAG_ON("discarded-qualifiers") /* Magic number */ H5MM_memcpy(image, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -1328,7 +1330,9 @@ H5HF__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG hdr = iblock->hdr; /* Set the shared heap header's file context for this operation */ + H5_GCC_CLANG_DIAG_OFF("discarded-qualifiers") hdr->f = f; + H5_GCC_CLANG_DIAG_ON("discarded-qualifiers") /* Magic number */ H5MM_memcpy(image, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -1675,7 +1679,6 @@ H5HF__cache_dblock_verify_chksum(const void *_image, size_t len, void *_udata) chk_p -= H5HF_SIZEOF_CHKSUM; /* Reset checksum field, for computing the checksum */ - /* (Casting away const OK - QAK) */ HDmemset(chk_p, 0, (size_t)H5HF_SIZEOF_CHKSUM); /* Compute checksum on entire direct block */ diff --git a/src/H5Idbg.c b/src/H5Idbg.c index 6b4a979..3eb6518 100644 --- a/src/H5Idbg.c +++ b/src/H5Idbg.c @@ -111,7 +111,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) const H5T_t *dt = (const H5T_t *)info->object; H5_GCC_CLANG_DIAG_OFF("cast-qual") - object = (void *)H5T_get_actual_type((H5T_t *)dt); /* Casting away const OK - QAK */ + object = (void *)H5T_get_actual_type((H5T_t *)dt); H5_GCC_CLANG_DIAG_ON("cast-qual") path = H5T_nameof(object); diff --git a/src/H5Idevelop.h b/src/H5Idevelop.h index 3cd951e..13e3a83 100644 --- a/src/H5Idevelop.h +++ b/src/H5Idevelop.h @@ -15,8 +15,8 @@ * support routines. */ -#ifndef _H5Idevelop_H -#define _H5Idevelop_H +#ifndef H5Idevelop_H +#define H5Idevelop_H /* Include package's public header */ #include "H5Ipublic.h" /* ID management */ @@ -136,4 +136,4 @@ H5_DLL hid_t H5Iregister_future(H5I_type_t type, const void *object, H5I_future_ } #endif -#endif /* _H5Idevelop_H */ +#endif /* H5Idevelop_H */ diff --git a/src/H5Iint.c b/src/H5Iint.c index ca6d208..e382efc 100644 --- a/src/H5Iint.c +++ b/src/H5Iint.c @@ -697,7 +697,7 @@ H5I_subst(hid_t id, const void *new_object) /* Get the old object pointer to return */ H5_GCC_CLANG_DIAG_OFF("cast-qual") - ret_value = (void *)info->object; /* (Casting away const OK -QAK) */ + ret_value = (void *)info->object; H5_GCC_CLANG_DIAG_ON("cast-qual") /* Set the new object pointer for the ID */ @@ -731,7 +731,7 @@ H5I_object(hid_t id) if (NULL != (info = H5I__find_id(id))) { /* Get the object pointer to return */ H5_GCC_CLANG_DIAG_OFF("cast-qual") - ret_value = (void *)info->object; /* (Casting away const OK -QAK) */ + ret_value = (void *)info->object; H5_GCC_CLANG_DIAG_ON("cast-qual") } @@ -767,7 +767,7 @@ H5I_object_verify(hid_t id, H5I_type_t type) if (type == H5I_TYPE(id) && NULL != (info = H5I__find_id(id))) { /* Get the object pointer to return */ H5_GCC_CLANG_DIAG_OFF("cast-qual") - ret_value = (void *)info->object; /* (Casting away const OK -QAK) */ + ret_value = (void *)info->object; H5_GCC_CLANG_DIAG_ON("cast-qual") } @@ -930,7 +930,7 @@ H5I__remove_common(H5I_type_info_t *type_info, hid_t id) type_info->last_id_info = NULL; H5_GCC_CLANG_DIAG_OFF("cast-qual") - ret_value = (void *)info->object; /* (Casting away const OK -QAK) */ + ret_value = (void *)info->object; H5_GCC_CLANG_DIAG_ON("cast-qual") if (!H5I_marking_g) @@ -1032,7 +1032,6 @@ H5I__dec_ref(hid_t id, void **request) type_info = H5I_type_info_array_g[H5I_TYPE(id)]; H5_GCC_CLANG_DIAG_OFF("cast-qual") - /* (Casting away const OK -QAK) */ if (!type_info->cls->free_func || (type_info->cls->free_func)((void *)info->object, request) >= 0) { /* Remove the node from the type */ if (NULL == H5I__remove_common(type_info, id)) @@ -1521,7 +1520,7 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) * case we'll need to get the wrapped object struct (H5F_t *, etc.). */ H5_GCC_CLANG_DIAG_OFF("cast-qual") - object = H5I__unwrap((void *)info->object, type); /* Casting away const OK */ + object = H5I__unwrap((void *)info->object, type); H5_GCC_CLANG_DIAG_ON("cast-qual") /* Invoke callback function */ @@ -1713,7 +1712,7 @@ H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) /* Get a pointer to the VOL connector's data */ H5_GCC_CLANG_DIAG_OFF("cast-qual") - object = H5I__unwrap((void *)info->object, type); /* Casting away const OK */ + object = H5I__unwrap((void *)info->object, type); H5_GCC_CLANG_DIAG_ON("cast-qual") /* Check for a match */ diff --git a/src/H5Ldevelop.h b/src/H5Ldevelop.h index 43ed7de..96b2ec3 100644 --- a/src/H5Ldevelop.h +++ b/src/H5Ldevelop.h @@ -15,8 +15,8 @@ * support routines. */ -#ifndef _H5Ldevelop_H -#define _H5Ldevelop_H +#ifndef H5Ldevelop_H +#define H5Ldevelop_H /* Include package's public header */ #include "H5Lpublic.h" @@ -311,4 +311,4 @@ typedef struct { #endif /* H5_NO_DEPRECATED_SYMBOLS */ -#endif /* _H5Ldevelop_H */ +#endif /* H5Ldevelop_H */ diff --git a/src/H5Lint.c b/src/H5Lint.c index 9dc8d0b..12de22f 100644 --- a/src/H5Lint.c +++ b/src/H5Lint.c @@ -595,8 +595,9 @@ H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H5_AT udata->lnk->cset = H5F_DEFAULT_CSET; /* Default character encoding for link */ /* Set the link's name correctly */ - /* Casting away const OK -QAK */ + H5_GCC_CLANG_DIAG_OFF("cast-qual") udata->lnk->name = (char *)name; + H5_GCC_CLANG_DIAG_ON("cast-qual") /* Insert link into group */ if (H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, @@ -1374,9 +1375,10 @@ H5L__move_dest_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "moving a link across files is not allowed") /* Give the object its new name */ - /* Casting away const okay -JML */ HDassert(udata->lnk->name == NULL); + H5_GCC_CLANG_DIAG_OFF("cast-qual") udata->lnk->name = (char *)name; + H5_GCC_CLANG_DIAG_ON("cast-qual") /* Insert the link into the group */ if (H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, H5O_TYPE_UNKNOWN, NULL) < 0) @@ -2123,7 +2125,9 @@ H5L__link_copy_file(H5F_t *dst_file, const H5O_link_t *_src_lnk, const H5O_loc_t /* Set up group location for link */ H5G_name_reset(&lnk_grp_path); lnk_grp_loc.path = &lnk_grp_path; - lnk_grp_loc.oloc = (H5O_loc_t *)src_oloc; /* Casting away const OK -QAK */ + H5_GCC_CLANG_DIAG_OFF("cast-qual") + lnk_grp_loc.oloc = (H5O_loc_t *)src_oloc; + H5_GCC_CLANG_DIAG_ON("cast-qual") /* Check if the target object exists */ if (H5G_loc_exists(&lnk_grp_loc, src_lnk->name, &tar_exists) < 0) diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 685ddd3..e63dc66 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -1430,11 +1430,13 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t oh->nmesgs++; /* Initialize information about message */ - mesg->dirty = FALSE; - mesg->flags = flags; - mesg->crt_idx = crt_idx; - mesg->native = NULL; - mesg->raw = (uint8_t *)chunk_image; /* Casting away const OK - QAK */ + mesg->dirty = FALSE; + mesg->flags = flags; + mesg->crt_idx = crt_idx; + mesg->native = NULL; + H5_GCC_CLANG_DIAG_OFF("cast-qual") + mesg->raw = (uint8_t *)chunk_image; + H5_GCC_CLANG_DIAG_ON("cast-qual") mesg->raw_size = mesg_size; mesg->chunkno = chunkno; @@ -1637,10 +1639,12 @@ H5O__chunk_serialize(const H5F_t *f, H5O_t *oh, unsigned chunkno) /* Encode any dirty messages in this chunk */ for (u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) - if (curr_msg->dirty && curr_msg->chunkno == chunkno) - /* Casting away const OK -QAK */ + if (curr_msg->dirty && curr_msg->chunkno == chunkno) { + H5_GCC_CLANG_DIAG_OFF("cast-qual") if (H5O_msg_flush((H5F_t *)f, oh, curr_msg) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message") + H5_GCC_CLANG_DIAG_ON("cast-qual") + } /* Sanity checks */ if (oh->version > H5O_VERSION_1) diff --git a/src/H5Opline.c b/src/H5Opline.c index 7f73801..5618dce 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -639,7 +639,6 @@ static herr_t H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int indent, int fwidth) { const H5O_pline_t *pline = (const H5O_pline_t *)mesg; - size_t i, j; FUNC_ENTER_PACKAGE_NOERR @@ -654,10 +653,15 @@ H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int in pline->nalloc); /* Loop over all the filters */ - for (i = 0; i < pline->nused; i++) { - char name[32]; + for (size_t i = 0; i < pline->nused; i++) { + /* 19 characters for text + 20 characters for largest 64-bit size_t + + * terminal NUL = 40 characters. + */ + char name[64]; + HDmemset(name, 0, 64); HDsnprintf(name, sizeof(name), "Filter at position %zu", i); + HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, name); HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), "Filter identification:", (unsigned)(pline->filter[i].id)); @@ -672,14 +676,14 @@ H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int in "Num CD values:", pline->filter[i].cd_nelmts); /* Filter parameters */ - for (j = 0; j < pline->filter[i].cd_nelmts; j++) { + for (size_t j = 0; j < pline->filter[i].cd_nelmts; j++) { char field_name[32]; HDsnprintf(field_name, sizeof(field_name), "CD value %lu", (unsigned long)j); HDfprintf(stream, "%*s%-*s %u\n", indent + 6, "", MAX(0, fwidth - 6), field_name, pline->filter[i].cd_values[j]); - } /* end for */ - } /* end for */ + } + } FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__pline_debug() */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 3c7bc09..3561c65 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -93,7 +93,6 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, \ H5D_VDS_ERROR, HSIZE_UNDEF, -1, -1, FALSE \ } -#ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER #define H5D_DEF_STORAGE_COMPACT \ { \ H5D_COMPACT, \ @@ -142,41 +141,6 @@ H5D_VIRTUAL, H5O_LAYOUT_VERSION_4, H5D_LOPS_VIRTUAL, {H5D_DEF_LAYOUT_CHUNK_INIT}, \ H5D_DEF_STORAGE_VIRTUAL \ } -#else /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ -/* Note that the compact & chunked layout initialization values are using the - * contiguous layout initialization in the union, because the contiguous - * layout is first in the union. These values are overridden in the - * H5P__init_def_layout() routine. -QAK - */ -#define H5D_DEF_LAYOUT_COMPACT \ - { \ - H5D_COMPACT, H5O_LAYOUT_VERSION_DEFAULT, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, \ - { \ - H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT \ - } \ - } -#define H5D_DEF_LAYOUT_CONTIG \ - { \ - H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_DEFAULT, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, \ - { \ - H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT \ - } \ - } -#define H5D_DEF_LAYOUT_CHUNK \ - { \ - H5D_CHUNKED, H5O_LAYOUT_VERSION_DEFAULT, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, \ - { \ - H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT \ - } \ - } -#define H5D_DEF_LAYOUT_VIRTUAL \ - { \ - H5D_VIRTUAL, H5O_LAYOUT_VERSION_4, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, \ - { \ - H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT \ - } \ - } -#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ /* ======== Dataset creation properties ======== */ /* Definitions for storage layout property */ @@ -245,9 +209,6 @@ /* General routines */ static herr_t H5P__set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout); -#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER -static herr_t H5P__init_def_layout(void); -#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ /* Property class callbacks */ static herr_t H5P__dcrt_reg_prop(H5P_genclass_t *pclass); @@ -320,18 +281,10 @@ static const H5O_efl_t H5D_def_efl_g = H5D_CRT_EXT_FILE_LIST_DEF; /* Default static const unsigned H5O_ohdr_min_g = H5D_CRT_MIN_DSET_HDR_SIZE_DEF; /* Default object header minimization */ /* Defaults for each type of layout */ -#ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER static const H5O_layout_t H5D_def_layout_compact_g = H5D_DEF_LAYOUT_COMPACT; static const H5O_layout_t H5D_def_layout_contig_g = H5D_DEF_LAYOUT_CONTIG; static const H5O_layout_t H5D_def_layout_chunk_g = H5D_DEF_LAYOUT_CHUNK; static const H5O_layout_t H5D_def_layout_virtual_g = H5D_DEF_LAYOUT_VIRTUAL; -#else /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ -static H5O_layout_t H5D_def_layout_compact_g = H5D_DEF_LAYOUT_COMPACT; -static H5O_layout_t H5D_def_layout_contig_g = H5D_DEF_LAYOUT_CONTIG; -static H5O_layout_t H5D_def_layout_chunk_g = H5D_DEF_LAYOUT_CHUNK; -static H5O_layout_t H5D_def_layout_virtual_g = H5D_DEF_LAYOUT_VIRTUAL; -static hbool_t H5P_dcrt_def_layout_init_g = FALSE; -#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ /*------------------------------------------------------------------------- * Function: H5P__dcrt_reg_prop @@ -1926,47 +1879,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__set_layout() */ -#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER - -/*------------------------------------------------------------------------- - * Function: H5P__init_def_layout - * - * Purpose: Set the default layout information for the various types of - * dataset layouts - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Tuesday, January 13, 2009 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5P__init_def_layout(void) -{ - const H5O_layout_chunk_t def_layout_chunk = H5D_DEF_LAYOUT_CHUNK_INIT; - const H5O_storage_compact_t def_store_compact = H5D_DEF_STORAGE_COMPACT_INIT; - const H5O_storage_chunk_t def_store_chunk = H5D_DEF_STORAGE_CHUNK_INIT; - const H5O_storage_virtual_t def_store_virtual = H5D_DEF_STORAGE_VIRTUAL_INIT; - - FUNC_ENTER_PACKAGE_NOERR - - /* Initialize the default layout info for non-contigous layouts */ - H5D_def_layout_compact_g.storage.type = H5D_COMPACT; - H5D_def_layout_compact_g.storage.u.compact = def_store_compact; - H5D_def_layout_chunk_g.u.chunk = def_layout_chunk; - H5D_def_layout_chunk_g.storage.type = H5D_CHUNKED; - H5D_def_layout_chunk_g.storage.u.chunk = def_store_chunk; - H5D_def_layout_virtual_g.storage.type = H5D_VIRTUAL; - H5D_def_layout_virtual_g.storage.u.virt = def_store_virtual; - - /* Note that we've initialized the default values */ - H5P_dcrt_def_layout_init_g = TRUE; - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P__init_def_layout() */ -#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ - /*------------------------------------------------------------------------- * Function: H5Pset_layout * @@ -1997,15 +1909,6 @@ H5Pset_layout(hid_t plist_id, H5D_layout_t layout_type) if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") -#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER - /* If the compiler doesn't support C99 designated initializers, check if - * the default layout structs have been initialized yet or not. *ick* -QAK - */ - if (!H5P_dcrt_def_layout_init_g) - if (H5P__init_def_layout() < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't initialize default layout info") -#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ - /* Get pointer to correct default layout */ switch (layout_type) { case H5D_COMPACT: @@ -2114,15 +2017,6 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]) if (!dim) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no chunk dimensions specified") -#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER - /* If the compiler doesn't support C99 designated initializers, check if - * the default layout structs have been initialized yet or not. *ick* -QAK - */ - if (!H5P_dcrt_def_layout_init_g) - if (H5P__init_def_layout() < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't initialize default layout info") -#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ - /* Verify & initialize property's chunk dims */ H5MM_memcpy(&chunk_layout, &H5D_def_layout_chunk_g, sizeof(H5D_def_layout_chunk_g)); HDmemset(&chunk_layout.u.chunk.dim, 0, sizeof(chunk_layout.u.chunk.dim)); @@ -2254,15 +2148,6 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, const if (H5D_virtual_check_mapping_pre(vspace, src_space, H5O_VIRTUAL_STATUS_USER) < 0) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "invalid mapping selections") -#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER - /* If the compiler doesn't support C99 designated initializers, check if - * the default layout structs have been initialized yet or not. *ick* -QAK - */ - if (!H5P_dcrt_def_layout_init_g) - if (H5P__init_def_layout() < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't initialize default layout info") -#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ - /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") @@ -2734,15 +2619,6 @@ H5Pset_chunk_opts(hid_t plist_id, unsigned options) if (options & ~(H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS)) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "unknown chunk options") -#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER - /* If the compiler doesn't support C99 designated initializers, check if - * the default layout structs have been initialized yet or not. *ick* -QAK - */ - if (!H5P_dcrt_def_layout_init_g) - if (H5P__init_def_layout() < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't initialize default layout info") -#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ - /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") @@ -2794,15 +2670,6 @@ H5Pget_chunk_opts(hid_t plist_id, unsigned *options /*out*/) FUNC_ENTER_API(FAIL) H5TRACE2("e", "ix", plist_id, options); -#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER - /* If the compiler doesn't support C99 designated initializers, check if - * the default layout structs have been initialized yet or not. *ick* -QAK - */ - if (!H5P_dcrt_def_layout_init_g) - if (H5P__init_def_layout() < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't initialize default layout info") -#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ - /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") @@ -2995,8 +2862,17 @@ H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name /*out /* Return values */ if (name_size > 0 && name) HDstrncpy(name, efl.slot[idx].name, name_size); + /* XXX: Badness! + * + * The offset parameter is of type off_t and the offset field of H5O_efl_entry_t + * is HDoff_t which is a different type on Windows (off_t is a 32-bit long, + * HDoff_t is __int64, a 64-bit type). + * + * In a future API reboot, we'll either want to make this parameter a haddr_t + * or define a 64-bit HDF5-specific offset type that is platform-independent. + */ if (offset) - *offset = efl.slot[idx].offset; + *offset = (off_t)efl.slot[idx].offset; if (size) *size = efl.slot[idx].size; diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index d0bc2b8..8c021f2 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -5781,6 +5781,9 @@ H5_DLL herr_t H5Pget_dset_no_attrs_hint(hid_t dcpl_id, hbool_t *minimize); * are null pointers then the corresponding information is not * returned. * + * \note On Windows, off_t is typically a 32-bit signed long value, which + * limits the valid offset that can be returned to 2 GiB. + * * \version 1.6.4 \p idx parameter type changed to unsigned. * \since 1.0.0 * diff --git a/src/H5SM.c b/src/H5SM.c index bd061dc8a..7ec5b8f 100644 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -1076,7 +1076,7 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags, unsigned type_id, ssize_t index_num; htri_t tri_ret; #ifndef NDEBUG - unsigned deferred_type = -1U; + unsigned deferred_type = UINT_MAX; #endif htri_t ret_value = TRUE; diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 86aaef2..f27b57a 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -11544,7 +11544,7 @@ H5S__hyper_proj_int_iterate(H5S_hyper_span_info_t *ss_span_info, const H5S_hyper H5S_HYPER_PROJ_INT_ADD_SKIP( udata, H5S__hyper_spans_nelem_helper((H5S_hyper_span_info_t *)ss_span_info, 0, udata->op_gen) * count, - FAIL); /* Casting away const OK -NAF */ + FAIL); /* Clean up if we are done */ if (depth == 0) { diff --git a/src/H5Tdbg.c b/src/H5Tdbg.c index 613aa60..515b710 100644 --- a/src/H5Tdbg.c +++ b/src/H5Tdbg.c @@ -116,7 +116,7 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED *path, int H5_ATTR_UNUSED *nprint /*i else nbytes = 0; nbytes *= path->stats.nelmts; - H5_bandwidth(bandwidth, (double)nbytes, path->stats.times.elapsed); + H5_bandwidth(bandwidth, sizeof(bandwidth), (double)nbytes, path->stats.times.elapsed); HDfprintf(H5DEBUG(T), " %-16s %10" PRIdHSIZE " %10u %8s %8s %8s %10s\n", path->name, path->stats.nelmts, path->stats.ncalls, timestrs.user, timestrs.system, timestrs.elapsed, bandwidth); diff --git a/src/H5Tdevelop.h b/src/H5Tdevelop.h index e642d7c..2ae4178 100644 --- a/src/H5Tdevelop.h +++ b/src/H5Tdevelop.h @@ -15,8 +15,8 @@ * support routines. */ -#ifndef _H5Tdevelop_H -#define _H5Tdevelop_H +#ifndef H5Tdevelop_H +#define H5Tdevelop_H /* Include package's public header */ #include "H5Tpublic.h" @@ -224,4 +224,4 @@ H5_DLL htri_t H5Tcompiler_conv(hid_t src_id, hid_t dst_id); #endif /* H5_NO_DEPRECATED_SYMBOLS */ -#endif /* _H5Tdevelop_H */ +#endif /* H5Tdevelop_H */ diff --git a/src/H5Tnative.c b/src/H5Tnative.c index 114e0a3..9625290 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -1171,10 +1171,20 @@ H5T__init_native_internal(void) /* clang-format off */ + /* Version 19.10 of the PGI C compiler croaks on the following + * tables if they are `static`, so make them `static` only if + * some other compiler is used. + */ +#if defined(__PGIC__) && __PGIC__ == 19 && __PGIC_MINOR__ == 10 +# define static_unless_buggy_pgic +#else +# define static_unless_buggy_pgic static +#endif + /* The library compiles with a limit on `static` object size, so * I broke this table into three. */ - static const native_int_t table1[] = { + static_unless_buggy_pgic const native_int_t table1[] = { NATIVE_ENTRY_INITIALIZER(SCHAR, signed char, 0, true) , NATIVE_ENTRY_INITIALIZER(UCHAR, unsigned char, 0, false) , NATIVE_ENTRY_INITIALIZER(SHORT, short, 0, true) @@ -1188,7 +1198,7 @@ H5T__init_native_internal(void) , NATIVE_ENTRY_INITIALIZER(LLONG, long long, 0, true) , NATIVE_ENTRY_INITIALIZER(ULLONG, unsigned long long, 0, false) }; - static const native_int_t table2[] = { + static_unless_buggy_pgic const native_int_t table2[] = { NATIVE_ENTRY_INITIALIZER(INT8, int8_t, 0, true) , NATIVE_ENTRY_INITIALIZER(UINT8, uint8_t, 0, false) , NATIVE_ENTRY_INITIALIZER(INT_LEAST8, int_least8_t, 0, true) @@ -1202,7 +1212,7 @@ H5T__init_native_internal(void) , NATIVE_ENTRY_INITIALIZER(INT_FAST16, int_fast16_t, 0, true) , NATIVE_ENTRY_INITIALIZER(UINT_FAST16, uint_fast16_t, 0, false) }; - static const native_int_t table3[] = { + static_unless_buggy_pgic const native_int_t table3[] = { NATIVE_ENTRY_INITIALIZER(INT32, int32_t, 0, true) , NATIVE_ENTRY_INITIALIZER(UINT32, uint32_t, 0, false) , NATIVE_ENTRY_INITIALIZER(INT_LEAST32, int_least32_t, 0, true) @@ -1216,11 +1226,12 @@ H5T__init_native_internal(void) , NATIVE_ENTRY_INITIALIZER(INT_FAST64, int_fast64_t, 0, true) , NATIVE_ENTRY_INITIALIZER(UINT_FAST64, uint_fast64_t, 0, false) }; - static const native_int_table_t table_table[] = { + static_unless_buggy_pgic const native_int_table_t table_table[] = { {table1, NELMTS(table1)} , {table2, NELMTS(table2)} , {table3, NELMTS(table3)} }; +#undef static_unless_buggy_pgic /* clang-format on */ size_t i, j; diff --git a/src/H5Z.c b/src/H5Z.c index d7ccbb4..23eb731 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -166,7 +166,7 @@ H5Z_term_package(void) * units of `B/s', `kB/s', `MB/s', `GB/s', or `TB/s' or * the word `Inf' if the elapsed time is zero. */ - H5_bandwidth(bandwidth, (double)(H5Z_stat_table_g[i].stats[dir].total), + H5_bandwidth(bandwidth, sizeof(bandwidth), (double)(H5Z_stat_table_g[i].stats[dir].total), H5Z_stat_table_g[i].stats[dir].times.elapsed); /* Print the statistics */ diff --git a/src/H5Zdevelop.h b/src/H5Zdevelop.h index 328e221..0f5e3e9 100644 --- a/src/H5Zdevelop.h +++ b/src/H5Zdevelop.h @@ -15,8 +15,8 @@ * support routines. */ -#ifndef _H5Zdevelop_H -#define _H5Zdevelop_H +#ifndef H5Zdevelop_H +#define H5Zdevelop_H /* Include package's public header */ #include "H5Zpublic.h" @@ -418,4 +418,4 @@ typedef struct H5Z_class1_t { #endif /* H5_NO_DEPRECATED_SYMBOLS */ -#endif /* _H5Zdevelop_H */ +#endif /* H5Zdevelop_H */ diff --git a/src/H5make_libsettings.c b/src/H5make_libsettings.c index 06f7ae3..6d9c3c9 100644 --- a/src/H5make_libsettings.c +++ b/src/H5make_libsettings.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/*keep this declaration near the top of this file -RPM*/ +/* Keep this declaration near the top of this file */ static const char *FileHeader = "\n\ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n\ * Copyright by The HDF Group. *\n\ @@ -66,19 +66,26 @@ insert_libhdf5_settings(FILE *flibinfo) HDexit(EXIT_FAILURE); } - /* print variable definition and the string */ - /* Do not use const else AIX strings does not show it. */ - fprintf(flibinfo, "char H5libhdf5_settings[]=\n"); + /* Turn off warnings for large arrays. If the library info string is + * a problem, people can build without the embedded library info. + */ + HDfprintf(flibinfo, "#include \"H5private.h\"\n"); + HDfprintf(flibinfo, "H5_GCC_DIAG_OFF(\"larger-than=\")\n\n"); + + /* Print variable definition and the string. Do not use const or some + * platforms (AIX?) will have issues. + */ + HDfprintf(flibinfo, "char H5libhdf5_settings[]=\n"); bol++; while (EOF != (inchar = HDgetc(fsettings))) { if (bol) { /* Start a new line */ - fprintf(flibinfo, "\t\""); + HDfprintf(flibinfo, "\t\""); bol = 0; } if (inchar == '\n') { /* end of a line */ - fprintf(flibinfo, "\\n\"\n"); + HDfprintf(flibinfo, "\\n\"\n"); bol++; } else @@ -89,21 +96,25 @@ insert_libhdf5_settings(FILE *flibinfo) /* wrap up */ if (!bol) /* EOF found without a new line */ - fprintf(flibinfo, "\\n\"\n"); - fprintf(flibinfo, ";\n\n"); + HDfprintf(flibinfo, "\\n\"\n"); + HDfprintf(flibinfo, ";\n\n"); } else { - fprintf(stderr, "Read errors encountered with %s\n", LIBSETTINGSFNAME); + HDfprintf(stderr, "Read errors encountered with %s\n", LIBSETTINGSFNAME); HDexit(EXIT_FAILURE); } if (0 != HDfclose(fsettings)) { HDperror(LIBSETTINGSFNAME); HDexit(EXIT_FAILURE); } + + /* Re-enable warnings for large arrays */ + HDfprintf(rawoutstream, "H5_GCC_DIAG_ON(\"larger-than=\")\n"); #else - /* print variable definition and an empty string */ - /* Do not use const else AIX strings does not show it. */ - fprintf(flibinfo, "char H5libhdf5_settings[]=\"\";\n"); + /* Print variable definition and an empty string. Do not use const or some + * platforms (AIX?) will have issues. + */ + HDfprintf(flibinfo, "char H5libhdf5_settings[]=\"\";\n"); #endif } /* insert_libhdf5_settings() */ @@ -120,7 +131,7 @@ insert_libhdf5_settings(FILE *flibinfo) static void make_libinfo(void) { - /* print variable definition and then the string as a macro. */ + /* Print variable definition and then the string as a macro */ insert_libhdf5_settings(rawoutstream); } @@ -191,42 +202,42 @@ information about the library build configuration\n"; /* * The file header: warning, copyright notice, build information. */ - fprintf(rawoutstream, "/* Generated automatically by H5make_libsettings -- do not edit */\n\n\n"); + HDfprintf(rawoutstream, "/* Generated automatically by H5make_libsettings -- do not edit */\n\n\n"); HDfputs(FileHeader, rawoutstream); /*the copyright notice--see top of this file */ - fprintf(rawoutstream, " *\n * Created:\t\t%s %2d, %4d\n", month_name[tm->tm_mon], tm->tm_mday, - 1900 + tm->tm_year); + HDfprintf(rawoutstream, " *\n * Created:\t\t%s %2d, %4d\n", month_name[tm->tm_mon], tm->tm_mday, + 1900 + tm->tm_year); if (pwd || real_name[0] || host_name[0]) { - fprintf(rawoutstream, " *\t\t\t"); + HDfprintf(rawoutstream, " *\t\t\t"); if (real_name[0]) - fprintf(rawoutstream, "%s <", real_name); + HDfprintf(rawoutstream, "%s <", real_name); #ifdef H5_HAVE_GETPWUID if (pwd) HDfputs(pwd->pw_name, rawoutstream); #endif if (host_name[0]) - fprintf(rawoutstream, "@%s", host_name); + HDfprintf(rawoutstream, "@%s", host_name); if (real_name[0]) - fprintf(rawoutstream, ">"); + HDfprintf(rawoutstream, ">"); HDfputc('\n', rawoutstream); } - fprintf(rawoutstream, " *\n * Purpose:\t\t"); + HDfprintf(rawoutstream, " *\n * Purpose:\t\t"); for (s = purpose; *s; s++) { HDfputc(*s, rawoutstream); if ('\n' == *s && s[1]) - fprintf(rawoutstream, " *\t\t\t"); + HDfprintf(rawoutstream, " *\t\t\t"); } - fprintf(rawoutstream, " *\n * Modifications:\n *\n"); - fprintf(rawoutstream, " *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n"); - fprintf(rawoutstream, " *\tIt was generated by code in `H5make_libsettings.c'.\n"); + HDfprintf(rawoutstream, " *\n * Modifications:\n *\n"); + HDfprintf(rawoutstream, " *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n"); + HDfprintf(rawoutstream, " *\tIt was generated by code in `H5make_libsettings.c'.\n"); - fprintf(rawoutstream, " *\n *"); + HDfprintf(rawoutstream, " *\n *"); for (i = 0; i < 73; i++) HDfputc('-', rawoutstream); - fprintf(rawoutstream, "\n */\n\n"); + HDfprintf(rawoutstream, "\n */\n\n"); } /*------------------------------------------------------------------------- @@ -280,7 +291,7 @@ main(int argc, char *argv[]) if (rawoutstream && rawoutstream != stdout) { if (HDfclose(rawoutstream)) - fprintf(stderr, "closing rawoutstream"); + HDfprintf(stderr, "closing rawoutstream"); else rawoutstream = NULL; } diff --git a/src/H5private.h b/src/H5private.h index 58086db..d93483a 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -550,7 +550,7 @@ typedef struct { } H5_timer_t; /* Returns library bandwidth as a pretty string */ -H5_DLL void H5_bandwidth(char *buf /*out*/, double nbytes, double nseconds); +H5_DLL void H5_bandwidth(char *buf /*out*/, size_t bufsize, double nbytes, double nseconds); /* Timer functionality */ H5_DLL time_t H5_now(void); diff --git a/src/H5public.h b/src/H5public.h index 0be303b..26239d0 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -37,9 +37,10 @@ /* C library header files for things that appear in HDF5 public headers */ #ifdef __cplusplus -#define __STDC_FORMAT_MACROS -#endif +#include +#else #include +#endif #include #include #include diff --git a/src/H5timer.c b/src/H5timer.c index b5dba97..83fd243 100644 --- a/src/H5timer.c +++ b/src/H5timer.c @@ -96,7 +96,7 @@ *------------------------------------------------------------------------- */ void -H5_bandwidth(char *buf /*out*/, double nbytes, double nseconds) +H5_bandwidth(char *buf /*out*/, size_t bufsize, double nbytes, double nseconds) { double bw; @@ -107,35 +107,35 @@ H5_bandwidth(char *buf /*out*/, double nbytes, double nseconds) if (H5_DBL_ABS_EQUAL(bw, 0.0)) HDstrcpy(buf, "0.000 B/s"); else if (bw < 1.0) - HDsprintf(buf, "%10.4e", bw); + HDsnprintf(buf, bufsize, "%10.4e", bw); else if (bw < (double)H5_KB) { - HDsprintf(buf, "%05.4f", bw); + HDsnprintf(buf, bufsize, "%05.4f", bw); HDstrcpy(buf + 5, " B/s"); } else if (bw < (double)H5_MB) { - HDsprintf(buf, "%05.4f", bw / (double)H5_KB); + HDsnprintf(buf, bufsize, "%05.4f", bw / (double)H5_KB); HDstrcpy(buf + 5, " kB/s"); } else if (bw < (double)H5_GB) { - HDsprintf(buf, "%05.4f", bw / (double)H5_MB); + HDsnprintf(buf, bufsize, "%05.4f", bw / (double)H5_MB); HDstrcpy(buf + 5, " MB/s"); } else if (bw < (double)H5_TB) { - HDsprintf(buf, "%05.4f", bw / (double)H5_GB); + HDsnprintf(buf, bufsize, "%05.4f", bw / (double)H5_GB); HDstrcpy(buf + 5, " GB/s"); } else if (bw < (double)H5_PB) { - HDsprintf(buf, "%05.4f", bw / (double)H5_TB); + HDsnprintf(buf, bufsize, "%05.4f", bw / (double)H5_TB); HDstrcpy(buf + 5, " TB/s"); } else if (bw < (double)H5_EB) { - HDsprintf(buf, "%05.4f", bw / (double)H5_PB); + HDsnprintf(buf, bufsize, "%05.4f", bw / (double)H5_PB); HDstrcpy(buf + 5, " PB/s"); } else { - HDsprintf(buf, "%10.4e", bw); + HDsnprintf(buf, bufsize, "%10.4e", bw); if (HDstrlen(buf) > 10) - HDsprintf(buf, "%10.3e", bw); + HDsnprintf(buf, bufsize, "%10.3e", bw); } /* end else-if */ } /* end else */ } /* end H5_bandwidth() */ @@ -627,30 +627,31 @@ H5_timer_get_time_string(double seconds) * (name? round_up_size? ?) */ if (seconds < 0.0) - HDsprintf(s, "N/A"); + HDsnprintf(s, H5TIMER_TIME_STRING_LEN, "N/A"); else if (H5_DBL_ABS_EQUAL(0.0, seconds)) - HDsprintf(s, "0.0 s"); + HDsnprintf(s, H5TIMER_TIME_STRING_LEN, "0.0 s"); else if (seconds < 1.0E-6) /* t < 1 us, Print time in ns */ - HDsprintf(s, "%.f ns", seconds * 1.0E9); + HDsnprintf(s, H5TIMER_TIME_STRING_LEN, "%.f ns", seconds * 1.0E9); else if (seconds < 1.0E-3) /* t < 1 ms, Print time in us */ - HDsprintf(s, "%.1f us", seconds * 1.0E6); + HDsnprintf(s, H5TIMER_TIME_STRING_LEN, "%.1f us", seconds * 1.0E6); else if (seconds < 1.0) /* t < 1 s, Print time in ms */ - HDsprintf(s, "%.1f ms", seconds * 1.0E3); + HDsnprintf(s, H5TIMER_TIME_STRING_LEN, "%.1f ms", seconds * 1.0E3); else if (seconds < H5_SEC_PER_MIN) /* t < 1 m, Print time in s */ - HDsprintf(s, "%.2f s", seconds); + HDsnprintf(s, H5TIMER_TIME_STRING_LEN, "%.2f s", seconds); else if (seconds < H5_SEC_PER_HOUR) /* t < 1 h, Print time in m and s */ - HDsprintf(s, "%.f m %.f s", minutes, remainder_sec); + HDsnprintf(s, H5TIMER_TIME_STRING_LEN, "%.f m %.f s", minutes, remainder_sec); else if (seconds < H5_SEC_PER_DAY) /* t < 1 d, Print time in h, m and s */ - HDsprintf(s, "%.f h %.f m %.f s", hours, minutes, remainder_sec); + HDsnprintf(s, H5TIMER_TIME_STRING_LEN, "%.f h %.f m %.f s", hours, minutes, remainder_sec); else /* Print time in d, h, m and s */ - HDsprintf(s, "%.f d %.f h %.f m %.f s", days, hours, minutes, remainder_sec); + HDsnprintf(s, H5TIMER_TIME_STRING_LEN, "%.f d %.f h %.f m %.f s", days, hours, minutes, + remainder_sec); return s; } /* end H5_timer_get_time_string() */ diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 44cf50c..d3ad098 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -26,6 +26,9 @@ */ #ifdef H5_HAVE_WIN32_API +/* __int64 is the correct type for the st_size field of the _stati64 struct. + * MSDN isn't very clear about this. + */ typedef struct _stati64 h5_stat_t; typedef __int64 h5_stat_size_t; @@ -57,7 +60,12 @@ struct timezone { #define HDlstat(S, B) _lstati64(S, B) #define HDmemset(X, C, Z) memset((void *)(X), C, Z) /* Cast avoids MSVC warning */ #define HDmkdir(S, M) _mkdir(S) -#define HDoff_t __int64 + +/* off_t exists on Windows, but is always a 32-bit long, even on 64-bit Windows, + * so we define HDoff_t to be __int64, which is the type of the st_size field + * of the _stati64 struct. + */ +#define HDoff_t __int64 /* Note that the variadic HDopen macro is using a VC++ extension * where the comma is dropped if nothing is passed to the ellipsis. diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 393040f..e64f32a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -34,6 +34,9 @@ if (NOT ONLY_SHARED_LIBS) INTERFACE "$/include>" ) target_compile_options(${HDF5_TEST_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") + target_compile_definitions(${HDF5_TEST_LIB_TARGET} + PRIVATE "H5_TEST_EXPRESS_LEVEL_DEFAULT=${H5_TEST_EXPRESS_LEVEL_DEFAULT}" + ) TARGET_C_PROPERTIES (${HDF5_TEST_LIB_TARGET} STATIC) target_link_libraries (${HDF5_TEST_LIB_TARGET} PUBLIC ${LINK_LIBS} ${HDF5_LIB_TARGET} @@ -53,7 +56,10 @@ if (BUILD_SHARED_LIBS) INTERFACE "$/include>" ) target_compile_options(${HDF5_TEST_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") - target_compile_definitions(${HDF5_TEST_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB") + target_compile_definitions(${HDF5_TEST_LIBSH_TARGET} + PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" + PRIVATE "H5_TEST_EXPRESS_LEVEL_DEFAULT=${H5_TEST_EXPRESS_LEVEL_DEFAULT}" + ) TARGET_C_PROPERTIES (${HDF5_TEST_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} PUBLIC ${LINK_LIBS} ${HDF5_LIBSH_TARGET} diff --git a/test/CMakePassthroughVOLTests.cmake b/test/CMakePassthroughVOLTests.cmake index e9f1381..94433de 100644 --- a/test/CMakePassthroughVOLTests.cmake +++ b/test/CMakePassthroughVOLTests.cmake @@ -142,7 +142,7 @@ add_custom_target(HDF5_VOLTEST_LIB_files ALL COMMENT "Copying files needed by HD -P "${HDF_RESOURCES_DIR}/volTest.cmake" ) set_tests_properties (VOL-${volname}-${voltest} PROPERTIES - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname};HDF5TestExpress=${HDF_TEST_EXPRESS}" + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname} ) endif () @@ -199,7 +199,7 @@ add_custom_target(HDF5_VOLTEST_LIB_files ALL COMMENT "Copying files needed by HD ) set_tests_properties (VOL-${volname}-fheap PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT} - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname};HDF5TestExpress=${HDF_TEST_EXPRESS}" + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname} ) endif () diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index a534e60..72f7a8d 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -484,7 +484,7 @@ if (NOT CYGWIN) endif () set_tests_properties (H5TEST-cache PROPERTIES FIXTURES_REQUIRED clear_cache - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) set_tests_properties (H5TEST-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) @@ -501,7 +501,7 @@ if (TEST_CACHE_IMAGE) add_test (NAME H5TEST_cache_image COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (H5TEST-cache_image PROPERTIES FIXTURES_REQUIRED clear_cache_image - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) endif () @@ -541,7 +541,7 @@ else () endif () set_tests_properties (H5TEST-external_env PROPERTIES FIXTURES_REQUIRED clear_external_env - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -575,7 +575,7 @@ else () endif () set_tests_properties (H5TEST-vds_env PROPERTIES FIXTURES_REQUIRED clear_vds_env - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -610,7 +610,7 @@ else () endif () set_tests_properties (H5TEST-flush1 PROPERTIES FIXTURES_REQUIRED clear_flush - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) if (HDF5_ENABLE_USING_MEMCHECKER) diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index e08e4d2..b371753 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -131,7 +131,7 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}" + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) endif () @@ -186,7 +186,7 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD ) set_tests_properties (VFD-${vfdname}-fheap PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT} - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}" + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) endif () diff --git a/test/cache_api.c b/test/cache_api.c index ec0a903..1decef9 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -835,7 +835,7 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id) * with the cache API calls. * * NOTE: This test takes some time to run and checks the - * HDF5TestExpress environment variable. + * testing express level value. * * Return: Test pass status (TRUE/FALSE) * diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 4d07116..f1571f0 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -839,7 +839,7 @@ check_multi_group_creation_tags(void) for (i = 0; i < MULTIGROUPS; i++) { - HDsprintf(gname, "%d", i); + HDsnprintf(gname, sizeof(gname), "%d", i); if ((gid = H5Gcreate2(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; if (H5Gclose(gid) < 0) @@ -861,7 +861,7 @@ check_multi_group_creation_tags(void) for (i = 0; i < MULTIGROUPS; i++) { /* Re-open the group */ - HDsprintf(gname, "%d", i); + HDsnprintf(gname, sizeof(gname), "%d", i); if ((gid = H5Gopen2(fid, gname, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -988,7 +988,7 @@ check_link_iteration_tags(void) /* Create many datasets in root group */ for (i = 0; i < 500; i++) { - HDsprintf(dsetname, "Dset %d", i); + HDsnprintf(dsetname, sizeof(dsetname), "Dset %d", i); if ((did = H5Dcreate2(fid, dsetname, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -1151,7 +1151,7 @@ check_dense_attribute_tags(void) for (i = 0; i < 50; i++) { - HDsprintf(attrname, "attr %d", i); + HDsnprintf(attrname, sizeof(attrname), "attr %d", i); if ((aid = H5Acreate2(did, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; if (H5Awrite(aid, H5T_NATIVE_UINT, &i) < 0) diff --git a/test/chunk_info.c b/test/chunk_info.c index b19f3df..f041c46 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -179,11 +179,18 @@ verify_get_chunk_info(hid_t dset, hid_t dspace, hsize_t chk_index, hsize_t exp_c if (H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR; - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); - VERIFY(size, exp_chk_size, "H5Dget_chunk_info, chunk size"); - VERIFY(read_flt_msk, exp_flt_msk, "H5Dget_chunk_info, filter mask"); - VERIFY(out_offset[0], exp_offset[0], "H5Dget_chunk_info, offset[0]"); - VERIFY(out_offset[1], exp_offset[1], "H5Dget_chunk_info, offset[1]"); + + if (HADDR_UNDEF == addr) + FAIL_PUTS_ERROR("address cannot be HADDR_UNDEF"); + if (size != exp_chk_size) + FAIL_PUTS_ERROR("unexpected chunk size"); + if (read_flt_msk != exp_flt_msk) + FAIL_PUTS_ERROR("unexpected filter mask"); + if (out_offset[0] != exp_offset[0]) + FAIL_PUTS_ERROR("unexpected offset[0]"); + if (out_offset[1] != exp_offset[1]) + FAIL_PUTS_ERROR("unexpected offset[1]"); + return SUCCEED; error: @@ -213,9 +220,14 @@ verify_get_chunk_info_by_coord(hid_t dset, hsize_t *offset, hsize_t exp_chk_size /* Get info of the chunk at logical coordinates specified by offset */ if (H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR; - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); - VERIFY(size, exp_chk_size, "H5Dget_chunk_info_by_coord, chunk size"); - VERIFY(read_flt_msk, exp_flt_msk, "H5Dget_chunk_info_by_coord, filter mask"); + + if (HADDR_UNDEF == addr) + FAIL_PUTS_ERROR("address cannot be HADDR_UNDEF"); + if (size != exp_chk_size) + FAIL_PUTS_ERROR("unexpected chunk size"); + if (read_flt_msk != exp_flt_msk) + FAIL_PUTS_ERROR("unexpected filter mask"); + return SUCCEED; error: @@ -245,8 +257,12 @@ verify_empty_chunk_info(hid_t dset, hsize_t *offset) /* Get info of the chunk at logical coordinates specified by offset */ if (H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR; - VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address"); - VERIFY(size, EMPTY_CHK_SIZE, "H5Dget_chunk_info_by_coord, chunk size"); + + if (HADDR_UNDEF != addr) + FAIL_PUTS_ERROR("address was not HADDR_UNDEF"); + if (EMPTY_CHK_SIZE != size) + FAIL_PUTS_ERROR("size was not EMPTY_CHK_SIZE"); + return SUCCEED; error: @@ -428,12 +444,14 @@ verify_idx_nchunks(hid_t dset, hid_t dspace, H5D_chunk_index_t exp_idx_type, hsi /* Get and verify the number of chunks */ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR; - VERIFY(nchunks, exp_num_chunks, "H5Dget_num_chunks, number of chunks"); + if (nchunks != exp_num_chunks) + FAIL_PUTS_ERROR("unexpected number of chunks"); /* Get and verify the number of chunks again, passing in H5S_ALL */ if (H5Dget_num_chunks(dset, H5S_ALL, &nchunks) < 0) TEST_ERROR; - VERIFY(nchunks, exp_num_chunks, "H5Dget_num_chunks, number of chunks"); + if (nchunks != exp_num_chunks) + FAIL_PUTS_ERROR("unexpected number of chunks"); return SUCCEED; @@ -603,7 +621,8 @@ test_get_chunk_info_highest_v18(hid_t fapl) /* Get and verify the number of chunks written */ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR; - VERIFY(nchunks, NUM_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks"); + if (NUM_CHUNKS_WRITTEN != nchunks) + FAIL_PUTS_ERROR("unexpected number of chunks"); /* Get and verify info of the last written chunk again, passing in H5S_ALL this time */ @@ -666,7 +685,8 @@ test_get_chunk_info_highest_v18(hid_t fapl) /* Verify that the number of chunks is 0 */ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR; - VERIFY(nchunks, NO_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks"); + if (NO_CHUNK_WRITTEN != nchunks) + FAIL_PUTS_ERROR("unexpected number of chunks"); /* Attempt to get info of a chunk from an empty dataset, should fail */ chk_index = OUTOFRANGE_CHK_INDEX; @@ -1128,7 +1148,8 @@ test_chunk_info_fixed_array(const char *filename, hid_t fapl) /* Get and verify the number of chunks written */ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR; - VERIFY(nchunks, NUM_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks"); + if (NUM_CHUNKS_WRITTEN != nchunks) + FAIL_PUTS_ERROR("unexpected number of chunks"); /* Get and verify info of each written chunk */ chk_index = 0; @@ -1271,7 +1292,8 @@ test_chunk_info_extensible_array(const char *filename, hid_t fapl) /* Get and verify the number of chunks written */ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR; - VERIFY(nchunks, NUM_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks"); + if (NUM_CHUNKS_WRITTEN != nchunks) + FAIL_PUTS_ERROR("unexpected number of chunks"); /* Get and verify info of each written chunk */ chk_index = 0; @@ -1419,7 +1441,8 @@ test_chunk_info_version2_btrees(const char *filename, hid_t fapl) /* Get and verify the number of chunks written */ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR; - VERIFY(nchunks, NUM_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks"); + if (NUM_CHUNKS_WRITTEN != nchunks) + FAIL_PUTS_ERROR("unexpected number of chunks"); /* Go through all written chunks, get their info and verify the values */ chk_index = 0; @@ -1602,7 +1625,8 @@ test_basic_query(hid_t fapl) /* Get the number of chunks and verify that no chunk has been written */ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR; - VERIFY(nchunks, NO_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks"); + if (NO_CHUNK_WRITTEN != nchunks) + FAIL_PUTS_ERROR("unexpected number of chunks"); /* Initialize the array of chunk data for the single chunk */ for (ii = 0; ii < CHUNK_NX; ii++) @@ -1618,7 +1642,8 @@ test_basic_query(hid_t fapl) /* Get and verify that one chunk had been written */ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR; - VERIFY(nchunks, ONE_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks"); + if (ONE_CHUNK_WRITTEN != nchunks) + FAIL_PUTS_ERROR("unexpected number of chunks"); /* Get and verify info of the first and only chunk */ if (verify_get_chunk_info(dset, H5S_ALL, 0, CHK_SIZE, offset, flt_msk) == FAIL) @@ -1649,7 +1674,8 @@ test_basic_query(hid_t fapl) /* Get and verify that two chunks had been written */ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR; - VERIFY(nchunks, TWO_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks"); + if (TWO_CHUNKS_WRITTEN != nchunks) + FAIL_PUTS_ERROR("unexpected number of chunks"); /* Get and verify info of the first written chunk in the dataset, its offset should be (0,0) */ @@ -1685,20 +1711,28 @@ test_basic_query(hid_t fapl) if (H5Dchunk_iter(dset, H5P_DEFAULT, &iter_cb, &udata) < 0) TEST_ERROR; - VERIFY(udata.last_index, 1, "Iterator did not iterate all chunks"); - VERIFY(chunk_infos[0].offset[0], 0, "Offset mismatch"); - VERIFY(chunk_infos[0].offset[1], 0, "Offset mismatch"); - VERIFY(chunk_infos[0].filter_mask, 0, "Filter mismatch"); - VERIFY(chunk_infos[0].nbytes, 96, "Size mismatch"); + if (udata.last_index != 1) + FAIL_PUTS_ERROR("Iterator did not iterate over all chunks"); + if (chunk_infos[0].offset[0] != 0) + FAIL_PUTS_ERROR("offset[0] mismatch"); + if (chunk_infos[0].offset[1] != 0) + FAIL_PUTS_ERROR("offset[1] mismatch"); + if (chunk_infos[0].filter_mask != 0) + FAIL_PUTS_ERROR("filter mask mismatch"); + if (chunk_infos[0].nbytes != 96) + FAIL_PUTS_ERROR("size mismatch"); - VERIFY(chunk_infos[1].offset[0], 1, "Offset mismatch"); - VERIFY(chunk_infos[1].offset[1], 1, "Offset mismatch"); + if (chunk_infos[1].offset[0] != 1) + FAIL_PUTS_ERROR("offset[0] mismatch"); + if (chunk_infos[1].offset[1] != 1) + FAIL_PUTS_ERROR("offset[1] mismatch"); /* Iterate and stop after one iteration */ cptr = &(chunk_infos[0]); if (H5Dchunk_iter(dset, H5P_DEFAULT, &iter_cb_stop, &cptr) < 0) TEST_ERROR; - VERIFY(cptr, &(chunk_infos[1]), "Verification of halted iterator failed\n"); + if (cptr != &(chunk_infos[1])) + FAIL_PUTS_ERROR("Verification of halted iterator failed"); /* Iterate and fail after one iteration */ cptr = &(chunk_infos[0]); @@ -1709,7 +1743,8 @@ test_basic_query(hid_t fapl) H5E_END_TRY; if (ret >= 0) TEST_ERROR; - VERIFY(cptr, &(chunk_infos[1]), "Verification of halted iterator failed\n"); + if (cptr != &(chunk_infos[1])) + FAIL_PUTS_ERROR("Verification of halted iterator failed"); /* Release resourse */ if (H5Dclose(dset) < 0) @@ -2102,7 +2137,8 @@ test_flt_msk_with_skip_compress(hid_t fapl) /* Get and verify the number of chunks written */ if (H5Dget_num_chunks(dset, H5S_ALL, &nchunks) < 0) TEST_ERROR; - VERIFY(nchunks, ONE_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks"); + if (ONE_CHUNK_WRITTEN != nchunks) + FAIL_PUTS_ERROR("unexpected number of chunks"); /* Get and verify info of the first and only chunk */ chk_index = 0; diff --git a/test/cork.c b/test/cork.c index 7628d28..53d9065 100644 --- a/test/cork.c +++ b/test/cork.c @@ -396,7 +396,7 @@ verify_obj_dset_cork(hbool_t swmr) /* Attach 8 attributes to the dataset */ for (i = 0; i < 8; i++) { - HDsprintf(attrname, "attr %d", i); + HDsnprintf(attrname, sizeof(attrname), "attr %d", i); if ((aid = H5Acreate2(did2, attrname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; if (H5Awrite(aid, H5T_NATIVE_INT, &i) < 0) @@ -864,7 +864,7 @@ verify_group_cork(hbool_t swmr) /* Attach 8 attributes to the third group: GRP3 */ for (i = 0; i < 8; i++) { - HDsprintf(attrname, "attr %d", i); + HDsnprintf(attrname, sizeof(attrname), "attr %d", i); if ((aid = H5Acreate2(gid3, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; if (H5Awrite(aid, H5T_NATIVE_UINT, &i) < 0) @@ -1081,7 +1081,7 @@ verify_named_cork(hbool_t swmr) /* Attach 8 attributes to datatype: DT3 */ for (i = 0; i < 8; i++) { - HDsprintf(attrname, "attr %d", i); + HDsnprintf(attrname, sizeof(attrname), "attr %d", i); if ((aid = H5Acreate2(tid3, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; if (H5Awrite(aid, H5T_NATIVE_UINT, &i) < 0) diff --git a/test/dt_arith.c b/test/dt_arith.c index 3601b95..ae48045 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -2462,11 +2462,11 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) break; case INT_LLONG: HDmemcpy(aligned, saved + j * sizeof(long long), sizeof(long long)); - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "d\n", *((long long *)aligned)); + HDfprintf(stdout, " %29lld\n", *((long long *)aligned)); break; case INT_ULLONG: HDmemcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long)); - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "u\n", *((unsigned long long *)aligned)); + HDfprintf(stdout, " %29llu\n", *((unsigned long long *)aligned)); break; case FLT_FLOAT: case FLT_DOUBLE: @@ -2516,11 +2516,11 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) break; case INT_LLONG: HDmemcpy(aligned, buf + j * sizeof(long long), sizeof(long long)); - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "d\n", *((long long *)aligned)); + HDfprintf(stdout, " %29lld\n", *((long long *)aligned)); break; case INT_ULLONG: HDmemcpy(aligned, buf + j * sizeof(long long), sizeof(unsigned long long)); - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "u\n", *((unsigned long long *)aligned)); + HDfprintf(stdout, " %29llu\n", *((unsigned long long *)aligned)); break; case FLT_FLOAT: case FLT_DOUBLE: @@ -2561,10 +2561,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) HDprintf(" %29lu\n", *((unsigned long *)((void *)hw))); break; case INT_LLONG: - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "d\n", *((long long *)((void *)hw))); + HDfprintf(stdout, " %29lld\n", *((long long *)((void *)hw))); break; case INT_ULLONG: - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "u\n", *((unsigned long long *)((void *)hw))); + HDfprintf(stdout, " %29llu\n", *((unsigned long long *)((void *)hw))); break; case FLT_FLOAT: case FLT_DOUBLE: @@ -4398,11 +4398,11 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) break; case INT_LLONG: HDmemcpy(aligned, saved + j * sizeof(long long), sizeof(long long)); - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "d\n", *((long long *)aligned)); + HDfprintf(stdout, " %29lld\n", *((long long *)aligned)); break; case INT_ULLONG: HDmemcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long)); - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "u\n", *((unsigned long long *)aligned)); + HDfprintf(stdout, " %29llu\n", *((unsigned long long *)aligned)); break; case FLT_FLOAT: HDmemcpy(aligned, saved + j * sizeof(float), sizeof(float)); @@ -4461,11 +4461,11 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) break; case INT_LLONG: HDmemcpy(aligned, buf + j * sizeof(long long), sizeof(long long)); - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "d\n", *((long long *)aligned)); + HDfprintf(stdout, " %29lld\n", *((long long *)aligned)); break; case INT_ULLONG: HDmemcpy(aligned, buf + j * sizeof(unsigned long long), sizeof(unsigned long long)); - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "u\n", *((unsigned long long *)aligned)); + HDfprintf(stdout, " %29llu\n", *((unsigned long long *)aligned)); break; case FLT_FLOAT: HDmemcpy(aligned, buf + j * sizeof(float), sizeof(float)); @@ -4515,10 +4515,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) HDprintf(" %29lu\n", *((unsigned long *)((void *)hw))); break; case INT_LLONG: - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "d\n", *((long long *)((void *)hw))); + HDfprintf(stdout, " %29lld\n", *((long long *)((void *)hw))); break; case INT_ULLONG: - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "u\n", *((unsigned long long *)((void *)hw))); + HDfprintf(stdout, " %29llu\n", *((unsigned long long *)((void *)hw))); break; case FLT_FLOAT: HDprintf(" %29f\n", (double)*((float *)((void *)hw))); diff --git a/test/dtypes.c b/test/dtypes.c index 218c019..f322d03 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -2322,7 +2322,7 @@ test_compound_11(void) ((big_t *)buf)[u].s1 = (char *)HDmalloc((size_t)32); if (!((big_t *)buf)[u].s1) TEST_ERROR; - HDsprintf(((big_t *)buf)[u].s1, "%u", (unsigned)u); + HDsnprintf(((big_t *)buf)[u].s1, 32, "%u", (unsigned)u); } /* end for */ /* Make copy of buffer before conversion */ diff --git a/test/fheap.c b/test/fheap.c index 01de37f..7fec567 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -7669,7 +7669,7 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ if (H5HF_remove(fh, heap_id[j]) < 0) FAIL_STACK_ERROR; - HDsprintf(obj2.b, "%s%2d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", j); + HDsnprintf(obj2.b, sizeof(obj2.b), "%s%2d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", j); if (H5HF_insert(fh, (sizeof(obj2)), &obj2, heap_id[j]) < 0) FAIL_STACK_ERROR; } /* end for */ @@ -7680,7 +7680,7 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ /* Insert object */ HDmemset(heap_id[i], 0, id_len); - HDsprintf(obj1.b, "%s%2d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", i); + HDsnprintf(obj1.b, sizeof(obj1.b), "%s%2d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", i); if (H5HF_insert(fh, (sizeof(obj1)), &obj1, heap_id[i]) < 0) FAIL_STACK_ERROR; } /* end for */ diff --git a/test/filter_plugin.c b/test/filter_plugin.c index abbcc26..4dcf74a 100644 --- a/test/filter_plugin.c +++ b/test/filter_plugin.c @@ -847,7 +847,7 @@ test_creating_groups_using_plugins(hid_t fid) for (i = 0; i < N_SUBGROUPS; i++) { char *sp = subgroup_name; - sp += HDsprintf(subgroup_name, SUBGROUP_PREFIX); + sp += HDsnprintf(subgroup_name, sizeof(subgroup_name), SUBGROUP_PREFIX); HDsprintf(sp, "%d", i); if ((sub_gid = H5Gcreate2(gid, subgroup_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -906,7 +906,7 @@ test_opening_groups_using_plugins(hid_t fid) for (i = 0; i < N_SUBGROUPS; i++) { char *sp = subgroup_name; - sp += HDsprintf(subgroup_name, SUBGROUP_PREFIX); + sp += HDsnprintf(subgroup_name, sizeof(subgroup_name), SUBGROUP_PREFIX); HDsprintf(sp, "%d", i); if ((sub_gid = H5Gopen2(gid, subgroup_name, H5P_DEFAULT)) < 0) @@ -1015,7 +1015,7 @@ test_path_api_calls(void) /* Add a bunch of paths to the path table */ for (u = 0; u < n_starting_paths; u++) { - HDsprintf(path, "a_path_%u", u); + HDsnprintf(path, sizeof(path), "a_path_%u", u); if (H5PLappend(path) < 0) { HDfprintf(stderr, " at %u: %s\n", u, path); TEST_ERROR; @@ -1081,7 +1081,7 @@ test_path_api_calls(void) /* Get path at the last index */ if ((path_len = H5PLget(n_starting_paths - 1, path, 256)) <= 0) TEST_ERROR; - HDsprintf(temp_name, "a_path_%u", n_starting_paths - 1); + HDsnprintf(temp_name, sizeof(temp_name), "a_path_%u", n_starting_paths - 1); if (HDstrcmp(path, temp_name) != 0) { HDfprintf(stderr, " get %u: %s\n", n_starting_paths - 1, path); TEST_ERROR; @@ -1135,7 +1135,7 @@ test_path_api_calls(void) TESTING(" prepend"); /* Prepend one path */ - HDsprintf(path, "a_path_%d", n_starting_paths + 1); + HDsnprintf(path, sizeof(path), "a_path_%d", n_starting_paths + 1); if (H5PLprepend(path) < 0) { HDfprintf(stderr, " prepend %u: %s\n", n_starting_paths + 1, path); TEST_ERROR; @@ -1158,7 +1158,7 @@ test_path_api_calls(void) /* Verify that the path was inserted at index zero */ if (H5PLget(0, path, 256) <= 0) TEST_ERROR; - HDsprintf(temp_name, "a_path_%d", n_starting_paths + 1); + HDsnprintf(temp_name, sizeof(temp_name), "a_path_%d", n_starting_paths + 1); if (HDstrcmp(path, temp_name) != 0) { HDfprintf(stderr, " get 0: %s\n", path); TEST_ERROR; @@ -1173,7 +1173,7 @@ test_path_api_calls(void) TESTING(" replace"); /* Replace one path at index 1 */ - HDsprintf(path, "a_path_%u", n_starting_paths + 4); + HDsnprintf(path, sizeof(path), "a_path_%u", n_starting_paths + 4); if (H5PLreplace(path, 1) < 0) { HDfprintf(stderr, " replace 1: %s\n", path); TEST_ERROR; @@ -1192,7 +1192,7 @@ test_path_api_calls(void) /* Check path at index 0 */ if (H5PLget(0, path, 256) <= 0) TEST_ERROR; - HDsprintf(temp_name, "a_path_%u", n_starting_paths + 1); + HDsnprintf(temp_name, sizeof(temp_name), "a_path_%u", n_starting_paths + 1); if (HDstrcmp(path, temp_name) != 0) { HDfprintf(stderr, " get 0: %s\n", path); TEST_ERROR; @@ -1240,7 +1240,7 @@ test_path_api_calls(void) TESTING(" insert"); /* Insert one path at index 3*/ - HDsprintf(path, "a_path_%d", n_starting_paths + 5); + HDsnprintf(path, sizeof(path), "a_path_%d", n_starting_paths + 5); if (H5PLinsert(path, 3) < 0) { HDfprintf(stderr, " insert 3: %s\n", path); TEST_ERROR; diff --git a/test/h5test.c b/test/h5test.c index ac15043..f39825c 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -355,7 +355,7 @@ h5_reset(void) * Cause the library to emit some diagnostics early so they don't * interfere with other formatted output. */ - HDsprintf(filename, "/tmp/h5emit-%05d.h5", HDgetpid()); + HDsnprintf(filename, sizeof(filename), "/tmp/h5emit-%05d.h5", HDgetpid()); H5E_BEGIN_TRY { hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); diff --git a/test/hyperslab.c b/test/hyperslab.c index 36e6b65..b816aae 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -163,19 +163,19 @@ test_fill(size_t nx, size_t ny, size_t nz, size_t di, size_t dj, size_t dk, size if (0 == ny) { ndims = 1; ny = nz = 1; - HDsprintf(dim, "%lu", (unsigned long)nx); + HDsnprintf(dim, sizeof(dim), "%lu", (unsigned long)nx); } /* end if */ else { ndims = 2; nz = 1; - HDsprintf(dim, "%lux%lu", (unsigned long)nx, (unsigned long)ny); + HDsnprintf(dim, sizeof(dim), "%lux%lu", (unsigned long)nx, (unsigned long)ny); } /* end else */ } /* end if */ else { ndims = 3; - HDsprintf(dim, "%lux%lux%lu", (unsigned long)nx, (unsigned long)ny, (unsigned long)nz); + HDsnprintf(dim, sizeof(dim), "%lux%lux%lu", (unsigned long)nx, (unsigned long)ny, (unsigned long)nz); } /* end else */ - HDsprintf(s, "Testing hyperslab fill %-11s variable hyperslab", dim); + HDsnprintf(s, sizeof(s), "Testing hyperslab fill %-11s variable hyperslab", dim); HDprintf("%-70s", s); HDfflush(stdout); @@ -321,17 +321,17 @@ test_copy(int mode, size_t nx, size_t ny, size_t nz, size_t di, size_t dj, size_ if (0 == ny) { ndims = 1; ny = nz = 1; - HDsprintf(dim, "%lu", (unsigned long)nx); + HDsnprintf(dim, sizeof(dim), "%lu", (unsigned long)nx); } /* end if */ else { ndims = 2; nz = 1; - HDsprintf(dim, "%lux%lu", (unsigned long)nx, (unsigned long)ny); + HDsnprintf(dim, sizeof(dim), "%lux%lu", (unsigned long)nx, (unsigned long)ny); } /* end else */ } /* end if */ else { ndims = 3; - HDsprintf(dim, "%lux%lux%lu", (unsigned long)nx, (unsigned long)ny, (unsigned long)nz); + HDsnprintf(dim, sizeof(dim), "%lux%lux%lu", (unsigned long)nx, (unsigned long)ny, (unsigned long)nz); } /* end else */ switch (mode) { @@ -364,7 +364,7 @@ test_copy(int mode, size_t nx, size_t ny, size_t nz, size_t di, size_t dj, size_ HDabort(); } /* end switch */ - HDsprintf(s, "Testing hyperslab copy %-11s %s", dim, sub); + HDsnprintf(s, sizeof(s), "Testing hyperslab copy %-11s %s", dim, sub); HDprintf("%-70s", s); HDfflush(stdout); @@ -618,15 +618,15 @@ test_multifill(size_t nx) s[0] = '\0'; for (i = 0; i < nx; i++) { if (dst[i].left != 3333333) - HDsprintf(s, "bad dst[%lu].left", (unsigned long)i); + HDsnprintf(s, sizeof(s), "bad dst[%lu].left", (unsigned long)i); else if (!H5_DBL_ABS_EQUAL(dst[i].mid, fill.mid)) /* Check if two DOUBLE values are equal. If their difference * is smaller than the EPSILON value for double, they are * considered equal. See the definition in h5test.h. */ - HDsprintf(s, "bad dst[%lu].mid", (unsigned long)i); + HDsnprintf(s, sizeof(s), "bad dst[%lu].mid", (unsigned long)i); else if (dst[i].right != 4444444) - HDsprintf(s, "bad dst[%lu].right", (unsigned long)i); + HDsnprintf(s, sizeof(s), "bad dst[%lu].right", (unsigned long)i); if (s[0]) { H5_FAILED(); if (!HDisatty(1)) { @@ -771,7 +771,8 @@ test_transpose(size_t nx, size_t ny) char s[256]; hsize_t i, j; - HDsprintf(s, "Testing 2d transpose by stride %4lux%-lud", (unsigned long)nx, (unsigned long)ny); + HDsnprintf(s, sizeof(s), "Testing 2d transpose by stride %4lux%-lud", (unsigned long)nx, + (unsigned long)ny); HDprintf("%-70s", s); HDfflush(stdout); @@ -869,8 +870,8 @@ test_sub_super(size_t nx, size_t ny) hsize_t i, j; char s[256]; - HDsprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ", (unsigned long)(2 * nx), - (unsigned long)(2 * ny), (unsigned long)nx, (unsigned long)ny); + HDsnprintf(s, sizeof(s), "Testing image sampling %4lux%-4lu to %4lux%-4lu ", (unsigned long)(2 * nx), + (unsigned long)(2 * ny), (unsigned long)nx, (unsigned long)ny); HDprintf("%-70s", s); HDfflush(stdout); @@ -919,8 +920,8 @@ test_sub_super(size_t nx, size_t ny) * Test replicating pixels to produce an image twice as large in each * dimension. */ - HDsprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ", (unsigned long)nx, (unsigned long)ny, - (unsigned long)(2 * nx), (unsigned long)(2 * ny)); + HDsnprintf(s, sizeof(s), "Testing image sampling %4lux%-4lu to %4lux%-4lu ", (unsigned long)nx, + (unsigned long)ny, (unsigned long)(2 * nx), (unsigned long)(2 * ny)); HDprintf("%-70s", s); HDfflush(stdout); @@ -946,17 +947,17 @@ test_sub_super(size_t nx, size_t ny) for (i = 0; i < nx; i++) { for (j = 0; j < ny; j++) { if (half[i * ny + j] != twice[4 * i * ny + 2 * j]) - HDsprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i, (unsigned long)j, - (unsigned long)i * 2, (unsigned long)j * 2); + HDsnprintf(s, sizeof(s), "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i, + (unsigned long)j, (unsigned long)i * 2, (unsigned long)j * 2); else if (half[i * ny + j] != twice[4 * i * ny + 2 * j + 1]) - HDsprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i, (unsigned long)j, - (unsigned long)i * 2, (unsigned long)j * 2 + 1); + HDsnprintf(s, sizeof(s), "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i, + (unsigned long)j, (unsigned long)i * 2, (unsigned long)j * 2 + 1); else if (half[i * ny + j] != twice[(2 * i + 1) * 2 * ny + 2 * j]) - HDsprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i, (unsigned long)j, - (unsigned long)i * 2 + 1, (unsigned long)j * 2); + HDsnprintf(s, sizeof(s), "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i, + (unsigned long)j, (unsigned long)i * 2 + 1, (unsigned long)j * 2); else if (half[i * ny + j] != twice[(2 * i + 1) * 2 * ny + 2 * j + 1]) - HDsprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i, (unsigned long)j, - (unsigned long)i * 2 + 1, (unsigned long)j * 2 + 1); + HDsnprintf(s, sizeof(s), "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i, + (unsigned long)j, (unsigned long)i * 2 + 1, (unsigned long)j * 2 + 1); if (s[0]) { H5_FAILED(); if (!HDisatty(1)) { @@ -1014,7 +1015,7 @@ test_array_fill(size_t lo, size_t hi) size_t u, v, w; /* Local index variables */ char s[256]; - HDsprintf(s, "array filling %4lu-%-4lu elements", (unsigned long)lo, (unsigned long)hi); + HDsnprintf(s, sizeof(s), "array filling %4lu-%-4lu elements", (unsigned long)lo, (unsigned long)hi); TESTING(s); /* Initialize */ @@ -1078,8 +1079,8 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z) hsize_t new_coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of offset */ char s[256]; - HDsprintf(s, "array offset %4lux%4lux%4lu elements", (unsigned long)z, (unsigned long)y, - (unsigned long)x); + HDsnprintf(s, sizeof(s), "array offset %4lux%4lux%4lu elements", (unsigned long)z, (unsigned long)y, + (unsigned long)x); TESTING(s); /* Initialize */ diff --git a/test/istore.c b/test/istore.c index f198aad..144355e 100644 --- a/test/istore.c +++ b/test/istore.c @@ -271,20 +271,21 @@ test_extend(hid_t f, const char *prefix, size_t nx, size_t ny, size_t nz) if (!ny) { ndims = 1; ny = nz = 1; - HDsprintf(dims, "%lu", (unsigned long)nx); + HDsnprintf(dims, sizeof(dims), "%lu", (unsigned long)nx); } else { ndims = 2; nz = 1; - HDsprintf(dims, "%lux%lu", (unsigned long)nx, (unsigned long)ny); + HDsnprintf(dims, sizeof(dims), "%lux%lu", (unsigned long)nx, (unsigned long)ny); } } else { ndims = 3; - HDsprintf(dims, "%lux%lux%lu", (unsigned long)nx, (unsigned long)ny, (unsigned long)nz); + HDsnprintf(dims, sizeof(dims), "%lux%lux%lu", (unsigned long)nx, (unsigned long)ny, + (unsigned long)nz); } - HDsprintf(s, "istore extend: %s", dims); + HDsnprintf(s, sizeof(s), "istore extend: %s", dims); TESTING(s); buf = (uint8_t *)HDmalloc(nx * ny * nz); check = (uint8_t *)HDmalloc(nx * ny * nz); @@ -298,7 +299,7 @@ test_extend(hid_t f, const char *prefix, size_t nx, size_t ny, size_t nz) max_corner[2] = 0; /* Build the new empty object */ - HDsprintf(name, "%s_%s", prefix, dims); + HDsnprintf(name, sizeof(name), "%s_%s", prefix, dims); if ((dataset = new_object(f, name, ndims, whole_size, whole_size)) < 0) { HDfprintf(stderr, " Cannot create %u-d object `%s'\n", ndims, name); goto error; @@ -468,20 +469,21 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks, size_t nx, size_t ny, s if (!ny) { ndims = 1; ny = nz = 1; - HDsprintf(dims, "%lu", (unsigned long)nx); + HDsnprintf(dims, sizeof(dims), "%lu", (unsigned long)nx); } else { ndims = 2; nz = 1; - HDsprintf(dims, "%lux%lu", (unsigned long)nx, (unsigned long)ny); + HDsnprintf(dims, sizeof(dims), "%lux%lu", (unsigned long)nx, (unsigned long)ny); } } else { ndims = 3; - HDsprintf(dims, "%lux%lux%lu", (unsigned long)nx, (unsigned long)ny, (unsigned long)nz); + HDsnprintf(dims, sizeof(dims), "%lux%lux%lu", (unsigned long)nx, (unsigned long)ny, + (unsigned long)nz); } - HDsprintf(s, "istore sparse: %s", dims); + HDsnprintf(s, sizeof(s), "istore sparse: %s", dims); TESTING(s); if (skip_test) { SKIPPED(); @@ -500,7 +502,7 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks, size_t nx, size_t ny, s size[2] = nz; /* Build the new empty object */ - HDsprintf(name, "%s_%s", prefix, dims); + HDsnprintf(name, sizeof(name), "%s_%s", prefix, dims); if ((dataset = new_object(f, name, ndims, whole_size, chunk_dims)) < 0) { HDprintf(" Cannot create %u-d object `%s'\n", ndims, name); goto error; diff --git a/test/lheap.c b/test/lheap.c index 1c6a6df..c9c6ca9 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -97,7 +97,7 @@ main(void) goto error; } for (i = 0; i < NOBJS; i++) { - HDsprintf(buf, "%03d-", i); + HDsnprintf(buf, sizeof(buf), "%03d-", i); for (j = 4; j < i; j++) buf[j] = (char)('0' + j % 10); if (j > 4) @@ -137,7 +137,7 @@ main(void) goto error; } for (i = 0; i < NOBJS; i++) { - HDsprintf(buf, "%03d-", i); + HDsnprintf(buf, sizeof(buf), "%03d-", i); for (j = 4; j < i; j++) buf[j] = (char)('0' + j % 10); if (j > 4) diff --git a/test/mf.c b/test/mf.c index ce9d667..bed92e3 100644 --- a/test/mf.c +++ b/test/mf.c @@ -6586,22 +6586,22 @@ error: memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; \ memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP; \ memb_map[H5FD_MEM_LHEAP] = H5FD_MEM_LHEAP; \ - HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); \ + HDsnprintf(sv[H5FD_MEM_SUPER], 64, "%%s-%c.h5", 's'); \ memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; \ memb_addr[H5FD_MEM_SUPER] = 0; \ - HDsprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); \ + HDsnprintf(sv[H5FD_MEM_BTREE], 64, "%%s-%c.h5", 'b'); \ memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE]; \ memb_addr[H5FD_MEM_BTREE] = HADDR_MAX / 6; \ - HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); \ + HDsnprintf(sv[H5FD_MEM_DRAW], 64, "%%s-%c.h5", 'r'); \ memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; \ memb_addr[H5FD_MEM_DRAW] = HADDR_MAX / 3; \ - HDsprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); \ + HDsnprintf(sv[H5FD_MEM_GHEAP], 64, "%%s-%c.h5", 'g'); \ memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP]; \ memb_addr[H5FD_MEM_GHEAP] = HADDR_MAX / 2; \ - HDsprintf(sv[H5FD_MEM_LHEAP], "%%s-%c.h5", 'l'); \ + HDsnprintf(sv[H5FD_MEM_LHEAP], 64, "%%s-%c.h5", 'l'); \ memb_name[H5FD_MEM_LHEAP] = sv[H5FD_MEM_LHEAP]; \ memb_addr[H5FD_MEM_LHEAP] = HADDR_MAX * 2 / 3; \ - HDsprintf(sv[H5FD_MEM_OHDR], "%%s-%c.h5", 'o'); \ + HDsnprintf(sv[H5FD_MEM_OHDR], 64, "%%s-%c.h5", 'o'); \ memb_name[H5FD_MEM_OHDR] = sv[H5FD_MEM_OHDR]; \ memb_addr[H5FD_MEM_OHDR] = HADDR_MAX * 5 / 6; \ } diff --git a/test/objcopy.c b/test/objcopy.c index cc8f428..62fb22e 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -646,7 +646,7 @@ test_copy_attach_attributes(hid_t loc_id, hid_t type_id) goto done; for (u = 0; u < num_attributes_g; u++) { - HDsprintf(attr_name, "%u attr", u); + HDsnprintf(attr_name, sizeof(attr_name), "%u attr", u); /* Set attribute data */ attr_data[0] = (int)(100 * u); @@ -715,7 +715,7 @@ test_copy_attach_paired_attributes(hid_t loc_id, hid_t loc_id2, hid_t type_id) goto done; for (u = 0; u < num_attributes_g; u++) { - HDsprintf(attr_name, "%u attr", u); + HDsnprintf(attr_name, sizeof(attr_name), "%u attr", u); /* Set attribute data */ attr_data[0] = (int)(100 * u); @@ -7933,17 +7933,17 @@ test_copy_group_deep(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f /* create nested sub-groups & datasets */ for (i = 0; i < NUM_SUB_GROUPS; i++) { - HDsprintf(objname, "Group #%d", i); + HDsnprintf(objname, sizeof(objname), "Group #%d", i); if ((gid_sub = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; for (j = 0; j < NUM_SUB_GROUPS; j++) { - HDsprintf(objname, "Group #%d", j); + HDsnprintf(objname, sizeof(objname), "Group #%d", j); if ((gid_sub2 = H5Gcreate2(gid_sub, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; for (k = 0; k < NUM_DATASETS; k++) { - HDsprintf(objname, "Dataset #%d", k); + HDsnprintf(objname, sizeof(objname), "Dataset #%d", k); /* add a dataset to the group */ if ((did = H5Dcreate2(gid_sub2, objname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, @@ -8222,12 +8222,12 @@ test_copy_group_wide_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* create wide sub-group hierarchy, with multiple links to higher groups */ for (u = 0; u < NUM_WIDE_LOOP_GROUPS; u++) { - HDsprintf(objname, "%s-%u", NAME_GROUP_SUB, u); + HDsnprintf(objname, sizeof(objname), "%s-%u", NAME_GROUP_SUB, u); if ((gid_sub = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; for (v = 0; v < NUM_WIDE_LOOP_GROUPS; v++) { - HDsprintf(objname, "%s-%u", NAME_GROUP_SUB_SUB2, v); + HDsnprintf(objname, sizeof(objname), "%s-%u", NAME_GROUP_SUB_SUB2, v); if ((gid_sub2 = H5Gcreate2(gid_sub, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; diff --git a/test/objcopy_ref.c b/test/objcopy_ref.c index adc1a84..ef20cb4 100644 --- a/test/objcopy_ref.c +++ b/test/objcopy_ref.c @@ -509,7 +509,7 @@ test_copy_attach_attributes(hid_t loc_id, hid_t type_id) goto done; for (u = 0; u < num_attributes_g; u++) { - HDsprintf(attr_name, "%u attr", u); + HDsnprintf(attr_name, sizeof(attr_name), "%u attr", u); /* Set attribute data */ attr_data[0] = (int)(100 * u); @@ -939,8 +939,10 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, H5R_ref_t *ref_buf1, *ref_buf2; /* Aliases for buffers to compare */ /* Loop over elements in buffers */ + H5_GCC_CLANG_DIAG_OFF("cast-qual") ref_buf1 = (H5R_ref_t *)buf1; ref_buf2 = (H5R_ref_t *)buf2; + H5_GCC_CLANG_DIAG_ON("cast-qual") for (u = 0; u < nelmts; u++, ref_buf1++, ref_buf2++) { hid_t obj1_id, obj2_id; /* IDs for objects referenced */ H5O_type_t obj1_type, obj2_type; /* Types of objects referenced */ diff --git a/test/ohdr.c b/test/ohdr.c index 6b31334..dc0497f 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -1883,7 +1883,7 @@ main(void) /* Display info about testing */ low_string = h5_get_version_string(low); high_string = h5_get_version_string(high); - HDsprintf(msg, "Using file format version: (%s, %s)", low_string, high_string); + HDsnprintf(msg, sizeof(msg), "Using file format version: (%s, %s)", low_string, high_string); HDputs(msg); /* test on object continuation block */ diff --git a/test/stab.c b/test/stab.c index d08ebca..b4c92a4 100644 --- a/test/stab.c +++ b/test/stab.c @@ -219,8 +219,9 @@ test_long(hid_t fcpl, hid_t fapl, hbool_t new_format) for (i = 0; i < LONG_NAME_LEN; i++) name1[i] = (char)('A' + i % 26); name1[LONG_NAME_LEN - 1] = '\0'; - name2 = (char *)HDmalloc((size_t)((2 * LONG_NAME_LEN) + 2)); - HDsprintf(name2, "%s/%s", name1, name1); + size_t name2Len = (2 * LONG_NAME_LEN) + 2; + name2 = (char *)HDmalloc(name2Len); + HDsnprintf(name2, name2Len, "%s/%s", name1, name1); /* Create groups */ if ((g1 = H5Gcreate2(fid, name1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -310,7 +311,7 @@ test_large(hid_t fcpl, hid_t fapl, hbool_t new_format) if (H5G__has_stab_test(cwg) != FALSE) TEST_ERROR; for (i = 0; i < LARGE_NOBJS; i++) { - HDsprintf(name, "%05d%05d", (HDrandom() % 100000), i); + HDsnprintf(name, sizeof(name), "%05d%05d", (HDrandom() % 100000), i); if ((dir = H5Gcreate2(cwg, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; if (H5Gclose(dir) < 0) @@ -452,7 +453,7 @@ lifecycle(hid_t fcpl, hid_t fapl2) TEST_ERROR; /* Create first "bottom" group */ - HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, (unsigned)0); + HDsnprintf(objname, sizeof(objname), LIFECYCLE_BOTTOM_GROUP, (unsigned)0); if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -475,7 +476,7 @@ lifecycle(hid_t fcpl, hid_t fapl2) /* Create several more bottom groups, to push the top group almost to a symbol table */ /* (Start counting at '1', since we've already created one bottom group */ for (u = 1; u < LIFECYCLE_MAX_COMPACT; u++) { - HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsnprintf(objname, sizeof(objname), LIFECYCLE_BOTTOM_GROUP, u); if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -511,7 +512,7 @@ lifecycle(hid_t fcpl, hid_t fapl2) TEST_ERROR; /* Create one more "bottom" group, which should push top group into using a symbol table */ - HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsnprintf(objname, sizeof(objname), LIFECYCLE_BOTTOM_GROUP, u); if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -545,7 +546,7 @@ lifecycle(hid_t fcpl, hid_t fapl2) /* Unlink objects from top group */ while (u >= LIFECYCLE_MIN_DENSE) { - HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsnprintf(objname, sizeof(objname), LIFECYCLE_BOTTOM_GROUP, u); if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; @@ -562,7 +563,7 @@ lifecycle(hid_t fcpl, hid_t fapl2) TEST_ERROR; /* Unlink one more object from the group, which should transform back to using links */ - HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsnprintf(objname, sizeof(objname), LIFECYCLE_BOTTOM_GROUP, u); if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; u--; @@ -576,11 +577,11 @@ lifecycle(hid_t fcpl, hid_t fapl2) TEST_ERROR; /* Unlink last two objects from top group */ - HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsnprintf(objname, sizeof(objname), LIFECYCLE_BOTTOM_GROUP, u); if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; u--; - HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsnprintf(objname, sizeof(objname), LIFECYCLE_BOTTOM_GROUP, u); if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; @@ -841,7 +842,7 @@ read_old(void) /* Create a bunch of objects in the group */ for (u = 0; u < READ_OLD_NGROUPS; u++) { - HDsprintf(objname, "Group %u", u); + HDsnprintf(objname, sizeof(objname), "Group %u", u); if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -865,7 +866,7 @@ read_old(void) /* Delete new objects from old group */ for (u = 0; u < READ_OLD_NGROUPS; u++) { - HDsprintf(objname, "Group %u", u); + HDsnprintf(objname, sizeof(objname), "Group %u", u); if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; } /* end for */ @@ -977,7 +978,7 @@ no_compact(hid_t fcpl, hid_t fapl2) TEST_ERROR; /* Create first "bottom" group */ - HDsprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0); + HDsnprintf(objname, sizeof(objname), NO_COMPACT_BOTTOM_GROUP, (unsigned)0); if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -998,7 +999,7 @@ no_compact(hid_t fcpl, hid_t fapl2) TEST_ERROR; /* Unlink object from top group */ - HDsprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0); + HDsnprintf(objname, sizeof(objname), NO_COMPACT_BOTTOM_GROUP, (unsigned)0); if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; diff --git a/test/swmr_common.c b/test/swmr_common.c index b359bc6..9063ddd 100644 --- a/test/swmr_common.c +++ b/test/swmr_common.c @@ -162,6 +162,9 @@ create_symbol_datatype(void) * Buffer for the created name. Must be pre-allocated. * Since the name is formulaic, this isn't considered an issue. * + * size_t name_buf_length + * The length in bytes of the name_buf buffer + * * unsigned level * The dataset's level * @@ -175,11 +178,11 @@ create_symbol_datatype(void) *------------------------------------------------------------------------- */ int -generate_name(char *name_buf, unsigned level, unsigned count) +generate_name(char *name_buf, size_t name_buf_length, unsigned level, unsigned count) { HDassert(name_buf); - HDsprintf(name_buf, "%u-%04u", level, count); + HDsnprintf(name_buf, name_buf_length, "%u-%04u", level, count); return 0; } /* end generate_name() */ @@ -206,7 +209,7 @@ generate_symbols(void) for (v = 0; v < symbol_count[u]; v++) { char name_buf[64]; - generate_name(name_buf, u, v); + generate_name(name_buf, sizeof(name_buf), u, v); symbol_info[u][v].name = HDstrdup(name_buf); symbol_info[u][v].dsid = -1; symbol_info[u][v].nrecords = 0; diff --git a/test/swmr_common.h b/test/swmr_common.h index d0d829d..5fcf923 100644 --- a/test/swmr_common.h +++ b/test/swmr_common.h @@ -66,10 +66,10 @@ extern "C" { H5TEST_DLL symbol_info_t *choose_dataset(void); H5TEST_DLL hid_t create_symbol_datatype(void); -H5TEST_DLL int generate_name(char *name_buf, unsigned level, unsigned count); -H5TEST_DLL int generate_symbols(void); -H5TEST_DLL int shutdown_symbols(void); -H5TEST_DLL int print_metadata_retries_info(hid_t fid); +H5TEST_DLL int generate_name(char *name_buf, size_t name_buf_length, unsigned level, unsigned count); +H5TEST_DLL int generate_symbols(void); +H5TEST_DLL int shutdown_symbols(void); +H5TEST_DLL int print_metadata_retries_info(hid_t fid); #ifdef __cplusplus } diff --git a/test/swmr_generator.c b/test/swmr_generator.c index 93cfa0f..51caa27 100644 --- a/test/swmr_generator.c +++ b/test/swmr_generator.c @@ -188,7 +188,7 @@ gen_skeleton(const char *filename, hbool_t verbose, hbool_t swmr_write, int comp hbool_t move_dataspace_message = FALSE; /* Whether to move the dataspace message out of object header chunk #0 */ - generate_name(name_buf, u, v); + generate_name(name_buf, sizeof(name_buf), u, v); if ((dsid = H5Dcreate2(fid, name_buf, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) return -1; diff --git a/test/tattr.c b/test/tattr.c index 2859f4c..d214719 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -2737,7 +2737,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Rename attribute */ - HDsprintf(new_attrname, "new attr %02u", u); + HDsnprintf(new_attrname, sizeof(new_attrname), "new attr %02u", u); /* Rename attribute */ ret = H5Arename_by_name(fid, DSET1_NAME, attrname, new_attrname, H5P_DEFAULT); @@ -9015,7 +9015,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Create new attribute name */ - HDsprintf(attrname2, "new attr %02u", u); + HDsnprintf(attrname2, sizeof(attrname2), "new attr %02u", u); /* Change second dataset's attribute's name */ ret = H5Arename_by_name(fid, DSET2_NAME, attrname, attrname2, H5P_DEFAULT); @@ -10126,7 +10126,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) /* Create attributes on group */ for (i = 0; i < BUG2_NATTR; i++) { - HDsprintf(aname, "%03u", i); + HDsnprintf(aname, sizeof(aname), "%03u", i); aid = H5Acreate2(gid, aname, H5T_STD_I32LE, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(aid, FAIL, "H5Acreate2"); @@ -10136,7 +10136,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) /* Delete every other attribute */ for (i = 1; i < BUG2_NATTR; i += 2) { - HDsprintf(aname, "%03u", i); + HDsnprintf(aname, sizeof(aname), "%03u", i); ret = H5Adelete(gid, aname); CHECK(ret, FAIL, "H5Adelete"); } @@ -10160,7 +10160,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) /* Open an attribute in the middle */ i = (BUG2_NATTR / 4) * 2; - HDsprintf(aname, "%03u", i); + HDsnprintf(aname, sizeof(aname), "%03u", i); aid = H5Aopen(gid, aname, H5P_DEFAULT); CHECK(aid, FAIL, "H5Aopen"); @@ -10203,7 +10203,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) /* Create attributes on group */ for (i = 0; i < BUG2_NATTR2; i++) { - HDsprintf(aname, "%03u", i); + HDsnprintf(aname, sizeof(aname), "%03u", i); aid = H5Acreate2(gid, aname, H5T_STD_I32LE, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(aid, FAIL, "H5Acreate2"); @@ -10213,7 +10213,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) /* Delete every other attribute */ for (i = 0; i < BUG2_NATTR2; i++) { - HDsprintf(aname, "%03u", i); + HDsnprintf(aname, sizeof(aname), "%03u", i); ret = H5Adelete(gid, aname); CHECK(ret, FAIL, "H5Adelete"); } diff --git a/test/tconfig.c b/test/tconfig.c index 8bd625f..8cffd54 100644 --- a/test/tconfig.c +++ b/test/tconfig.c @@ -161,11 +161,6 @@ test_config_ctypes(void) vrfy_cint_type(int_least64_t, uint_least64_t, H5_SIZEOF_INT_LEAST64_T); #endif - /* pseudo standard basic types */ -#if H5_SIZEOF___INT64 > 0 - vrfy_cint_type(__int64, unsigned __int64, H5_SIZEOF___INT64); -#endif - #if H5_SIZEOF_OFF_T > 0 vrfy_ctype(off_t, H5_SIZEOF_OFF_T); #endif diff --git a/test/test_swmr.sh.in b/test/test_swmr.sh.in index e517ddc..012b024 100644 --- a/test/test_swmr.sh.in +++ b/test/test_swmr.sh.in @@ -60,16 +60,16 @@ TESTING() { # This performs similar function as the routine h5_wait_message() in test/h5test.c WAIT_MESSAGE() { message=$1 # Get the name of the message file to wait for - t0=$(date +%s) # Get current time in seconds + t0=`date +%s` # Get current time in seconds difft=0 # Initialize the time difference mexist=0 # Indicate whether the message file is found while [ $difft -lt $MESSAGE_TIMEOUT ] ; # Loop till message times out do - t1=$(date +%s) # Get current time in seconds - difft=$(("$t1" - "$t0")) # Calculate the time difference - if [ -e "$message" ]; then # If message file is found: + t1=`date +%s` # Get current time in seconds + difft=`expr $t1 - $t0` # Calculate the time difference + if [ -e $message ]; then # If message file is found: mexist=1 # indicate the message file is found - rm "$message" # remove the message file + rm $message # remove the message file break # get out of the while loop fi done; @@ -128,7 +128,7 @@ for FILE in swmr*; do *.o) continue ;; ## don't copy the .o files esac if test -f "$FILE" ; then - cp "$FILE" swmr_test + cp $FILE swmr_test fi done @@ -143,12 +143,12 @@ if [ -f .libs/swmr ]; then *.o) continue ;; ## don't copy the .o files esac if test -f "$FILE" ; then - cp "$FILE" swmr_test/.libs + cp $FILE swmr_test/.libs fi done fi -cd swmr_test || exit 1 +cd swmr_test # Loop over index types @@ -171,7 +171,7 @@ do $testdir/swmr_generator -q $compress $index_type if test $? -ne 0; then echo generator had error - nerrors=$((nerrors + 1)) + nerrors=`expr $nerrors + 1` fi # Launch the Generator with SWMR_WRITE @@ -179,7 +179,7 @@ do $testdir/swmr_generator -q -s $compress $index_type if test $? -ne 0; then echo generator had error - nerrors=$((nerrors + 1)) + nerrors=`expr $nerrors + 1` fi # Check for error and exit if one occurred @@ -217,19 +217,19 @@ do seed="" $testdir/swmr_reader -q $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n & pid_readers="$pid_readers $!" - n=$((n + 1)) + n=`expr $n + 1` done - $DPRINT pid_readers="$pid_readers" + $DPRINT pid_readers=$pid_readers $IFDEBUG ps # Collect exit codes of the readers first because they usually finish # before the writer. for xpid in $pid_readers; do - $DPRINT checked reader "$xpid" - wait "$xpid" + $DPRINT checked reader $xpid + wait $xpid if test $? -ne 0; then echo reader had error - nerrors=$((nerrors + 1)) + nerrors=`expr $nerrors + 1` fi done @@ -238,7 +238,7 @@ do wait $pid_writer if test $? -ne 0; then echo writer had error - nerrors=$((nerrors + 1)) + nerrors=`expr $nerrors + 1` fi # Check for error and exit if one occurred @@ -263,7 +263,7 @@ do $testdir/swmr_generator -q -s $compress $index_type if test $? -ne 0; then echo generator had error - nerrors=$((nerrors + 1)) + nerrors=`expr $nerrors + 1` fi # Remove any possible writer message file before launching writer @@ -289,19 +289,19 @@ do seed="" $testdir/swmr_reader -q $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n & pid_readers="$pid_readers $!" - n=$((n + 1)) + n=`expr $n + 1` done - $DPRINT pid_readers="$pid_readers" + $DPRINT pid_readers=$pid_readers $IFDEBUG ps # Collect exit code of the readers first because they usually finish # before the writer. for xpid in $pid_readers; do - $DPRINT checked reader "$xpid" - wait "$xpid" + $DPRINT checked reader $xpid + wait $xpid if test $? -ne 0; then echo reader had error - nerrors=$((nerrors + 1)) + nerrors=`expr $nerrors + 1` fi done @@ -310,7 +310,7 @@ do wait $pid_writer if test $? -ne 0; then echo writer had error - nerrors=$((nerrors + 1)) + nerrors=`expr $nerrors + 1` fi # Check for error and exit if one occurred @@ -352,19 +352,19 @@ do seed="" $testdir/swmr_remove_reader -q $Nsecs_rem $seed 2>&1 |tee swmr_reader.out.$n & pid_readers="$pid_readers $!" - n=$((n + 1)) + n=`expr $n + 1` done - $DPRINT pid_readers="$pid_readers" + $DPRINT pid_readers=$pid_readers $IFDEBUG ps # Collect exit code of the readers first because they usually finish # before the writer. for xpid in $pid_readers; do - $DPRINT checked reader "$xpid" - wait "$xpid" + $DPRINT checked reader $xpid + wait $xpid if test $? -ne 0; then echo reader had error - nerrors=$((nerrors + 1)) + nerrors=`expr $nerrors + 1` fi done @@ -373,7 +373,7 @@ do wait $pid_writer if test $? -ne 0; then echo writer had error - nerrors=$((nerrors + 1)) + nerrors=`expr $nerrors + 1` fi # Check for error and exit if one occurred @@ -398,7 +398,7 @@ do $testdir/swmr_generator -q $compress $index_type if test $? -ne 0; then echo generator had error - nerrors=$((nerrors + 1)) + nerrors=`expr $nerrors + 1` fi # Launch the Writer (not in parallel - just to rebuild the datasets) @@ -407,7 +407,7 @@ do $testdir/swmr_writer -q $Nrecords $seed if test $? -ne 0; then echo writer had error - nerrors=$((nerrors + 1)) + nerrors=`expr $nerrors + 1` fi # Remove any possible writer message file before launching writer @@ -433,19 +433,19 @@ do seed="" $testdir/swmr_remove_reader -q $Nsecs_addrem $seed 2>&1 |tee swmr_reader.out.$n & pid_readers="$pid_readers $!" - n=$((n + 1)) + n=`expr $n + 1` done - $DPRINT pid_readers="$pid_readers" + $DPRINT pid_readers=$pid_readers $IFDEBUG ps # Collect exit code of the readers first because they usually finish # before the writer. for xpid in $pid_readers; do - $DPRINT checked reader "$xpid" - wait "$xpid" + $DPRINT checked reader $xpid + wait $xpid if test $? -ne 0; then echo reader had error - nerrors=$((nerrors + 1)) + nerrors=`expr $nerrors + 1` fi done @@ -454,7 +454,7 @@ do wait $pid_writer if test $? -ne 0; then echo writer had error - nerrors=$((nerrors + 1)) + nerrors=`expr $nerrors + 1` fi # Check for error and exit if one occurred @@ -482,7 +482,7 @@ do $testdir/swmr_generator -q $compress $index_type $seed if test $? -ne 0; then echo generator had error - nerrors=$((nerrors + 1)) + nerrors=`expr $nerrors + 1` fi # Remove any possible writer message file before launching writer @@ -504,26 +504,26 @@ do # The sparse reader spits out a LOT of data so it's set to 'quiet' $testdir/swmr_sparse_reader -q $Nrecs_spa 2>&1 |tee swmr_reader.out.$n & pid_readers="$pid_readers $!" - n=$((n + 1)) + n=`expr $n + 1` done - $DPRINT pid_readers="$pid_readers" + $DPRINT pid_readers=$pid_readers $IFDEBUG ps # Collect exit code of the writer - $DPRINT checked writer "$pid_writer" - wait "$pid_writer" + $DPRINT checked writer $pid_writer + wait $pid_writer if test $? -ne 0; then echo writer had error - nerrors=$((nerrors + 1)) + nerrors=`expr $nerrors + 1` fi # Collect exit code of the readers for xpid in $pid_readers; do - $DPRINT checked reader "$xpid" - wait "$xpid" + $DPRINT checked reader $xpid + wait $xpid if test $? -ne 0; then echo reader had error - nerrors=$((nerrors + 1)) + nerrors=`expr $nerrors + 1` fi done diff --git a/test/testframe.c b/test/testframe.c index d3f0211..e7499ed 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -413,16 +413,20 @@ SetTestVerbosity(int newval) Values: 0: Exhaustive run Tests should take as long as necessary - 1: Full run. Default if HDF5TestExpress is not defined + 1: Full run. Default if H5_TEST_EXPRESS_LEVEL_DEFAULT + and HDF5TestExpress are not defined Tests should take no more than 30 minutes 2: Quick run Tests should take no more than 10 minutes - 3: Smoke test. Default if HDF5TestExpress is set to a value other than 0-3 + 3: Smoke test. + Default if HDF5TestExpress is set to a value other than 0-3 Tests should take less than 1 minute Design: If the environment variable $HDF5TestExpress is defined, - then test programs should skip some tests so that they + or if a default testing level > 1 has been set via + H5_TEST_EXPRESS_LEVEL_DEFAULT, then test programs should + skip some tests so that they complete sooner. Terms: @@ -442,18 +446,27 @@ GetTestExpress(void) /* set it here for now. Should be done in something like h5test_init(). */ if (TestExpress == -1) { + int express_val = 1; + + /* Check if a default test express level is defined (e.g., by build system) */ +#ifdef H5_TEST_EXPRESS_LEVEL_DEFAULT + express_val = H5_TEST_EXPRESS_LEVEL_DEFAULT; +#endif + + /* Check if HDF5TestExpress is set to override the default level */ env_val = HDgetenv("HDF5TestExpress"); + if (env_val) { + if (HDstrcmp(env_val, "0") == 0) + express_val = 0; + else if (HDstrcmp(env_val, "1") == 0) + express_val = 1; + else if (HDstrcmp(env_val, "2") == 0) + express_val = 2; + else + express_val = 3; + } - if (env_val == NULL) - SetTestExpress(1); - else if (HDstrcmp(env_val, "0") == 0) - SetTestExpress(0); - else if (HDstrcmp(env_val, "1") == 0) - SetTestExpress(1); - else if (HDstrcmp(env_val, "2") == 0) - SetTestExpress(2); - else - SetTestExpress(3); + SetTestExpress(express_val); } return (TestExpress); diff --git a/test/testmeta.c b/test/testmeta.c index a3b5160..a62977b 100644 --- a/test/testmeta.c +++ b/test/testmeta.c @@ -83,7 +83,7 @@ main(void) for (i = 0; i < NEXTARRAYS; i++) { /* Create dataset */ - HDsprintf(name, "/ExtArray%06d", i); + HDsnprintf(name, sizeof(name), "/ExtArray%06d", i); dataset_id = H5Dcreate2(file_id, name, H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, prop_id, H5P_DEFAULT); @@ -108,7 +108,7 @@ main(void) floatval = (float)j; /* Create group to hold data arrays for this object */ - HDsprintf(name, "/DataArray/%06d", j); + HDsnprintf(name, sizeof(name), "/DataArray/%06d", j); group_id = H5Gcreate2(file_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (group_id < 0) { HDfprintf(stderr, "Failed to create DataArray group.\n"); @@ -124,7 +124,7 @@ main(void) dataspace_id = H5Screate_simple(1, dims, maxdims); /* Create dataset */ - HDsprintf(name, "DataArray%06d", i); + HDsnprintf(name, sizeof(name), "DataArray%06d", i); dataset_id = H5Dcreate2(group_id, name, H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (dataset_id < 0) { @@ -170,7 +170,7 @@ main(void) /* Extend attribute arrays */ for (i = 0; i < NEXTARRAYS; i++) { /* Open extendable dataset */ - HDsprintf(name, "/ExtArray%06d", i); + HDsnprintf(name, sizeof(name), "/ExtArray%06d", i); dataset_id = H5Dopen2(file_id, name, H5P_DEFAULT); if (dataset_id < 0) { HDfprintf(stderr, "Failed to open ExtArray dataset.\n"); diff --git a/test/tfile.c b/test/tfile.c index 717eb91..caf9c62 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1111,14 +1111,14 @@ test_get_obj_ids(void) /* creates NGROUPS groups under the root group */ for (m = 0; m < NGROUPS; m++) { - HDsprintf(gname, "group%d", m); + HDsnprintf(gname, sizeof(gname), "group%d", m); gid[m] = H5Gcreate2(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(gid[m], FAIL, "H5Gcreate2"); } /* create NDSETS datasets under the root group */ for (n = 0; n < NDSETS; n++) { - HDsprintf(dname, "dataset%d", n); + HDsnprintf(dname, sizeof(dname), "dataset%d", n); dset[n] = H5Dcreate2(fid, dname, H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(dset[n], FAIL, "H5Dcreate2"); } @@ -1178,7 +1178,7 @@ test_get_obj_ids(void) /* Open NDSETS datasets under the root group */ for (n = 0; n < NDSETS; n++) { - HDsprintf(dname, "dataset%d", n); + HDsnprintf(dname, sizeof(dname), "dataset%d", n); dset[n] = H5Dopen2(fid, dname, H5P_DEFAULT); CHECK(dset[n], FAIL, "H5Dcreate2"); } @@ -4473,7 +4473,7 @@ test_file_freespace(const char *env_h5_drvr) /* Create datasets in file */ for (u = 0; u < 10; u++) { - HDsprintf(name, "Dataset %u", u); + HDsnprintf(name, sizeof(name), "Dataset %u", u); dset = H5Dcreate2(file, name, H5T_STD_U32LE, dspace, H5P_DEFAULT, dcpl, H5P_DEFAULT); CHECK(dset, FAIL, "H5Dcreate2"); @@ -4496,7 +4496,7 @@ test_file_freespace(const char *env_h5_drvr) /* Delete datasets in file */ for (k = 9; k >= 0; k--) { - HDsprintf(name, "Dataset %u", (unsigned)k); + HDsnprintf(name, sizeof(name), "Dataset %u", (unsigned)k); ret = H5Ldelete(file, name, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); } /* end for */ @@ -4624,7 +4624,7 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format) /* Create datasets in file */ for (u = 0; u < 10; u++) { - HDsprintf(name, "Dataset %u", u); + HDsnprintf(name, sizeof(name), "Dataset %u", u); dset = H5Dcreate2(file, name, H5T_STD_U32LE, dspace, H5P_DEFAULT, dcpl, H5P_DEFAULT); CHECK(dset, FAIL, "H5Dcreate2"); @@ -4642,7 +4642,7 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format) /* Delete odd-numbered datasets in file */ for (u = 0; u < 10; u++) { - HDsprintf(name, "Dataset %u", u); + HDsnprintf(name, sizeof(name), "Dataset %u", u); if (u % 2) { ret = H5Ldelete(file, name, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); @@ -7590,7 +7590,7 @@ test_incr_filesize(void) /* Create datasets in file */ for (u = 0; u < 10; u++) { - HDsprintf(name, "Dataset %u", u); + HDsnprintf(name, sizeof(name), "Dataset %u", u); dset = H5Dcreate2(fid, name, H5T_STD_U32LE, dspace, H5P_DEFAULT, dcpl, H5P_DEFAULT); CHECK(dset, FAIL, "H5Dcreate2"); diff --git a/test/th5o.c b/test/th5o.c index 9504f7a..4ffcbef 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -1738,7 +1738,7 @@ test_h5o_getinfo_visit(void) /* Attach 10 attributes to "group1" */ for (j = 0; j < 10; j++) { /* Create the attribute name */ - HDsprintf(attrname, "attr%u", j); + HDsnprintf(attrname, sizeof(attrname), "attr%u", j); /* Create the attribute */ aid = H5Acreate2(gid1, attrname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(aid, FAIL, "H5Acreate2"); diff --git a/test/titerate.c b/test/titerate.c index 1d87343..5796f11 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -156,7 +156,7 @@ test_iter_group(hid_t fapl, hbool_t new_format) CHECK(filespace, FAIL, "H5Screate"); for (i = 0; i < NDATASETS; i++) { - HDsprintf(name, "Dataset %d", i); + HDsnprintf(name, sizeof(name), "Dataset %d", i); dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); @@ -436,7 +436,7 @@ test_iter_attr(hid_t fapl, hbool_t new_format) CHECK(dataset, FAIL, "H5Dcreate2"); for (i = 0; i < NATTR; i++) { - HDsprintf(name, "Attribute %02d", i); + HDsnprintf(name, sizeof(name), "Attribute %02d", i); attribute = H5Acreate2(dataset, name, H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT); CHECK(attribute, FAIL, "H5Acreate2"); @@ -649,7 +649,7 @@ test_iter_group_large(hid_t fapl) /* Create a bunch of groups */ for (i = 0; i < ITER_NGROUPS; i++) { - HDsprintf(gname, "Group_%d", i); + HDsnprintf(gname, sizeof(gname), "Group_%d", i); /* Add the name to the list of objects in the root group */ HDstrcpy(names[i].name, gname); @@ -766,7 +766,7 @@ test_grp_memb_funcs(hid_t fapl) CHECK(filespace, FAIL, "H5Screate"); for (i = 0; i < NDATASETS; i++) { - HDsprintf(name, "Dataset %d", i); + HDsnprintf(name, sizeof(name), "Dataset %d", i); dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); diff --git a/test/unlink.c b/test/unlink.c index 2527e94..265c497 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -179,12 +179,12 @@ test_many(hid_t file) /* Create a bunch of names and unlink them in order */ TESTING("forward unlink"); for (i = 0; i < how_many; i++) { - HDsprintf(name, "obj_%05d", i); + HDsnprintf(name, sizeof(name), "obj_%05d", i); if (H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; } /* end for */ for (i = 0; i < how_many; i++) { - HDsprintf(name, "obj_%05d", i); + HDsnprintf(name, sizeof(name), "obj_%05d", i); if (H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; } /* end for */ @@ -193,12 +193,12 @@ test_many(hid_t file) /* Create a bunch of names and unlink them in reverse order */ TESTING("backward unlink"); for (i = 0; i < how_many; i++) { - HDsprintf(name, "obj_%05d", i); + HDsnprintf(name, sizeof(name), "obj_%05d", i); if (H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; } /* end for */ for (i = (how_many - 1); i >= 0; --i) { - HDsprintf(name, "obj_%05d", i); + HDsnprintf(name, sizeof(name), "obj_%05d", i); if (H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; } /* end for */ @@ -207,15 +207,15 @@ test_many(hid_t file) /* Create a bunch of names and unlink them from both directions */ TESTING("inward unlink"); for (i = 0; i < how_many; i++) { - HDsprintf(name, "obj_%05d", i); + HDsnprintf(name, sizeof(name), "obj_%05d", i); if (H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; } /* end for */ for (i = 0; i < how_many; i++) { if (i % 2) - HDsprintf(name, "obj_%05d", how_many - (1 + i / 2)); + HDsnprintf(name, sizeof(name), "obj_%05d", how_many - (1 + i / 2)); else - HDsprintf(name, "obj_%05d", i / 2); + HDsnprintf(name, sizeof(name), "obj_%05d", i / 2); if (H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; } /* end for */ @@ -224,15 +224,15 @@ test_many(hid_t file) /* Create a bunch of names and unlink them from the midle */ TESTING("outward unlink"); for (i = 0; i < how_many; i++) { - HDsprintf(name, "obj_%05d", i); + HDsnprintf(name, sizeof(name), "obj_%05d", i); if (H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; } /* end for */ for (i = (how_many - 1); i >= 0; --i) { if (i % 2) - HDsprintf(name, "obj_%05d", how_many - (1 + i / 2)); + HDsnprintf(name, sizeof(name), "obj_%05d", how_many - (1 + i / 2)); else - HDsprintf(name, "obj_%05d", i / 2); + HDsnprintf(name, sizeof(name), "obj_%05d", i / 2); if (H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; } /* end for */ @@ -938,7 +938,7 @@ test_filespace(hid_t fapl) /* Alternate adding attributes to each one */ for (u = 0; u < FILESPACE_NATTR; u++) { /* Set the name of the attribute to create */ - HDsprintf(objname, "%s %u", ATTRNAME, u); + HDsnprintf(objname, sizeof(objname), "%s %u", ATTRNAME, u); /* Create an attribute on the first dataset */ if ((attr = H5Acreate2(dataset, objname, H5T_NATIVE_INT, attr_space, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -1070,7 +1070,7 @@ test_filespace(hid_t fapl) /* Create a many groups to remove */ for (u = 0; u < UNLINK_NGROUPS; u++) { - HDsprintf(objname, "%s %u", GROUPNAME, u); + HDsnprintf(objname, sizeof(objname), "%s %u", GROUPNAME, u); if ((group = H5Gcreate2(file, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; if (H5Gclose(group) < 0) @@ -1080,7 +1080,7 @@ test_filespace(hid_t fapl) /* Remove the all the groups */ /* (Remove them in reverse order just to make file size calculation easier -QAK) */ for (u = UNLINK_NGROUPS; u > 0; u--) { - HDsprintf(objname, "%s %u", GROUPNAME, (u - 1)); + HDsnprintf(objname, sizeof(objname), "%s %u", GROUPNAME, (u - 1)); if (H5Ldelete(file, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; } /* end for */ @@ -1148,21 +1148,21 @@ test_filespace(hid_t fapl) /* Create a complex group hierarchy to remove */ for (u = 0; u < FILESPACE_TOP_GROUPS; u++) { /* Create group */ - HDsprintf(objname, "%s %u", GROUPNAME, u); + HDsnprintf(objname, sizeof(objname), "%s %u", GROUPNAME, u); if ((group = H5Gcreate2(file, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; /* Create nested groups inside top groups */ for (v = 0; v < FILESPACE_NESTED_GROUPS; v++) { /* Create group */ - HDsprintf(objname, "%s %u", GROUP2NAME, v); + HDsnprintf(objname, sizeof(objname), "%s %u", GROUP2NAME, v); if ((group2 = H5Gcreate2(group, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; /* Create datasets inside nested groups */ for (w = 0; w < FILESPACE_NDATASETS; w++) { /* Create & close a dataset */ - HDsprintf(objname, "%s %u", DATASETNAME, w); + HDsnprintf(objname, sizeof(objname), "%s %u", DATASETNAME, w); if ((dataset = H5Dcreate2(group2, objname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; @@ -1184,21 +1184,21 @@ test_filespace(hid_t fapl) /* (Remove them in reverse order just to make file size calculation easier -QAK) */ for (u = FILESPACE_TOP_GROUPS; u > 0; u--) { /* Open group */ - HDsprintf(objname, "%s %u", GROUPNAME, (u - 1)); + HDsnprintf(objname, sizeof(objname), "%s %u", GROUPNAME, (u - 1)); if ((group = H5Gopen2(file, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; /* Open nested groups inside top groups */ for (v = 0; v < FILESPACE_NESTED_GROUPS; v++) { /* Create group */ - HDsprintf(objname, "%s %u", GROUP2NAME, v); + HDsnprintf(objname, sizeof(objname), "%s %u", GROUP2NAME, v); if ((group2 = H5Gopen2(group, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; /* Remove datasets inside nested groups */ for (w = 0; w < FILESPACE_NDATASETS; w++) { /* Remove dataset */ - HDsprintf(objname, "%s %u", DATASETNAME, w); + HDsnprintf(objname, sizeof(objname), "%s %u", DATASETNAME, w); if (H5Ldelete(group2, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; } /* end for */ @@ -1208,7 +1208,7 @@ test_filespace(hid_t fapl) FAIL_STACK_ERROR; /* Remove nested group */ - HDsprintf(objname, "%s %u", GROUP2NAME, v); + HDsnprintf(objname, sizeof(objname), "%s %u", GROUP2NAME, v); if (H5Ldelete(group, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; } /* end for */ @@ -1218,7 +1218,7 @@ test_filespace(hid_t fapl) FAIL_STACK_ERROR; /* Remove top group */ - HDsprintf(objname, "%s %u", GROUPNAME, (u - 1)); + HDsnprintf(objname, sizeof(objname), "%s %u", GROUPNAME, (u - 1)); if (H5Ldelete(file, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; } /* end for */ @@ -1502,7 +1502,7 @@ test_create_unlink(const char *msg, hid_t fapl) /* Create a many groups to remove */ for (u = 0; u < UNLINK_NGROUPS; u++) { - HDsprintf(groupname, "%s %u", GROUPNAME, u); + HDsnprintf(groupname, sizeof(groupname), "%s %u", GROUPNAME, u); if ((group = H5Gcreate2(file, groupname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); HDprintf("group %s creation failed\n", groupname); @@ -1517,7 +1517,7 @@ test_create_unlink(const char *msg, hid_t fapl) /* Remove the all the groups */ for (u = 0; u < UNLINK_NGROUPS; u++) { - HDsprintf(groupname, "%s %u", GROUPNAME, u); + HDsnprintf(groupname, sizeof(groupname), "%s %u", GROUPNAME, u); if (H5Ldelete(file, groupname, H5P_DEFAULT) < 0) { H5_FAILED(); HDprintf("Unlinking group %s failed\n", groupname); @@ -1765,7 +1765,7 @@ test_unlink_rightleaf(hid_t fid) /* Create all the groups */ for (n = 0; n < ngroups; n++) { - HDsprintf(name, "Zone%d", n + 1); + HDsnprintf(name, sizeof(name), "Zone%d", n + 1); if ((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; } /* end for */ @@ -1774,7 +1774,7 @@ test_unlink_rightleaf(hid_t fid) for (n = 0; n < ngroups; n++) { if (delete_node(rootid, gids[n]) < 0) TEST_ERROR; - HDsprintf(name, "Zone%d", n + 1); + HDsnprintf(name, sizeof(name), "Zone%d", n + 1); if ((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; } /* end for */ @@ -1854,7 +1854,7 @@ test_unlink_rightnode(hid_t fid) /* Create all the groups */ for (n = 0; n < ngroups; n++) { - HDsprintf(name, "ZoneB%d", n + 1); + HDsnprintf(name, sizeof(name), "ZoneB%d", n + 1); if ((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; } /* end for */ @@ -1946,7 +1946,7 @@ test_unlink_middlenode(hid_t fid) /* Create all the groups */ for (n = 0; n < ngroups; n++) { - HDsprintf(name, "ZoneC%d", n + 1); + HDsnprintf(name, sizeof(name), "ZoneC%d", n + 1); if ((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; } /* end for */ @@ -2676,7 +2676,7 @@ test_full_group_compact(hid_t fapl) /* Create several objects to link to */ for (u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - HDsprintf(objname, "keep %u\n", u); + HDsnprintf(objname, sizeof(objname), "keep %u\n", u); if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; if (H5Gclose(gid2) < 0) @@ -2713,15 +2713,15 @@ test_full_group_compact(hid_t fapl) /* Create hard links to objects in group to keep */ for (u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - HDsprintf(objname, "/keep/keep %u\n", u); - HDsprintf(objname2, "keep %u\n", u); + HDsnprintf(objname, sizeof(objname), "/keep/keep %u\n", u); + HDsnprintf(objname2, sizeof(objname2), "keep %u\n", u); if (H5Lcreate_hard(file_id, objname, gid, objname2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; } /* end for */ /* Create several objects to delete */ for (u = 0; u < FULL_GROUP_NUM_DELETE_COMPACT; u++) { - HDsprintf(objname, "delete %u\n", u); + HDsnprintf(objname, sizeof(objname), "delete %u\n", u); if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; if (H5Gclose(gid2) < 0) @@ -2742,7 +2742,7 @@ test_full_group_compact(hid_t fapl) /* Check reference count on objects to keep */ for (u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - HDsprintf(objname, "/keep/keep %u\n", u); + HDsnprintf(objname, sizeof(objname), "/keep/keep %u\n", u); if (H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; if (oi.rc != 2) @@ -2763,7 +2763,7 @@ test_full_group_compact(hid_t fapl) /* Check reference count on objects to keep */ for (u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - HDsprintf(objname, "/keep/keep %u\n", u); + HDsnprintf(objname, sizeof(objname), "/keep/keep %u\n", u); if (H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; if (oi.rc != 1) @@ -2838,7 +2838,7 @@ test_full_group_dense(hid_t fapl) /* Create several objects to link to */ for (u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - HDsprintf(objname, "keep %u\n", u); + HDsnprintf(objname, sizeof(objname), "keep %u\n", u); if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; if (H5Gclose(gid2) < 0) @@ -2890,15 +2890,15 @@ test_full_group_dense(hid_t fapl) /* Create hard links to objects in group to keep */ for (u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - HDsprintf(objname, "/keep/keep %u\n", u); - HDsprintf(objname2, "keep %u\n", u); + HDsnprintf(objname, sizeof(objname), "/keep/keep %u\n", u); + HDsnprintf(objname2, sizeof(objname2), "keep %u\n", u); if (H5Lcreate_hard(file_id, objname, gid, objname2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; } /* end for */ /* Create several objects to delete */ for (u = 0; u < FULL_GROUP_NUM_DELETE_DENSE; u++) { - HDsprintf(objname, "delete %u\n", u); + HDsnprintf(objname, sizeof(objname), "delete %u\n", u); if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; if (H5Gclose(gid2) < 0) @@ -2919,7 +2919,7 @@ test_full_group_dense(hid_t fapl) /* Check reference count on objects to keep */ for (u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - HDsprintf(objname, "/keep/keep %u\n", u); + HDsnprintf(objname, sizeof(objname), "/keep/keep %u\n", u); if (H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; if (oi.rc != 2) @@ -2940,7 +2940,7 @@ test_full_group_dense(hid_t fapl) /* Check reference count on objects to keep */ for (u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - HDsprintf(objname, "/keep/keep %u\n", u); + HDsnprintf(objname, sizeof(objname), "/keep/keep %u\n", u); if (H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; if (oi.rc != 1) diff --git a/test/vfd.c b/test/vfd.c index 412f202..b4fc742 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -1538,19 +1538,19 @@ test_multi(void) memb_map[H5FD_MEM_BTREE] = H5FD_MEM_BTREE; memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP; - HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); + HDsnprintf(sv[H5FD_MEM_SUPER], 32, "%%s-%c.h5", 's'); memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; memb_addr[H5FD_MEM_SUPER] = 0; - HDsprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); + HDsnprintf(sv[H5FD_MEM_BTREE], 32, "%%s-%c.h5", 'b'); memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE]; memb_addr[H5FD_MEM_BTREE] = HADDR_MAX / 4; - HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); + HDsnprintf(sv[H5FD_MEM_DRAW], 32, "%%s-%c.h5", 'r'); memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; memb_addr[H5FD_MEM_DRAW] = HADDR_MAX / 2; - HDsprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); + HDsnprintf(sv[H5FD_MEM_GHEAP], 32, "%%s-%c.h5", 'g'); memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP]; memb_addr[H5FD_MEM_GHEAP] = (HADDR_MAX / 4) * 3; @@ -1787,12 +1787,12 @@ test_multi_compat(void) memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; memb_fapl[H5FD_MEM_SUPER] = H5P_DEFAULT; - HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); + HDsnprintf(sv[H5FD_MEM_SUPER], 32, "%%s-%c.h5", 's'); memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; memb_addr[H5FD_MEM_SUPER] = 0; memb_fapl[H5FD_MEM_DRAW] = H5P_DEFAULT; - HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); + HDsnprintf(sv[H5FD_MEM_DRAW], 32, "%%s-%c.h5", 'r'); memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; memb_addr[H5FD_MEM_DRAW] = HADDR_MAX / 2; @@ -1804,12 +1804,12 @@ test_multi_compat(void) /* Make copy for the data file in the build directory, to protect the * original file in the source directory */ - HDsprintf(filename_s, "%s-%c.h5", MULTI_COMPAT_BASENAME, 's'); - HDsprintf(newname_s, "%s-%c.h5", FILENAME[9], 's'); + HDsnprintf(filename_s, sizeof(filename_s), "%s-%c.h5", MULTI_COMPAT_BASENAME, 's'); + HDsnprintf(newname_s, sizeof(newname_s), "%s-%c.h5", FILENAME[9], 's'); h5_make_local_copy(filename_s, newname_s); - HDsprintf(filename_r, "%s-%c.h5", MULTI_COMPAT_BASENAME, 'r'); - HDsprintf(newname_r, "%s-%c.h5", FILENAME[9], 'r'); + HDsnprintf(filename_r, sizeof(filename_r), "%s-%c.h5", MULTI_COMPAT_BASENAME, 'r'); + HDsnprintf(newname_r, sizeof(newname_r), "%s-%c.h5", FILENAME[9], 'r'); h5_make_local_copy(filename_r, newname_r); /* Reopen the file for read only. Verify 1.8 library can open file @@ -3581,12 +3581,12 @@ H5FD__ctl_test_vfd_ctl(H5FD_t H5_ATTR_UNUSED *_file, uint64_t op_code, uint64_t switch (op_code) { /* Op code for testing purposes */ - case H5FD_CTL__TEST_OPCODE: + case H5FD_CTL_TEST_OPCODE: break; /* Unknown op code */ default: - if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG) + if (flags & H5FD_CTL_FAIL_IF_UNKNOWN_FLAG) ret_value = FAIL; break; } @@ -3660,8 +3660,8 @@ run_ctl_test(uint64_t op_code, uint64_t flags, ctl_test_opc_type opc_type, hid_t char filename[1024]; /* Check for a few ctl function flags */ - fail_if_unknown = (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG); - routing_flag_set = (flags & H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG); + fail_if_unknown = (flags & H5FD_CTL_FAIL_IF_UNKNOWN_FLAG); + routing_flag_set = (flags & H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG); /* Determine if the top-level VFD is a passthrough VFD */ if ((driver_id = H5Pget_driver(fapl_id)) < 0) @@ -3761,7 +3761,7 @@ test_ctl(void) TESTING_2("known op code to terminal VFD (without fail on unknown flag)"); - op_code = H5FD_CTL__TEST_OPCODE; + op_code = H5FD_CTL_TEST_OPCODE; flags = 0; /* H5FDctl call should succeed normally */ @@ -3772,8 +3772,8 @@ test_ctl(void) TESTING_2("known op code to terminal VFD (with fail on unknown flag)"); - op_code = H5FD_CTL__TEST_OPCODE; - flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG; + op_code = H5FD_CTL_TEST_OPCODE; + flags = H5FD_CTL_FAIL_IF_UNKNOWN_FLAG; /* H5FDctl call should succeed normally */ if (run_ctl_test(op_code, flags, CTL_OPC_KNOWN_TERMINAL, fapl_id) < 0) @@ -3783,8 +3783,8 @@ test_ctl(void) TESTING_2("known op code to terminal VFD (without fail on unknown flag/route to terminal VFD)"); - op_code = H5FD_CTL__TEST_OPCODE; - flags = H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + op_code = H5FD_CTL_TEST_OPCODE; + flags = H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG; /* H5FDctl call should succeed normally */ if (run_ctl_test(op_code, flags, CTL_OPC_KNOWN_TERMINAL, fapl_id) < 0) @@ -3794,8 +3794,8 @@ test_ctl(void) TESTING_2("known op code to terminal VFD (with fail on unknown flag/route to terminal VFD)"); - op_code = H5FD_CTL__TEST_OPCODE; - flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + op_code = H5FD_CTL_TEST_OPCODE; + flags = H5FD_CTL_FAIL_IF_UNKNOWN_FLAG | H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG; /* H5FDctl call should succeed normally */ if (run_ctl_test(op_code, flags, CTL_OPC_KNOWN_TERMINAL, fapl_id) < 0) @@ -3817,7 +3817,7 @@ test_ctl(void) TESTING_2("unknown op code to terminal VFD (with fail on unknown flag)"); op_code = H5FD_CTL_OPC_RESERVED; - flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG; + flags = H5FD_CTL_FAIL_IF_UNKNOWN_FLAG; /* H5FDctl call should fail due to 'fail if unknown' flag being specified */ if (run_ctl_test(op_code, flags, CTL_OPC_UNKNOWN, fapl_id) < 0) @@ -3828,7 +3828,7 @@ test_ctl(void) TESTING_2("unknown op code to terminal VFD (without fail on unknown flag/route to terminal VFD)"); op_code = H5FD_CTL_OPC_RESERVED; - flags = H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + flags = H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG; /* H5FDctl call should silently ignore unknown op code and succeed */ if (run_ctl_test(op_code, flags, CTL_OPC_UNKNOWN, fapl_id) < 0) @@ -3839,7 +3839,7 @@ test_ctl(void) TESTING_2("unknown op code to terminal VFD (with fail on unknown flag/route to terminal VFD)"); op_code = H5FD_CTL_OPC_RESERVED; - flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + flags = H5FD_CTL_FAIL_IF_UNKNOWN_FLAG | H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG; /* H5FDctl call should fail due to 'fail if unknown' flag being specified */ if (run_ctl_test(op_code, flags, CTL_OPC_UNKNOWN, fapl_id) < 0) @@ -3870,7 +3870,7 @@ test_ctl(void) TESTING_2("known op code through passthrough VFD to terminal VFD (without fail on unknown flag/no " "routing flag)"); - op_code = H5FD_CTL__TEST_OPCODE; + op_code = H5FD_CTL_TEST_OPCODE; flags = 0; /* @@ -3886,8 +3886,8 @@ test_ctl(void) TESTING_2( "known op code through passthrough VFD to terminal VFD (with fail on unknown flag/no routing flag)"); - op_code = H5FD_CTL__TEST_OPCODE; - flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG; + op_code = H5FD_CTL_TEST_OPCODE; + flags = H5FD_CTL_FAIL_IF_UNKNOWN_FLAG; /* * H5FDctl call should fail since op code is unknown to @@ -3903,8 +3903,8 @@ test_ctl(void) TESTING_2("known op code through passthrough VFD to terminal VFD (without fail on unknown flag/route to " "terminal VFD)"); - op_code = H5FD_CTL__TEST_OPCODE; - flags = H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + op_code = H5FD_CTL_TEST_OPCODE; + flags = H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG; /* * H5Dctl call should succeed since the passthrough VFD @@ -3919,8 +3919,8 @@ test_ctl(void) TESTING_2("known op code through passthrough VFD to terminal VFD (with fail on unknown flag/route to " "terminal VFD)"); - op_code = H5FD_CTL__TEST_OPCODE; - flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + op_code = H5FD_CTL_TEST_OPCODE; + flags = H5FD_CTL_FAIL_IF_UNKNOWN_FLAG | H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG; /* * H5Dctl call should succeed since the passthrough VFD @@ -3950,7 +3950,7 @@ test_ctl(void) TESTING_2("unknown op code to passthrough VFD (with fail on unknown flag)"); op_code = H5FD_CTL_OPC_RESERVED; - flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG; + flags = H5FD_CTL_FAIL_IF_UNKNOWN_FLAG; /* * H5FDctl call should fail since op code is unknown to @@ -3965,7 +3965,7 @@ test_ctl(void) TESTING_2("unknown op code to passthrough VFD (without fail on unknown flag/route to terminal VFD)"); op_code = H5FD_CTL_OPC_RESERVED; - flags = H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + flags = H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG; /* * H5Dctl call should succeed since the passthrough VFD @@ -3983,7 +3983,7 @@ test_ctl(void) TESTING_2("unknown op code to passthrough VFD (with fail on unknown flag/route to terminal VFD)"); op_code = H5FD_CTL_OPC_RESERVED; - flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + flags = H5FD_CTL_FAIL_IF_UNKNOWN_FLAG | H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG; /* * H5Dctl call should fail since the passthrough VFD diff --git a/testpar/t_2Gio.c b/testpar/t_2Gio.c index 554d4ec..ad8a15e 100644 --- a/testpar/t_2Gio.c +++ b/testpar/t_2Gio.c @@ -522,8 +522,8 @@ dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[] } /* NOTE: This is a memory intensive test and is only run - * with 2 MPI ranks and with $HDF5TestExpress == 0 - * i.e. Exhaustive test run is allowed. Otherwise + * with 2 MPI ranks and with a testing express level + * of 0, i.e. Exhaustive test run is allowed. Otherwise * the test is skipped. * * Thanks to l.ferraro@cineca.it for the following test:: @@ -3323,7 +3323,7 @@ none_selection_chunk(void) * Simple independent I/O. This tests that the defaults are properly set. * * TEST_ACTUAL_IO_RESET: - * Performs collective and then independent I/O with hthe same dxpl to + * Performs collective and then independent I/O with the same dxpl to * make sure the peroperty is correctly reset to the default on each use. * Specifically, this test runs TEST_ACTUAL_IO_MULTI_CHUNK_NO_OPT_MIX_DISAGREE * (The most complex case that works on all builds) and then performs @@ -3704,9 +3704,10 @@ test_actual_io_mode(int selection_mode) /* Test values */ if (actual_chunk_opt_mode_expected != (H5D_mpio_actual_chunk_opt_mode_t)-1 && actual_io_mode_expected != (H5D_mpio_actual_io_mode_t)-1) { - HDsprintf(message, "Actual Chunk Opt Mode has the correct value for %s.\n", test_name); + HDsnprintf(message, sizeof(message), "Actual Chunk Opt Mode has the correct value for %s.\n", + test_name); VRFY((actual_chunk_opt_mode_write == actual_chunk_opt_mode_expected), message); - HDsprintf(message, "Actual IO Mode has the correct value for %s.\n", test_name); + HDsnprintf(message, sizeof(message), "Actual IO Mode has the correct value for %s.\n", test_name); VRFY((actual_io_mode_write == actual_io_mode_expected), message); } else { @@ -4100,10 +4101,12 @@ test_no_collective_cause_mode(int selection_mode) /* Test values */ HDmemset(message, 0, sizeof(message)); - HDsprintf(message, "Local cause of Broken Collective I/O has the correct value for %s.\n", test_name); + HDsnprintf(message, sizeof(message), + "Local cause of Broken Collective I/O has the correct value for %s.\n", test_name); VRFY((no_collective_cause_local_write == no_collective_cause_local_expected), message); HDmemset(message, 0, sizeof(message)); - HDsprintf(message, "Global cause of Broken Collective I/O has the correct value for %s.\n", test_name); + HDsnprintf(message, sizeof(message), + "Global cause of Broken Collective I/O has the correct value for %s.\n", test_name); VRFY((no_collective_cause_global_write == no_collective_cause_global_expected), message); /* Release some resources */ diff --git a/testpar/t_dset.c b/testpar/t_dset.c index eb11b32..f34cc1d 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -3262,9 +3262,10 @@ test_actual_io_mode(int selection_mode) /* Test values */ if (actual_chunk_opt_mode_expected != (H5D_mpio_actual_chunk_opt_mode_t)-1 && actual_io_mode_expected != (H5D_mpio_actual_io_mode_t)-1) { - HDsprintf(message, "Actual Chunk Opt Mode has the correct value for %s.\n", test_name); + HDsnprintf(message, sizeof(message), "Actual Chunk Opt Mode has the correct value for %s.\n", + test_name); VRFY((actual_chunk_opt_mode_write == actual_chunk_opt_mode_expected), message); - HDsprintf(message, "Actual IO Mode has the correct value for %s.\n", test_name); + HDsnprintf(message, sizeof(message), "Actual IO Mode has the correct value for %s.\n", test_name); VRFY((actual_io_mode_write == actual_io_mode_expected), message); } else { diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index 339ca33..54d75e6 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -183,7 +183,7 @@ multiple_dset_write(void) VRFY((ret >= 0), "set fill-value succeeded"); for (n = 0; n < ndatasets; n++) { - HDsprintf(dname, "dataset %d", n); + HDsnprintf(dname, sizeof(dname), "dataset %d", n); dataset = H5Dcreate2(iof, dname, H5T_NATIVE_DOUBLE, filespace, H5P_DEFAULT, dcpl, H5P_DEFAULT); VRFY((dataset > 0), dname); @@ -878,11 +878,11 @@ collective_group_write(void) /* creates ngroups groups under the root group, writes chunked * datasets in parallel. */ for (m = 0; m < ngroups; m++) { - HDsprintf(gname, "group%d", m); + HDsnprintf(gname, sizeof(gname), "group%d", m); gid = H5Gcreate2(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((gid > 0), gname); - HDsprintf(dname, "dataset%d", m); + HDsnprintf(dname, sizeof(dname), "dataset%d", m); did = H5Dcreate2(gid, dname, H5T_NATIVE_INT, filespace, H5P_DEFAULT, dcpl, H5P_DEFAULT); VRFY((did > 0), dname); @@ -979,12 +979,12 @@ group_dataset_read(hid_t fid, int mpi_rank, int m) VRFY((outdata != NULL), "HDmalloc succeeded for outdata"); /* open every group under root group. */ - HDsprintf(gname, "group%d", m); + HDsnprintf(gname, sizeof(gname), "group%d", m); gid = H5Gopen2(fid, gname, H5P_DEFAULT); VRFY((gid > 0), gname); /* check the data. */ - HDsprintf(dname, "dataset%d", m); + HDsnprintf(dname, sizeof(dname), "dataset%d", m); did = H5Dopen2(gid, dname, H5P_DEFAULT); VRFY((did > 0), dname); @@ -1080,7 +1080,7 @@ multiple_group_write(void) /* creates ngroups groups under the root group, writes datasets in * parallel. */ for (m = 0; m < ngroups; m++) { - HDsprintf(gname, "group%d", m); + HDsnprintf(gname, sizeof(gname), "group%d", m); gid = H5Gcreate2(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((gid > 0), gname); @@ -1136,7 +1136,7 @@ write_dataset(hid_t memspace, hid_t filespace, hid_t gid) VRFY((outme != NULL), "HDmalloc succeeded for outme"); for (n = 0; n < NDATASET; n++) { - HDsprintf(dname, "dataset%d", n); + HDsnprintf(dname, sizeof(dname), "dataset%d", n); did = H5Dcreate2(gid, dname, H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((did > 0), dname); @@ -1174,7 +1174,7 @@ create_group_recursive(hid_t memspace, hid_t filespace, hid_t gid, int counter) } #endif /* BARRIER_CHECKS */ - HDsprintf(gname, "%dth_child_group", counter + 1); + HDsnprintf(gname, sizeof(gname), "%dth_child_group", counter + 1); child_gid = H5Gcreate2(gid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((child_gid > 0), gname); @@ -1228,7 +1228,7 @@ multiple_group_read(void) /* open every group under root group. */ for (m = 0; m < ngroups; m++) { - HDsprintf(gname, "group%d", m); + HDsnprintf(gname, sizeof(gname), "group%d", m); gid = H5Gopen2(fid, gname, H5P_DEFAULT); VRFY((gid > 0), gname); @@ -1285,7 +1285,7 @@ read_dataset(hid_t memspace, hid_t filespace, hid_t gid) VRFY((outdata != NULL), "HDmalloc succeeded for outdata"); for (n = 0; n < NDATASET; n++) { - HDsprintf(dname, "dataset%d", n); + HDsnprintf(dname, sizeof(dname), "dataset%d", n); did = H5Dopen2(gid, dname, H5P_DEFAULT); VRFY((did > 0), dname); @@ -1336,7 +1336,7 @@ recursive_read_group(hid_t memspace, hid_t filespace, hid_t gid, int counter) nerrors += err_num; if (counter < GROUP_DEPTH) { - HDsprintf(gname, "%dth_child_group", counter + 1); + HDsnprintf(gname, sizeof(gname), "%dth_child_group", counter + 1); child_gid = H5Gopen2(gid, gname, H5P_DEFAULT); VRFY((child_gid > 0), gname); recursive_read_group(memspace, filespace, child_gid, counter + 1); @@ -1358,7 +1358,7 @@ write_attribute(hid_t obj_id, int this_type, int num) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); if (this_type == is_group) { - HDsprintf(attr_name, "Group Attribute %d", num); + HDsnprintf(attr_name, sizeof(attr_name), "Group Attribute %d", num); sid = H5Screate(H5S_SCALAR); aid = H5Acreate2(obj_id, attr_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT); H5Awrite(aid, H5T_NATIVE_INT, &num); @@ -1366,7 +1366,7 @@ write_attribute(hid_t obj_id, int this_type, int num) H5Sclose(sid); } /* end if */ else if (this_type == is_dset) { - HDsprintf(attr_name, "Dataset Attribute %d", num); + HDsnprintf(attr_name, sizeof(attr_name), "Dataset Attribute %d", num); for (i = 0; i < 8; i++) attr_data[i] = i; sid = H5Screate_simple(dspace_rank, dspace_dims, NULL); @@ -1389,14 +1389,14 @@ read_attribute(hid_t obj_id, int this_type, int num) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); if (this_type == is_group) { - HDsprintf(attr_name, "Group Attribute %d", num); + HDsnprintf(attr_name, sizeof(attr_name), "Group Attribute %d", num); aid = H5Aopen(obj_id, attr_name, H5P_DEFAULT); H5Aread(aid, H5T_NATIVE_INT, &in_num); vrfy_errors = dataset_vrfy(NULL, NULL, NULL, group_block, &in_num, &num); H5Aclose(aid); } else if (this_type == is_dset) { - HDsprintf(attr_name, "Dataset Attribute %d", num); + HDsnprintf(attr_name, sizeof(attr_name), "Dataset Attribute %d", num); for (i = 0; i < 8; i++) out_data[i] = i; aid = H5Aopen(obj_id, attr_name, H5P_DEFAULT); diff --git a/testpar/t_prop.c b/testpar/t_prop.c index 930b895..c08a022 100644 --- a/testpar/t_prop.c +++ b/testpar/t_prop.c @@ -69,14 +69,22 @@ test_encode_decode(hid_t orig_pl, int mpi_rank, int recv_proc) HDfree(rbuf); } /* end if */ - if (0 == mpi_rank) + if (0 == mpi_rank) { + /* gcc 11 complains about passing MPI_STATUSES_IGNORE as an MPI_Status + * array. See the discussion here: + * + * https://github.com/pmodels/mpich/issues/5687 + */ + H5_GCC_DIAG_OFF("stringop-overflow") MPI_Waitall(2, req, MPI_STATUSES_IGNORE); + H5_GCC_DIAG_ON("stringop-overflow") + } if (NULL != sbuf) HDfree(sbuf); MPI_Barrier(MPI_COMM_WORLD); - return (0); + return 0; } void diff --git a/testpar/t_vfd.c b/testpar/t_vfd.c index 81e4983..ad296ad 100644 --- a/testpar/t_vfd.c +++ b/testpar/t_vfd.c @@ -571,17 +571,20 @@ vector_read_test_1(int file_name_id, int mpi_rank, int mpi_size, H5FD_mpio_xfer_ if (xfer_mode == H5FD_MPIO_INDEPENDENT) { - sprintf(test_title, "parallel vector read test 1 -- %s / independent", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector read test 1 -- %s / independent", + vfd_name); } else if (coll_opt_mode == H5FD_MPIO_INDIVIDUAL_IO) { - sprintf(test_title, "parallel vector read test 1 -- %s / col op / ind I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector read test 1 -- %s / col op / ind I/O", + vfd_name); } else { HDassert(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO); - sprintf(test_title, "parallel vector read test 1 -- %s / col op / col I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector read test 1 -- %s / col op / col I/O", + vfd_name); } TESTING(test_title); @@ -817,17 +820,20 @@ vector_read_test_2(int file_name_id, int mpi_rank, int mpi_size, H5FD_mpio_xfer_ if (xfer_mode == H5FD_MPIO_INDEPENDENT) { - sprintf(test_title, "parallel vector read test 2 -- %s / independent", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector read test 2 -- %s / independent", + vfd_name); } else if (coll_opt_mode == H5FD_MPIO_INDIVIDUAL_IO) { - sprintf(test_title, "parallel vector read test 2 -- %s / col op / ind I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector read test 2 -- %s / col op / ind I/O", + vfd_name); } else { HDassert(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO); - sprintf(test_title, "parallel vector read test 2 -- %s / col op / col I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector read test 2 -- %s / col op / col I/O", + vfd_name); } TESTING(test_title); @@ -1139,17 +1145,20 @@ vector_read_test_3(int file_name_id, int mpi_rank, int mpi_size, H5FD_mpio_xfer_ if (xfer_mode == H5FD_MPIO_INDEPENDENT) { - sprintf(test_title, "parallel vector read test 3 -- %s / independent", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector read test 3 -- %s / independent", + vfd_name); } else if (coll_opt_mode == H5FD_MPIO_INDIVIDUAL_IO) { - sprintf(test_title, "parallel vector read test 3 -- %s / col op / ind I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector read test 3 -- %s / col op / ind I/O", + vfd_name); } else { HDassert(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO); - sprintf(test_title, "parallel vector read test 3 -- %s / col op / col I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector read test 3 -- %s / col op / col I/O", + vfd_name); } TESTING(test_title); @@ -1508,17 +1517,20 @@ vector_read_test_4(int file_name_id, int mpi_rank, int mpi_size, H5FD_mpio_xfer_ if (xfer_mode == H5FD_MPIO_INDEPENDENT) { - sprintf(test_title, "parallel vector read test 4 -- %s / independent", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector read test 4 -- %s / independent", + vfd_name); } else if (coll_opt_mode == H5FD_MPIO_INDIVIDUAL_IO) { - sprintf(test_title, "parallel vector read test 4 -- %s / col op / ind I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector read test 4 -- %s / col op / ind I/O", + vfd_name); } else { HDassert(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO); - sprintf(test_title, "parallel vector read test 4 -- %s / col op / col I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector read test 4 -- %s / col op / col I/O", + vfd_name); } TESTING(test_title); @@ -1951,17 +1963,20 @@ vector_read_test_5(int file_name_id, int mpi_rank, int mpi_size, H5FD_mpio_xfer_ if (xfer_mode == H5FD_MPIO_INDEPENDENT) { - sprintf(test_title, "parallel vector read test 5 -- %s / independent", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector read test 5 -- %s / independent", + vfd_name); } else if (coll_opt_mode == H5FD_MPIO_INDIVIDUAL_IO) { - sprintf(test_title, "parallel vector read test 5 -- %s / col op / ind I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector read test 5 -- %s / col op / ind I/O", + vfd_name); } else { HDassert(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO); - sprintf(test_title, "parallel vector read test 5 -- %s / col op / col I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector read test 5 -- %s / col op / col I/O", + vfd_name); } TESTING(test_title); @@ -2204,17 +2219,20 @@ vector_write_test_1(int file_name_id, int mpi_rank, int mpi_size, H5FD_mpio_xfer if (xfer_mode == H5FD_MPIO_INDEPENDENT) { - sprintf(test_title, "parallel vector write test 1 -- %s / independent", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector write test 1 -- %s / independent", + vfd_name); } else if (coll_opt_mode == H5FD_MPIO_INDIVIDUAL_IO) { - sprintf(test_title, "parallel vector write test 1 -- %s / col op / ind I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector write test 1 -- %s / col op / ind I/O", + vfd_name); } else { HDassert(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO); - sprintf(test_title, "parallel vector write test 1 -- %s / col op / col I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector write test 1 -- %s / col op / col I/O", + vfd_name); } TESTING(test_title); @@ -2403,17 +2421,20 @@ vector_write_test_2(int file_name_id, int mpi_rank, int mpi_size, H5FD_mpio_xfer if (xfer_mode == H5FD_MPIO_INDEPENDENT) { - sprintf(test_title, "parallel vector write test 2 -- %s / independent", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector write test 2 -- %s / independent", + vfd_name); } else if (coll_opt_mode == H5FD_MPIO_INDIVIDUAL_IO) { - sprintf(test_title, "parallel vector write test 2 -- %s / col op / ind I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector write test 2 -- %s / col op / ind I/O", + vfd_name); } else { HDassert(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO); - sprintf(test_title, "parallel vector write test 2 -- %s / col op / col I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector write test 2 -- %s / col op / col I/O", + vfd_name); } TESTING(test_title); @@ -2668,17 +2689,20 @@ vector_write_test_3(int file_name_id, int mpi_rank, int mpi_size, H5FD_mpio_xfer if (xfer_mode == H5FD_MPIO_INDEPENDENT) { - sprintf(test_title, "parallel vector write test 3 -- %s / independent", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector write test 3 -- %s / independent", + vfd_name); } else if (coll_opt_mode == H5FD_MPIO_INDIVIDUAL_IO) { - sprintf(test_title, "parallel vector write test 3 -- %s / col op / ind I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector write test 3 -- %s / col op / ind I/O", + vfd_name); } else { HDassert(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO); - sprintf(test_title, "parallel vector write test 3 -- %s / col op / col I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector write test 3 -- %s / col op / col I/O", + vfd_name); } TESTING(test_title); @@ -2950,17 +2974,20 @@ vector_write_test_4(int file_name_id, int mpi_rank, int mpi_size, H5FD_mpio_xfer if (xfer_mode == H5FD_MPIO_INDEPENDENT) { - sprintf(test_title, "parallel vector write test 4 -- %s / independent", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector write test 4 -- %s / independent", + vfd_name); } else if (coll_opt_mode == H5FD_MPIO_INDIVIDUAL_IO) { - sprintf(test_title, "parallel vector write test 4 -- %s / col op / ind I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector write test 4 -- %s / col op / ind I/O", + vfd_name); } else { HDassert(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO); - sprintf(test_title, "parallel vector write test 4 -- %s / col op / col I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector write test 4 -- %s / col op / col I/O", + vfd_name); } TESTING(test_title); @@ -3269,17 +3296,20 @@ vector_write_test_5(int file_name_id, int mpi_rank, int mpi_size, H5FD_mpio_xfer if (xfer_mode == H5FD_MPIO_INDEPENDENT) { - sprintf(test_title, "parallel vector write test 5 -- %s / independent", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector write test 5 -- %s / independent", + vfd_name); } else if (coll_opt_mode == H5FD_MPIO_INDIVIDUAL_IO) { - sprintf(test_title, "parallel vector write test 5 -- %s / col op / ind I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector write test 5 -- %s / col op / ind I/O", + vfd_name); } else { HDassert(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO); - sprintf(test_title, "parallel vector write test 5 -- %s / col op / col I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector write test 5 -- %s / col op / col I/O", + vfd_name); } TESTING(test_title); @@ -3701,17 +3731,20 @@ vector_write_test_6(int file_name_id, int mpi_rank, int mpi_size, H5FD_mpio_xfer if (xfer_mode == H5FD_MPIO_INDEPENDENT) { - sprintf(test_title, "parallel vector write test 6 -- %s / independent", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector write test 6 -- %s / independent", + vfd_name); } else if (coll_opt_mode == H5FD_MPIO_INDIVIDUAL_IO) { - sprintf(test_title, "parallel vector write test 6 -- %s / col op / ind I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector write test 6 -- %s / col op / ind I/O", + vfd_name); } else { HDassert(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO); - sprintf(test_title, "parallel vector write test 6 -- %s / col op / col I/O", vfd_name); + snprintf(test_title, sizeof(test_title), "parallel vector write test 6 -- %s / col op / col I/O", + vfd_name); } TESTING(test_title); diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index a7156b5..9fa3ccc 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -31,33 +31,29 @@ #define UI_FORMAT "%-15u %-15u %-15u\n" #define LI_FORMAT "%-15ld %-15ld %-15ld\n" #define ULI_FORMAT "%-15lu %-15lu %-15lu\n" -#define LLI_FORMAT "%-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d\n" -#define ULLI_FORMAT "%-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "u\n" +#define LLI_FORMAT "%-15lld %-15lld %-15lld\n" +#define ULLI_FORMAT "%-15llu %-15llu %-15llu\n" /* with -p option */ -#define F_FORMAT_P "%-15.10g %-15.10g %-15.10g %-14.10g\n" -#define LD_FORMAT_P "%-15.10Lg %-15.10Lg %-15.10Lg %-14.10Lg\n" -#define I_FORMAT_P "%-15d %-15d %-15d %-14f\n" -#define UI_FORMAT_P "%-15u %-15u %-15u %-14f\n" -#define LI_FORMAT_P "%-15ld %-15ld %-15ld %-14f\n" -#define ULI_FORMAT_P "%-15lu %-15lu %-15lu %-14f\n" -#define LLI_FORMAT_P \ - "%-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d %-14f\n" -#define ULLI_FORMAT_P \ - "%-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "d %-14f\n" -#define SPACES " " +#define F_FORMAT_P "%-15.10g %-15.10g %-15.10g %-14.10g\n" +#define LD_FORMAT_P "%-15.10Lg %-15.10Lg %-15.10Lg %-14.10Lg\n" +#define I_FORMAT_P "%-15d %-15d %-15d %-14f\n" +#define UI_FORMAT_P "%-15u %-15u %-15u %-14f\n" +#define LI_FORMAT_P "%-15ld %-15ld %-15ld %-14f\n" +#define ULI_FORMAT_P "%-15lu %-15lu %-15lu %-14f\n" +#define LLI_FORMAT_P "%-15lld %-15lld %-15lld %-14f\n" +#define ULLI_FORMAT_P "%-15llu %-15llu %-15lld %-14f\n" +#define SPACES " " /* not comparable */ -#define F_FORMAT_P_NOTCOMP "%-15.10g %-15.10g %-15.10g not comparable\n" -#define LD_FORMAT_P_NOTCOMP "%-15.10Lg %-15.10Lg %-15.10Lg not comparable\n" -#define I_FORMAT_P_NOTCOMP "%-15d %-15d %-15d not comparable\n" -#define UI_FORMAT_P_NOTCOMP "%-15u %-15u %-15u not comparable\n" -#define LI_FORMAT_P_NOTCOMP "%-15ld %-15ld %-15ld not comparable\n" -#define ULI_FORMAT_P_NOTCOMP "%-15lu %-15lu %-15lu not comparable\n" -#define LLI_FORMAT_P_NOTCOMP \ - "%-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d not comparable\n" -#define ULLI_FORMAT_P_NOTCOMP \ - "%-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "d not comparable\n" +#define F_FORMAT_P_NOTCOMP "%-15.10g %-15.10g %-15.10g not comparable\n" +#define LD_FORMAT_P_NOTCOMP "%-15.10Lg %-15.10Lg %-15.10Lg not comparable\n" +#define I_FORMAT_P_NOTCOMP "%-15d %-15d %-15d not comparable\n" +#define UI_FORMAT_P_NOTCOMP "%-15u %-15u %-15u not comparable\n" +#define LI_FORMAT_P_NOTCOMP "%-15ld %-15ld %-15ld not comparable\n" +#define ULI_FORMAT_P_NOTCOMP "%-15lu %-15lu %-15lu not comparable\n" +#define LLI_FORMAT_P_NOTCOMP "%-15lld %-15lld %-15lld not comparable\n" +#define ULLI_FORMAT_P_NOTCOMP "%-15llu %-15llu %-15lld not comparable\n" /* if system EPSILON is defined, use the system EPSILON; otherwise, use constants that are close to most EPSILON values */ diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 5976044..5ade61f 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -660,8 +660,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai H5TOOLS_START_DEBUG(" "); /* Build default formats for long long types */ if (!fmt_llong[0]) { - HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%%sd", H5_PRINTF_LL_WIDTH); - HDsnprintf(fmt_ullong, sizeof(fmt_ullong), "%%%su", H5_PRINTF_LL_WIDTH); + HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%lld"); + HDsnprintf(fmt_ullong, sizeof(fmt_ullong), "%%llu"); } /* Append value depending on data type */ diff --git a/tools/src/h5perf/perf.c b/tools/src/h5perf/perf.c index 84be7e8..270af57 100644 --- a/tools/src/h5perf/perf.c +++ b/tools/src/h5perf/perf.c @@ -457,7 +457,7 @@ parse_args(int argc, char **argv) } } - return (0); + return 0; } /*------------------------------------------------------------------------- * Function: getenv_all @@ -478,14 +478,9 @@ parse_args(int argc, char **argv) * Programmer: Leon Arber * 4/4/05 * - * Modifications: - * Use original getenv if MPI is not initialized. This happens - * one uses the PHDF5 library to build a serial nature code. - * Albert 2006/04/07 - * *------------------------------------------------------------------------- */ -char * +static char * getenv_all(MPI_Comm comm, int root, const char *name) { int mpi_size, mpi_rank, mpi_initialized, mpi_finalized; @@ -539,7 +534,9 @@ getenv_all(MPI_Comm comm, int root, const char *name) #endif } else { - /* use original getenv */ + /* Use the original getenv if MPI is not initialized. This happens + * if you use the parallel HDF5 library to build a serial program. + */ if (env) HDfree(env); env = HDgetenv(name); diff --git a/tools/src/h5perf/pio_engine.c b/tools/src/h5perf/pio_engine.c index 1baaca2..b546c43 100644 --- a/tools/src/h5perf/pio_engine.c +++ b/tools/src/h5perf/pio_engine.c @@ -146,7 +146,7 @@ do_pio(parameters param) file_descr fd; iotype iot; - char fname[FILENAME_MAX]; + char *fname = NULL; long nf; long ndsets; off_t nbytes; /*number of bytes per dataset */ @@ -168,6 +168,9 @@ do_pio(parameters param) /* IO type */ iot = param.io_type; + if (NULL == (fname = HDcalloc(FILENAME_MAX, sizeof(char)))) + GOTOERROR(FAIL); + switch (iot) { case MPIO: fd.mpifd = MPI_FILE_NULL; @@ -234,7 +237,7 @@ do_pio(parameters param) } if ((snbytes % pio_mpi_nprocs_g) != 0) { HDfprintf(stderr, - "Dataset size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the " + "Dataset size (%lld) must be a multiple of the " "number of processes (%d)\n", (long long)snbytes, pio_mpi_nprocs_g); GOTOERROR(FAIL); @@ -243,7 +246,7 @@ do_pio(parameters param) if (!param.dim2d) { if (((size_t)(snbytes / pio_mpi_nprocs_g) % buf_size) != 0) { HDfprintf(stderr, - "Dataset size/process (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the " + "Dataset size/process (%lld) must be a multiple of the " "transfer buffer size (%zu)\n", (long long)(snbytes / pio_mpi_nprocs_g), buf_size); GOTOERROR(FAIL); @@ -252,7 +255,7 @@ do_pio(parameters param) else { if (((size_t)snbytes % buf_size) != 0) { HDfprintf(stderr, - "Dataset side size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the " + "Dataset side size (%lld) must be a multiple of the " "transfer buffer size (%zu)\n", (long long)snbytes, buf_size); GOTOERROR(FAIL); @@ -283,7 +286,7 @@ do_pio(parameters param) char base_name[256]; HDsnprintf(base_name, sizeof(base_name), "#pio_tmp_%lu", nf); - pio_create_filename(iot, base_name, fname, sizeof(fname)); + pio_create_filename(iot, base_name, fname, FILENAME_MAX); if (pio_debug_level > 0) HDfprintf(output, "rank %d: data filename=%s\n", pio_mpi_rank_g, fname); @@ -365,8 +368,8 @@ done: } /* release generic resources */ - if (buffer) - HDfree(buffer); + HDfree(buffer); + HDfree(fname); res.ret_code = ret_code; return res; } @@ -625,15 +628,13 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nby if (!parms->dim2d) { HDfprintf(output, "Debug(do_write): " - "buf_size=%zu, bytes_begin=%" H5_PRINTF_LL_WIDTH "d, bytes_count=%" H5_PRINTF_LL_WIDTH - "d\n", + "buf_size=%zu, bytes_begin=%lld, bytes_count=%lld\n", buf_size, (long long)bytes_begin[0], (long long)bytes_count); } else { HDfprintf(output, "Debug(do_write): " - "linear buf_size=%zu, bytes_begin=(%" H5_PRINTF_LL_WIDTH "d,%" H5_PRINTF_LL_WIDTH - "d), bytes_count=%" H5_PRINTF_LL_WIDTH "d\n", + "linear buf_size=%zu, bytes_begin=(%lld,%lld), bytes_count=%lld\n", buf_size * blk_size, (long long)bytes_begin[0], (long long)bytes_begin[1], (long long)bytes_count); } @@ -1640,15 +1641,13 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nbyt if (!parms->dim2d) { HDfprintf(output, "Debug(do_write): " - "buf_size=%zu, bytes_begin=%" H5_PRINTF_LL_WIDTH "d, bytes_count=%" H5_PRINTF_LL_WIDTH - "d\n", + "buf_size=%zu, bytes_begin=%lld, bytes_count=%lld\n", buf_size, (long long)bytes_begin[0], (long long)bytes_count); } else { HDfprintf(output, "Debug(do_write): " - "linear buf_size=%zu, bytes_begin=(%" H5_PRINTF_LL_WIDTH "d,%" H5_PRINTF_LL_WIDTH - "d), bytes_count=%" H5_PRINTF_LL_WIDTH "d\n", + "linear buf_size=%zu, bytes_begin=(%lld,%lld), bytes_count=%lld\n", buf_size * blk_size, (long long)bytes_begin[0], (long long)bytes_begin[1], (long long)bytes_count); } diff --git a/tools/src/h5perf/pio_perf.c b/tools/src/h5perf/pio_perf.c index 003c4f2..7ebbefa 100644 --- a/tools/src/h5perf/pio_perf.c +++ b/tools/src/h5perf/pio_perf.c @@ -1121,25 +1121,25 @@ recover_size_and_print(long long val, const char *end) if (val >= ONE_MB && (val % ONE_MB) == 0) { if (val >= ONE_GB && (val % ONE_GB) == 0) HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" + "%lld" "GB%s", val / ONE_GB, end); else HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" + "%lld" "MB%s", val / ONE_MB, end); } else { HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" + "%lld" "KB%s", val / ONE_KB, end); } } else { HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" + "%lld" "%s", val, end); } diff --git a/tools/src/h5perf/sio_engine.c b/tools/src/h5perf/sio_engine.c index abf8b9a..7781f80 100644 --- a/tools/src/h5perf/sio_engine.c +++ b/tools/src/h5perf/sio_engine.c @@ -179,7 +179,7 @@ do_sio(parameters param, results *res) if ((param.dset_size[i] % param.buf_size[i]) != 0) { HDfprintf(stderr, - "Dataset size[%d] (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the " + "Dataset size[%d] (%lld) must be a multiple of the " "transfer buffer size[%d] (%zu)\n", param.rank, (long long)param.dset_size[i], param.rank, param.buf_size[i]); GOTOERROR(FAIL); @@ -203,7 +203,7 @@ do_sio(parameters param, results *res) /* Open file for write */ HDstrcpy(base_name, "#sio_tmp"); - sio_create_filename(iot, base_name, fname, sizeof(fname), ¶m); + sio_create_filename(iot, base_name, fname, FILENAME_MAX, ¶m); if (sio_debug_level > 0) HDfprintf(output, "data filename=%s\n", fname); @@ -522,7 +522,7 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer) } /* end if */ } /* end if */ - HDsprintf(dname, "Dataset_%ld", (unsigned long)parms->num_bytes); + HDsnprintf(dname, sizeof(dname), "Dataset_%ld", (unsigned long)parms->num_bytes); h5ds_id = H5Dcreate2(fd->h5fd, dname, ELMT_H5_TYPE, h5dset_space_id, H5P_DEFAULT, h5dcpl, H5P_DEFAULT); @@ -851,7 +851,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) break; case HDF5: - HDsprintf(dname, "Dataset_%ld", (long)parms->num_bytes); + HDsnprintf(dname, sizeof(dname), "Dataset_%ld", (long)parms->num_bytes); h5ds_id = H5Dopen2(fd->h5fd, dname, H5P_DEFAULT); if (h5ds_id < 0) { HDfprintf(stderr, "HDF5 Dataset open failed\n"); @@ -1181,7 +1181,7 @@ set_vfd(parameters *param) return -1; for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { memb_fapl[mt] = H5P_DEFAULT; - HDsprintf(sv->arr[mt], "%%s-%c.h5", multi_letters[mt]); + HDsnprintf(sv->arr[mt], 1024, "%%s-%c.h5", multi_letters[mt]); memb_name[mt] = sv->arr[mt]; memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); } diff --git a/tools/src/h5perf/sio_perf.c b/tools/src/h5perf/sio_perf.c index dc2e15e..5432d6c 100644 --- a/tools/src/h5perf/sio_perf.c +++ b/tools/src/h5perf/sio_perf.c @@ -674,25 +674,25 @@ recover_size_and_print(long long val, const char *end) if (val >= ONE_MB && (val % ONE_MB) == 0) { if (val >= ONE_GB && (val % ONE_GB) == 0) HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" + "%lld" "GB%s", val / ONE_GB, end); else HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" + "%lld" "MB%s", val / ONE_MB, end); } else { HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" + "%lld" "KB%s", val / ONE_KB, end); } } else { HDfprintf(output, - "%" H5_PRINTF_LL_WIDTH "d" + "%lld" "%s", val, end); } diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index c38a431..25df5c7 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -1531,7 +1531,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr, pack_opt_ { unsigned level = cd_values[0]; - HDsprintf(temp, "(%d)", level); + HDsnprintf(temp, sizeof(temp), "(%d)", level); HDstrcat(strfilter, temp); } #endif @@ -1545,7 +1545,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr, pack_opt_ unsigned options_mask = cd_values[0]; /* from dcpl, not filt*/ unsigned ppb = cd_values[1]; - HDsprintf(temp, "(%d,", ppb); + HDsnprintf(temp, sizeof(temp), "(%d,", ppb); HDstrcat(strfilter, temp); if (options_mask & H5_SZIP_EC_OPTION_MASK) HDstrcpy(temp, "EC) "); @@ -1588,7 +1588,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr, pack_opt_ HDstrcpy(str, "dset "); HDstrcat(str, strfilter); - HDsprintf(temp, " (%.3f:1)", ratio); + HDsnprintf(temp, sizeof(temp), " (%.3f:1)", ratio); HDstrcat(str, temp); if (options->verbose == 2) HDprintf(FORMAT_OBJ_TIME, str, read_time, write_time, objname); diff --git a/tools/src/misc/h5repart.c b/tools/src/misc/h5repart.c index f4cef6a..078883d 100644 --- a/tools/src/misc/h5repart.c +++ b/tools/src/misc/h5repart.c @@ -242,7 +242,7 @@ main(int argc, char *argv[]) if (argno >= argc) usage(prog_name); src_gen_name = argv[argno++]; - HDsprintf(src_name, src_gen_name, src_membno); + HDsnprintf(src_name, NAMELEN, src_gen_name, src_membno); src_is_family = strcmp(src_name, src_gen_name); if ((src = HDopen(src_name, O_RDONLY)) < 0) { @@ -264,7 +264,7 @@ main(int argc, char *argv[]) if (argno >= argc) usage(prog_name); dst_gen_name = argv[argno++]; - HDsprintf(dst_name, dst_gen_name, dst_membno); + HDsnprintf(dst_name, NAMELEN, dst_gen_name, dst_membno); dst_is_family = HDstrcmp(dst_name, dst_gen_name); if ((dst = HDopen(dst_name, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) { @@ -356,7 +356,7 @@ main(int argc, char *argv[]) dst_offset = dst_offset + (off_t)n; break; } - HDsprintf(src_name, src_gen_name, ++src_membno); + HDsnprintf(src_name, NAMELEN, src_gen_name, ++src_membno); if ((src = HDopen(src_name, O_RDONLY)) < 0 && ENOENT == errno) { dst_offset = dst_offset + (off_t)n; break; @@ -404,7 +404,7 @@ main(int argc, char *argv[]) } } HDclose(dst); - HDsprintf(dst_name, dst_gen_name, ++dst_membno); + HDsnprintf(dst_name, NAMELEN, dst_gen_name, ++dst_membno); if ((dst = HDopen(dst_name, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) { HDperror(dst_name); HDexit(EXIT_FAILURE); diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 70b3d57..4aa6426 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -589,7 +589,7 @@ gent_attribute(void) dims[0] = 24; space = H5Screate_simple(1, dims, NULL); attr = H5Acreate2(root, "/attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT); - HDsprintf(buf, "attribute of root group"); + HDsnprintf(buf, sizeof(buf), "attribute of root group"); H5Awrite(attr, H5T_NATIVE_SCHAR, buf); H5Sclose(space); H5Aclose(attr); @@ -1389,7 +1389,7 @@ gent_all(void) dims[0] = 10; space = H5Screate_simple(1, dims, NULL); attr = H5Acreate2(group, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT); - HDsprintf(buf, "abcdefghi"); + HDsnprintf(buf, sizeof(buf), "abcdefghi"); H5Awrite(attr, H5T_NATIVE_SCHAR, buf); H5Sclose(space); H5Aclose(attr); @@ -1425,7 +1425,7 @@ gent_all(void) dims[0] = 27; space = H5Screate_simple(1, dims, NULL); attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT); - HDsprintf(buf, "1st attribute of dset1.1.1"); + HDsnprintf(buf, sizeof(buf), "1st attribute of dset1.1.1"); H5Awrite(attr, H5T_NATIVE_SCHAR, buf); H5Sclose(space); H5Aclose(attr); @@ -1433,7 +1433,7 @@ gent_all(void) dims[0] = 27; space = H5Screate_simple(1, dims, NULL); attr = H5Acreate2(dataset, "attr2", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT); - HDsprintf(buf, "2nd attribute of dset1.1.1"); + HDsnprintf(buf, sizeof(buf), "2nd attribute of dset1.1.1"); H5Awrite(attr, H5T_NATIVE_SCHAR, buf); H5Sclose(space); H5Aclose(attr); @@ -1632,7 +1632,7 @@ gent_many(void) dims[0] = 10; space2 = H5Screate_simple(1, dims, NULL); attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space2, H5P_DEFAULT, H5P_DEFAULT); - HDsprintf(buf, "abcdefghi"); + HDsnprintf(buf, sizeof(buf), "abcdefghi"); H5Awrite(attr, H5T_NATIVE_CHAR, buf); H5Sclose(space2); H5Aclose(attr); @@ -1970,9 +1970,9 @@ gent_str2(void) dims[0] = 3; space2 = H5Screate_simple(1, dims, NULL); attr = H5Acreate2(dataset, "attr1", fxdlenstr2, space2, H5P_DEFAULT, H5P_DEFAULT); - HDsprintf(&(buf2[0 * LENSTR2]), "0123456789"); - HDsprintf(&(buf2[1 * LENSTR2]), "abcdefghij"); - HDsprintf(&(buf2[2 * LENSTR2]), "ABCDEFGHIJ"); + HDsnprintf(&(buf2[0 * LENSTR2]), LENSTR2, "0123456789"); + HDsnprintf(&(buf2[1 * LENSTR2]), LENSTR2, "abcdefghij"); + HDsnprintf(&(buf2[2 * LENSTR2]), LENSTR2, "ABCDEFGHIJ"); H5Awrite(attr, fxdlenstr2, buf2); H5Sclose(space2); H5Tclose(fxdlenstr2); @@ -1984,7 +1984,7 @@ gent_str2(void) for (i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - HDsprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of", i); + HDsnprintf(buf, sizeof(buf), "This is row %1d of type H5T_STR_NULLTERM of", i); H5Tset_size(memtype, HDstrlen(buf) + 1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -1997,7 +1997,7 @@ gent_str2(void) for (i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - HDsprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of string array", i); + HDsnprintf(buf, sizeof(buf), "This is row %1d of type H5T_STR_NULLTERM of string array", i); H5Tset_size(memtype, HDstrlen(buf) + 1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -2016,7 +2016,7 @@ gent_str2(void) for (i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - HDsprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of", i); + HDsnprintf(buf, sizeof(buf), "This is row %1d of type H5T_STR_NULLPAD of", i); H5Tset_size(memtype, HDstrlen(buf) + 1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -2029,7 +2029,7 @@ gent_str2(void) for (i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - HDsprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of string array", i); + HDsnprintf(buf, sizeof(buf), "This is row %1d of type H5T_STR_NULLPAD of string array", i); H5Tset_size(memtype, HDstrlen(buf) + 1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -2048,7 +2048,7 @@ gent_str2(void) for (i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - HDsprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of", i); + HDsnprintf(buf, sizeof(buf), "This is row %1d of type H5T_STR_SPACEPAD of", i); H5Tset_size(memtype, HDstrlen(buf) + 1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -2061,7 +2061,7 @@ gent_str2(void) for (i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - HDsprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of string array", i); + HDsnprintf(buf, sizeof(buf), "This is row %1d of type H5T_STR_SPACEPAD of string array", i); H5Tset_size(memtype, HDstrlen(buf) + 1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -3930,7 +3930,7 @@ gent_large_objname(void) group = H5Gcreate2(fid, "this_is_a_large_group_name", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for (i = 0; i < 50; ++i) { - HDsprintf(grp_name, "this_is_a_large_group_name%d", i); + HDsnprintf(grp_name, sizeof(grp_name), "this_is_a_large_group_name%d", i); group2 = H5Gcreate2(group, grp_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); H5Gclose(group2); } diff --git a/tools/test/h5jam/h5jamgentest.c b/tools/test/h5jam/h5jamgentest.c index 5632cc0..16604b3 100644 --- a/tools/test/h5jam/h5jamgentest.c +++ b/tools/test/h5jam/h5jamgentest.c @@ -152,7 +152,7 @@ gent_ub(const char *filename, size_t ub_size, size_t ub_fill) goto error; if ((attr = H5Acreate2(group, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - if (HDsprintf(buf, "abcdefghi") < 0) + if (HDsnprintf(buf, sizeof(buf), "abcdefghi") < 0) goto error; if (H5Awrite(attr, H5T_NATIVE_SCHAR, buf) < 0) goto error; @@ -206,7 +206,7 @@ gent_ub(const char *filename, size_t ub_size, size_t ub_fill) goto error; if ((attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - if (HDsprintf(buf, "1st attribute of dset1.1.1") < 0) + if (HDsnprintf(buf, sizeof(buf), "1st attribute of dset1.1.1") < 0) goto error; if (H5Awrite(attr, H5T_NATIVE_SCHAR, buf) < 0) goto error; @@ -220,7 +220,7 @@ gent_ub(const char *filename, size_t ub_size, size_t ub_fill) goto error; if ((attr = H5Acreate2(dataset, "attr2", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - if (HDsprintf(buf, "2nd attribute of dset1.1.1") < 0) + if (HDsnprintf(buf, sizeof(buf), "2nd attribute of dset1.1.1") < 0) goto error; if (H5Awrite(attr, H5T_NATIVE_SCHAR, buf) < 0) goto error; diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index 8b114e4..028939a 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -3157,7 +3157,7 @@ make_early(void) goto out; if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) goto out; - HDsprintf(name, "%d", i); + HDsnprintf(name, sizeof(name), "%d", i); if ((H5Tcommit2(fid, name, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if (H5Tclose(tid) < 0) @@ -3181,7 +3181,7 @@ make_early(void) for (i = 0; i < iter; i++) { if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) goto out; - HDsprintf(name, "%d", i); + HDsnprintf(name, sizeof(name), "%d", i); if ((H5Tcommit2(fid, name, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if (H5Tclose(tid) < 0) @@ -3240,7 +3240,7 @@ make_layout(hid_t loc_id) *------------------------------------------------------------------------- */ for (i = 0; i < 4; i++) { - HDsprintf(name, "dset%d", i + 1); + HDsnprintf(name, sizeof(name), "dset%d", i + 1); if (write_dset(loc_id, RANK, dims, name, H5T_NATIVE_INT, buf) < 0) goto error; } diff --git a/tools/test/h5stat/h5stat_gentest.c b/tools/test/h5stat/h5stat_gentest.c index c775d6a..4d21a43 100644 --- a/tools/test/h5stat/h5stat_gentest.c +++ b/tools/test/h5stat/h5stat_gentest.c @@ -88,7 +88,7 @@ gen_newgrat_file(const char *fname) /* Create NUM_GRPS groups in the root group */ for (i = 1; i <= NUM_GRPS; i++) { - HDsprintf(name, "%s%d", GROUP_NAME, i); + HDsnprintf(name, sizeof(name), "%s%d", GROUP_NAME, i); if ((gid = H5Gcreate2(fid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; if (H5Gclose(gid) < 0) @@ -109,7 +109,7 @@ gen_newgrat_file(const char *fname) /* Create NUM_ATTRS for the dataset */ for (i = 1; i <= NUM_ATTRS; i++) { - HDsprintf(attrname, "%s%d", ATTR_NAME, i); + HDsnprintf(attrname, sizeof(attrname), "%s%d", ATTR_NAME, i); if ((attr_id = H5Acreate2(did, attrname, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; if (H5Aclose(attr_id) < 0) @@ -211,7 +211,7 @@ gen_threshold_file(const char *fname) /* Create 11 attributes for the dataset */ for (i = 1; i <= (THRES_NUM + 1); i++) { - HDsprintf(name, "%s%d", THRES_ATTR_NAME, i); + HDsnprintf(name, sizeof(name), "%s%d", THRES_ATTR_NAME, i); if ((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; if (H5Aclose(attr_id) < 0) @@ -240,7 +240,7 @@ gen_threshold_file(const char *fname) /* Create 10 attributes for the 2-D dataset */ for (i = 1; i <= THRES_NUM; i++) { - HDsprintf(name, "%s%d", THRES_ATTR_NAME, i); + HDsnprintf(name, sizeof(name), "%s%d", THRES_ATTR_NAME, i); if ((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; if (H5Aclose(attr_id) < 0) @@ -264,7 +264,7 @@ gen_threshold_file(const char *fname) /* Create 10 1-D datasets with non-zero dimension size for the group */ for (i = 1; i <= THRES_NUM; i++) { /* set up dataset name */ - HDsprintf(name, "%s%d", THRES_DSET_NAME, i); + HDsnprintf(name, sizeof(name), "%s%d", THRES_DSET_NAME, i); /* Create the dataset */ if ((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -286,7 +286,7 @@ gen_threshold_file(const char *fname) /* Create 25 attributes for the group */ for (i = 1; i <= THRES_NUM_25; i++) { /* Set up attribute name */ - HDsprintf(name, "%s%d", THRES_ATTR_GRP_NAME, i); + HDsnprintf(name, sizeof(name), "%s%d", THRES_ATTR_GRP_NAME, i); /* Create the attribute */ if ((attr_id = H5Acreate2(gid, name, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -308,7 +308,7 @@ gen_threshold_file(const char *fname) /* Create 9 1-D datasets with non-zero dimension size for the group */ for (i = 1; i < THRES_NUM; i++) { /* set up dataset name */ - HDsprintf(name, "%s%d", THRES_DSET_NAME, i); + HDsnprintf(name, sizeof(name), "%s%d", THRES_DSET_NAME, i); /* Create the dataset */ if ((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) diff --git a/tools/test/misc/h5perf_gentest.c b/tools/test/misc/h5perf_gentest.c index 248fd92..7589144 100644 --- a/tools/test/misc/h5perf_gentest.c +++ b/tools/test/misc/h5perf_gentest.c @@ -104,7 +104,7 @@ main(int argc, char *argv[]) } if (strlen(fname) <= 0) - HDsprintf(fname, FNAME); + HDsnprintf(fname, sizeof(fname), FNAME); create_perf_test_file(fname, ngrps, ndsets, nattrs, (hsize_t)nrows, (hsize_t)dim0, (hsize_t)chunk, vlen, z, l); @@ -324,7 +324,7 @@ create_perf_test_file(const char *fname, int ngrps, int ndsets, int nattrs, hsiz fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); add_attrs(fid, 0); - HDsprintf(name, "a cmp ds of %d rows", nrows); + HDsnprintf(name, sizeof(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); add_attrs(did, 0); @@ -344,7 +344,7 @@ create_perf_test_file(const char *fname, int ngrps, int ndsets, int nattrs, hsiz add_attrs(gid1, 0); for (i = 0; i < ngrps; i++) { /* create sub groups */ - HDsprintf(name, "g%02d", i); + HDsnprintf(name, sizeof(name), "g%02d", i); gid2 = H5Gcreate(gid1, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (i < 10) add_attrs(gid2, 0); @@ -357,14 +357,14 @@ create_perf_test_file(const char *fname, int ngrps, int ndsets, int nattrs, hsiz add_attrs(gid1, 0); for (j = 0; j < ndsets; j += 12) { /* 1 add a null dataset */ - HDsprintf(name, "%05d null dataset", j); + HDsnprintf(name, sizeof(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); H5Dclose(did); /* 2 add scalar int point */ - HDsprintf(name, "%05d scalar int point", j); + HDsnprintf(name, sizeof(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) @@ -372,7 +372,7 @@ create_perf_test_file(const char *fname, int ngrps, int ndsets, int nattrs, hsiz H5Dclose(did); /* 3 scalar vlen string */ - HDsprintf(name, "%05d scalar vlen string", j); + HDsnprintf(name, sizeof(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) @@ -380,7 +380,7 @@ create_perf_test_file(const char *fname, int ngrps, int ndsets, int nattrs, hsiz H5Dclose(did); /* 4 add fixed-length float array */ - HDsprintf(name, "%05d fixed-length float array", j); + HDsnprintf(name, sizeof(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) @@ -388,7 +388,7 @@ create_perf_test_file(const char *fname, int ngrps, int ndsets, int nattrs, hsiz H5Dclose(did); /* 5 add fixed-length strings */ - HDsprintf(name, "%05d fixed-length strings", j); + HDsnprintf(name, sizeof(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) @@ -396,7 +396,7 @@ create_perf_test_file(const char *fname, int ngrps, int ndsets, int nattrs, hsiz H5Dclose(did); /* 6 add compound data */ - HDsprintf(name, "%05d compound data", j); + HDsnprintf(name, sizeof(name), "%05d compound 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) @@ -404,7 +404,7 @@ create_perf_test_file(const char *fname, int ngrps, int ndsets, int nattrs, hsiz H5Dclose(did); /* 7 add 2D double */ - HDsprintf(name, "%05d 2D double", j); + HDsnprintf(name, sizeof(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]); @@ -413,7 +413,7 @@ create_perf_test_file(const char *fname, int ngrps, int ndsets, int nattrs, hsiz H5Dclose(did); /* 8 add 1D int array */ - HDsprintf(name, "%05d 1D int array", j); + HDsnprintf(name, sizeof(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) @@ -421,7 +421,7 @@ create_perf_test_file(const char *fname, int ngrps, int ndsets, int nattrs, hsiz H5Dclose(did); /* 9 add vlen int array */ - HDsprintf(name, "%05d vlen int array", j); + HDsnprintf(name, sizeof(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); @@ -430,7 +430,7 @@ create_perf_test_file(const char *fname, int ngrps, int ndsets, int nattrs, hsiz H5Dclose(did); /* 10 add vlen strings */ - HDsprintf(name, "%05d vlen strings", j); + HDsnprintf(name, sizeof(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); @@ -441,7 +441,7 @@ create_perf_test_file(const char *fname, int ngrps, int ndsets, int nattrs, hsiz /* 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); - HDsprintf(name, "%05d obj refs", j); + HDsnprintf(name, sizeof(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) @@ -456,7 +456,7 @@ create_perf_test_file(const char *fname, int ngrps, int ndsets, int nattrs, hsiz 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); + HDsnprintf(name, sizeof(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) @@ -572,11 +572,11 @@ add_attrs(hid_t oid, int idx) /* 1 scalar point */ sid = H5Screate(H5S_SCALAR); - HDsprintf(name, "%05d scalar int", idx); + HDsnprintf(name, sizeof(name), "%05d scalar int", idx); nattrs += add_attr(oid, name, H5T_NATIVE_UINT, sid, &i); - HDsprintf(name, "%05d scalar ulong", idx); + HDsnprintf(name, sizeof(name), "%05d scalar ulong", idx); nattrs += add_attr(oid, name, H5T_NATIVE_INT64, sid, &l); - HDsprintf(name, "%05d scalar str", idx); + HDsnprintf(name, sizeof(name), "%05d scalar str", idx); tid = H5Tcopy(H5T_C_S1); H5Tset_size(tid, H5T_VARIABLE); nattrs += add_attr(oid, name, tid, sid, &s[2]); @@ -586,24 +586,24 @@ add_attrs(hid_t oid, int idx) /* 4 single point */ sid = H5Screate_simple(1, dims1, NULL); H5Rcreate(&ref, oid, ".", H5R_OBJECT, (hid_t)-1); - HDsprintf(name, "%05d single float", idx); + HDsnprintf(name, sizeof(name), "%05d single float", idx); nattrs += add_attr(oid, name, H5T_NATIVE_FLOAT, sid, &f); - HDsprintf(name, "%05d single double", idx); + HDsnprintf(name, sizeof(name), "%05d single double", idx); nattrs += add_attr(oid, name, H5T_NATIVE_DOUBLE, sid, &d); - HDsprintf(name, "%05d single obj_ref", idx); + HDsnprintf(name, sizeof(name), "%05d single obj_ref", idx); nattrs += add_attr(oid, name, H5T_STD_REF_OBJ, sid, &ref); H5Sclose(sid); /* 7 fixed length 1D array */ sid = H5Screate_simple(1, dims1, NULL); tid = H5Tarray_create(H5T_NATIVE_FLOAT, 1, dims2); - HDsprintf(name, "%05d array float", idx); + HDsnprintf(name, sizeof(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); - HDsprintf(name, "%05d array str", idx); + HDsnprintf(name, sizeof(name), "%05d array str", idx); nattrs += add_attr(oid, name, tid1, sid, s); H5Tclose(tid1); H5Tclose(tid); @@ -612,7 +612,7 @@ add_attrs(hid_t oid, int idx) /* 9 fixed length 2D int arrays */ sid = H5Screate_simple(1, dims2, NULL); tid = H5Tarray_create(H5T_NATIVE_INT, 2, dims3); - HDsprintf(name, "%05d array int 2D", idx); + HDsnprintf(name, sizeof(name), "%05d array int 2D", idx); nattrs += add_attr(oid, name, tid, sid, int3d[0][0]); H5Tclose(tid); H5Sclose(sid); @@ -621,12 +621,12 @@ add_attrs(hid_t oid, int idx) sid = H5Screate_simple(1, dims2, NULL); tid = H5Tcopy(H5T_C_S1); H5Tset_size(tid, H5T_VARIABLE); - HDsprintf(name, "%05d vlen strings", idx); + HDsnprintf(name, sizeof(name), "%05d vlen strings", idx); nattrs += add_attr(oid, name, tid, sid, s_vlen); H5Tclose(tid); tid = H5Tvlen_create(H5T_NATIVE_INT); ; - HDsprintf(name, "%05d vlen int array", idx); + HDsnprintf(name, sizeof(name), "%05d vlen int array", idx); nattrs += add_attr(oid, name, tid, sid, i_vlen); H5Tclose(tid); H5Sclose(sid); @@ -640,7 +640,7 @@ add_attrs(hid_t oid, int idx) offset += sizeof(H5T_NATIVE_INT); H5Tinsert(tid, "City", offset, tid1); offset += sizeof(char *); - HDsprintf(name, "%05d compound data", idx); + HDsnprintf(name, sizeof(name), "%05d compound data", idx); nattrs += add_attr(oid, name, tid, sid, cmp_data); H5Tclose(tid1); H5Tclose(tid); diff --git a/tools/test/perform/iopipe.c b/tools/test/perform/iopipe.c index 2aa9e25..37f07a1 100644 --- a/tools/test/perform/iopipe.c +++ b/tools/test/perform/iopipe.c @@ -71,7 +71,7 @@ print_stats(const char *prefix, ((double)(r_start->ru_stime.tv_sec) + (double)(r_start->ru_stime.tv_usec) / 1000000.0); #endif e_time = t_stop - t_start; - H5_bandwidth(bw, (double)nbytes, e_time); + H5_bandwidth(bw, sizeof(bw), (double)nbytes, e_time); #ifdef H5_HAVE_GETRUSAGE HDprintf(HEADING "%1.2fuser %1.2fsystem %1.2felapsed %s\n", prefix, u_time, s_time, e_time, bw); -- cgit v0.12