summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/src/jni/exceptionImp.c33
-rw-r--r--java/src/jni/exceptionImp.h6
-rw-r--r--java/src/jni/h5Imp.h6
-rw-r--r--java/src/jni/h5aImp.c4
-rw-r--r--java/src/jni/h5aImp.h6
-rw-r--r--java/src/jni/h5dImp.c4
-rw-r--r--java/src/jni/h5dImp.h6
-rw-r--r--java/src/jni/h5eImp.h6
-rw-r--r--java/src/jni/h5fImp.h6
-rw-r--r--java/src/jni/h5gImp.h6
-rw-r--r--java/src/jni/h5iImp.h6
-rw-r--r--java/src/jni/h5jni.h27
-rw-r--r--java/src/jni/h5lImp.h6
-rw-r--r--java/src/jni/h5oImp.h6
-rw-r--r--java/src/jni/h5pACPLImp.h6
-rw-r--r--java/src/jni/h5pDAPLImp.h6
-rw-r--r--java/src/jni/h5pDCPLImp.h6
-rw-r--r--java/src/jni/h5pDXPLImp.h6
-rw-r--r--java/src/jni/h5pFAPLImp.h6
-rw-r--r--java/src/jni/h5pFCPLImp.h6
-rw-r--r--java/src/jni/h5pGAPLImp.h6
-rw-r--r--java/src/jni/h5pGCPLImp.h6
-rw-r--r--java/src/jni/h5pImp.h6
-rw-r--r--java/src/jni/h5pLAPLImp.h6
-rw-r--r--java/src/jni/h5pLCPLImp.h6
-rw-r--r--java/src/jni/h5pOCPLImp.h6
-rw-r--r--java/src/jni/h5pOCpyPLImp.h6
-rw-r--r--java/src/jni/h5pStrCPLImp.h6
-rw-r--r--java/src/jni/h5plImp.h6
-rw-r--r--java/src/jni/h5rImp.h6
-rw-r--r--java/src/jni/h5sImp.h6
-rw-r--r--java/src/jni/h5tImp.h6
-rw-r--r--java/src/jni/h5util.c482
-rw-r--r--java/src/jni/h5util.h4
-rw-r--r--java/src/jni/h5zImp.h6
-rw-r--r--java/src/jni/nativeData.h6
36 files changed, 321 insertions, 413 deletions
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 */