summaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/src')
-rw-r--r--java/src/hdf/hdf5lib/H5.java337
-rw-r--r--java/src/hdf/hdf5lib/HDF5Constants.java22
-rw-r--r--java/src/jni/CMakeLists.txt2
-rw-r--r--java/src/jni/h5Constants.c14
-rw-r--r--java/src/jni/h5aImp.c8
-rw-r--r--java/src/jni/h5dImp.c8
-rw-r--r--java/src/jni/h5pFAPLImp.c10
-rw-r--r--java/src/jni/h5rImp.c590
-rw-r--r--java/src/jni/h5rImp.h130
-rw-r--r--java/src/jni/h5sImp.c6
-rw-r--r--java/src/jni/h5sImp.h6
-rw-r--r--java/src/jni/h5tImp.c6
-rw-r--r--java/src/jni/h5tImp.h4
-rw-r--r--java/src/jni/h5util.c344
-rw-r--r--java/src/jni/h5util.h1
-rw-r--r--java/src/jni/nativeData.c40
16 files changed, 1359 insertions, 169 deletions
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java
index 09fb223..ba10f5e 100644
--- a/java/src/hdf/hdf5lib/H5.java
+++ b/java/src/hdf/hdf5lib/H5.java
@@ -1107,7 +1107,9 @@ public class H5 implements java.io.Serializable {
log.trace("H5Aread_dname_D");
status = H5Aread_double(attr_id, mem_type_id, (double[]) obj, isCriticalPinning);
}
- else if ((H5.H5Tdetect_class(mem_type_id, HDF5Constants.H5T_REFERENCE) && (is1D && (dataClass.getComponentType() == String.class))) || H5.H5Tequal(mem_type_id, HDF5Constants.H5T_STD_REF_DSETREG)) {
+ else if ((H5.H5Tdetect_class(mem_type_id, HDF5Constants.H5T_REFERENCE) &&
+ (is1D && (dataClass.getComponentType() == String.class))) ||
+ H5.H5Tequal(mem_type_id, HDF5Constants.H5T_STD_REF_DSETREG)) {
log.trace("H5Aread_reg_ref");
status = H5Aread_reg_ref(attr_id, mem_type_id, (String[]) obj);
}
@@ -2005,7 +2007,9 @@ public class H5 implements java.io.Serializable {
status = H5Dread_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id,
(double[]) obj, isCriticalPinning);
}
- else if ((H5.H5Tdetect_class(mem_type_id, HDF5Constants.H5T_REFERENCE) && (is1D && (dataClass.getComponentType() == String.class))) || H5.H5Tequal(mem_type_id, HDF5Constants.H5T_STD_REF_DSETREG)) {
+ else if ((H5.H5Tdetect_class(mem_type_id, HDF5Constants.H5T_REFERENCE) &&
+ (is1D && (dataClass.getComponentType() == String.class))) ||
+ H5.H5Tequal(mem_type_id, HDF5Constants.H5T_STD_REF_DSETREG)) {
log.trace("H5Dread_reg_ref");
status = H5Dread_reg_ref(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id,
(String[]) obj);
@@ -8095,6 +8099,331 @@ public class H5 implements java.io.Serializable {
// ////////////////////////////////////////////////////////////
// //
+ // H5R: HDF5 1.12 Reference API Functions //
+ // //
+ // ////////////////////////////////////////////////////////////
+
+ // Constructors //
+
+ /**
+ * H5Rcreate_object creates a reference pointing to the object named name located at loc id.
+ *
+ * @param loc_id
+ * IN: Location identifier used to locate the object being pointed to.
+ * @param name
+ * IN: Name of object at location loc_id.
+ * @param access_id
+ * IN: Object access identifier to the object being pointed to.
+ *
+ * @return the reference (byte[]) if successful
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - an input array is null.
+ * @exception IllegalArgumentException
+ * - an input array is invalid.
+ **/
+ public synchronized static native byte[] H5Rcreate_object(long loc_id, String name, long access_id)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ /**
+ * H5Rcreate_region creates the reference, pointing to the region represented by
+ * space id within the object named name located at loc id.
+ *
+ * @param loc_id
+ * IN: Location identifier used to locate the object being pointed to.
+ * @param name
+ * IN: Name of object at location loc_id.
+ * @param space_id
+ * IN: Identifies the dataset region that a dataset region reference points to.
+ * @param access_id
+ * IN: Object access identifier to the object being pointed to.
+ *
+ * @return the reference (byte[]) if successful
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - an input array is null.
+ * @exception IllegalArgumentException
+ * - an input array is invalid.
+ **/
+ public synchronized static native byte[] H5Rcreate_region(long loc_id, String name, long space_id, long access_id)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ /**
+ * H5Rcreate_attr creates the reference, pointing to the attribute named attr name
+ * and attached to the object named name located at loc id.
+ *
+ * @param loc_id
+ * IN: Location identifier used to locate the object being pointed to.
+ * @param name
+ * IN: Name of object at location loc_id.
+ * @param attr_name
+ * IN: Name of the attribute within the object.
+ * @param access_id
+ * IN: Object access identifier to the object being pointed to.
+ *
+ * @return the reference (byte[]) if successful
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - an input array is null.
+ * @exception IllegalArgumentException
+ * - an input array is invalid.
+ **/
+ public synchronized static native byte[] H5Rcreate_attr(long loc_id, String name, String attr_name, long access_id)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ /**
+ * H5Rdestroy destroys a reference and releases resources.
+ *
+ * @param ref_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - an input array is null.
+ * @exception IllegalArgumentException
+ * - an input array is invalid.
+ **/
+ public synchronized static native void H5Rdestroy(byte[] ref_ptr)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ // Info //
+
+ /**
+ * H5Rget_type retrieves the type of a reference.
+ *
+ * @param ref_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ *
+ * @return a valid reference type if successful; otherwise returns H5R UNKNOWN.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - an input array is null.
+ * @exception IllegalArgumentException
+ * - an input array is invalid.
+ **/
+ public synchronized static native int H5Rget_type(byte[] ref_ptr)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ /**
+ * H5Requal determines whether two references point to the same object, region or attribute.
+ *
+ * @param ref1_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ * @param ref2_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ *
+ * @return true if equal, else false
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - an input array is null.
+ * @exception IllegalArgumentException
+ * - an input array is invalid.
+ **/
+ public synchronized static native boolean H5Requal(byte[] ref1_ptr, byte[] ref2_ptr)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ /**
+ * H5Rcopy creates a copy of an existing reference.
+ *
+ * @param src_ref_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ *
+ * @return a valid copy of the reference (byte[]) if successful.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - an input array is null.
+ * @exception IllegalArgumentException
+ * - an input array is invalid.
+ **/
+ public synchronized static native byte[] H5Rcopy(byte[] src_ref_ptr)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ // Dereference //
+
+ /**
+ * H5Ropen_object opens that object and returns an identifier.
+ * The object opened with this function should be closed when it is no longer needed
+ * so that resource leaks will not develop. Use the appropriate close function such
+ * as H5Oclose or H5Dclose for datasets.
+ *
+ * @param ref_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ * @param rapl_id
+ * IN: A reference access property list identifier for the reference. The access property
+ * list can be used to access external files that the reference points
+ * to (through a file access property list).
+ * @param oapl_id
+ * IN: An object access property list identifier for the reference. The access property
+ * property list must be of the same type as the object being referenced,
+ * that is a group or dataset property list.
+ *
+ * @return a valid identifier if successful
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - an input array is null.
+ * @exception IllegalArgumentException
+ * - an input array is invalid.
+ **/
+ public synchronized static native long H5Ropen_object(byte[] ref_ptr, long rapl_id, long oapl_id)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ /**
+ * H5Ropen region creates a copy of the dataspace of the dataset pointed to by a region reference,
+ * ref ptr, and defines a selection matching the selection pointed to by ref ptr within the dataspace copy.
+ * Use H5Sclose to release the dataspace identifier returned by this function when the identifier is no longer needed.
+ *
+ * @param ref_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ * @param rapl_id
+ * IN: A reference access property list identifier for the reference. The access property
+ * list can be used to access external files that the reference points
+ * to (through a file access property list).
+ * @param oapl_id
+ * IN: An object access property list identifier for the reference. The access property
+ * property list must be of the same type as the object being referenced,
+ * that is a group or dataset property list.
+ *
+ * @return a valid dataspace identifier if successful
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - an input array is null.
+ * @exception IllegalArgumentException
+ * - an input array is invalid.
+ **/
+ public synchronized static native long H5Ropen_region(byte[] ref_ptr, long rapl_id, long oapl_id)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ /**
+ * H5Ropen_attr opens the attribute attached to the object and returns an identifier.
+ * The attribute opened with this function should be closed with H5Aclose when it is no longer needed
+ * so that resource leaks will not develop.
+ *
+ * @param ref_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ * @param rapl_id
+ * IN: A reference access property list identifier for the reference. The access property
+ * list can be used to access external files that the reference points
+ * to (through a file access property list).
+ * @param aapl_id
+ * IN: An attribute access property list identifier for the reference. The access property
+ * property list must be of the same type as the object being referenced,
+ * that is a group or dataset property list.
+ *
+ * @return a valid attribute identifier if successful
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - an input array is null.
+ * @exception IllegalArgumentException
+ * - an input array is invalid.
+ **/
+ public synchronized static native long H5Ropen_attr(byte[] ref_ptr, long rapl_id, long aapl_id)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ // Get type //
+
+ /**
+ * H5Rget obj type3 retrieves the type of the referenced object pointed to.
+ *
+ * @param ref_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ * @param rapl_id
+ * IN: A reference access property list identifier for the reference. The access property
+ * list can be used to access external files that the reference points
+ * to (through a file access property list).
+ *
+ * @return Returns the object type
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - array is null.
+ * @exception IllegalArgumentException
+ * - array is invalid.
+ **/
+ public synchronized static native int H5Rget_obj_type3(byte[] ref_ptr, long rapl_id)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ // Get name //
+
+ /**
+ * H5Rget_file_name retrieves the file name for the object, region or attribute reference pointed to.
+ *
+ * @param ref_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ *
+ * @return Returns the file name of the reference
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - array is null.
+ * @exception IllegalArgumentException
+ * - array is invalid.
+ **/
+ public synchronized static native String H5Rget_file_name(byte[] ref_ptr)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ /**
+ * H5Rget_obj_name retrieves the object name for the object, region or attribute reference pointed to.
+ *
+ * @param ref_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ * @param rapl_id
+ * IN: A reference access property list identifier for the reference. The access property
+ * list can be used to access external files that the reference points
+ * to (through a file access property list).
+ *
+ * @return Returns the object name of the reference
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - array is null.
+ * @exception IllegalArgumentException
+ * - array is invalid.
+ **/
+ public synchronized static native String H5Rget_obj_name(byte[] ref_ptr, long rapl_id)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ /**
+ * H5Rget_attr_name retrieves the attribute name for the object, region or attribute reference pointed to.
+ *
+ * @param ref_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ *
+ * @return Returns the attribute name of the reference
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - array is null.
+ * @exception IllegalArgumentException
+ * - array is invalid.
+ **/
+ public synchronized static native String H5Rget_attr_name(byte[] ref_ptr)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ // ////////////////////////////////////////////////////////////
+ // //
// H5R: HDF5 1.8 Reference API Functions //
// //
// ////////////////////////////////////////////////////////////
@@ -10328,14 +10657,12 @@ public class H5 implements java.io.Serializable {
* @param buf
* Buffer with data to be reclaimed.
*
- * @return a non-negative value if successful
- *
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
* @exception NullPointerException
* - buf is null.
**/
- public synchronized static native int H5Treclaim(long type_id, long space_id, long xfer_plist_id, byte[] buf)
+ public synchronized static native void H5Treclaim(long type_id, long space_id, long xfer_plist_id, byte[] buf)
throws HDF5LibraryException, NullPointerException;
/**
diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java
index f5be38d..4aeeb98 100644
--- a/java/src/hdf/hdf5lib/HDF5Constants.java
+++ b/java/src/hdf/hdf5lib/HDF5Constants.java
@@ -407,11 +407,18 @@ public class HDF5Constants {
public static final int H5PL_VOL_PLUGIN = H5PL_VOL_PLUGIN();
public static final int H5PL_ALL_PLUGIN = H5PL_ALL_PLUGIN();
+ public static final int H5R_ATTR = H5R_ATTR();
public static final int H5R_BADTYPE = H5R_BADTYPE();
public static final int H5R_DATASET_REGION = H5R_DATASET_REGION();
+ public static final int H5R_DATASET_REGION1 = H5R_DATASET_REGION1();
+ public static final int H5R_DATASET_REGION2 = H5R_DATASET_REGION2();
public static final int H5R_MAXTYPE = H5R_MAXTYPE();
+ public static final int H5R_REF_BUF_SIZE = H5R_REF_BUF_SIZE();
public static final int H5R_OBJ_REF_BUF_SIZE = H5R_OBJ_REF_BUF_SIZE();
public static final int H5R_OBJECT = H5R_OBJECT();
+ public static final int H5R_OBJECT1 = H5R_OBJECT1();
+ public static final int H5R_OBJECT2 = H5R_OBJECT2();
+
public static final int H5S_ALL = H5S_ALL();
public static final int H5S_MAX_RANK = H5S_MAX_RANK();
public static final int H5S_NO_CLASS = H5S_NO_CLASS();
@@ -606,6 +613,7 @@ public class HDF5Constants {
public static final long H5T_STD_I8LE = H5T_STD_I8LE();
public static final long H5T_STD_REF_DSETREG = H5T_STD_REF_DSETREG();
public static final long H5T_STD_REF_OBJ = H5T_STD_REF_OBJ();
+ public static final long H5T_STD_REF = H5T_STD_REF();
public static final long H5T_STD_U16BE = H5T_STD_U16BE();
public static final long H5T_STD_U16LE = H5T_STD_U16LE();
public static final long H5T_STD_U32BE = H5T_STD_U32BE();
@@ -1420,16 +1428,28 @@ public class HDF5Constants {
private static native final int H5PL_VOL_PLUGIN();
+ private static native final int H5R_ATTR();
+
private static native final int H5R_BADTYPE();
private static native final int H5R_DATASET_REGION();
+ private static native final int H5R_DATASET_REGION1();
+
+ private static native final int H5R_DATASET_REGION2();
+
private static native final int H5R_MAXTYPE();
+ private static native final int H5R_REF_BUF_SIZE();
+
private static native final int H5R_OBJ_REF_BUF_SIZE();
private static native final int H5R_OBJECT();
+ private static native final int H5R_OBJECT1();
+
+ private static native final int H5R_OBJECT2();
+
private static native final int H5S_ALL();
private static native final int H5S_MAX_RANK();
@@ -1818,6 +1838,8 @@ public class HDF5Constants {
private static native final long H5T_STD_REF_OBJ();
+ private static native final long H5T_STD_REF();
+
private static native final long H5T_STD_U16BE();
private static native final long H5T_STD_U16LE();
diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt
index a05921b..ac41bfb 100644
--- a/java/src/jni/CMakeLists.txt
+++ b/java/src/jni/CMakeLists.txt
@@ -77,7 +77,7 @@ set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
########### JNI libraries always must be built shared ###############
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};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_JAVA_JNI_SOURCE_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
)
TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED)
target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} PUBLIC ${HDF5_LIBSH_TARGET})
diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c
index 69adebd..05dc2ea 100644
--- a/java/src/jni/h5Constants.c
+++ b/java/src/jni/h5Constants.c
@@ -813,13 +813,25 @@ Java_hdf_hdf5lib_HDF5Constants_H5R_1BADTYPE(JNIEnv *env, jclass cls) { return H5
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5R_1MAXTYPE(JNIEnv *env, jclass cls) { return H5R_MAXTYPE; }
JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5R_1REF_1BUF_1SIZE(JNIEnv *env, jclass cls) { return H5R_REF_BUF_SIZE; }
+JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJ_1REF_1BUF_1SIZE(JNIEnv *env, jclass cls) { return H5R_OBJ_REF_BUF_SIZE; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5R_1DSET_1REG_1REF_1BUF_1SIZE(JNIEnv *env, jclass cls) { return H5R_DSET_REG_REF_BUF_SIZE; }
JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5R_1ATTR(JNIEnv *env, jclass cls) { return H5R_ATTR; }
+JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJECT(JNIEnv *env, jclass cls) { return H5R_OBJECT; }
JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJECT1(JNIEnv *env, jclass cls) { return H5R_OBJECT1; }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJECT2(JNIEnv *env, jclass cls) { return H5R_OBJECT2; }
+JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5R_1DATASET_1REGION(JNIEnv *env, jclass cls) { return H5R_DATASET_REGION; }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5R_1DATASET_1REGION1(JNIEnv *env, jclass cls) { return H5R_DATASET_REGION1; }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5R_1DATASET_1REGION2(JNIEnv *env, jclass cls) { return H5R_DATASET_REGION2; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5S_1ALL(JNIEnv *env, jclass cls) { return H5S_ALL; }
@@ -1211,6 +1223,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1REF_1DSETREG(JNIEnv *env, jclass cls) {
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1REF_1OBJ(JNIEnv *env, jclass cls) { return H5T_STD_REF_OBJ; }
JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1REF(JNIEnv *env, jclass cls) { return H5T_STD_REF; }
+JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U16BE(JNIEnv *env, jclass cls) { return H5T_STD_U16BE; }
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U16LE(JNIEnv *env, jclass cls) { return H5T_STD_U16LE; }
diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c
index 9f22665..85872b2 100644
--- a/java/src/jni/h5aImp.c
+++ b/java/src/jni/h5aImp.c
@@ -1304,7 +1304,7 @@ H5AwriteVL_asstr
{
const char *utf8 = NULL;
hsize_t dims[H5S_MAX_RANK];
- jstring jstr;
+ jstring jstr = NULL;
size_t typeSize;
size_t i;
hid_t sid = H5I_INVALID_HID;
@@ -1390,7 +1390,7 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref
(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
{
- hdset_reg_ref_t *ref_data = NULL;
+ H5R_ref_t *ref_data = NULL;
h5str_t h5str;
jstring jstr;
jsize i, n;
@@ -1405,7 +1405,7 @@ Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_reg_ref: buf length < 0");
}
- if (NULL == (ref_data = (hdset_reg_ref_t *) HDcalloc(1, (size_t)n * sizeof(hdset_reg_ref_t))))
+ if (NULL == (ref_data = (H5R_ref_t *) HDcalloc(1, (size_t)n * sizeof(H5R_ref_t))))
H5_JNI_FATAL_ERROR(ENVONLY, "H5Aread_reg_ref: failed to allocate read buffer");
if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, ref_data)) < 0)
@@ -1419,7 +1419,7 @@ Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref
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, (void*)&ref_data[i], 0, 0))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s)))
diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c
index b395189..352c047 100644
--- a/java/src/jni/h5dImp.c
+++ b/java/src/jni/h5dImp.c
@@ -1502,7 +1502,7 @@ H5DwriteVL_asstr
(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf)
{
const char *utf8 = NULL;
- jstring obj;
+ jstring obj = NULL;
hbool_t close_mem_space = FALSE;
size_t typeSize;
size_t i;
@@ -1630,7 +1630,7 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref
jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
{
- hdset_reg_ref_t *ref_data = NULL;
+ H5R_ref_t *ref_data = NULL;
h5str_t h5str;
jstring jstr;
jsize i, n;
@@ -1645,7 +1645,7 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_reg_ref: buf length < 0");
}
- if (NULL == (ref_data = (hdset_reg_ref_t *) HDcalloc(1, (size_t)n * sizeof(hdset_reg_ref_t))))
+ if (NULL == (ref_data = (H5R_ref_t *) HDcalloc(1, (size_t)n * sizeof(H5R_ref_t))))
H5_JNI_FATAL_ERROR(ENVONLY, "H5Dread_reg_ref: failed to allocate read buffer");
if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, xfer_plist_id, ref_data)) < 0)
@@ -1659,7 +1659,7 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref
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, (void*)&ref_data[i], 0, 0))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s)))
diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c
index 006707a..a627e65 100644
--- a/java/src/jni/h5pFAPLImp.c
+++ b/java/src/jni/h5pFAPLImp.c
@@ -425,6 +425,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs
CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5FD_hdfs_fapl_t", "(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;I)V", args, ret_obj);
#else
+ UNUSED(fapl_id);
+
H5_UNIMPLEMENTED(ENVONLY, "H5Pget_fapl_hdfs: not implemented");
#endif /* H5_HAVE_LIBHDFS */
@@ -532,6 +534,9 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs
if (H5Pset_fapl_hdfs((hid_t)fapl_id, &instance) < 0)
H5_LIBRARY_ERROR(ENVONLY);
#else
+ UNUSED(fapl_id);
+ UNUSED(fapl_config);
+
H5_UNIMPLEMENTED(ENVONLY, "H5Pset_fapl_hdfs: not implemented");
#endif /* H5_HAVE_LIBHDFS */
@@ -841,6 +846,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3
CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5FD_ros3_fapl_t", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", args, ret_obj);
#else
+ UNUSED(fapl_id);
+
H5_UNIMPLEMENTED(ENVONLY, "H5Pget_fapl_ros3: not implemented");
#endif /* H5_HAVE_ROS3_VFD */
@@ -939,6 +946,9 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3
if (H5Pset_fapl_ros3((hid_t)fapl_id, &instance) < 0)
H5_LIBRARY_ERROR(ENVONLY);
#else
+ UNUSED(fapl_id);
+ UNUSED(fapl_config);
+
H5_UNIMPLEMENTED(ENVONLY, "H5Pset_fapl_ros3: not implemented");
#endif /* H5_HAVE_ROS3_VFD */
diff --git a/java/src/jni/h5rImp.c b/java/src/jni/h5rImp.c
index 1a77fd3..21ee658 100644
--- a/java/src/jni/h5rImp.c
+++ b/java/src/jni/h5rImp.c
@@ -26,10 +26,596 @@ extern "C" {
#include "h5jni.h"
#include "h5rImp.h"
+
+/* H5R: HDF5 1.12 Reference API Functions */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rcreate_object
+ * Signature: (JLjava/lang/String;)[B
+ */
+JNIEXPORT jbyteArray JNICALL
+Java_hdf_hdf5lib_H5_H5Rcreate_1object
+ (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong aid)
+{
+ const char *refName = NULL;
+ jbyteArray ref = NULL;
+ jbyte *refBuf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcreate_object: name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, refName, NULL, "H5Rcreate_object: reference name not pinned");
+
+ if (NULL == (refBuf = (unsigned char *) HDcalloc((size_t) 1, H5R_REF_BUF_SIZE)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Rcreate_object: failed to allocate reference buffer");
+
+ if ((status = H5Rcreate_object((hid_t)loc_id, refName, (hid_t)aid, (const H5R_ref_t *)refBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (ref = ENVPTR->NewByteArray(ENVONLY, (jsize)H5R_REF_BUF_SIZE)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetByteArrayRegion(ENVONLY, ref, 0, (jsize)H5R_REF_BUF_SIZE, (jbyte *)refBuf);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (refName)
+ UNPIN_JAVA_STRING(ENVONLY, name, refName);
+ if (refBuf)
+ HDfree(refBuf);
+
+ return ref;
+} /* end Java_hdf_hdf5lib_H5_H5Rcreate_1object */
+
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rcreate_region
+ * Signature: (JLjava/lang/String;J)[B
+ */
+JNIEXPORT jbyteArray JNICALL
+Java_hdf_hdf5lib_H5_H5Rcreate_1region
+ (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong space_id, jlong aid)
+{
+ const char *refName = NULL;
+ jbyteArray ref = NULL;
+ jbyte *refBuf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcreate_region: name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, refName, NULL, "H5Rcreate_region: reference name not pinned");
+
+ if (NULL == (refBuf = (unsigned char *) HDcalloc((size_t) 1, H5R_REF_BUF_SIZE)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Rcreate_region: failed to allocate reference buffer");
+
+ if ((status = H5Rcreate_region((hid_t)loc_id, refName, space_id, (hid_t)aid, (const H5R_ref_t *)refBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (ref = ENVPTR->NewByteArray(ENVONLY, (jsize)H5R_REF_BUF_SIZE)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetByteArrayRegion(ENVONLY, ref, 0, (jsize)H5R_REF_BUF_SIZE, (jbyte *)refBuf);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (refName)
+ UNPIN_JAVA_STRING(ENVONLY, name, refName);
+ if (refBuf)
+ HDfree(refBuf);
+
+ return ref;
+} /* end Java_hdf_hdf5lib_H5_H5Rcreate_1region */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rcreate_attr
+ * Signature: (JLjava/lang/String;Ljava/lang/String;)[B
+ */
+JNIEXPORT jbyteArray JNICALL
+Java_hdf_hdf5lib_H5_H5Rcreate_1attr
+ (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jstring attr_name, jlong aid)
+{
+ const char *refName = NULL;
+ const char *attrName = NULL;
+ jbyteArray ref = NULL;
+ jbyte *refBuf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcreate_attr: name is NULL");
+ if (NULL == attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcreate_attr: attribute name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Rcreate_attr: attribute name not pinned");
+
+ PIN_JAVA_STRING(ENVONLY, name, refName, NULL, "H5Rcreate_attr: reference name not pinned");
+
+ if (NULL == (refBuf = (unsigned char *) HDcalloc((size_t) 1, H5R_REF_BUF_SIZE)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Rcreate_attr: failed to allocate reference buffer");
+
+ if ((status = H5Rcreate_attr((hid_t)loc_id, refName, attrName, (hid_t)aid, (const H5R_ref_t *)refBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (ref = ENVPTR->NewByteArray(ENVONLY, (jsize)H5R_REF_BUF_SIZE)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetByteArrayRegion(ENVONLY, ref, 0, (jsize)H5R_REF_BUF_SIZE, (jbyte *)refBuf);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, attr_name, attrName);
+ if (refName)
+ UNPIN_JAVA_STRING(ENVONLY, name, refName);
+ if (refBuf)
+ HDfree(refBuf);
+
+ return ref;
+} /* end Java_hdf_hdf5lib_H5_H5Rcreate_1attr */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rdestroy
+ * Signature: ([B)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Rdestroy
+ (JNIEnv *env, jclass clss, jbyteArray ref)
+{
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jsize refBufLen;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rdestroy: reference is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rdestroy: reference array length < 0");
+ }
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rdestroy: reference buffer not pinned");
+
+ if ((status = H5Rdestroy((const H5R_ref_t *)refBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (status < 0) ? JNI_ABORT : 0);
+} /* end Java_hdf_hdf5lib_H5_H5Rdestroy */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rget_type
+ * Signature: ([B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Rget_1type
+ (JNIEnv *env, jclass clss, jbyteArray ref)
+{
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jsize refBufLen;
+ H5R_type_t ref_type = -1;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_type: reference is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_type: reference array length < 0");
+ }
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_type: reference buffer not pinned");
+
+ if ((ref_type = H5Rget_type((const H5R_ref_t *)refBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (ref_type < 0) ? JNI_ABORT : 0);
+
+ return (jint)ref_type;
+} /* end Java_hdf_hdf5lib_H5_H5Rget_1type */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Requal
+ * Signature: ([B[B)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Requal
+ (JNIEnv *env, jclass clss, jbyteArray ref1, jbyteArray ref2)
+{
+ jboolean isCopy;
+ jbyte *refBuf1 = NULL;
+ jbyte *refBuf2 = NULL;
+ jsize refBufLen;
+ htri_t bval = JNI_FALSE;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == ref1)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Requal: reference1 is NULL");
+
+ if (NULL == ref2)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Requal: reference2 is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref1)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Requal: reference1 array length < 0");
+ }
+
+ PIN_BYTE_ARRAY(ENVONLY, ref1, refBuf1, &isCopy, "H5Requal: reference1 buffer not pinned");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref2)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Requal: reference2 array length < 0");
+ }
+
+ PIN_BYTE_ARRAY(ENVONLY, ref2, refBuf2, &isCopy, "H5Requal: reference2 buffer not pinned");
+
+ if ((bval = H5Requal((const H5R_ref_t *)refBuf1, (const H5R_ref_t *)refBuf2)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ status = bval;
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ if (refBuf2)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref2, refBuf2, (status < 0) ? JNI_ABORT : 0);
+ if (refBuf1)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref1, refBuf1, (status < 0) ? JNI_ABORT : 0);
+
+ return (jboolean)bval;
+} /* end Java_hdf_hdf5lib_H5_H5Requal */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rcopy
+ * Signature: ([B)[B
+ */
+JNIEXPORT jbyteArray JNICALL
+Java_hdf_hdf5lib_H5_H5Rcopy
+ (JNIEnv *env, jclass clss, jbyteArray src_ref)
+{
+ jboolean isCopy;
+ jbyte *src_refBuf = NULL;
+ jsize refBufLen;
+ jbyteArray dst_ref = NULL;
+ jbyte *dst_refBuf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == src_ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcopy: src reference is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, src_ref)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rcopy: src reference array length < 0");
+ }
+
+ PIN_BYTE_ARRAY(ENVONLY, src_ref, src_refBuf, &isCopy, "H5Rcopy: src reference buffer not pinned");
+
+ if (NULL == (dst_refBuf = (unsigned char *) HDcalloc((size_t) 1, H5R_REF_BUF_SIZE)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Rcreate_attr: failed to allocate dst reference buffer");
+
+ if ((status = H5Rcopy((const H5R_ref_t *)src_refBuf, (const H5R_ref_t *)dst_refBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (dst_ref = ENVPTR->NewByteArray(ENVONLY, (jsize)H5R_REF_BUF_SIZE)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetByteArrayRegion(ENVONLY, dst_ref, 0, (jsize)H5R_REF_BUF_SIZE, (jbyte *)dst_refBuf);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (src_refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, src_ref, src_refBuf, (status < 0) ? JNI_ABORT : 0);
+ if (dst_refBuf)
+ HDfree(dst_refBuf);
+
+ return dst_ref;
+} /* end Java_hdf_hdf5lib_H5_H5Rcopy */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Ropen_object
+ * Signature: ([BJJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Ropen_1object
+ (JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id, jlong oapl_id)
+{
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jsize refBufLen;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ropen_object: reference is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Ropen_object: reference array length < 0");
+ }
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Ropen_object: reference buffer not pinned");
+
+ if ((retVal = H5Ropen_object((const H5R_ref_t *)refBuf, (hid_t)rapl_id, (hid_t)oapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jlong)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Ropen_1object */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Ropen_region
+ * Signature: ([BJJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Ropen_1region
+ (JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id, jlong oapl_id)
+{
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jsize refBufLen;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ropen_region: reference is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Ropen_region: reference array length < 0");
+ }
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Ropen_region: reference buffer not pinned");
+
+ if ((retVal = H5Ropen_region((const H5R_ref_t *)refBuf, (hid_t)rapl_id, (hid_t)oapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jlong)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Ropen_1region */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Ropen_attr
+ * Signature: ([BJJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Ropen_1attr
+ (JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id, jlong aapl_id)
+{
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jsize refBufLen;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ropen_attr: reference is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Ropen_attr: reference array length < 0");
+ }
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Ropen_attr: reference buffer not pinned");
+
+ if ((retVal = H5Ropen_attr((const H5R_ref_t *)refBuf, (hid_t)rapl_id, (hid_t)aapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jlong)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Ropen_1attr */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rget_obj_type3
+ * Signature: ([BJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Rget_1obj_1type3
+ (JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id)
+{
+ H5O_type_t object_info = -1;
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ int retVal = -1;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_obj_type3: reference buffer is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_obj_type3: reference buffer not pinned");
+
+ if ((retVal = H5Rget_obj_type3((const H5R_ref_t *)refBuf, (hid_t)rapl_id, &object_info)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (retVal >= 0)
+ retVal = object_info;
+
+done:
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Rget_1obj_1type3 */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rget_file_name
+ * Signature: ([B)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Rget_1file_1name
+ (JNIEnv *env, jclass clss, jbyteArray ref)
+{
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jstring str = NULL;
+ ssize_t buf_size;
+ ssize_t check_size = -1;
+ char *namePtr = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_file_name: reference buffer is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_file_name: reference buffer not pinned");
+
+ /* Get the length of the name */
+ if ((buf_size = H5Rget_file_name((const H5R_ref_t *)refBuf, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Rget_file_name: malloc failed");
+
+ if ((check_size = H5Rget_file_name((const H5R_ref_t *)refBuf, namePtr, (size_t)buf_size + 1)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ namePtr[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, namePtr)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (namePtr)
+ HDfree(namePtr);
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (check_size < 0) ? JNI_ABORT : 0);
+
+ return str;
+} /* end Java_hdf_hdf5lib_H5_H5Rget_1file_1name */
+
/*
- * Pointer to the JNI's Virtual Machine; used for callback functions.
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rget_obj_name
+ * Signature: ([BJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Rget_1obj_1name
+ (JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id)
+{
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jstring str = NULL;
+ ssize_t buf_size;
+ ssize_t check_size = -1;
+ char *namePtr = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_obj_name: reference buffer is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_obj_name: reference buffer not pinned");
+
+ /* Get the length of the name */
+ if ((buf_size = H5Rget_obj_name((const H5R_ref_t *)refBuf, (hid_t)rapl_id, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Rget_obj_name: malloc failed");
+
+ if ((check_size = H5Rget_obj_name((const H5R_ref_t *)refBuf, (hid_t)rapl_id, namePtr, (size_t)buf_size + 1)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ namePtr[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, namePtr)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (namePtr)
+ HDfree(namePtr);
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (check_size < 0) ? JNI_ABORT : 0);
+
+ return str;
+} /* end Java_hdf_hdf5lib_H5_H5Rget_1obj_1name */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rget_attr_name
+ * Signature: ([B)Ljava/lang/String;
*/
-/* extern JavaVM *jvm; */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Rget_1attr_1name
+ (JNIEnv *env, jclass clss, jbyteArray ref)
+{
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jstring str = NULL;
+ ssize_t buf_size;
+ ssize_t check_size = -1;
+ char *namePtr = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_attr_name: reference buffer is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_attr_name: reference buffer not pinned");
+
+ /* Get the length of the name */
+ if ((buf_size = H5Rget_attr_name((const H5R_ref_t *)refBuf, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Rget_attr_name: malloc failed");
+
+ if ((check_size = H5Rget_attr_name((const H5R_ref_t *)refBuf, namePtr, (size_t)buf_size + 1)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ namePtr[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, namePtr)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (namePtr)
+ HDfree(namePtr);
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (check_size < 0) ? JNI_ABORT : 0);
+
+ return str;
+} /* end Java_hdf_hdf5lib_H5_H5Rget_1attr_1name */
+
+/* H5R: HDF5 1.8 Reference API Functions */
/*
* Class: hdf_hdf5lib_H5
diff --git a/java/src/jni/h5rImp.h b/java/src/jni/h5rImp.h
index e28329b..3bdb266 100644
--- a/java/src/jni/h5rImp.h
+++ b/java/src/jni/h5rImp.h
@@ -21,6 +21,136 @@
extern "C" {
#endif /* __cplusplus */
+/* H5R: HDF5 1.12 Reference API Functions */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rcreate_object
+ * Signature: (JLjava/lang/String;)[B
+ */
+JNIEXPORT jbyteArray JNICALL
+Java_hdf_hdf5lib_H5_H5Rcreate_1object
+ (JNIEnv *, jclass, jlong, jstring, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rcreate_region
+ * Signature: (JLjava/lang/String;J)[B
+ */
+JNIEXPORT jbyteArray JNICALL
+Java_hdf_hdf5lib_H5_H5Rcreate_1region
+ (JNIEnv *, jclass, jlong, jstring, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rcreate_attr
+ * Signature: (JLjava/lang/String;Ljava/lang/String;)[B
+ */
+JNIEXPORT jbyteArray JNICALL
+Java_hdf_hdf5lib_H5_H5Rcreate_1attr
+ (JNIEnv *, jclass, jlong, jstring, jstring, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rdestroy
+ * Signature: ([B)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Rdestroy
+ (JNIEnv *, jclass, jbyteArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rget_type
+ * Signature: ([B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Rget_1type
+ (JNIEnv *, jclass, jbyteArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Requal
+ * Signature: ([B[B)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Requal
+ (JNIEnv *, jclass, jbyteArray, jbyteArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rcopy
+ * Signature: ([B)[B
+ */
+JNIEXPORT jbyteArray JNICALL
+Java_hdf_hdf5lib_H5_H5Rcopy
+ (JNIEnv *, jclass, jbyteArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Ropen_object
+ * Signature: ([BJJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Ropen_1object
+ (JNIEnv *, jclass, jbyteArray, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Ropen_region
+ * Signature: ([BJJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Ropen_1region
+ (JNIEnv *, jclass, jbyteArray, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Ropen_attr
+ * Signature: ([BJJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Ropen_1attr
+ (JNIEnv *, jclass, jbyteArray, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rget_obj_type3
+ * Signature: ([BJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Rget_1obj_1type3
+ (JNIEnv *, jclass, jbyteArray, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rget_file_name
+ * Signature: ([B)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Rget_1file_1name
+ (JNIEnv *, jclass, jbyteArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rget_obj_name
+ * Signature: ([BJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Rget_1obj_1name
+ (JNIEnv *, jclass, jbyteArray, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rget_attr_name
+ * Signature: ([B)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Rget_1attr_1name
+ (JNIEnv *, jclass, jbyteArray);
+
+/* H5R: HDF5 1.8 Reference API Functions */
+
/*
* Class: hdf_hdf5lib_H5
* Method: H5Rcreate
diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c
index eedd42e..c703e90 100644
--- a/java/src/jni/h5sImp.c
+++ b/java/src/jni/h5sImp.c
@@ -162,9 +162,9 @@ done:
} /* end Java_hdf_hdf5lib_H5__1H5Scopy */
#ifdef notdef
-// 10/28/99 -- added code to copy the array -- this is not used,
-// but serves as a reminder in case we try to implement this in
-// the future....
+/* 10/28/99 -- added code to copy the array -- this is not used,
+ * but serves as a reminder in case we try to implement this in
+ */ the future....
/*
* Note: the argument coord is actually long coord[][], which has been
* flattened by the caller.
diff --git a/java/src/jni/h5sImp.h b/java/src/jni/h5sImp.h
index 141e504..87661e3 100644
--- a/java/src/jni/h5sImp.h
+++ b/java/src/jni/h5sImp.h
@@ -49,9 +49,9 @@ Java_hdf_hdf5lib_H5__1H5Scopy
(JNIEnv *, jclass, jlong);
#ifdef notdef
-// 10/28/99 -- added code to copy the array -- this is not used,
-// but serves as a reminder in case we try to implement this in
-// the future....
+/* 10/28/99 -- added code to copy the array -- this is not used,
+ * but serves as a reminder in case we try to implement this in
+ */ the future....
/*
* Note: the argument coord is actually long coord[][], which has been
* flattened by the caller.
diff --git a/java/src/jni/h5tImp.c b/java/src/jni/h5tImp.c
index 3302b7d..1adff3c 100644
--- a/java/src/jni/h5tImp.c
+++ b/java/src/jni/h5tImp.c
@@ -981,9 +981,9 @@ done:
/*
* Class: hdf_hdf5lib_H5
* Method: H5Treclaim
- * Signature: (JJJ[B)I
+ * Signature: (JJJ[B)V
*/
-JNIEXPORT jint JNICALL
+JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Treclaim
(JNIEnv *env, jclass clss, jlong type_id, jlong space_id,
jlong xfer_plist_id, jbyteArray buf)
@@ -1005,8 +1005,6 @@ Java_hdf_hdf5lib_H5_H5Treclaim
done:
if (pinBuf)
UNPIN_BYTE_ARRAY(ENVONLY, buf, pinBuf, (status < 0) ? JNI_ABORT : 0);
-
- return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Treclaim */
/*
diff --git a/java/src/jni/h5tImp.h b/java/src/jni/h5tImp.h
index a63969b..78e4561 100644
--- a/java/src/jni/h5tImp.h
+++ b/java/src/jni/h5tImp.h
@@ -402,9 +402,9 @@ Java_hdf_hdf5lib_H5_H5Tpack
/*
* Class: hdf_hdf5lib_H5
* Method: H5Treclaim
- * Signature: (JJJ[B)I
+ * Signature: (JJJ[B)V
*/
-JNIEXPORT jint JNICALL
+JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Treclaim
(JNIEnv*, jclass, jlong, jlong, jlong, jbyteArray);
diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c
index 700f75f..5c82edc 100644
--- a/java/src/jni/h5util.c
+++ b/java/src/jni/h5util.c
@@ -71,6 +71,12 @@ static int render_bin_output_region_data_points(FILE *stream, hid_t region_s
static int render_bin_output_region_points(FILE *stream, hid_t region_space,
hid_t region_id, hid_t container);
+/* Strings for output */
+#define H5_TOOLS_GROUP "GROUP"
+#define H5_TOOLS_DATASET "DATASET"
+#define H5_TOOLS_DATATYPE "DATATYPE"
+#define H5_TOOLS_ATTRIBUTE "ATTRIBUTE"
+
/** frees memory held by array of strings */
void
h5str_array_free
@@ -217,7 +223,7 @@ h5str_convert
switch (typeSize) {
case sizeof(float):
{
- float tmp_float = 0.0;
+ float tmp_float = 0.0f;
sscanf(token, "%f", &tmp_float);
HDmemcpy(cptr, &tmp_float, sizeof(float));
@@ -625,6 +631,69 @@ done:
return retVal;
} /* end h5str_convert */
+/*-------------------------------------------------------------------------
+ * Function: h5str_sprint_reference
+ *
+ * Purpose: Object reference -- show the name of the referenced object.
+ *
+ * Return: Nothing
+ *-------------------------------------------------------------------------
+ */
+void
+h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, hid_t container, void *ref_p)
+{
+ ssize_t buf_size;
+ char *ref_name = NULL;
+ const H5R_ref_t *ref_vp = (H5R_ref_t *)ref_p;
+
+ UNUSED(container);
+
+ if (!h5str_append(out_str, " \""))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ buf_size = H5Rget_file_name(ref_vp, NULL, 0);
+ if (buf_size) {
+ ref_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1);
+ if (H5Rget_file_name(ref_vp, ref_name, buf_size + 1) >= 0) {
+ ref_name[buf_size] = '\0';
+ if (!h5str_append(out_str, ref_name))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+ HDfree(ref_name);
+ ref_name = NULL;
+ }
+
+ buf_size = H5Rget_obj_name(ref_vp, H5P_DEFAULT, NULL, 0);
+ if (buf_size) {
+ ref_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1);
+ if (H5Rget_obj_name(ref_vp, H5P_DEFAULT, ref_name, buf_size + 1) >= 0) {
+ ref_name[buf_size] = '\0';
+ if (!h5str_append(out_str, ref_name))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+ HDfree(ref_name);
+ ref_name = NULL;
+ }
+
+ if (H5Rget_type(ref_vp) == H5R_ATTR) {
+ buf_size = H5Rget_attr_name(ref_vp, NULL, 0);
+ if (buf_size) {
+ ref_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1);
+ if (H5Rget_attr_name(ref_vp, ref_name, buf_size + 1) >= 0) {
+ ref_name[buf_size] = '\0';
+ if (!h5str_append(out_str, ref_name))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+ HDfree(ref_name);
+ ref_name = NULL;
+ }
+ }
+ if (!h5str_append(out_str, "\""))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+done:
+ if (ref_name)
+ HDfree(ref_name);
+}
+
/*
* Prints the value of a data point into a string.
*
@@ -639,8 +708,11 @@ h5str_sprintf
unsigned char *ucptr = (unsigned char *) in_buf;
static char fmt_llong[8], fmt_ullong[8];
H5T_class_t tclass = H5T_NO_CLASS;
+ H5T_str_t pad;
size_t typeSize = 0;
+ H5T_sign_t nsign = H5T_SGN_ERROR;
hid_t mtid = H5I_INVALID_HID;
+ hid_t obj = H5I_INVALID_HID;
char *cptr = (char *) in_buf;
char *this_str = NULL;
int n;
@@ -655,12 +727,14 @@ h5str_sprintf
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]) {
- if (HDsprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH) < 0)
+ if (HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%%sd", H5_PRINTF_LL_WIDTH) < 0)
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: sprintf failure");
- if (HDsprintf(fmt_ullong, "%%%su", H5_PRINTF_LL_WIDTH) < 0)
+ if (HDsnprintf(fmt_ullong, sizeof(fmt_ullong), "%%%su", H5_PRINTF_LL_WIDTH) < 0)
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: sprintf failure");
} /* end if */
@@ -670,7 +744,7 @@ h5str_sprintf
switch (typeSize) {
case sizeof(float):
{
- float tmp_float = 0.0;
+ float tmp_float = 0.0f;
HDmemcpy(&tmp_float, cptr, sizeof(float));
@@ -724,27 +798,28 @@ h5str_sprintf
case H5T_STRING:
{
- htri_t is_variable;
- char *tmp_str;
-
- typeSize = 0;
+ htri_t is_variable;
+ char *tmp_str;
if ((is_variable = H5Tis_variable_str(tid)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if (is_variable) {
- if (NULL != (tmp_str = *(char **) in_buf))
+ /* cp_vp is the pointer into the struct where a `char*' is stored. So we have
+ * to dereference the pointer to get the `char*' to pass to HDstrlen(). */
+ tmp_str = *(char **)in_buf;
+ if (NULL != tmp_str)
typeSize = HDstrlen(tmp_str);
}
else {
tmp_str = cptr;
}
+ pad = H5Tget_strpad(tid);
/* Check for NULL pointer for string */
if (!tmp_str) {
if (NULL == (this_str = (char *) HDmalloc(5)))
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
-
HDstrncpy(this_str, "NULL", 5);
}
else {
@@ -762,7 +837,6 @@ h5str_sprintf
case H5T_INTEGER:
{
- H5T_sign_t nsign = H5T_SGN_ERROR;
if (H5T_SGN_ERROR == (nsign = H5Tget_sign(tid)))
H5_LIBRARY_ERROR(ENVONLY);
@@ -779,7 +853,7 @@ h5str_sprintf
if (NULL == (this_str = (char *) HDmalloc(7)))
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
- if (HDsprintf(this_str, "%u", tmp_uchar) < 0)
+ if (HDsprintf(this_str, "%hhu", tmp_uchar) < 0)
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
}
else {
@@ -806,7 +880,7 @@ h5str_sprintf
if (NULL == (this_str = (char *) HDmalloc(9)))
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
- if (HDsprintf(this_str, "%u", tmp_ushort) < 0)
+ if (HDsprintf(this_str, "%hu", tmp_ushort) < 0)
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
}
else {
@@ -815,7 +889,7 @@ h5str_sprintf
if (NULL == (this_str = (char *) HDmalloc(9)))
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
- if (HDsprintf(this_str, "%d", tmp_short) < 0)
+ if (HDsprintf(this_str, "%hd", tmp_short) < 0)
H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
}
@@ -984,96 +1058,122 @@ h5str_sprintf
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)
+ if (H5Tequal(tid, H5T_STD_REF)) {
+ H5O_type_t obj_type = -1; /* Object type */
+ H5R_type_t ref_type; /* Reference type */
+ const H5R_ref_t *ref_vp = (H5R_ref_t *)cptr;
+
+ ref_type = H5Rget_type(ref_vp);
+ H5Rget_obj_type3(ref_vp, H5P_DEFAULT, &obj_type);
+ switch (ref_type) {
+ case H5R_OBJECT1:
+ {
+ /* Object references -- show the type and OID of the referenced object. */
+ H5O_info_t oi;
+
+ if((obj = H5Ropen_object(ref_vp, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ H5Oget_info2(obj, &oi, H5O_INFO_BASIC);
+ if(H5Oclose(obj) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+ else
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"))
+ if (NULL == (this_str = (char *) HDmalloc(14)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+ if (HDsprintf(this_str, "%u-", (unsigned) oi.type) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ if (!h5str_append(out_str, this_str))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ HDfree(this_str);
+ this_str = NULL;
+
+ switch (obj_type) {
+ case H5O_TYPE_GROUP:
+ if (!h5str_append(out_str, H5_TOOLS_GROUP))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ break;
+
+ case H5O_TYPE_DATASET:
+ if (!h5str_append(out_str, H5_TOOLS_DATASET))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ break;
+
+ case H5O_TYPE_NAMED_DATATYPE:
+ if (!h5str_append(out_str, H5_TOOLS_DATATYPE))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ break;
+
+ case H5O_TYPE_MAP:
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ break;
+ } /* end switch */
+ H5Oclose(obj);
+ h5str_sprint_reference(ENVONLY, out_str, container, ref_vp);
+
+ /* Print OID */
+ if (NULL == (this_str = (char *) HDmalloc(64)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+ if (HDsprintf(this_str, "%lu:"H5_PRINTF_HADDR_FMT" ", oi.fileno, oi.addr) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
- if (h5str_dump_region_points(ENVONLY, out_str, region, region_obj) < 0)
+ break;
+ case H5R_DATASET_REGION1:
+ if (!h5str_append(out_str, H5_TOOLS_DATASET))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- }
- else {
- if (!h5str_append(out_str, " REGION_TYPE BLOCK"))
+ h5str_sprint_reference(ENVONLY, out_str, container, (void*)cptr);
+ break;
+ case H5R_OBJECT2:
+ switch (obj_type) {
+ case H5O_TYPE_GROUP:
+ if (!h5str_append(out_str, H5_TOOLS_GROUP))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ break;
+
+ case H5O_TYPE_DATASET:
+ if (!h5str_append(out_str, H5_TOOLS_DATASET))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ break;
+
+ case H5O_TYPE_NAMED_DATATYPE:
+ if (!h5str_append(out_str, H5_TOOLS_DATATYPE))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ break;
+
+ case H5O_TYPE_MAP:
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ break;
+ } /* end switch */
+ h5str_sprint_reference(ENVONLY, out_str, container, (void*)cptr);
+ break;
+ case H5R_DATASET_REGION2:
+ if (!h5str_append(out_str, H5_TOOLS_DATASET))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
-
- if (h5str_dump_region_blocks(ENVONLY, out_str, region, region_obj) < 0)
+ h5str_sprint_reference(ENVONLY, out_str, container, (void*)cptr);
+ break;
+ case H5R_ATTR:
+ if (!h5str_append(out_str, H5_TOOLS_ATTRIBUTE))
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;
+ h5str_sprint_reference(ENVONLY, out_str, container, (void*)cptr);
+ break;
+ case H5R_BADTYPE:
+ case H5R_MAXTYPE:
+ default:
+ break;
+ } /* end switch */
}
- else if (H5R_OBJ_REF_BUF_SIZE == typeSize) {
- H5O_info_t oi;
- hid_t obj = H5I_INVALID_HID;
-
- /*
- * Object references -- show the type and OID of the referenced
- * object.
- */
-
- if (NULL == (this_str = (char *) HDmalloc(64)))
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
-
- if ((obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, cptr)) < 0)
- H5_LIBRARY_ERROR(ENVONLY);
-
- if (H5Oget_info2(obj, &oi, H5O_INFO_ALL) < 0)
- H5_LIBRARY_ERROR(ENVONLY);
-
- /* Print object data and close object */
- if (HDsprintf(this_str, "%u-%lu", (unsigned) oi.type, oi.addr) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
-
- if (H5Oclose(obj) < 0)
- H5_LIBRARY_ERROR(ENVONLY);
- obj = H5I_INVALID_HID;
+ else if (H5Tequal(tid, H5T_STD_REF_DSETREG)) {
+ /* (H5R_DSET_REG_REF_BUF_SIZE == typeSize) */
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+ else if (H5Tequal(tid, H5T_STD_REF_OBJ)) {
+ /* (H5R_OBJ_REF_BUF_SIZE == typeSize) */
+ H5_LIBRARY_ERROR(ENVONLY);
}
break;
@@ -2204,20 +2304,28 @@ h5str_render_bin_output
case H5T_REFERENCE:
{
- if (H5Tequal(tid, H5T_STD_REF_DSETREG)) {
+ if (H5Tequal(tid, H5T_STD_REF)) {
+ 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++) {
mem = ((unsigned char*)_mem) + block_index * size;
-
- if ((region_id = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, mem)) < 0)
+ if((region_id = H5Ropen_object((const H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) < 0)
continue;
-
- if ((region_space = H5Rget_region(container, H5R_DATASET_REGION, mem)) < 0) {
+ else {
+ if((region_space = H5Ropen_region((const H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if (!h5str_is_zero(mem, H5Tget_size(H5T_STD_REF))) {
+ 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
+ ret_value = render_bin_output_region_blocks(stream, region_space, region_id, container);
+ }
+ H5Sclose(region_space);
+ } /* end if (region_space >= 0) */
H5Dclose(region_id);
- continue;
}
if ((region_type = H5Sget_select_type(region_space)) < 0) {
@@ -2225,19 +2333,13 @@ h5str_render_bin_output
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);
- H5Dclose(region_id);
-
if (ret_value < 0)
break;
}
}
+ else if (H5Tequal(tid, H5T_STD_REF_DSETREG)) {
+ ;
+ }
else if (H5Tequal(tid, H5T_STD_REF_OBJ)) {
;
}
@@ -3091,15 +3193,15 @@ done:
} /* end Java_hdf_hdf5lib_H5_H5Dcopy */
/*
-/////////////////////////////////////////////////////////////////////////////////
-//
-//
-// Add these methods so that we don't need to call H5Gget_objtype_by_idx
-// in a loop to get information for all the objects in a group, which takes
-// a lot of time to finish if the number of objects is more than 10,000
-//
-/////////////////////////////////////////////////////////////////////////////////
-*/
+ * /////////////////////////////////////////////////////////////////////////////////
+ * //
+ * //
+ * // Add these methods so that we don't need to call H5Gget_objtype_by_idx
+ * // in a loop to get information for all the objects in a group, which takes
+ * // a lot of time to finish if the number of objects is more than 10,000
+ * //
+ * /////////////////////////////////////////////////////////////////////////////////
+ */
#ifdef __cplusplus
herr_t obj_info_all(hid_t g_id, const char *name, const H5L_info_t *linfo, void *op_data);
diff --git a/java/src/jni/h5util.h b/java/src/jni/h5util.h
index e5f0d0b..c26cd5d 100644
--- a/java/src/jni/h5util.h
+++ b/java/src/jni/h5util.h
@@ -40,6 +40,7 @@ extern void h5str_free(h5str_t *str);
extern void h5str_resize(h5str_t *str, size_t new_len);
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 void h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, hid_t container, void *ref_p);
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);
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);
diff --git a/java/src/jni/nativeData.c b/java/src/jni/nativeData.c
index 947f843..ad01b01 100644
--- a/java/src/jni/nativeData.c
+++ b/java/src/jni/nativeData.c
@@ -101,7 +101,7 @@ JNIEXPORT jfloatArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B
(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */
{
- jfloatArray rarray;
+ jfloatArray rarray = NULL;
jboolean bb;
jfloat *farray = NULL;
jfloat *iap = NULL;
@@ -152,7 +152,7 @@ JNIEXPORT jshortArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B
(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */
{
- jshortArray rarray;
+ jshortArray rarray = NULL;
jboolean bb;
jshort *sarray = NULL;
jshort *iap = NULL;
@@ -203,7 +203,7 @@ JNIEXPORT jlongArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B
(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */
{
- jlongArray rarray;
+ jlongArray rarray = NULL;
jboolean bb;
jlong *larray = NULL;
jlong *iap = NULL;
@@ -254,7 +254,7 @@ JNIEXPORT jdoubleArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B
(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */
{
- jdoubleArray rarray;
+ jdoubleArray rarray = NULL;
jboolean bb;
jdouble *darray = NULL;
jdouble *iap = NULL;
@@ -305,7 +305,7 @@ JNIEXPORT jintArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToInt__II_3B
(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */
{
- jintArray rarray;
+ jintArray rarray = NULL;
jboolean bb;
jint *iarray = NULL;
jint *iap = NULL;
@@ -357,7 +357,7 @@ JNIEXPORT jshortArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToShort__II_3B
(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */
{
- jshortArray rarray;
+ jshortArray rarray = NULL;
jboolean bb;
jshort *sarray = NULL;
jshort *iap = NULL;
@@ -409,7 +409,7 @@ JNIEXPORT jfloatArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToFloat__II_3B
(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */
{
- jfloatArray rarray;
+ jfloatArray rarray = NULL;
jboolean bb;
jfloat *farray = NULL;
jfloat *iap = NULL;
@@ -461,7 +461,7 @@ JNIEXPORT jlongArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToLong__II_3B
(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */
{
- jlongArray rarray;
+ jlongArray rarray = NULL;
jboolean bb;
jlong *larray = NULL;
jlong *iap = NULL;
@@ -513,7 +513,7 @@ JNIEXPORT jdoubleArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToDouble__II_3B
(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */
{
- jdoubleArray rarray;
+ jdoubleArray rarray = NULL;
jboolean bb;
jdouble *darray = NULL;
jdouble *iap = NULL;
@@ -565,7 +565,7 @@ JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_intToByte__II_3I
(JNIEnv *env, jclass clss, jint start, jint len, jintArray idata) /* IN: array of int */
{
- jbyteArray rarray;
+ jbyteArray rarray = NULL;
jboolean bb;
jbyte *barray = NULL;
jbyte *bap = NULL;
@@ -627,7 +627,7 @@ JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_shortToByte__II_3S
(JNIEnv *env, jclass clss, jint start, jint len, jshortArray sdata) /* IN: array of short */
{
- jbyteArray rarray;
+ jbyteArray rarray = NULL;
jboolean bb;
jshort *ip = NULL;
jshort *sarr = NULL;
@@ -689,7 +689,7 @@ JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_floatToByte__II_3F
(JNIEnv *env, jclass clss, jint start, jint len, jfloatArray fdata) /* IN: array of float */
{
- jbyteArray rarray;
+ jbyteArray rarray = NULL;
jboolean bb;
jfloat *ip = NULL;
jfloat *farr = NULL;
@@ -751,7 +751,7 @@ JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_doubleToByte__II_3D
(JNIEnv *env, jclass clss, jint start, jint len, jdoubleArray ddata) /* IN: array of double */
{
- jbyteArray rarray;
+ jbyteArray rarray = NULL;
jboolean bb;
jdouble *ip = NULL;
jdouble *darr = NULL;
@@ -813,7 +813,7 @@ JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_longToByte__II_3J
(JNIEnv *env, jclass clss, jint start, jint len, jlongArray ldata) /* IN: array of long */
{
- jbyteArray rarray;
+ jbyteArray rarray = NULL;
jboolean bb;
jlong *ip = NULL;
jlong *larr = NULL;
@@ -875,7 +875,7 @@ JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_intToByte__I
(JNIEnv *env, jclass clss, jint idata) /* IN: int */
{
- jbyteArray rarray;
+ jbyteArray rarray = NULL;
jboolean bb;
jbyte *barray = NULL;
jbyte *bap = NULL;
@@ -911,7 +911,7 @@ JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_floatToByte__F
(JNIEnv *env, jclass clss, jfloat fdata) /* IN: float */
{
- jbyteArray rarray;
+ jbyteArray rarray = NULL;
jboolean bb;
jbyte *barray = NULL;
jbyte *bap = NULL;
@@ -947,7 +947,7 @@ JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_shortToByte__S
(JNIEnv *env, jclass clss, jshort sdata) /* IN: short */
{
- jbyteArray rarray;
+ jbyteArray rarray = NULL;
jboolean bb;
jbyte *barray = NULL;
jbyte *bap = NULL;
@@ -983,7 +983,7 @@ JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_doubleToByte__D
(JNIEnv *env, jclass clss, jdouble ddata) /* IN: double */
{
- jbyteArray rarray;
+ jbyteArray rarray = NULL;
jboolean bb;
jbyte *barray = NULL;
jbyte *bap = NULL;
@@ -1019,7 +1019,7 @@ JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_longToByte__J
(JNIEnv *env, jclass clss, jlong ldata) /* IN: long */
{
- jbyteArray rarray;
+ jbyteArray rarray = NULL;
jboolean bb;
jbyte *barray = NULL;
jbyte *bap = NULL;
@@ -1055,7 +1055,7 @@ JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToByte__B
(JNIEnv *env, jclass clss, jbyte bdata) /* IN: byte */
{
- jbyteArray rarray;
+ jbyteArray rarray = NULL;
jboolean bb;
jbyte *barray = NULL;
jbyte *bap = NULL;