diff options
133 files changed, 1132 insertions, 956 deletions
@@ -1943,6 +1943,7 @@ ./tools/testfiles/tintsnodata.h5 ./tools/testfiles/tlarge_objname.ddl ./tools/testfiles/tlarge_objname.h5 +./tools/testfiles/tldouble.ddl ./tools/testfiles/tldouble.h5 ./tools/testfiles/tlonglinks.ddl ./tools/testfiles/tlonglinks.h5 @@ -2452,6 +2453,7 @@ ./tools/test/h5diff/testfiles/h5diff_80.txt ./tools/test/h5diff/testfiles/h5diff_800.txt ./tools/test/h5diff/testfiles/h5diff_801.txt +./tools/test/h5diff/testfiles/h5diff_830.txt ./tools/test/h5diff/testfiles/h5diff_90.txt ./tools/test/h5diff/testfiles/h5diff_100.txt ./tools/test/h5diff/testfiles/h5diff_101.txt diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h index fe6e033c..cb43c73 100644 --- a/c++/src/H5AbstractDs.h +++ b/c++/src/H5AbstractDs.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __AbstractDs_H -#define __AbstractDs_H +#ifndef AbstractDs_H +#define AbstractDs_H namespace H5 { @@ -81,4 +81,4 @@ class H5_DLLCPP AbstractDs { }; // end of AbstractDs } // namespace H5 -#endif // __AbstractDs_H +#endif // AbstractDs_H diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h index 2e5ccf3..368883b 100644 --- a/c++/src/H5CommonFG.h +++ b/c++/src/H5CommonFG.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __CommonFG_H -#define __CommonFG_H +#ifndef CommonFG_H +#define CommonFG_H namespace H5 { @@ -83,7 +83,7 @@ class H5_DLLCPP CommonFG { }; // end of CommonFG } // namespace H5 -#endif // __CommonFG_H +#endif // CommonFG_H /*************************************************************************** Design Note diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index ae5bb4a..2a0f18e 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __Group_H -#define __Group_H +#ifndef Group_H +#define Group_H namespace H5 { @@ -83,4 +83,4 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { }; // end of Group } // namespace H5 -#endif // __Group_H +#endif // Group_H diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h index b756a3d..4f75849 100644 --- a/c++/src/H5IdComponent.h +++ b/c++/src/H5IdComponent.h @@ -12,8 +12,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef __IdComponent_H -#define __IdComponent_H +#ifndef IdComponent_H +#define IdComponent_H namespace H5 { @@ -113,4 +113,4 @@ class H5_DLLCPP IdComponent { }; // end class IdComponent } // namespace H5 -#endif // __IdComponent_H +#endif // IdComponent_H diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags index 3fe13d8..cba8298 100644 --- a/config/gnu-cxxflags +++ b/config/gnu-cxxflags @@ -148,7 +148,7 @@ if test "X-g++" = "X-$cxx_vendor"; then # Enhanced Diagnostics # ######################## - if test $cc_vers_major -ge 10; then + if test $cxx_vers_major -ge 10; then NO_DIAGS_CXXFLAGS="-fdiagnostics-urls=never -fno-diagnostics-color" fi DIAGS_CXXFLAGS= diff --git a/config/gnu-fflags b/config/gnu-fflags index d4f876d..ec4fcab 100644 --- a/config/gnu-fflags +++ b/config/gnu-fflags @@ -109,7 +109,7 @@ if test "X-gfortran" = "X-$f9x_vendor"; then # Enhanced Diagnostics # ######################## - if test $cc_vers_major -ge 10; then + if test $f9x_vers_major -ge 10; then NO_DIAGS_FCFLAGS="-fdiagnostics-urls=never -fno-diagnostics-color" fi DIAGS_FCFLAGS= diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index 2eb1981..f5c0fd5 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -70,8 +70,8 @@ initCfile(void) * help@hdfgroup.org. *\n\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\ \n\n\ -#ifndef _H5f90i_gen_H\n\ -#define _H5f90i_gen_H\n\ +#ifndef H5f90i_gen_H\n\ +#define H5f90i_gen_H\n\ \n\ /* This file is automatically generated by H5match_types.c at build time. */\n\ \n\ diff --git a/java/src/jni/exceptionImp.c b/java/src/jni/exceptionImp.c index e62caee..12ef0a1 100644 --- a/java/src/jni/exceptionImp.c +++ b/java/src/jni/exceptionImp.c @@ -262,12 +262,25 @@ done: * exception. */ jboolean -h5outOfMemory(JNIEnv *env, const char *functName) +h5outOfMemory(JNIEnv *env, const char *message) { - return H5JNIErrorClass(env, functName, "java/lang/OutOfMemoryError"); + return H5JNIErrorClass(env, message, "java/lang/OutOfMemoryError"); } /* end h5outOfMemory() */ /* + * Create and throw an 'AssertionError' + * + * Note: This routine never returns from the 'throw', + * and the Java native method immediately raises the + * exception. + */ +jboolean +h5assertion(JNIEnv *env, const char *message) +{ + return H5JNIErrorClass(env, message, "java/lang/AssertionError"); +} /* end h5assertion() */ + +/* * A fatal error in a JNI call * Create and throw an 'InternalError' * @@ -276,9 +289,9 @@ h5outOfMemory(JNIEnv *env, const char *functName) * exception. */ jboolean -h5JNIFatalError(JNIEnv *env, const char *functName) +h5JNIFatalError(JNIEnv *env, const char *message) { - return H5JNIErrorClass(env, functName, "java/lang/InternalError"); + return H5JNIErrorClass(env, message, "java/lang/InternalError"); } /* end h5JNIFatalError() */ /* @@ -290,9 +303,9 @@ h5JNIFatalError(JNIEnv *env, const char *functName) * exception. */ jboolean -h5nullArgument(JNIEnv *env, const char *functName) +h5nullArgument(JNIEnv *env, const char *message) { - return H5JNIErrorClass(env, functName, "java/lang/NullPointerException"); + return H5JNIErrorClass(env, message, "java/lang/NullPointerException"); } /* end h5nullArgument() */ /* @@ -304,9 +317,9 @@ h5nullArgument(JNIEnv *env, const char *functName) * exception. */ jboolean -h5badArgument(JNIEnv *env, const char *functName) +h5badArgument(JNIEnv *env, const char *message) { - return H5JNIErrorClass(env, functName, "java/lang/IllegalArgumentException"); + return H5JNIErrorClass(env, message, "java/lang/IllegalArgumentException"); } /* end h5badArgument() */ /* @@ -318,9 +331,9 @@ h5badArgument(JNIEnv *env, const char *functName) * exception. */ jboolean -h5unimplemented(JNIEnv *env, const char *functName) +h5unimplemented(JNIEnv *env, const char *message) { - return H5JNIErrorClass(env, functName, "java/lang/UnsupportedOperationException"); + return H5JNIErrorClass(env, message, "java/lang/UnsupportedOperationException"); } /* end h5unimplemented() */ /* h5raiseException(). This routine is called to generate diff --git a/java/src/jni/exceptionImp.h b/java/src/jni/exceptionImp.h index 72edf4c..38469df 100644 --- a/java/src/jni/exceptionImp.h +++ b/java/src/jni/exceptionImp.h @@ -13,8 +13,8 @@ #include <jni.h> /* Header for class hdf_hdf5lib_H5_exception */ -#ifndef _Included_hdf_hdf5lib_H5_exception -#define _Included_hdf_hdf5lib_H5_exception +#ifndef Included_hdf_hdf5lib_H5_exception +#define Included_hdf_hdf5lib_H5_exception #ifdef __cplusplus extern "C" { @@ -67,4 +67,4 @@ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMi } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_exception */ +#endif /* Included_hdf_hdf5lib_H5_exception */ diff --git a/java/src/jni/h5Imp.h b/java/src/jni/h5Imp.h index 776f295..8ab7662 100644 --- a/java/src/jni/h5Imp.h +++ b/java/src/jni/h5Imp.h @@ -13,8 +13,8 @@ #include <jni.h> /* Header for class hdf_hdf5lib_H5_H5 */ -#ifndef _Included_hdf_hdf5lib_H5_H5 -#define _Included_hdf_hdf5lib_H5_H5 +#ifndef Included_hdf_hdf5lib_H5_H5 +#define Included_hdf_hdf5lib_H5_H5 #ifdef __cplusplus extern "C" { @@ -82,4 +82,4 @@ JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5is_1library_1threadsafe(JNIEnv } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5 */ +#endif /* Included_hdf_hdf5lib_H5_H5 */ diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c index f072732..f06075c 100644 --- a/java/src/jni/h5aImp.c +++ b/java/src/jni/h5aImp.c @@ -1133,7 +1133,7 @@ H5AreadVL_asstr(JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf) for (i = 0; i < (size_t)n; i++) { h5str.s[0] = '\0'; - if (!h5str_sprintf(ENVONLY, &h5str, aid, tid, &(((char *)readBuf)[i * typeSize]), typeSize, 0)) + if (!h5str_sprintf(ENVONLY, &h5str, aid, tid, &(((char *)readBuf)[i * typeSize]), 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s))) @@ -1425,7 +1425,7 @@ Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref(JNIEnv *env, jclass clss, jlong attr_id, j for (i = 0; i < n; i++) { h5str.s[0] = '\0'; - if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)attr_id, (hid_t)mem_type_id, ref_data[i], 0, 0)) + if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)attr_id, (hid_t)mem_type_id, ref_data[i], 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s))) diff --git a/java/src/jni/h5aImp.h b/java/src/jni/h5aImp.h index 3d9a230..aee0e40 100644 --- a/java/src/jni/h5aImp.h +++ b/java/src/jni/h5aImp.h @@ -13,8 +13,8 @@ #include <jni.h> /* Header for class hdf_hdf5lib_H5_H5A */ -#ifndef _Included_hdf_hdf5lib_H5_H5A -#define _Included_hdf_hdf5lib_H5_H5A +#ifndef Included_hdf_hdf5lib_H5_H5A +#define Included_hdf_hdf5lib_H5_H5A #ifdef __cplusplus extern "C" { @@ -375,4 +375,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name(JNIEnv *, jclass } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5A */ +#endif /* Included_hdf_hdf5lib_H5_H5A */ diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c index 0fd57ff..24d0714 100644 --- a/java/src/jni/h5dImp.c +++ b/java/src/jni/h5dImp.c @@ -1278,7 +1278,7 @@ H5DreadVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid for (i = 0; i < (size_t)n; i++) { h5str.s[0] = '\0'; - if (!h5str_sprintf(ENVONLY, &h5str, did, tid, &(((char *)readBuf)[i * typeSize]), typeSize, 0)) + if (!h5str_sprintf(ENVONLY, &h5str, did, tid, &(((char *)readBuf)[i * typeSize]), 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s))) @@ -1657,7 +1657,7 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref(JNIEnv *env, jclass clss, jlong dataset_id for (i = 0; i < n; i++) { h5str.s[0] = '\0'; - if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)dataset_id, (hid_t)mem_type_id, &ref_data[i], 0, 0)) + if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)dataset_id, (hid_t)mem_type_id, &ref_data[i], 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s))) diff --git a/java/src/jni/h5dImp.h b/java/src/jni/h5dImp.h index 61dfeaa..e339dad 100644 --- a/java/src/jni/h5dImp.h +++ b/java/src/jni/h5dImp.h @@ -13,8 +13,8 @@ #include <jni.h> /* Header for class hdf_hdf5lib_H5_H5D */ -#ifndef _Included_hdf_hdf5lib_H5_H5D -#define _Included_hdf_hdf5lib_H5_H5D +#ifndef Included_hdf_hdf5lib_H5_H5D +#define Included_hdf_hdf5lib_H5_H5D #ifdef __cplusplus extern "C" { @@ -322,4 +322,4 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Drefresh(JNIEnv *, jclass, jlong); } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5D */ +#endif /* Included_hdf_hdf5lib_H5_H5D */ diff --git a/java/src/jni/h5eImp.h b/java/src/jni/h5eImp.h index 3133ca9..95e43fa 100644 --- a/java/src/jni/h5eImp.h +++ b/java/src/jni/h5eImp.h @@ -13,8 +13,8 @@ #include <jni.h> /* Header for class hdf_hdf5lib_H5_H5E */ -#ifndef _Included_hdf_hdf5lib_H5_H5E -#define _Included_hdf_hdf5lib_H5_H5E +#ifndef Included_hdf_hdf5lib_H5_H5E +#define Included_hdf_hdf5lib_H5_H5E #ifdef __cplusplus extern "C" { @@ -144,4 +144,4 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Ewalk2(JNIEnv *, jclass, jlong, jlo } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5E */ +#endif /* Included_hdf_hdf5lib_H5_H5E */ diff --git a/java/src/jni/h5fImp.h b/java/src/jni/h5fImp.h index d1f466b..f9790b6 100644 --- a/java/src/jni/h5fImp.h +++ b/java/src/jni/h5fImp.h @@ -13,8 +13,8 @@ #include <jni.h> /* Header for class hdf_hdf5lib_H5_H5F */ -#ifndef _Included_hdf_hdf5lib_H5_H5F -#define _Included_hdf_hdf5lib_H5_H5F +#ifndef Included_hdf_hdf5lib_H5_H5F +#define Included_hdf_hdf5lib_H5_H5F #ifdef __cplusplus extern "C" { @@ -222,4 +222,4 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds(JNIEnv *, jcla } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5F */ +#endif /* Included_hdf_hdf5lib_H5_H5F */ diff --git a/java/src/jni/h5gImp.h b/java/src/jni/h5gImp.h index 4b0cb4d..b7130ed 100644 --- a/java/src/jni/h5gImp.h +++ b/java/src/jni/h5gImp.h @@ -13,8 +13,8 @@ #include <jni.h> /* Header for class hdf_hdf5lib_H5_H5G */ -#ifndef _Included_hdf_hdf5lib_H5_H5G -#define _Included_hdf_hdf5lib_H5_H5G +#ifndef Included_hdf_hdf5lib_H5_H5G +#define Included_hdf_hdf5lib_H5_H5G #ifdef __cplusplus extern "C" { @@ -96,4 +96,4 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Grefresh(JNIEnv *, jclass, jlong); } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5G */ +#endif /* Included_hdf_hdf5lib_H5_H5G */ diff --git a/java/src/jni/h5iImp.h b/java/src/jni/h5iImp.h index ed54303..08d5fa1 100644 --- a/java/src/jni/h5iImp.h +++ b/java/src/jni/h5iImp.h @@ -13,8 +13,8 @@ #include <jni.h> /* Header for class hdf_hdf5lib_H5_H5I */ -#ifndef _Included_hdf_hdf5lib_H5_H5I -#define _Included_hdf_hdf5lib_H5_H5I +#ifndef Included_hdf_hdf5lib_H5_H5I +#define Included_hdf_hdf5lib_H5_H5I #ifdef __cplusplus extern "C" { @@ -130,4 +130,4 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Idestroy_1type(JNIEnv *, jclass, ji } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5I */ +#endif /* Included_hdf_hdf5lib_H5_H5I */ diff --git a/java/src/jni/h5jni.h b/java/src/jni/h5jni.h index 78fc92a..3750f8b 100644 --- a/java/src/jni/h5jni.h +++ b/java/src/jni/h5jni.h @@ -21,8 +21,8 @@ #include <string.h> #include "H5private.h" -#ifndef _Included_h5jni -#define _Included_h5jni +#ifndef Included_h5jni +#define Included_h5jni #ifdef __cplusplus #define ENVPTR (env) @@ -266,9 +266,10 @@ extern jboolean h5JNIFatalError(JNIEnv *env, const char *); extern jboolean h5nullArgument(JNIEnv *env, const char *); extern jboolean h5badArgument(JNIEnv *env, const char *); extern jboolean h5outOfMemory(JNIEnv *env, const char *); +extern jboolean h5assertion(JNIEnv *env, const char *); +extern jboolean h5unimplemented(JNIEnv *env, const char *); extern jboolean h5libraryError(JNIEnv *env); extern jboolean h5raiseException(JNIEnv *env, const char *, const char *); -extern jboolean h5unimplemented(JNIEnv *env, const char *functName); /* * The following macros are to facilitate immediate cleanup+return @@ -304,21 +305,27 @@ extern jboolean h5unimplemented(JNIEnv *env, const char *functName); goto done; \ } while (0) -#define H5_LIBRARY_ERROR(env) \ +#define H5_ASSERTION_ERROR(env, message) \ do { \ - h5libraryError(env); \ + h5assertion(env, message); \ goto done; \ } while (0) -#define H5_RAISE_EXCEPTION(env, message, exception) \ +#define H5_UNIMPLEMENTED(env, message) \ do { \ - h5raiseException(env, message, exception); \ + h5unimplemented(env, message); \ goto done; \ } while (0) -#define H5_UNIMPLEMENTED(env, message) \ +#define H5_LIBRARY_ERROR(env) \ do { \ - h5unimplemented(env, message); \ + h5libraryError(env); \ + goto done; \ + } while (0) + +#define H5_RAISE_EXCEPTION(env, message, exception) \ + do { \ + h5raiseException(env, message, exception); \ goto done; \ } while (0) @@ -334,4 +341,4 @@ extern jobject create_H5G_info_t(JNIEnv *env, H5G_info_t group_info); } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_h5jni */ +#endif /* Included_h5jni */ diff --git a/java/src/jni/h5lImp.h b/java/src/jni/h5lImp.h index 134ed17..85aff03 100644 --- a/java/src/jni/h5lImp.h +++ b/java/src/jni/h5lImp.h @@ -13,8 +13,8 @@ #include <jni.h> /* Header for class hdf_hdf5lib_H5_H5_H5L */ -#ifndef _Included_hdf_hdf5lib_H5_H5L -#define _Included_hdf_hdf5lib_H5_H5L +#ifndef Included_hdf_hdf5lib_H5_H5L +#define Included_hdf_hdf5lib_H5_H5L #ifdef __cplusplus extern "C" { @@ -170,4 +170,4 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Lunregister(JNIEnv *, jclass, jint) } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5L */ +#endif /* Included_hdf_hdf5lib_H5_H5L */ diff --git a/java/src/jni/h5oImp.h b/java/src/jni/h5oImp.h index 2ddf7a2..26a16c4 100644 --- a/java/src/jni/h5oImp.h +++ b/java/src/jni/h5oImp.h @@ -13,8 +13,8 @@ #include <jni.h> /* Header for class hdf_hdf5lib_H5_H5_H5O */ -#ifndef _Included_hdf_hdf5lib_H5_H5O -#define _Included_hdf_hdf5lib_H5_H5O +#ifndef Included_hdf_hdf5lib_H5_H5O +#define Included_hdf_hdf5lib_H5_H5O #ifdef __cplusplus extern "C" { @@ -193,4 +193,4 @@ JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Oare_1mdc_1flushes_1disabled(JN } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5O */ +#endif /* Included_hdf_hdf5lib_H5_H5O */ diff --git a/java/src/jni/h5pACPLImp.h b/java/src/jni/h5pACPLImp.h index 8d9bf7d..15fcf33 100644 --- a/java/src/jni/h5pACPLImp.h +++ b/java/src/jni/h5pACPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PACPL -#define _Included_hdf_hdf5lib_H5_H5PACPL +#ifndef Included_hdf_hdf5lib_H5_H5PACPL +#define Included_hdf_hdf5lib_H5_H5PACPL #include <jni.h> @@ -23,4 +23,4 @@ extern "C" { } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PACPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PACPL */ diff --git a/java/src/jni/h5pDAPLImp.h b/java/src/jni/h5pDAPLImp.h index 353f652..bf11fef 100644 --- a/java/src/jni/h5pDAPLImp.h +++ b/java/src/jni/h5pDAPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PDAPL -#define _Included_hdf_hdf5lib_H5_H5PDAPL +#ifndef Included_hdf_hdf5lib_H5_H5PDAPL +#define Included_hdf_hdf5lib_H5_H5PDAPL #include <jni.h> @@ -93,4 +93,4 @@ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap(JNIEnv } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PDAPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PDAPL */ diff --git a/java/src/jni/h5pDCPLImp.h b/java/src/jni/h5pDCPLImp.h index 302019f..46d1cc3 100644 --- a/java/src/jni/h5pDCPLImp.h +++ b/java/src/jni/h5pDCPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PDCPL -#define _Included_hdf_hdf5lib_H5_H5PDCPL +#ifndef Included_hdf_hdf5lib_H5_H5PDCPL +#define Included_hdf_hdf5lib_H5_H5PDCPL #include <jni.h> @@ -320,4 +320,4 @@ JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix(JNIEnv *, } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PDCPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PDCPL */ diff --git a/java/src/jni/h5pDXPLImp.h b/java/src/jni/h5pDXPLImp.h index 250c3f8..21c40c4 100644 --- a/java/src/jni/h5pDXPLImp.h +++ b/java/src/jni/h5pDXPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PDXPL -#define _Included_hdf_hdf5lib_H5_H5PDXPL +#ifndef Included_hdf_hdf5lib_H5_H5PDXPL +#define Included_hdf_hdf5lib_H5_H5PDXPL #include <jni.h> @@ -181,4 +181,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios(JNIEnv *, jclas } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PDXPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PDXPL */ diff --git a/java/src/jni/h5pFAPLImp.h b/java/src/jni/h5pFAPLImp.h index 4bb48e2..3c5988f 100644 --- a/java/src/jni/h5pFAPLImp.h +++ b/java/src/jni/h5pFAPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PFAPL -#define _Included_hdf_hdf5lib_H5_H5PFAPL +#ifndef Included_hdf_hdf5lib_H5_H5PFAPL +#define Included_hdf_hdf5lib_H5_H5PFAPL #include <jni.h> @@ -476,4 +476,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds(JNIEnv *, jcla } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PFAPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PFAPL */ diff --git a/java/src/jni/h5pFCPLImp.h b/java/src/jni/h5pFCPLImp.h index eb827b9..78e98ae 100644 --- a/java/src/jni/h5pFCPLImp.h +++ b/java/src/jni/h5pFCPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PFCPL -#define _Included_hdf_hdf5lib_H5_H5PFCPL +#ifndef Included_hdf_hdf5lib_H5_H5PFCPL +#define Included_hdf_hdf5lib_H5_H5PFCPL #include <jni.h> @@ -177,4 +177,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change(J } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PFCPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PFCPL */ diff --git a/java/src/jni/h5pGAPLImp.h b/java/src/jni/h5pGAPLImp.h index 478402a..9091ff8 100644 --- a/java/src/jni/h5pGAPLImp.h +++ b/java/src/jni/h5pGAPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PGAPL -#define _Included_hdf_hdf5lib_H5_H5PGAPL +#ifndef Included_hdf_hdf5lib_H5_H5PGAPL +#define Included_hdf_hdf5lib_H5_H5PGAPL #include <jni.h> @@ -23,4 +23,4 @@ extern "C" { } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PGAPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PGAPL */ diff --git a/java/src/jni/h5pGCPLImp.h b/java/src/jni/h5pGCPLImp.h index 6a40908..5090c3a 100644 --- a/java/src/jni/h5pGCPLImp.h +++ b/java/src/jni/h5pGCPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PGCPL -#define _Included_hdf_hdf5lib_H5_H5PGCPL +#ifndef Included_hdf_hdf5lib_H5_H5PGCPL +#define Included_hdf_hdf5lib_H5_H5PGCPL #include <jni.h> @@ -79,4 +79,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change(JNIEnv *, } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PGCPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PGCPL */ diff --git a/java/src/jni/h5pImp.h b/java/src/jni/h5pImp.h index b80ce46..189e9d7 100644 --- a/java/src/jni/h5pImp.h +++ b/java/src/jni/h5pImp.h @@ -12,8 +12,8 @@ /* Header for class hdf_hdf5lib_H5_H5_H5P */ -#ifndef _Included_hdf_hdf5lib_H5_H5P -#define _Included_hdf_hdf5lib_H5_H5P +#ifndef Included_hdf_hdf5lib_H5_H5P +#define Included_hdf_hdf5lib_H5_H5P #include <jni.h> @@ -210,4 +210,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Pclose_1class(JNIEnv *, jclass, j } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5P */ +#endif /* Included_hdf_hdf5lib_H5_H5P */ diff --git a/java/src/jni/h5pLAPLImp.h b/java/src/jni/h5pLAPLImp.h index 46adc0c..8ddc8d2 100644 --- a/java/src/jni/h5pLAPLImp.h +++ b/java/src/jni/h5pLAPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PLAPL -#define _Included_hdf_hdf5lib_H5_H5PLAPL +#ifndef Included_hdf_hdf5lib_H5_H5PLAPL +#define Included_hdf_hdf5lib_H5_H5PLAPL #include <jni.h> @@ -87,4 +87,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags(JNIEnv *, j } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PLAPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PLAPL */ diff --git a/java/src/jni/h5pLCPLImp.h b/java/src/jni/h5pLCPLImp.h index 7601adb..4cdf6cd 100644 --- a/java/src/jni/h5pLCPLImp.h +++ b/java/src/jni/h5pLCPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PLCPL -#define _Included_hdf_hdf5lib_H5_H5PLCPL +#ifndef Included_hdf_hdf5lib_H5_H5PLCPL +#define Included_hdf_hdf5lib_H5_H5PLCPL #include <jni.h> @@ -23,4 +23,4 @@ extern "C" { } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PLCPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PLCPL */ diff --git a/java/src/jni/h5pOCPLImp.h b/java/src/jni/h5pOCPLImp.h index c16f1be..94d397b 100644 --- a/java/src/jni/h5pOCPLImp.h +++ b/java/src/jni/h5pOCPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5POCPL -#define _Included_hdf_hdf5lib_H5_H5POCPL +#ifndef Included_hdf_hdf5lib_H5_H5POCPL +#define Included_hdf_hdf5lib_H5_H5POCPL #include <jni.h> @@ -80,4 +80,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order(JNIEnv } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5POCPL */ +#endif /* Included_hdf_hdf5lib_H5_H5POCPL */ diff --git a/java/src/jni/h5pOCpyPLImp.h b/java/src/jni/h5pOCpyPLImp.h index d8682cb..50ee972 100644 --- a/java/src/jni/h5pOCpyPLImp.h +++ b/java/src/jni/h5pOCpyPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5POCpyPL -#define _Included_hdf_hdf5lib_H5_H5POCpyPL +#ifndef Included_hdf_hdf5lib_H5_H5POCpyPL +#define Included_hdf_hdf5lib_H5_H5POCpyPL #include <jni.h> @@ -53,4 +53,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1copy_1object(JNIEnv *, jclass } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5POCpyPL */ +#endif /* Included_hdf_hdf5lib_H5_H5POCpyPL */ diff --git a/java/src/jni/h5pStrCPLImp.h b/java/src/jni/h5pStrCPLImp.h index 8a56494..c0a7ec2 100644 --- a/java/src/jni/h5pStrCPLImp.h +++ b/java/src/jni/h5pStrCPLImp.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _Included_hdf_hdf5lib_H5_H5PStrCPL -#define _Included_hdf_hdf5lib_H5_H5PStrCPL +#ifndef Included_hdf_hdf5lib_H5_H5PStrCPL +#define Included_hdf_hdf5lib_H5_H5PStrCPL #include <jni.h> @@ -37,4 +37,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding(JNIEnv *, jcla } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PStrCPL */ +#endif /* Included_hdf_hdf5lib_H5_H5PStrCPL */ diff --git a/java/src/jni/h5plImp.h b/java/src/jni/h5plImp.h index b809efa..410a34f 100644 --- a/java/src/jni/h5plImp.h +++ b/java/src/jni/h5plImp.h @@ -13,8 +13,8 @@ #include <jni.h> /* Header for class hdf_hdf5lib_H5_H5PL */ -#ifndef _Included_hdf_hdf5lib_H5_H5PL -#define _Included_hdf_hdf5lib_H5_H5PL +#ifndef Included_hdf_hdf5lib_H5_H5PL +#define Included_hdf_hdf5lib_H5_H5PL #ifdef __cplusplus extern "C" { @@ -87,4 +87,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5PLsize(JNIEnv *, jclass); } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5PL */ +#endif /* Included_hdf_hdf5lib_H5_H5PL */ diff --git a/java/src/jni/h5rImp.h b/java/src/jni/h5rImp.h index 3fe56b8..6270323 100644 --- a/java/src/jni/h5rImp.h +++ b/java/src/jni/h5rImp.h @@ -13,8 +13,8 @@ #include <jni.h> /* Header for class hdf_hdf5lib_H5_H5R */ -#ifndef _Included_hdf_hdf5lib_H5_H5R -#define _Included_hdf_hdf5lib_H5_H5R +#ifndef Included_hdf_hdf5lib_H5_H5R +#define Included_hdf_hdf5lib_H5_H5R #ifdef __cplusplus extern "C" { @@ -70,4 +70,4 @@ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Rget_1name(JNIEnv *, jclass, jlong } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5R */ +#endif /* Included_hdf_hdf5lib_H5_H5R */ diff --git a/java/src/jni/h5sImp.h b/java/src/jni/h5sImp.h index 1ceaf3f..a758d5a 100644 --- a/java/src/jni/h5sImp.h +++ b/java/src/jni/h5sImp.h @@ -13,8 +13,8 @@ #include <jni.h> /* Header for class hdf_hdf5lib_H5_H5S */ -#ifndef _Included_hdf_hdf5lib_H5_H5S -#define _Included_hdf_hdf5lib_H5_H5S +#ifndef Included_hdf_hdf5lib_H5_H5S +#define Included_hdf_hdf5lib_H5_H5S #ifdef __cplusplus extern "C" { @@ -321,4 +321,4 @@ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Scombine_1select(JNIEnv *, jclass, } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5S */ +#endif /* Included_hdf_hdf5lib_H5_H5S */ diff --git a/java/src/jni/h5tImp.h b/java/src/jni/h5tImp.h index 4e14482..b6355fb 100644 --- a/java/src/jni/h5tImp.h +++ b/java/src/jni/h5tImp.h @@ -13,8 +13,8 @@ #include <jni.h> /* Header for class hdf_hdf5lib_H5_H5T */ -#ifndef _Included_hdf_hdf5lib_H5_H5T -#define _Included_hdf_hdf5lib_H5_H5T +#ifndef Included_hdf_hdf5lib_H5_H5T +#define Included_hdf_hdf5lib_H5_H5T #ifdef __cplusplus extern "C" { @@ -498,4 +498,4 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Trefresh(JNIEnv *, jclass, jlong); } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5T */ +#endif /* Included_hdf_hdf5lib_H5_H5T */ diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 8174b78..c4021ec 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -52,16 +52,18 @@ void * edata; /* Local Prototypes */ /********************/ -static int h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj); -static int h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj); +static int h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj, + int expand_data); +static int h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj, + int expand_data); static int h5str_is_zero(const void *_mem, size_t size); static hid_t h5str_get_native_type(hid_t type); static hid_t h5str_get_little_endian_type(hid_t type); static hid_t h5str_get_big_endian_type(hid_t type); static htri_t h5str_detect_vlen(hid_t tid); static htri_t h5str_detect_vlen_str(hid_t tid); -static int h5tools_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, void *_mem, - hsize_t nelmts); +static int h5str_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, void *_mem, + hsize_t nelmts); static int h5str_render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts); static int render_bin_output_region_data_blocks(FILE *stream, hid_t region_id, hid_t container, int ndims, @@ -181,13 +183,14 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ H5T_class_t tclass = H5T_NO_CLASS; const char delimiter[] = " ," H5_COMPOUND_BEGIN_INDICATOR H5_COMPOUND_END_INDICATOR H5_ARRAY_BEGIN_INDICATOR H5_ARRAY_END_INDICATOR H5_VLEN_BEGIN_INDICATOR H5_VLEN_END_INDICATOR; - size_t typeSize = 0; - hid_t mtid = H5I_INVALID_HID; - char * this_str = NULL; - char * token; - char * cptr = NULL; - int n; - size_t retVal = 0; + + size_t retVal = 0; + size_t typeSize = 0; + hid_t mtid = H5I_INVALID_HID; + char * this_str = NULL; + char * cptr = NULL; + char * token; + int n; if (!in_str) H5_NULL_ARGUMENT_ERROR(ENVONLY, "h5str_convert: in_str is NULL"); @@ -235,7 +238,7 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ case sizeof(long double): { long double tmp_ldouble = 0.0; - sscanf(token, "%Lf", &tmp_ldouble); + sscanf(token, "%Lg", &tmp_ldouble); HDmemcpy(cptr, &tmp_ldouble, sizeof(long double)); break; } @@ -635,6 +638,53 @@ done: return retVal; } /* end h5str_convert */ +int +h5str_region_dataset(JNIEnv *env, h5str_t *out_str, hid_t container, void *ref_buf, int expand_data) +{ + H5S_sel_type region_type = H5S_SEL_ERROR; + hid_t region_obj = H5I_INVALID_HID; + hid_t region_sid = H5I_INVALID_HID; + char ref_name[1024]; + + int ret_value = FAIL; + + if ((region_obj = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, ref_buf)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if ((region_sid = H5Rget_region(container, H5R_DATASET_REGION, ref_buf)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (expand_data) { + if (H5Rget_name(region_obj, H5R_DATASET_REGION, ref_buf, (char *)ref_name, 1024) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (!h5str_append(out_str, ref_name)) + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); + } + + if ((region_type = H5Sget_select_type(region_sid)) > H5S_SEL_ERROR) { + if (H5S_SEL_POINTS == region_type) { + if (h5str_dump_region_points(ENVONLY, out_str, region_sid, region_obj, expand_data) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + } + else if (H5S_SEL_HYPERSLABS == region_type) { + if (h5str_dump_region_blocks(ENVONLY, out_str, region_sid, region_obj, expand_data) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + } + } + + ret_value = SUCCEED; +done: + if (region_sid >= 0) + if (H5Sclose(region_sid) < 0) + H5_LIBRARY_ERROR(ENVONLY); + if (region_obj >= 0) + if (H5Dclose(region_obj) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + return ret_value; +} + /* * Prints the value of a data point into a string. * @@ -643,8 +693,7 @@ done: * FAILURE: 0 */ size_t -h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *in_buf, size_t in_buf_len, - int expand_data) +h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *in_buf, int expand_data) { unsigned char *ucptr = (unsigned char *)in_buf; static char fmt_llong[8], fmt_ullong[8]; @@ -666,8 +715,6 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i H5_LIBRARY_ERROR(ENVONLY); if (!(typeSize = H5Tget_size(tid))) H5_LIBRARY_ERROR(ENVONLY); - if (!(nsign = H5Tget_sign(tid))) - H5_LIBRARY_ERROR(ENVONLY); /* Build default formats for long long types */ if (!fmt_llong[0]) { @@ -676,7 +723,6 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i if (HDsnprintf(fmt_ullong, sizeof(fmt_ullong), "%%%su", H5_PRINTF_LL_WIDTH) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); } /* end if */ - switch (tclass) { case H5T_FLOAT: { switch (typeSize) { @@ -937,7 +983,7 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i H5_LIBRARY_ERROR(ENVONLY); if (!h5str_append(out_str, H5_COMPOUND_BEGIN_INDICATOR)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); for (i = 0; i < (unsigned)n; i++) { offset = H5Tget_member_offset(tid, i); @@ -945,12 +991,12 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i if ((mtid = H5Tget_member_type(tid, i)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &cptr[offset], in_buf_len, expand_data)) + if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &cptr[offset], expand_data)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if ((i + 1) < (unsigned)n) if (!h5str_append(out_str, ", ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); if (H5Tclose(mtid) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -958,7 +1004,7 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i } if (!h5str_append(out_str, H5_COMPOUND_END_INDICATOR)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); break; } @@ -968,7 +1014,7 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i if (H5Tenum_nameof(tid, cptr, enum_name, sizeof enum_name) >= 0) { if (!h5str_append(out_str, enum_name)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); } else { size_t i; @@ -993,74 +1039,13 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i case H5T_REFERENCE: { if (h5str_is_zero(cptr, typeSize)) { if (!h5str_append(out_str, "NULL")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); break; } if (H5R_DSET_REG_REF_BUF_SIZE == typeSize) { - H5S_sel_type region_type = H5S_SEL_ERROR; - hid_t region_obj = H5I_INVALID_HID; - hid_t region = H5I_INVALID_HID; - char ref_name[1024]; - - /* - * Dataset region reference -- - * show the type and the referenced object - */ - - /* Get name of the dataset the region reference points to using H5Rget_name */ - if ((region_obj = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, cptr)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if ((region = H5Rget_region(container, H5R_DATASET_REGION, cptr)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if (expand_data) { - if (H5S_SEL_ERROR == (region_type = H5Sget_select_type(region))) - H5_LIBRARY_ERROR(ENVONLY); - - if (H5S_SEL_POINTS == region_type) { - if (h5str_dump_region_points_data(ENVONLY, out_str, region, region_obj) < 0) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } - else { - if (h5str_dump_region_blocks_data(ENVONLY, out_str, region, region_obj) < 0) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } - } - else { - if (H5Rget_name(region_obj, H5R_DATASET_REGION, cptr, (char *)ref_name, 1024) < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if (!h5str_append(out_str, ref_name)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - - if (H5S_SEL_ERROR == (region_type = H5Sget_select_type(region))) - H5_LIBRARY_ERROR(ENVONLY); - - if (H5S_SEL_POINTS == region_type) { - if (!h5str_append(out_str, " REGION_TYPE POINT")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - - if (h5str_dump_region_points(ENVONLY, out_str, region, region_obj) < 0) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } - else { - if (!h5str_append(out_str, " REGION_TYPE BLOCK")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - - if (h5str_dump_region_blocks(ENVONLY, out_str, region, region_obj) < 0) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } - } - - if (H5Sclose(region) < 0) - H5_LIBRARY_ERROR(ENVONLY); - region = H5I_INVALID_HID; - - if (H5Dclose(region_obj) < 0) - H5_LIBRARY_ERROR(ENVONLY); - region_obj = H5I_INVALID_HID; + if (h5str_region_dataset(ENVONLY, out_str, container, cptr, expand_data) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); } else if (H5R_OBJ_REF_BUF_SIZE == typeSize) { H5O_info_t oi; @@ -1098,7 +1083,7 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i int rank = 0; if (!h5str_append(out_str, H5_ARRAY_BEGIN_INDICATOR)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); if ((mtid = H5Tget_super(tid)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1116,17 +1101,16 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i total_elmts *= dims[i]; for (i = 0; i < total_elmts; i++) { - if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &(cptr[i * baseSize]), in_buf_len, - expand_data)) + if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &(cptr[i * baseSize]), expand_data)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if ((i + 1) < total_elmts) if (!h5str_append(out_str, ", ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); } if (!h5str_append(out_str, H5_ARRAY_END_INDICATOR)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); if (H5Tclose(mtid) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1147,20 +1131,20 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i H5_LIBRARY_ERROR(ENVONLY); if (!h5str_append(out_str, H5_VLEN_BEGIN_INDICATOR)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); for (i = 0; i < (unsigned)vl_buf->len; i++) { if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &(((char *)vl_buf->p)[i * baseSize]), - vl_buf->len, expand_data)) + expand_data)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if ((i + 1) < (unsigned)vl_buf->len) if (!h5str_append(out_str, ", ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); } if (!h5str_append(out_str, H5_VLEN_END_INDICATOR)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); if (H5Tclose(mtid) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1202,7 +1186,7 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i if (this_str) { if (!h5str_append(out_str, this_str)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); HDfree(this_str); this_str = NULL; @@ -1303,12 +1287,12 @@ h5str_print_region_data_blocks(JNIEnv *env, hid_t region_id, h5str_t *str, int n for (numindex = 0; numindex < numelem; numindex++) { if (!h5str_sprintf(ENVONLY, str, region_id, type_id, ((char *)region_buf + numindex * type_size), - 0, 1)) + 1)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (numindex + 1 < numelem) if (!h5str_append(str, ", ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); } /* end for (jndx = 0; jndx < numelem; jndx++, region_elmtno++, ctx.cur_elmt++) */ } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */ @@ -1332,7 +1316,7 @@ done: } /* end h5str_print_region_data_blocks */ int -h5str_dump_region_blocks_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id) +h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region_space, hid_t region_id, int expand_data) { hssize_t nblocks; hsize_t alloc_size; @@ -1341,29 +1325,31 @@ h5str_dump_region_blocks_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t reg hid_t type_id = H5I_INVALID_HID; int ndims = -1; int ret_value = FAIL; + int i; + char tmp_str[256]; /* * This function fails if the region does not have blocks. */ - H5E_BEGIN_TRY { nblocks = H5Sget_select_hyper_nblocks(region); } + H5E_BEGIN_TRY { nblocks = H5Sget_select_hyper_nblocks(region_space); } H5E_END_TRY; - if (nblocks < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if ((ndims = H5Sget_simple_extent_ndims(region)) < 0) + if (nblocks <= 0) { + ret_value = SUCCEED; + goto done; + } + if ((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) H5_LIBRARY_ERROR(ENVONLY); /* Print block information */ alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]); - if (alloc_size == (hsize_t)((size_t)alloc_size)) { - if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, - "h5str_dump_region_blocks_data: failed to allocate region block buffer"); + if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_region_blocks: failed to allocate region block buffer"); - if (H5Sget_select_hyper_blocklist(region, (hsize_t)0, (hsize_t)nblocks, ptdata) < 0) - H5_LIBRARY_ERROR(ENVONLY); + if (H5Sget_select_hyper_blocklist(region_space, (hsize_t)0, (hsize_t)nblocks, ptdata) < 0) + H5_LIBRARY_ERROR(ENVONLY); + if (expand_data) { if ((dtype = H5Dget_type(region_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1372,65 +1358,19 @@ h5str_dump_region_blocks_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t reg if (h5str_print_region_data_blocks(ENVONLY, region_id, str, ndims, type_id, nblocks, ptdata) < 0) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } /* if (alloc_size == (hsize_t)((size_t)alloc_size)) */ - - ret_value = SUCCEED; - -done: - if (type_id >= 0) - H5Tclose(type_id); - if (dtype >= 0) - H5Tclose(dtype); - if (ptdata) - HDfree(ptdata); - - return ret_value; -} /* end h5str_dump_region_blocks_data */ - -static int -h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id) -{ - hssize_t nblocks; - hsize_t alloc_size; - hsize_t *ptdata = NULL; - char tmp_str[256]; - int ndims = -1; - int ret_value = FAIL; - - UNUSED(region_id); - - /* - * This function fails if the region does not have blocks. - */ - H5E_BEGIN_TRY { nblocks = H5Sget_select_hyper_nblocks(region); } - H5E_END_TRY; - - if (nblocks < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if ((ndims = H5Sget_simple_extent_ndims(region)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - - /* Print block information */ - alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]); - if (alloc_size == (hsize_t)((size_t)alloc_size)) { - int i; - - if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, - "h5str_dump_region_blocks: failed to allocate region block buffer"); - - if (H5Sget_select_hyper_blocklist(region, (hsize_t)0, (hsize_t)nblocks, ptdata) < 0) - H5_LIBRARY_ERROR(ENVONLY); + } + else { + if (!h5str_append(str, " REGION_TYPE BLOCK")) + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); if (!h5str_append(str, " {")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); for (i = 0; i < nblocks; i++) { int j; if (!h5str_append(str, " ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); /* Start coordinates and opposite corner */ for (j = 0; j < ndims; j++) { @@ -1440,7 +1380,7 @@ h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_i H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: HDsprintf failure"); if (!h5str_append(str, tmp_str)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); } for (j = 0; j < ndims; j++) { @@ -1451,22 +1391,25 @@ h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_i H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: HDsprintf failure"); if (!h5str_append(str, tmp_str)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); } if (!h5str_append(str, ") ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); tmp_str[0] = '\0'; } if (!h5str_append(str, " }")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } /* if (alloc_size == (hsize_t)((size_t)alloc_size)) */ - + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); + } ret_value = SUCCEED; done: + if (type_id >= 0) + H5Tclose(type_id); + if (dtype >= 0) + H5Tclose(dtype); if (ptdata) HDfree(ptdata); @@ -1524,12 +1467,12 @@ h5str_print_region_data_points(JNIEnv *env, hid_t region_space, hid_t region_id, if (H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (!h5str_sprintf(ENVONLY, str, region_id, type_id, ((char *)region_buf + jndx * type_size), 0, 1)) + if (!h5str_sprintf(ENVONLY, str, region_id, type_id, ((char *)region_buf + jndx * type_size), 1)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (jndx + 1 < (size_t)npoints) if (!h5str_append(str, ", ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); } /* end for (jndx = 0; jndx < npoints; jndx++, elmtno++) */ ret_value = SUCCEED; @@ -1546,133 +1489,88 @@ done: } /* end h5str_print_region_data_points */ int -h5str_dump_region_points_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id) +h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region_space, hid_t region_id, int expand_data) { - hssize_t npoints; hsize_t alloc_size; + hssize_t npoints = -1; hsize_t *ptdata = NULL; hid_t dtype = H5I_INVALID_HID; hid_t type_id = H5I_INVALID_HID; int ndims = -1; int ret_value = FAIL; + int i; + char tmp_str[256]; /* * This function fails if the region does not have points. */ - H5E_BEGIN_TRY { npoints = H5Sget_select_elem_npoints(region); } + H5E_BEGIN_TRY { npoints = H5Sget_select_elem_npoints(region_space); } H5E_END_TRY; - if (npoints < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if ((ndims = H5Sget_simple_extent_ndims(region)) < 0) + if (npoints <= 0) { + ret_value = SUCCEED; + goto done; + } + if ((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) H5_LIBRARY_ERROR(ENVONLY); /* Print point information */ - if (npoints > 0) { - alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]); - if (alloc_size == (hsize_t)((size_t)alloc_size)) { - if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) - H5_OUT_OF_MEMORY_ERROR( - ENVONLY, "h5str_dump_region_points_data: failed to allocate region point data buffer"); - - if (H5Sget_select_elem_pointlist(region, (hsize_t)0, (hsize_t)npoints, ptdata) < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if ((dtype = H5Dget_type(region_id)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if ((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if (h5str_print_region_data_points(ENVONLY, region, region_id, str, ndims, type_id, npoints, - ptdata) < 0) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } - } - - ret_value = SUCCEED; - -done: - if (type_id >= 0) - H5Tclose(type_id); - if (dtype >= 0) - H5Tclose(dtype); - if (ptdata) - HDfree(ptdata); - - return ret_value; -} /* end h5str_dump_region_points_data */ - -static int -h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id) -{ - hssize_t npoints; - hsize_t alloc_size; - hsize_t *ptdata = NULL; - char tmp_str[256]; - int ndims = -1; - int ret_value = FAIL; - - UNUSED(region_id); - - /* - * This function fails if the region does not have points. - */ - H5E_BEGIN_TRY { npoints = H5Sget_select_elem_npoints(region); } - H5E_END_TRY; - - if (npoints < 0) - H5_LIBRARY_ERROR(ENVONLY); + alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]); + if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, + "h5str_dump_region_points: failed to allocate region point data buffer"); - if ((ndims = H5Sget_simple_extent_ndims(region)) < 0) + if (H5Sget_select_elem_pointlist(region_space, (hsize_t)0, (hsize_t)npoints, ptdata) < 0) H5_LIBRARY_ERROR(ENVONLY); - /* Print point information */ - if (npoints > 0) { - int i; - - alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]); - if (alloc_size == (hsize_t)((size_t)alloc_size)) { - if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, - "h5str_dump_region_points: failed to allocate region point buffer"); + if (expand_data) { + if ((dtype = H5Dget_type(region_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); - if (H5Sget_select_elem_pointlist(region, (hsize_t)0, (hsize_t)npoints, ptdata) < 0) - H5_LIBRARY_ERROR(ENVONLY); + if ((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) + H5_LIBRARY_ERROR(ENVONLY); - if (!h5str_append(str, " {")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + if (h5str_print_region_data_points(ENVONLY, region_space, region_id, str, ndims, type_id, npoints, + ptdata) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + } + else { + if (!h5str_append(str, " REGION_TYPE POINT")) + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); - for (i = 0; i < npoints; i++) { - int j; + if (!h5str_append(str, " {")) + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); - if (!h5str_append(str, " ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + for (i = 0; i < npoints; i++) { + int j; - for (j = 0; j < ndims; j++) { - tmp_str[0] = '\0'; + if (!h5str_append(str, " ")) + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); - if (HDsprintf(tmp_str, "%s%lu", j ? "," : "(", (unsigned long)(ptdata[i * ndims + j])) < - 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_points: HDsprintf failure"); + for (j = 0; j < ndims; j++) { + tmp_str[0] = '\0'; - if (!h5str_append(str, tmp_str)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } /* end for (j = 0; j < ndims; j++) */ + if (HDsprintf(tmp_str, "%s%lu", j ? "," : "(", (unsigned long)(ptdata[i * ndims + j])) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_points: HDsprintf failure"); - if (!h5str_append(str, ") ")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } /* end for (i = 0; i < npoints; i++) */ + if (!h5str_append(str, tmp_str)) + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); + } /* end for (j = 0; j < ndims; j++) */ - if (!h5str_append(str, " }")) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } /* end if (alloc_size == (hsize_t)((size_t) alloc_size)) */ - } /* end if (npoints > 0) */ + if (!h5str_append(str, ") ")) + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); + } /* end for (i = 0; i < npoints; i++) */ + if (!h5str_append(str, " }")) + H5_ASSERTION_ERROR(ENVONLY, "Unable to append string."); + } ret_value = SUCCEED; done: + if (type_id >= 0) + H5Tclose(type_id); + if (dtype >= 0) + H5Tclose(dtype); if (ptdata) HDfree(ptdata); @@ -2195,8 +2093,9 @@ h5str_render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hs case H5T_REFERENCE: { if (H5Tequal(tid, H5T_STD_REF_DSETREG)) { + hid_t region_id = H5I_INVALID_HID; + hid_t region_space = H5I_INVALID_HID; H5S_sel_type region_type; - hid_t region_id, region_space; /* Region data */ for (block_index = 0; block_index < block_nelmts; block_index++) { @@ -2204,26 +2103,17 @@ h5str_render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hs if ((region_id = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, mem)) < 0) continue; + if ((region_space = H5Rget_region(container, H5R_DATASET_REGION, mem)) >= 0) { + region_type = H5Sget_select_type(region_space); + if (region_type == H5S_SEL_POINTS) + ret_value = + render_bin_output_region_points(stream, region_space, region_id, container); + else if (region_type == H5S_SEL_HYPERSLABS) + ret_value = + render_bin_output_region_blocks(stream, region_space, region_id, container); - if ((region_space = H5Rget_region(container, H5R_DATASET_REGION, mem)) < 0) { - H5Dclose(region_id); - continue; - } - - if ((region_type = H5Sget_select_type(region_space)) < 0) { H5Sclose(region_space); - H5Dclose(region_id); - continue; - } - - if (region_type == H5S_SEL_POINTS) - ret_value = - render_bin_output_region_points(stream, region_space, region_id, container); - else - ret_value = - render_bin_output_region_blocks(stream, region_space, region_id, container); - - H5Sclose(region_space); + } /* end if (region_space >= 0) */ H5Dclose(region_id); if (ret_value < 0) @@ -2756,7 +2646,7 @@ h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order) H5_LIBRARY_ERROR(ENVONLY); if (binary_order == 99) { - if (h5tools_dump_simple_data(ENVONLY, stream, dset, p_type, sm_buf, hs_nelmts) < 0) + if (h5str_dump_simple_data(ENVONLY, stream, dset, p_type, sm_buf, hs_nelmts) < 0) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); } else { @@ -2827,7 +2717,7 @@ H5Tdetect_variable_str(hid_t tid) } /* end H5Tdetect_variable_str */ static int -h5tools_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, void *_mem, hsize_t nelmts) +h5str_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, void *_mem, hsize_t nelmts) { unsigned char *mem = (unsigned char *)_mem; h5str_t buffer; /* string into which to render */ @@ -2847,38 +2737,38 @@ h5tools_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, h5str_new(&buffer, 32 * size); if (!buffer.s) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5tools_dump_simple_data: failed to allocate buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_simple_data: failed to allocate buffer"); - if (!(bytes_in = h5str_sprintf(ENVONLY, &buffer, container, type, memref, 0, 1))) + if (!(bytes_in = h5str_sprintf(ENVONLY, &buffer, container, type, memref, 1))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - if (i > 0) { + if ((i > 0) && (bytes_in > 0)) { if (HDfprintf(stream, ", ") < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: HDfprintf failure"); + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: HDfprintf failure"); if (line_count >= H5TOOLS_TEXT_BLOCK) { line_count = 0; if (HDfprintf(stream, "\n") < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: HDfprintf failure"); + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: HDfprintf failure"); } } if (HDfprintf(stream, "%s", buffer.s) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: HDfprintf failure"); + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: HDfprintf failure"); h5str_free(&buffer); } /* end for (i = 0; i < nelmts... */ if (HDfprintf(stream, "\n") < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: HDfprintf failure"); + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_data: HDfprintf failure"); done: if (buffer.s) h5str_free(&buffer); return ret_value; -} /* end h5tools_dump_simple_data */ +} /* end h5str_dump_simple_data */ /* * Utility Java APIs @@ -2932,7 +2822,7 @@ Java_hdf_hdf5lib_H5_H5AreadComplex(JNIEnv *env, jclass clss, jlong attr_id, jlon for (i = 0; i < (size_t)n; i++) { h5str.s[0] = '\0'; - if (!h5str_sprintf(ENVONLY, &h5str, attr_id, mem_type_id, readBuf + (i * size), 0, 0)) + if (!h5str_sprintf(ENVONLY, &h5str, attr_id, mem_type_id, readBuf + (i * size), 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s))) @@ -3476,7 +3366,7 @@ Java_hdf_hdf5lib_H5_H5export_1dataset(JNIEnv *env, jclass clss, jstring file_exp H5_JNI_FATAL_ERROR(ENVONLY, "HDfopen failed"); if ((ret_val = h5str_dump_simple_dset(ENVONLY, stream, dataset_id, binary_order)) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_dset failed"); + H5_ASSERTION_ERROR(ENVONLY, "h5str_dump_simple_dset failed"); if (stream) { HDfclose(stream); diff --git a/java/src/jni/h5util.h b/java/src/jni/h5util.h index 6bee223..19415b4 100644 --- a/java/src/jni/h5util.h +++ b/java/src/jni/h5util.h @@ -42,11 +42,9 @@ extern char * h5str_append(h5str_t *str, const char *cstr); extern size_t h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_buf, size_t out_buf_offset); extern size_t h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *in_buf, - size_t in_buf_len, int expand_data); + int expand_data); extern void h5str_array_free(char **strs, size_t len); extern int h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order); -extern int h5str_dump_region_blocks_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj); -extern int h5str_dump_region_points_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj); extern htri_t H5Tdetect_variable_str(hid_t tid); diff --git a/java/src/jni/h5zImp.h b/java/src/jni/h5zImp.h index 4e8982e..3092ae6 100644 --- a/java/src/jni/h5zImp.h +++ b/java/src/jni/h5zImp.h @@ -13,8 +13,8 @@ #include <jni.h> /* Header for class hdf_hdf5lib_H5_H5Z */ -#ifndef _Included_hdf_hdf5lib_H5_H5Z -#define _Included_hdf_hdf5lib_H5_H5Z +#ifndef Included_hdf_hdf5lib_H5_H5Z +#define Included_hdf_hdf5lib_H5_H5Z #ifdef __cplusplus extern "C" { @@ -46,4 +46,4 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Zget_1filter_1info(JNIEnv *, jclass } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_H5_H5Z */ +#endif /* Included_hdf_hdf5lib_H5_H5Z */ diff --git a/java/src/jni/nativeData.h b/java/src/jni/nativeData.h index 0150c75..9bf313f 100644 --- a/java/src/jni/nativeData.h +++ b/java/src/jni/nativeData.h @@ -13,8 +13,8 @@ #include <jni.h> /* Header for class hdf_hdf5lib_HDFNativeData */ -#ifndef _Included_hdf_hdf5lib_HDFNativeData -#define _Included_hdf_hdf5lib_HDFNativeData +#ifndef Included_hdf_hdf5lib_HDFNativeData +#define Included_hdf_hdf5lib_HDFNativeData #ifdef __cplusplus extern "C" { @@ -97,4 +97,4 @@ JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToByte__B(JNIEnv } /* end extern "C" */ #endif /* __cplusplus */ -#endif /* _Included_hdf_hdf5lib_HDFNativeData */ +#endif /* Included_hdf_hdf5lib_HDFNativeData */ diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 6b22c36..4543ca4 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -256,7 +256,14 @@ Bug Fixes since HDF5-1.10.7 release =================================== Library ------- - - + - Remove underscores on header file guards + + Header file guards used a variety of underscores at the beginning the define. + + Removed all leading (some trailing) underscores from header file guards. + + (ADB - 2021/03/03, #361) + Java Library ------------ diff --git a/src/H5B2int.c b/src/H5B2int.c index ef90bbf..610da6c 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -138,15 +138,15 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx) { - const H5AC_class_t *child_class; /* Pointer to child node's class info */ - haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */ - void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */ - uint16_t * left_nrec, *right_nrec; /* Pointers to child # of records */ - uint8_t * left_native, *right_native; /* Pointers to childs' native records */ - H5B2_node_ptr_t * left_node_ptrs = NULL, - *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */ - uint16_t mid_record; /* Index of "middle" record in current node */ - uint16_t old_node_nrec; /* Number of records in internal node split */ + const H5AC_class_t *child_class; /* Pointer to child node's class info */ + haddr_t left_addr = HADDR_UNDEF, right_addr = HADDR_UNDEF; /* Addresses of left & right child nodes */ + void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */ + uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */ + uint8_t * left_native, *right_native; /* Pointers to childs' native records */ + H5B2_node_ptr_t *left_node_ptrs = NULL, + *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */ + uint16_t mid_record; /* Index of "middle" record in current node */ + uint16_t old_node_nrec; /* Number of records in internal node split */ unsigned left_child_flags = H5AC__NO_FLAGS_SET, right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */ herr_t ret_value = SUCCEED; /* Return value */ @@ -423,13 +423,13 @@ done: herr_t H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsigned idx) { - const H5AC_class_t *child_class; /* Pointer to child node's class info */ - haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */ - void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */ - uint16_t * left_nrec, *right_nrec; /* Pointers to child # of records */ - uint8_t * left_native, *right_native; /* Pointers to childs' native records */ - H5B2_node_ptr_t * left_node_ptrs = NULL, - *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */ + const H5AC_class_t *child_class; /* Pointer to child node's class info */ + haddr_t left_addr = HADDR_UNDEF, right_addr = HADDR_UNDEF; /* Addresses of left & right child nodes */ + void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */ + uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */ + uint8_t * left_native, *right_native; /* Pointers to childs' native records */ + H5B2_node_ptr_t *left_node_ptrs = NULL, + *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */ hssize_t left_moved_nrec = 0, right_moved_nrec = 0; /* Number of records moved, for internal redistrib */ unsigned left_child_flags = H5AC__NO_FLAGS_SET, right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */ @@ -696,20 +696,20 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsigned idx) { H5B2_node_ptr_t *left_node_ptrs = NULL, - *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */ - H5B2_node_ptr_t * middle_node_ptrs = NULL; /* Pointers to childs' node pointer info */ - const H5AC_class_t *child_class; /* Pointer to child node's class info */ - haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */ - haddr_t middle_addr; /* Address of middle child node */ - void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */ - void * middle_child = NULL; /* Pointers to middle child node */ - uint16_t * left_nrec, *right_nrec; /* Pointers to child # of records */ - uint16_t * middle_nrec; /* Pointers to middle child # of records */ - uint8_t * left_native, *right_native; /* Pointers to childs' native records */ - uint8_t * middle_native; /* Pointers to middle child's native records */ - hssize_t left_moved_nrec = 0, right_moved_nrec = 0; /* Number of records moved, for internal split */ - hssize_t middle_moved_nrec = 0; /* Number of records moved, for internal split */ - unsigned left_child_flags = H5AC__NO_FLAGS_SET, + *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */ + H5B2_node_ptr_t * middle_node_ptrs = NULL; /* Pointers to childs' node pointer info */ + const H5AC_class_t *child_class; /* Pointer to child node's class info */ + haddr_t left_addr = HADDR_UNDEF, right_addr = HADDR_UNDEF; /* Addresses of left & right child nodes */ + haddr_t middle_addr = HADDR_UNDEF; /* Address of middle child node */ + void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */ + void * middle_child = NULL; /* Pointers to middle child node */ + uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */ + uint16_t *middle_nrec; /* Pointers to middle child # of records */ + uint8_t * left_native, *right_native; /* Pointers to childs' native records */ + uint8_t * middle_native; /* Pointers to middle child's native records */ + hssize_t left_moved_nrec = 0, right_moved_nrec = 0; /* Number of records moved, for internal split */ + hssize_t middle_moved_nrec = 0; /* Number of records moved, for internal split */ + unsigned left_child_flags = H5AC__NO_FLAGS_SET, right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */ unsigned middle_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1122,16 +1122,16 @@ H5B2__merge2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx) { - const H5AC_class_t *child_class; /* Pointer to child node's class info */ - haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */ - void * left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */ - uint16_t * left_nrec, *right_nrec; /* Pointers to left & right child # of records */ - uint8_t * left_native, *right_native; /* Pointers to left & right children's native records */ - H5B2_node_ptr_t * left_node_ptrs = NULL, - *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */ - unsigned left_child_flags = H5AC__NO_FLAGS_SET, - right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */ - herr_t ret_value = SUCCEED; /* Return value */ + const H5AC_class_t *child_class; /* Pointer to child node's class info */ + haddr_t left_addr = HADDR_UNDEF, right_addr = HADDR_UNDEF; /* Addresses of left & right child nodes */ + void * left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */ + uint16_t *left_nrec, *right_nrec; /* Pointers to left & right child # of records */ + uint8_t * left_native, *right_native; /* Pointers to left & right children's native records */ + H5B2_node_ptr_t *left_node_ptrs = NULL, + *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */ + unsigned left_child_flags = H5AC__NO_FLAGS_SET, + right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -1297,19 +1297,19 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx) { - const H5AC_class_t *child_class; /* Pointer to child node's class info */ - haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */ - haddr_t middle_addr; /* Address of middle child node */ - void * left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */ - void * middle_child = NULL; /* Pointer to middle child node */ - uint16_t * left_nrec, *right_nrec; /* Pointers to left & right child # of records */ - uint16_t * middle_nrec; /* Pointer to middle child # of records */ - uint8_t * left_native, *right_native; /* Pointers to left & right children's native records */ - uint8_t * middle_native; /* Pointer to middle child's native records */ - H5B2_node_ptr_t * left_node_ptrs = NULL, - *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */ - H5B2_node_ptr_t *middle_node_ptrs = NULL; /* Pointer to child's node pointer info */ - hsize_t middle_moved_nrec; /* Number of records moved, for internal split */ + const H5AC_class_t *child_class; /* Pointer to child node's class info */ + haddr_t left_addr = HADDR_UNDEF, right_addr = HADDR_UNDEF; /* Addresses of left & right child nodes */ + haddr_t middle_addr = HADDR_UNDEF; /* Address of middle child node */ + void * left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */ + void * middle_child = NULL; /* Pointer to middle child node */ + uint16_t *left_nrec, *right_nrec; /* Pointers to left & right child # of records */ + uint16_t *middle_nrec; /* Pointer to middle child # of records */ + uint8_t * left_native, *right_native; /* Pointers to left & right children's native records */ + uint8_t * middle_native; /* Pointer to middle child's native records */ + H5B2_node_ptr_t *left_node_ptrs = NULL, + *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */ + H5B2_node_ptr_t *middle_node_ptrs = NULL; /* Pointer to child's node pointer info */ + hsize_t middle_moved_nrec; /* Number of records moved, for internal split */ unsigned left_child_flags = H5AC__NO_FLAGS_SET, right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */ unsigned middle_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */ @@ -1933,7 +1933,7 @@ H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, const H5B2_node_ptr_t /* If the node is in the cache, check for retargeting its parent */ if (node_status & H5AC_ES__IN_CACHE) { - void ** parent_ptr; /* Pointer to child node's parent */ + void ** parent_ptr = NULL; /* Pointer to child node's parent */ hbool_t update_deps = FALSE; /* Whether to update flush dependencies */ /* Get child node pointer */ diff --git a/src/H5B2leaf.c b/src/H5B2leaf.c index 199e011..20ace84 100644 --- a/src/H5B2leaf.c +++ b/src/H5B2leaf.c @@ -607,11 +607,11 @@ herr_t H5B2__swap_leaf(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx, void *swap_loc) { - const H5AC_class_t *child_class; /* Pointer to child node's class info */ - haddr_t child_addr; /* Address of child node */ - void * child = NULL; /* Pointer to child node */ - uint8_t * child_native; /* Pointer to child's native records */ - herr_t ret_value = SUCCEED; /* Return value */ + const H5AC_class_t *child_class; /* Pointer to child node's class info */ + haddr_t child_addr = HADDR_UNDEF; /* Address of child node */ + void * child = NULL; /* Pointer to child node */ + uint8_t * child_native; /* Pointer to child's native records */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -2140,7 +2140,7 @@ done: * Function: H5C_pin_protected_entry() * * Purpose: Pin a protected cache entry. The entry must be protected - * at the time of call, and must be unpinned. + * at the time of call, and must be unpinned. * * Return: Non-negative on success/Negative on failure * @@ -2226,8 +2226,8 @@ H5C_protect(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *udata, unsign #ifdef H5_HAVE_PARALLEL hbool_t coll_access = FALSE; /* whether access to the cache entry is done collectively */ #endif /* H5_HAVE_PARALLEL */ - hbool_t write_permitted; - hbool_t was_loaded = FALSE; /* Whether the entry was loaded as a result of the protect */ + hbool_t write_permitted = FALSE; + hbool_t was_loaded = FALSE; /* Whether the entry was loaded as a result of the protect */ size_t empty_space; void * thing; H5C_cache_entry_t *entry_ptr; diff --git a/src/H5Clog_json.c b/src/H5Clog_json.c index 6d048f1..731d741 100644 --- a/src/H5Clog_json.c +++ b/src/H5Clog_json.c @@ -173,7 +173,7 @@ H5C__json_write_log_message(H5C_log_json_udata_t *json_udata) /* Write the log message and flush */ n_chars = HDstrlen(json_udata->message); - if ((int)n_chars != HDfprintf(json_udata->outfile, json_udata->message)) + if ((int)n_chars != HDfprintf(json_udata->outfile, "%s", json_udata->message)) HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message") HDmemset((void *)(json_udata->message), 0, (size_t)(n_chars * sizeof(char))); diff --git a/src/H5Clog_trace.c b/src/H5Clog_trace.c index 8c79d7b..c30f79e 100644 --- a/src/H5Clog_trace.c +++ b/src/H5Clog_trace.c @@ -168,7 +168,7 @@ H5C__trace_write_log_message(H5C_log_trace_udata_t *trace_udata) /* Write the log message and flush */ n_chars = HDstrlen(trace_udata->message); - if ((int)n_chars != HDfprintf(trace_udata->outfile, trace_udata->message)) + if ((int)n_chars != HDfprintf(trace_udata->outfile, "%s", trace_udata->message)) HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message") HDmemset((void *)(trace_udata->message), 0, (size_t)(n_chars * sizeof(char))); diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 24cbbc0..c9dad0b 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -3146,9 +3146,9 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled) herr_t H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udata) { - H5D_rdcc_ent_t * ent = NULL; /* Cache entry */ - H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk); - unsigned idx; /* Index of chunk in cache, if present */ + H5D_rdcc_ent_t * ent = NULL; /* Cache entry */ + H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk); + unsigned idx = 0; /* Index of chunk in cache, if present */ hbool_t found = FALSE; /* In cache? */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index c824edf..4519dd7 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -394,8 +394,8 @@ done: * Purpose: Store virtual dataset layout information, for new dataset * * Note: We assume here that the contents of the heap block cannot - * change! If this ever stops being the case we must change - * this code to allow overwrites of the heap block. -NAF + * change! If this ever stops being the case we must change + * this code to allow overwrites of the heap block. -NAF * * Return: Success: SUCCEED * Failure: FAIL @@ -2298,7 +2298,7 @@ done: hbool_t H5D__virtual_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage) { - hbool_t ret_value; /* Return value */ + hbool_t ret_value = FALSE; /* Return value */ FUNC_ENTER_PACKAGE_NOERR @@ -2382,7 +2382,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, cons hssize_t select_nelmts; /* Number of elements in selection */ hsize_t bounds_start[H5S_MAX_RANK]; /* Selection bounds start */ hsize_t bounds_end[H5S_MAX_RANK]; /* Selection bounds end */ - int rank; + int rank = 0; hbool_t bounds_init = FALSE; /* Whether bounds_start, bounds_end, and rank are valid */ size_t i, j, k; /* Local index variables */ herr_t ret_value = SUCCEED; /* Return value */ @@ -722,7 +722,8 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_get(const H5EA_t *ea, hsize_t /* Local variables */ H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */ void *thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */ - H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */ + H5EA__unprotect_func_t thing_unprot_func = + NULL; /* Function pointer for unprotecting the array metadata */ /* * Check arguments. diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 07bd794..4032d3b 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -484,8 +484,8 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) #ifdef H5_HAVE_WIN32_API struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif - H5_timer_t open_timer; /* Timer for open() call */ - H5_timer_t stat_timer; /* Timer for stat() call */ + H5_timer_t open_timer = {{0}, {0}, {0}, FALSE}; /* Timer for open() call */ + H5_timer_t stat_timer = {{0}, {0}, {0}, FALSE}; /* Timer for stat() call */ h5_stat_t sb; H5FD_t * ret_value = NULL; /* Return value */ @@ -677,9 +677,9 @@ done: static herr_t H5FD__log_close(H5FD_t *_file) { - H5FD_log_t *file = (H5FD_log_t *)_file; - H5_timer_t close_timer; /* Timer for close() call */ - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_log_t *file = (H5FD_log_t *)_file; + H5_timer_t close_timer = {{0}, {0}, {0}, FALSE}; /* Timer for close() call */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1166,11 +1166,11 @@ static herr_t H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, void *buf /*out*/) { - H5FD_log_t * file = (H5FD_log_t *)_file; - size_t orig_size = size; /* Save the original size for later */ - haddr_t orig_addr = addr; - H5_timer_t read_timer; /* Timer for read operation */ - H5_timevals_t read_times; /* Elapsed time for read operation */ + H5FD_log_t * file = (H5FD_log_t *)_file; + size_t orig_size = size; /* Save the original size for later */ + haddr_t orig_addr = addr; + H5_timer_t read_timer = {{0}, {0}, {0}, FALSE}; /* Timer for read operation */ + H5_timevals_t read_times; /* Elapsed time for read operation */ #ifndef H5_HAVE_PREADWRITE H5_timer_t seek_timer; /* Timer for seek operation */ H5_timevals_t seek_times; /* Elapsed time for seek operation */ @@ -1380,11 +1380,11 @@ static herr_t H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, const void *buf) { - H5FD_log_t * file = (H5FD_log_t *)_file; - size_t orig_size = size; /* Save the original size for later */ - haddr_t orig_addr = addr; - H5_timer_t write_timer; /* Timer for write operation */ - H5_timevals_t write_times; /* Elapsed time for write operation */ + H5FD_log_t * file = (H5FD_log_t *)_file; + size_t orig_size = size; /* Save the original size for later */ + haddr_t orig_addr = addr; + H5_timer_t write_timer = {{0}, {0}, {0}, FALSE}; /* Timer for write operation */ + H5_timevals_t write_times; /* Elapsed time for write operation */ #ifndef H5_HAVE_PREADWRITE H5_timer_t seek_timer; /* Timer for seek operation */ H5_timevals_t seek_times; /* Elapsed time for seek operation */ @@ -1604,8 +1604,8 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_ /* Extend the file to make sure it's large enough */ if (!H5F_addr_eq(file->eoa, file->eof)) { - H5_timer_t trunc_timer; /* Timer for truncate operation */ - H5_timevals_t trunc_times; /* Elapsed time for truncate operation */ + H5_timer_t trunc_timer = {{0}, {0}, {0}, FALSE}; /* Timer for truncate operation */ + H5_timevals_t trunc_times; /* Elapsed time for truncate operation */ /* Start timer for truncate operation */ if (file->fa.flags & H5FD_LOG_TIME_TRUNCATE) { diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index c96b595..68440d0 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -1822,8 +1822,8 @@ H5FD_multi_lock(H5FD_t *_file, hbool_t rw) { H5FD_multi_t * file = (H5FD_multi_t *)_file; int nerrors = 0; - H5FD_mem_t out_mt; - static const char *func = "H5FD_multi_unlock"; /* Function Name for error reporting */ + H5FD_mem_t out_mt = H5FD_MEM_DEFAULT; + static const char *func = "H5FD_multi_unlock"; /* Function Name for error reporting */ /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -2002,7 +2002,7 @@ open_members(H5FD_multi_t *file) } H5_GCC_DIAG_ON("format-nonliteral") -#ifdef _H5private_H +#ifdef H5private_H /* * This is not related to the functionality of the driver code. * It is added here to trigger warning if HDF5 private definitions are included diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index 1f23a68..4b39365 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -1964,7 +1964,7 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha buffer[buffer_i] = 0; /* collect a line from file */ - line_buffer = fgets(line_buffer, 128, file); + line_buffer = HDfgets(line_buffer, 128, file); if (line_buffer == NULL) goto done; /* end of file */ @@ -2063,9 +2063,9 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char * #endif #ifdef H5_HAVE_WIN32_API - ret = HDsnprintf(awspath, 117, "%s/.aws/", getenv("USERPROFILE")); + ret = HDsnprintf(awspath, 117, "%s/.aws/", HDgetenv("USERPROFILE")); #else - ret = HDsnprintf(awspath, 117, "%s/.aws/", getenv("HOME")); + ret = HDsnprintf(awspath, 117, "%s/.aws/", HDgetenv("HOME")); #endif if (ret < 0 || (size_t)ret >= 117) HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format home-aws path") diff --git a/src/H5FDsplitter.c b/src/H5FDsplitter.c index f093262..84edc13 100644 --- a/src/H5FDsplitter.c +++ b/src/H5FDsplitter.c @@ -210,7 +210,7 @@ H5FD_splitter_init(void) { hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) H5FD_SPLITTER_LOG_CALL(FUNC); diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index efc1802..b395127 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -1201,7 +1201,7 @@ H5FD_stdio_unlock(H5FD_t *_file) return 0; } /* end H5FD_stdio_unlock() */ -#ifdef _H5private_H +#ifdef H5private_H /* * This is not related to the functionality of the driver code. * It is added here to trigger warning if HDF5 private definitions are included diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 2af0baa..f18f0f9 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -1115,8 +1115,8 @@ H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) /* Loop until no more merging */ if (fspace->sinfo->merge_list) { do { - H5SL_node_t * less_sect_node; /* Skip list node for section less than new section */ - H5SL_node_t * greater_sect_node; /* Skip list node for section greater than new section */ + H5SL_node_t *less_sect_node; /* Skip list node for section less than new section */ + H5SL_node_t *greater_sect_node = NULL; /* Skip list node for section greater than new section */ H5FS_section_info_t * tmp_sect; /* Temporary free space section */ H5FS_section_class_t *tmp_sect_cls; /* Temporary section's class */ hbool_t greater_sect_node_valid = FALSE; /* Indicate if 'greater than' section node is valid */ diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index f7fde6f..60fff22 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -684,10 +684,10 @@ herr_t H5HF_iblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, haddr_t hdr_addr, unsigned nrows) { - H5HF_hdr_t * hdr = NULL; /* Fractal heap header info */ - H5HF_indirect_t *iblock = NULL; /* Fractal heap direct block info */ - hbool_t did_protect; /* Whether we protected the indirect block or not */ - herr_t ret_value = SUCCEED; /* Return value */ + H5HF_hdr_t * hdr = NULL; /* Fractal heap header info */ + H5HF_indirect_t *iblock = NULL; /* Fractal heap direct block info */ + hbool_t did_protect = FALSE; /* Whether we protected the indirect block or not */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5HFman.c b/src/H5HFman.c index f978d7c..d26c145 100644 --- a/src/H5HFman.c +++ b/src/H5HFman.c @@ -297,9 +297,9 @@ H5HF__man_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void * * H5AC__NO_FLAGS_SET or * H5AC__READ_ONLY_FLAG */ - haddr_t dblock_addr; /* Direct block address */ + haddr_t dblock_addr = HADDR_UNDEF; /* Direct block address */ size_t dblock_size; /* Direct block size */ - unsigned dblock_cache_flags; /* Flags for unprotecting direct block */ + unsigned dblock_cache_flags = 0; /* Flags for unprotecting direct block */ hsize_t obj_off; /* Object's offset in heap */ size_t obj_len; /* Object's length in heap */ size_t blk_off; /* Offset of object in block */ @@ -545,9 +545,9 @@ done: herr_t H5HF__man_remove(H5HF_hdr_t *hdr, const uint8_t *id) { - H5HF_free_section_t *sec_node = NULL; /* Pointer to free space section for block */ - H5HF_indirect_t * iblock = NULL; /* Pointer to indirect block */ - hbool_t did_protect; /* Whether we protected the indirect block or not */ + H5HF_free_section_t *sec_node = NULL; /* Pointer to free space section for block */ + H5HF_indirect_t * iblock = NULL; /* Pointer to indirect block */ + hbool_t did_protect = FALSE; /* Whether we protected the indirect block or not */ hsize_t obj_off; /* Object's offset in heap */ size_t obj_len; /* Object's length in heap */ size_t dblock_size; /* Direct block size */ diff --git a/src/H5HFsection.c b/src/H5HFsection.c index c33f09f..ffd3a18 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -2474,7 +2474,7 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, hbool_ /* Add an indirect section for each indirect block in the row */ for (v = 0; v < row_entries; v++) { - hbool_t did_protect; /* Whether we protected the indirect block or not */ + hbool_t did_protect = FALSE; /* Whether we protected the indirect block or not */ /* Try to get the child section's indirect block, if it's available */ if (sect->sect_info.state == H5FS_SECT_LIVE) { @@ -930,7 +930,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_get_size(H5F_t *f, haddr_t add H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ H5HL_prfx_t * prfx = NULL; /* Local heap prefix */ - H5HL_t * heap; /* Heap data structure */ + H5HL_t * heap = NULL; /* Heap data structure */ /* check arguments */ HDassert(f); @@ -977,7 +977,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_heapsize(H5F_t *f, haddr_t add H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ H5HL_prfx_t * prfx = NULL; /* Local heap prefix */ - H5HL_t * heap; /* Heap data structure */ + H5HL_t * heap = NULL; /* Heap data structure */ /* check arguments */ HDassert(f); @@ -26,20 +26,20 @@ /* Module Setup */ /****************/ -#define H5F_FRIEND /*suppress error about including H5Fpkg */ -#define H5FS_FRIEND /*suppress error about including H5Fpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#define H5FS_FRIEND /*suppress error about including H5Fpkg */ #include "H5MFmodule.h" /* This source code file is part of the H5MF module */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ #include "H5FSpkg.h" /* File free space */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MFpkg.h" /* File memory management */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MFpkg.h" /* File memory management */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ /* Local Macros */ @@ -122,7 +122,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE; * Purpose: Initialize the free space section+aggregator merge flags * for the file. * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Friday, February 1, 2008 @@ -274,17 +274,17 @@ H5MF__alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_pa } /* end H5MF__alloc_to_fs_type() */ /*------------------------------------------------------------------------- - * Function: H5MF__open_fstype + * Function: H5MF__open_fstype * - * Purpose: Open an existing free space manager of TYPE for file by + * Purpose: Open an existing free space manager of TYPE for file by * creating a free-space structure. * Note that TYPE can be H5F_mem_page_t or H5FD_mem_t enum types. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol - * Jan 8 2008 + * Programmer: Quincey Koziol + * Jan 8 2008 * *------------------------------------------------------------------------- */ @@ -351,17 +351,17 @@ done: } /* end H5MF__open_fstype() */ /*------------------------------------------------------------------------- - * Function: H5MF__create_fstype + * Function: H5MF__create_fstype * - * Purpose: Create free space manager of TYPE for the file by creating + * Purpose: Create free space manager of TYPE for the file by creating * a free-space structure * Note that TYPE can be H5F_mem_page_t or H5FD_mem_t enum types. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol - * Jan 8 2008 + * Programmer: Quincey Koziol + * Jan 8 2008 * *------------------------------------------------------------------------- */ @@ -435,16 +435,16 @@ done: } /* end H5MF__create_fstype() */ /*------------------------------------------------------------------------- - * Function: H5MF__start_fstype + * Function: H5MF__start_fstype * - * Purpose: Open or create a free space manager of a given TYPE. + * Purpose: Open or create a free space manager of a given TYPE. * Note that TYPE can be H5F_mem_page_t or H5FD_mem_t enum types. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol - * Jan 8 2008 + * Programmer: Quincey Koziol + * Jan 8 2008 * *------------------------------------------------------------------------- */ @@ -492,7 +492,7 @@ done: * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; April 2013 + * Programmer: Vailin Choi; April 2013 * *------------------------------------------------------------------------- */ @@ -603,7 +603,7 @@ done: /*------------------------------------------------------------------------- * Function: H5MF__add_sect * - * Purpose: To add a section to the specified free-space manager. + * Purpose: To add a section to the specified free-space manager. * * Return: Success: non-negative * Failure: negative @@ -661,11 +661,11 @@ done: /*------------------------------------------------------------------------- * Function: H5MF__find_sect * - * Purpose: To find a section from the specified free-space manager to fulfill the request. - * If found, re-add the left-over space back to the manager. + * Purpose: To find a section from the specified free-space manager to fulfill the request. + * If found, re-add the left-over space back to the manager. * - * Return: TRUE if a section is found to fulfill the request - * FALSE if not + * Return: TRUE if a section is found to fulfill the request + * FALSE if not * * Programmer: Vailin Choi; April 2013 * @@ -745,9 +745,9 @@ done: * Function: H5MF_alloc * * Purpose: Allocate SIZE bytes of file memory and return the relative - * address where that contiguous chunk of file memory exists. - * The TYPE argument describes the purpose for which the storage - * is being requested. + * address where that contiguous chunk of file memory exists. + * The TYPE argument describes the purpose for which the storage + * is being requested. * * Return: Success: The file address of new chunk. * Failure: HADDR_UNDEF @@ -1002,15 +1002,15 @@ done: * * Purpose: Allocate temporary space in the file * - * Note: The address returned is non-overlapping with any other address - * in the file and suitable for insertion into the metadata - * cache. + * Note: The address returned is non-overlapping with any other address + * in the file and suitable for insertion into the metadata + * cache. * - * The address is _not_ suitable for actual file I/O and will - * cause an error if it is so used. + * The address is _not_ suitable for actual file I/O and will + * cause an error if it is so used. * - * The space allocated with this routine should _not_ be freed, - * it should just be abandoned. Calling H5MF_xfree() with space + * The space allocated with this routine should _not_ be freed, + * it should just be abandoned. Calling H5MF_xfree() with space * from this routine will cause an error. * * Return: Success: Temporary file address @@ -1244,9 +1244,9 @@ done: } /* end H5MF_xfree() */ /*------------------------------------------------------------------------- - * Function: H5MF_try_extend + * Function: H5MF_try_extend * - * Purpose: Extend a block in the file if possible. + * Purpose: Extend a block in the file if possible. * For non-paged aggregation: * --try to extend at EOA * --try to extend into the aggregators @@ -1256,11 +1256,11 @@ done: * --try to extend into a free-space section if adjoined * --try to extend into the page end threshold if a metadata block * - * Return: Success: TRUE(1) - Block was extended + * Return: Success: TRUE(1) - Block was extended * FALSE(0) - Block could not be extended - * Failure: FAIL + * Failure: FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, June 11, 2004 * *------------------------------------------------------------------------- @@ -1528,7 +1528,7 @@ done: * Purpose: Close the free space tracker(s) for a file: * paged or non-paged aggregation * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * * Programmer: Vailin Choi; Dec 2012 * @@ -1571,9 +1571,9 @@ done: * of TYPE for file. * Note that TYPE can be H5F_mem_page_t or H5FD_mem_t enum types. * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Jan 2016 * *------------------------------------------------------------------------- @@ -1630,9 +1630,9 @@ done: * free-space managers when downgrading persistent free-space * to non-persistent. * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Jan 2016 * *------------------------------------------------------------------------- @@ -2087,7 +2087,7 @@ done: * * Purpose: Shrink the EOA while closing * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Saturday, July 7, 2012 @@ -2338,7 +2338,7 @@ done: /*------------------------------------------------------------------------- * Function: H5MF_get_free_sections() * - * Purpose: To retrieve free-space section information for + * Purpose: To retrieve free-space section information for * paged or non-paged aggregation * * Return: Success: Number of free sections @@ -2468,10 +2468,10 @@ done: /*------------------------------------------------------------------------- * Function: H5MF__sects_cb() * - * Purpose: Iterator callback for each free-space section + * Purpose: Iterator callback for each free-space section * Retrieve address and size into user data * - * Return: Always succeed + * Return: Always succeed * * Programmer: Vailin Choi * July 1st, 2009 @@ -2498,7 +2498,7 @@ H5MF__sects_cb(H5FS_section_info_t *_sect, void *_udata) /*------------------------------------------------------------------------- * Function: H5MF__get_free_sects * - * Purpose: Retrieve section information for the specified free-space manager. + * Purpose: Retrieve section information for the specified free-space manager. * * Return: Success: non-negative * Failure: negative @@ -2539,10 +2539,10 @@ done: /*------------------------------------------------------------------------- * Function: H5MF_settle_raw_data_fsm() * - * Purpose: Handle any tasks required before the metadata cache - * can serialize or flush the raw data free space manager - * and any metadata free space managers that reside in the - * raw data free space manager ring. + * Purpose: Handle any tasks required before the metadata cache + * can serialize or flush the raw data free space manager + * and any metadata free space managers that reside in the + * raw data free space manager ring. * * Specifically, this means any metadata managers that DON'T * handle space allocation for free space manager header or @@ -2550,25 +2550,25 @@ done: * ring. * * In the absence of page allocation, there is at most one - * free space manager per memory type defined in H5F_mem_t. - * Of these, the one that allocates H5FD_MEM_DRAW will - * always reside in the raw data free space manager ring. - * If there is more than one metadata free space manager, - * all that don't handle H5FD_MEM_FSPACE_HDR or + * free space manager per memory type defined in H5F_mem_t. + * Of these, the one that allocates H5FD_MEM_DRAW will + * always reside in the raw data free space manager ring. + * If there is more than one metadata free space manager, + * all that don't handle H5FD_MEM_FSPACE_HDR or * H5FD_MEM_FSPACE_SINFO (which map to H5FD_MEM_OHDR and * H5FD_MEM_LHEAP respectively) will reside in the raw - * data free space manager ring as well + * data free space manager ring as well * - * With page allocation, the situation is conceptually - * identical, but more complex in practice. + * With page allocation, the situation is conceptually + * identical, but more complex in practice. * * In the worst case (multi file driver) page allocation - * can result in two free space managers for each memory - * type -- one for small (less than on equal to one page) + * can result in two free space managers for each memory + * type -- one for small (less than on equal to one page) * allocations, and one for large (greater than one page) * allocations. * - * In the more common one file case, page allocation will + * In the more common one file case, page allocation will * result in a total of three free space managers -- one for * small (<= one page) raw data allocations, one for small * metadata allocations (i.e, all memory types other than @@ -2576,64 +2576,64 @@ done: * allocations. * * Despite these complications, the solution is the same in - * the page allocation case -- free space managers (be they + * the page allocation case -- free space managers (be they * small data or large) are assigned to the raw data free * space manager ring if they don't allocate file space for * free space managers. Note that in the one file case, the - * large free space manager must be assigned to the metadata - * free space manager ring, as it both allocates pages for - * the metadata free space manager, and allocates space for - * large (> 1 page) metadata cache entries. + * large free space manager must be assigned to the metadata + * free space manager ring, as it both allocates pages for + * the metadata free space manager, and allocates space for + * large (> 1 page) metadata cache entries. * * At present, the task list for this routine is: * - * 1) Reduce the EOA to the extent possible. To do this: + * 1) Reduce the EOA to the extent possible. To do this: * - * a) Free both aggregators. Space not at EOA will be - * added to the appropriate free space manager. + * a) Free both aggregators. Space not at EOA will be + * added to the appropriate free space manager. * - * The raw data aggregator should not be restarted - * after this point. It is possible that the metadata - * aggregator will be. + * The raw data aggregator should not be restarted + * after this point. It is possible that the metadata + * aggregator will be. * - * b) Free all file space currently allocated to free - * space managers. + * b) Free all file space currently allocated to free + * space managers. * - * c) Delete the free space manager superblock - * extension message if allocated. + * c) Delete the free space manager superblock + * extension message if allocated. * - * This done, reduce the EOA by moving it to just before - * the last piece of free memory in the file. + * This done, reduce the EOA by moving it to just before + * the last piece of free memory in the file. * - * 2) Ensure that space is allocated for the free space + * 2) Ensure that space is allocated for the free space * manager superblock extension message. Must do this * now, before reallocating file space for free space - * managers, as it is possible that this allocation may - * grab the last section in a FSM -- making it unnecessary - * to re-allocate file space for it. - * - * 3) Scan all free space managers not involved in allocating - * space for free space managers. For each such free space - * manager, test to see if it contains free space. If - * it does, allocate file space for its header and section - * data. If it contains no free space, leave it without - * allocated file space as there is no need to save it to - * file. - * - * Note that all free space managers in this class should - * see no further space allocations / deallocations as - * at this point, all raw data allocations should be - * finalized, as should all metadata allocations not - * involving free space managers. - * - * We will allocate space for free space managers involved - * in the allocation of file space for free space managers - * in H5MF_settle_meta_data_fsm() - * - * Return: SUCCEED/FAIL + * managers, as it is possible that this allocation may + * grab the last section in a FSM -- making it unnecessary + * to re-allocate file space for it. + * + * 3) Scan all free space managers not involved in allocating + * space for free space managers. For each such free space + * manager, test to see if it contains free space. If + * it does, allocate file space for its header and section + * data. If it contains no free space, leave it without + * allocated file space as there is no need to save it to + * file. + * + * Note that all free space managers in this class should + * see no further space allocations / deallocations as + * at this point, all raw data allocations should be + * finalized, as should all metadata allocations not + * involving free space managers. + * + * We will allocate space for free space managers involved + * in the allocation of file space for free space managers + * in H5MF_settle_meta_data_fsm() + * + * Return: SUCCEED/FAIL * * Programmer: John Mainzer - * 5/25/16 + * 5/25/16 * *------------------------------------------------------------------------- */ @@ -3012,122 +3012,122 @@ done: /*------------------------------------------------------------------------- * Function: H5MF_settle_meta_data_fsm() * - * Purpose: If the free space manager is persistent, handle any tasks - * required before the metadata cache can serialize or flush - * the metadata free space manager(s) that handle file space - * allocation for free space managers. + * Purpose: If the free space manager is persistent, handle any tasks + * required before the metadata cache can serialize or flush + * the metadata free space manager(s) that handle file space + * allocation for free space managers. * - * In most cases, there will be only one manager assigned - * to this role. However, since for reasons unknown, - * free space manager headers and section info blocks are - * different classes of memory, it is possible that two free - * space managers will be involved. + * In most cases, there will be only one manager assigned + * to this role. However, since for reasons unknown, + * free space manager headers and section info blocks are + * different classes of memory, it is possible that two free + * space managers will be involved. * - * On entry to this function, the raw data settle routine - * (H5MF_settle_raw_data_fsm()) should have: + * On entry to this function, the raw data settle routine + * (H5MF_settle_raw_data_fsm()) should have: * - * 1) Freed the aggregators. + * 1) Freed the aggregators. * - * 2) Freed all file space allocated to the free space managers. + * 2) Freed all file space allocated to the free space managers. * - * 3) Deleted the free space manager superblock extension message + * 3) Deleted the free space manager superblock extension message * - * 4) Reduced the EOA to the extent possible. + * 4) Reduced the EOA to the extent possible. * - * 5) Re-created the free space manager superblock extension - * message. + * 5) Re-created the free space manager superblock extension + * message. * - * 6) Reallocated file space for all non-empty free space - * managers NOT involved in allocation of space for free - * space managers. + * 6) Reallocated file space for all non-empty free space + * managers NOT involved in allocation of space for free + * space managers. * - * Note that these free space managers (if not empty) should - * have been written to file by this point, and that no - * further space allocations involving them should take - * place during file close. + * Note that these free space managers (if not empty) should + * have been written to file by this point, and that no + * further space allocations involving them should take + * place during file close. * - * On entry to this routine, the free space manager(s) involved - * in allocation of file space for free space managers should - * still be floating. (i.e. should not have any file space - * allocated to them.) + * On entry to this routine, the free space manager(s) involved + * in allocation of file space for free space managers should + * still be floating. (i.e. should not have any file space + * allocated to them.) * - * Similarly, the raw data aggregator should not have been - * restarted. Note that it is probable that reallocation of - * space in 5) and 6) above will have re-started the metadata - * aggregator. + * Similarly, the raw data aggregator should not have been + * restarted. Note that it is probable that reallocation of + * space in 5) and 6) above will have re-started the metadata + * aggregator. * * - * In this routine, we proceed as follows: + * In this routine, we proceed as follows: * - * 1) Verify that the free space manager(s) involved in file - * space allocation for free space managers are still floating. + * 1) Verify that the free space manager(s) involved in file + * space allocation for free space managers are still floating. * - * 2) Free the aggregators. + * 2) Free the aggregators. * - * 3) Reduce the EOA to the extent possible, and make note - * of the resulting value. This value will be stored - * in the fsinfo superblock extension message and be used - * in the subsequent file open. + * 3) Reduce the EOA to the extent possible, and make note + * of the resulting value. This value will be stored + * in the fsinfo superblock extension message and be used + * in the subsequent file open. * - * 4) Re-allocate space for any free space manager(s) that: + * 4) Re-allocate space for any free space manager(s) that: * - * a) are involved in allocation of space for free space - * managers, and + * a) are involved in allocation of space for free space + * managers, and * - * b) contain free space. + * b) contain free space. * - * It is possible that we could allocate space for one - * of these free space manager(s) only to have the allocation - * result in the free space manager being empty and thus - * obliging us to free the space again. Thus there is the - * potential for an infinite loop if we want to avoid saving - * empty free space managers. + * It is possible that we could allocate space for one + * of these free space manager(s) only to have the allocation + * result in the free space manager being empty and thus + * obliging us to free the space again. Thus there is the + * potential for an infinite loop if we want to avoid saving + * empty free space managers. * - * Similarly, it is possible that we could allocate space - * for a section info block, only to discover that this - * allocation has changed the size of the section info -- - * forcing us to deallocate and start the loop over again. + * Similarly, it is possible that we could allocate space + * for a section info block, only to discover that this + * allocation has changed the size of the section info -- + * forcing us to deallocate and start the loop over again. * - * To avoid this, simply allocate file space for these - * FSM(s) directly from the VFD layer if allocation is - * indicated. This avoids the issue by bypassing the FSMs - * in this case. + * To avoid this, simply allocate file space for these + * FSM(s) directly from the VFD layer if allocation is + * indicated. This avoids the issue by bypassing the FSMs + * in this case. * - * Note that this may increase the size of the file needlessly. - * A better solution would be to modify the FSM code to - * save empty FSMs to file, and to allow section info blocks - * to be oversized. However, given that the FSM code is - * also used by the fractal heaps, and that we are under - * severe time pressure at the moment, the above brute - * force solution is attractive. + * Note that this may increase the size of the file needlessly. + * A better solution would be to modify the FSM code to + * save empty FSMs to file, and to allow section info blocks + * to be oversized. However, given that the FSM code is + * also used by the fractal heaps, and that we are under + * severe time pressure at the moment, the above brute + * force solution is attractive. * - * 5) Make note of the EOA -- used for sanity checking on - * FSM shutdown. + * 5) Make note of the EOA -- used for sanity checking on + * FSM shutdown. * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * * Programmer: John Mainzer - * 5/25/16 + * 5/25/16 * *------------------------------------------------------------------------- */ herr_t H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) { - H5F_mem_page_t sm_fshdr_fs_type; /* small fs hdr fsm */ - H5F_mem_page_t sm_fssinfo_fs_type; /* small fs sinfo fsm */ - H5F_mem_page_t lg_fshdr_fs_type; /* large fs hdr fsm */ - H5F_mem_page_t lg_fssinfo_fs_type; /* large fs sinfo fsm */ - H5FS_t * sm_hdr_fspace = NULL; /* ptr to sm FSM hdr alloc FSM */ - H5FS_t * sm_sinfo_fspace = NULL; /* ptr to sm FSM sinfo alloc FSM */ - H5FS_t * lg_hdr_fspace = NULL; /* ptr to lg FSM hdr alloc FSM */ - H5FS_t * lg_sinfo_fspace = NULL; /* ptr to lg FSM sinfo alloc FSM */ - haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */ - /* for self referential FSMs */ - haddr_t eoa_post_fsm_fsalloc; /* eoa post file space allocation */ - /* for self referential FSMs */ - H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_mem_page_t sm_fshdr_fs_type; /* small fs hdr fsm */ + H5F_mem_page_t sm_fssinfo_fs_type; /* small fs sinfo fsm */ + H5F_mem_page_t lg_fshdr_fs_type = H5F_MEM_PAGE_DEFAULT; /* large fs hdr fsm */ + H5F_mem_page_t lg_fssinfo_fs_type = H5F_MEM_PAGE_DEFAULT; /* large fs sinfo fsm */ + H5FS_t * sm_hdr_fspace = NULL; /* ptr to sm FSM hdr alloc FSM */ + H5FS_t * sm_sinfo_fspace = NULL; /* ptr to sm FSM sinfo alloc FSM */ + H5FS_t * lg_hdr_fspace = NULL; /* ptr to lg FSM hdr alloc FSM */ + H5FS_t * lg_sinfo_fspace = NULL; /* ptr to lg FSM sinfo alloc FSM */ + haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */ + /* for self referential FSMs */ + haddr_t eoa_post_fsm_fsalloc; /* eoa post file space allocation */ + /* for self referential FSMs */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) @@ -3393,7 +3393,7 @@ done: * Function: H5MF__fsm_type_is_self_referential() * * Purpose: Return TRUE if the indicated free space manager allocates - * file space for free space managers. Return FALSE otherwise. + * file space for free space managers. Return FALSE otherwise. * * Return: TRUE/FALSE * @@ -3449,7 +3449,7 @@ H5MF__fsm_type_is_self_referential(H5F_t *f, H5F_mem_page_t fsm_type) * Function: H5MF__fsm_is_self_referential() * * Purpose: Return TRUE if the indicated free space manager allocates - * file space for free space managers. Return FALSE otherwise. + * file space for free space managers. Return FALSE otherwise. * * Return: TRUE/FALSE * @@ -3496,15 +3496,15 @@ H5MF__fsm_is_self_referential(H5F_t *f, H5FS_t *fspace) * Function: H5MF_tidy_self_referential_fsm_hack * * Purpose: As discussed in the comments of the settle routines above, - * the existence of self referential free space managers - * as currently implemented creates the possibility of - * infinite loops at file close. + * the existence of self referential free space managers + * as currently implemented creates the possibility of + * infinite loops at file close. * - * As a hack to avoid this, we have added code to settle - * self referential free space managers, and then allocate - * space for them directly from the file driver. + * As a hack to avoid this, we have added code to settle + * self referential free space managers, and then allocate + * space for them directly from the file driver. * - * To avoid dropping ever increasing amounts of file space + * To avoid dropping ever increasing amounts of file space * on the floor with each subsequent file close/open cycle, * we need to clean this up on file open. To avoid this, * this function is called on the first file space allocation @@ -3541,7 +3541,7 @@ H5MF__fsm_is_self_referential(H5F_t *f, H5FS_t *fspace) * and then set f->shared->eoa_pre_fsm_fsalloc to * HADDR_UNDEF. * - * If page buffering, verify that the new EOA is + * If page buffering, verify that the new EOA is * on a page boundary, and expunge any pages in the * page buffer after the new EOA. * diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index a93506a..f7da32a 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -2005,8 +2005,8 @@ H5O_merge_null(H5F_t *f, H5O_t *oh) for (v = 0, curr_msg2 = &oh->mesg[0]; v < oh->nmesgs; v++, curr_msg2++) { if (u != v && H5O_NULL_ID == curr_msg2->type->id && curr_msg->chunkno == curr_msg2->chunkno) { - ssize_t adj_raw; /* Amount to adjust raw message pointer */ - size_t adj_raw_size; /* Amount to adjust raw message size */ + ssize_t adj_raw = 0; /* Amount to adjust raw message pointer */ + size_t adj_raw_size = 0; /* Amount to adjust raw message size */ /* Check for second message after first message */ if ((curr_msg->raw + curr_msg->raw_size) == diff --git a/src/H5Obtreek.c b/src/H5Obtreek.c index c8e0365..4eee322 100644 --- a/src/H5Obtreek.c +++ b/src/H5Obtreek.c @@ -198,7 +198,7 @@ static size_t H5O_btreek_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) { - size_t ret_value; + size_t ret_value = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index a0b7763..3367231 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -29,21 +29,21 @@ typedef struct H5O_t H5O_t; typedef struct H5O_fill_t H5O_fill_t; /* Include the public header file for this API */ -#include "H5Opublic.h" /* Object header functions */ +#include "H5Opublic.h" /* Object header functions */ /* Public headers needed by this file */ -#include "H5Dpublic.h" /* Dataset functions */ -#include "H5Lpublic.h" /* Link functions */ +#include "H5Dpublic.h" /* Dataset functions */ +#include "H5Lpublic.h" /* Link functions */ #include "H5Spublic.h" /* Dataspace functions */ /* Private headers needed by this file */ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ #include "H5Fprivate.h" /* File access */ -#include "H5HGprivate.h" /* Global Heaps */ +#include "H5HGprivate.h" /* Global Heaps */ #include "H5SLprivate.h" /* Skip lists */ #include "H5Tprivate.h" /* Datatype functions */ -#include "H5Zprivate.h" /* I/O pipeline filters */ +#include "H5Zprivate.h" /* I/O pipeline filters */ /* Forward references of package typedefs */ typedef struct H5O_msg_class_t H5O_msg_class_t; diff --git a/src/H5Opublic.h b/src/H5Opublic.h index 249479b..b8cd940 100644 --- a/src/H5Opublic.h +++ b/src/H5Opublic.h @@ -95,7 +95,7 @@ /* Types of objects in file */ typedef enum H5O_type_t { H5O_TYPE_UNKNOWN = -1, /* Unknown object type */ - H5O_TYPE_GROUP, /* Object is a group */ + H5O_TYPE_GROUP, /* Object is a group */ H5O_TYPE_DATASET, /* Object is a dataset */ H5O_TYPE_NAMED_DATATYPE, /* Object is a named data type */ H5O_TYPE_NTYPES /* Number of different object types (must be last!) */ @@ -682,8 +682,8 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void * haddr_t offset; haddr_t search_addr; /* Address of current page */ hsize_t num_touched_pages; /* Number of pages accessed */ - size_t access_size; - hbool_t bypass_pb = FALSE; /* Whether to bypass page buffering */ + size_t access_size = 0; + hbool_t bypass_pb = FALSE; /* Whether to bypass page buffering */ hsize_t i; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -983,8 +983,8 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const haddr_t offset; haddr_t search_addr; /* Address of current page */ hsize_t num_touched_pages; /* Number of pages accessed */ - size_t access_size; - hbool_t bypass_pb = FALSE; /* Whether to bypass page buffering */ + size_t access_size = 0; + hbool_t bypass_pb = FALSE; /* Whether to bypass page buffering */ hsize_t i; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index 7333ddf..0ef1519 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -865,8 +865,8 @@ done: static herr_t H5P__encode_chunk_cache_nslots(const void *value, void **_pp, size_t *size) { - uint64_t enc_value; /* Property value to encode */ - uint8_t **pp = (uint8_t **)_pp; + uint64_t enc_value = 0; /* Property value to encode */ + uint8_t **pp = (uint8_t **)_pp; unsigned enc_size; /* Size of encoded property */ FUNC_ENTER_STATIC_NOERR @@ -965,8 +965,8 @@ H5P__decode_chunk_cache_nslots(const void **_pp, void *_value) static herr_t H5P__encode_chunk_cache_nbytes(const void *value, void **_pp, size_t *size) { - uint64_t enc_value; /* Property value to encode */ - uint8_t **pp = (uint8_t **)_pp; + uint64_t enc_value = 0; /* Property value to encode */ + uint8_t **pp = (uint8_t **)_pp; unsigned enc_size; /* Size of encoded property */ FUNC_ENTER_STATIC_NOERR diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 51a311c..e07d6e7 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -2215,7 +2215,7 @@ herr_t H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, const char *src_dset_name, hid_t src_space_id) { - H5P_genplist_t * plist; /* Property list pointer */ + H5P_genplist_t * plist = NULL; /* Property list pointer */ H5O_layout_t virtual_layout; /* Layout information for setting virtual info */ H5S_t * vspace; /* Virtual dataset space selection */ H5S_t * src_space; /* Source dataset space selection */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 7268647..1a69c10 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -4304,9 +4304,9 @@ herr_t H5Pget_mdc_log_options(hid_t plist_id, hbool_t *is_enabled, char *location, size_t *location_size, hbool_t *start_on_access) { - H5P_genplist_t *plist; /* Property list pointer */ - char * location_ptr; /* Pointer to location string */ - herr_t ret_value = SUCCEED; /* Return value */ + H5P_genplist_t *plist; /* Property list pointer */ + char * location_ptr = NULL; /* Pointer to location string */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "i*b*s*z*b", plist_id, is_enabled, location, location_size, start_on_access); @@ -746,10 +746,10 @@ done: static H5SL_node_t * H5SL_insert_common(H5SL_t *slist, void *item, const void *key) { - H5SL_node_t *x; /* Current node to examine */ - H5SL_node_t *prev; /* Node before the new node */ - uint32_t hashval = 0; /* Hash value for key */ - H5SL_node_t *ret_value; /* Return value */ + H5SL_node_t *x; /* Current node to examine */ + H5SL_node_t *prev; /* Node before the new node */ + uint32_t hashval = 0; /* Hash value for key */ + H5SL_node_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1378,9 +1378,9 @@ done: void * H5SL_search(H5SL_t *slist, const void *key) { - H5SL_node_t *x; /* Current node to examine */ - uint32_t hashval = 0; /* Hash value for key */ - void * ret_value; /* Return value */ + H5SL_node_t *x; /* Current node to examine */ + uint32_t hashval = 0; /* Hash value for key */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1676,9 +1676,9 @@ done: H5SL_node_t * H5SL_find(H5SL_t *slist, const void *key) { - H5SL_node_t *x; /* Current node to examine */ - uint32_t hashval = 0; /* Hash value for key */ - H5SL_node_t *ret_value; /* Return value */ + H5SL_node_t *x; /* Current node to examine */ + uint32_t hashval = 0; /* Hash value for key */ + H5SL_node_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 5450408..d9afff7 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -1102,10 +1102,10 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) } /* end if */ /* Must be an irregular hyperslab selection */ else { - H5S_hyper_span_t * curr_span; /* Current hyperslab span node */ - H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */ - hsize_t * abs_arr; /* Absolute hyperslab span position */ - int curr_dim; /* Temporary rank holder */ + H5S_hyper_span_t * curr_span = NULL; /* Current hyperslab span node */ + H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */ + hsize_t * abs_arr; /* Absolute hyperslab span position */ + int curr_dim; /* Temporary rank holder */ /* Set the rank of the fastest changing dimension */ ndims = iter->rank; @@ -1294,10 +1294,10 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter) } /* end if */ /* Must be an irregular hyperslab selection */ else { - H5S_hyper_span_t * curr_span; /* Current hyperslab span node */ - H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */ - hsize_t * abs_arr; /* Absolute hyperslab span position */ - int curr_dim; /* Temporary rank holder */ + H5S_hyper_span_t * curr_span = NULL; /* Current hyperslab span node */ + H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */ + hsize_t * abs_arr; /* Absolute hyperslab span position */ + int curr_dim; /* Temporary rank holder */ /* Set the rank of the fastest changing dimension */ ndims = iter->rank; diff --git a/src/H5system.c b/src/H5system.c index 9780428..38a6930 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -698,8 +698,8 @@ H5_make_time(struct tm *tm) * VS 2015 is removed, with _get_timezone replacing it. */ long timezone = 0; -#endif /* defined(H5_HAVE_VISUAL_STUDIO) && (_MSC_VER >= 1900) */ - time_t ret_value; /* Return value */ +#endif /* defined(H5_HAVE_VISUAL_STUDIO) && (_MSC_VER >= 1900) */ + time_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1337,7 +1337,7 @@ done: herr_t H5_combine_path(const char *path1, const char *path2, char **full_name /*out*/) { - size_t path1_len; /* length of path1 */ + size_t path1_len = 0; /* length of path1 */ size_t path2_len; /* length of path2 */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5timer.c b/src/H5timer.c index 08e4404..ac3a01e 100644 --- a/src/H5timer.c +++ b/src/H5timer.c @@ -582,10 +582,10 @@ H5_timer_get_time_string(double seconds) char *s; /* output string */ /* Used when the time is greater than 59 seconds */ - double days; - double hours; - double minutes; - double remainder_sec; + double days = 0.0; + double hours = 0.0; + double minutes = 0.0; + double remainder_sec = 0.0; /* Extract larger time units from count of seconds */ if (seconds > (double)60.0F) { diff --git a/src/H5trace.c b/src/H5trace.c index bfc1b52..83455d9 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -117,7 +117,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) void * vp = NULL; FILE * out = H5_debug_g.trace; static hbool_t is_first_invocation = TRUE; - H5_timer_t function_timer; + H5_timer_t function_timer = {{0}, {0}, {0}, FALSE}; H5_timevals_t function_times; static H5_timer_t running_timer; H5_timevals_t running_times; diff --git a/test/cache_common.h b/test/cache_common.h index 2976fc8..f184ebf 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -17,8 +17,8 @@ * This file contains common #defines, type definitions, and * externs for tests of the cache implemented in H5C.c */ -#ifndef _CACHE_COMMON_H -#define _CACHE_COMMON_H +#ifndef CACHE_COMMON_H +#define CACHE_COMMON_H #define H5C_FRIEND /*suppress error about including H5Cpkg */ #define H5F_FRIEND /*suppress error about including H5Fpkg */ @@ -692,4 +692,4 @@ H5TEST_DLL void dump_LRU(H5F_t * file_ptr); } #endif -#endif /* _CACHE_COMMON_H */ +#endif /* CACHE_COMMON_H */ diff --git a/test/external_common.h b/test/external_common.h index d338a70..6215be9 100644 --- a/test/external_common.h +++ b/test/external_common.h @@ -17,8 +17,8 @@ * * Purpose: Private function for external.c and external_env.c */ -#ifndef _EXTERNAL_COMMON_H -#define _EXTERNAL_COMMON_H +#ifndef EXTERNAL_COMMON_H +#define EXTERNAL_COMMON_H /* Include test header files */ #include "h5test.h" @@ -41,4 +41,4 @@ H5TEST_DLL herr_t reset_raw_data_files(hbool_t is_env); } #endif -#endif /* _EXTERNAL_COMMON_H */ +#endif /* EXTERNAL_COMMON_H */ diff --git a/test/external_fname.h b/test/external_fname.h index 2545547..c2cd059 100644 --- a/test/external_fname.h +++ b/test/external_fname.h @@ -17,8 +17,8 @@ * * Purpose: Private declaration for external.c and external_env.c */ -#ifndef _EXTERNAL_FNAME_H -#define _EXTERNAL_FNAME_H +#ifndef EXTERNAL_FNAME_H +#define EXTERNAL_FNAME_H /* Include test header files */ #include "h5test.h" @@ -26,4 +26,4 @@ static const char *EXT_FNAME[] = {"extern_1", "extern_2", "extern_3", "extern_4", "extern_dir/file_1", "extern_5", NULL}; -#endif /* _EXTERNAL_FNAME_H */ +#endif /* EXTERNAL_FNAME_H */ diff --git a/test/swmr_common.h b/test/swmr_common.h index e342580..d0d829d 100644 --- a/test/swmr_common.h +++ b/test/swmr_common.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _SWMR_COMMON_H -#define _SWMR_COMMON_H +#ifndef SWMR_COMMON_H +#define SWMR_COMMON_H /***********/ /* Headers */ @@ -75,4 +75,4 @@ H5TEST_DLL int print_metadata_retries_info(hid_t fid); } #endif -#endif /* _SWMR_COMMON_H */ +#endif /* SWMR_COMMON_H */ diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index d518675..f14bcda 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5DIFF_H__ -#define H5DIFF_H__ +#ifndef H5DIFF_H +#define H5DIFF_H #include "hdf5.h" #include "h5tools.h" @@ -159,4 +159,4 @@ int print_objname(diff_opt_t *opts, hsize_t nfound); void do_print_objname(const char *OBJ, const char *path1, const char *path2, diff_opt_t *opts); void do_print_attrname(const char *attr, const char *path1, const char *path2); -#endif /* H5DIFF_H__ */ +#endif /* H5DIFF_H */ diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 9db045f..bd4470b 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -3133,48 +3133,66 @@ print_pos(diff_opt_t *opts, hsize_t idx, size_t u) hsize_t curr_pos = idx; parallel_print("[ "); - H5TOOLS_DEBUG("do calc_acc_pos[%ld] nelmts:%d - errstat:%d", i, opts->hs_nelmts, opts->err_stat); + H5TOOLS_DEBUG("do calc_acc_pos[%ld] nelmts:%d - errstat:%d", idx, opts->hs_nelmts, + opts->err_stat); if (opts->sset[0] != NULL) { /* Subsetting is used - calculate total position */ - hsize_t elmnt_cnt = 1; - hsize_t dim_cnt = 0; /* previous dim size */ - hsize_t str_cnt = 0; /* previous dim stride */ - hsize_t curr_idx = idx; /* calculated running position */ - hsize_t str_idx = 0; - hsize_t blk_idx = 0; - hsize_t cnt_idx = 0; - hsize_t hs_idx = 0; - j = opts->rank - 1; + hsize_t prev_dim_size = 0; /* previous dim size */ + hsize_t prev_str = 0; /* previouw stride idx*/ + hsize_t str_cnt = 0; /* stride multiplier*/ + hsize_t curr_idx = 0; /* calculated running position */ + hsize_t str_idx = 0; + hsize_t blk_idx = 0; + hsize_t cnt_idx = 0; + hsize_t dim_size = 0; /* current dim size */ + hsize_t elmnt_cnt = 1; + hsize_t next_idx = idx; + hsize_t data_idx = 0; + j = opts->rank - 1; + H5TOOLS_DEBUG("...begin:%ld=> opts->rank:%ld (idx:%ld)", j, opts->rank, idx); do { - cnt_idx = opts->sset[0]->count.data[j]; /* Count value for current dim */ - H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - count:%ld", j, - curr_pos, curr_idx, cnt_idx); - blk_idx = opts->sset[0]->block.data[j]; /* Block value for current dim */ - H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - block:%ld", j, - curr_pos, curr_idx, blk_idx); - hs_idx = cnt_idx * blk_idx; /* hyperslab area value for current dim */ - H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - hs:%ld", j, curr_pos, - curr_idx, hs_idx); - str_idx = opts->sset[0]->stride.data[j]; /* Stride value for current dim */ - H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - stride:%ld", j, - curr_pos, curr_idx, str_idx); - elmnt_cnt *= opts->dims[j]; /* Total number of elements in dimension */ - H5TOOLS_DEBUG("... sset loop:%d with elmnt_cnt:%ld", j, elmnt_cnt); - if (str_idx > blk_idx) - curr_idx += dim_cnt * (str_idx - blk_idx); /* */ - else if (curr_idx >= hs_idx) - curr_idx += dim_cnt * str_cnt; - H5TOOLS_DEBUG("... sset loop:%d with idx:%ld (curr_idx:%ld) - stride:%ld", j, idx, - curr_idx, str_idx); - dim_cnt = elmnt_cnt; /* */ - if (str_idx > blk_idx) - str_cnt = str_idx - blk_idx; /* */ - else - str_cnt = str_idx; /* */ - H5TOOLS_DEBUG("... sset loop:%d with dim_cnt:%ld - str_cnt:%ld", j, dim_cnt, str_cnt); + curr_idx = next_idx; /* New current data position */ + cnt_idx = opts->sset[0]->count.data[j]; /* Count value for current dim */ + blk_idx = opts->sset[0]->block.data[j]; /* Block value for current dim */ + str_idx = opts->sset[0]->stride.data[j]; /* Stride value for current dim */ + H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - c:%ld b:%ld s:%ld", j, + curr_pos, curr_idx, cnt_idx, blk_idx, str_idx); + dim_size = opts->dims[j]; /* Current dimension size */ + // elmnt_cnt *= dim_size; /* Total number of elements in dimension */ + H5TOOLS_DEBUG("... sset loop:%d with elmnt_cnt:%ld - (prev_dim_size:%ld - dim_size:%ld) " + "- str_cnt:%ld", + j, elmnt_cnt, prev_dim_size, dim_size, str_cnt); + data_idx = elmnt_cnt * dim_size; + H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (data_idx:%ld)", j, curr_pos, data_idx); + for (i = 0; i < cnt_idx; i++) { + H5TOOLS_DEBUG("... ... data loop:%d with cnt_idx:%ld - str_cnt:%ld (curr_idx:%ld - " + "data_idx:%ld)", + i, cnt_idx, str_cnt, curr_idx, data_idx); + if (curr_idx >= data_idx) { + /* get to next block */ + data_idx += str_idx * dim_size; + /* get next block */ + str_cnt++; + H5TOOLS_DEBUG( + "... ... data loop:%d with cnt_idx:%ld - str_cnt:%ld - data_idx:%ld", i, + cnt_idx, str_cnt, data_idx); + } + H5TOOLS_DEBUG("... ... end data loop:%d with dim_cnt:%ld - str_cnt:%ld - " + "(curr_idx:%ld - data_idx:%ld)", + i, dim_size, str_cnt, curr_idx, data_idx); + } + next_idx += dim_size * str_cnt; // + prev_dim_size; + H5TOOLS_DEBUG("... sset loop:%d with curr_idx:%ld (next_idx:%ld)", j, curr_idx, next_idx); + str_cnt = 0; + prev_str = str_idx; + prev_dim_size = dim_size; + H5TOOLS_DEBUG("... end sset loop:%d with prev_dim_size:%ld (curr_idx:%ld - data_idx:%ld) " + "- str_cnt:%ld", + j, prev_dim_size, curr_idx, data_idx, str_cnt); + elmnt_cnt *= dim_size; /* Total number of elements in dimension */ j--; - } while (curr_idx >= elmnt_cnt && j >= 0); + } while (next_idx >= elmnt_cnt && j >= 0); curr_pos = curr_idx; /* New current position */ H5TOOLS_DEBUG("pos loop:%d,%d with elmnt_cnt:%ld - curr_pos:%ld", i, j, elmnt_cnt, curr_pos); } /* if (opts->sset[0] != NULL) */ diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 90c6de5..baaf665 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1599,7 +1599,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t } break; case H5T_ARRAY: { int k, ndims; - hsize_t dims[H5S_MAX_RANK], temp_nelmts, nelmts; + hsize_t dims[H5S_MAX_RANK], temp_nelmts, nelmts = 0; hid_t memb = H5I_INVALID_HID; H5TOOLS_DEBUG("H5T_ARRAY"); diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 99a7500..53f16cf 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -17,8 +17,8 @@ * * Purpose: Support functions for the various tools. */ -#ifndef H5TOOLS_H__ -#define H5TOOLS_H__ +#ifndef H5TOOLS_H +#define H5TOOLS_H #include "hdf5.h" #include "h5tools_error.h" @@ -684,4 +684,4 @@ H5TOOLS_DLL hbool_t h5tools_render_region_element(FILE *stream, const h5tool_for } #endif -#endif /* H5TOOLS_H__ */ +#endif /* H5TOOLS_H */ diff --git a/tools/lib/h5tools_dump.h b/tools/lib/h5tools_dump.h index 9cebdc3..9b47789 100644 --- a/tools/lib/h5tools_dump.h +++ b/tools/lib/h5tools_dump.h @@ -14,8 +14,8 @@ /* * Purpose: Support h5dump functions for the various tools. */ -#ifndef H5TOOLS_DUMP_H__ -#define H5TOOLS_DUMP_H__ +#ifndef H5TOOLS_DUMP_H +#define H5TOOLS_DUMP_H #include "h5tools_utils.h" @@ -94,4 +94,4 @@ H5TOOLS_DLL void h5tools_print_packed_bits(h5tools_str_t *buffer /*in,out*/, hid } #endif -#endif /* H5TOOLS_DUMP_H__ */ +#endif /* H5TOOLS_DUMP_H */ diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h index b8e5339..8fd33bb 100644 --- a/tools/lib/h5tools_error.h +++ b/tools/lib/h5tools_error.h @@ -14,8 +14,8 @@ /* * Header file for error values, etc. */ -#ifndef H5TOOLS_ERROR_H_ -#define H5TOOLS_ERROR_H_ +#ifndef H5TOOLS_ERROR_H +#define H5TOOLS_ERROR_H #include "H5Epublic.h" #include "H5Eprivate.h" /* Error handling */ @@ -250,4 +250,4 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g; H5_LEAVE(ret_val) \ } while (0) -#endif /* H5TOOLS_ERROR_H_ */ +#endif /* H5TOOLS_ERROR_H */ diff --git a/tools/lib/h5tools_ref.h b/tools/lib/h5tools_ref.h index 2720620..e3d55c6 100644 --- a/tools/lib/h5tools_ref.h +++ b/tools/lib/h5tools_ref.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5TOOLS_REF_H__ -#define H5TOOLS_REF_H__ +#ifndef H5TOOLS_REF_H +#define H5TOOLS_REF_H #include "hdf5.h" diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 7995d22..41a12d7 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -705,7 +705,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai long double templdouble; HDmemcpy(&templdouble, vp, sizeof(long double)); - h5tools_str_append(str, OPT(info->fmt_double, "%Lf"), templdouble); + h5tools_str_append(str, "%Lg", templdouble); #endif } break; diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h index 1c3301a..3bbf6b1 100644 --- a/tools/lib/h5tools_str.h +++ b/tools/lib/h5tools_str.h @@ -15,8 +15,8 @@ * Programmer: Bill Wendling * Monday, 19. February 2001 */ -#ifndef H5TOOLS_STR_H__ -#define H5TOOLS_STR_H__ +#ifndef H5TOOLS_STR_H +#define H5TOOLS_STR_H typedef struct h5tools_str_t { char * s; /*allocate string */ @@ -46,4 +46,4 @@ H5TOOLS_DLL char *h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t * hid_t type, void *vp, h5tools_context_t *ctx); H5TOOLS_DLL char *h5tools_str_replace(const char *string, const char *substr, const char *replacement); -#endif /* H5TOOLS_STR_H__ */ +#endif /* H5TOOLS_STR_H */ diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 3a68abe..108cd4f 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -196,7 +196,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti /* long command line option */ int i; const char ch = '='; - char * arg = &argv[opt_ind][2]; + char * arg = HDstrdup(&argv[opt_ind][2]); size_t arg_len = 0; opt_arg = strchr(&argv[opt_ind][2], ch); @@ -251,6 +251,8 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti opt_ind++; sp = 1; + + HDfree(arg); } else { register char *cp; /* pointer into current token */ @@ -1077,12 +1079,14 @@ h5tools_parse_ros3_fapl_tuple(const char *tuple_str, int delim, H5FD_ros3_fapl_t ccred[1] = (const char *)s3cred[1]; ccred[2] = (const char *)s3cred[2]; - if (h5tools_populate_ros3_fapl(fapl_config_out, ccred) < 0) + if (0 == h5tools_populate_ros3_fapl(fapl_config_out, ccred)) H5TOOLS_GOTO_ERROR(FAIL, "failed to populate S3 VFD FAPL config"); done: - HDfree(s3cred); - HDfree(s3cred_src); + if (s3cred) + HDfree(s3cred); + if (s3cred_src) + HDfree(s3cred_src); return ret_value; } diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index d38abce..34ac89b 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -17,8 +17,8 @@ * * Purpose: Support functions for the various tools. */ -#ifndef H5TOOLS_UTILS_H__ -#define H5TOOLS_UTILS_H__ +#ifndef H5TOOLS_UTILS_H +#define H5TOOLS_UTILS_H #include "hdf5.h" @@ -190,4 +190,4 @@ H5TOOLS_DLL herr_t h5tools_parse_hdfs_fapl_tuple(const char *tuple_str, int deli } #endif -#endif /* H5TOOLS_UTILS_H__ */ +#endif /* H5TOOLS_UTILS_H */ diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h index 32cd270..cda27a2 100644 --- a/tools/lib/h5trav.h +++ b/tools/lib/h5trav.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5TRAV_H__ -#define H5TRAV_H__ +#ifndef H5TRAV_H +#define H5TRAV_H #include "hdf5.h" @@ -188,4 +188,4 @@ H5TOOLS_DLL void trav_table_free(trav_table_t *table); H5TOOLS_DLL void trav_table_addflags(unsigned *flags, char *objname, h5trav_type_t type, trav_table_t *table); -#endif /* H5TRAV_H__ */ +#endif /* H5TRAV_H */ diff --git a/tools/lib/io_timer.h b/tools/lib/io_timer.h index 96ea05e..0269b93 100644 --- a/tools/lib/io_timer.h +++ b/tools/lib/io_timer.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef IO_TIMER__ -#define IO_TIMER__ +#ifndef IO_TIMER +#define IO_TIMER #include "hdf5.h" @@ -88,4 +88,4 @@ H5TOOLS_DLL double io_time_get(io_time_t *pt, timer_type t); } #endif /* __cplusplus */ -#endif /* IO_TIMER__ */ +#endif /* IO_TIMER */ diff --git a/tools/lib/ph5diff.h b/tools/lib/ph5diff.h index 8e884dd..7dce495 100644 --- a/tools/lib/ph5diff.h +++ b/tools/lib/ph5diff.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _PH5DIFF_H__ -#define _PH5DIFF_H__ +#ifndef PH5DIFF_H +#define PH5DIFF_H /* Send from manager to workers */ #define MPI_TAG_ARGS 1 @@ -40,4 +40,4 @@ struct diffs_found { int not_cmp; }; -#endif /* _PH5DIFF_H__ */ +#endif /* PH5DIFF_H */ diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c index 471400f..6402384 100644 --- a/tools/src/h5diff/h5diff_common.c +++ b/tools/src/h5diff/h5diff_common.c @@ -70,7 +70,6 @@ check_options(diff_opt_t *opts) } } -#if TRILABS_227 /*------------------------------------------------------------------------- * Function: parse_hsize_list * @@ -186,7 +185,6 @@ parse_subset_params(const char *dset) return s; } -#endif /*------------------------------------------------------------------------- * Function: parse_command_line @@ -442,11 +440,9 @@ parse_command_line(int argc, const char *argv[], const char **fname1, const char * TRILABS_227 is complete except for an issue with printing indices * the following calls will enable subsetting */ -#if TRILABS_227 opts->sset[0] = parse_subset_params(*objname1); opts->sset[1] = parse_subset_params(*objname2); -#endif H5TOOLS_ENDDEBUG(""); } @@ -766,19 +762,27 @@ usage(void) /* * TRILABS_227 is complete except for an issue with printing indices * the following will be needed for subsetting + */ PRINTVALSTREAM(rawoutstream, " Subsetting options:\n"); - PRINTVALSTREAM(rawoutstream, " Subsetting is available by using the fcompact form of subsetting, as - follows:\n"); PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK]\n"); - PRINTVALSTREAM(rawoutstream, " It is not required to use all parameters, but until the last parameter - value used,\n"); PRINTVALSTREAM(rawoutstream, " all of the semicolons (;) are required, even when a - parameter value is not specified. Example:\n"); PRINTVALSTREAM(rawoutstream, " obj1 - /foo/mydataset[START;;COUNT;BLOCK]\n"); PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START]\n"); - PRINTVALSTREAM(rawoutstream, " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 - in\n"); PRINTVALSTREAM(rawoutstream, " each dimension. START is optional and will default to 0 in each - dimension.\n"); PRINTVALSTREAM(rawoutstream, " Each of START, STRIDE, COUNT, and BLOCK must be a - comma-separated list of integers with\n"); PRINTVALSTREAM(rawoutstream, " one integer for each dimension - of the dataset.\n"); PRINTVALSTREAM(rawoutstream, "\n"); - */ + PRINTVALSTREAM(rawoutstream, + " Subsetting is available by using the fcompact form of subsetting, as follows:\n"); + PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK]\n"); + PRINTVALSTREAM(rawoutstream, + " It is not required to use all parameters, but until the last parameter value used,\n"); + PRINTVALSTREAM( + rawoutstream, + " all of the semicolons (;) are required, even when a parameter value is not specified. Example:\n"); + PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START;;COUNT;BLOCK]\n"); + PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START]\n"); + PRINTVALSTREAM(rawoutstream, + " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in\n"); + PRINTVALSTREAM(rawoutstream, + " each dimension. START is optional and will default to 0 in each dimension.\n"); + PRINTVALSTREAM( + rawoutstream, + " Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with\n"); + PRINTVALSTREAM(rawoutstream, " one integer for each dimension of the dataset.\n"); + PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, " Exit code:\n"); PRINTVALSTREAM(rawoutstream, " 0 if no differences, 1 if differences found, 2 if error\n"); PRINTVALSTREAM(rawoutstream, "\n"); diff --git a/tools/src/h5diff/h5diff_common.h b/tools/src/h5diff/h5diff_common.h index 6594478..83f4255 100644 --- a/tools/src/h5diff/h5diff_common.h +++ b/tools/src/h5diff/h5diff_common.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5DIFFCOMMON_H__ -#define H5DIFFCOMMON_H__ +#ifndef H5DIFFCOMMON_H +#define H5DIFFCOMMON_H #include "h5tools.h" /* Name of tool */ @@ -32,4 +32,4 @@ void print_info(diff_opt_t *opts); } #endif -#endif /* H5DIFFCOMMON_H__ */ +#endif /* H5DIFFCOMMON_H */ diff --git a/tools/src/h5dump/h5dump.h b/tools/src/h5dump/h5dump.h index 60422ad..a53d1ba 100644 --- a/tools/src/h5dump/h5dump.h +++ b/tools/src/h5dump/h5dump.h @@ -10,8 +10,8 @@ * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5DUMP_H__ -#define H5DUMP_H__ +#ifndef H5DUMP_H +#define H5DUMP_H #include "hdf5.h" #include "H5private.h" @@ -112,4 +112,4 @@ const dump_functions *dump_function_table; } #endif -#endif /* !H5DUMP_H__ */ +#endif /* H5DUMP_H */ diff --git a/tools/src/h5dump/h5dump_ddl.h b/tools/src/h5dump/h5dump_ddl.h index 6d65796..8487270 100644 --- a/tools/src/h5dump/h5dump_ddl.h +++ b/tools/src/h5dump/h5dump_ddl.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5DUMP_DDL_H__ -#define H5DUMP_DDL_H__ +#ifndef H5DUMP_DDL_H +#define H5DUMP_DDL_H #ifdef __cplusplus extern "C" { @@ -50,4 +50,4 @@ void handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED *data, in } #endif -#endif /* !H5DUMP_DDL_H__ */ +#endif /* H5DUMP_DDL_H */ diff --git a/tools/src/h5dump/h5dump_defines.h b/tools/src/h5dump/h5dump_defines.h index 0fb8def..21a31dd 100644 --- a/tools/src/h5dump/h5dump_defines.h +++ b/tools/src/h5dump/h5dump_defines.h @@ -10,8 +10,8 @@ * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5DUMP_DEFINES_H__ -#define H5DUMP_DEFINES_H__ +#ifndef H5DUMP_DEFINES_H +#define H5DUMP_DEFINES_H #define H5DUMP_MAX_RANK H5S_MAX_RANK @@ -50,4 +50,4 @@ #define H5_SZIP_MSB_OPTION_MASK 16 #define H5_SZIP_RAW_OPTION_MASK 128 -#endif /* !H5DUMP_DEFINES_H__ */ +#endif /* H5DUMP_DEFINES_H */ diff --git a/tools/src/h5dump/h5dump_extern.h b/tools/src/h5dump/h5dump_extern.h index 8fbb5af..308f602 100644 --- a/tools/src/h5dump/h5dump_extern.h +++ b/tools/src/h5dump/h5dump_extern.h @@ -10,8 +10,8 @@ * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5DUMP_EXTERN_H__ -#define H5DUMP_EXTERN_H__ +#ifndef H5DUMP_EXTERN_H +#define H5DUMP_EXTERN_H #include "hdf5.h" #include "H5private.h" @@ -109,4 +109,4 @@ ssize_t table_list_visited(unsigned long file_no); } #endif -#endif /* !H5DUMP_EXTERN_H__ */ +#endif /* H5DUMP_EXTERN_H */ diff --git a/tools/src/h5dump/h5dump_xml.h b/tools/src/h5dump/h5dump_xml.h index 9ff22ed..d69f6d5 100644 --- a/tools/src/h5dump/h5dump_xml.h +++ b/tools/src/h5dump/h5dump_xml.h @@ -10,8 +10,8 @@ * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5DUMP_XML_H__ -#define H5DUMP_XML_H__ +#ifndef H5DUMP_XML_H +#define H5DUMP_XML_H extern const char *xmlnsprefix; @@ -34,4 +34,4 @@ void xml_dump_data(hid_t, int, struct subset_t *, int); } #endif -#endif /* !H5DUMP_XML_H__ */ +#endif /* H5DUMP_XML_H */ diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index e3f4384..471af51 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -2536,7 +2536,7 @@ parsePathInfo(struct path_info *path, char *temp) token = HDstrtok(temp, delimiter); if (HDstrlen(token) >= MAX_PATH_NAME_LENGTH) { - (void)HDfprintf(stderr, err1); + (void)HDfprintf(stderr, "%s", err1); return (-1); } HDstrcpy(path->group[i++], token); @@ -2546,7 +2546,7 @@ parsePathInfo(struct path_info *path, char *temp) if (token == NULL) break; if (HDstrlen(token) >= MAX_PATH_NAME_LENGTH) { - (void)HDfprintf(stderr, err1); + (void)HDfprintf(stderr, "%s", err1); return (-1); } HDstrcpy(path->group[i++], token); diff --git a/tools/src/h5import/h5import.h b/tools/src/h5import/h5import.h index 2192f4a..efd40e1 100644 --- a/tools/src/h5import/h5import.h +++ b/tools/src/h5import/h5import.h @@ -17,8 +17,8 @@ * */ -#ifndef H5IMPORT_H__ -#define H5IMPORT_H__ +#ifndef H5IMPORT_H +#define H5IMPORT_H /* * state table tokens @@ -189,4 +189,4 @@ void help(char *); hid_t createOutputDataType(struct Input *in); hid_t createInputDataType(struct Input *in); -#endif /* H5IMPORT_H__ */ +#endif /* H5IMPORT_H */ diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 23cde21..1f9c681 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -2622,7 +2622,7 @@ int main(int argc, const char *argv[]) { hid_t file_id = H5I_INVALID_HID; - char * fname = NULL, *oname = NULL, *x; + char * fname = NULL, *oname = NULL, *x = NULL; const char *s = NULL; char * rest; int argno; diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h index f022934..ca1269b 100644 --- a/tools/src/h5repack/h5repack.h +++ b/tools/src/h5repack/h5repack.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5REPACK_H__ -#define H5REPACK_H__ +#ifndef H5REPACK_H +#define H5REPACK_H #include "H5private.h" #include "hdf5.h" @@ -224,4 +224,4 @@ obj_list_t *parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, obj_list_t *parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about object */ pack_opt_t *options); -#endif /* H5REPACK_H__ */ +#endif /* H5REPACK_H */ diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c index e8e7f29..88a3462 100644 --- a/tools/src/misc/h5debug.c +++ b/tools/src/misc/h5debug.c @@ -245,8 +245,8 @@ main(int argc, char *argv[]) haddr_t extra[10]; uint8_t sig[H5F_SIGNATURE_LEN]; size_t u; - H5E_auto2_t func; - void * edata; + H5E_auto2_t func = NULL; + void * edata = NULL; hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t status = SUCCEED; int exit_value = 0; diff --git a/tools/src/misc/h5repart.c b/tools/src/misc/h5repart.c index 77b40a1..a75f6d8 100644 --- a/tools/src/misc/h5repart.c +++ b/tools/src/misc/h5repart.c @@ -97,7 +97,7 @@ static off_t get_size(const char *progname, int *argno, int argc, char *argv[]) { off_t retval = -1; - char *suffix; + char *suffix = NULL; if (isdigit((int)(argv[*argno][2]))) { retval = HDstrtol(argv[*argno] + 2, &suffix, 10); diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index be8047a..6e9a65d 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -282,6 +282,7 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_80.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_800.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_801.txt + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_830.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_90.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8625.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8639.txt @@ -907,6 +908,8 @@ h5diff_800.out.err h5diff_801.out h5diff_801.out.err + h5diff_830.out + h5diff_830.out.err h5diff_8625.out h5diff_8625.out.err h5diff_8639.out @@ -1530,6 +1533,11 @@ ADD_H5_TEST (h5diff_800 1 -v ${FILE7} ${FILE8} /g1/array /g1/array) ADD_H5_TEST (h5diff_801 1 -v ${FILE7} ${FILE8A} /g1/array /g1/array) # ############################################################################## +# # dataset subsets +# ############################################################################## +#TRILABS_227 ADD_H5_TEST (h5diff_830 1 --enable-error-stack -v ${FILE7} ${FILE8} /g1/array3D[0,0,0;2,2,1;2,2,2;] /g1/array3D[0,0,0;2,2,1;2,2,2;]) + +# ############################################################################## # # VDS tests # ############################################################################## ADD_H5_TEST (h5diff_v1 0 -v ${FILEV1} ${FILEV2}) diff --git a/tools/test/h5diff/testfiles/h5diff_10.txt b/tools/test/h5diff/testfiles/h5diff_10.txt index 0618705..5804ac3 100644 --- a/tools/test/h5diff/testfiles/h5diff_10.txt +++ b/tools/test/h5diff/testfiles/h5diff_10.txt @@ -131,6 +131,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_600.txt b/tools/test/h5diff/testfiles/h5diff_600.txt index 98c80be..fa7447b 100644 --- a/tools/test/h5diff/testfiles/h5diff_600.txt +++ b/tools/test/h5diff/testfiles/h5diff_600.txt @@ -131,6 +131,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_603.txt b/tools/test/h5diff/testfiles/h5diff_603.txt index a5bb805..9e1dc89 100644 --- a/tools/test/h5diff/testfiles/h5diff_603.txt +++ b/tools/test/h5diff/testfiles/h5diff_603.txt @@ -132,6 +132,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_606.txt b/tools/test/h5diff/testfiles/h5diff_606.txt index 4782e17..146b944 100644 --- a/tools/test/h5diff/testfiles/h5diff_606.txt +++ b/tools/test/h5diff/testfiles/h5diff_606.txt @@ -132,6 +132,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_612.txt b/tools/test/h5diff/testfiles/h5diff_612.txt index ee40713..511e693 100644 --- a/tools/test/h5diff/testfiles/h5diff_612.txt +++ b/tools/test/h5diff/testfiles/h5diff_612.txt @@ -132,6 +132,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_615.txt b/tools/test/h5diff/testfiles/h5diff_615.txt index 5504812..c4b41f9 100644 --- a/tools/test/h5diff/testfiles/h5diff_615.txt +++ b/tools/test/h5diff/testfiles/h5diff_615.txt @@ -132,6 +132,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_621.txt b/tools/test/h5diff/testfiles/h5diff_621.txt index e4dba56..9dd312d 100644 --- a/tools/test/h5diff/testfiles/h5diff_621.txt +++ b/tools/test/h5diff/testfiles/h5diff_621.txt @@ -132,6 +132,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_622.txt b/tools/test/h5diff/testfiles/h5diff_622.txt index 0e7ffa3..0f7c4af 100644 --- a/tools/test/h5diff/testfiles/h5diff_622.txt +++ b/tools/test/h5diff/testfiles/h5diff_622.txt @@ -132,6 +132,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_623.txt b/tools/test/h5diff/testfiles/h5diff_623.txt index bb70458..3e1b5f3 100644 --- a/tools/test/h5diff/testfiles/h5diff_623.txt +++ b/tools/test/h5diff/testfiles/h5diff_623.txt @@ -132,6 +132,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_624.txt b/tools/test/h5diff/testfiles/h5diff_624.txt index cb30023..0645961 100644 --- a/tools/test/h5diff/testfiles/h5diff_624.txt +++ b/tools/test/h5diff/testfiles/h5diff_624.txt @@ -132,6 +132,18 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] (The option --follow-symlinks overrides the default behavior when symbolic links are compared.). + Subsetting options: + Subsetting is available by using the fcompact form of subsetting, as follows: + obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK] + It is not required to use all parameters, but until the last parameter value used, + all of the semicolons (;) are required, even when a parameter value is not specified. Example: + obj1 /foo/mydataset[START;;COUNT;BLOCK] + obj1 /foo/mydataset[START] + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with + one integer for each dimension of the dataset. + Exit code: 0 if no differences, 1 if differences found, 2 if error diff --git a/tools/test/h5diff/testfiles/h5diff_830.txt b/tools/test/h5diff/testfiles/h5diff_830.txt new file mode 100644 index 0000000..8f00d8b --- /dev/null +++ b/tools/test/h5diff/testfiles/h5diff_830.txt @@ -0,0 +1,30 @@ +dataset: </g1/array3D> and </g1/array3D> +size: [4x3x2] [4x3x2] +position array3D array3D difference +------------------------------------------------------------ +[ 0 0 0 ] 1 0 1 +[ 0 0 0 ] 2 0 2 +[ 0 0 0 ] 3 0 3 +[ 0 0 1 ] 4 0 4 +[ 0 0 1 ] 5 0 5 +[ 0 0 1 ] 6 0 6 +[ 0 2 0 ] 13 0 13 +[ 0 2 0 ] 14 0 14 +[ 0 2 0 ] 15 0 15 +[ 0 2 1 ] 16 0 16 +[ 0 2 1 ] 17 0 17 +[ 0 2 1 ] 18 0 18 +[ 2 0 0 ] 37 0 37 +[ 2 0 0 ] 38 0 38 +[ 2 0 0 ] 39 0 39 +[ 2 0 1 ] 40 0 40 +[ 2 0 1 ] 41 0 41 +[ 2 0 1 ] 42 0 42 +[ 2 2 0 ] 49 0 49 +[ 2 2 0 ] 50 0 50 +[ 2 2 0 ] 51 0 51 +[ 2 2 1 ] 52 0 52 +[ 2 2 1 ] 53 0 53 +[ 2 2 1 ] 54 0 54 +24 differences found +EXIT CODE: 1 diff --git a/tools/test/h5diff/testh5diff.sh.in b/tools/test/h5diff/testh5diff.sh.in index 4a8550e..24e9e23 100644 --- a/tools/test/h5diff/testh5diff.sh.in +++ b/tools/test/h5diff/testh5diff.sh.in @@ -341,6 +341,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_710.txt $SRC_H5DIFF_TESTFILES/h5diff_80.txt $SRC_H5DIFF_TESTFILES/h5diff_800.txt $SRC_H5DIFF_TESTFILES/h5diff_801.txt +$SRC_H5DIFF_TESTFILES/h5diff_830.txt $SRC_H5DIFF_TESTFILES/h5diff_90.txt $SRC_H5DIFF_TESTFILES/h5diff_8625.txt $SRC_H5DIFF_TESTFILES/h5diff_8639.txt @@ -1186,6 +1187,11 @@ TOOLTEST h5diff_800.txt -v h5diff_dset1.h5 h5diff_dset2.h5 /g1/array /g1/array TOOLTEST h5diff_801.txt -v h5diff_dset1.h5 h5diff_dset3.h5 /g1/array /g1/array # ############################################################################## +# # dataset subsets +# ############################################################################## +#TRILABS_227 TOOLTEST h5diff_830.txt --enable-error-stack -v h5diff_dset1.h5 h5diff_dset2.h5 /g1/array3D[0,0,0;2,2,1;2,2,2;] /g1/array3D[0,0,0;2,2,1;2,2,2;] + +# ############################################################################## # VDS tests # ############################################################################## TOOLTEST h5diff_v1.txt -v 1_vds.h5 2_vds.h5 diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index dbc5844..54439b8 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -126,7 +126,7 @@ ${HDF5_TOOLS_DIR}/testfiles/tintsattrs.ddl ${HDF5_TOOLS_DIR}/testfiles/tintsnodata.ddl ${HDF5_TOOLS_DIR}/testfiles/tlarge_objname.ddl - #${HDF5_TOOLS_DIR}/testfiles/tldouble.ddl + ${HDF5_TOOLS_DIR}/testfiles/tldouble.ddl ${HDF5_TOOLS_DIR}/testfiles/tlonglinks.ddl ${HDF5_TOOLS_DIR}/testfiles/tloop-1.ddl ${HDF5_TOOLS_DIR}/testfiles/tmulti.ddl @@ -281,7 +281,7 @@ ${HDF5_TOOLS_DIR}/testfiles/tintsattrs.h5 ${HDF5_TOOLS_DIR}/testfiles/tintsnodata.h5 ${HDF5_TOOLS_DIR}/testfiles/tlarge_objname.h5 - #${HDF5_TOOLS_DIR}/testfiles/tldouble.h5 + ${HDF5_TOOLS_DIR}/testfiles/tldouble.h5 ${HDF5_TOOLS_DIR}/testfiles/tlonglinks.h5 ${HDF5_TOOLS_DIR}/testfiles/tloop.h5 ${HDF5_TOOLS_DIR}/testfiles/tmulti-b.h5 @@ -1058,7 +1058,7 @@ ADD_H5_TEST (zerodim 0 --enable-error-stack zerodim.h5) # test for long double (some systems do not have long double) - #ADD_H5_TEST (tldouble 0 --enable-error-stack tldouble.h5) +# ADD_H5_TEST (tldouble 0 --enable-error-stack tldouble.h5) # test for vms ADD_H5_TEST (tvms 0 --enable-error-stack tvms.h5) @@ -1129,7 +1129,7 @@ ADD_H5_TEST (non_existing 1 --enable-error-stack tgroup.h5 non_existing.h5) # test to verify HDFFV-9407: long double full precision - ADD_H5_GREP_TEST (t128bit_float 1 "1.123456789012345" -m %.35Lf t128bit_float.h5) +# ADD_H5_GREP_TEST (t128bit_float 1 "1.123456789012345" -m %.35Lg t128bit_float.h5) ############################################################################## ### P L U G I N T E S T S diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index c1058fb..9d14f4b 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -114,6 +114,7 @@ #define FILE84 "tudfilter.h5" #define FILE85 "tgrpnullspace.h5" #define FILE87 "tintsnodata.h5" +#define FILE88 "tldouble_scalar.h5" /*------------------------------------------------------------------------- * prototypes @@ -6296,6 +6297,57 @@ error: } /*------------------------------------------------------------------------- + * Function: gent_ldouble_scalar + * + * Purpose: make file with a long double scalar dataset + * + *------------------------------------------------------------------------- + */ +static int +gent_ldouble_scalar(void) +{ + hid_t fid; + hid_t did; + hid_t tid; + hid_t sid; + hsize_t dims[1] = {6}; + long double buf[6] = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0}; + + if ((fid = H5Fcreate(FILE88, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + if ((sid = H5Screate(H5S_SCALAR)) < 0) + goto error; + + if ((tid = H5Tarray_create2(H5T_NATIVE_LDOUBLE, 1, dims)) < 0) + goto error; + + if (H5Tget_size(tid) == 0) + goto error; + + if ((did = H5Dcreate2(fid, "dset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + goto error; + + if (H5Sclose(sid) < 0) + goto error; + if (H5Tclose(tid) < 0) + goto error; + if (H5Dclose(did) < 0) + goto error; + if (H5Fclose(fid) < 0) + goto error; + + return 0; + +error: + HDprintf("error !\n"); + return -1; +} + +/*------------------------------------------------------------------------- * Function: gent_binary * * Purpose: Generate a file to be used in the binary output test diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in index d62218f..2104e1c 100644 --- a/tools/test/h5dump/testh5dump.sh.in +++ b/tools/test/h5dump/testh5dump.sh.in @@ -140,7 +140,7 @@ $SRC_H5DUMP_TESTFILES/thyperslab.h5 $SRC_H5DUMP_TESTFILES/tintsattrs.h5 $SRC_H5DUMP_TESTFILES/tints4dims.h5 $SRC_H5DUMP_TESTFILES/tlarge_objname.h5 -#$SRC_H5DUMP_TESTFILES/tldouble.h5 +$SRC_H5DUMP_TESTFILES/tldouble.h5 $SRC_H5DUMP_TESTFILES/tlonglinks.h5 $SRC_H5DUMP_TESTFILES/tloop.h5 $SRC_H5DUMP_TESTFILES/tmulti-b.h5 @@ -284,7 +284,7 @@ $SRC_H5DUMP_TESTFILES/tints4dimsCountEq.ddl $SRC_H5DUMP_TESTFILES/tints4dimsStride2.ddl $SRC_H5DUMP_TESTFILES/tintsattrs.ddl $SRC_H5DUMP_TESTFILES/tlarge_objname.ddl -#$SRC_H5DUMP_TESTFILES/tldouble.ddl +$SRC_H5DUMP_TESTFILES/tldouble.ddl $SRC_H5DUMP_TESTFILES/tlonglinks.ddl $SRC_H5DUMP_TESTFILES/tloop-1.ddl $SRC_H5DUMP_TESTFILES/tmulti.ddl @@ -1433,7 +1433,7 @@ TOOLTEST2 tall-6.exp --enable-error-stack -y -o tall-6.txt -d /g1/g1.1/dset1.1.1 TOOLTEST3 non_existing.ddl --enable-error-stack tgroup.h5 non_existing.h5 # test to verify HDFFV-9407: long double full precision -GREPTEST OUTTXT "1.123456789012345" t128bit_float.ddl -m %.35Lf t128bit_float.h5 +#GREPTEST OUTTXT "1.123456789012345" t128bit_float.ddl -m %.35Lf t128bit_float.h5 # Clean up temporary files/directories CLEAN_TESTFILES_AND_TESTDIR diff --git a/tools/test/h5jam/getub.c b/tools/test/h5jam/getub.c index a21c2af..a9b4437 100644 --- a/tools/test/h5jam/getub.c +++ b/tools/test/h5jam/getub.c @@ -138,14 +138,15 @@ main(int argc, const char *argv[]) } /* end if */ /* close things and exit */ + HDfree(filename); HDfree(buf); HDclose(fd); return EXIT_SUCCESS; error: - if (buf) - HDfree(buf); + HDfree(filename); + HDfree(buf); if (fd >= 0) HDclose(fd); return EXIT_FAILURE; diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c index c4bdb4b..fcaa337 100644 --- a/tools/test/perform/chunk_cache.c +++ b/tools/test/perform/chunk_cache.c @@ -98,7 +98,7 @@ create_dset1(hid_t file) hid_t dcpl = H5I_INVALID_HID; hsize_t dims[RANK] = {DSET1_DIM1, DSET1_DIM2}; hsize_t chunk_dims[RANK] = {CHUNK1_DIM1, CHUNK1_DIM2}; - int ** data; /* data for writing */ + int ** data = NULL; /* data for writing */ /* Create the data space. */ if ((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0) @@ -134,6 +134,7 @@ create_dset1(hid_t file) H5Dclose(dataset); H5Pclose(dcpl); H5Sclose(dataspace); + HDfree(data); return 0; error: @@ -144,6 +145,7 @@ error: H5Sclose(dataspace); } H5E_END_TRY; + HDfree(data); return 1; } @@ -160,7 +162,7 @@ create_dset2(hid_t file) hid_t dcpl = H5I_INVALID_HID; hsize_t dims[RANK] = {DSET2_DIM1, DSET2_DIM2}; hsize_t chunk_dims[RANK] = {CHUNK2_DIM1, CHUNK2_DIM2}; - int ** data; /* data for writing */ + int ** data = NULL; /* data for writing */ /* Create the data space. */ if ((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0) @@ -195,6 +197,7 @@ create_dset2(hid_t file) H5Dclose(dataset); H5Pclose(dcpl); H5Sclose(dataspace); + HDfree(data); return 0; @@ -206,6 +209,7 @@ error: H5Sclose(dataspace); } H5E_END_TRY; + HDfree(data); return 1; } @@ -259,11 +263,11 @@ check_partial_chunks_perf(hid_t file) end_t = H5_get_time(); if ((end_t - start_t) > (double)0.0f) - printf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %lu\n", + printf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %zu\n", (end_t - start_t), nbytes_global); else printf("1. Partial chunks: no total read time because timer is not available; number of bytes being " - "read from file is %lu\n", + "read from file is %zu\n", nbytes_global); H5Dclose(dataset); @@ -337,11 +341,11 @@ check_hash_value_perf(hid_t file) end_t = H5_get_time(); if ((end_t - start_t) > (double)0.0f) - printf("2. Hash value: total read time is %lf; number of bytes being read from file is %lu\n", + printf("2. Hash value: total read time is %lf; number of bytes being read from file is %zu\n", (end_t - start_t), nbytes_global); else printf("2. Hash value: no total read time because timer is not available; number of bytes being read " - "from file is %lu\n", + "from file is %zu\n", nbytes_global); H5Dclose(dataset); diff --git a/tools/test/perform/pio_perf.h b/tools/test/perform/pio_perf.h index 027b553..24621da 100644 --- a/tools/test/perform/pio_perf.h +++ b/tools/test/perform/pio_perf.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef PIO_PERF_H__ -#define PIO_PERF_H__ +#ifndef PIO_PERF_H +#define PIO_PERF_H #ifndef STANDALONE #include "io_timer.h" @@ -97,4 +97,4 @@ extern results do_pio(parameters param); } #endif /* __cplusplus */ -#endif /* PIO_PERF_H__ */ +#endif /* PIO_PERF_H */ diff --git a/tools/test/perform/pio_standalone.h b/tools/test/perform/pio_standalone.h index 5a3f16d..3da2660 100644 --- a/tools/test/perform/pio_standalone.h +++ b/tools/test/perform/pio_standalone.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef PIO_STANDALONE_H__ -#define PIO_PERF_H__ +#ifndef PIO_STANDALONE_H +#define PIO_STANDALONE_H /* Header file for building h5perf by standalone mode. * Created: Christian Chilan, 2005/5/18. diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c index ff0e4eb..f8061d4 100644 --- a/tools/test/perform/sio_engine.c +++ b/tools/test/perform/sio_engine.c @@ -783,7 +783,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) /* Allocate data verification buffer */ if (NULL == (buffer2 = (char *)malloc(linear_buf_size))) { - HDfprintf(stderr, "malloc for data verification buffer size (%Zu) failed\n", linear_buf_size); + HDfprintf(stderr, "malloc for data verification buffer size (%zu) failed\n", linear_buf_size); GOTOERROR(FAIL); } /* end if */ diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c index f24e97a..8463ffa 100644 --- a/tools/test/perform/sio_perf.c +++ b/tools/test/perform/sio_perf.c @@ -872,9 +872,9 @@ report_parameters(struct options *opts) HDfprintf(output, "\n"); if (opts->page_size) { - HDfprintf(output, "Page Aggregation Enabled. Page size = %ld\n", opts->page_size); + HDfprintf(output, "Page Aggregation Enabled. Page size = %zu\n", opts->page_size); if (opts->page_buffer_size) - HDfprintf(output, "Page Buffering Enabled. Page Buffer size = %ld\n", opts->page_buffer_size); + HDfprintf(output, "Page Buffering Enabled. Page Buffer size = %zu\n", opts->page_buffer_size); else HDfprintf(output, "Page Buffering Disabled\n"); } diff --git a/tools/test/perform/sio_perf.h b/tools/test/perform/sio_perf.h index acdb801..6242782 100644 --- a/tools/test/perform/sio_perf.h +++ b/tools/test/perform/sio_perf.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef SIO_PERF_H__ -#define SIO_PERF_H__ +#ifndef SIO_PERF_H +#define SIO_PERF_H #ifndef STANDALONE #include "io_timer.h" @@ -101,4 +101,4 @@ extern void do_sio(parameters param, results *res); } #endif /* __cplusplus */ -#endif /* PIO_PERF_H__ */ +#endif /* SIO_PERF_H */ diff --git a/tools/test/perform/sio_standalone.h b/tools/test/perform/sio_standalone.h index 924cbfd..eebce68 100644 --- a/tools/test/perform/sio_standalone.h +++ b/tools/test/perform/sio_standalone.h @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef SIO_STANDALONE_H__ -#define SIO_PERF_H__ +#ifndef SIO_STANDALONE_H +#define SIO_STANDALONE_H /* Header file for building h5perf by standalone mode. * Created: Christian Chilan, 2005/5/18. diff --git a/tools/testfiles/tldouble.ddl b/tools/testfiles/tldouble.ddl new file mode 100644 index 0000000..c032ef3 --- /dev/null +++ b/tools/testfiles/tldouble.ddl @@ -0,0 +1,11 @@ +HDF5 "tldouble.h5" { +GROUP "/" { + DATASET "dset" { + DATATYPE H5T_NATIVE_LDOUBLE + DATASPACE SIMPLE { ( 3 ) / ( 3 ) } + DATA { + (0): 1, 2, 3 + } + } +} +} |