summaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/src')
-rw-r--r--java/src/hdf/hdf5lib/H5.java4
-rw-r--r--java/src/hdf/hdf5lib/HDF5Constants.java6
-rw-r--r--java/src/hdf/overview.html15
-rw-r--r--java/src/jni/CMakeLists.txt14
-rw-r--r--java/src/jni/h5Constants.c4
-rw-r--r--java/src/jni/h5Imp.c1
-rw-r--r--java/src/jni/h5aImp.c22
-rw-r--r--java/src/jni/h5dImp.c17
-rw-r--r--java/src/jni/h5eImp.c18
-rw-r--r--java/src/jni/h5fImp.c7
-rw-r--r--java/src/jni/h5gImp.c1
-rw-r--r--java/src/jni/h5iImp.c1
-rw-r--r--java/src/jni/h5lImp.c29
-rw-r--r--java/src/jni/h5oImp.c21
-rw-r--r--java/src/jni/h5pImp.c34
-rw-r--r--java/src/jni/h5plImp.c1
-rw-r--r--java/src/jni/h5rImp.c1
-rw-r--r--java/src/jni/h5sImp.c7
-rw-r--r--java/src/jni/h5tImp.c1
-rw-r--r--java/src/jni/h5util.c11
20 files changed, 126 insertions, 89 deletions
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java
index f58623e..f9f9b65 100644
--- a/java/src/hdf/hdf5lib/H5.java
+++ b/java/src/hdf/hdf5lib/H5.java
@@ -214,7 +214,7 @@ import hdf.hdf5lib.structs.H5O_info_t;
* exception handlers to print out the HDF-5 error stack.
* <hr>
*
- * @version HDF5 1.11.2 <BR>
+ * @version HDF5 1.11.4 <BR>
* <b>See also: <a href ="./hdf.hdf5lib.HDFArray.html"> hdf.hdf5lib.HDFArray</a> </b><BR>
* <a href ="./hdf.hdf5lib.HDF5Constants.html"> hdf.hdf5lib.HDF5Constants</a><BR>
* <a href ="./hdf.hdf5lib.HDF5CDataTypes.html"> hdf.hdf5lib.HDF5CDataTypes</a><BR>
@@ -237,7 +237,7 @@ public class H5 implements java.io.Serializable {
*
* Make sure to update the versions number when a different library is used.
*/
- public final static int LIB_VERSION[] = { 1, 11, 2 };
+ public final static int LIB_VERSION[] = { 1, 11, 4 };
public final static String H5PATH_PROPERTY_KEY = "hdf.hdf5lib.H5.hdf5lib";
diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java
index 7eddac0..b530f4b 100644
--- a/java/src/hdf/hdf5lib/HDF5Constants.java
+++ b/java/src/hdf/hdf5lib/HDF5Constants.java
@@ -190,6 +190,7 @@ public class HDF5Constants {
public static final long H5E_UNSUPPORTED = H5E_UNSUPPORTED();
public static final long H5E_VERSION = H5E_VERSION();
public static final long H5E_VFL = H5E_VFL();
+ public static final long H5E_VOL = H5E_VOL();
public static final long H5E_WALK_DOWNWARD = H5E_WALK_DOWNWARD();
public static final long H5E_WALK_UPWARD = H5E_WALK_UPWARD();
public static final long H5E_WRITEERROR = H5E_WRITEERROR();
@@ -317,6 +318,7 @@ public class HDF5Constants {
public static final int H5I_REFERENCE = H5I_REFERENCE();
public static final int H5I_UNINIT = H5I_UNINIT();
public static final int H5I_VFL = H5I_VFL();
+ public static final int H5I_VOL = H5I_VOL();
public static final int H5L_TYPE_ERROR = H5L_TYPE_ERROR();
public static final int H5L_TYPE_HARD = H5L_TYPE_HARD();
@@ -980,6 +982,8 @@ public class HDF5Constants {
private static native final long H5E_VFL();
+ private static native final long H5E_VOL();
+
private static native final long H5E_WALK_DOWNWARD();
private static native final long H5E_WALK_UPWARD();
@@ -1224,6 +1228,8 @@ public class HDF5Constants {
private static native final int H5I_VFL();
+ private static native final int H5I_VOL();
+
private static native final int H5L_TYPE_ERROR();
private static native final int H5L_TYPE_HARD();
diff --git a/java/src/hdf/overview.html b/java/src/hdf/overview.html
index 9c19442..edb1b76 100644
--- a/java/src/hdf/overview.html
+++ b/java/src/hdf/overview.html
@@ -6,18 +6,19 @@
The <b>Java HD5 Interface (JHI5)</b> is a Java package
(<a href="../../hdf-java-html/javadocs/hdf/hdf5lib/package-summary.html">hdf.hdf5lib</a>)
that ``wraps around'' the HDF5 library.
-<p />There are a large number of functions in the HDF5
+<p>There are a large number of functions in the HDF5
library (version 1.10). Some of the functions are not supported in JHI5. Most
of the unsupported functions have C function pointers, which is not currently
-implemented in JHI5.
+implemented in JHI5.</p>
-<center><table BORDER=1 COLS=1 WIDTH="71%" BGCOLOR="#dbeaf5" >
+<table style="width:71%;text-align:center;background-color:#dbeaf5" border="1">
+<caption>Java HDF5 Interface (JHI5)</caption>
<tr>
-<td>
-<center>Note: The JHI5 does not support HDF4 or earlier.</center>
+<td style="text-align:center;">
+Note: The JHI5 does not support HDF4 or earlier.
</td>
</tr>
-</table></center>
+</table>
<p>The JHI5 may be used by any Java application that needs to access HDF5
files. It is extremely important to emphasize that <i>this package is not
@@ -91,6 +92,6 @@ and the HDF5 library.
<h3>
<a NAME="DOWNLOAD"></a>To Obtain</h3>
-The JHI5 is included with the <a href="http://www.hdfgroup.org/HDF5/index.html">HDF5</a> library.
+The JHI5 is included with the <a href="https://portal.hdfgroup.org/display/support/Downloads">HDF5</a> library.
</body>
diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt
index a0228e1..7b95e0b 100644
--- a/java/src/jni/CMakeLists.txt
+++ b/java/src/jni/CMakeLists.txt
@@ -50,22 +50,10 @@ set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
add_library (${HDF5_JAVA_JNI_LIB_TARGET} SHARED ${HDF5_JAVA_JNI_CSRCS} ${HDF5_JAVA_JNI_CHDRS})
target_include_directories(${HDF5_JAVA_JNI_LIB_TARGET} PRIVATE ${HDF5_BINARY_DIR} ${HDF5_JAVA_JNI_SOURCE_DIR})
TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED)
-target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET})
+target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} PUBLIC ${HDF5_LIBSH_TARGET})
set_target_properties (${HDF5_JAVA_JNI_LIB_TARGET} PROPERTIES FOLDER libraries/jni)
SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_JAVA_JNI_LIB_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_JAVA_JNI_LIB_NAME} SHARED "JAVA")
-if (WIN32)
- get_filename_component (HDF5_JAVA_JNI_DLL_NAME ${HDF5_JAVA_JNI_LIB_TARGET} NAME_WE)
- set (HDF5_JAVA_JNI_DLL_NAME "${HDF5_JAVA_JNI_DLL_NAME}$<$<CONFIG:Debug>:_D>")
- # message (STATUS "HDF5_JAVA_JNI_DLL_NAME: ${HDF5_JAVA_JNI_DLL_NAME}")
- if (BUILD_TESTING)
- add_custom_target (HDF5_JAVA_JNI-Test-Copy ALL
- COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
- COMMENT "Copying ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
- )
- add_dependencies (HDF5_JAVA_JNI-Test-Copy ${HDF5_JAVA_JNI_LIB_TARGET})
- endif ()
-endif ()
#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install for import into other projects
diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c
index c99745d..fdec61a 100644
--- a/java/src/jni/h5Constants.c
+++ b/java/src/jni/h5Constants.c
@@ -344,6 +344,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5E_1VERSION(JNIEnv *env, jclass cls) { return H5
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5E_1VFL(JNIEnv *env, jclass cls) { return H5E_VFL; }
JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5E_1VOL(JNIEnv *env, jclass cls) { return H5E_VOL; }
+JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5E_1WALK_1DOWNWARD(JNIEnv *env, jclass cls) { return H5E_WALK_DOWNWARD; }
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5E_1WALK_1UPWARD(JNIEnv *env, jclass cls) { return H5E_WALK_UPWARD; }
@@ -605,6 +607,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5I_1REFERENCE(JNIEnv *env, jclass cls) { return
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5I_1VFL(JNIEnv *env, jclass cls) { return H5I_VFL; }
JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5I_1VOL(JNIEnv *env, jclass cls) { return H5I_VOL; }
+JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5I_1INVALID_1HID(JNIEnv *env, jclass cls) { return H5I_INVALID_HID; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5I_1GENPROP_1CLS(JNIEnv *env, jclass cls) { return H5I_GENPROP_CLS; }
diff --git a/java/src/jni/h5Imp.c b/java/src/jni/h5Imp.c
index 2eeb075..1ad6b17 100644
--- a/java/src/jni/h5Imp.c
+++ b/java/src/jni/h5Imp.c
@@ -36,7 +36,6 @@ extern "C" {
#include "h5Imp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
/*
* Class: hdf_hdf5lib_H5
diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c
index c0dc182..aba2240 100644
--- a/java/src/jni/h5aImp.c
+++ b/java/src/jni/h5aImp.c
@@ -29,7 +29,11 @@ extern "C" {
#include "h5aImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
+
+typedef struct _cb_wrapper {
+ jobject visit_callback;
+ jobject op_data;
+} cb_wrapper;
#ifdef __cplusplus
#define CBENVPTR (cbenv)
@@ -53,7 +57,8 @@ static herr_t H5AwriteVL_asstr (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjec
static herr_t H5AwriteVL_str (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf);
static herr_t H5AreadVL_asstr (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf);
static herr_t H5AreadVL_str (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf);
-static herr_t H5A_iterate_cb(hid_t g_id, const char *name, const H5A_info_t *info, void *op_data);
+
+static herr_t H5A_iterate_cb(hid_t g_id, const char *name, const H5A_info_t *info, void *cb_data);
/*
@@ -1138,7 +1143,7 @@ Java_hdf_hdf5lib_H5__1H5Aget_1create_1plist
static herr_t
H5A_iterate_cb
- (hid_t g_id, const char *name, const H5A_info_t *info, void *op_data) {
+ (hid_t g_id, const char *name, const H5A_info_t *info, void *cb_data) {
JNIEnv *cbenv;
jint status = -1;
jclass cls;
@@ -1147,6 +1152,9 @@ H5A_iterate_cb
jmethodID constructor;
jvalue args[4];
jobject cb_info_t = NULL;
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
+ void *op_data = (void *)wrapper->op_data;
+ jobject visit_callback = wrapper->visit_callback;
if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback);
@@ -1195,14 +1203,14 @@ Java_hdf_hdf5lib_H5_H5Aiterate
hsize_t start_idx = (hsize_t)idx;
herr_t status = -1;
+ cb_wrapper wrapper = {callback_op, op_data};
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if ((op_data == NULL) || (callback_op == NULL)) {
h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL");
} /* end if */
else {
- status = H5Aiterate2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)op_data);
+ status = H5Aiterate2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)&wrapper);
if (status < 0)
h5libraryError(env);
@@ -1224,9 +1232,9 @@ Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name
const char *lName;
hsize_t start_idx = (hsize_t)idx;
herr_t status = -1;
+ cb_wrapper wrapper = {callback_op, op_data};
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if ((op_data == NULL) || (callback_op == NULL)) {
h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL");
@@ -1234,7 +1242,7 @@ Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name
else {
PIN_JAVA_STRING(name, lName);
if (lName != NULL) {
- status = H5Aiterate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)op_data, (hid_t)access_id);
+ status = H5Aiterate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)&wrapper, (hid_t)access_id);
UNPIN_JAVA_STRING(name, lName);
diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c
index cea6bb4..652c873 100644
--- a/java/src/jni/h5dImp.c
+++ b/java/src/jni/h5dImp.c
@@ -30,7 +30,11 @@ extern "C" {
#include "h5dImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
+
+typedef struct _cb_wrapper {
+ jobject visit_callback;
+ jobject op_data;
+} cb_wrapper;
#ifdef __cplusplus
#ifdef _WINDOWS
@@ -1105,7 +1109,7 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1string
const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0);
if (utf8) {
- strncpy(&c_buf[i * str_len], utf8, str_len);
+ HDstrncpy(&c_buf[i * str_len], utf8, str_len);
} /* end if */
ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8);
@@ -1888,7 +1892,7 @@ Java_hdf_hdf5lib_H5_H5Dset_1extent
static herr_t
H5D_iterate_cb
- (void* elem, hid_t elem_id, unsigned ndim, const hsize_t *point, void *op_data) {
+ (void* elem, hid_t elem_id, unsigned ndim, const hsize_t *point, void *cb_data) {
JNIEnv *cbenv;
jint status;
jclass cls;
@@ -1896,6 +1900,9 @@ H5D_iterate_cb
jbyteArray elemArray;
jlongArray pointArray;
jsize size;
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
+ void *op_data = (void *)wrapper->op_data;
+ jobject visit_callback = wrapper->visit_callback;
if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) {
JVMPTR->DetachCurrentThread(JVMPAR);
@@ -1958,9 +1965,9 @@ Java_hdf_hdf5lib_H5_H5Diterate
herr_t status = -1;
jboolean isCopy;
jbyte *buffP;
+ cb_wrapper wrapper = {callback_op, op_data};
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if (op_data == NULL) {
h5nullArgument(env, "H5Diterate: op_data is NULL");
@@ -1977,7 +1984,7 @@ Java_hdf_hdf5lib_H5_H5Diterate
h5JNIFatalError(env, "H5Diterate: buf not pinned");
} /* end if */
else {
- status = H5Diterate((void*)buffP, (hid_t)buf_type, (hid_t)space, (H5D_operator_t)H5D_iterate_cb, (void*)op_data);
+ status = H5Diterate((void*)buffP, (hid_t)buf_type, (hid_t)space, (H5D_operator_t)H5D_iterate_cb, (void*)&wrapper);
if (status < 0) {
ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, JNI_ABORT);
diff --git a/java/src/jni/h5eImp.c b/java/src/jni/h5eImp.c
index 10a02b0..9c80461 100644
--- a/java/src/jni/h5eImp.c
+++ b/java/src/jni/h5eImp.c
@@ -40,7 +40,11 @@ extern "C" {
#include "h5eImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
+
+typedef struct _cb_wrapper {
+ jobject visit_callback;
+ jobject op_data;
+} cb_wrapper;
#ifdef __cplusplus
#define CBENVPTR (cbenv)
@@ -60,7 +64,7 @@ extern jobject visit_callback;
/* Local Prototypes */
/********************/
-static herr_t H5E_walk_cb(int nindx, const H5E_error2_t *info, void *op_data);
+static herr_t H5E_walk_cb(int nindx, const H5E_error2_t *info, void *cb_data);
/*
* Class: hdf_hdf5lib_H5
@@ -475,7 +479,7 @@ Java_hdf_hdf5lib_H5_H5Eget_1num
static herr_t
H5E_walk_cb
- (int nindx, const H5E_error2_t *info, void *op_data)
+ (int nindx, const H5E_error2_t *info, void *cb_data)
{
JNIEnv *cbenv;
jint status = -1;
@@ -485,6 +489,9 @@ H5E_walk_cb
jmethodID constructor;
jvalue args[7];
jobject cb_info_t = NULL;
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
+ void *op_data = (void *)wrapper->op_data;
+ jobject visit_callback = wrapper->visit_callback;
if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback);
@@ -532,13 +539,14 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Ewalk2
(JNIEnv *env, jclass cls, jlong stk_id, jlong direction, jobject callback_op, jobject op_data)
{
+ cb_wrapper wrapper = {callback_op, op_data};
+
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if ((op_data == NULL) || (callback_op == NULL)) {
h5nullArgument(env, "H5Ewalk2: op_data or callback_op is NULL");
} /* end if */
- else if (H5Ewalk2(stk_id, (H5E_direction_t)direction, (H5E_walk2_t)H5E_walk_cb, (void*)op_data) < 0)
+ else if (H5Ewalk2(stk_id, (H5E_direction_t)direction, (H5E_walk2_t)H5E_walk_cb, (void*)&wrapper) < 0)
h5libraryError(env);
} /* end iJava_hdf_hdf5lib_H5_H5Ewalk2f */
diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c
index 8cf5252..9d68290 100644
--- a/java/src/jni/h5fImp.c
+++ b/java/src/jni/h5fImp.c
@@ -29,7 +29,6 @@ extern "C" {
#include "h5util.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
/*
* Class: hdf_hdf5lib_H5
@@ -541,7 +540,7 @@ Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write
- (JNIEnv *env, jclass cls, jlong file_id)
+ (JNIEnv *env, jclass cls, jlong file_id)
{
if (H5Fstart_swmr_write((hid_t)file_id) < 0)
h5libraryError(env);
@@ -554,7 +553,7 @@ Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging
- (JNIEnv *env, jclass cls, jlong file_id)
+ (JNIEnv *env, jclass cls, jlong file_id)
{
if (H5Fstart_mdc_logging((hid_t)file_id) < 0)
h5libraryError(env);
@@ -580,7 +579,7 @@ Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status
- (JNIEnv *env, jclass cls, jlong file_id, jbooleanArray mdc_logging_status)
+ (JNIEnv *env, jclass cls, jlong file_id, jbooleanArray mdc_logging_status)
{
hbool_t is_enabled;
hbool_t is_currently_logging;
diff --git a/java/src/jni/h5gImp.c b/java/src/jni/h5gImp.c
index 41ec382..42c042a 100644
--- a/java/src/jni/h5gImp.c
+++ b/java/src/jni/h5gImp.c
@@ -30,7 +30,6 @@ extern "C" {
#include "h5gImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
/*
* Class: hdf_hdf5lib_H5
diff --git a/java/src/jni/h5iImp.c b/java/src/jni/h5iImp.c
index 47574ca..b8bd1cd 100644
--- a/java/src/jni/h5iImp.c
+++ b/java/src/jni/h5iImp.c
@@ -28,7 +28,6 @@ extern "C" {
#include "h5iImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
/*
* Class: hdf_hdf5lib_H5
diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c
index f1734fd..e1ec3bd 100644
--- a/java/src/jni/h5lImp.c
+++ b/java/src/jni/h5lImp.c
@@ -28,13 +28,17 @@ extern "C" {
#include "h5lImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
+
+typedef struct _cb_wrapper {
+ jobject visit_callback;
+ jobject op_data;
+} cb_wrapper;
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5L_iterate_cb(hid_t g_id, const char *name, const H5L_info_t *info, void *op_data);
+static herr_t H5L_iterate_cb(hid_t g_id, const char *name, const H5L_info_t *info, void *cb_data);
/*
* Class: hdf_hdf5lib_H5
@@ -541,7 +545,7 @@ Java_hdf_hdf5lib_H5_H5Lmove
static herr_t
H5L_iterate_cb
- (hid_t g_id, const char *name, const H5L_info_t *info, void *op_data)
+ (hid_t g_id, const char *name, const H5L_info_t *info, void *cb_data)
{
JNIEnv *cbenv;
jint status;
@@ -551,6 +555,9 @@ H5L_iterate_cb
jmethodID constructor;
jvalue args[5];
jobject cb_info_t = NULL;
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
+ void *op_data = (void *)wrapper->op_data;
+ jobject visit_callback = wrapper->visit_callback;
if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback);
@@ -600,15 +607,15 @@ Java_hdf_hdf5lib_H5_H5Lvisit
jobject callback_op, jobject op_data)
{
herr_t status = -1;
+ cb_wrapper wrapper = {callback_op, op_data};
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if ((op_data == NULL) || (callback_op == NULL)) {
h5nullArgument(env, "H5Lvisit: op_data or callback_op is NULL");
} /* end if */
else {
- status = H5Lvisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data);
+ status = H5Lvisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper);
if (status < 0)
h5libraryError(env);
} /* end else */
@@ -628,9 +635,9 @@ Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name
{
herr_t status = -1;
const char *lName;
+ cb_wrapper wrapper = {callback_op, op_data};
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if ((op_data == NULL) || (callback_op == NULL)) {
h5nullArgument(env, "H5Lvisit_by_name: op_data or callback_op is NULL");
@@ -638,7 +645,7 @@ Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name
else {
PIN_JAVA_STRING(name, lName);
if (lName != NULL) {
- status = H5Lvisit_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data, (hid_t)access_id);
+ status = H5Lvisit_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper, (hid_t)access_id);
UNPIN_JAVA_STRING(name, lName);
@@ -662,15 +669,15 @@ Java_hdf_hdf5lib_H5_H5Literate
{
hsize_t start_idx = (hsize_t)idx;
herr_t status = -1;
+ cb_wrapper wrapper = {callback_op, op_data};
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if ((op_data == NULL) || (callback_op == NULL)) {
h5nullArgument(env, "H5Literate: op_data or callback_op is NULL");
} /* end if */
else {
- status = H5Literate((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data);
+ status = H5Literate((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper);
if (status < 0)
h5libraryError(env);
@@ -694,7 +701,7 @@ Java_hdf_hdf5lib_H5_H5Literate_1by_1name
const char *lName;
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
+ cb_wrapper wrapper = {callback_op, op_data};
if ((op_data == NULL) || (callback_op == NULL)) {
h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL");
@@ -702,7 +709,7 @@ Java_hdf_hdf5lib_H5_H5Literate_1by_1name
else {
PIN_JAVA_STRING(name, lName);
if (lName != NULL) {
- status = H5Literate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data, (hid_t)access_id);
+ status = H5Literate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper, (hid_t)access_id);
UNPIN_JAVA_STRING(name, lName);
diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c
index 6093e46..1de505a 100644
--- a/java/src/jni/h5oImp.c
+++ b/java/src/jni/h5oImp.c
@@ -27,13 +27,17 @@ extern "C" {
#include "h5oImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
+
+typedef struct _cb_wrapper {
+ jobject visit_callback;
+ jobject op_data;
+} cb_wrapper;
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5O_iterate_cb(hid_t g_id, const char *name, const H5O_info_t *info, void *op_data);
+static herr_t H5O_iterate_cb(hid_t g_id, const char *name, const H5O_info_t *info, void *cb_data);
/*
* Class: hdf_hdf5lib_H5
@@ -330,7 +334,7 @@ Java_hdf_hdf5lib_H5_H5Olink
static herr_t
H5O_iterate_cb
- (hid_t g_id, const char *name, const H5O_info_t *info, void *op_data)
+ (hid_t g_id, const char *name, const H5O_info_t *info, void *cb_data)
{
JNIEnv *cbenv;
jint status = -1;
@@ -343,6 +347,9 @@ H5O_iterate_cb
jobject ihinfobuf1;
jobject ihinfobuf2;
jobject cb_info_t = NULL;
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
+ void *op_data = (void *)wrapper->op_data;
+ jobject visit_callback = wrapper->visit_callback;
if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) {
/* printf("JNI H5O_iterate_cb error: AttachCurrentThread failed\n"); */
@@ -448,9 +455,9 @@ Java_hdf_hdf5lib_H5_H5Ovisit
jobject callback_op, jobject op_data, jint fields)
{
herr_t status = -1;
+ cb_wrapper wrapper = {callback_op, op_data};
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if (op_data == NULL) {
h5nullArgument(env, "H5Ovisit: op_data is NULL");
@@ -459,7 +466,7 @@ Java_hdf_hdf5lib_H5_H5Ovisit
h5nullArgument(env, "H5Ovisit: callback_op is NULL");
} /* end if */
else {
- status = H5Ovisit2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (unsigned)fields);
+ status = H5Ovisit2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)&wrapper, (unsigned)fields);
if (status < 0)
h5libraryError(env);
@@ -480,9 +487,9 @@ Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name
{
herr_t status = -1;
const char *lName;
+ cb_wrapper wrapper = {callback_op, op_data};
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if (op_data == NULL) {
h5nullArgument(env, "H5Ovisit_by_name: op_data is NULL");
@@ -495,7 +502,7 @@ Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name
else {
PIN_JAVA_STRING(name, lName);
if (lName != NULL) {
- status = H5Ovisit_by_name2((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (unsigned)fields, (hid_t)access_id);
+ status = H5Ovisit_by_name2((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)&wrapper, (unsigned)fields, (hid_t)access_id);
UNPIN_JAVA_STRING(name, lName);
diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c
index 3ff7436..52008ce 100644
--- a/java/src/jni/h5pImp.c
+++ b/java/src/jni/h5pImp.c
@@ -27,7 +27,6 @@ extern "C" {
#include "h5pImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
extern jobject copy_callback;
extern jobject close_callback;
extern jobject create_callback;
@@ -36,6 +35,11 @@ extern jobject get_callback;
extern jobject set_callback;
extern jobject delete_callback;
+typedef struct _cb_wrapper {
+ jobject visit_callback;
+ jobject op_data;
+} cb_wrapper;
+
/********************/
/* Local Prototypes */
/********************/
@@ -52,7 +56,7 @@ static herr_t H5P_prp_get_func_cb(hid_t prop_id, const char *name, size_t size,
static herr_t H5P_prp_set_func_cb(hid_t prop_id, const char *name, size_t size, void *value);
static herr_t H5P_prp_delete_func_cb(hid_t prop_id, const char *name, size_t size, void *value);
-static herr_t H5P_iterate_cb(hid_t prop_id, const char *name, void *op_data);
+static herr_t H5P_iterate_cb(hid_t prop_id, const char *name, void *cb_data);
/*
* Class: hdf_hdf5lib_H5
@@ -3877,7 +3881,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi
const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0);
if (utf8) {
- member_name[i] = (char*)HDmalloc(strlen(utf8) + 1);
+ member_name[i] = (char*)HDmalloc(HDstrlen(utf8) + 1);
if (member_name[i]) {
strcpy(member_name[i], utf8);
} /* end if */
@@ -4185,7 +4189,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config
h5JNIFatalError(env, "H5Pset_mdc_config: out of memory trace_file_name");
return;
} /* end if */
- strncpy(cacheinfo.trace_file_name, str, 1025);
+ HDstrncpy(cacheinfo.trace_file_name, str, 1025);
ENVPTR->ReleaseStringUTFChars(ENVPAR j_str, str);
if(ENVPTR->ExceptionOccurred(ENVONLY)) {
h5JNIFatalError(env, "H5Pset_mdc_config: loading trace_file_name failed");
@@ -5042,7 +5046,7 @@ H5P_cls_copy_cb
} /* end if */
JVMPTR->DetachCurrentThread(JVMPAR);
return (herr_t)status;
-} /* end H5P_cls_ccopy_cb */
+} /* end H5P_cls_copy_cb */
static herr_t
H5P_cls_close_cb
@@ -5158,13 +5162,16 @@ Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options
static herr_t
H5D_append_cb
- (hid_t dataset_id, hsize_t *cur_dims, void *op_data)
+ (hid_t dataset_id, hsize_t *cur_dims, void *cb_data)
{
JNIEnv *cbenv;
jint status = -1;
jclass cls;
jmethodID mid;
jlongArray cur_dimsArray;
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
+ void *op_data = (void *)wrapper->op_data;
+ jobject visit_callback = wrapper->visit_callback;
if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) {
JVMPTR->DetachCurrentThread(JVMPAR);
@@ -5199,9 +5206,9 @@ Java_hdf_hdf5lib_H5_H5Pset_1append_1flush
(JNIEnv *env, jclass clss, jlong plist_id, jint ndims, jlongArray boundary, jobject callback_op, jobject op_data)
{
herr_t status = -1;
+ cb_wrapper wrapper = {callback_op, op_data};
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if (op_data == NULL) {
h5nullArgument(env, "H5Pset_append_flush: op_data is NULL");
@@ -5210,7 +5217,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1append_1flush
h5nullArgument(env, "H5Pset_append_flush: callback_op is NULL");
} /* end if */
else {
- status = H5Pset_append_flush((hid_t)plist_id, (unsigned)ndims, (const hsize_t*)boundary, (H5D_append_cb_t)H5D_append_cb, (void*)op_data);
+ status = H5Pset_append_flush((hid_t)plist_id, (unsigned)ndims, (const hsize_t*)boundary, (H5D_append_cb_t)H5D_append_cb, (void*)&wrapper);
if (status < 0)
h5libraryError(env);
@@ -5603,13 +5610,16 @@ Java_hdf_hdf5lib_H5_H5Pinsert2
static herr_t
H5P_iterate_cb
- (hid_t prop_id, const char *name, void *op_data)
+ (hid_t prop_id, const char *name, void *cb_data)
{
JNIEnv *cbenv;
jint status = -1;
jclass cls;
jmethodID mid;
jstring str;
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
+ void *op_data = (void *)wrapper->op_data;
+ jobject visit_callback = wrapper->visit_callback;
/* fprintf(stderr, "\nJNI H5P_iterate_cb entered\n"); fflush(stderr); */
if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) {
@@ -5656,9 +5666,9 @@ Java_hdf_hdf5lib_H5_H5Piterate
herr_t status = -1;
jint *theArray = NULL;
jboolean isCopy;
+ cb_wrapper wrapper = {callback_op, op_data};
ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
if (op_data == NULL) {
h5nullArgument(env, "H5Piterate: op_data is NULL");
@@ -5668,7 +5678,7 @@ Java_hdf_hdf5lib_H5_H5Piterate
} /* end else if */
else {
if (idx == NULL) {
- status = H5Piterate((hid_t)prop_id, NULL, (H5P_iterate_t)H5P_iterate_cb, (void*)op_data);
+ status = H5Piterate((hid_t)prop_id, NULL, (H5P_iterate_t)H5P_iterate_cb, (void*)&wrapper);
} /* end if */
else {
theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR idx, &isCopy);
@@ -5676,7 +5686,7 @@ Java_hdf_hdf5lib_H5_H5Piterate
h5JNIFatalError(env, "H5Piterate: idx not pinned");
} /* end if */
else
- status = H5Piterate((hid_t)prop_id, (int*)&theArray[0], (H5P_iterate_t)H5P_iterate_cb, (void*)op_data);
+ status = H5Piterate((hid_t)prop_id, (int*)&theArray[0], (H5P_iterate_t)H5P_iterate_cb, (void*)&wrapper);
} /* end else */
if (status < 0) {
diff --git a/java/src/jni/h5plImp.c b/java/src/jni/h5plImp.c
index ffd5b7a..d551120 100644
--- a/java/src/jni/h5plImp.c
+++ b/java/src/jni/h5plImp.c
@@ -27,7 +27,6 @@ extern "C" {
#include "h5plImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
/*
* Class: hdf_hdf5lib_H5
diff --git a/java/src/jni/h5rImp.c b/java/src/jni/h5rImp.c
index b250550..5f2b86d 100644
--- a/java/src/jni/h5rImp.c
+++ b/java/src/jni/h5rImp.c
@@ -27,7 +27,6 @@ extern "C" {
#include "h5rImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
/*
diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c
index 10f69eb..65cdd7b 100644
--- a/java/src/jni/h5sImp.c
+++ b/java/src/jni/h5sImp.c
@@ -27,7 +27,6 @@ extern "C" {
#include "h5sImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
/*
* Class: hdf_hdf5lib_H5
@@ -572,7 +571,7 @@ Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple
h5JNIFatalError(env, "H5Pset_simple_extent: dims not pinned");
return -1;
} /* end if */
- sa = lp = (hsize_t *) malloc((size_t)rank * sizeof(hsize_t));
+ sa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t));
if (sa == NULL) {
ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
h5JNIFatalError(env, "H5Sset_simple_extent: dims not converted to hsize_t");
@@ -1018,7 +1017,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist
h5JNIFatalError(env, "H5Sget_select_hyper_blocklist: buf not pinned");
} /* end if */
else {
- ba = (hsize_t *) malloc((size_t)nb * 2 * (size_t)rank * sizeof(hsize_t));
+ ba = (hsize_t *) HDmalloc((size_t)nb * 2 * (size_t)rank * sizeof(hsize_t));
if (ba == NULL) {
ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT);
h5JNIFatalError(env, "H5Screate-simple: buffer not converted to hsize_t");
@@ -1136,7 +1135,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds
return -1;
} /* end if */
rank = (int) ENVPTR->GetArrayLength(ENVPAR start);
- strt = (hsize_t *)malloc((size_t)rank * sizeof(hsize_t));
+ strt = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
if (strt == NULL) {
ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
h5JNIFatalError(env, "H5Sget_select_bounds: start not converted to hsize_t");
diff --git a/java/src/jni/h5tImp.c b/java/src/jni/h5tImp.c
index 7b4af56..307f1a5 100644
--- a/java/src/jni/h5tImp.c
+++ b/java/src/jni/h5tImp.c
@@ -30,7 +30,6 @@ extern "C" {
#include "h5tImp.h"
extern JavaVM *jvm;
-extern jobject visit_callback;
/*
* Class: hdf_hdf5lib_H5
diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c
index 33dca7f..fd34ba1 100644
--- a/java/src/jni/h5util.c
+++ b/java/src/jni/h5util.c
@@ -33,7 +33,6 @@ hsize_t H5TOOLS_BUFSIZE = (32 * 1024 * 1024); /* 32 MB */
int H5TOOLS_TEXT_BLOCK = 16; /* Number of elements on a line in a text export file */
JavaVM *jvm;
-jobject visit_callback;
jobject copy_callback;
jobject close_callback;
jobject create_callback;
@@ -1769,7 +1768,7 @@ h5str_render_bin_output
if (H5Tis_variable_str(tid)) {
s = *(char**) mem;
if (s != NULL)
- size = strlen(s);
+ size = HDstrlen(s);
}
else {
s = (char *) mem;
@@ -2130,11 +2129,11 @@ render_bin_output_region_data_points
ret_value = -1;
HDfree(dims1);
- } /* end if((dims1 = (hsize_t *) malloc(sizeof(hsize_t) * ndims)) != NULL) */
+ } /* end if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */
else
ret_value = -1;
HDfree(region_buf);
- } /* end if((region_buf = malloc(type_size * (size_t)npoints)) != NULL) */
+ } /* end if((region_buf = HDmalloc(type_size * (size_t)npoints)) != NULL) */
else
ret_value = -1;
@@ -2437,7 +2436,7 @@ Java_hdf_hdf5lib_H5_H5AreadComplex
H5Tclose(p_type);
n = ENVPTR->GetArrayLength(ENVPAR buf);
- rdata = (char *)malloc((size_t)n * size);
+ rdata = (char *)HDmalloc((size_t)n * size);
if (rdata == NULL) {
h5JNIFatalError(env, "H5AreadComplex: failed to allocate buff for read");
} /* end if */
@@ -2953,7 +2952,7 @@ obj_info_all
if (retVal < 0) {
*(datainfo->otype+datainfo->count) = -1;
*(datainfo->ltype+datainfo->count) = -1;
- *(datainfo->objname+datainfo->count) = (char *)HDmalloc(strlen(name)+1);
+ *(datainfo->objname+datainfo->count) = (char *)HDmalloc(HDstrlen(name)+1);
HDstrcpy(*(datainfo->objname+datainfo->count), name);
*(datainfo->objno+datainfo->count) = (unsigned long)-1;
} /* end if */