From 5b40763b2be26d9a6e7855bbc1528fd8e523a071 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 6 May 2022 11:41:58 -0700 Subject: Brings random stuff over from develop (#1738) --- c++/examples/run-c++-ex.sh.in | 6 +- config/BlankForm | 90 ++++++------- config/apple | 127 ++++++++++-------- config/cmake_ext_mod/NSIS.template.in | 4 +- config/solaris | 6 +- configure.ac | 74 ++++------- examples/h5_mount.c | 2 +- examples/h5_shared_mesg.c | 4 +- examples/h5_vds-percival-unlim-maxmin.c | 2 +- fortran/examples/compound.f90 | 14 +- fortran/examples/h5_cmprss.f90 | 2 +- fortran/examples/h5_crtatt.f90 | 2 +- fortran/examples/h5_extend.f90 | 4 +- fortran/examples/refobjexample.f90 | 2 +- fortran/examples/testh5fc.sh.in | 2 +- fortran/src/H5Af.c | 8 +- fortran/src/H5Aff.F90 | 14 +- fortran/src/H5Df.c | 14 +- fortran/src/H5Dff.F90 | 18 +-- fortran/src/H5Ff.c | 4 +- fortran/src/H5Fff.F90 | 2 +- fortran/src/H5Gf.c | 8 +- fortran/src/H5Gff.F90 | 32 ++--- fortran/src/H5Lff.F90 | 4 +- fortran/src/H5Pf.c | 30 ++--- fortran/src/H5Pff.F90 | 18 +-- fortran/src/H5Sf.c | 8 +- fortran/src/H5Sff.F90 | 2 +- fortran/src/H5Tf.c | 6 +- fortran/src/H5Tff.F90 | 4 +- fortran/src/H5_buildiface.F90 | 8 +- fortran/src/H5_ff.F90 | 4 +- fortran/src/H5f90global.F90 | 4 +- fortran/src/H5f90proto.h | 2 +- fortran/src/h5fc.in | 6 +- src/H5.c | 17 ++- src/H5FDmirror.c | 42 +++--- src/H5FDmirror_priv.h | 2 +- test/hdfs.c | 9 -- test/istore.c | 27 +--- test/mirror_vfd.c | 224 +++++++++++++++++++++++++------- test/ntypes.c | 187 +++++++++++++++----------- test/vfd.c | 187 +++++++++++++------------- utils/mirror_vfd/mirror_remote.c | 2 +- utils/mirror_vfd/mirror_remote.h | 2 +- utils/mirror_vfd/mirror_server.c | 57 ++++---- utils/mirror_vfd/mirror_server_stop.c | 17 ++- utils/mirror_vfd/mirror_writer.c | 8 +- 48 files changed, 734 insertions(+), 584 deletions(-) diff --git a/c++/examples/run-c++-ex.sh.in b/c++/examples/run-c++-ex.sh.in index ff932e0..4593779 100644 --- a/c++/examples/run-c++-ex.sh.in +++ b/c++/examples/run-c++-ex.sh.in @@ -46,10 +46,10 @@ prefix_relto_examplesdir=$( prefix=@prefix@ examplesdir=@examplesdir@ if [ ${examplesdir##${prefix}/} != ${examplesdir} ]; then - echo $(echo ${examplesdir##${prefix}/} | \ - sed 's,[^/][^/]*,..,g') + echo $(echo ${examplesdir##${prefix}/} | \ + sed 's,[^/][^/]*,..,g') else - echo $prefix + echo $prefix fi ) diff --git a/config/BlankForm b/config/BlankForm index ce4bf53..68da38d 100644 --- a/config/BlankForm +++ b/config/BlankForm @@ -1,4 +1,4 @@ -# -*- shell-script -*- +# -*- shell-script -*- # # Copyright by The HDF Group. # Copyright by the Board of Trustees of the University of Illinois. @@ -52,39 +52,39 @@ fi # Flags that end with `_CPPFLAGS' are passed to the compiler when # compiling but not when linking. # -# DEBUG_CFLAGS Flags to pass to the compiler to create a -# DEBUG_CPPFLAGS library suitable for use with debugging -# tools. Usually this list will exclude -# optimization switches (like `-O') and include -# switches that turn on symbolic debugging -# support (like `-g'). +# DEBUG_CFLAGS Flags to pass to the compiler to create a +# DEBUG_CPPFLAGS library suitable for use with debugging +# tools. Usually this list will exclude +# optimization switches (like `-O') and include +# switches that turn on symbolic debugging +# support (like `-g'). # -# PROD_CFLAGS Flags to pass to the compiler to create a -# PROD_CPPFLAGS production version of the library. These -# usualy exclude symbolic debugging switches -# (like `-g') and include optimization switches -# (like `-O'). +# PROD_CFLAGS Flags to pass to the compiler to create a +# PROD_CPPFLAGS production version of the library. These +# usually exclude symbolic debugging switches +# (like `-g') and include optimization switches +# (like `-O'). # -# PROFILE_CFLAGS Flags to pass to the compiler to create a -# PROFILE_CPPFLAGS library suitable for performance testing (like -# `-pg'). This may or may not include debugging -# or production flags. -# -# H5_CFLAGS Flags can be added to this variable which -# might already be partially initialized. These -# flags will always be passed to the compiler -# and should include switches to turn on full -# warnings. HDF5 attempts to be ANSI and Posix -# compliant and employ good programming -# practices resulting in few if any -# warnings. +# PROFILE_CFLAGS Flags to pass to the compiler to create a +# PROFILE_CPPFLAGS library suitable for performance testing (like +# `-pg'). This may or may not include debugging +# or production flags. # -# Warning flags do not have to be added to H5_CFLAGS -# variable if the compiler is the GNU gcc -# compiler or a descendent of gcc such as EGCS or PGCC. +# H5_CFLAGS Flags can be added to this variable which +# might already be partially initialized. These +# flags will always be passed to the compiler +# and should include switches to turn on full +# warnings. HDF5 attempts to be ANSI and Posix +# compliant and employ good programming +# practices resulting in few if any +# warnings. +# +# Warning flags do not have to be added to H5_CFLAGS +# variable if the compiler is the GNU gcc +# compiler or a descendent of gcc such as EGCS or PGCC. # # AM_CFLAGS Flags added directly into this variable will -# be propogated to the compiler wrapper scripts (h5cc, +# be propagated to the compiler wrapper scripts (h5cc, # h5c++, et cetera) in addition to being used to compile # the library. # @@ -97,24 +97,24 @@ fi case $CC_BASENAME in gcc) - H5_CFLAGS="$H5_CFLAGS -Wsign-compare" #Only works for some versions - DEBUG_CFLAGS="-g -fverbose-asm" - DEBUG_CPPFLAGS= - PROD_CFLAGS="-O3 -fomit-frame-pointer" - PROD_CPPFLAGS= - PROFILE_CFLAGS="-pg" - PROFILE_CPPFLAGS= - ;; + H5_CFLAGS="$H5_CFLAGS -Wsign-compare" #Only works for some versions + DEBUG_CFLAGS="-g -fverbose-asm" + DEBUG_CPPFLAGS= + PROD_CFLAGS="-O3 -fomit-frame-pointer" + PROD_CPPFLAGS= + PROFILE_CFLAGS="-pg" + PROFILE_CPPFLAGS= + ;; *) - H5_CFLAGS="$H5_CFLAGS -ansi" - DEBUG_CFLAGS="-g" - DEBUG_CPPFLAGS= - PROD_CFLAGS="-O" - PROD_CPPFLAGS= - PROFILE_CFLAGS="-pg" - PROFILE_CPPFLAGS= - ;; + H5_CFLAGS="$H5_CFLAGS -ansi" + DEBUG_CFLAGS="-g" + DEBUG_CPPFLAGS= + PROD_CFLAGS="-O" + PROD_CPPFLAGS= + PROFILE_CFLAGS="-pg" + PROFILE_CPPFLAGS= + ;; esac diff --git a/config/apple b/config/apple index 98dede2..0fb7dca 100644 --- a/config/apple +++ b/config/apple @@ -22,58 +22,60 @@ # No support for OS older than darwin 10.X. if test "X-" = "X-$CC"; then case "$host_os" in - darwin10.*) # Snow Leopard. Use gcc/g++ because clang++ is not available. - CC=gcc - CC_BASENAME=gcc - ;; - *) - CC=clang - CC_BASENAME=clang - - # Production - PROD_CFLAGS="-O3" - PROD_CPPFLAGS= - - # Debug - DEBUG_CFLAGS="-g -O0" - DEBUG_CPPFLAGS= - - # Profile - # Use this for profiling with gprof - # Just "-g" for now. More later. - PROFILE_CFLAGS="-g" - PROFILE_CPPFLAGS= - ;; + darwin10.*) # Snow Leopard. Use gcc/g++ because clang++ is not available. + CC=gcc + CC_BASENAME=gcc + ;; + *) + if test "X-$enable_parallel" = "X-yes"; then + # default to use mpicc which is the defacto MPI compiler name + CC=mpicc + CC_BASENAME=mpicc + else + CC=clang + CC_BASENAME=clang + fi + + # Production + PROD_CFLAGS="-O3" + PROD_CPPFLAGS= + + # Debug + DEBUG_CFLAGS="-g -O0" + DEBUG_CPPFLAGS= + + # Profile + # Use this for profiling with gprof + # Just "-g" for now. More later. + PROFILE_CFLAGS="-g" + PROFILE_CPPFLAGS= + ;; esac fi -# Figure out compiler flags +# Figure out C compiler flags . $srcdir/config/gnu-flags . $srcdir/config/clang-flags +. $srcdir/config/intel-flags + # temp patch: if GCC 4.2.1 is used in Lion or Mountain Lion systems, do not # use -O option as it causes failures in test/dt_arith. case "$host_os" in darwin1[12].*) # lion & mountain lion - #echo cc_vendor=$cc_vendor'-'cc_version=$cc_version - case "$cc_vendor-$cc_version" in - gcc-4.2.1) - # Remove any -O flags - #echo PROD_CFLAGS=$PROD_CFLAGS - PROD_CFLAGS="`echo $PROD_CFLAGS | sed -e 's/-O[0-3]*//'`" - #echo new PROD_CFLAGS=$PROD_CFLAGS - ;; - esac - ;; + #echo cc_vendor=$cc_vendor'-'cc_version=$cc_version + case "$cc_vendor-$cc_version" in + gcc-4.2.1) + # Remove any -O flags + #echo PROD_CFLAGS=$PROD_CFLAGS + PROD_CFLAGS="`echo $PROD_CFLAGS | sed -e 's/-O[0-3]*//'`" + #echo new PROD_CFLAGS=$PROD_CFLAGS + ;; + esac + ;; esac - -. $srcdir/config/intel-flags + if test "X-" = "X-$FC"; then case $CC_BASENAME in - clang) - # clang has no fortran compiler. Use gfortran. - FC=gfortran - FC_BASENAME=gfortran - ;; gcc*) FC=gfortran FC_BASENAME=gfortran @@ -82,15 +84,26 @@ if test "X-" = "X-$FC"; then FC=ifort FC_BASENAME=ifort ;; + mpicc*) + FC=mpif90 + FC_BASENAME=mpif90 + ;; + clang) + # clang has no fortran compiler. Use gfortran. + FC=gfortran + FC_BASENAME=gfortran + ;; esac fi +# Figure out FORTRAN compiler flags +. $srcdir/config/gnu-fflags +. $srcdir/config/intel-fflags + + +# The default C++ compiler is `clang++'. if test "X-" = "X-$CXX"; then case $CC_BASENAME in - clang) - CXX=clang++ - CXX_BASENAME=clang++ - ;; gcc) CXX=g++ CXX_BASENAME=g++ @@ -99,18 +112,21 @@ if test "X-" = "X-$CXX"; then CXX=icpc CXX_BASENAME=icpc ;; + mpicc*) + FC=mpif90 + FC_BASENAME=mpif90 + ;; + clang) + CXX=clang++ + CXX_BASENAME=clang++ + ;; esac fi -case $CXX_BASENAME in - clang++) - PROD_CXXFLAGS="-O3" - DEBUG_CXXFLAGS="-g -O0" - # Use this for profiling with gprof - # Just "-g" for now. More later. - PROFILE_CXXFLAGS="-g" - ;; -esac +# Figure out C++ compiler flags +. $srcdir/config/intel-cxxflags # Do this ahead of GNU to avoid icpc being detected as g++ +. $srcdir/config/gnu-cxxflags +. $srcdir/config/clang-cxxflags # compiler version strings case $CC in @@ -133,16 +149,15 @@ case $CC in echo "No match to get cc_version_info for $CC" ;; esac + # Figure out Fortran compiler flags and version strings case $FC in *gfortran*) - . $srcdir/config/gnu-fflags fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS --version 2>&1 |\ grep 'GCC' | sed 's/\(.*(GCC) [-a-z0-9\. ]*\).*/\1/'` ;; *ifc*|*ifort*) - . $srcdir/config/intel-fflags fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS -V 2>&1 | grep 'Version' |\ sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'` ;; @@ -156,13 +171,11 @@ esac # get c++ version info case $CXX in clang++) - . $srcdir/config/clang-cxxflags cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS --version 2>&1 |\ grep 'Apple' | sed 's/(.*//'` ;; *g++*) - . $srcdir/config/gnu-cxxflags cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS --version 2>&1 |\ grep 'GCC' | sed 's/.*\((GCC) [-a-z0-9\. ]*.*\)/\1/'` ;; diff --git a/config/cmake_ext_mod/NSIS.template.in b/config/cmake_ext_mod/NSIS.template.in index ecced05..db79466 100644 --- a/config/cmake_ext_mod/NSIS.template.in +++ b/config/cmake_ext_mod/NSIS.template.in @@ -849,7 +849,7 @@ Section "Uninstall" @CPACK_NSIS_DELETE_ICONS@ @CPACK_NSIS_DELETE_ICONS_EXTRA@ - ;Delete empty start menu parent diretories + ;Delete empty start menu parent directories StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" startMenuDeleteLoop: @@ -868,7 +868,7 @@ Section "Uninstall" Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" @CPACK_NSIS_DELETE_ICONS_EXTRA@ - ;Delete empty start menu parent diretories + ;Delete empty start menu parent directories StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" secondStartMenuDeleteLoop: diff --git a/config/solaris b/config/solaris index b7c7963..6b6b74d 100644 --- a/config/solaris +++ b/config/solaris @@ -39,7 +39,7 @@ if test "X-" = "X-$cc_flags_set"; then # Debug # NDEBUG is handled explicitly by the configure script - # -g is hanled by the symbols flags + # -g is handled by the symbols flags DEBUG_CFLAGS= # Symbols @@ -101,7 +101,7 @@ if test "X-" = "X-$f9x_flags_set"; then # Debug # NDEBUG is handled explicitly by the configure script - # -g is hanled by the symbols flags + # -g is handled by the symbols flags DEBUG_FCFLAGS= # Symbols @@ -157,7 +157,7 @@ if test -z "$cxx_flags_set"; then # Debug # NDEBUG is handled explicitly by the configure script - # -g is hanled by the symbols flags + # -g is handled by the symbols flags DEBUG_CXXFLAGS= # Symbols diff --git a/configure.ac b/configure.ac index 90dbeeb..1e71bf9 100644 --- a/configure.ac +++ b/configure.ac @@ -231,9 +231,10 @@ AC_CACHE_CHECK([for cached host], [hdf5_cv_host], [hdf5_cv_host="none"]); if test $hdf5_cv_host = "none"; then hdf5_cv_host=$host elif test $hdf5_cv_host != $host; then - echo "The config.cache file was generated on $hdf5_cv_host but" - echo "this is $host. Please remove that file and try again." - AC_MSG_ERROR([config.cache file is invalid]) + AC_MSG_ERROR([ + The config.cache file was generated on $hdf5_cv_host but + this is $host. Please remove that file and try again. + config.cache file is invalid]) fi ## ---------------------------------------------------------------------- @@ -390,7 +391,7 @@ if test "X$CC_BASENAME" = "Xclang"; then # 'address;undefined'. Which and which combinations of these are # supported varies by compiler version, but unsupported options # or combinations will result in configure errors reported in config.log. - # Comma separated lists of sanitize options wil be entered intact in + # Comma separated lists of sanitize options will be entered intact in # one -fsanitize= flag. Space separated lists will be entered in # separate -fsanitize= flags. # NOTE: No sanity checking done here! @@ -573,11 +574,7 @@ AC_ARG_ENABLE([fortran], [Compile the Fortran interface [default=no]])], [HDF_FORTRAN=$enableval]) -if test "X$HDF_FORTRAN" = "Xyes"; then - echo "yes" -else - echo "no" -fi +AC_MSG_RESULT([$HDF_FORTRAN]) if test "X$HDF_FORTRAN" = "Xyes"; then @@ -800,9 +797,9 @@ AC_ARG_ENABLE([cxx], [AS_HELP_STRING([--enable-cxx], [Compile the C++ interface [default=no]])], [HDF_CXX=$enableval]) +AC_MSG_RESULT([$HDF_CXX]) if test "X$HDF_CXX" = "Xyes"; then - echo "yes" HDF5_INTERFACES="$HDF5_INTERFACES c++" ## Expose the compiler for *.in files @@ -826,7 +823,6 @@ if test "X$HDF_CXX" = "Xyes"; then PAC_PROG_CXX_OFFSETOF else - AC_MSG_RESULT([no]) CXX="no" fi @@ -1010,7 +1006,7 @@ AC_ARG_ENABLE([java], if test "X$HDF_JAVA" = "Xyes"; then if test "X${enable_shared}" != "Xno"; then - echo "yes" + AC_MSG_RESULT([yes]) if test "X$CLASSPATH" = "X"; then H5_CLASSPATH=".:$srcdir/java/lib" else @@ -1103,12 +1099,7 @@ AC_ARG_ENABLE([tests], [Compile the HDF5 tests [default=yes]])], [HDF5_TESTS=$enableval]) -if test "X$HDF5_TESTS" = "Xno"; then - AC_MSG_RESULT([yes]) - echo "Building HDF5 tests is disabled" -else - AC_MSG_RESULT([no]) -fi +AC_MSG_RESULT([$HDF5_TESTS]) ## These need to be exposed for some tests. AC_SUBST([H5_UTILS_TEST_BUILDDIR]) @@ -1133,12 +1124,7 @@ AC_ARG_ENABLE([tools], [Compile the HDF5 tools [default=yes]])], [HDF5_TOOLS=$enableval]) -if test "X$HDF5_TOOLS" = "Xno"; then - AC_MSG_RESULT([yes]) - echo "Building HDF5 tools is disabled" -else - AC_MSG_RESULT([no]) -fi +AC_MSG_RESULT([$HDF5_TOOLS]) ## ---------------------------------------------------------------------- ## Check if they would like to enable building doxygen files @@ -1157,8 +1143,9 @@ AC_ARG_ENABLE([doxygen], [Compile the HDF5 doxygen files [default=no]])], [HDF5_DOXYGEN=$enableval]) +AC_MSG_RESULT([$HDF5_DOXYGEN]) + if test "X$HDF5_DOXYGEN" = "Xyes"; then - AC_MSG_RESULT([yes]) DX_DOXYGEN_FEATURE(ON) DX_DOT_FEATURE(OFF) DX_HTML_FEATURE(ON) @@ -1216,10 +1203,6 @@ if test "X$HDF5_DOXYGEN" = "Xyes"; then DOXYGEN_PREDEFINED='H5_HAVE_DIRECT H5_HAVE_LIBHDFS H5_HAVE_MAP_API H5_HAVE_PARALLEL H5_HAVE_ROS3_VFD' DX_INIT_DOXYGEN([HDF5], [./doxygen/Doxyfile], [hdf5lib_docs]) - -else - AC_MSG_RESULT([no]) - echo "Doxygen support is disabled" fi @@ -1249,18 +1232,17 @@ AC_ARG_ENABLE([static_exec], [Install only statically linked executables [default=no]])], [STATIC_EXEC=$enableval]) +AC_MSG_RESULT([$STATIC_EXEC]) if test "X$STATIC_EXEC" = "Xyes"; then - echo "yes" ## Issue a warning if -static flag is not supported. if test "X$lt_cv_prog_compiler_static_works" = "Xno"; then - echo " warning: -static flag not supported on this system; executable won't statically link shared system libraries." + AC_MSG_WARN([-static flag not supported on this system; executable won't statically link shared system libraries.]) LT_STATIC_EXEC="" else LT_STATIC_EXEC="-all-static" fi else - echo "no" LT_STATIC_EXEC="" fi AM_CONDITIONAL([USE_PLUGINS_CONDITIONAL], [test "X$LT_STATIC_EXEC" = X]) @@ -1613,6 +1595,7 @@ case "X-$withval" in ;; esac + ## ---------------------------------------------------------------------- ## Make the external filters list available to *.in files ## At this point it's unset (no external filters by default) but it @@ -1721,6 +1704,7 @@ fi ## command-line switch. The value is an include path and/or a library path. ## If the library path is specified then it must be preceded by a comma. ## +AC_SUBST([LL_PATH]) AC_SUBST([USE_FILTER_SZIP]) USE_FILTER_SZIP="no" AC_ARG_WITH([szlib], [AS_HELP_STRING([--with-szlib=DIR], @@ -1805,7 +1789,7 @@ if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$szlib_lib" fi - AC_SUBST([LL_PATH]) LL_PATH="$LD_LIBRARY_PATH" + LL_PATH="$LD_LIBRARY_PATH" AC_CACHE_VAL([hdf5_cv_szlib_can_encode], [AC_RUN_IFELSE( @@ -1853,13 +1837,8 @@ AM_CONDITIONAL([BUILD_SHARED_SZIP_CONDITIONAL], [test "X$USE_FILTER_SZIP" = "Xye AC_CACHE_SAVE ## ---------------------------------------------------------------------- -## Enable thread-safe version of library (requires Pthreads on POSIX -## systems). We usually pick up the system Pthreads library, so --with-pthread -## is only necessary if you are using a custom Pthreads library or if -## your OS hides its implementation in an unusual location. -## -## On Windows, we use Win32 threads and no special configuration should be -## required to use them. +## Enable thread-safe version of library. It requires Pthreads support +## on POSIX systems. ## AC_SUBST([THREADSAFE]) @@ -2012,10 +1991,8 @@ if test "X$THREADSAFE" = "Xyes"; then AC_CACHE_VAL([hdf5_cv_system_scope_threads], [AC_RUN_IFELSE( [AC_LANG_PROGRAM([ - #if STDC_HEADERS #include #include - #endif ],[ pthread_attr_t attribute; int ret; @@ -2226,7 +2203,7 @@ for hdf5_cv_printf_ll in ll l L q unknown; do ],[[ char *s = malloc(128); long long x = (long long)1048576 * (long long)1048576; - sprintf(s,"%${hdf5_cv_printf_ll}d",x); + snprintf(s,128,"%${hdf5_cv_printf_ll}d",x); exit(strcmp(s,"1099511627776")); ]])] , [break],,[continue]) @@ -3400,7 +3377,7 @@ fi ## ---------------------------------------------------------------------- ## Decide whether the data accuracy has higher priority during data -## conversions. If not, some hard conversions will still be prefered even +## conversions. If not, some hard conversions will still be preferred even ## though the data may be wrong (for example, some compilers don't ## support denormalized floating values) to maximize speed. ## @@ -3414,7 +3391,7 @@ AC_ARG_ENABLE([dconv-accuracy], if test "$DATA_ACCURACY" = "yes"; then AC_MSG_RESULT([yes]) AC_DEFINE([WANT_DATA_ACCURACY], [1], - [Data accuracy is prefered to speed during data conversions]) + [Data accuracy is preferred to speed during data conversions]) else AC_MSG_RESULT([no]) fi @@ -3735,12 +3712,7 @@ AC_ARG_ENABLE([build-all], [Build helper programs that only developers should need [default=no]])], [BUILD_ALL=$enableval], [BUILD_ALL=no]) - -if test "X$BUILD_ALL" = "Xyes"; then - echo "yes" -else - echo "no" -fi +AC_MSG_RESULT([$BUILD_ALL]) AM_CONDITIONAL([BUILD_ALL_CONDITIONAL], [test "X$BUILD_ALL" = "Xyes"]) ## ---------------------------------------------------------------------- diff --git a/examples/h5_mount.c b/examples/h5_mount.c index e984d5b..3f087f7 100644 --- a/examples/h5_mount.c +++ b/examples/h5_mount.c @@ -109,7 +109,7 @@ main(void) } /* - * Close all identifers + * Close all identifiers */ H5Tclose(tid); H5Dclose(did); diff --git a/examples/h5_shared_mesg.c b/examples/h5_shared_mesg.c index 0f623b9..f26b360 100644 --- a/examples/h5_shared_mesg.c +++ b/examples/h5_shared_mesg.c @@ -109,7 +109,7 @@ main(void) * This keeps the indexes simple when only a few messages are shared, * but allows them to scale for many messages. If many messages are * deleted from the B-tree, it scales back down into a list. - * A "resonable" setting for maximum list size and minimum btree size + * A "reasonable" setting for maximum list size and minimum btree size * depends on what kinds of messages will be stored in the file. * These numbers are the same for all indexes in a file. * We'll guess at some numbers, though we could just as easily have kept @@ -227,7 +227,7 @@ error: /*------------------------------------------------------------------------- * Function: create_standard_file * - * Purpose: A helper functon for the example. Creates an HDF5 file + * Purpose: A helper function for the example. Creates an HDF5 file * with many repeated messages using the file creation * property list FCPL. * diff --git a/examples/h5_vds-percival-unlim-maxmin.c b/examples/h5_vds-percival-unlim-maxmin.c index 7e029a3..f459c20 100644 --- a/examples/h5_vds-percival-unlim-maxmin.c +++ b/examples/h5_vds-percival-unlim-maxmin.c @@ -152,7 +152,7 @@ main(void) wdata[j] = 10 * (i + 1); /* - * Open the source files and datasets. Appen data to each dataset and + * Open the source files and datasets. Append data to each dataset and * close all resources. */ diff --git a/fortran/examples/compound.f90 b/fortran/examples/compound.f90 index d9f8235..57624c6 100644 --- a/fortran/examples/compound.f90 +++ b/fortran/examples/compound.f90 @@ -41,7 +41,7 @@ INTEGER(HID_T) :: dt3_id ! Memory datatype identifier (for double precision field) INTEGER(HID_T) :: dt4_id ! Memory datatype identifier (for real field) INTEGER(HID_T) :: dt5_id ! Memory datatype identifier - INTEGER(HID_T) :: plist_id ! Dataset trasfer property + INTEGER(HID_T) :: plist_id ! Dataset transfer property INTEGER(SIZE_T) :: typesize @@ -111,21 +111,21 @@ type_size = type_sizec + type_sizei + type_sized + type_sizer CALL h5tcreate_f(H5T_COMPOUND_F, type_size, dtype_id, error) ! - ! Insert memebers + ! Insert members ! - ! CHARACTER*2 memeber + ! CHARACTER*2 member ! offset = 0 CALL h5tinsert_f(dtype_id, "char_field", offset, dt5_id, error) ! ! INTEGER member ! - offset = offset + type_sizec ! Offset of the second memeber is 2 + offset = offset + type_sizec ! Offset of the second member is 2 CALL h5tinsert_f(dtype_id, "integer_field", offset, H5T_NATIVE_INTEGER, error) ! ! DOUBLE PRECISION member ! - offset = offset + type_sizei ! Offset of the third memeber is 6 + offset = offset + type_sizei ! Offset of the third member is 6 CALL h5tinsert_f(dtype_id, "double_field", offset, H5T_NATIVE_DOUBLE, error) ! ! REAL member @@ -198,7 +198,7 @@ ! CALL h5dopen_f(file_id, dsetname, dset_id, error) ! - ! Create memeory datatyoe to read character member of the compound datatype. + ! Create memory datatype to read character member of the compound datatype. ! CALL h5tcopy_f(H5T_NATIVE_CHARACTER, dt2_id, error) typesize = 2 @@ -208,7 +208,7 @@ offset = 0 CALL h5tinsert_f(dt1_id, "char_field", offset, dt2_id, error) ! - ! Read part of the datatset and display it. + ! Read part of the dataset and display it. ! CALL h5dread_f(dset_id, dt1_id, char_member_out, data_dims, error) write(*,*) (char_member_out(i), i=1, dimsize) diff --git a/fortran/examples/h5_cmprss.f90 b/fortran/examples/h5_cmprss.f90 index 61efc30..86d9cfa 100644 --- a/fortran/examples/h5_cmprss.f90 +++ b/fortran/examples/h5_cmprss.f90 @@ -51,7 +51,7 @@ PROGRAM h5_cmprss !INTEGER :: szip_pixels_per_block ! - !Initialize FORTRAN predifined datatypes + !Initialize FORTRAN predefined datatypes ! CALL h5open_f(error) ! diff --git a/fortran/examples/h5_crtatt.f90 b/fortran/examples/h5_crtatt.f90 index 996a506..64d2bde 100644 --- a/fortran/examples/h5_crtatt.f90 +++ b/fortran/examples/h5_crtatt.f90 @@ -35,7 +35,7 @@ PROGRAM H5_CRTATT INTEGER(HID_T) :: aspace_id ! Attribute Dataspace identifier INTEGER(HID_T) :: atype_id ! Attribute Dataspace identifier INTEGER(HSIZE_T), DIMENSION(1) :: adims = (/2/) ! Attribute dimension - INTEGER :: arank = 1 ! Attribure rank + INTEGER :: arank = 1 ! Attribute rank INTEGER(SIZE_T) :: attrlen ! Length of the attribute string CHARACTER(LEN=80), DIMENSION(2) :: attr_data ! Attribute data diff --git a/fortran/examples/h5_extend.f90 b/fortran/examples/h5_extend.f90 index 0ad6ef9..86cc3c6 100644 --- a/fortran/examples/h5_extend.f90 +++ b/fortran/examples/h5_extend.f90 @@ -86,7 +86,7 @@ PROGRAM H5_EXTEND INTEGER, DIMENSION(1:3,1:10) :: rdata ! - !Initialize FORTRAN predifined datatypes + !Initialize FORTRAN predefined datatypes ! CALL h5open_f(error) @@ -110,7 +110,7 @@ PROGRAM H5_EXTEND CALL h5pset_chunk_f(crp_list, RANK, dimsc, error) ! - !Create a dataset with 3X3 dimensions using cparms creation propertie . + !Create a dataset with 3X3 dimensions using cparms creation properties. ! CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dataspace, & dset_id, error, crp_list ) diff --git a/fortran/examples/refobjexample.f90 b/fortran/examples/refobjexample.f90 index d420192..873b420 100644 --- a/fortran/examples/refobjexample.f90 +++ b/fortran/examples/refobjexample.f90 @@ -26,7 +26,7 @@ IMPLICIT NONE CHARACTER(LEN=10), PARAMETER :: filename = "FORTRAN.h5" ! File CHARACTER(LEN=8), PARAMETER :: dsetnamei = "INTEGERS" ! Dataset with the integer data - CHARACTER(LEN=17), PARAMETER :: dsetnamer = "OBJECT_REFERENCES" ! Dataset wtih object + CHARACTER(LEN=17), PARAMETER :: dsetnamer = "OBJECT_REFERENCES" ! Dataset with object ! references CHARACTER(LEN=6), PARAMETER :: groupname1 = "GROUP1" ! Groups in the file CHARACTER(LEN=6), PARAMETER :: groupname2 = "GROUP2" ! diff --git a/fortran/examples/testh5fc.sh.in b/fortran/examples/testh5fc.sh.in index db687d8..71f41f8 100644 --- a/fortran/examples/testh5fc.sh.in +++ b/fortran/examples/testh5fc.sh.in @@ -61,7 +61,7 @@ applib=libapp${H5TOOL}.a # short hands # Caution: if some *.h5 files must be cleaned here, list them by names. # Don't use the wildcard form of *.h5 as it will wipe out even *.h5 generated -# by otehr test programs. This will cause a racing condition error when +# by other test programs. This will cause a racing condition error when # parallel make (e.g., gmake -j 4) is used. temp_SRC="$hdf5main $appmain $prog1 $prog2" temp_OBJ=`echo $temp_SRC | sed -e "s/\.${suffix}/.o/g"` diff --git a/fortran/src/H5Af.c b/fortran/src/H5Af.c index 3a2f3d3..4c1f29d 100644 --- a/fortran/src/H5Af.c +++ b/fortran/src/H5Af.c @@ -272,7 +272,7 @@ done: * PURPOSE * Call H5Aopen to open an attribute * INPUTS - * obj_id - Identifer for object to which attribute is attached + * obj_id - Identifier for object to which attribute is attached * attr_name - Attribute access property list * attr_namelen - size of attr_name * aapl_id - Link access property list @@ -317,7 +317,7 @@ done: * PURPOSE * Call h5adelete_by_name to remove an attribute from a specified location * INPUTS - * loc_id - identifer for object to which attribute is attached + * loc_id - identifier for object to which attribute is attached * obj_name - object identifier * obj_namelen - name length * attr_name - name of the attribute @@ -424,7 +424,7 @@ done: * INPUTS * * - * loc_id - Identifer for object to which attribute is attached + * loc_id - Identifier for object to which attribute is attached * obj_name - Name of object, relative to location, * from which attribute is to be removed *TEST* check NULL * idx_type - Type of index; Possible values are: @@ -532,7 +532,7 @@ done: * aapl_id - Attribute access property list * lapl_id - Link access property list * OUTPUTS - * attr_id - attribute identifer + * attr_id - attribute identifier * RETURNS * 0 on success, -1 on failure * AUTHOR diff --git a/fortran/src/H5Aff.F90 b/fortran/src/H5Aff.F90 index 8f56993..53f0a39 100644 --- a/fortran/src/H5Aff.F90 +++ b/fortran/src/H5Aff.F90 @@ -211,7 +211,7 @@ CONTAINS ! ! INPUTS ! obj_id - identifier of a group, dataset, or named -! datatype atttribute to be attached to +! datatype attribute to be attached to ! name - attribute name ! OUTPUTS ! attr_id - attribute identifier @@ -487,7 +487,7 @@ CONTAINS SUBROUTINE h5aget_name_by_idx_f(loc_id, obj_name, idx_type, order, & n, name, hdferr, size, lapl_id) IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: loc_id ! Identifer for object to which attribute is attached + INTEGER(HID_T), INTENT(IN) :: loc_id ! Identifier for object to which attribute is attached CHARACTER(LEN=*), INTENT(IN) :: obj_name ! Name of object, relative to location, ! from which attribute is to be removed *TEST* check NULL INTEGER, INTENT(IN) :: idx_type ! Type of index; Possible values are: @@ -846,7 +846,7 @@ CONTAINS ! identifier and attribute name ! ! INPUTS -! obj_id - Identifer for object to which attribute is attached +! obj_id - Identifier for object to which attribute is attached ! attr_name - Name of attribute to open ! OUTPUTS ! attr_id - attribute identifier @@ -934,7 +934,7 @@ CONTAINS ! SOURCE SUBROUTINE H5Adelete_by_idx_f(loc_id, obj_name, idx_type, order, n, hdferr, lapl_id) IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: loc_id ! Identifer for object to which attribute is attached + INTEGER(HID_T), INTENT(IN) :: loc_id ! Identifier for object to which attribute is attached CHARACTER(LEN=*), INTENT(IN) :: obj_name ! Name of object, relative to location, ! from which attribute is to be removed INTEGER, INTENT(IN) :: idx_type ! Type of index; Possible values are: @@ -991,7 +991,7 @@ CONTAINS ! Removes an attribute from a specified location ! ! INPUTS -! loc_id - Identifer for object to which attribute is attached +! loc_id - Identifier for object to which attribute is attached ! obj_name - Name of attribute to open ! attr_name - Attribute access property list ! lapl_id - Link access property list @@ -1005,7 +1005,7 @@ CONTAINS ! SOURCE SUBROUTINE H5Adelete_by_name_f(loc_id, obj_name, attr_name, hdferr, lapl_id) IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: loc_id ! Identifer for object to which attribute is attached + INTEGER(HID_T), INTENT(IN) :: loc_id ! Identifier for object to which attribute is attached CHARACTER(LEN=*), INTENT(IN) :: obj_name ! Name of object, relative to location, ! from which attribute is to be removed CHARACTER(LEN=*), INTENT(IN) :: attr_name ! Name of attribute to delete @@ -1841,7 +1841,7 @@ CONTAINS ! dims parameter was added to make code portable; ! Aprile 4, 2001 ! -! Changed buf intent to INOUT to be consistant +! Changed buf intent to INOUT to be consistent ! with how the C functions handles it. The pg ! compiler will return 0 if a buf value is not set. ! February, 2008 diff --git a/fortran/src/H5Df.c b/fortran/src/H5Df.c index 4eeb5c7..6c46608 100644 --- a/fortran/src/H5Df.c +++ b/fortran/src/H5Df.c @@ -145,7 +145,7 @@ DONE: * Elena Pourmal * Tuesday, May 14, 2002 * HISTORY - * This function was added to accomodate h5dwrite_f with the + * This function was added to accommodate h5dwrite_f with the * dims argument being of INTEGER(HSIZE_T) type * SOURCE */ @@ -217,7 +217,7 @@ h5dwrite_ref_reg_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id * Elena Pourmal * Wednesday, May 15, 2002 * HISTORY - * This function was added to accomodate h5dread_f subroutine + * This function was added to accommodate h5dread_f subroutine * with the dims parameter being of INTEGER(HSIZE_T_F) size. * SOURCE */ @@ -495,10 +495,10 @@ h5dget_storage_size_c(hid_t_f *dset_id, hsize_t_f *size) c_dset_id = (hid_t)*dset_id; c_size = H5Dget_storage_size(c_dset_id); - if (c_size == 0) - return ret_value; - *size = (hsize_t_f)c_size; - ret_value = 0; + if (c_size != 0) { + ret_value = 0; + } + *size = (hsize_t_f)c_size; return ret_value; } @@ -783,7 +783,7 @@ h5dwrite_vl_string_c(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_ return ret_value; } /* - * Move data from temorary buffer + * Move data from temporary buffer */ tmp_p = tmp; for (i = 0; i < num_elem; i++) { diff --git a/fortran/src/H5Dff.F90 b/fortran/src/H5Dff.F90 index 75af58e..6b77a8c 100644 --- a/fortran/src/H5Dff.F90 +++ b/fortran/src/H5Dff.F90 @@ -476,7 +476,7 @@ CONTAINS ! ! Changed name from the now obsolete h5dextend_f ! to h5dset_extent_f. Provided interface to old name -! for backward compatability. -MSB- March 14, 2008 +! for backward compatibility. -MSB- March 14, 2008 ! ! SOURCE SUBROUTINE h5dset_extent_f(dataset_id, size, hdferr) @@ -1195,7 +1195,7 @@ CONTAINS IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier - INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: dims ! size of the bufffer buf + INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: dims ! size of the buffer buf TYPE(hobj_ref_t_f), DIMENSION(dims(1)), INTENT(IN), TARGET :: buf ! Data buffer INTEGER, INTENT(OUT) :: hdferr ! Error code INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id ! Memory dataspace identfier @@ -1227,7 +1227,7 @@ CONTAINS IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier - INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: dims ! size of the bufffer buf + INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: dims ! size of the buffer buf TYPE(hdset_reg_ref_t_f), DIMENSION(dims(1)), INTENT(IN), TARGET :: buf ! Data buffer INTEGER, INTENT(OUT) :: hdferr ! Error code INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id ! Memory dataspace identfier @@ -1625,8 +1625,7 @@ CONTAINS ! Inputs: ! fill_value - fill value ! space_id - memory space selection identifier -! buf - data buffer iin memory ro apply selection to -! - of k-th dimension of the buf array +! buf - memory buffer containing the selection to be filled ! Outputs: ! hdferr: - error code ! Success: 0 @@ -1676,8 +1675,7 @@ CONTAINS ! Inputs: ! fill_value - fill value ! space_id - memory space selection identifier -! buf - data buffer iin memory ro apply selection to -! - of k-th dimension of the buf array +! buf - memory buffer containing the selection to be filled ! Outputs: ! hdferr: - error code ! Success: 0 @@ -1724,8 +1722,7 @@ CONTAINS ! Inputs: ! fill_value - fill value ! space_id - memory space selection identifier - ! buf - data buffer iin memory ro apply selection to - ! - of k-th dimension of the buf array + ! buf - memory buffer containing the selection to be filled ! Outputs: ! hdferr: - error code ! Success: 0 @@ -1799,8 +1796,7 @@ CONTAINS ! Inputs: ! fill_value - fill value ! space_id - memory space selection identifier -! buf - data buffer iin memory ro apply selection to -! - of k-th dimension of the buf array +! buf - memory buffer containing the selection to be filled ! Outputs: ! hdferr: - error code ! Success: 0 diff --git a/fortran/src/H5Ff.c b/fortran/src/H5Ff.c index af420a4..089bb55 100644 --- a/fortran/src/H5Ff.c +++ b/fortran/src/H5Ff.c @@ -631,7 +631,7 @@ h5fget_name_c(hid_t_f *obj_id, size_t_f *size, _fcd buf, size_t_f *buflen) int_f ret_value = 0; /* Return value */ /* - * Allocate buffer to hold name of an attribute + * Allocate buffer to hold name of file */ if (NULL == (c_buf = (char *)HDmalloc((size_t)*buflen + 1))) HGOTO_DONE(FAIL); @@ -639,7 +639,7 @@ h5fget_name_c(hid_t_f *obj_id, size_t_f *size, _fcd buf, size_t_f *buflen) /* * Call H5Fget_name function */ - if ((size_c = H5Fget_name((hid_t)*obj_id, c_buf, (size_t)*buflen)) < 0) + if ((size_c = H5Fget_name((hid_t)*obj_id, c_buf, (size_t)*buflen + 1)) < 0) HGOTO_DONE(FAIL); /* diff --git a/fortran/src/H5Fff.F90 b/fortran/src/H5Fff.F90 index 3e79d75..7558fb1 100644 --- a/fortran/src/H5Fff.F90 +++ b/fortran/src/H5Fff.F90 @@ -85,7 +85,7 @@ CONTAINS INTEGER(HID_T), INTENT(OUT) :: file_id ! File identifier INTEGER, INTENT(OUT) :: hdferr ! Error code INTEGER(HID_T), OPTIONAL, INTENT(IN) :: creation_prp - ! File creation propertly + ! File creation property ! list identifier INTEGER(HID_T), OPTIONAL, INTENT(IN) :: access_prp ! File access property list diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c index dd0e52f..a26b8f2 100644 --- a/fortran/src/H5Gf.c +++ b/fortran/src/H5Gf.c @@ -390,13 +390,13 @@ DONE: * Call H5Glink2 to link the specified type * INPUTS * cur_loc_id - identifier of file or group - * cur_name - name of the existing object for hard link releative + * cur_name - name of the existing object for hard link relative * to cur_loc_id location, * anything for the soft link * current_namelen - current name length * link_type - link type * new_loc_id - location identifier - * new_name - new name for the object releative to the new_loc_id + * new_name - new name for the object relative to the new_loc_id * location * new_namelen - new_name length * RETURNS @@ -879,7 +879,7 @@ done: * February 15, 2008 * HISTORY * - * - Added 'mounted' paramater + * - Added 'mounted' parameter * M. Scot Breitenfeld * July 16, 2008 * SOURCE @@ -1014,7 +1014,7 @@ done: * February 18, 2008 * HISTORY * - * - Added 'mounted' paramater + * - Added 'mounted' parameter * M. Scot Breitenfeld * July 16, 2008 * SOURCE diff --git a/fortran/src/H5Gff.F90 b/fortran/src/H5Gff.F90 index 9e7665f..bfca595 100644 --- a/fortran/src/H5Gff.F90 +++ b/fortran/src/H5Gff.F90 @@ -73,7 +73,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 5, 2001 ! -! Added additional optional paramaters in 1.8 +! Added additional optional parameters in 1.8 ! MSB - February 27, 2008 ! ! SOURCE @@ -491,8 +491,8 @@ CONTAINS INTEGER, INTENT(OUT) :: hdferr ! Error code !***** - INTEGER :: current_namelen ! Lenghth of the current_name string - INTEGER :: new_namelen ! Lenghth of the new_name string + INTEGER :: current_namelen ! Length of the current_name string + INTEGER :: new_namelen ! Length of the new_name string INTERFACE INTEGER FUNCTION h5glink_c(loc_id, link_type, current_name, & @@ -524,7 +524,7 @@ CONTAINS ! PURPOSE ! Creates a link of the specified type from new_name ! to current_name. current_name and new_name are interpreted -! releative to current and new location identifiers. +! relative to current and new location identifiers. ! ! INPUTS ! cur_loc_id - location identifier @@ -559,8 +559,8 @@ CONTAINS INTEGER, INTENT(OUT) :: hdferr ! Error code !***** - INTEGER :: cur_namelen ! Lenghth of the current_name string - INTEGER :: new_namelen ! Lenghth of the new_name string + INTEGER :: cur_namelen ! Length of the current_name string + INTEGER :: new_namelen ! Length of the new_name string INTERFACE INTEGER FUNCTION h5glink2_c(cur_loc_id, cur_name, cur_namelen, & @@ -617,7 +617,7 @@ CONTAINS CHARACTER(LEN=*), INTENT(IN) :: name ! Name of an object INTEGER, INTENT(OUT) :: hdferr ! Error code !***** - INTEGER :: namelen ! Lenghth of the name character string + INTEGER :: namelen ! Length of the name character string INTERFACE INTEGER FUNCTION h5gunlink_c(loc_id, name, namelen) BIND(C,NAME='h5gunlink_c') @@ -666,8 +666,8 @@ CONTAINS CHARACTER(LEN=*), INTENT(IN) :: new_name ! New name of an object INTEGER, INTENT(OUT) :: hdferr ! Error code !***** - INTEGER :: namelen ! Lenghth of the current_name string - INTEGER :: new_namelen ! Lenghth of the new_name string + INTEGER :: namelen ! Length of the current_name string + INTEGER :: new_namelen ! Length of the new_name string INTERFACE INTEGER FUNCTION h5gmove_c(loc_id, name, namelen, new_name, new_namelen) BIND(C,NAME='h5gmove_c') @@ -715,7 +715,7 @@ CONTAINS INTEGER, INTENT(OUT) :: hdferr ! Error code !***** INTEGER :: src_namelen ! Length of the current_name string - INTEGER :: dst_namelen ! Lenghth of the new_name string + INTEGER :: dst_namelen ! Length of the new_name string INTERFACE INTEGER FUNCTION h5gmove2_c(src_loc_id, src_name, src_namelen, & @@ -776,7 +776,7 @@ CONTAINS ! points to INTEGER, INTENT(OUT) :: hdferr ! Error code !***** - INTEGER :: namelen ! Lenghth of the current_name string + INTEGER :: namelen ! Length of the current_name string INTERFACE INTEGER FUNCTION h5gget_linkval_c(loc_id, name, namelen, size, buffer) BIND(C,NAME='h5gget_linkval_c') @@ -827,8 +827,8 @@ CONTAINS CHARACTER(LEN=*), INTENT(IN) :: comment ! New name of an object INTEGER, INTENT(OUT) :: hdferr ! Error code !***** - INTEGER :: namelen ! Lenghth of the current_name string - INTEGER :: commentlen ! Lenghth of the comment string + INTEGER :: namelen ! Length of the current_name string + INTEGER :: commentlen ! Length of the comment string INTERFACE INTEGER FUNCTION h5gset_comment_c(loc_id, name, namelen, & @@ -1024,7 +1024,7 @@ CONTAINS ! ! HISTORY ! -! - Added 'mounted' paramater +! - Added 'mounted' parameter ! M. Scot Breitenfeld ! July 16, 2008 ! @@ -1104,7 +1104,7 @@ CONTAINS ! February 18, 2008 ! ! HISTORY -! Added 'mounted' paramater +! Added 'mounted' parameter ! M. Scot Breitenfeld ! July 16, 2008 ! @@ -1206,7 +1206,7 @@ CONTAINS ! February 18, 2008 ! ! HISTORY -! Added 'mounted' paramater +! Added 'mounted' parameter ! M. Scot Breitenfeld ! July 16, 2008 ! SOURCE diff --git a/fortran/src/H5Lff.F90 b/fortran/src/H5Lff.F90 index 3d21656..3c8f311 100644 --- a/fortran/src/H5Lff.F90 +++ b/fortran/src/H5Lff.F90 @@ -1317,7 +1317,7 @@ CONTAINS ! Inputs: ! group_id - Identifier specifying subject group ! index_type - Type of index which determines the order: -! H5_INDEX_NAME_F - Alpha-numeric index on name +! H5_INDEX_NAME_F - Alphanumeric index on name ! H5_INDEX_CRT_ORDER_F - Index on creation order ! order - Order within index: ! H5_ITER_INC_F - Increasing order @@ -1393,7 +1393,7 @@ CONTAINS ! loc_id - File or group identifier specifying location of subject group ! group_name - Name of subject group ! index_type - Type of index which determines the order: -! H5_INDEX_NAME_F - Alpha-numeric index on name +! H5_INDEX_NAME_F - Alphanumeric index on name ! H5_INDEX_CRT_ORDER_F - Index on creation order ! order - Order within index: ! H5_ITER_INC_F - Increasing order diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index dd7b855..9c122e1 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -145,7 +145,7 @@ done: * plist1_id - property list identifier * plist2_id - property list identifier * OUTPUTS - * c_flag - flag to indicate that lists are eqaul + * c_flag - flag to indicate that lists are equal * RETURNS * 0 on success, -1 on failure * AUTHOR @@ -931,7 +931,7 @@ h5pset_fapl_stdio_c(hid_t_f *prp_id) * NAME * h5pget_fapl_stdio_c * PURPOSE - * Call H5Pget_fapl_stdio to determine whther the low level file driver + * Call H5Pget_fapl_stdio to determine whether the low level file driver * uses the functions declared in the stdio.h * INPUTS * prp_id - property list identifier @@ -1008,7 +1008,7 @@ h5pset_fapl_sec2_c(hid_t_f *prp_id) * NAME * h5pget_fapl_sec2_c * PURPOSE - * Call H5Pget_fapl_stdio to determine whther the low level file driver + * Call H5Pget_fapl_stdio to determine whether the low level file driver * uses the functions declared in the unistd.h * INPUTS * prp_id - property list identifier @@ -2181,7 +2181,7 @@ h5pset_fclose_degree_c(hid_t_f *fapl_id, int_f *degree) * PURPOSE * Call H5Pset_buffer to set size of conversion buffer * INPUTS - * prp_id - t`dataset trasfer property list identifier + * prp_id - t`dataset transfer property list identifier * size - size of the buffer * OUTPUTS * NONE @@ -2216,7 +2216,7 @@ h5pset_buffer_c(hid_t_f *prp_id, hsize_t_f *size) * PURPOSE * Call H5Pget_buffer to get size of conversion buffer * INPUTS - * prp_id - t`dataset trasfer property list identifier + * prp_id - t`dataset transfer property list identifier * OUTPUTS * size - size of conversion buffer * RETURNS @@ -3000,11 +3000,11 @@ h5pget_nprops_c(hid_t_f *plist, size_t_f *nprops) * h5pget_class_parent_c * PURPOSE * Call H5Pget_class_parent to get the parent class of - * a genereic property class + * a generic property class * INPUTS * prp_id - property list to query * OUTPUTS - * parent_id - parent classs identifier + * parent_id - parent class identifier * RETURNS * 0 on success, -1 on failure * AUTHOR @@ -3500,7 +3500,7 @@ h5pset_family_offset_c(hid_t_f *prp_id, hsize_t_f *offset) * NAME * h5pset_fapl_multi_c * PURPOSE - * Call H5Pset_fapl_multi to set multi file dirver + * Call H5Pset_fapl_multi to set multi file driver * INPUTS * prp_id - file_creation property list identifier * mem_map - memory mapping array @@ -3565,7 +3565,7 @@ h5pset_fapl_multi_c(hid_t_f *prp_id, int_f *memb_map, hid_t_f *memb_fapl, _fcd m tmp_p = tmp_p + c_lenmax; } /* - * Take care of othe arguments + * Take care of other arguments */ tmp_max_addr = (long double)(HADDR_MAX); c_prp_id = (hid_t)*prp_id; @@ -3598,7 +3598,7 @@ DONE: * NAME * h5pset_fapl_multi_sc * PURPOSE - * Call H5Pset_fapl_multi to set multi file dirver + * Call H5Pset_fapl_multi to set multi file driver * INPUTS * prp_id - file_creation property list identifier * RETURNS @@ -3636,7 +3636,7 @@ h5pset_fapl_multi_sc(hid_t_f *prp_id, int_f *flag) * NAME * h5pget_fapl_multi_c * PURPOSE - * Call H5Pget_fapl_multi to set multi file dirver + * Call H5Pget_fapl_multi to set multi file driver * INPUTS * prp_id - file_creation property list identifier * lenmax - length of the name a sdeclared in Fortran @@ -4602,7 +4602,7 @@ h5pget_copy_object_c(hid_t_f *ocp_plist_id, int_f *copy_options) * INPUTS * * prp_id - property list identifier to query - * expression_len - buffer size transorm expression + * expression_len - buffer size transform expression * * Output: * expression - buffer to hold transform expression @@ -4665,7 +4665,7 @@ done: * * prp_id - property list identifier to query * expression - buffer to hold transform expression - * expression_len - buffer size transorm expression + * expression_len - buffer size transform expression * * Output: * @@ -5473,7 +5473,7 @@ h5pget_fapl_mpio_c(hid_t_f *prp_id, int_f *comm, int_f *info) * h5pset_dxpl_mpio_c * PURPOSE * Call H5Pset_dxpl_mpio to set transfer mode of the dataset - * trasfer property list + * transfer property list * INPUTS * prp_id - property list identifier * data_xfer_mode - transfer mode @@ -5525,7 +5525,7 @@ h5pset_dxpl_mpio_c(hid_t_f *prp_id, int_f *data_xfer_mode) * h5pget_dxpl_mpio_c * PURPOSE * Call H5Pget_dxpl_mpio to get transfer mode of the dataset - * trasfer property list + * transfer property list * INPUTS * prp_id - property list identifier * data_xfer_mode - buffer to retrieve transfer mode diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index b0b3f53..2734d49 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -500,7 +500,7 @@ CONTAINS ! a chunked layout dataset. ! ! INPUTS -! prp_id - datatset creation property list identifier +! prp_id - dataset creation property list identifier ! ndims - number of dimensions for each chunk ! dims - array with dimension sizes for each chunk ! OUTPUTS @@ -1880,7 +1880,7 @@ CONTAINS ! INPUTS ! ! prp_id - file access property list identifier -! gc_reference - flag for stting garbage collection on +! gc_reference - flag for setting garbage collection on ! and off (1 or 0) ! OUTPUTS ! @@ -1931,7 +1931,7 @@ CONTAINS ! prp_id - file access property list identifier ! OUTPUTS ! -! gc_reference - flag for stting garbage collection on +! gc_reference - flag for setting garbage collection on ! and off (1 or 0) ! hdferr - error code ! Success: 0 @@ -2659,7 +2659,7 @@ CONTAINS ! h5pequal_f ! ! PURPOSE -! Checks if two property lists are eqaul +! Checks if two property lists are equal ! ! INPUTS ! @@ -3059,7 +3059,7 @@ CONTAINS ! INPUTS ! ! plist_id - file access property list identifier -! size - metatdata block size +! size - metadata block size ! OUTPUTS ! ! hdferr - error code @@ -3103,7 +3103,7 @@ CONTAINS ! plist_id - file access property list identifier ! OUTPUTS ! -! size - metatdata block size +! size - metadata block size ! hdferr - error code ! Success: 0 ! Failure: -1 @@ -3596,7 +3596,7 @@ CONTAINS ! h5pget_class_parent_f ! ! PURPOSE -! Retrieves the parent class of a genric property class. +! Retrieves the parent class of a generic property class. ! ! INPUTS ! @@ -4759,7 +4759,7 @@ CONTAINS ! H5Pget_libver_bounds_f ! ! PURPOSE -! Retrieves the lower and upper bounds on the HDF5 library release versions that indirectly +! Retrieves the lower and upper bounds on the HDF5 library release versions that indirectly ! determine the object format versions used when creating objects in the file. ! ! INPUTS @@ -5391,7 +5391,7 @@ CONTAINS ! ! HISTORY ! -! Should hdferr return just 0 or 1 and add another arguement for the size? +! Should hdferr return just 0 or 1 and add another argument for the size? ! Fortran90 Interface: SUBROUTINE h5pget_data_transform_f(plist_id, expression, hdferr, size) IMPLICIT NONE diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c index b5585d9..8a4da86 100644 --- a/fortran/src/H5Sf.c +++ b/fortran/src/H5Sf.c @@ -388,7 +388,7 @@ done: * PURPOSE * Call H5Sget_select_elem_pointlist * get a list of element points in the - * current dataspace selectin. + * current dataspace selection. * Starting with the startpoint-th point in the * list of points, numpoints points are put into the user's * buffer. If the user's buffer fills up before numpoints @@ -759,7 +759,7 @@ done: * space_id - identifier of the dataspace * rank - dataspace rank * current_size - array with the new dimension sizes - * maximum_size - aray with maximum sizes of dimensions + * maximum_size - array with maximum sizes of dimensions * RETURNS * 0 on success, -1 on failure * AUTHOR @@ -804,7 +804,7 @@ done: * space_id - identifier of the dataspace * OUTPUTS * dims - array with the dimension sizes - * maxdims - aray with maximum sizes of dimensions + * maxdims - array with maximum sizes of dimensions * RETURNS * number of dataspace dimensions (rank) on success, -1 on failure * AUTHOR @@ -852,7 +852,7 @@ done: * NAME * h5sis_simple_c * PURPOSE - * Call H5Sis_simple to detrmine if the dataspace + * Call H5Sis_simple to determine if the dataspace * is simple. * INPUTS * space_id - identifier of the dataspace diff --git a/fortran/src/H5Sff.F90 b/fortran/src/H5Sff.F90 index e68d66f..07c7018 100644 --- a/fortran/src/H5Sff.F90 +++ b/fortran/src/H5Sff.F90 @@ -447,7 +447,7 @@ CONTAINS ! INPUTS ! space_id - dataspace identifier ! startpoint - element point to start with -! num_points - number of elemnt points to get +! num_points - number of element points to get ! OUTPUTS ! buf - buffer with element points selected ! hdferr - Returns 0 if successful and -1 if fails diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c index 1516cc7..f3016f1 100644 --- a/fortran/src/H5Tf.c +++ b/fortran/src/H5Tf.c @@ -1560,7 +1560,7 @@ h5tget_member_type_c(hid_t_f *type_id, int_f *field_idx, hid_t_f *datatype) * Call H5Tcreate to create a datatype * INPUTS * cls - class type - * size - size of the class memeber + * size - size of the class member * RETURNS * 0 on success, -1 on failure * AUTHOR @@ -2033,7 +2033,7 @@ h5tvlen_create_c(hid_t_f *type_id, hid_t_f *vltype_id) * NAME * h5tis_variable_str_c * PURPOSE - * Call H5Tis_variable_str to detrmine if the datatype + * Call H5Tis_variable_str to determine if the datatype * is a variable string. * INPUTS * type_id - identifier of the dataspace @@ -2069,7 +2069,7 @@ h5tis_variable_str_c(hid_t_f *type_id, int_f *flag) * NAME * h5tget_member_class_c * PURPOSE - * Call H5Tget_member_class to detrmine ithe class of the compound + * Call H5Tget_member_class to determine ithe class of the compound * datatype member * INPUTS * type_id - identifier of the dataspace diff --git a/fortran/src/H5Tff.F90 b/fortran/src/H5Tff.F90 index 0eab39e..7582dab 100644 --- a/fortran/src/H5Tff.F90 +++ b/fortran/src/H5Tff.F90 @@ -86,7 +86,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 7, 2001 ! -! Added optional parameter 'tapl_id' for compatability +! Added optional parameter 'tapl_id' for compatibility ! with H5Topen2. April 9, 2009. ! ! SOURCE @@ -212,7 +212,7 @@ CONTAINS ! h5tcopy_f ! ! PURPOSE -! Creates a copy of exisiting datatype. +! Creates a copy of existing datatype. ! ! INPUTS ! type_id - datatype identifier diff --git a/fortran/src/H5_buildiface.F90 b/fortran/src/H5_buildiface.F90 index fb3a002..090b6db 100644 --- a/fortran/src/H5_buildiface.F90 +++ b/fortran/src/H5_buildiface.F90 @@ -14,7 +14,7 @@ ! ! NOTES ! This program uses the Fortran 2008 intrinsic function STORAGE_SIZE or SIZEOF -! depending on availablity.It generates code that makes use of +! depending on availability.It generates code that makes use of ! STORAGE_SIZE/SIZEOF in H5_gen.F90. STORAGE_SIZE is standard ! compliant and should always be chosen over SIZEOF. ! @@ -437,7 +437,7 @@ PROGRAM H5_buildiface ! dims parameter was added to make code portable; ! Aprile 4, 2001 ! -! Changed buf intent to INOUT to be consistant +! Changed buf intent to INOUT to be consistent ! with how the C functions handles it. The pg ! compiler will return 0 if a buf value is not set. ! February, 2008 @@ -564,7 +564,7 @@ PROGRAM H5_buildiface ! dims parameter was added to make code portable; ! Aprile 4, 2001 ! -! Changed buf intent to INOUT to be consistant +! Changed buf intent to INOUT to be consistent ! with how the C functions handles it. The pg ! compiler will return 0 if a buf value is not set. ! February, 2008 @@ -677,7 +677,7 @@ PROGRAM H5_buildiface ! Optional parameters: ! mem_space_id - memory dataspace identifier ! file_space_id - file dataspace identifier -! xfer_prp - trasfer property list identifier +! xfer_prp - transfer property list identifier ! ! AUTHOR ! Elena Pourmal diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index 21363a5..c9bdac7 100644 --- a/fortran/src/H5_ff.F90 +++ b/fortran/src/H5_ff.F90 @@ -698,7 +698,7 @@ CONTAINS ! ! Outputs: ! majnum - major version of the library -! minum - minor version of the library +! minnum - minor version of the library ! relnum - release version of the library ! error - Returns 0 if successful and -1 if fails ! @@ -733,7 +733,7 @@ CONTAINS ! ! Inputs: ! majnum - major version of the library -! minum - minor version of the library +! minnum - minor version of the library ! relnum - release version of the library ! ! Outputs: diff --git a/fortran/src/H5f90global.F90 b/fortran/src/H5f90global.F90 index c1c73f7..840b8a7 100644 --- a/fortran/src/H5f90global.F90 +++ b/fortran/src/H5f90global.F90 @@ -844,7 +844,7 @@ CONTAINS END SUBROUTINE H5_Fortran_string_f2c -! Copy Fortran string to C charater array, assuming the C array is one-char +! Copy Fortran string to C character array, assuming the C array is one-char ! longer for the terminating null char. ! fstring : the Fortran input string ! cstring : the C output string (with memory already allocated) @@ -872,7 +872,7 @@ CONTAINS !!$ cstring(j) = C_NULL_CHAR !!$end subroutine MPIR_Fortran_string_f2c !!$ -!!$! Copy C charater array to Fortran string +!!$! Copy C character array to Fortran string !!$subroutine MPIR_Fortran_string_c2f(cstring, fstring) !!$ implicit none !!$ character(kind=c_char), intent(in) :: cstring(:) diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index 1480ca8..74e88e8 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -534,7 +534,7 @@ H5_FCDLL int_f h5pget_dxpl_mpio_c(hid_t_f *prp_id, int_f *data_xfer_mode); H5_FCDLL int_f h5pset_dxpl_mpio_c(hid_t_f *prp_id, int_f *data_xfer_mode); #endif /* - * Functions frome H5Rf.c + * Functions from H5Rf.c */ H5_FCDLL int_f h5rcreate_region_c(int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *space_id); H5_FCDLL int_f h5rcreate_ptr_c(void *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *ref_type, diff --git a/fortran/src/h5fc.in b/fortran/src/h5fc.in index a56d38d..79401f8 100644 --- a/fortran/src/h5fc.in +++ b/fortran/src/h5fc.in @@ -38,7 +38,7 @@ HL="@HL@" ## $FLINKER $FCFLAGS $H5BLD_FCFLAGS $F9XSUFFIXFLAG $LDFLAGS $LIBS ## ## $fmodules $link_objs $link_args $shared_link ## ## ## -## These settings can be overriden by setting HDF5_FCFLAGS, ## +## These settings can be overridden by setting HDF5_FCFLAGS, ## ## HDF5_LDFLAGS, or HDF5_LIBS in the environment. ## ## ## ############################################################################ @@ -136,7 +136,7 @@ usage() { echo " shared libraries]" echo " " echo " You can also add or change paths and flags to the compile line using" - echo " the following environment varibles or by assigning them to their counterparts" + echo " the following environment variables or by assigning them to their counterparts" echo " in the 'Things You Can Modify to Override...'" section of $prog_name echo " " echo " Variable Current value to be replaced" @@ -298,7 +298,7 @@ fi if test "x$do_link" = "xyes"; then shared_link="" -# conditionnaly link with the hl library +# conditionally link with the hl library if test "X$HL" = "Xhl"; then libraries=" $libraries -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 " else diff --git a/src/H5.c b/src/H5.c index 3998a25..2993308 100644 --- a/src/H5.c +++ b/src/H5.c @@ -984,7 +984,7 @@ done: /*------------------------------------------------------------------------- * Function: H5close * - * Purpose: Terminate the library and release all resources. + * Purpose: Terminate the library and release all resources. * * Return: Non-negative on success/Negative on failure * @@ -1120,19 +1120,22 @@ H5free_memory(void *mem) herr_t H5is_library_threadsafe(hbool_t *is_ts) { + herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_API_NOINIT H5TRACE1("e", "*b", is_ts); - HDassert(is_ts); - - /* At this time, it is impossible for this to fail. */ + if (is_ts) { #ifdef H5_HAVE_THREADSAFE - *is_ts = TRUE; + *is_ts = TRUE; #else /* H5_HAVE_THREADSAFE */ - *is_ts = FALSE; + *is_ts = FALSE; #endif /* H5_HAVE_THREADSAFE */ + } + else + ret_value = FAIL; - FUNC_LEAVE_API_NOINIT(SUCCEED) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5is_library_threadsafe() */ #if defined(H5_HAVE_THREADSAFE) && defined(H5_BUILT_AS_DYNAMIC_LIB) && defined(H5_HAVE_WIN32_API) && \ diff --git a/src/H5FDmirror.c b/src/H5FDmirror.c index 2c8f336..a29a6fa 100644 --- a/src/H5FDmirror.c +++ b/src/H5FDmirror.c @@ -298,7 +298,7 @@ H5FD__mirror_xmit_decode_uint16(uint16_t *out, const unsigned char *_buf) HDassert(_buf && out); - HDmemcpy(&n, _buf, sizeof(n)); + H5MM_memcpy(&n, _buf, sizeof(n)); *out = (uint16_t)HDntohs(n); return 2; /* number of bytes eaten */ @@ -326,7 +326,7 @@ H5FD__mirror_xmit_decode_uint32(uint32_t *out, const unsigned char *_buf) HDassert(_buf && out); - HDmemcpy(&n, _buf, sizeof(n)); + H5MM_memcpy(&n, _buf, sizeof(n)); *out = (uint32_t)HDntohl(n); return 4; /* number of bytes eaten */ @@ -385,7 +385,7 @@ H5FD__mirror_xmit_decode_uint64(uint64_t *out, const unsigned char *_buf) HDassert(_buf && out); - HDmemcpy(&n, _buf, sizeof(n)); + H5MM_memcpy(&n, _buf, sizeof(n)); if (TRUE == is_host_little_endian()) *out = BSWAP_64(n); else @@ -412,7 +412,7 @@ H5FD__mirror_xmit_decode_uint8(uint8_t *out, const unsigned char *_buf) HDassert(_buf && out); - HDmemcpy(out, _buf, sizeof(uint8_t)); + H5MM_memcpy(out, _buf, sizeof(uint8_t)); return 1; /* number of bytes eaten */ } /* end H5FD__mirror_xmit_decode_uint8() */ @@ -439,7 +439,7 @@ H5FD__mirror_xmit_encode_uint16(unsigned char *_dest, uint16_t v) HDassert(_dest); n = (uint16_t)HDhtons(v); - HDmemcpy(_dest, &n, sizeof(n)); + H5MM_memcpy(_dest, &n, sizeof(n)); return 2; } /* end H5FD__mirror_xmit_encode_uint16() */ @@ -466,7 +466,7 @@ H5FD__mirror_xmit_encode_uint32(unsigned char *_dest, uint32_t v) HDassert(_dest); n = (uint32_t)HDhtonl(v); - HDmemcpy(_dest, &n, sizeof(n)); + H5MM_memcpy(_dest, &n, sizeof(n)); return 4; } /* end H5FD__mirror_xmit_encode_uint32() */ @@ -494,7 +494,7 @@ H5FD__mirror_xmit_encode_uint64(unsigned char *_dest, uint64_t v) if (TRUE == is_host_little_endian()) n = BSWAP_64(v); - HDmemcpy(_dest, &n, sizeof(n)); + H5MM_memcpy(_dest, &n, sizeof(n)); return 8; } /* H5FD__mirror_xmit_encode_uint64() */ @@ -519,7 +519,7 @@ H5FD__mirror_xmit_encode_uint8(unsigned char *dest, uint8_t v) HDassert(dest); - HDmemcpy(dest, &v, sizeof(v)); + H5MM_memcpy(dest, &v, sizeof(v)); return 1; } /* end H5FD__mirror_xmit_encode_uint8() */ @@ -1166,7 +1166,7 @@ done: /* ------------------------------------------------------------------------- * Function: H5FD__mirror_fapl_get * - * Purpose: Get the file access propety list which could be used to create + * Purpose: Get the file access property list which could be used to create * an identical file. * * Return: Success: pointer to the new file access property list value. @@ -1188,7 +1188,7 @@ H5FD__mirror_fapl_get(H5FD_t *_file) if (NULL == fa) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "calloc failed"); - HDmemcpy(fa, &(file->fa), sizeof(H5FD_mirror_fapl_t)); + H5MM_memcpy(fa, &(file->fa), sizeof(H5FD_mirror_fapl_t)); ret_value = fa; @@ -1224,7 +1224,7 @@ H5FD__mirror_fapl_copy(const void *_old_fa) if (new_fa == NULL) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "memory allocation failed"); - HDmemcpy(new_fa, old_fa, sizeof(H5FD_mirror_fapl_t)); + H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_mirror_fapl_t)); ret_value = new_fa; done: @@ -1266,25 +1266,25 @@ H5FD__mirror_fapl_free(void *_fa) * Function: H5Pget_fapl_mirror * * Purpose: Get the configuration information for this fapl. - * Data is memcopied into the fa_out pointer. + * Data is memcopied into the fa_dst pointer. * * Return: SUCCEED/FAIL * ------------------------------------------------------------------------- */ herr_t -H5Pget_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa_out) +H5Pget_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa_dst) { - const H5FD_mirror_fapl_t *fa = NULL; + const H5FD_mirror_fapl_t *fa_src = NULL; H5P_genplist_t * plist = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*x", fapl_id, fa_out); + H5TRACE2("e", "i*x", fapl_id, fa_dst); LOG_OP_CALL(FUNC); - if (NULL == fa_out) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_out is NULL"); + if (NULL == fa_dst) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_dst is NULL"); plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); if (NULL == plist) @@ -1292,13 +1292,13 @@ H5Pget_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa_out) if (H5P_peek_driver(plist) != H5FD_MIRROR) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); - fa = (const H5FD_mirror_fapl_t *)H5P_peek_driver_info(plist); - if (NULL == fa) + fa_src = (const H5FD_mirror_fapl_t *)H5P_peek_driver_info(plist); + if (NULL == fa_src) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); - HDassert(fa->magic == H5FD_MIRROR_FAPL_MAGIC); /* sanity check */ + HDassert(fa_src->magic == H5FD_MIRROR_FAPL_MAGIC); /* sanity check */ - HDmemcpy(fa_out, fa, sizeof(H5FD_mirror_fapl_t)); + H5MM_memcpy(fa_dst, fa_src, sizeof(H5FD_mirror_fapl_t)); done: FUNC_LEAVE_API(ret_value); diff --git a/src/H5FDmirror_priv.h b/src/H5FDmirror_priv.h index b387f72..f647c21 100644 --- a/src/H5FDmirror_priv.h +++ b/src/H5FDmirror_priv.h @@ -31,7 +31,7 @@ extern "C" { /* Define the maximum allowed size for a receiving buffer when accepting bytes to * write. Writes larger than this size are performed by multiple accept-write * steps by the Writer. */ -#define H5FD_MIRROR_DATA_BUFFER_MAX H5_GB /* 1 Gigabyte */ +#define H5FD_MIRROR_DATA_BUFFER_MAX (1024 * 1024 * 1024) /* 1 Gigabyte */ #define H5FD_MIRROR_XMIT_CURR_VERSION 1 #define H5FD_MIRROR_XMIT_MAGIC 0x87F8005B diff --git a/test/hdfs.c b/test/hdfs.c index 5465e77..dfaa585 100644 --- a/test/hdfs.c +++ b/test/hdfs.c @@ -1448,15 +1448,6 @@ test_noops_and_autofails(void) H5E_BEGIN_TRY{ JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, TRUE), "truncate must fail (closing)")} H5E_END_TRY; - /* no-op calls to `lock()` and `unlock()` - */ - JSVERIFY(SUCCEED, H5FDlock(file, TRUE), "lock always succeeds; has no effect") - JSVERIFY(SUCCEED, H5FDlock(file, FALSE), "lock issue") - JSVERIFY(SUCCEED, H5FDunlock(file), "unlock issue") - /* Lock/unlock with null file or similar error crashes tests. - * HDassert in calling heirarchy, `H5FD[un]lock()` and `H5FD_[un]lock()` - */ - /************ * TEARDOWN * ************/ diff --git a/test/istore.c b/test/istore.c index c75b8bf..f198aad 100644 --- a/test/istore.c +++ b/test/istore.c @@ -330,25 +330,6 @@ test_extend(hid_t f, const char *prefix, size_t nx, size_t ny, size_t nz) } } -#if 0 - if (0 == ctr) - HDfprintf(stderr,"\n"); - HDfprintf(stderr," Insert: ctr=%lu, corner=(%ld", (unsigned long)ctr, (long)offset[0]); - if (ndims > 1) - HDfprintf(stderr,",%ld", (long)offset[1]); - if (ndims > 2) - HDfprintf(stderr,",%ld", (long)offset[2]); - HDfprintf(stderr,"), size=(%lu", (unsigned long)size[0]); - if (ndims > 1) - HDfprintf(stderr,",%lu", (unsigned long)size[1]); - if (ndims > 2) - HDfprintf(stderr,",%lu", (unsigned long)size[2]); - HDfprintf(stderr,"), %lu element%s", (unsigned long)nelmts, 1 == nelmts ? "" : "s"); - if (0 == nelmts) - HDfprintf(stderr," *SKIPPED*"); - HDfprintf(stderr,"\n"); -#endif - /* Fill the source array */ if (0 == nelmts) continue; @@ -478,7 +459,7 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks, size_t nx, size_t ny, s hsize_t ctr; char dims[64], s[256], name[256]; hsize_t offset[3]; - hsize_t size[3], total = 0; + hsize_t size[3]; uint8_t *buf = NULL; hsize_t whole_size[3]; /* Size of dataset's dataspace */ size_t u; /* Local index variable */ @@ -503,7 +484,7 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks, size_t nx, size_t ny, s HDsprintf(s, "istore sparse: %s", dims); TESTING(s); if (skip_test) { - SKIPPED() + SKIPPED(); return SUCCEED; } buf = (uint8_t *)HDmalloc(nx * ny * nz); @@ -559,10 +540,6 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks, size_t nx, size_t ny, s HDprintf(")\n"); goto error; } - total += nx * ny * nz; -#if 0 - HDfprintf(stderr,"ctr: ctr=%Zu, total=%Zu\n", ctr, total); -#endif /* We don't test reading yet.... */ } diff --git a/test/mirror_vfd.c b/test/mirror_vfd.c index 3556cd2..34a4481 100644 --- a/test/mirror_vfd.c +++ b/test/mirror_vfd.c @@ -75,6 +75,25 @@ static unsigned int g_verbosity = DEFAULT_VERBOSITY; #define MIRR_MESG_SIZE 128 static char mesg[MIRR_MESG_SIZE + 1]; +/* ---------------------------------------------------------------------------- + * Structure: struct mt_opts + * + * Purpose: Convenience structure to hold options as parsed from the + * command line. + * + * `portno` (int) + * Port number, as received from arguments. + * + * `ip` (char *) + * IP address string as received from arguments. + * + * ---------------------------------------------------------------------------- + */ +struct mt_opts { + int portno; + char ip[H5FD_MIRROR_MAX_IP_LEN + 1]; +}; + /* Convenience structure for passing file names via helper functions. */ struct mirrortest_filenames { @@ -98,7 +117,8 @@ static herr_t _close_chunking_ids(unsigned min_dset, unsigned max_dset, hid_t *d static herr_t _populate_filepath(const char *dirname, const char *_basename, hid_t fapl_id, char *path_out, hbool_t h5suffix); -static hid_t create_mirroring_split_fapl(const char *_basename, struct mirrortest_filenames *names); +static hid_t create_mirroring_split_fapl(const char *_basename, struct mirrortest_filenames *names, + const struct mt_opts *opts); static void mybzero(void *dest, size_t size); @@ -128,7 +148,7 @@ mybzero(void *dest, size_t size) * Function: _populate_filepath * * Purpose: Given a directory name and a base name, concatenate the two and - * run h5fixname() to get the "actual" path to the intented target. + * run h5fixname() to get the "actual" path to the intended target. * `h5suffix' should be FALSE to keep the base name unaltered; * TRUE will append the '.h5' h5suffix to the basename... * FALSE -> h5fixname_no_suffix(), TRUE -> h5fixname() @@ -1246,7 +1266,8 @@ error: * --------------------------------------------------------------------------- */ static hid_t -create_mirroring_split_fapl(const char *_basename, struct mirrortest_filenames *names) +create_mirroring_split_fapl(const char *_basename, struct mirrortest_filenames *names, + const struct mt_opts *opts) { H5FD_splitter_vfd_config_t splitter_config; H5FD_mirror_fapl_t mirror_conf; @@ -1274,8 +1295,8 @@ create_mirroring_split_fapl(const char *_basename, struct mirrortest_filenames * */ mirror_conf.magic = H5FD_MIRROR_FAPL_MAGIC; mirror_conf.version = H5FD_MIRROR_CURR_FAPL_T_VERSION; - mirror_conf.handshake_port = SERVER_HANDSHAKE_PORT; - if (HDstrncpy(mirror_conf.remote_ip, SERVER_IP_ADDRESS, H5FD_MIRROR_MAX_IP_LEN) == NULL) { + mirror_conf.handshake_port = opts->portno; + if (HDstrncpy(mirror_conf.remote_ip, opts->ip, H5FD_MIRROR_MAX_IP_LEN) == NULL) { TEST_ERROR; } splitter_config.wo_fapl_id = H5Pcreate(H5P_FILE_ACCESS); @@ -1354,7 +1375,7 @@ error: * --------------------------------------------------------------------------- */ static int -test_create_and_close(void) +test_create_and_close(const struct mt_opts *opts) { struct mirrortest_filenames names; hid_t file_id = H5I_INVALID_HID; @@ -1364,7 +1385,7 @@ test_create_and_close(void) /* Create FAPL for Splitter[sec2|mirror] */ - fapl_id = create_mirroring_split_fapl("basic_create", &names); + fapl_id = create_mirroring_split_fapl("basic_create", &names, opts); if (H5I_INVALID_HID == fapl_id) { TEST_ERROR; } @@ -1889,7 +1910,7 @@ error: * --------------------------------------------------------------------------- */ static int -test_basic_dataset_write(void) +test_basic_dataset_write(const struct mt_opts *opts) { struct mirrortest_filenames names; hid_t file_id = H5I_INVALID_HID; @@ -1906,7 +1927,7 @@ test_basic_dataset_write(void) /* Create FAPL for Splitter[sec2|mirror] */ - fapl_id = create_mirroring_split_fapl("basic_write", &names); + fapl_id = create_mirroring_split_fapl("basic_write", &names, opts); if (H5I_INVALID_HID == fapl_id) { TEST_ERROR; } @@ -2020,7 +2041,7 @@ error: * --------------------------------------------------------------------------- */ static int -test_chunked_dataset_write(void) +test_chunked_dataset_write(const struct mt_opts *opts) { struct mirrortest_filenames names; hid_t file_id = H5I_INVALID_HID; @@ -2030,7 +2051,7 @@ test_chunked_dataset_write(void) /* Create FAPL for Splitter[sec2|mirror] */ - fapl_id = create_mirroring_split_fapl("chunked_write", &names); + fapl_id = create_mirroring_split_fapl("chunked_write", &names, opts); if (H5I_INVALID_HID == fapl_id) { TEST_ERROR; } @@ -2134,7 +2155,7 @@ error: * --------------------------------------------------------------------------- */ static int -test_on_disk_zoo(void) +test_on_disk_zoo(const struct mt_opts *opts) { const char grp_name[] = "/only"; struct mirrortest_filenames names; @@ -2146,7 +2167,7 @@ test_on_disk_zoo(void) /* Create FAPL for Splitter[sec2|mirror] */ - fapl_id = create_mirroring_split_fapl("zoo", &names); + fapl_id = create_mirroring_split_fapl("zoo", &names, opts); if (H5I_INVALID_HID == fapl_id) { TEST_ERROR; } @@ -2183,8 +2204,9 @@ test_on_disk_zoo(void) if (pass) { validate_zoo(file_id, grp_name, 0); /* sanity-check */ } + if (!pass) { - HDprintf(failure_mssg); + HDprintf("%s", failure_mssg); TEST_ERROR; } @@ -2247,15 +2269,14 @@ error: * --------------------------------------------------------------------------- */ static int -test_vanishing_datasets(void) +test_vanishing_datasets(const struct mt_opts *opts) { struct mirrortest_filenames names; - hid_t file_id = H5I_INVALID_HID; - hid_t fapl_id = H5I_INVALID_HID; - hid_t dset_id = H5I_INVALID_HID; - hid_t dspace_id = H5I_INVALID_HID; - hid_t mirror_fapl_id = H5I_INVALID_HID; - hsize_t dims[2] = {DATABUFFER_SIZE, DATABUFFER_SIZE}; + hid_t file_id = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; + hid_t dspace_id = H5I_INVALID_HID; + hsize_t dims[2] = {DATABUFFER_SIZE, DATABUFFER_SIZE}; uint32_t buf[DATABUFFER_SIZE][DATABUFFER_SIZE]; /* consider malloc? */ H5G_info_t group_info; unsigned int i, j, k; @@ -2269,7 +2290,7 @@ test_vanishing_datasets(void) /* Create FAPL for Splitter[sec2|mirror] */ - fapl_id = create_mirroring_split_fapl("vanishing", &names); + fapl_id = create_mirroring_split_fapl("vanishing", &names, opts); if (H5I_INVALID_HID == fapl_id) { TEST_ERROR; } @@ -2333,7 +2354,7 @@ test_vanishing_datasets(void) file_id = H5I_INVALID_HID; /* verify there are no datasets in file */ - file_id = H5Fopen(names.rw, H5F_ACC_RDONLY, H5P_DEFAULT); + file_id = H5Fopen(names.rw, H5F_ACC_RDONLY, fapl_id); if (file_id < 0) { TEST_ERROR; } @@ -2348,7 +2369,7 @@ test_vanishing_datasets(void) if (H5Fclose(file_id) < 0) { TEST_ERROR; } - file_id = H5Fopen(names.wo, H5F_ACC_RDONLY, H5P_DEFAULT); + file_id = H5Fopen(names.wo, H5F_ACC_RDONLY, fapl_id); if (file_id < 0) { TEST_ERROR; } @@ -2384,21 +2405,10 @@ test_vanishing_datasets(void) error: H5E_BEGIN_TRY { - if (mirror_fapl_id != H5I_INVALID_HID) { - H5Pclose(mirror_fapl_id); - } - if (fapl_id != H5I_INVALID_HID) { - H5Pclose(fapl_id); - } - if (file_id != H5I_INVALID_HID) { - H5Fclose(file_id); - } - if (dset_id != H5I_INVALID_HID) { - H5Dclose(dset_id); - } - if (dspace_id != H5I_INVALID_HID) { - H5Sclose(dspace_id); - } + H5Pclose(fapl_id); + H5Fclose(file_id); + H5Dclose(dset_id); + H5Sclose(dspace_id); } H5E_END_TRY; return -1; @@ -2419,7 +2429,7 @@ error: * --------------------------------------------------------------------------- */ static int -test_concurrent_access(void) +test_concurrent_access(const struct mt_opts *opts) { struct file_bundle { struct mirrortest_filenames names; @@ -2452,7 +2462,7 @@ test_concurrent_access(void) char _name[16] = ""; hid_t _fapl_id = H5I_INVALID_HID; HDsnprintf(_name, 15, "concurrent%d", i); - _fapl_id = create_mirroring_split_fapl(_name, &bundle[i].names); + _fapl_id = create_mirroring_split_fapl(_name, &bundle[i].names, opts); if (H5I_INVALID_HID == _fapl_id) { TEST_ERROR; } @@ -2563,6 +2573,111 @@ error: return -1; } /* end test_concurrent_access() */ +/* ---------------------------------------------------------------------------- + * Function: parse_args + * + * Purpose: Parse command-line arguments, populating the options struct + * pointer as appropriate. + * Default values will be set for unspecified options. + * + * Return: 0 on success, negative (-1) if error. + * ---------------------------------------------------------------------------- + */ +static int +parse_args(int argc, char **argv, struct mt_opts *opts) +{ + int i = 0; + + opts->portno = SERVER_HANDSHAKE_PORT; + HDstrncpy(opts->ip, SERVER_IP_ADDRESS, H5FD_MIRROR_MAX_IP_LEN); + + for (i = 1; i < argc; i++) { /* start with first possible option argument */ + if (!HDstrncmp(argv[i], "--ip=", 5)) { + HDstrncpy(opts->ip, argv[i] + 5, H5FD_MIRROR_MAX_IP_LEN); + } + else if (!HDstrncmp(argv[i], "--port=", 7)) { + opts->portno = HDatoi(argv[i] + 7); + } + else { + HDprintf("Unrecognized option: '%s'\n", argv[i]); + return -1; + } + } /* end for each argument from command line */ + + /* auto-replace 'localhost' with numeric IP */ + if (!HDstrncmp(opts->ip, "localhost", 10)) { /* include null terminator */ + HDstrncpy(opts->ip, "127.0.0.1", H5FD_MIRROR_MAX_IP_LEN); + } + + return 0; +} /* end parse_args() */ + +/* ---------------------------------------------------------------------------- + * Function: confirm_server + * + * Purpose: Create socket and confirm remote server is available. + * + * Return: 0 on success, negative (-1) if error. + * ---------------------------------------------------------------------------- + */ +static int +confirm_server(struct mt_opts *opts) +{ + char mybuf[16]; + int live_socket; + struct sockaddr_in target_addr; + unsigned attempt = 0; + + live_socket = HDsocket(AF_INET, SOCK_STREAM, 0); + if (live_socket < 0) { + HDprintf("ERROR socket()\n"); + return -1; + } + + target_addr.sin_family = AF_INET; + target_addr.sin_port = HDhtons((uint16_t)opts->portno); + target_addr.sin_addr.s_addr = HDinet_addr(opts->ip); + HDmemset(target_addr.sin_zero, '\0', sizeof(target_addr.sin_zero)); + + while (1) { + if (HDconnect(live_socket, (struct sockaddr *)&target_addr, (socklen_t)sizeof(target_addr)) < 0) { + if (attempt > 10) { + HDprintf("ERROR connect() (%d)\n%s\n", errno, HDstrerror(errno)); + return -1; + } + attempt++; + HDsleep(1); + HDprintf("attempt #%u: ERROR connect() (%d)\n%s\n", attempt, errno, HDstrerror(errno)); + } + else { + break; + } + } + + /* Request confirmation from the server */ + if (HDwrite(live_socket, "CONFIRM", 8) == -1) { + HDprintf("ERROR write() (%d)\n%s\n", errno, HDstrerror(errno)); + return -1; + } + + /* Read & verify response from port connection. */ + if (HDread(live_socket, &mybuf, sizeof(mybuf)) == -1) { + HDprintf("ERROR read() can't receive data\n"); + return -1; + } + if (HDstrncmp("ALIVE", mybuf, 6)) { + HDprintf("ERROR read() didn't receive data from server\n"); + return -1; + } + + if (HDclose(live_socket) < 0) { + HDprintf("ERROR close() can't close socket\n"); + return -1; + } + + return 0; +} /* end confirm_server() */ + /* --------------------------------------------------------------------------- * Function: main * @@ -2576,9 +2691,10 @@ error: * --------------------------------------------------------------------------- */ int -main(void) +main(int argc, char **argv) { - int nerrors = 0; + struct mt_opts opts; + int nerrors = 0; h5_reset(); @@ -2602,6 +2718,16 @@ main(void) } } + if (parse_args(argc, argv, &opts) < 0) { + HDprintf("Unable to parse arguments\n"); + HDexit(EXIT_FAILURE); + } + + if (confirm_server(&opts) < 0) { + HDprintf("Unable to confirm server is running\n"); + HDexit(EXIT_FAILURE); + } + /* -------------------- */ /* TESTS */ /* Tests return negative values; `-=' increments nerrors count */ @@ -2609,12 +2735,12 @@ main(void) if (nerrors == 0) { nerrors -= test_fapl_configuration(); nerrors -= test_xmit_encode_decode(); - nerrors -= test_create_and_close(); - nerrors -= test_basic_dataset_write(); - nerrors -= test_chunked_dataset_write(); - nerrors -= test_on_disk_zoo(); - nerrors -= test_vanishing_datasets(); - nerrors -= test_concurrent_access(); + nerrors -= test_create_and_close(&opts); + nerrors -= test_basic_dataset_write(&opts); + nerrors -= test_chunked_dataset_write(&opts); + nerrors -= test_on_disk_zoo(&opts); + nerrors -= test_vanishing_datasets(&opts); + nerrors -= test_concurrent_access(&opts); } if (nerrors) { diff --git a/test/ntypes.c b/test/ntypes.c index 4d1ec51..e63211f 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -26,10 +26,6 @@ const char *FILENAME[] = {"ntypes", NULL}; #define DIM1 200 #define DIM3 20 -int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; -short spoints2[DIM0][DIM1], scheck2[DIM0][DIM1]; -int ipoints3[DIM0][DIM1][5], icheck3[DIM0][DIM1][5]; - #define DSET_ATOMIC_NAME_1 "atomic_type_1" #define DSET_ATOMIC_NAME_2 "atomic_type_2" #define DSET_ATOMIC_NAME_3 "atomic_type_3" @@ -80,13 +76,24 @@ test_atomic_dtype(hid_t file) int i, j, n; hsize_t dims[2]; void * tmp = NULL; + struct { + int arr[DIM0][DIM1]; + } *ipoints2 = NULL; + struct { + int arr[DIM0][DIM1]; + } *icheck2 = NULL; TESTING("atomic datatype"); + if (NULL == (ipoints2 = HDcalloc(1, sizeof(*ipoints2)))) + TEST_ERROR; + if (NULL == (icheck2 = HDcalloc(1, sizeof(*icheck2)))) + TEST_ERROR; + /* Initialize the dataset */ for (i = n = 0; i < DIM0; i++) for (j = 0; j < DIM1; j++) - ipoints2[i][j] = n++; + ipoints2->arr[i][j] = n++; /* Create the data space */ dims[0] = DIM0; @@ -129,7 +136,7 @@ test_atomic_dtype(hid_t file) /* Read the dataset back. The temporary buffer is for special platforms * like Cray. */ if (NULL == (tmp = HDmalloc((size_t)(DIM0 * DIM1 * H5Tget_size(native_type))))) - TEST_ERROR + TEST_ERROR; if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; @@ -146,7 +153,7 @@ test_atomic_dtype(hid_t file) /* Check that the values read are the same as the values written */ for (i = 0; i < DIM0; i++) for (j = 0; j < DIM1; j++) - if (ipoints2[i][j] != icheck2[i][j]) { + if (ipoints2->arr[i][j] != icheck2->arr[i][j]) { H5_FAILED(); HDprintf(" Read different values than written.\n"); HDprintf(" At index %d,%d\n", i, j); @@ -270,6 +277,9 @@ test_atomic_dtype(hid_t file) if (H5Sclose(space) < 0) TEST_ERROR; + HDfree(ipoints2); + HDfree(icheck2); + PASSED(); return 0; @@ -287,6 +297,9 @@ error: } H5E_END_TRY; + HDfree(ipoints2); + HDfree(icheck2); + return -1; } @@ -540,7 +553,7 @@ test_compound_dtype2(hid_t file) /* Read the dataset back. Temporary buffer is for special platforms like * Cray */ if (NULL == (tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type)))) - TEST_ERROR + TEST_ERROR; if (NULL == (bkg = HDcalloc(sizeof(s1), DIM0 * DIM1))) TEST_ERROR; @@ -763,9 +776,9 @@ test_compound_dtype(hid_t file) /* Read the dataset back. Temporary buffer is for special platforms like * Cray */ if (NULL == (tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type)))) - TEST_ERROR + TEST_ERROR; if (NULL == (bkg = HDcalloc(sizeof(s1), DIM0 * DIM1))) - TEST_ERROR + TEST_ERROR; if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; @@ -1328,13 +1341,24 @@ test_enum_dtype(hid_t file) short colors[8]; unsigned char sub_colors[16]; const char * mname[] = {"RED", "GREEN", "BLUE", "YELLOW", "PINK", "PURPLE", "ORANGE", "WHITE"}; + struct { + short arr[DIM0][DIM1]; + } *spoints2 = NULL; + struct { + short arr[DIM0][DIM1]; + } *scheck2 = NULL; TESTING("enum datatype"); + if (NULL == (spoints2 = HDcalloc(1, sizeof(*spoints2)))) + TEST_ERROR; + if (NULL == (scheck2 = HDcalloc(1, sizeof(*scheck2)))) + TEST_ERROR; + /* Initialize the dataset */ for (i = 0; i < DIM0; i++) for (j = 0, n = 0; j < DIM1; j++, n++) - spoints2[i][j] = (short)((i * 10 + j * 100 + n) % 8); + spoints2->arr[i][j] = (short)((i * 10 + j * 100 + n) % 8); /* Create the data space */ dims[0] = DIM0; @@ -1396,14 +1420,12 @@ test_enum_dtype(hid_t file) /* Read the dataset back. Temporary buffer is for special platforms like * Cray */ if (NULL == (tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type)))) - TEST_ERROR + TEST_ERROR; if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; HDmemcpy(scheck2, tmp, DIM0 * DIM1 * H5Tget_size(native_type)); - HDfree(tmp); - tmp = NULL; if (H5Tconvert(native_type, tid_m, (DIM0 * DIM1), scheck2, NULL, H5P_DEFAULT) < 0) TEST_ERROR; @@ -1411,11 +1433,11 @@ test_enum_dtype(hid_t file) /* Check that the values read are the same as the values written */ for (i = 0; i < DIM0; i++) for (j = 0; j < DIM1; j++) - if (spoints2[i][j] != scheck2[i][j]) { + if (spoints2->arr[i][j] != scheck2->arr[i][j]) { H5_FAILED(); HDprintf(" Read different values than written.\n"); HDprintf(" At index %d,%d\n", i, j); - HDprintf(" spoints2[i][j]=%hd, scheck2[i][j]=%hd\n", spoints2[i][j], scheck2[i][j]); + HDprintf(" spoints2[i][j]=%hd, scheck2[i][j]=%hd\n", spoints2->arr[i][j], scheck2->arr[i][j]); goto error; } /* end if */ @@ -1423,13 +1445,19 @@ test_enum_dtype(hid_t file) H5Tclose(dtype); H5Tclose(native_type); H5Tclose(tid_m); + + HDfree(tmp); + HDfree(spoints2); + HDfree(scheck2); + PASSED(); return 0; error: /* Free memory for test data */ - if (tmp) - HDfree(tmp); + HDfree(tmp); + HDfree(spoints2); + HDfree(scheck2); H5E_BEGIN_TRY { @@ -1565,7 +1593,7 @@ test_array_dtype(hid_t file) /* Read the dataset back. Temporary buffer is for special platforms like * Cray */ if (NULL == (tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type)))) - TEST_ERROR + TEST_ERROR; if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; @@ -1657,14 +1685,25 @@ test_array_dtype2(hid_t file) int i, j, k, n; hsize_t space_dims[2], array_dims[1] = {5}; void * tmp = NULL; + struct { + int arr[DIM0][DIM1][5]; + } *ipoints3 = NULL; + struct { + int arr[DIM0][DIM1][5]; + } *icheck3 = NULL; TESTING("array of atomic datatype"); + if (NULL == (ipoints3 = HDcalloc(1, sizeof(*ipoints3)))) + goto error; + if (NULL == (icheck3 = HDcalloc(1, sizeof(*icheck3)))) + goto error; + /* Initialize the dataset */ for (i = n = 0; i < DIM0; i++) for (j = 0; j < DIM1; j++) for (k = 0; k < 5; k++) - ipoints3[i][j][k] = n++; + ipoints3->arr[i][j][k] = n++; /* Create the data space */ space_dims[0] = DIM0; @@ -1713,7 +1752,7 @@ test_array_dtype2(hid_t file) /* Read the dataset back. Temporary buffer is for special platforms like * Cray */ if (NULL == (tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type)))) - TEST_ERROR + TEST_ERROR; if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; @@ -1729,7 +1768,7 @@ test_array_dtype2(hid_t file) for (i = 0; i < DIM0; i++) for (j = 0; j < DIM1; j++) for (k = 0; k < 5; k++) - if (icheck3[i][j][k] != ipoints3[i][j][k]) { + if (icheck3->arr[i][j][k] != ipoints3->arr[i][j][k]) { H5_FAILED(); HDprintf(" Read different values than written.\n"); HDprintf(" At index %d,%d\n", i, j); @@ -1746,6 +1785,9 @@ test_array_dtype2(hid_t file) if (H5Tclose(tid_m) < 0) TEST_ERROR; + HDfree(ipoints3); + HDfree(icheck3); + PASSED(); return 0; @@ -1765,6 +1807,9 @@ error: } H5E_END_TRY; + HDfree(ipoints3); + HDfree(icheck3); + return -1; } @@ -1830,7 +1875,7 @@ test_vl_dtype(hid_t file) /* Create a VL datatype for disk storage */ if ((tid = H5Tvlen_create(tid2)) < 0) - TEST_ERROR + TEST_ERROR; /* Create a dataset */ if ((dataset = H5Dcreate2(file, DSET_VL_NAME, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -1898,7 +1943,7 @@ test_vl_dtype(hid_t file) /* use temporary buffer to convert datatype. This is for special * platforms like Cray */ if (NULL == (tmp = (void **)HDmalloc(t2->len * sizeof(unsigned int)))) - TEST_ERROR + TEST_ERROR; HDmemcpy(tmp, t2->p, t2->len * H5Tget_size(nat_super_type)); if (H5Tconvert(nat_super_type, H5T_NATIVE_UINT, t2->len, tmp, NULL, H5P_DEFAULT) < 0) @@ -2276,9 +2321,9 @@ test_refer_dtype(hid_t file) /* Allocate write & read buffers */ if (NULL == (wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t))))) - TEST_ERROR + TEST_ERROR; if (NULL == (rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t))))) - TEST_ERROR + TEST_ERROR; /* Create dataspace for datasets */ if ((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0) @@ -2286,7 +2331,7 @@ test_refer_dtype(hid_t file) /* Create a group */ if ((group = H5Gcreate2(file, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /* Create a datatype to refer to */ if ((tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t))) < 0) @@ -2451,9 +2496,9 @@ test_refer_dtype2(hid_t file) /* Allocate write & read buffers */ if (NULL == (dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2))) - TEST_ERROR + TEST_ERROR; if (NULL == (drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), SPACE2_DIM1 * SPACE2_DIM2))) - TEST_ERROR + TEST_ERROR; /* Create dataspace for datasets */ if ((sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL)) < 0) @@ -2912,8 +2957,7 @@ test_ninteger(void) hid_t nid1 = -1; /* native datatype */ hid_t nid2 = -1; /* native datatype */ hsize_t dims[1] = {DIM3}; /* dataspace dimensions */ - hsize_t nelmts; /* number of elements in dataset */ - int rank = 1; /* rank of dataset */ + int rank = 1; /* rank of dataset */ int buf[DIM3]; int chk[DIM3]; int i; @@ -2929,33 +2973,33 @@ test_ninteger(void) */ /* create a file using default properties */ if ((fid1 = H5Fcreate("tstint1.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /* create a data space */ if ((sid1 = H5Screate_simple(rank, dims, NULL)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /* create dcpl */ if ((dcpl1 = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /* create a dataset */ if ((did1 = H5Dcreate2(fid1, "dset", H5T_NATIVE_INT, sid1, H5P_DEFAULT, dcpl1, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /* write */ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /* close */ if (H5Sclose(sid1) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; if (H5Pclose(dcpl1) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; if (H5Dclose(did1) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; if (H5Fclose(fid1) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /*------------------------------------------------------------------------- * step 2: open and create another file copying the data from file1 @@ -2964,81 +3008,78 @@ test_ninteger(void) /* open */ if ((fid1 = H5Fopen("tstint1.h5", H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /* open dataset */ if ((did1 = H5Dopen2(fid1, "dset", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; if ((sid1 = H5Dget_space(did1)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /* get dcpl */ if ((dcpl1 = H5Dget_create_plist(did1)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /* get file datatype */ if ((tid1 = H5Dget_type(did1)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /* get native datatype */ if ((nid1 = H5Tget_native_type(tid1, H5T_DIR_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /* get size */ if (H5Tget_size(nid1) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /* get rank */ if ((rank = H5Sget_simple_extent_ndims(sid1)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; HDmemset(dims, 0, sizeof dims); /* get dimension */ if (H5Sget_simple_extent_dims(sid1, dims, NULL) < 0) - FAIL_STACK_ERROR - nelmts = 1; - for (i = 0; i < rank; i++) - nelmts *= dims[i]; + FAIL_STACK_ERROR; /* read */ if (H5Dread(did1, nid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, chk) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /* create a file using default properties */ if ((fid2 = H5Fcreate("tstint2.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /* create a dataset using the native type */ if ((did2 = H5Dcreate2(fid2, "dset", nid1, sid1, H5P_DEFAULT, dcpl1, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /* write */ if (H5Dwrite(did2, nid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, chk) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /* get dcpl */ if ((dcpl2 = H5Dget_create_plist(did2)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /* get file datatype */ if ((tid2 = H5Dget_type(did2)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /* get native datatype */ if ((nid2 = H5Tget_native_type(tid2, H5T_DIR_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /* check */ if (H5Tget_precision(nid1) != H5Tget_precision(nid2)) { HDprintf(" Precision differ.\n"); - TEST_ERROR + TEST_ERROR; } /* end if */ /* compare dataset creation property lists */ if (H5Pequal(dcpl1, dcpl2) <= 0) { HDprintf(" Property lists differ.\n"); - TEST_ERROR + TEST_ERROR; } /* end if */ /* check */ @@ -3047,32 +3088,32 @@ test_ninteger(void) H5_FAILED(); HDprintf(" Read different values than written.\n"); HDprintf(" At index %d\n", i); - TEST_ERROR + TEST_ERROR; } /* end if */ /* close */ if (H5Sclose(sid1) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; if (H5Pclose(dcpl1) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; if (H5Pclose(dcpl2) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; if (H5Tclose(tid1) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; if (H5Tclose(tid2) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; if (H5Tclose(nid1) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; if (H5Tclose(nid2) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; if (H5Dclose(did1) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; if (H5Dclose(did2) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; if (H5Fclose(fid1) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; if (H5Fclose(fid2) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; PASSED(); return 0; diff --git a/test/vfd.c b/test/vfd.c index df348ba..deebb40 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -140,28 +140,28 @@ test_sec2(void) /* Check that the VFD feature flags are correct */ if ((driver_id = H5Pget_driver(fapl_id)) < 0) - TEST_ERROR + TEST_ERROR; if (H5FDdriver_query(driver_id, &driver_flags) < 0) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_DATA_SIEVE)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_POSIX_COMPAT_HANDLE)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_SUPPORTS_SWMR_IO)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_DEFAULT_VFD_COMPATIBLE)) - TEST_ERROR + TEST_ERROR; /* Check for extra flags not accounted for above */ if (driver_flags != (H5FD_FEAT_AGGREGATE_METADATA | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE | H5FD_FEAT_AGGREGATE_SMALLDATA | H5FD_FEAT_POSIX_COMPAT_HANDLE | H5FD_FEAT_SUPPORTS_SWMR_IO | H5FD_FEAT_DEFAULT_VFD_COMPATIBLE)) - TEST_ERROR + TEST_ERROR; if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; @@ -186,7 +186,7 @@ test_sec2(void) if (os_file_handle == NULL) FAIL_PUTS_ERROR("NULL os-specific vfd/file handle was returned from H5Fget_vfd_handle"); - /* There is no garantee the size of metadata in file is constant. + /* There is no guarantee the size of metadata in file is constant. * Just try to check if it's reasonable. * * Currently it should be around 2 KB. @@ -284,26 +284,26 @@ test_core(void) * so backing-store related flags will not be returned here. */ if ((driver_id = H5Pget_driver(fapl_id)) < 0) - TEST_ERROR + TEST_ERROR; if (H5FDdriver_query(driver_id, &driver_flags) < 0) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_DATA_SIEVE)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_ALLOW_FILE_IMAGE)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS)) - TEST_ERROR + TEST_ERROR; /* Check for extra flags not accounted for above */ if (driver_flags != (H5FD_FEAT_AGGREGATE_METADATA | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE | H5FD_FEAT_AGGREGATE_SMALLDATA | H5FD_FEAT_ALLOW_FILE_IMAGE | H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS)) - TEST_ERROR + TEST_ERROR; if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; @@ -352,7 +352,7 @@ test_core(void) * they are correct. */ if (H5Pget_fapl_core(fapl_id_out, &increment, &backing_store) < 0) - TEST_ERROR + TEST_ERROR; if (increment != (size_t)CORE_INCREMENT) FAIL_PUTS_ERROR("incorrect increment from file fapl"); if (backing_store != TRUE) @@ -382,7 +382,7 @@ test_core(void) if (os_file_handle == NULL) FAIL_PUTS_ERROR("NULL os-specific vfd/file handle was returned from H5Fget_vfd_handle"); - /* There is no garantee the size of metadata in file is constant. + /* There is no guarantee the size of metadata in file is constant. * Just try to check if it's reasonable. * * TODO: Needs justification of why is this is a reasonable size. @@ -529,7 +529,7 @@ test_core(void) } /* end if */ /* Check file size API. - * There is no garantee the size of metadata in file is constant. + * There is no guarantee the size of metadata in file is constant. * Just try to check if it's reasonable. * * TODO: Needs justification of why is this is a reasonable size. @@ -845,7 +845,7 @@ test_family_opens(char *fname, hid_t fa_pl) } H5E_END_TRY; if (file >= 0) - TEST_ERROR + TEST_ERROR; /* Case 2: reopen file with correct name template but default property list */ H5E_BEGIN_TRY @@ -854,7 +854,7 @@ test_family_opens(char *fname, hid_t fa_pl) } H5E_END_TRY; if (file >= 0) - TEST_ERROR + TEST_ERROR; /* Case 3: reopen file with wrong member size */ if (H5Pset_fapl_family(fa_pl, (hsize_t)128, H5P_DEFAULT) < 0) @@ -866,7 +866,7 @@ test_family_opens(char *fname, hid_t fa_pl) } H5E_END_TRY; if (file >= 0) - TEST_ERROR + TEST_ERROR; /* Case 4: reopen file with wrong name template */ HDstrcpy(wrong_name, fname); @@ -885,7 +885,7 @@ test_family_opens(char *fname, hid_t fa_pl) } H5E_END_TRY; if (file >= 0) - TEST_ERROR + TEST_ERROR; return 0; @@ -941,21 +941,21 @@ test_family(void) /* Check that the VFD feature flags are correct */ if ((driver_id = H5Pget_driver(fapl)) < 0) - TEST_ERROR + TEST_ERROR; if (H5FDdriver_query(driver_id, &driver_flags) < 0) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_DATA_SIEVE)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) - TEST_ERROR + TEST_ERROR; /* Check for extra flags not accounted for above */ if (driver_flags != (H5FD_FEAT_AGGREGATE_METADATA | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE | H5FD_FEAT_AGGREGATE_SMALLDATA)) - TEST_ERROR + TEST_ERROR; if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; @@ -1101,7 +1101,7 @@ error: * See if we can open files created with v1.6 library. * The source file was created by the test/file_handle.c * of the v1.6 library. Then tools/misc/h5repart.c was - * used to concantenated. The command was "h5repart -m 5k + * used to concatenated. The command was "h5repart -m 5k * family_file%05d.h5 family_v16_%05d.h5". * * Return: Success: 0 @@ -1369,7 +1369,7 @@ H5_GCC_DIAG_ON("format-nonliteral") /*------------------------------------------------------------------------- * Function: test_multi * - * Purpose: Tests the file handle interface for MUTLI driver + * Purpose: Tests the file handle interface for MULTI driver * * Return: SUCCEED/FAIL * @@ -1452,21 +1452,21 @@ test_multi(void) /* Check that the VFD feature flags are correct */ if ((driver_id = H5Pget_driver(fapl)) < 0) - TEST_ERROR + TEST_ERROR; if (H5FDdriver_query(driver_id, &driver_flags) < 0) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_DATA_SIEVE)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_USE_ALLOC_SIZE)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_PAGED_AGGR)) - TEST_ERROR + TEST_ERROR; /* Check for extra flags not accounted for above */ if (driver_flags != (H5FD_FEAT_DATA_SIEVE | H5FD_FEAT_AGGREGATE_SMALLDATA | H5FD_FEAT_USE_ALLOC_SIZE | H5FD_FEAT_PAGED_AGGR)) - TEST_ERROR + TEST_ERROR; if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; @@ -1553,7 +1553,7 @@ test_multi(void) /* Create and write attribute for the root group. */ if ((root = H5Gopen2(file, "/", H5P_DEFAULT)) < 0) - TEST_ERROR + TEST_ERROR; /* Attribute string. */ if ((atype = H5Tcopy(H5T_C_S1)) < 0) @@ -1858,28 +1858,28 @@ test_log(void) /* Check that the VFD feature flags are correct */ if ((driver_id = H5Pget_driver(fapl)) < 0) - TEST_ERROR + TEST_ERROR; if (H5FDdriver_query(driver_id, &driver_flags) < 0) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_DATA_SIEVE)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_POSIX_COMPAT_HANDLE)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_SUPPORTS_SWMR_IO)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_DEFAULT_VFD_COMPATIBLE)) - TEST_ERROR + TEST_ERROR; /* Check for extra flags not accounted for above */ if (driver_flags != (H5FD_FEAT_AGGREGATE_METADATA | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE | H5FD_FEAT_AGGREGATE_SMALLDATA | H5FD_FEAT_POSIX_COMPAT_HANDLE | H5FD_FEAT_SUPPORTS_SWMR_IO | H5FD_FEAT_DEFAULT_VFD_COMPATIBLE)) - TEST_ERROR + TEST_ERROR; /* Create the test file */ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) @@ -1971,23 +1971,23 @@ test_stdio(void) /* Check that the VFD feature flags are correct */ if ((driver_id = H5Pget_driver(fapl)) < 0) - TEST_ERROR + TEST_ERROR; if (H5FDdriver_query(driver_id, &driver_flags) < 0) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_DATA_SIEVE)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_DEFAULT_VFD_COMPATIBLE)) - TEST_ERROR + TEST_ERROR; /* Check for extra flags not accounted for above */ if (driver_flags != (H5FD_FEAT_AGGREGATE_METADATA | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE | H5FD_FEAT_AGGREGATE_SMALLDATA | H5FD_FEAT_DEFAULT_VFD_COMPATIBLE)) - TEST_ERROR + TEST_ERROR; if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; @@ -2089,28 +2089,28 @@ test_windows(void) /* Check that the VFD feature flags are correct */ if ((driver_id = H5Pget_driver(fapl)) < 0) - TEST_ERROR + TEST_ERROR; if (H5FDdriver_query(driver_id, &driver_flags) < 0) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_DATA_SIEVE)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_POSIX_COMPAT_HANDLE)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_SUPPORTS_SWMR_IO)) - TEST_ERROR + TEST_ERROR; if (!(driver_flags & H5FD_FEAT_DEFAULT_VFD_COMPATIBLE)) - TEST_ERROR + TEST_ERROR; /* Check for extra flags not accounted for above */ if (driver_flags != (H5FD_FEAT_AGGREGATE_METADATA | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE | H5FD_FEAT_AGGREGATE_SMALLDATA | H5FD_FEAT_POSIX_COMPAT_HANDLE | H5FD_FEAT_SUPPORTS_SWMR_IO | H5FD_FEAT_DEFAULT_VFD_COMPATIBLE)) - TEST_ERROR + TEST_ERROR; if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; @@ -2191,14 +2191,12 @@ static herr_t test_ros3(void) { #ifdef H5_HAVE_ROS3_VFD - hid_t fid = -1; /* file ID */ - hid_t fapl_id = -1; /* file access property list ID */ - hid_t fapl_id_out = -1; /* from H5Fget_access_plist */ - hid_t driver_id = -1; /* ID for this VFD */ - unsigned long driver_flags = 0; /* VFD feature flags */ - char filename[1024]; /* filename */ - void * os_file_handle = NULL; /* OS file handle */ - hsize_t file_size; /* file size */ + hid_t fid = -1; /* file ID */ + hid_t fapl_id = -1; /* file access property list ID */ + hid_t fapl_id_out = -1; /* from H5Fget_access_plist */ + hid_t driver_id = -1; /* ID for this VFD */ + unsigned long driver_flags = 0; /* VFD feature flags */ + char filename[1024]; /* filename */ H5FD_ros3_fapl_t test_ros3_fa; H5FD_ros3_fapl_t ros3_fa_0 = { /* version = */ H5FD_CURR_ROS3_FAPL_T_VERSION, @@ -2245,11 +2243,11 @@ test_ros3(void) TEST_ERROR; if (!(driver_flags & H5FD_FEAT_DATA_SIEVE)) - TEST_ERROR + TEST_ERROR; /* Check for extra flags not accounted for above */ if (driver_flags != (H5FD_FEAT_DATA_SIEVE)) - TEST_ERROR + TEST_ERROR; PASSED(); return 0; @@ -2526,7 +2524,7 @@ done: * Function: driver_is_splitter_compatible * * Purpose: Determine whether the driver set in the FAPL ID is compatible - * with the Splitter VFD -- specificially, Write-Only channel. + * with the Splitter VFD -- specifically, Write-Only channel. * * Return: Success: 0 * Failure: -1 @@ -2570,7 +2568,7 @@ driver_is_splitter_compatible(hid_t fapl_id) } if (H5Pclose(split_fapl_id) < 0) { - FAIL_PUTS_ERROR("Can't close contained FAPL") + FAIL_PUTS_ERROR("Can't close contained FAPL"); } split_fapl_id = H5I_INVALID_HID; @@ -3099,7 +3097,7 @@ splitter_tentative_open_test(hid_t child_fapl_id) SPLITTER_TEST_FAULT("can't close file ID\n"); } if (!file_exists(filename_rw, child_fapl_id)) { - SPLITTER_TEST_FAULT("R/W file mysteriously disappared\n"); + SPLITTER_TEST_FAULT("R/W file mysteriously disappeared\n"); } if (!file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n"); @@ -3119,7 +3117,7 @@ splitter_tentative_open_test(hid_t child_fapl_id) SPLITTER_TEST_FAULT("can't close file ID\n"); } if (!file_exists(filename_rw, child_fapl_id)) { - SPLITTER_TEST_FAULT("R/W file mysteriously disappared\n"); + SPLITTER_TEST_FAULT("R/W file mysteriously disappeared\n"); } if (!file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n"); @@ -3150,7 +3148,7 @@ splitter_tentative_open_test(hid_t child_fapl_id) SPLITTER_TEST_FAULT("can't close file ID\n"); } if (!file_exists(filename_rw, child_fapl_id)) { - SPLITTER_TEST_FAULT("R/W file mysteriously disappared\n"); + SPLITTER_TEST_FAULT("R/W file mysteriously disappeared\n"); } if (!file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n"); @@ -3181,7 +3179,7 @@ splitter_tentative_open_test(hid_t child_fapl_id) SPLITTER_TEST_FAULT("can't close file ID\n"); } if (!file_exists(filename_rw, child_fapl_id)) { - SPLITTER_TEST_FAULT("R/W file mysteriously disappared\n"); + SPLITTER_TEST_FAULT("R/W file mysteriously disappeared\n"); } if (!file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n"); @@ -3380,7 +3378,18 @@ error: int main(void) { - int nerrors = 0; + char *env_h5_drvr = NULL; + int nerrors = 0; + + /* Don't run VFD tests when HDF5_DRIVER is set. These tests expect a + * specific VFD to be set and HDF5_DRIVER being set can interfere + * with that. + */ + env_h5_drvr = HDgetenv("HDF5_DRIVER"); + if (env_h5_drvr) { + HDprintf(" -- SKIPPED VFD tests because %s is set -- \n", env_h5_drvr); + HDexit(EXIT_SUCCESS); + } h5_reset(); diff --git a/utils/mirror_vfd/mirror_remote.c b/utils/mirror_vfd/mirror_remote.c index f61580d..8bb9544 100644 --- a/utils/mirror_vfd/mirror_remote.c +++ b/utils/mirror_vfd/mirror_remote.c @@ -147,7 +147,7 @@ mirror_log_bytes(struct mirror_log_info *info, unsigned int level, size_t n_byte * ---------------------------------------------------------------------------- */ loginfo_t * -mirror_log_init(char *path, char *prefix, unsigned int verbosity) +mirror_log_init(char *path, const char *prefix, unsigned int verbosity) { loginfo_t *info = NULL; diff --git a/utils/mirror_vfd/mirror_remote.h b/utils/mirror_vfd/mirror_remote.h index 6f37b0b..9415f7f 100644 --- a/utils/mirror_vfd/mirror_remote.h +++ b/utils/mirror_vfd/mirror_remote.h @@ -42,7 +42,7 @@ typedef struct mirror_log_info { void mirror_log(loginfo_t *info, unsigned int level, const char *format, ...); void mirror_log_bytes(loginfo_t *info, unsigned int level, size_t n_bytes, const unsigned char *buf); -loginfo_t *mirror_log_init(char *path, char *prefix, unsigned int verbosity); +loginfo_t *mirror_log_init(char *path, const char *prefix, unsigned int verbosity); int mirror_log_term(loginfo_t *loginfo); herr_t run_writer(int socketfd, H5FD_mirror_xmit_open_t *xmit_open); diff --git a/utils/mirror_vfd/mirror_server.c b/utils/mirror_vfd/mirror_server.c index 9de07c1..d6b5254 100644 --- a/utils/mirror_vfd/mirror_server.c +++ b/utils/mirror_vfd/mirror_server.c @@ -46,11 +46,8 @@ #ifdef H5_HAVE_MIRROR_VFD -#define MAXBUF 2048 /* max buffer length. */ -#define LISTENQ 80 /* max pending mirrorS requests */ -#define DEFAULT_PORT 3000 /* default listening port */ -#define MAX_PORT_LOOPS 20 /* max iteratations through port range */ -#define PORT_LOOP_RETRY_DELAY 1 /* seconds to wait between port scans */ +#define LISTENQ 80 /* max pending mirrorS requests */ +#define DEFAULT_PORT 3000 /* default listening port */ /* semi-unique "magic" numbers to sanity-check structure pointers */ #define OP_ARGS_MAGIC 0xCF074379u @@ -80,7 +77,7 @@ * line. * * `log_prepend_type` (int) - * Flag that the logging messages should have the assocaited verbosity + * Flag that the logging messages should have the associated verbosity * level present in the line (e.g., "WARN", "ERROR", or "INFO"). * * `log_path` (char *) @@ -94,14 +91,14 @@ * --------------------------------------------------------------------------- */ struct op_args { - uint32_t magic; - int help; - int main_port; - int verbosity; - int log_prepend_serv; - int log_prepend_type; - char log_path[PATH_MAX + 1]; - char writer_log_path[PATH_MAX + 1]; + uint32_t magic; + int help; + int main_port; + unsigned int verbosity; + int log_prepend_serv; + int log_prepend_type; + char log_path[PATH_MAX + 1]; + char writer_log_path[PATH_MAX + 1]; }; /* --------------------------------------------------------------------------- @@ -211,8 +208,8 @@ parse_args(int argc, char **argv, struct op_args *args_out) return -1; } - /* Loop over arguments after program name and writer_path */ - for (i = 2; i < argc; i++) { + /* Loop over arguments after program name */ + for (i = 1; i < argc; i++) { if (!HDstrncmp(argv[i], "-h", 3) || !HDstrncmp(argv[i], "--help", 7)) { mirror_log(NULL, V_INFO, "found help argument"); args_out->help = 1; @@ -224,7 +221,7 @@ parse_args(int argc, char **argv, struct op_args *args_out) } /* end if port */ else if (!HDstrncmp(argv[i], "--verbosity=", 12)) { mirror_log(NULL, V_INFO, "parsing 'verbosity' (%s)", argv[i] + 12); - args_out->verbosity = HDatoi(argv[i] + 12); + args_out->verbosity = (unsigned int)HDatoi(argv[i] + 12); } /* end if verbosity */ else if (!HDstrncmp(argv[i], "--logpath=", 10)) { mirror_log(NULL, V_INFO, "parsing 'logpath' (%s)", argv[i] + 10); @@ -456,7 +453,7 @@ error: * --------------------------------------------------------------------------- */ static void -wait_for_child(int sig) +wait_for_child(int H5_ATTR_UNUSED sig) { while (HDwaitpid(-1, NULL, WNOHANG) > 0) ; @@ -476,7 +473,7 @@ handle_requests(struct server_run *run) { int connfd = -1; /**/ char mybuf[H5FD_MIRROR_XMIT_OPEN_SIZE]; /**/ - int ret; /* general-purpose error-checking */ + ssize_t ret; /* general-purpose error-checking */ int pid; /* process ID of fork */ struct sigaction sa; int ret_value = 0; @@ -521,14 +518,13 @@ handle_requests(struct server_run *run) /* Read handshake from port connection. */ - ret = (int)HDread(connfd, &mybuf, H5FD_MIRROR_XMIT_OPEN_SIZE); - if (-1 == ret) { + if ((ret = HDread(connfd, &mybuf, H5FD_MIRROR_XMIT_OPEN_SIZE)) < 0) { mirror_log(run->loginfo, V_ERR, "read:%d", ret); goto error; } mirror_log(run->loginfo, V_INFO, "received %d bytes", ret); mirror_log(run->loginfo, V_ALL, "```"); - mirror_log_bytes(run->loginfo, V_ALL, ret, (const unsigned char *)mybuf); + mirror_log_bytes(run->loginfo, V_ALL, (size_t)ret, (const unsigned char *)mybuf); mirror_log(run->loginfo, V_ALL, "```"); /* Respond to handshake message. @@ -537,10 +533,27 @@ handle_requests(struct server_run *run) if (!HDstrncmp("SHUTDOWN", mybuf, 8)) { /* Stop operation if told to stop */ mirror_log(run->loginfo, V_INFO, "received SHUTDOWN!", ret); + + /* Confirm operation */ + if ((ret = HDwrite(connfd, "CLOSING", 8)) < 0) { + mirror_log(run->loginfo, V_ERR, "write:%d", ret); + HDclose(connfd); + connfd = -1; + goto error; + } + HDclose(connfd); connfd = -1; goto done; } /* end if explicit "SHUTDOWN" directive */ + if (!HDstrncmp("CONFIRM", mybuf, 7)) { + /* Confirm operation */ + if ((ret = HDwrite(connfd, "ALIVE", 6)) < 0) { + mirror_log(run->loginfo, V_ERR, "write:%d", ret); + goto error; + } + HDclose(connfd); + } /* end if "CONFIRM" directive */ else if (H5FD_MIRROR_XMIT_OPEN_SIZE == ret) { H5FD_mirror_xmit_open_t xopen; diff --git a/utils/mirror_vfd/mirror_server_stop.c b/utils/mirror_vfd/mirror_server_stop.c index bf306d9..44386bf 100644 --- a/utils/mirror_vfd/mirror_server_stop.c +++ b/utils/mirror_vfd/mirror_server_stop.c @@ -15,7 +15,7 @@ * Exists for cross-platform, optionally remote shutdown. */ -#include "H5private.h" /* System compatability call-wrapper macros */ +#include "H5private.h" /* System compatibility call-wrapper macros */ #ifdef H5_HAVE_MIRROR_VFD @@ -60,13 +60,13 @@ struct mshs_opts { static void usage(void) { - HDprintf("mirror_server_halten_sie [options]\n" + HDprintf("mirror_server_stop [options]\n" "System-independent Mirror Server shutdown program.\n" "Sends shutdown message to Mirror Server at given IP:port\n" "\n" "Options:\n" " -h | --help Print this usage message and exit.\n" - " --ip=ADDR IP Address of remote server (defaut %s)\n" + " --ip=ADDR IP Address of remote server (default %s)\n" " --port=PORT Handshake port of remote server (default %d)\n", MSHS_DEFAULT_IP, MSHS_DEFAULT_PORTNO); } /* end usage() */ @@ -128,6 +128,7 @@ parse_args(int argc, char **argv, struct mshs_opts *opts) static int send_shutdown(struct mshs_opts *opts) { + char mybuf[16]; int live_socket; struct sockaddr_in target_addr; @@ -157,6 +158,16 @@ send_shutdown(struct mshs_opts *opts) return -1; } + /* Read & verify response from port connection. */ + if (HDread(live_socket, &mybuf, sizeof(mybuf)) == -1) { + HDprintf("ERROR read() can't receive data\n"); + return -1; + } + if (HDstrncmp("CLOSING", mybuf, 8)) { + HDprintf("ERROR read() didn't receive data from server\n"); + return -1; + } + if (HDclose(live_socket) < 0) { HDprintf("ERROR close() can't close socket\n"); return -1; diff --git a/utils/mirror_vfd/mirror_writer.c b/utils/mirror_vfd/mirror_writer.c index d3f12de..5726db5 100644 --- a/utils/mirror_vfd/mirror_writer.c +++ b/utils/mirror_vfd/mirror_writer.c @@ -788,8 +788,7 @@ do_write(struct mirror_session *session, const unsigned char *xmit_buf) */ sum_bytes_written = 0; do { - nbytes_in_packet = HDread(session->sockfd, buf, H5FD_MIRROR_DATA_BUFFER_MAX); - if (-1 == nbytes_in_packet) { + if ((nbytes_in_packet = HDread(session->sockfd, buf, H5FD_MIRROR_DATA_BUFFER_MAX)) < 0) { mirror_log(session->loginfo, V_ERR, "can't read into databuffer"); reply_error(session, "can't read data buffer"); return -1; @@ -798,7 +797,7 @@ do_write(struct mirror_session *session, const unsigned char *xmit_buf) mirror_log(session->loginfo, V_INFO, "received %zd bytes", nbytes_in_packet); if (HEXDUMP_WRITEDATA) { mirror_log(session->loginfo, V_ALL, "DATA:\n```"); - mirror_log_bytes(session->loginfo, V_ALL, nbytes_in_packet, (const unsigned char *)buf); + mirror_log_bytes(session->loginfo, V_ALL, (size_t)nbytes_in_packet, (const unsigned char *)buf); mirror_log(session->loginfo, V_ALL, "```"); } @@ -859,8 +858,7 @@ receive_communique(struct mirror_session *session, struct sock_comm *comm) mirror_log(session->loginfo, V_INFO, "ready to receive"); /* TODO */ - read_ret = HDread(session->sockfd, comm->raw, H5FD_MIRROR_XMIT_BUFFER_MAX); - if (-1 == read_ret) { + if ((read_ret = HDread(session->sockfd, comm->raw, H5FD_MIRROR_XMIT_BUFFER_MAX)) < 0) { mirror_log(session->loginfo, V_ERR, "read:%zd", read_ret); goto error; } -- cgit v0.12