diff options
47 files changed, 707 insertions, 473 deletions
diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index a0c2ed6..9294bad 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -216,6 +216,7 @@ public class HDF5Constants { public static final int H5F_LIBVER_EARLIEST = H5F_LIBVER_EARLIEST(); public static final int H5F_LIBVER_V18 = H5F_LIBVER_V18(); public static final int H5F_LIBVER_V110 = H5F_LIBVER_V110(); + public static final int H5F_LIBVER_V112 = H5F_LIBVER_V112(); public static final int H5F_LIBVER_NBOUNDS = H5F_LIBVER_NBOUNDS(); public static final int H5F_LIBVER_LATEST = H5F_LIBVER_LATEST(); public static final int H5F_OBJ_ALL = H5F_OBJ_ALL(); @@ -1049,6 +1050,8 @@ public class HDF5Constants { private static native final int H5F_LIBVER_V110(); + private static native final int H5F_LIBVER_V112(); + private static native final int H5F_LIBVER_NBOUNDS(); private static native final int H5F_LIBVER_LATEST(); diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index 2ac0892..74eb436 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -401,6 +401,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V18(JNIEnv *env, jclass cls){return JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V110(JNIEnv *env, jclass cls){return H5F_LIBVER_V110;} JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V112(JNIEnv *env, jclass cls){return H5F_LIBVER_V112;} +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1NBOUNDS(JNIEnv *env, jclass cls){return H5F_LIBVER_NBOUNDS;} JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1LATEST(JNIEnv *env, jclass cls){return H5F_LIBVER_LATEST;} diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java index 981f34e..e46ed48 100644 --- a/java/test/TestH5P.java +++ b/java/test/TestH5P.java @@ -214,7 +214,7 @@ public class TestH5P { @Test(expected = HDF5FunctionArgumentException.class) public void testH5Pset_libver_bounds_invalidhigh() throws Throwable { - H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_V110, HDF5Constants.H5F_LIBVER_V110+1); + H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_V112, HDF5Constants.H5F_LIBVER_V112+1); } @Test diff --git a/m4/ax_check_class.m4 b/m4/ax_check_class.m4 index 098aa77..e673c2d 100644 --- a/m4/ax_check_class.m4 +++ b/m4/ax_check_class.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_class.html +# https://www.gnu.org/software/autoconf-archive/ax_check_class.html # =========================================================================== # # SYNOPSIS @@ -36,7 +36,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see <http://www.gnu.org/licenses/>. +# with this program. If not, see <https://www.gnu.org/licenses/>. # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -51,83 +51,18 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 7 +#serial 12 AU_ALIAS([AC_CHECK_CLASS], [AX_CHECK_CLASS]) AC_DEFUN([AX_CHECK_CLASS],[ AC_REQUIRE([AX_PROG_JAVA]) ac_var_name=`echo $1 | sed 's/\./_/g'` -dnl Normaly I'd use a AC_CACHE_CHECK here but since the variable name is +dnl Normally I'd use a AC_CACHE_CHECK here but since the variable name is dnl dynamic I need an extra level of extraction AC_MSG_CHECKING([for $1 class]) AC_CACHE_VAL(ax_cv_class_$ac_var_name, [ -if test x$ac_cv_prog_uudecode_base64 = xyes; then -dnl /** -dnl * Test.java: used to test dynamicaly if a class exists. -dnl */ -dnl public class Test -dnl { -dnl -dnl public static void -dnl main( String[] argv ) -dnl { -dnl Class lib; -dnl if (argv.length < 1) -dnl { -dnl System.err.println ("Missing argument"); -dnl System.exit (77); -dnl } -dnl try -dnl { -dnl lib = Class.forName (argv[0]); -dnl } -dnl catch (ClassNotFoundException e) -dnl { -dnl System.exit (1); -dnl } -dnl lib = null; -dnl System.exit (0); -dnl } -dnl -dnl } -cat << \EOF > Test.uue -begin-base64 644 Test.class -yv66vgADAC0AKQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE -bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 -bWJlclRhYmxlDAAKAAsBAANlcnIBABVMamF2YS9pby9QcmludFN0cmVhbTsJ -AA0ACQcADgEAEGphdmEvbGFuZy9TeXN0ZW0IABABABBNaXNzaW5nIGFyZ3Vt -ZW50DAASABMBAAdwcmludGxuAQAVKExqYXZhL2xhbmcvU3RyaW5nOylWCgAV -ABEHABYBABNqYXZhL2lvL1ByaW50U3RyZWFtDAAYABkBAARleGl0AQAEKEkp -VgoADQAXDAAcAB0BAAdmb3JOYW1lAQAlKExqYXZhL2xhbmcvU3RyaW5nOylM -amF2YS9sYW5nL0NsYXNzOwoAHwAbBwAgAQAPamF2YS9sYW5nL0NsYXNzBwAi -AQAgamF2YS9sYW5nL0NsYXNzTm90Rm91bmRFeGNlcHRpb24BAAY8aW5pdD4B -AAMoKVYMACMAJAoAAwAlAQAKU291cmNlRmlsZQEACVRlc3QuamF2YQAhAAEA -AwAAAAAAAgAJAAUABgABAAcAAABtAAMAAwAAACkqvgSiABCyAAwSD7YAFBBN -uAAaKgMyuAAeTKcACE0EuAAaAUwDuAAasQABABMAGgAdACEAAQAIAAAAKgAK -AAAACgAAAAsABgANAA4ADgATABAAEwASAB4AFgAiABgAJAAZACgAGgABACMA -JAABAAcAAAAhAAEAAQAAAAUqtwAmsQAAAAEACAAAAAoAAgAAAAQABAAEAAEA -JwAAAAIAKA== -==== -EOF - if $UUDECODE Test.uue; then - : - else - echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AS_MESSAGE_LOG_FD - echo "configure: failed file was:" >&AS_MESSAGE_LOG_FD - cat Test.uue >&AS_MESSAGE_LOG_FD - ac_cv_prog_uudecode_base64=no - fi - rm -f Test.uue - if AC_TRY_COMMAND($JAVA $JAVAFLAGS Test $1) >/dev/null 2>&1; then - eval "ac_cv_class_$ac_var_name=yes" - else - eval "ac_cv_class_$ac_var_name=no" - fi - rm -f Test.class -else AX_TRY_COMPILE_JAVA([$1], , [eval "ac_cv_class_$ac_var_name=yes"], [eval "ac_cv_class_$ac_var_name=no"]) -fi eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" eval "HAVE_$ac_var_name=$`echo ac_cv_class_$ac_var_val`" HAVE_LAST_CLASS=$ac_var_val @@ -137,7 +72,7 @@ else ifelse([$3], , :, [$3]) fi ]) -dnl for some reason the above statment didn't fall though here? +dnl for some reason the above statement didn't fall though here? dnl do scripts have variable scoping? eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" AC_MSG_RESULT($ac_var_val) diff --git a/m4/ax_check_classpath.m4 b/m4/ax_check_classpath.m4 index 3c9081a..e08a253 100644 --- a/m4/ax_check_classpath.m4 +++ b/m4/ax_check_classpath.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_classpath.html +# https://www.gnu.org/software/autoconf-archive/ax_check_classpath.html # =========================================================================== # # SYNOPSIS @@ -33,7 +33,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see <http://www.gnu.org/licenses/>. +# with this program. If not, see <https://www.gnu.org/licenses/>. # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -48,7 +48,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 5 +#serial 6 AU_ALIAS([AC_CHECK_CLASSPATH], [AX_CHECK_CLASSPATH]) AC_DEFUN([AX_CHECK_CLASSPATH],[ diff --git a/m4/ax_check_java_home.m4 b/m4/ax_check_java_home.m4 index cfe8f58..1d60387 100644 --- a/m4/ax_check_java_home.m4 +++ b/m4/ax_check_java_home.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_java_home.html +# https://www.gnu.org/software/autoconf-archive/ax_check_java_home.html # =========================================================================== # # SYNOPSIS @@ -28,7 +28,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see <http://www.gnu.org/licenses/>. +# with this program. If not, see <https://www.gnu.org/licenses/>. # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -43,7 +43,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 6 +#serial 7 AU_ALIAS([AC_CHECK_JAVA_HOME], [AX_CHECK_JAVA_HOME]) diff --git a/m4/ax_check_junit.m4 b/m4/ax_check_junit.m4 index 39b52d1..44dd70d 100644 --- a/m4/ax_check_junit.m4 +++ b/m4/ax_check_junit.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_junit.html +# https://www.gnu.org/software/autoconf-archive/ax_check_junit.html # =========================================================================== # # SYNOPSIS @@ -45,7 +45,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 5 +#serial 6 AU_ALIAS([AC_CHECK_JUNIT], [AX_CHECK_JUNIT]) AC_DEFUN([AX_CHECK_JUNIT],[ diff --git a/m4/ax_check_rqrd_class.m4 b/m4/ax_check_rqrd_class.m4 index 8f14241..baa041a 100644 --- a/m4/ax_check_rqrd_class.m4 +++ b/m4/ax_check_rqrd_class.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_rqrd_class.html +# https://www.gnu.org/software/autoconf-archive/ax_check_rqrd_class.html # =========================================================================== # # SYNOPSIS @@ -35,7 +35,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see <http://www.gnu.org/licenses/>. +# with this program. If not, see <https://www.gnu.org/licenses/>. # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -50,7 +50,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 5 +#serial 6 AU_ALIAS([AC_CHECK_RQRD_CLASS], [AX_CHECK_RQRD_CLASS]) AC_DEFUN([AX_CHECK_RQRD_CLASS],[ diff --git a/m4/ax_java_check_class.m4 b/m4/ax_java_check_class.m4 index 917638a..c9d60f7 100644 --- a/m4/ax_java_check_class.m4 +++ b/m4/ax_java_check_class.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_java_check_class.html +# https://www.gnu.org/software/autoconf-archive/ax_java_check_class.html # =========================================================================== # # SYNOPSIS @@ -15,7 +15,7 @@ # # The macro tries to compile a minimal program importing <class>. Some # newer compilers moan about the failure to use this but fail or produce a -# class file anyway. All moaing is sunk to /dev/null since I only wanted +# class file anyway. All moaning is sunk to /dev/null since I only wanted # to know if the class could be imported. This is a recommended followup # to AX_CHECK_JAVA_PLUGIN with classpath appropriately adjusted. # @@ -34,7 +34,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see <http://www.gnu.org/licenses/>. +# with this program. If not, see <https://www.gnu.org/licenses/>. # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -49,7 +49,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 9 +#serial 12 AU_ALIAS([DPS_JAVA_CHECK_CLASS], [AX_JAVA_CHECK_CLASS]) AC_DEFUN([AX_JAVA_CHECK_CLASS],[ diff --git a/m4/ax_java_options.m4 b/m4/ax_java_options.m4 index 36c10d9..722d788 100644 --- a/m4/ax_java_options.m4 +++ b/m4/ax_java_options.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_java_options.html +# https://www.gnu.org/software/autoconf-archive/ax_java_options.html # =========================================================================== # # SYNOPSIS @@ -27,7 +27,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 6 +#serial 7 AU_ALIAS([AC_JAVA_OPTIONS], [AX_JAVA_OPTIONS]) AC_DEFUN([AX_JAVA_OPTIONS],[ diff --git a/m4/ax_jni_include_dir.m4 b/m4/ax_jni_include_dir.m4 index becb33a..ae7a5f0 100644 --- a/m4/ax_jni_include_dir.m4 +++ b/m4/ax_jni_include_dir.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_jni_include_dir.html +# https://www.gnu.org/software/autoconf-archive/ax_jni_include_dir.html # =========================================================================== # # SYNOPSIS @@ -32,6 +32,10 @@ # # - at the configure level, setenv JAVAC # +# This macro depends on AC_CANONICAL_HOST which requires that config.guess +# and config.sub be distributed along with the source code. See autoconf +# manual for details. +# # Note: This macro can work with the autoconf M4 macros for Java programs. # This particular macro is not part of the original set of macros. # @@ -44,11 +48,13 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 11 +#serial 15 AU_ALIAS([AC_JNI_INCLUDE_DIR], [AX_JNI_INCLUDE_DIR]) AC_DEFUN([AX_JNI_INCLUDE_DIR],[ +AC_REQUIRE([AC_CANONICAL_HOST]) + JNI_INCLUDE_DIRS="" if test "x$JAVA_HOME" != x; then @@ -66,14 +72,17 @@ else fi case "$host_os" in - darwin*) # Apple JDK is at /System location and has headers symlinked elsewhere - case "$_JTOPDIR" in - /System/Library/Frameworks/JavaVM.framework/*) - _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` - _JINC="$_JTOPDIR/Headers";; - *) _JINC="$_JTOPDIR/include";; - esac;; - *) _JINC="$_JTOPDIR/include";; + darwin*) # Apple Java headers are inside the Xcode bundle. + macos_version=$(sw_vers -productVersion | sed -n -e 's/^@<:@0-9@:>@*.\(@<:@0-9@:>@*\).@<:@0-9@:>@*/\1/p') + if @<:@ "$macos_version" -gt "7" @:>@; then + _JTOPDIR="$(xcrun --show-sdk-path)/System/Library/Frameworks/JavaVM.framework" + _JINC="$_JTOPDIR/Headers" + else + _JTOPDIR="/System/Library/Frameworks/JavaVM.framework" + _JINC="$_JTOPDIR/Headers" + fi + ;; + *) _JINC="$_JTOPDIR/include";; esac _AS_ECHO_LOG([_JTOPDIR=$_JTOPDIR]) _AS_ECHO_LOG([_JINC=$_JINC]) @@ -81,13 +90,21 @@ _AS_ECHO_LOG([_JINC=$_JINC]) # On Mac OS X 10.6.4, jni.h is a symlink: # /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/jni.h # -> ../../CurrentJDK/Headers/jni.h. -AC_CHECK_FILE([$_JINC/jni.h], - [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC"], - [_JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` - AC_CHECK_FILE([$_JTOPDIR/include/jni.h], - [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include"], - AC_MSG_ERROR([cannot find JDK header files])) - ]) +AC_CACHE_CHECK(jni headers, ac_cv_jni_header_path, +[ + if test -f "$_JINC/jni.h"; then + ac_cv_jni_header_path="$_JINC" + JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $ac_cv_jni_header_path" + else + _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` + if test -f "$_JTOPDIR/include/jni.h"; then + ac_cv_jni_header_path="$_JTOPDIR/include" + JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $ac_cv_jni_header_path" + else + ac_cv_jni_header_path=none + fi + fi +]) # get the likely subdirectories for system specific java includes case "$host_os" in @@ -102,13 +119,15 @@ cygwin*) _JNI_INC_SUBDIRS="win32";; *) _JNI_INC_SUBDIRS="genunix";; esac -# add any subdirectories that are present -for JINCSUBDIR in $_JNI_INC_SUBDIRS -do +if test "x$ac_cv_jni_header_path" != "xnone"; then + # add any subdirectories that are present + for JINCSUBDIR in $_JNI_INC_SUBDIRS + do if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include/$JINCSUBDIR" fi -done + done +fi ]) # _ACJNI_FOLLOW_SYMLINKS <path> diff --git a/m4/ax_prog_jar.m4 b/m4/ax_prog_jar.m4 index 3c60fca..d474912 100644 --- a/m4/ax_prog_jar.m4 +++ b/m4/ax_prog_jar.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_jar.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_jar.html # =========================================================================== # # SYNOPSIS @@ -37,7 +37,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 7 +#serial 8 AU_ALIAS([AC_PROG_JAR], [AX_PROG_JAR]) AC_DEFUN([AX_PROG_JAR],[ diff --git a/m4/ax_prog_java.m4 b/m4/ax_prog_java.m4 index 03961db..c2e6964 100644 --- a/m4/ax_prog_java.m4 +++ b/m4/ax_prog_java.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_java.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_java.html # =========================================================================== # # SYNOPSIS @@ -85,7 +85,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see <http://www.gnu.org/licenses/>. +# with this program. If not, see <https://www.gnu.org/licenses/>. # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -100,7 +100,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 9 +#serial 10 AU_ALIAS([AC_PROG_JAVA], [AX_PROG_JAVA]) AC_DEFUN([AX_PROG_JAVA],[ diff --git a/m4/ax_prog_java_cc.m4 b/m4/ax_prog_java_cc.m4 index 3df064f..ce9612d 100644 --- a/m4/ax_prog_java_cc.m4 +++ b/m4/ax_prog_java_cc.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_java_cc.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_java_cc.html # =========================================================================== # # SYNOPSIS @@ -56,7 +56,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see <http://www.gnu.org/licenses/>. +# with this program. If not, see <https://www.gnu.org/licenses/>. # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -71,7 +71,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 4 +#serial 5 # AX_PROG_JAVA_CC([COMPILER ...]) # -------------------------- diff --git a/m4/ax_prog_java_works.m4 b/m4/ax_prog_java_works.m4 index 54e132a..bc70526 100644 --- a/m4/ax_prog_java_works.m4 +++ b/m4/ax_prog_java_works.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_java_works.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_java_works.html # =========================================================================== # # SYNOPSIS @@ -32,7 +32,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see <http://www.gnu.org/licenses/>. +# with this program. If not, see <https://www.gnu.org/licenses/>. # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -47,57 +47,16 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 9 +#serial 11 AU_ALIAS([AC_PROG_JAVA_WORKS], [AX_PROG_JAVA_WORKS]) AC_DEFUN([AX_PROG_JAVA_WORKS], [ -AC_PATH_PROG(UUDECODE, uudecode, [no]) -if test x$UUDECODE != xno; then -AC_CACHE_CHECK([if uudecode can decode base 64 file], ac_cv_prog_uudecode_base64, [ -dnl /** -dnl * Test.java: used to test if java compiler works. -dnl */ -dnl public class Test -dnl { -dnl -dnl public static void -dnl main( String[] argv ) -dnl { -dnl System.exit (0); -dnl } -dnl -dnl } -cat << \EOF > Test.uue -begin-base64 644 Test.class -yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE -bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 -bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s -YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG -aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB -AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB -AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ= -==== -EOF -if $UUDECODE Test.uue; then - ac_cv_prog_uudecode_base64=yes -else - echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AS_MESSAGE_LOG_FD - echo "configure: failed file was:" >&AS_MESSAGE_LOG_FD - cat Test.uue >&AS_MESSAGE_LOG_FD - ac_cv_prog_uudecode_base64=no -fi -rm -f Test.uue]) -fi -if test x$ac_cv_prog_uudecode_base64 != xyes; then - rm -f Test.class - AC_MSG_WARN([I have to compile Test.class from scratch]) if test x$ac_cv_prog_javac_works = xno; then AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly]) fi if test x$ac_cv_prog_javac_works = x; then AX_PROG_JAVAC fi -fi AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [ JAVA_TEST=Test.java CLASS_TEST=Test.class @@ -111,7 +70,6 @@ public static void main (String args[]) { } } EOF changequote([, ])dnl -if test x$ac_cv_prog_uudecode_base64 != xyes; then if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then : else @@ -119,7 +77,6 @@ if test x$ac_cv_prog_uudecode_base64 != xyes; then cat $JAVA_TEST >&AS_MESSAGE_LOG_FD AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)) fi -fi if AC_TRY_COMMAND($JAVA -classpath . $JAVAFLAGS $TEST) >/dev/null 2>&1; then ac_cv_prog_java_works=yes else @@ -127,7 +84,7 @@ else cat $JAVA_TEST >&AS_MESSAGE_LOG_FD AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?)) fi -rm -fr $JAVA_TEST $CLASS_TEST Test.uue +rm -f $JAVA_TEST $CLASS_TEST ]) AC_PROVIDE([$0])dnl ] diff --git a/m4/ax_prog_javac.m4 b/m4/ax_prog_javac.m4 index d061243..8abb733 100644 --- a/m4/ax_prog_javac.m4 +++ b/m4/ax_prog_javac.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_javac.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_javac.html # =========================================================================== # # SYNOPSIS @@ -49,7 +49,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see <http://www.gnu.org/licenses/>. +# with this program. If not, see <https://www.gnu.org/licenses/>. # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -64,7 +64,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 7 +#serial 8 AU_ALIAS([AC_PROG_JAVAC], [AX_PROG_JAVAC]) AC_DEFUN([AX_PROG_JAVAC],[ diff --git a/m4/ax_prog_javac_works.m4 b/m4/ax_prog_javac_works.m4 index 7dfa1e3..9b48149 100644 --- a/m4/ax_prog_javac_works.m4 +++ b/m4/ax_prog_javac_works.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_javac_works.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_javac_works.html # =========================================================================== # # SYNOPSIS @@ -32,7 +32,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see <http://www.gnu.org/licenses/>. +# with this program. If not, see <https://www.gnu.org/licenses/>. # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -47,7 +47,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 6 +#serial 7 AU_ALIAS([AC_PROG_JAVAC_WORKS], [AX_PROG_JAVAC_WORKS]) AC_DEFUN([AX_PROG_JAVAC_WORKS],[ diff --git a/m4/ax_prog_javadoc.m4 b/m4/ax_prog_javadoc.m4 index bcb6045..b9fcea4 100644 --- a/m4/ax_prog_javadoc.m4 +++ b/m4/ax_prog_javadoc.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_javadoc.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_javadoc.html # =========================================================================== # # SYNOPSIS @@ -38,7 +38,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 8 +#serial 9 AU_ALIAS([AC_PROG_JAVADOC], [AX_PROG_JAVADOC]) AC_DEFUN([AX_PROG_JAVADOC],[ diff --git a/m4/ax_prog_javah.m4 b/m4/ax_prog_javah.m4 index cefc616..935ec89 100644 --- a/m4/ax_prog_javah.m4 +++ b/m4/ax_prog_javah.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_javah.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_javah.html # =========================================================================== # # SYNOPSIS @@ -21,7 +21,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 8 +#serial 11 AU_ALIAS([AC_PROG_JAVAH], [AX_PROG_JAVAH]) AC_DEFUN([AX_PROG_JAVAH],[ @@ -30,19 +30,19 @@ AC_REQUIRE([AC_PROG_CPP])dnl AC_PATH_PROG(JAVAH,javah) AS_IF([test -n "$ac_cv_path_JAVAH"], [ - AC_TRY_CPP([#include <jni.h>],,[ + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <jni.h>]])],[],[ ac_save_CPPFLAGS="$CPPFLAGS" - _ACJAVAH_FOLLOW_SYMLINKS("$ac_cv_path_JAVAH") + _ACJAVAH_FOLLOW_SYMLINKS("$ac_cv_path_JAVAH") ax_prog_javah_bin_dir=`AS_DIRNAME([$_ACJAVAH_FOLLOWED])` ac_dir="`AS_DIRNAME([$ax_prog_javah_bin_dir])`/include" AS_CASE([$build_os], - [cygwin*], + [cygwin*|mingw*], [ac_machdep=win32], [ac_machdep=`AS_ECHO($build_os) | sed 's,[[-0-9]].*,,'`]) CPPFLAGS="$ac_save_CPPFLAGS -I$ac_dir -I$ac_dir/$ac_machdep" - AC_TRY_CPP([#include <jni.h>], - ac_save_CPPFLAGS="$CPPFLAGS", - AC_MSG_WARN([unable to include <jni.h>])) + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <jni.h>]])], + [ac_save_CPPFLAGS="$CPPFLAGS"], + [AC_MSG_WARN([unable to include <jni.h>])]) CPPFLAGS="$ac_save_CPPFLAGS"]) ]) ]) diff --git a/m4/ax_try_compile_java.m4 b/m4/ax_try_compile_java.m4 index a8ed6b2..245c36c 100644 --- a/m4/ax_try_compile_java.m4 +++ b/m4/ax_try_compile_java.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_try_compile_java.html +# https://www.gnu.org/software/autoconf-archive/ax_try_compile_java.html # =========================================================================== # # SYNOPSIS @@ -29,7 +29,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 8 +#serial 10 AU_ALIAS([AC_TRY_COMPILE_JAVA], [AX_TRY_COMPILE_JAVA]) AC_DEFUN([AX_TRY_COMPILE_JAVA],[ @@ -48,8 +48,8 @@ dnl Don't remove the temporary files here, so they can be examined. else echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD cat Test.java >&AS_MESSAGE_LOG_FD -ifelse([$4], , , [ rm -fr Test.java Test.class +ifelse([$4], , , [ rm -f Test.java Test.class $4 ])dnl fi -rm -fr Test.java Test.class]) +rm -f Test.java Test.class]) diff --git a/m4/ax_try_run_java.m4 b/m4/ax_try_run_java.m4 index c680f03..2ebb86d 100644 --- a/m4/ax_try_run_java.m4 +++ b/m4/ax_try_run_java.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_try_run_java.html +# https://www.gnu.org/software/autoconf-archive/ax_try_run_java.html # =========================================================================== # # SYNOPSIS @@ -29,7 +29,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 2 +#serial 3 AU_ALIAS([AC_TRY_RUN_JAVA], [AX_TRY_RUN_JAVA]) AC_DEFUN([AX_TRY_RUN_JAVA],[ diff --git a/src/H5Aint.c b/src/H5Aint.c index 88a4780..d8ba92a 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -108,6 +108,7 @@ static herr_t H5A__iterate_common(hid_t loc_id, H5_index_t idx_type, const unsigned H5O_attr_ver_bounds[] = { H5O_ATTR_VERSION_1, /* H5F_LIBVER_EARLIEST */ H5O_ATTR_VERSION_3, /* H5F_LIBVER_V18 */ + H5O_ATTR_VERSION_3, /* H5F_LIBVER_V110 */ H5O_ATTR_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; @@ -193,6 +193,10 @@ typedef struct H5CX_t { hid_t dapl_id; /* DAPL ID for API operation */ H5P_genplist_t *dapl; /* Dataset Access Property List */ + /* FAPL */ + hid_t fapl_id; /* FAPL ID for API operation */ + H5P_genplist_t *fapl; /* File Access Property List */ + /* Internal: Object tagging info */ haddr_t tag; /* Current object's tag (ohdr chunk #0 address) */ @@ -288,6 +292,12 @@ typedef struct H5CX_t { char *vds_prefix; hbool_t vds_prefix_valid; + /* Cached FAPL properties */ + H5F_libver_t low_bound; /* low_bound property for H5Pset_libver_bounds() */ + hbool_t low_bound_valid; /* Whether low_bound property is valid */ + H5F_libver_t high_bound; /* high_bound property for H5Pset_libver_bounds */ + hbool_t high_bound_valid; /* Whether high_bound property is valid */ + /* Cached VOL settings */ H5VL_connector_prop_t vol_connector_prop; /* Property for VOL connector ID & info */ hbool_t vol_connector_prop_valid; /* Whether property for VOL connector ID & info is valid */ @@ -355,6 +365,13 @@ typedef struct H5CX_dapl_cache_t { char *vds_prefix; } H5CX_dapl_cache_t; +/* Typedef for cached default file access property list information */ +/* (Same as the cached DXPL struct, above, except for the default DCPL) */ +typedef struct H5CX_fapl_cache_t { + H5F_libver_t low_bound; /* low_bound property for H5Pset_libver_bounds() */ + H5F_libver_t high_bound; /* high_bound property for H5Pset_libver_bounds */ +} H5CX_fapl_cache_t; + /********************/ /* Local Prototypes */ /********************/ @@ -393,6 +410,9 @@ static H5CX_dcpl_cache_t H5CX_def_dcpl_cache; /* Define a "default" dataset access property list cache structure to use for default DAPLs */ static H5CX_dapl_cache_t H5CX_def_dapl_cache; +/* Define a "default" file access property list cache structure to use for default FAPLs */ +static H5CX_fapl_cache_t H5CX_def_fapl_cache; + /* Declare a static free list to manage H5CX_node_t structs */ H5FL_DEFINE_STATIC(H5CX_node_t); @@ -418,6 +438,7 @@ H5CX__init_package(void) H5P_genplist_t *la_plist; /* Link access property list */ H5P_genplist_t *dc_plist; /* Dataset creation property list */ H5P_genplist_t *da_plist; /* Dataset access property list */ + H5P_genplist_t *fa_plist; /* File access property list */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -531,7 +552,6 @@ H5CX__init_package(void) if(H5P_get(dc_plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &H5CX_def_dcpl_cache.do_min_dset_ohdr) < 0) HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag") - /* Reset the "default DAPL cache" information */ HDmemset(&H5CX_def_dapl_cache, 0, sizeof(H5CX_dapl_cache_t)); @@ -549,6 +569,22 @@ H5CX__init_package(void) if(H5P_peek(da_plist, H5D_ACS_VDS_PREFIX_NAME, &H5CX_def_dapl_cache.vds_prefix) < 0) HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve prefix for VDS") + /* Reset the "default FAPL cache" information */ + HDmemset(&H5CX_def_fapl_cache, 0, sizeof(H5CX_fapl_cache_t)); + + /* Get the default FAPL cache information */ + + /* Get the default file access property list */ + if(NULL == (fa_plist = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT))) + HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list") + + /* Get low_bound */ + if(H5P_get(fa_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &H5CX_def_fapl_cache.low_bound) < 0) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag") + + if(H5P_get(fa_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &H5CX_def_fapl_cache.high_bound) < 0) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5CX__init_package() */ @@ -675,6 +711,7 @@ H5CX__push_common(H5CX_node_t *cnode) cnode->ctx.dcpl_id = H5P_DATASET_CREATE_DEFAULT; cnode->ctx.dapl_id = H5P_DATASET_ACCESS_DEFAULT; cnode->ctx.lapl_id = H5P_LINK_ACCESS_DEFAULT; + cnode->ctx.fapl_id = H5P_FILE_ACCESS_DEFAULT; cnode->ctx.tag = H5AC__INVALID_TAG; cnode->ctx.ring = H5AC_RING_USER; @@ -1053,6 +1090,42 @@ H5CX_set_dcpl(hid_t dcpl_id) FUNC_LEAVE_NOAPI_VOID } /* end H5CX_set_dcpl() */ +/*------------------------------------------------------------------------- + * Function: H5CX_set_libver_bounds + * + * Purpose: Sets the low/high bounds according to "f" for the current API call context. + * When "f" is NULL, the low/high bounds are set to latest format. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Vailin Choi + * March 27, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_set_libver_bounds(H5F_t *f) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(head && *head); + + /* Set the API context value */ + (*head)->ctx.low_bound = (f == NULL) ? H5F_LIBVER_LATEST : H5F_LOW_BOUND(f); + (*head)->ctx.high_bound = (f == NULL) ? H5F_LIBVER_LATEST : H5F_HIGH_BOUND(f); + + /* Mark the values as valid */ + (*head)->ctx.low_bound_valid = TRUE; + (*head)->ctx.high_bound_valid = TRUE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_set_libver_bounds() */ + /*------------------------------------------------------------------------- * Function: H5CX_set_lapl @@ -1124,6 +1197,7 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, else { htri_t is_lapl; /* Whether the access property list is (or is derived from) a link access property list */ htri_t is_dapl; /* Whether the access property list is (or is derived from) a dataset access property list */ + htri_t is_fapl; /* Whether the access property list is (or is derived from) a file access property list */ #ifdef H5CX_DEBUG /* Sanity check the access property list class */ @@ -1143,6 +1217,12 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, else if(is_dapl) (*head)->ctx.dapl_id = *acspl_id; + /* Check for file access property and set API context if so */ + if((is_fapl = H5P_class_isa(*libclass->pclass, *H5P_CLS_FACC->pclass)) < 0) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't check for file access class") + else if(is_fapl) + (*head)->ctx.fapl_id = *acspl_id; + #ifdef H5_HAVE_PARALLEL /* If this routine is not guaranteed to be collective (i.e. it doesn't * modify the structural metadata in a file), check if the application @@ -2333,6 +2413,43 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5CX_get_nlinks() */ +/*------------------------------------------------------------------------- + * Function: H5CX_get_libver_bounds + * + * Purpose: Retrieves the low/high bounds for the current API call context. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Vailin Choi + * March 27, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_get_libver_bounds(H5F_libver_t *low_bound, H5F_libver_t *high_bound) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(low_bound); + HDassert(high_bound); + HDassert(head && *head); + HDassert(H5P_DEFAULT != (*head)->ctx.fapl_id); + + H5CX_RETRIEVE_PROP_VALID(fapl, H5P_FILE_ACCESS_DEFAULT, H5F_ACS_LIBVER_LOW_BOUND_NAME, low_bound) + H5CX_RETRIEVE_PROP_VALID(fapl, H5P_FILE_ACCESS_DEFAULT, H5F_ACS_LIBVER_HIGH_BOUND_NAME, high_bound) + + /* Get the values */ + *low_bound = (*head)->ctx.low_bound; + *high_bound = (*head)->ctx.high_bound; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_get_libver_bounds() */ + /*------------------------------------------------------------------------- * Function: H5CX_get_dset_min_ohdr_flag diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h index 2248ac9..638c32a 100644 --- a/src/H5CXprivate.h +++ b/src/H5CXprivate.h @@ -79,6 +79,7 @@ H5_DLL herr_t H5CX_free_state(H5CX_state_t *api_state); H5_DLL void H5CX_set_dxpl(hid_t dxpl_id); H5_DLL void H5CX_set_lapl(hid_t lapl_id); H5_DLL void H5CX_set_dcpl(hid_t dcpl_id); +H5_DLL herr_t H5CX_set_libver_bounds(H5F_t *f); H5_DLL herr_t H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t loc_id, hbool_t is_collective); H5_DLL herr_t H5CX_set_loc(hid_t loc_id); @@ -131,6 +132,9 @@ H5_DLL herr_t H5CX_get_dset_min_ohdr_flag(hbool_t *dset_min_ohdr_flag); H5_DLL herr_t H5CX_get_ext_file_prefix(char **prefix_extfile); H5_DLL herr_t H5CX_get_vds_prefix(char **prefix_vds); +/* "Getter" routines for FAPL properties cached in API context */ +H5_DLL herr_t H5CX_get_libver_bounds(H5F_libver_t *low_bound, H5F_libver_t *high_bound); + /* "Setter" routines for API context info */ H5_DLL void H5CX_set_tag(haddr_t tag); H5_DLL void H5CX_set_ring(H5AC_ring_t ring); diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index 494d2c8..fb28489 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -50,6 +50,7 @@ const unsigned H5O_layout_ver_bounds[] = { H5O_LAYOUT_VERSION_1, /* H5F_LIBVER_EARLIEST */ H5O_LAYOUT_VERSION_3, /* H5F_LIBVER_V18 */ /* H5O_LAYOUT_VERSION_DEFAULT */ + H5O_LAYOUT_VERSION_4, /* H5F_LIBVER_V110 */ H5O_LAYOUT_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; diff --git a/src/H5Fint.c b/src/H5Fint.c index 03bbbd9..5d03b3b 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -3327,7 +3327,7 @@ H5F__start_swmr_write(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file superblock version - should be at least 3") /* Check for correct file format version */ - if((f->shared->low_bound != H5F_LIBVER_V110) || (f->shared->high_bound != H5F_LIBVER_V110)) + if((f->shared->low_bound < H5F_LIBVER_V110) || (f->shared->high_bound < H5F_LIBVER_V110)) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file format version does not support SWMR - needs to be 1.10 or greater") /* Should not be marked for SWMR writing mode already */ diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 9f1ed01..8274654 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -178,11 +178,12 @@ typedef enum H5F_libver_t { H5F_LIBVER_ERROR = -1, H5F_LIBVER_EARLIEST = 0, /* Use the earliest possible format for storing objects */ H5F_LIBVER_V18 = 1, /* Use the latest v18 format for storing objects */ - H5F_LIBVER_V110 = 2, /* Use the latest v10 format for storing objects */ + H5F_LIBVER_V110 = 2, /* Use the latest v110 format for storing objects */ + H5F_LIBVER_V112 = 3, /* Use the latest v112 format for storing objects */ H5F_LIBVER_NBOUNDS } H5F_libver_t; -#define H5F_LIBVER_LATEST H5F_LIBVER_V110 +#define H5F_LIBVER_LATEST H5F_LIBVER_V112 /* File space handling strategy */ typedef enum H5F_fspace_strategy_t { diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 3c225a2..aa5a85d 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -76,6 +76,7 @@ H5FL_DEFINE(H5F_super_t); static const unsigned HDF5_superblock_ver_bounds[] = { HDF5_SUPERBLOCK_VERSION_DEF, /* H5F_LIBVER_EARLIEST */ HDF5_SUPERBLOCK_VERSION_2, /* H5F_LIBVER_V18 */ + HDF5_SUPERBLOCK_VERSION_3, /* H5F_LIBVER_V110 */ HDF5_SUPERBLOCK_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; diff --git a/src/H5Ofill.c b/src/H5Ofill.c index ebd885c..d87dc84 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -157,6 +157,7 @@ const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{ const unsigned H5O_fill_ver_bounds[] = { H5O_FILL_VERSION_1, /* H5F_LIBVER_EARLIEST */ H5O_FILL_VERSION_2, /* H5F_LIBVER_V18 */ + H5O_FILL_VERSION_3, /* H5F_LIBVER_V110 */ H5O_FILL_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; diff --git a/src/H5Oint.c b/src/H5Oint.c index 570f94e..60aae45 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -130,6 +130,7 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = { const unsigned H5O_obj_ver_bounds[] = { H5O_VERSION_1, /* H5F_LIBVER_EARLIEST */ H5O_VERSION_2, /* H5F_LIBVER_V18 */ + H5O_VERSION_2, /* H5F_LIBVER_V110 */ H5O_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; diff --git a/src/H5Opline.c b/src/H5Opline.c index 85a95b7..609f2eb 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -93,6 +93,7 @@ const H5O_msg_class_t H5O_MSG_PLINE[1] = {{ const unsigned H5O_pline_ver_bounds[] = { H5O_PLINE_VERSION_1, /* H5F_LIBVER_EARLIEST */ H5O_PLINE_VERSION_2, /* H5F_LIBVER_V18 */ + H5O_PLINE_VERSION_2, /* H5F_LIBVER_V110 */ H5O_PLINE_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; @@ -66,6 +66,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE; const unsigned H5O_sdspace_ver_bounds[] = { H5O_SDSPACE_VERSION_1, /* H5F_LIBVER_EARLIEST */ H5O_SDSPACE_VERSION_2, /* H5F_LIBVER_V18 */ + H5O_SDSPACE_VERSION_2, /* H5F_LIBVER_V110 */ H5O_SDSPACE_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; diff --git a/src/H5Sall.c b/src/H5Sall.c index 0aa2f05..9823d36 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -58,8 +58,7 @@ static herr_t H5S__all_release(H5S_t *space); static htri_t H5S__all_is_valid(const H5S_t *space); static hssize_t H5S__all_serial_size(const H5S_t *space); static herr_t H5S__all_serialize(const H5S_t *space, uint8_t **p); -static herr_t H5S__all_deserialize(H5S_t *space, uint32_t version, uint8_t flags, - const uint8_t **p); +static herr_t H5S__all_deserialize(H5S_t **space, const uint8_t **p); static herr_t H5S__all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S__all_offset(const H5S_t *space, hsize_t *off); static int H5S__all_unlim_dim(const H5S_t *space); @@ -648,10 +647,8 @@ H5S__all_serialize(const H5S_t *space, uint8_t **p) Deserialize the current selection from a user-provided buffer. USAGE herr_t H5S_all_deserialize(space, p) - H5S_t *space; IN/OUT: Dataspace pointer to place + H5S_t **space; IN/OUT: Dataspace pointer to place selection into - uint32_t version IN: Selection version - uint8_t flags IN: Selection flags uint8 **p; OUT: Pointer to buffer holding serialized selection. Will be advanced to end of serialized selection. @@ -666,22 +663,51 @@ H5S__all_serialize(const H5S_t *space, uint8_t **p) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S__all_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags, - const uint8_t H5_ATTR_UNUSED **p) +H5S__all_deserialize(H5S_t **space, const uint8_t **p) { + uint32_t version; /* Version number */ + H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use, + either *space or a newly allocated one */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_STATIC - HDassert(space); HDassert(p); HDassert(*p); + /* As part of the efforts to push all selection-type specific coding + to the callbacks, the coding for the allocation of a null dataspace + is moved from H5S_select_deserialize() in H5Sselect.c. + This is needed for decoding virtual layout in H5O__layout_decode() */ + + /* Allocate space if not provided */ + if(!*space) { + if(NULL == (tmp_space = H5S_create(H5S_SIMPLE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace") + } /* end if */ + else + tmp_space = *space; + + /* Decode version */ + UINT32DECODE(*p, version); + + /* Skip over the remainder of the header */ + *p += 8; + /* Change to "all" selection */ - if(H5S_select_all(space, TRUE) < 0) + if(H5S_select_all(tmp_space, TRUE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + /* Return space to the caller if allocated */ + if(!*space) + *space = tmp_space; + done: + /* Free temporary space if not passed to caller (only happens on error) */ + if(!*space && tmp_space) + if(H5S_close(tmp_space) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__all_deserialize() */ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 4cb5e28..6d42ec1 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -95,8 +95,7 @@ static herr_t H5S__hyper_release(H5S_t *space); static htri_t H5S__hyper_is_valid(const H5S_t *space); static hssize_t H5S__hyper_serial_size(const H5S_t *space); static herr_t H5S__hyper_serialize(const H5S_t *space, uint8_t **p); -static herr_t H5S__hyper_deserialize(H5S_t *space, uint32_t version, uint8_t flags, - const uint8_t **p); +static herr_t H5S__hyper_deserialize(H5S_t **space, const uint8_t **p); static herr_t H5S__hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S__hyper_offset(const H5S_t *space, hsize_t *offset); static int H5S__hyper_unlim_dim(const H5S_t *space); @@ -3456,7 +3455,7 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans, static herr_t H5S__hyper_serialize(const H5S_t *space, uint8_t **p) { - uint8_t *pp; /* Local pointer for decoding */ + uint8_t *pp; /* Local pointer for encoding */ uint8_t *lenp; /* Pointer to length location for later storage */ uint32_t len = 0; /* Number of bytes used */ uint32_t version; /* Version number */ @@ -3507,6 +3506,7 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p) UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].count); UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].block); } /* end for */ + len += (4 * space->extent.rank * 8); } /* end if */ /* Check for a "regular" hyperslab selection */ else if(space->select.sel_info.hslab->diminfo_valid) { @@ -3636,10 +3636,8 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p) Deserialize the current selection from a user-provided buffer. USAGE herr_t H5S__hyper_deserialize(space, p) - H5S_t *space; IN/OUT: Dataspace pointer to place + H5S_t **space; IN/OUT: Dataspace pointer to place selection into - uint32_t version IN: Selection version - uint8_t flags IN: Selection flags uint8 **p; OUT: Pointer to buffer holding serialized selection. Will be advanced to end of serialized selection. @@ -3654,27 +3652,65 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t flags, - const uint8_t **p) +H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) { - unsigned rank; /* Rank of points */ - const uint8_t *pp; /* Local pointer for decoding */ - hsize_t start[H5S_MAX_RANK]; /* Hyperslab start information */ - hsize_t block[H5S_MAX_RANK]; /* Hyperslab block information */ - unsigned u; /* Local counting variable */ - herr_t ret_value = FAIL; /* Return value */ + H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use, + either *space or a newly allocated one */ + hsize_t dims[H5S_MAX_RANK]; /* Dimenion sizes */ + hsize_t start[H5S_MAX_RANK]; /* Hyperslab start information */ + hsize_t block[H5S_MAX_RANK]; /* Hyperslab block information */ + uint32_t version; /* Version number */ + uint8_t flags = 0; /* Flags */ + unsigned rank; /* Rank of points */ + const uint8_t *pp; /* Local pointer for decoding */ + unsigned u; /* Local counting variable */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_STATIC /* Check args */ - HDassert(space); HDassert(p); pp = (*p); HDassert(pp); - /* Deserialize slabs to select */ - /* (The header and rank have already beed decoded) */ - rank = space->extent.rank; /* Retrieve rank from space */ + /* As part of the efforts to push all selection-type specific coding + to the callbacks, the coding for the allocation of a null dataspace + is moved from H5S_select_deserialize() in H5Sselect.c to here. + This is needed for decoding virtual layout in H5O__layout_decode() */ + /* Allocate space if not provided */ + if(!*space) { + if(NULL == (tmp_space = H5S_create(H5S_SIMPLE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace") + } /* end if */ + else + tmp_space = *space; + + /* Decode version */ + UINT32DECODE(pp, version); + + if(version >= (uint32_t)2) { + /* Decode flags */ + flags = *(pp)++; + + /* Skip over the remainder of the header */ + pp += 4; + } else + /* Skip over the remainder of the header */ + pp += 8; + + /* Decode the rank of the point selection */ + UINT32DECODE(pp,rank); + + if(!*space) { + /* Patch the rank of the allocated dataspace */ + (void)HDmemset(dims, 0, (size_t)rank * sizeof(dims[0])); + if(H5S_set_extent_simple(tmp_space, rank, dims, NULL) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set dimensions") + } /* end if */ + else + /* Verify the rank of the provided dataspace */ + if(rank != tmp_space->extent.rank) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of serialized selection does not match dataspace") /* If there is an unlimited dimension, only encode opt_unlim_diminfo */ if(flags & H5S_SELECT_FLAG_UNLIM) { @@ -3695,7 +3731,7 @@ H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fl } /* end for */ /* Select the hyperslab to the current selection */ - if((ret_value = H5S_select_hyperslab(space, H5S_SELECT_SET, start, stride, count, block)) < 0) + if((ret_value = H5S_select_hyperslab(tmp_space, H5S_SELECT_SET, start, stride, count, block)) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't change selection") } /* end if */ else { @@ -3729,7 +3765,7 @@ H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fl *tblock = (*tend - *tstart) + 1; /* Select or add the hyperslab to the current selection */ - if((ret_value = H5S_select_hyperslab(space, (u == 0 ? H5S_SELECT_SET : H5S_SELECT_OR), start, stride, count, block)) < 0) + if((ret_value = H5S_select_hyperslab(tmp_space, (u == 0 ? H5S_SELECT_SET : H5S_SELECT_OR), start, stride, count, block)) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't change selection") } /* end for */ } /* end else */ @@ -3737,7 +3773,16 @@ H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fl /* Update decoding pointer */ *p = pp; + /* Return space to the caller if allocated */ + if(!*space) + *space = tmp_space; + done: + /* Free temporary space if not passed to caller (only happens on error) */ + if(!*space && tmp_space) + if(H5S_close(tmp_space) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_deserialize() */ diff --git a/src/H5Snone.c b/src/H5Snone.c index 86994dd..cae9a67 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -58,8 +58,7 @@ static herr_t H5S__none_release(H5S_t *space); static htri_t H5S__none_is_valid(const H5S_t *space); static hssize_t H5S__none_serial_size(const H5S_t *space); static herr_t H5S__none_serialize(const H5S_t *space, uint8_t **p); -static herr_t H5S__none_deserialize(H5S_t *space, uint32_t version, uint8_t flags, - const uint8_t **p); +static herr_t H5S__none_deserialize(H5S_t **space, const uint8_t **p); static herr_t H5S__none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S__none_offset(const H5S_t *space, hsize_t *off); static int H5S__none_unlim_dim(const H5S_t *space); @@ -602,10 +601,8 @@ H5S__none_serialize(const H5S_t *space, uint8_t **p) Deserialize the current selection from a user-provided buffer. USAGE herr_t H5S__none_deserialize(space, version, flags, p) - H5S_t *space; IN/OUT: Dataspace pointer to place + H5S_t **space; IN/OUT: Dataspace pointer to place selection into - uint32_t version IN: Selection version - uint8_t flags IN: Selection flags uint8 **p; OUT: Pointer to buffer holding serialized selection. Will be advanced to end of serialized selection. @@ -620,22 +617,50 @@ H5S__none_serialize(const H5S_t *space, uint8_t **p) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S__none_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, - uint8_t H5_ATTR_UNUSED flags, const uint8_t H5_ATTR_UNUSED **p) +H5S__none_deserialize(H5S_t **space, const uint8_t **p) { - herr_t ret_value = SUCCEED; /* return value */ + H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use, + either *space or a newly allocated one */ + uint32_t version; /* Version number */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_STATIC - HDassert(space); HDassert(p); HDassert(*p); + /* As part of the efforts to push all selection-type specific coding + to the callbacks, the coding for the allocation of a null dataspace + is moved from H5S_select_deserialize() in H5Sselect.c to here. + This is needed for decoding virtual layout in H5O__layout_decode() */ + /* Allocate space if not provided */ + if(!*space) { + if(NULL == (tmp_space = H5S_create(H5S_SIMPLE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace") + } /* end if */ + else + tmp_space = *space; + + /* Decode version */ + UINT32DECODE(*p, version); + + /* Skip over the remainder of the header */ + *p += 8; + /* Change to "none" selection */ - if(H5S_select_none(space) < 0) + if(H5S_select_none(tmp_space) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + /* Return space to the caller if allocated */ + if(!*space) + *space = tmp_space; + done: + /* Free temporary space if not passed to caller (only happens on error) */ + if(!*space && tmp_space) + if(H5S_close(tmp_space) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__none_deserialize() */ diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 0575f03..2918648 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -148,8 +148,7 @@ typedef hssize_t (*H5S_sel_serial_size_func_t)(const H5S_t *space); /* Method to store current selection in "serialized" form (a byte sequence suitable for storing on disk) */ typedef herr_t (*H5S_sel_serialize_func_t)(const H5S_t *space, uint8_t **p); /* Method to create selection from "serialized" form (a byte sequence suitable for storing on disk) */ -typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t *space, uint32_t version, uint8_t flags, - const uint8_t **p); +typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t **space, const uint8_t **p); /* Method to determine smallest n-D bounding box containing the current selection */ typedef herr_t (*H5S_sel_bounds_func_t)(const H5S_t *space, hsize_t *start, hsize_t *end); /* Method to determine linear offset of initial element in selection within dataspace */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index e62b48d..ac9c983 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -60,8 +60,7 @@ static herr_t H5S__point_release(H5S_t *space); static htri_t H5S__point_is_valid(const H5S_t *space); static hssize_t H5S__point_serial_size(const H5S_t *space); static herr_t H5S__point_serialize(const H5S_t *space, uint8_t **p); -static herr_t H5S__point_deserialize(H5S_t *space, uint32_t version, uint8_t flags, - const uint8_t **p); +static herr_t H5S__point_deserialize(H5S_t **space, const uint8_t **p); static herr_t H5S__point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S__point_offset(const H5S_t *space, hsize_t *off); static int H5S__point_unlim_dim(const H5S_t *space); @@ -988,7 +987,7 @@ static herr_t H5S__point_serialize(const H5S_t *space, uint8_t **p) { H5S_pnt_node_t *curr; /* Point information nodes */ - uint8_t *pp = (*p); /* Local pointer for decoding */ + uint8_t *pp; /* Local pointer for encoding */ uint8_t *lenp; /* Pointer to length location for later storage */ uint32_t len = 0; /* Number of bytes used */ unsigned u; /* Local counting variable */ @@ -998,6 +997,7 @@ H5S__point_serialize(const H5S_t *space, uint8_t **p) /* Check args */ HDassert(space); HDassert(p); + pp = (*p); HDassert(pp); /* Store the preamble information */ @@ -1045,10 +1045,8 @@ H5S__point_serialize(const H5S_t *space, uint8_t **p) Deserialize the current selection from a user-provided buffer. USAGE herr_t H5S__point_deserialize(space, p) - H5S_t *space; IN/OUT: Dataspace pointer to place + H5S_t **space; IN/OUT: Dataspace pointer to place selection into - uint32_t version IN: Selection version - uint8_t flags IN: Selection flags uint8 **p; OUT: Pointer to buffer holding serialized selection. Will be advanced to end of serialized selection. @@ -1063,11 +1061,14 @@ H5S__point_serialize(const H5S_t *space, uint8_t **p) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S__point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags, - const uint8_t **p) +H5S__point_deserialize(H5S_t **space, const uint8_t **p) { + H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use, + either *space or a newly allocated one */ + hsize_t dims[H5S_MAX_RANK]; /* Dimension sizes */ + uint32_t version; /* Version number */ hsize_t *coord = NULL, *tcoord; /* Pointer to array of elements */ - const uint8_t *pp = (*p); /* Local pointer for decoding */ + const uint8_t *pp; /* Local pointer for decoding */ size_t num_elem = 0; /* Number of elements in selection */ unsigned rank; /* Rank of points */ unsigned i, j; /* local counting variables */ @@ -1076,13 +1077,43 @@ H5S__point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5 FUNC_ENTER_STATIC /* Check args */ - HDassert(space); HDassert(p); + pp = (*p); HDassert(pp); + /* As part of the efforts to push all selection-type specific coding + to the callbacks, the coding for the allocation of a null dataspace + is moved from H5S_select_deserialize() in H5Sselect.c to here. + This is needed for decoding virtual layout in H5O__layout_decode() */ + /* Allocate space if not provided */ + if(!*space) { + if(NULL == (tmp_space = H5S_create(H5S_SIMPLE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace") + } /* end if */ + else + tmp_space = *space; + + /* Decode version */ + UINT32DECODE(pp, version); + + /* Skip over the remainder of the header */ + pp += 8; + + /* Decode the rank of the point selection */ + UINT32DECODE(pp,rank); + + if(!*space) { + /* Patch the rank of the allocated dataspace */ + (void)HDmemset(dims, 0, (size_t)rank * sizeof(dims[0])); + if(H5S_set_extent_simple(tmp_space, rank, dims, NULL) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set dimensions") + } /* end if */ + else + /* Verify the rank of the provided dataspace */ + if(rank != tmp_space->extent.rank) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of serialized selection does not match dataspace") + /* Deserialize points to select */ - /* (The header and rank have already beed decoded) */ - rank = space->extent.rank; /* Retrieve rank from space */ UINT32DECODE(pp, num_elem); /* decode the number of points */ /* Allocate space for the coordinates */ @@ -1095,13 +1126,22 @@ H5S__point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5 UINT32DECODE(pp, *tcoord); /* Select points */ - if(H5S_select_elements(space, H5S_SELECT_SET, num_elem, (const hsize_t *)coord) < 0) + if(H5S_select_elements(tmp_space, H5S_SELECT_SET, num_elem, (const hsize_t *)coord) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") /* Update decoding pointer */ *p = pp; + /* Return space to the caller if allocated */ + if(!*space) + *space = tmp_space; + done: + /* Free temporary space if not passed to caller (only happens on error) */ + if(!*space && tmp_space) + if(H5S_close(tmp_space) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace") + /* Free the coordinate array if necessary */ if(coord != NULL) H5MM_xfree(coord); diff --git a/src/H5Sselect.c b/src/H5Sselect.c index ef38746..aaea203 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -544,101 +544,44 @@ H5S_select_valid(const H5S_t *space) herr_t H5S_select_deserialize(H5S_t **space, const uint8_t **p) { - H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use, either - *space or a newly allocated one */ uint32_t sel_type; /* Pointer to the selection type */ - uint32_t version; /* Version number */ - uint8_t flags = 0; /* Flags */ herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) HDassert(space); - /* Allocate space if not provided */ - if(!*space) { - if(NULL == (tmp_space = H5S_create(H5S_SIMPLE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace") - } /* end if */ - else - tmp_space = *space; + /* Selection-type specific coding is moved to the callbacks. */ /* Decode selection type */ UINT32DECODE(*p, sel_type); - /* Decode version */ - UINT32DECODE(*p, version); - - if(version >= (uint32_t)2) { - /* Decode flags */ - flags = *(*p)++; - - /* Check for unknown flags */ - if(flags & ~H5S_SELECT_FLAG_BITS) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "unknown flag for selection") - - /* Skip over the remainder of the header */ - *p += 4; - } /* end if */ - else - /* Skip over the remainder of the header */ - *p += 8; - - /* Decode and check or patch rank for point and hyperslab selections */ - if((sel_type == H5S_SEL_POINTS) || (sel_type == H5S_SEL_HYPERSLABS)) { - uint32_t rank; /* Rank of dataspace */ - - /* Decode the rank of the point selection */ - UINT32DECODE(*p,rank); - - if(!*space) { - hsize_t dims[H5S_MAX_RANK]; - - /* Patch the rank of the allocated dataspace */ - (void)HDmemset(dims, 0, (size_t)rank * sizeof(dims[0])); - if(H5S_set_extent_simple(tmp_space, rank, dims, NULL) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set dimensions") - } /* end if */ - else - /* Verify the rank of the provided dataspace */ - if(rank != tmp_space->extent.rank) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of serialized selection does not match dataspace") - } /* end if */ - /* Make routine for selection type */ switch(sel_type) { case H5S_SEL_POINTS: /* Sequence of points selected */ - ret_value = (*H5S_sel_point->deserialize)(tmp_space, version, flags, p); + ret_value = (*H5S_sel_point->deserialize)(space, p); break; case H5S_SEL_HYPERSLABS: /* Hyperslab selection defined */ - ret_value = (*H5S_sel_hyper->deserialize)(tmp_space, version, flags, p); + ret_value = (*H5S_sel_hyper->deserialize)(space, p); break; case H5S_SEL_ALL: /* Entire extent selected */ - ret_value = (*H5S_sel_all->deserialize)(tmp_space, version, flags, p); + ret_value = (*H5S_sel_all->deserialize)(space, p); break; case H5S_SEL_NONE: /* Nothing selected */ - ret_value = (*H5S_sel_none->deserialize)(tmp_space, version, flags, p); + ret_value = (*H5S_sel_none->deserialize)(space, p); break; default: break; } /* end switch */ + if(ret_value < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "can't deserialize selection") - /* Return space to the caller if allocated */ - if(!*space) - *space = tmp_space; - done: - /* Free temporary space if not passed to caller (only happens on error) */ - if(!*space && tmp_space) - if(H5S_close(tmp_space) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_deserialize() */ @@ -513,6 +513,7 @@ H5FL_DEFINE(H5T_shared_t); const unsigned H5O_dtype_ver_bounds[] = { H5O_DTYPE_VERSION_1, /* H5F_LIBVER_EARLIEST */ H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V18 */ + H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V110 */ H5O_DTYPE_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; diff --git a/src/H5trace.c b/src/H5trace.c index 9a13193..23f2f1d 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -1054,7 +1054,11 @@ H5_trace(const double *returning, const char *func, const char *type, ...) break; case H5F_LIBVER_V110: - HDcompile_assert(H5F_LIBVER_LATEST == H5F_LIBVER_V110); + HDfprintf(out, "H5F_LIBVER_V110"); + break; + + case H5F_LIBVER_V112: + HDcompile_assert(H5F_LIBVER_LATEST == H5F_LIBVER_V112); HDfprintf(out, "H5F_LIBVER_LATEST"); break; diff --git a/test/dsets.c b/test/dsets.c index ef3cf58..a317f14 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -12990,7 +12990,7 @@ test_versionbounds(void) if (vdset > 0) /* dataset created successfully */ { /* Virtual dataset is only available starting in V110 */ - VERIFY(high, H5F_LIBVER_V110, "virtual dataset"); + VERIFY(high >= H5F_LIBVER_V110, TRUE, "virtual dataset"); if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; diff --git a/test/h5test.c b/test/h5test.c index bc3f2fa..8634a4d 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -100,6 +100,17 @@ static const char *multi_letters = "msbrglo"; /* The # of seconds to wait for the message file--used by h5_wait_message() */ #define MESSAGE_TIMEOUT 300 /* Timeout in seconds */ +/* The strings that correspond to library version bounds H5F_libver_t in H5Fpublic.h */ +/* This is used by h5_get_version_string() */ +const char *LIBVER_NAMES[] = { + "earliest", /* H5F_LIBVER_EARLIEST = 0 */ + "v18", /* H5F_LIBVER_V18 = 1 */ + "v110", /* H5F_LIBVER_V110 = 2 */ + "latest", /* H5F_LIBVER_V112 = 3 */ + NULL +}; + + /* Previous error reporting function */ static H5E_auto2_t err_func = NULL; @@ -1940,3 +1951,17 @@ error: return NULL; } /* h5_get_dummy_vol_class */ +/*------------------------------------------------------------------------- + * Function: h5_get_version_string + * + * Purpose: Get the string that corresponds to the libvery version bound. + * + * Return: The string + * + *------------------------------------------------------------------------- + */ +char * +h5_get_version_string(H5F_libver_t libver) +{ + return(LIBVER_NAMES[libver]); +} /* end of h5_get_version_string */ diff --git a/test/h5test.h b/test/h5test.h index 8c3ce6b..ada52ad 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -148,6 +148,7 @@ H5TEST_DLL int h5_make_local_copy(const char *origfilename, const char *local_co H5TEST_DLL herr_t h5_verify_cached_stabs(const char *base_name[], hid_t fapl); H5TEST_DLL H5FD_class_t *h5_get_dummy_vfd_class(void); H5TEST_DLL H5VL_class_t *h5_get_dummy_vol_class(void); +H5TEST_DLL char *h5_get_version_string(H5F_libver_t libver); /* Functions that will replace components of a FAPL */ H5TEST_DLL herr_t h5_get_vfd_fapl(hid_t fapl_id); diff --git a/test/ohdr.c b/test/ohdr.c index b8f7112..9fc5791 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -1627,45 +1627,6 @@ error: return FAIL; } /* test_minimized_dset_ohdr_fillvalue_backwards_compatability */ -#define STR_EARLIEST "earliest" -#define STR_V18 "v18" -#define STR_LATEST "latest" -static char * -version_string(H5F_libver_t libver) -{ - char *str = NULL; - - str = (char *) HDmalloc(20); - if (str == NULL) { - HDfprintf(stderr, "Allocation failed\n"); - HDexit(1); - } - - switch(libver) { - case H5F_LIBVER_EARLIEST: - HDstrcpy(str, STR_EARLIEST); - break; - - case H5F_LIBVER_V18: - HDstrcpy(str, STR_V18); - break; - - case H5F_LIBVER_V110: - HDassert(H5F_LIBVER_LATEST == H5F_LIBVER_V110); - HDstrcpy(str, STR_LATEST); - break; - - case H5F_LIBVER_ERROR: - case H5F_LIBVER_NBOUNDS: - default: - HDsprintf(str, "%ld", (long)libver); - break; - } /* end switch */ - - /* Return the formed version bound string */ - return str; -} /* end version_string() */ - /*------------------------------------------------------------------------- * Function: main @@ -1693,7 +1654,6 @@ main(void) H5O_loc_t oh_loc; /* Object header locations */ H5F_libver_t low, high; /* File format bounds */ time_t time_new, ro; - char msg[80]; /* Message for file format version */ int i; /* Local index variable */ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret; /* Generic return value */ @@ -1718,8 +1678,9 @@ main(void) /* Loop through all the combinations of low/high library format bounds */ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { - char *low_string = NULL; - char *high_string = NULL; + char *low_string = NULL; /* Message for library version low bound */ + char *high_string = NULL; /* Message for library version high bound */ + char msg[80]; /* Message for file format version */ /* Set version bounds before opening the file */ H5E_BEGIN_TRY { @@ -1730,13 +1691,11 @@ main(void) continue; /* Display info about testing */ - low_string = version_string(low); - high_string = version_string(high); + low_string = h5_get_version_string(low); + high_string = h5_get_version_string(high); sprintf(msg, "Using file format version: (%s, %s)", low_string, high_string); HDputs(msg); - HDfree(high_string); - HDfree(low_string); /* test on object continuation block */ if(test_cont(filename, fapl) < 0) diff --git a/test/tfile.c b/test/tfile.c index e3ff372..430bc85 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -5167,7 +5167,7 @@ test_libver_bounds_open(void) /* Get new low bound and verify that it has been upgraded properly */ ret = H5Pget_libver_bounds(new_fapl, &new_low, NULL); CHECK(ret, FAIL, "H5Pget_libver_bounds"); - VERIFY(new_low, H5F_LIBVER_LATEST, "Low bound should be upgraded to H5F_LIBVER_LATEST"); + VERIFY(new_low >= H5F_LIBVER_V110, TRUE, "Low bound should be upgraded to at least H5F_LIBVER_V110"); ret = H5Pclose(new_fapl); CHECK(ret, FAIL, "H5Pclose"); @@ -5445,7 +5445,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) } H5E_END_TRY; /* Get the internal file pointer if the create succeeds */ - if((ok = fid >= 0)) { + if(fid >= 0) { f = (H5F_t *)H5VL_object(fid); CHECK(f, NULL, "H5VL_object"); } @@ -5456,34 +5456,35 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) if(is_swmr) { /* SWMR is enabled */ - if(high == H5F_LIBVER_LATEST) { /* Should succeed */ - VERIFY(ok, TRUE, "H5Fcreate"); + if(high >= H5F_LIBVER_V110) { /* Should succeed */ + VERIFY(fid >= 0, TRUE, "H5Fcreate"); VERIFY(HDF5_SUPERBLOCK_VERSION_3, f->shared->sblock->super_vers, "HDF5_superblock_ver_bounds"); - VERIFY(H5F_LIBVER_V110, f->shared->low_bound, "HDF5_superblock_ver_bounds"); + VERIFY(f->shared->low_bound >= H5F_LIBVER_V110, TRUE, "HDF5_superblock_ver_bounds"); } else /* Should fail */ - VERIFY(ok, FALSE, "H5Fcreate"); + VERIFY(fid >= 0, FALSE, "H5Fcreate"); } else { /* Should succeed */ - VERIFY(ok, TRUE, "H5Fcreate"); + VERIFY(fid >= 0, TRUE, "H5Fcreate"); VERIFY(low, f->shared->low_bound, "HDF5_superblock_ver_bounds"); switch(low) { case H5F_LIBVER_EARLIEST: - ok = (f->shared->sblock->super_vers == 0 || - f->shared->sblock->super_vers == 1 || - f->shared->sblock->super_vers == 2); + ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_DEF || + f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_1 || + f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2); VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); break; case H5F_LIBVER_V18: - ok = (f->shared->sblock->super_vers == 2); + ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2); VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); break; case H5F_LIBVER_V110: - ok = (f->shared->sblock->super_vers == 3); + case H5F_LIBVER_V112: + ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_3); VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); break; @@ -5495,7 +5496,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) } /* end switch */ } - if(ok) { /* Close the file */ + if(fid >= 0) { /* Close the file */ ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); } @@ -5587,7 +5588,6 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr) hid_t new_fapl = -1; /* File access property list */ unsigned super_vers; /* Superblock version */ H5F_libver_t low, high; /* Low and high bounds */ - hbool_t ok; /* The result is ok or not */ herr_t ret; /* Return value */ /* Create the file with the input fcpl and fapl */ @@ -5626,7 +5626,7 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr) } H5E_END_TRY; /* Get the internal file pointer if the open succeeds */ - if((ok = fid >= 0)) { + if(fid >= 0) { f = (H5F_t *)H5VL_object(fid); CHECK(f, NULL, "H5VL_object"); } @@ -5634,26 +5634,24 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr) /* Verify the file open succeeds or fails */ switch(super_vers) { case 3: - if(high == H5F_LIBVER_LATEST) { + if(high >= H5F_LIBVER_V110) { /* Should succeed */ - VERIFY(ok, TRUE, "H5Fopen"); - VERIFY(H5F_LIBVER_V110, f->shared->low_bound, "HDF5_superblock_ver_bounds"); + VERIFY(fid >= 0, TRUE, "H5Fopen"); + VERIFY(f->shared->low_bound >= H5F_LIBVER_V110, TRUE, "HDF5_superblock_ver_bounds"); /* Close the file */ ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); } else /* Should fail */ - VERIFY(ok, FALSE, "H5Fopen"); + VERIFY(fid >= 0, FALSE, "H5Fopen"); break; case 2: if(is_swmr) /* Should fail */ - VERIFY(ok, FALSE, "H5Fopen"); + VERIFY(fid >= 0, FALSE, "H5Fopen"); else { /* Should succeed */ - VERIFY(ok, TRUE, "H5Fopen"); - - ok = f->shared->low_bound >= H5F_LIBVER_V18; - VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); + VERIFY(fid >= 0, TRUE, "H5Fopen"); + VERIFY(f->shared->low_bound >= H5F_LIBVER_V18, TRUE, "HDF5_superblock_ver_bounds"); /* Close the file */ ret = H5Fclose(fid); @@ -5664,10 +5662,10 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr) case 1: case 0: if(is_swmr) /* Should fail */ - VERIFY(ok, FALSE, "H5Fopen"); + VERIFY(fid >= 0, FALSE, "H5Fopen"); else { /* Should succeed */ - VERIFY(ok, TRUE, "H5Fopen"); - VERIFY(low, f->shared->low_bound, "HDF5_superblock_ver_bounds"); + VERIFY(fid >= 0, TRUE, "H5Fopen"); + VERIFY(f->shared->low_bound, low, "HDF5_superblock_ver_bounds"); ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); diff --git a/test/th5s.c b/test/th5s.c index 14f5de9..07d31ed 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -1325,6 +1325,84 @@ test_h5s_encode(void) /**************************************************************** ** +** test_h5s_encode_length(): +** Test to verify HDFFV-10271 is fixed. +** Verify that version 2 hyperslab encoding length is correct. +** +** See "RFC: H5Sencode/H5Sdecode Format Change" for the +** description of the encoding format. +** +****************************************************************/ +static void +test_h5s_encode_length(void) +{ + hid_t sid; /* Dataspace ID */ + hid_t decoded_sid; /* Dataspace ID from H5Sdecode2 */ + size_t sbuf_size=0; /* Buffer size for H5Sencode2/1 */ + unsigned char *sbuf=NULL; /* Buffer for H5Sencode2/1 */ + hsize_t dims[1] = {500}; /* Dimension size */ + hsize_t start, count, block, stride; /* Hyperslab selection specifications */ + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Version 2 Hyperslab Encoding Length is correct\n")); + + /* Create dataspace */ + sid = H5Screate_simple(1, dims, NULL); + CHECK(sid, FAIL, "H5Screate_simple"); + + /* Setting H5S_UNLIMITED in count will use version 2 for hyperslab encoding */ + start = 0; + stride = 10; + block = 4; + count = H5S_UNLIMITED; + + /* Set hyperslab selection */ + ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, &start, &stride, &count, &block); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + /* Encode simple data space in a buffer */ + ret = H5Sencode(sid, NULL, &sbuf_size); + CHECK(ret, FAIL, "H5Sencode"); + + /* Allocate the buffer */ + if(sbuf_size > 0) { + sbuf = (unsigned char*)HDcalloc((size_t)1, sbuf_size); + CHECK(sbuf, NULL, "H5Sencode2"); + } + + /* Encode the dataspace */ + ret = H5Sencode(sid, sbuf, &sbuf_size); + CHECK(ret, FAIL, "H5Sencode"); + + /* Verify that length stored at this location in the buffer is correct */ + VERIFY((uint32_t)sbuf[40], 36, "Length for encoding version 2"); + VERIFY((uint32_t)sbuf[35], 2, "Hyperslab encoding version is 2"); + + /* Decode from the dataspace buffer and return an object handle */ + decoded_sid = H5Sdecode(sbuf); + CHECK(decoded_sid, FAIL, "H5Sdecode"); + + /* Verify that the original and the decoded dataspace are equal */ + VERIFY(H5Sget_select_npoints(sid), H5Sget_select_npoints(decoded_sid), "Compare npoints"); + + /* Close the decoded dataspace */ + ret = H5Sclose(decoded_sid); + CHECK(ret, FAIL, "H5Sclose"); + + /* Free the buffer */ + if(sbuf) + HDfree(sbuf); + + /* Close the original dataspace */ + ret = H5Sclose(sid); + CHECK(ret, FAIL, "H5Sclose"); + +} /* test_h5s_encode_length() */ + + +/**************************************************************** +** ** test_h5s_scalar_write(): Test scalar H5S (dataspace) writing code. ** ****************************************************************/ @@ -2516,6 +2594,7 @@ test_h5s(void) test_h5s_null(); /* Test Null dataspace H5S code */ test_h5s_zero_dim(); /* Test dataspace with zero dimension size */ test_h5s_encode(); /* Test encoding and decoding */ + test_h5s_encode_length(); /* Test version 2 hyperslab encoding length is correct */ test_h5s_scalar_write(); /* Test scalar H5S writing code */ test_h5s_scalar_read(); /* Test scalar H5S reading code */ diff --git a/test/trefer.c b/test/trefer.c index 4f76cb3..938f040 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -492,41 +492,42 @@ test_reference_obj(void) ** ****************************************************************/ static void -test_reference_region(void) +test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dset1, /* Dataset ID */ - dset2; /* Dereferenced dataset ID */ - hid_t sid1, /* Dataspace ID #1 */ - sid2; /* Dataspace ID #2 */ - hid_t dapl_id; /* Dataset access property list */ - hsize_t dims1[] = {SPACE1_DIM1}, - dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ - hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ - hsize_t * coords; /* Coordinate buffer */ - hsize_t low[SPACE2_RANK]; /* Selection bounds */ - hsize_t high[SPACE2_RANK]; /* Selection bounds */ - hdset_reg_ref_t *wbuf, /* buffer to write to disk */ - *rbuf; /* buffer read from disk */ - hdset_reg_ref_t nvrbuf[3]={{0},{101},{255}}; /* buffer with non-valid refs */ - uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ - *drbuf; /* Buffer for reading numeric data from disk */ - uint8_t *tu8; /* Temporary pointer to uint8 data */ - H5O_type_t obj_type; /* Type of object */ - int i, j; /* counting variables */ - hssize_t hssize_ret; /* hssize_t return value */ - htri_t tri_ret; /* htri_t return value */ - herr_t ret; /* Generic return value */ - haddr_t addr = HADDR_UNDEF; /* test for undefined reference */ - hid_t dset_NA; /* Dataset id for undefined reference */ - hid_t space_NA; /* Dataspace id for undefined reference */ - hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */ - hdset_reg_ref_t wdata_NA[1], /* Write buffer */ - rdata_NA[1]; /* Read buffer */ + hid_t fid1; /* HDF5 File IDs */ + hid_t fapl = -1; /* File access property list */ + hid_t dset1, /* Dataset ID */ + dset2; /* Dereferenced dataset ID */ + hid_t sid1, /* Dataspace ID #1 */ + sid2; /* Dataspace ID #2 */ + hid_t dapl_id; /* Dataset access property list */ + hsize_t dims1[] = {SPACE1_DIM1}, + dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ + hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ + hsize_t *coords; /* Coordinate buffer */ + hsize_t low[SPACE2_RANK]; /* Selection bounds */ + hsize_t high[SPACE2_RANK]; /* Selection bounds */ + hdset_reg_ref_t *wbuf, /* buffer to write to disk */ + *rbuf; /* buffer read from disk */ + hdset_reg_ref_t nvrbuf[3]={{0},{101},{255}}; /* buffer with non-valid refs */ + uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ + *drbuf; /* Buffer for reading numeric data from disk */ + uint8_t *tu8; /* Temporary pointer to uint8 data */ + H5O_type_t obj_type; /* Type of object */ + int i, j; /* counting variables */ + hssize_t hssize_ret; /* hssize_t return value */ + htri_t tri_ret; /* htri_t return value */ + herr_t ret; /* Generic return value */ + haddr_t addr = HADDR_UNDEF; /* test for undefined reference */ + hid_t dset_NA; /* Dataset id for undefined reference */ + hid_t space_NA; /* Dataspace id for undefined reference */ + hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */ + hdset_reg_ref_t wdata_NA[1], /* Write buffer */ + rdata_NA[1]; /* Read buffer */ /* Output message about test being performed */ MESSAGE(5, ("Testing Dataset Region Reference Functions\n")); @@ -537,8 +538,16 @@ test_reference_region(void) dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2)); - /* Create file */ - fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + /* Create file access property list */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, FAIL, "H5Pcreate"); + + /* Set the low/high version bounds in fapl */ + ret = H5Pset_libver_bounds(fapl, libver_low, libver_high); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + + /* Create file with the fapl */ + fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid1, FAIL, "H5Fcreate"); /* Create dataspace for datasets */ @@ -627,6 +636,7 @@ test_reference_region(void) /* Store third dataset region */ ret = H5Rcreate(&wbuf[2], fid1, "/Dataset2", H5R_DATASET_REGION, sid2); CHECK(ret, FAIL, "H5Rcreate"); + ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[0], &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type2"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2"); @@ -677,7 +687,7 @@ test_reference_region(void) CHECK(ret, FAIL, "H5Fclose"); /* Re-open the file */ - fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, H5P_DEFAULT); + fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, fapl); CHECK(fid1, FAIL, "H5Fopen"); /* @@ -822,30 +832,32 @@ test_reference_region(void) ret = H5Sclose(sid2); CHECK(ret, FAIL, "H5Sclose"); - /* Get the unlimited selection */ - sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[2]); - CHECK(sid2, FAIL, "H5Rget_region"); - - /* Verify correct hyperslab selected */ - hssize_ret = H5Sget_select_npoints(sid2); - VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints"); - tri_ret = H5Sis_regular_hyperslab(sid2); - CHECK(tri_ret, FAIL, "H5Sis_regular_hyperslab"); - VERIFY(tri_ret, TRUE, "H5Sis_regular_hyperslab Result"); - ret = H5Sget_regular_hyperslab(sid2, start, stride, count, block); - CHECK(ret, FAIL, "H5Sget_regular_hyperslab"); - VERIFY(start[0], (hsize_t)1, "Hyperslab Coordinates"); - VERIFY(start[1], (hsize_t)8, "Hyperslab Coordinates"); - VERIFY(stride[0], (hsize_t)4, "Hyperslab Coordinates"); - VERIFY(stride[1], (hsize_t)1, "Hyperslab Coordinates"); - VERIFY(count[0], H5S_UNLIMITED, "Hyperslab Coordinates"); - VERIFY(count[1], (hsize_t)1, "Hyperslab Coordinates"); - VERIFY(block[0], (hsize_t)2, "Hyperslab Coordinates"); - VERIFY(block[1], (hsize_t)2, "Hyperslab Coordinates"); - - /* Close region space */ - ret = H5Sclose(sid2); - CHECK(ret, FAIL, "H5Sclose"); + if(libver_high >= H5F_LIBVER_V110) { + /* Get the unlimited selection */ + sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[2]); + CHECK(sid2, FAIL, "H5Rget_region"); + + /* Verify correct hyperslab selected */ + hssize_ret = H5Sget_select_npoints(sid2); + VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints"); + tri_ret = H5Sis_regular_hyperslab(sid2); + CHECK(tri_ret, FAIL, "H5Sis_regular_hyperslab"); + VERIFY(tri_ret, TRUE, "H5Sis_regular_hyperslab Result"); + ret = H5Sget_regular_hyperslab(sid2, start, stride, count, block); + CHECK(ret, FAIL, "H5Sget_regular_hyperslab"); + VERIFY(start[0], (hsize_t)1, "Hyperslab Coordinates"); + VERIFY(start[1], (hsize_t)8, "Hyperslab Coordinates"); + VERIFY(stride[0], (hsize_t)4, "Hyperslab Coordinates"); + VERIFY(stride[1], (hsize_t)1, "Hyperslab Coordinates"); + VERIFY(count[0], H5S_UNLIMITED, "Hyperslab Coordinates"); + VERIFY(count[1], (hsize_t)1, "Hyperslab Coordinates"); + VERIFY(block[0], (hsize_t)2, "Hyperslab Coordinates"); + VERIFY(block[1], (hsize_t)2, "Hyperslab Coordinates"); + + /* Close region space */ + ret = H5Sclose(sid2); + CHECK(ret, FAIL, "H5Sclose"); + } /* Close first space */ ret = H5Sclose(sid1); @@ -887,34 +899,39 @@ test_reference_region(void) ** test_reference_region_1D(): Test H5R (reference) object reference code. ** Tests 1-D references to various kinds of objects ** +** Note: The libver_low/libver_high parameters are added to create the file +** with the low and high bounds setting in fapl. +** Please see the RFC for "H5Sencode/H5Sdecode Format Change". +** ****************************************************************/ static void -test_reference_region_1D(void) +test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dset1, /* Dataset ID */ - dset3; /* Dereferenced dataset ID */ - hid_t sid1, /* Dataspace ID #1 */ - sid3; /* Dataspace ID #3 */ - hid_t dapl_id; /* Dataset access property list */ - hsize_t dims1[] = {SPACE1_DIM1}, - dims3[] = {SPACE3_DIM1}; - hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */ - hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ - hsize_t * coords; /* Coordinate buffer */ - hsize_t low[SPACE3_RANK]; /* Selection bounds */ - hsize_t high[SPACE3_RANK]; /* Selection bounds */ - hdset_reg_ref_t *wbuf, /* buffer to write to disk */ - *rbuf; /* buffer read from disk */ - uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ - *drbuf; /* Buffer for reading numeric data from disk */ - uint8_t *tu8; /* Temporary pointer to uint8 data */ - H5O_type_t obj_type; /* Object type */ - int i; /* counting variables */ - herr_t ret; /* Generic return value */ + hid_t fid1; /* HDF5 File IDs */ + hid_t fapl = -1; /* File access property list */ + hid_t dset1, /* Dataset ID */ + dset3; /* Dereferenced dataset ID */ + hid_t sid1, /* Dataspace ID #1 */ + sid3; /* Dataspace ID #3 */ + hid_t dapl_id; /* Dataset access property list */ + hsize_t dims1[] = {SPACE1_DIM1}, + dims3[] = {SPACE3_DIM1}; + hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */ + hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ + hsize_t *coords; /* Coordinate buffer */ + hsize_t low[SPACE3_RANK]; /* Selection bounds */ + hsize_t high[SPACE3_RANK]; /* Selection bounds */ + hdset_reg_ref_t *wbuf, /* buffer to write to disk */ + *rbuf; /* buffer read from disk */ + uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ + *drbuf; /* Buffer for reading numeric data from disk */ + uint8_t *tu8; /* Temporary pointer to uint8 data */ + H5O_type_t obj_type; /* Object type */ + int i; /* counting variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing 1-D Dataset Region Reference Functions\n")); @@ -925,8 +942,16 @@ test_reference_region_1D(void) dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1); drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1); - /* Create file */ - fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + /* Create the file access property list */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, FAIL, "H5Pcreate"); + + /* Set the low/high version bounds in fapl */ + ret = H5Pset_libver_bounds(fapl, libver_low, libver_high); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + + /* Create file with the fapl */ + fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid1, FAIL, "H5Fcreate"); /* Create dataspace for datasets */ @@ -1022,7 +1047,7 @@ test_reference_region_1D(void) CHECK(ret, FAIL, "H5Fclose"); /* Re-open the file */ - fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, H5P_DEFAULT); + fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, fapl); CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ @@ -1156,6 +1181,10 @@ test_reference_region_1D(void) ret = H5Pclose(dapl_id); CHECK(ret, FAIL, "H5Pclose"); + /* Close file access property list */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); @@ -1733,13 +1762,28 @@ test_reference_compat(void) void test_reference(void) { + H5F_libver_t low, high; /* Low and high bounds */ + /* Output message about test being performed */ MESSAGE(5, ("Testing References\n")); test_reference_params(); /* Test for correct parameter checking */ test_reference_obj(); /* Test basic H5R object reference code */ - test_reference_region(); /* Test basic H5R dataset region reference code */ - test_reference_region_1D(); /* Test H5R dataset region reference code for 1-D datasets */ + + /* Loop through all the combinations of low/high version bounds */ + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { + + /* Invalid combinations, just continue */ + if(high == H5F_LIBVER_EARLIEST || high < low) + continue; + + test_reference_region(low, high); /* Test basic H5R dataset region reference code */ + test_reference_region_1D(low, high); /* Test H5R dataset region reference code for 1-D datasets */ + + } /* end high bound */ + } /* end low bound */ + test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */ test_reference_group(); /* Test operations on dereferenced groups */ #ifndef H5_NO_DEPRECATED_SYMBOLS |